@maudecode/cove 2026.2.19 → 2026.3.2

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.
@@ -1,21 +1,21 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/400-lAWKXRoJ.css","assets/500-CRBx2u7m.css","assets/600-BRVR-SPy.css","assets/400-WFOKBYV6.css","assets/500-C9oGlv8Y.css","assets/600-B7Ikl3KO.css","assets/400-Bigd7ufU.css","assets/400-DIm2vEr-.css","assets/500-QKfiiXYO.css","assets/600-D8Jk2OB9.css","assets/400-QlzHorXL.css","assets/500-DnnFFs0Q.css","assets/600-BmBzHULK.css","assets/400-BMkBL_OY.css","assets/500-CQUBMBhA.css","assets/600-C2ZgMpi4.css"])))=>i.map(i=>d[i]);
2
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function a(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=a(o);fetch(o.href,s)}})();var vl,J,sg,lg,za,kp,ig,cg,ug,Eh,cd,ud,dg,js={},hg=[],l0=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,gl=Array.isArray;function Cn(e,t){for(var a in t)e[a]=t[a];return e}function Ah(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function nn(e,t,a){var r,o,s,i={};for(s in t)s=="key"?r=t[s]:s=="ref"?o=t[s]:i[s]=t[s];if(arguments.length>2&&(i.children=arguments.length>3?vl.call(arguments,2):a),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)i[s]===void 0&&(i[s]=e.defaultProps[s]);return hs(e,i,r,o,null)}function hs(e,t,a,r,o){var s={type:e,props:t,key:a,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++sg,__i:-1,__u:0};return o==null&&J.vnode!=null&&J.vnode(s),s}function H(e){return e.children}function At(e,t){this.props=e,this.context=t}function lo(e,t){if(t==null)return e.__?lo(e.__,e.__i+1):null;for(var a;t<e.__k.length;t++)if((a=e.__k[t])!=null&&a.__e!=null)return a.__e;return typeof e.type=="function"?lo(e):null}function fg(e){var t,a;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((a=e.__k[t])!=null&&a.__e!=null){e.__e=e.__c.base=a.__e;break}return fg(e)}}function dd(e){(!e.__d&&(e.__d=!0)&&za.push(e)&&!Ji.__r++||kp!=J.debounceRendering)&&((kp=J.debounceRendering)||ig)(Ji)}function Ji(){for(var e,t,a,r,o,s,i,c=1;za.length;)za.length>c&&za.sort(cg),e=za.shift(),c=za.length,e.__d&&(a=void 0,r=void 0,o=(r=(t=e).__v).__e,s=[],i=[],t.__P&&((a=Cn({},r)).__v=r.__v+1,J.vnode&&J.vnode(a),Mh(t.__P,a,r,t.__n,t.__P.namespaceURI,32&r.__u?[o]:null,s,o??lo(r),!!(32&r.__u),i),a.__v=r.__v,a.__.__k[a.__i]=a,vg(s,a,i),r.__e=r.__=null,a.__e!=o&&fg(a)));Ji.__r=0}function pg(e,t,a,r,o,s,i,c,u,d,h){var f,p,v,w,C,T,b,g=r&&r.__k||hg,y=t.length;for(u=i0(a,t,g,u,y),f=0;f<y;f++)(v=a.__k[f])!=null&&(p=v.__i==-1?js:g[v.__i]||js,v.__i=f,T=Mh(e,v,p,o,s,i,c,u,d,h),w=v.__e,v.ref&&p.ref!=v.ref&&(p.ref&&Ih(p.ref,null,v),h.push(v.ref,v.__c||w,v)),C==null&&w!=null&&(C=w),(b=!!(4&v.__u))||p.__k===v.__k?u=mg(v,u,e,b):typeof v.type=="function"&&T!==void 0?u=T:w&&(u=w.nextSibling),v.__u&=-7);return a.__e=C,u}function i0(e,t,a,r,o){var s,i,c,u,d,h=a.length,f=h,p=0;for(e.__k=new Array(o),s=0;s<o;s++)(i=t[s])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[s]=hs(null,i,null,null,null):gl(i)?i=e.__k[s]=hs(H,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[s]=hs(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[s]=i,u=s+p,i.__=e,i.__b=e.__b+1,c=null,(d=i.__i=c0(i,a,u,f))!=-1&&(f--,(c=a[d])&&(c.__u|=2)),c==null||c.__v==null?(d==-1&&(o>h?p--:o<h&&p++),typeof i.type!="function"&&(i.__u|=4)):d!=u&&(d==u-1?p--:d==u+1?p++:(d>u?p--:p++,i.__u|=4))):e.__k[s]=null;if(f)for(s=0;s<h;s++)(c=a[s])!=null&&(2&c.__u)==0&&(c.__e==r&&(r=lo(c)),bg(c,c));return r}function mg(e,t,a,r){var o,s;if(typeof e.type=="function"){for(o=e.__k,s=0;o&&s<o.length;s++)o[s]&&(o[s].__=e,t=mg(o[s],t,a,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=lo(e)),a.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ir(e,t){return t=t||[],e==null||typeof e=="boolean"||(gl(e)?e.some(function(a){ir(a,t)}):t.push(e)),t}function c0(e,t,a,r){var o,s,i,c=e.key,u=e.type,d=t[a],h=d!=null&&(2&d.__u)==0;if(d===null&&c==null||h&&c==d.key&&u==d.type)return a;if(r>(h?1:0)){for(o=a-1,s=a+1;o>=0||s<t.length;)if((d=t[i=o>=0?o--:s++])!=null&&(2&d.__u)==0&&c==d.key&&u==d.type)return i}return-1}function Sp(e,t,a){t[0]=="-"?e.setProperty(t,a??""):e[t]=a==null?"":typeof a!="number"||l0.test(t)?a:a+"px"}function Kl(e,t,a,r,o){var s,i;e:if(t=="style")if(typeof a=="string")e.style.cssText=a;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)a&&t in a||Sp(e.style,t,"");if(a)for(t in a)r&&a[t]==r[t]||Sp(e.style,t,a[t])}else if(t[0]=="o"&&t[1]=="n")s=t!=(t=t.replace(ug,"$1")),i=t.toLowerCase(),t=i in e||t=="onFocusOut"||t=="onFocusIn"?i.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=a,a?r?a.u=r.u:(a.u=Eh,e.addEventListener(t,s?ud:cd,s)):e.removeEventListener(t,s?ud:cd,s);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]=a??"";break e}catch{}typeof a=="function"||(a==null||a===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&a==1?"":a))}}function _p(e){return function(t){if(this.l){var a=this.l[t.type+e];if(t.t==null)t.t=Eh++;else if(t.t<a.u)return;return a(J.event?J.event(t):t)}}}function Mh(e,t,a,r,o,s,i,c,u,d){var h,f,p,v,w,C,T,b,g,y,E,x,S,k,I,A,O,z=t.type;if(t.constructor!==void 0)return null;128&a.__u&&(u=!!(32&a.__u),s=[c=t.__e=a.__e]),(h=J.__b)&&h(t);e:if(typeof z=="function")try{if(b=t.props,g="prototype"in z&&z.prototype.render,y=(h=z.contextType)&&r[h.__c],E=h?y?y.props.value:h.__:r,a.__c?T=(f=t.__c=a.__c).__=f.__E:(g?t.__c=f=new z(b,E):(t.__c=f=new At(b,E),f.constructor=z,f.render=d0),y&&y.sub(f),f.state||(f.state={}),f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),g&&f.__s==null&&(f.__s=f.state),g&&z.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Cn({},f.__s)),Cn(f.__s,z.getDerivedStateFromProps(b,f.__s))),v=f.props,w=f.state,f.__v=t,p)g&&z.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),g&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(g&&z.getDerivedStateFromProps==null&&b!==v&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(b,E),t.__v==a.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(b,f.__s,E)===!1){for(t.__v!=a.__v&&(f.props=b,f.state=f.__s,f.__d=!1),t.__e=a.__e,t.__k=a.__k,t.__k.some(function(se){se&&(se.__=t)}),x=0;x<f._sb.length;x++)f.__h.push(f._sb[x]);f._sb=[],f.__h.length&&i.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(b,f.__s,E),g&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(v,w,C)})}if(f.context=E,f.props=b,f.__P=e,f.__e=!1,S=J.__r,k=0,g){for(f.state=f.__s,f.__d=!1,S&&S(t),h=f.render(f.props,f.state,f.context),I=0;I<f._sb.length;I++)f.__h.push(f._sb[I]);f._sb=[]}else do f.__d=!1,S&&S(t),h=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(r=Cn(Cn({},r),f.getChildContext())),g&&!p&&f.getSnapshotBeforeUpdate!=null&&(C=f.getSnapshotBeforeUpdate(v,w)),A=h,h!=null&&h.type===H&&h.key==null&&(A=gg(h.props.children)),c=pg(e,gl(A)?A:[A],t,a,r,o,s,i,c,u,d),f.base=t.__e,t.__u&=-161,f.__h.length&&i.push(f),T&&(f.__E=f.__=null)}catch(se){if(t.__v=null,u||s!=null)if(se.then){for(t.__u|=u?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,t.__e=c}else{for(O=s.length;O--;)Ah(s[O]);hd(t)}else t.__e=a.__e,t.__k=a.__k,se.then||hd(t);J.__e(se,t,a)}else s==null&&t.__v==a.__v?(t.__k=a.__k,t.__e=a.__e):c=t.__e=u0(a.__e,t,a,r,o,s,i,u,d);return(h=J.diffed)&&h(t),128&t.__u?void 0:c}function hd(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(hd)}function vg(e,t,a){for(var r=0;r<a.length;r++)Ih(a[r],a[++r],a[++r]);J.__c&&J.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(s){s.call(o)})}catch(s){J.__e(s,o.__v)}})}function gg(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:gl(e)?e.map(gg):Cn({},e)}function u0(e,t,a,r,o,s,i,c,u){var d,h,f,p,v,w,C,T=a.props||js,b=t.props,g=t.type;if(g=="svg"?o="http://www.w3.org/2000/svg":g=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),s!=null){for(d=0;d<s.length;d++)if((v=s[d])&&"setAttribute"in v==!!g&&(g?v.localName==g:v.nodeType==3)){e=v,s[d]=null;break}}if(e==null){if(g==null)return document.createTextNode(b);e=document.createElementNS(o,g,b.is&&b),c&&(J.__m&&J.__m(t,s),c=!1),s=null}if(g==null)T===b||c&&e.data==b||(e.data=b);else{if(s=s&&vl.call(e.childNodes),!c&&s!=null)for(T={},d=0;d<e.attributes.length;d++)T[(v=e.attributes[d]).name]=v.value;for(d in T)if(v=T[d],d!="children"){if(d=="dangerouslySetInnerHTML")f=v;else if(!(d in b)){if(d=="value"&&"defaultValue"in b||d=="checked"&&"defaultChecked"in b)continue;Kl(e,d,null,v,o)}}for(d in b)v=b[d],d=="children"?p=v:d=="dangerouslySetInnerHTML"?h=v:d=="value"?w=v:d=="checked"?C=v:c&&typeof v!="function"||T[d]===v||Kl(e,d,v,T[d],o);if(h)c||f&&(h.__html==f.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(f&&(e.innerHTML=""),pg(t.type=="template"?e.content:e,gl(p)?p:[p],t,a,r,g=="foreignObject"?"http://www.w3.org/1999/xhtml":o,s,i,s?s[0]:a.__k&&lo(a,0),c,u),s!=null)for(d=s.length;d--;)Ah(s[d]);c||(d="value",g=="progress"&&w==null?e.removeAttribute("value"):w!=null&&(w!==e[d]||g=="progress"&&!w||g=="option"&&w!=T[d])&&Kl(e,d,w,T[d],o),d="checked",C!=null&&C!=e[d]&&Kl(e,d,C,T[d],o))}return e}function Ih(e,t,a){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(o){J.__e(o,a)}}function bg(e,t,a){var r,o;if(J.unmount&&J.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Ih(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){J.__e(s,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&bg(r[o],t,a||typeof e.type!="function");a||Ah(e.__e),e.__c=e.__=e.__e=void 0}function d0(e,t,a){return this.constructor(e,a)}function fd(e,t,a){var r,o,s,i;t==document&&(t=document.documentElement),J.__&&J.__(e,t),o=(r=!1)?null:t.__k,s=[],i=[],Mh(t,e=t.__k=nn(H,null,[e]),o||js,js,t.namespaceURI,o?null:t.firstChild?vl.call(t.childNodes):null,s,o?o.__e:t.firstChild,r,i),vg(s,e,i)}function h0(e,t,a){var r,o,s,i,c=Cn({},e.props);for(s in e.type&&e.type.defaultProps&&(i=e.type.defaultProps),t)s=="key"?r=t[s]:s=="ref"?o=t[s]:c[s]=t[s]===void 0&&i!=null?i[s]:t[s];return arguments.length>2&&(c.children=arguments.length>3?vl.call(arguments,2):a),hs(e.type,c,r||e.key,o||e.ref,null)}function xg(e){function t(a){var r,o;return this.getChildContext||(r=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(s){this.props.value!=s.value&&r.forEach(function(i){i.__e=!0,dd(i)})},this.sub=function(s){r.add(s);var i=s.componentWillUnmount;s.componentWillUnmount=function(){r&&r.delete(s),i&&i.call(s)}}),a.children}return t.__c="__cC"+dg++,t.__=e,t.Provider=t.__l=(t.Consumer=function(a,r){return a.children(r)}).contextType=t,t}vl=hg.slice,J={__e:function(e,t,a,r){for(var o,s,i;t=t.__;)if((o=t.__c)&&!o.__)try{if((s=o.constructor)&&s.getDerivedStateFromError!=null&&(o.setState(s.getDerivedStateFromError(e)),i=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),i=o.__d),i)return o.__E=o}catch(c){e=c}throw e}},sg=0,lg=function(e){return e!=null&&e.constructor===void 0},At.prototype.setState=function(e,t){var a;a=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Cn({},this.state),typeof e=="function"&&(e=e(Cn({},a),this.props)),e&&Cn(a,e),e!=null&&this.__v&&(t&&this._sb.push(t),dd(this))},At.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),dd(this))},At.prototype.render=H,za=[],ig=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,cg=function(e,t){return e.__v.__b-t.__v.__b},Ji.__r=0,ug=/(PointerCapture)$|Capture$/i,Eh=0,cd=_p(!1),ud=_p(!0),dg=0;var f0=0;function n(e,t,a,r,o,s){t||(t={});var i,c,u=t;if("ref"in u)for(c in u={},t)c=="ref"?i=t[c]:u[c]=t[c];var d={type:e,props:u,key:a,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--f0,__i:-1,__u:0,__source:o,__self:s};if(typeof e=="function"&&(i=e.defaultProps))for(c in i)u[c]===void 0&&(u[c]=i[c]);return J.vnode&&J.vnode(d),d}const p0="modulepreload",m0=function(e){return"/"+e},Cp={},Te=function(t,a,r){let o=Promise.resolve();if(a&&a.length>0){let u=function(d){return Promise.all(d.map(h=>Promise.resolve(h).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=i?.nonce||i?.getAttribute("nonce");o=u(a.map(d=>{if(d=m0(d),d in Cp)return;Cp[d]=!0;const h=d.endsWith(".css"),f=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${f}`))return;const p=document.createElement("link");if(p.rel=h?"stylesheet":p0,h||(p.as="script"),p.crossOrigin="",p.href=d,c&&p.setAttribute("nonce",c),document.head.appendChild(p),h)return new Promise((v,w)=>{p.addEventListener("load",v),p.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return o.then(i=>{for(const c of i||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};var cr,pe,Eu,Tp,Hs=0,yg=[],ke=J,Ep=ke.__b,Ap=ke.__r,Mp=ke.diffed,Ip=ke.__c,Rp=ke.unmount,Lp=ke.__;function bl(e,t){ke.__h&&ke.__h(pe,e,Hs||t),Hs=0;var a=pe.__H||(pe.__H={__:[],__h:[]});return e>=a.__.length&&a.__.push({}),a.__[e]}function U(e){return Hs=1,v0(kg,e)}function v0(e,t,a){var r=bl(cr++,2);if(r.t=e,!r.__c&&(r.__=[a?a(t):kg(void 0,t),function(c){var u=r.__N?r.__N[0]:r.__[0],d=r.t(u,c);u!==d&&(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=pe,!pe.__f)){var o=function(c,u,d){if(!r.__c.__H)return!0;var h=r.__c.__H.__.filter(function(p){return!!p.__c});if(h.every(function(p){return!p.__N}))return!s||s.call(this,c,u,d);var f=r.__c.props!==c;return h.forEach(function(p){if(p.__N){var v=p.__[0];p.__=p.__N,p.__N=void 0,v!==p.__[0]&&(f=!0)}}),s&&s.call(this,c,u,d)||f};pe.__f=!0;var s=pe.shouldComponentUpdate,i=pe.componentWillUpdate;pe.componentWillUpdate=function(c,u,d){if(this.__e){var h=s;s=void 0,o(c,u,d),s=h}i&&i.call(this,c,u,d)},pe.shouldComponentUpdate=o}return r.__N||r.__}function R(e,t){var a=bl(cr++,3);!ke.__s&&Lh(a.__H,t)&&(a.__=e,a.u=t,pe.__H.__h.push(a))}function Rh(e,t){var a=bl(cr++,4);!ke.__s&&Lh(a.__H,t)&&(a.__=e,a.u=t,pe.__h.push(a))}function F(e){return Hs=5,xe(function(){return{current:e}},[])}function xe(e,t){var a=bl(cr++,7);return Lh(a.__H,t)&&(a.__=e(),a.__H=t,a.__h=e),a.__}function Q(e,t){return Hs=8,xe(function(){return e},t)}function wg(e){var t=pe.context[e.__c],a=bl(cr++,9);return a.c=e,t?(a.__==null&&(a.__=!0,t.sub(pe)),t.props.value):e.__}function g0(){for(var e;e=yg.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ki),e.__H.__h.forEach(pd),e.__H.__h=[]}catch(t){e.__H.__h=[],ke.__e(t,e.__v)}}ke.__b=function(e){pe=null,Ep&&Ep(e)},ke.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Lp&&Lp(e,t)},ke.__r=function(e){Ap&&Ap(e),cr=0;var t=(pe=e.__c).__H;t&&(Eu===pe?(t.__h=[],pe.__h=[],t.__.forEach(function(a){a.__N&&(a.__=a.__N),a.u=a.__N=void 0})):(t.__h.forEach(ki),t.__h.forEach(pd),t.__h=[],cr=0)),Eu=pe},ke.diffed=function(e){Mp&&Mp(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(yg.push(t)!==1&&Tp===ke.requestAnimationFrame||((Tp=ke.requestAnimationFrame)||b0)(g0)),t.__H.__.forEach(function(a){a.u&&(a.__H=a.u),a.u=void 0})),Eu=pe=null},ke.__c=function(e,t){t.some(function(a){try{a.__h.forEach(ki),a.__h=a.__h.filter(function(r){return!r.__||pd(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],ke.__e(r,a.__v)}}),Ip&&Ip(e,t)},ke.unmount=function(e){Rp&&Rp(e);var t,a=e.__c;a&&a.__H&&(a.__H.__.forEach(function(r){try{ki(r)}catch(o){t=o}}),a.__H=void 0,t&&ke.__e(t,a.__v))};var $p=typeof requestAnimationFrame=="function";function b0(e){var t,a=function(){clearTimeout(r),$p&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(a,35);$p&&(t=requestAnimationFrame(a))}function ki(e){var t=pe,a=e.__c;typeof a=="function"&&(e.__c=void 0,a()),pe=t}function pd(e){var t=pe;e.__c=e.__(),pe=t}function Lh(e,t){return!e||e.length!==t.length||t.some(function(a,r){return a!==e[r]})}function kg(e,t){return typeof t=="function"?t(e):t}var x0=Symbol.for("preact-signals");function Fc(){if(ha>1)ha--;else{for(var e,t=!1;fs!==void 0;){var a=fs;for(fs=void 0,md++;a!==void 0;){var r=a.o;if(a.o=void 0,a.f&=-3,!(8&a.f)&&Cg(a))try{a.c()}catch(o){t||(e=o,t=!0)}a=r}}if(md=0,ha--,t)throw e}}function zc(e){if(ha>0)return e();ha++;try{return e()}finally{Fc()}}var oe=void 0;function Sg(e){var t=oe;oe=void 0;try{return e()}finally{oe=t}}var fs=void 0,ha=0,md=0,Yi=0;function _g(e){if(oe!==void 0){var t=e.n;if(t===void 0||t.t!==oe)return t={i:0,S:e,p:oe.s,n:void 0,t:oe,e:void 0,x:void 0,r:t},oe.s!==void 0&&(oe.s.n=t),oe.s=t,e.n=t,32&oe.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=oe.s,t.n=void 0,oe.s.n=t,oe.s=t),t}}function qe(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}qe.prototype.brand=x0;qe.prototype.h=function(){return!0};qe.prototype.S=function(e){var t=this,a=this.t;a!==e&&e.e===void 0&&(e.x=a,this.t=e,a!==void 0?a.e=e:Sg(function(){var r;(r=t.W)==null||r.call(t)}))};qe.prototype.U=function(e){var t=this;if(this.t!==void 0){var a=e.e,r=e.x;a!==void 0&&(a.x=r,e.e=void 0),r!==void 0&&(r.e=a,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&Sg(function(){var o;(o=t.Z)==null||o.call(t)}))}};qe.prototype.subscribe=function(e){var t=this;return Se(function(){var a=t.value,r=oe;oe=void 0;try{e(a)}finally{oe=r}},{name:"sub"})};qe.prototype.valueOf=function(){return this.value};qe.prototype.toString=function(){return this.value+""};qe.prototype.toJSON=function(){return this.value};qe.prototype.peek=function(){var e=oe;oe=void 0;try{return this.value}finally{oe=e}};Object.defineProperty(qe.prototype,"value",{get:function(){var e=_g(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(md>100)throw new Error("Cycle detected");this.v=e,this.i++,Yi++,ha++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Fc()}}}});function m(e,t){return new qe(e,t)}function Cg(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 Tg(e){for(var t=e.s;t!==void 0;t=t.n){var a=t.S.n;if(a!==void 0&&(t.r=a),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Eg(e){for(var t=e.s,a=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):a=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=a}function Tr(e,t){qe.call(this,void 0),this.x=e,this.s=void 0,this.g=Yi-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Tr.prototype=new qe;Tr.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Yi))return!0;if(this.g=Yi,this.f|=1,this.i>0&&!Cg(this))return this.f&=-2,!0;var e=oe;try{Tg(this),oe=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(a){this.v=a,this.f|=16,this.i++}return oe=e,Eg(this),this.f&=-2,!0};Tr.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)}qe.prototype.S.call(this,e)};Tr.prototype.U=function(e){if(this.t!==void 0&&(qe.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)}};Tr.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(Tr.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=_g(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function K(e,t){return new Tr(e,t)}function Ag(e){var t=e.u;if(e.u=void 0,typeof t=="function"){ha++;var a=oe;oe=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,$h(e),r}finally{oe=a,Fc()}}}function $h(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Ag(e)}function y0(e){if(oe!==this)throw new Error("Out-of-order effect");Eg(this),oe=e,this.f&=-2,8&this.f&&$h(this),Fc()}function Eo(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}Eo.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()}};Eo.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Ag(this),Tg(this),ha++;var e=oe;return oe=this,y0.bind(this,e)};Eo.prototype.N=function(){2&this.f||(this.f|=2,this.o=fs,fs=this)};Eo.prototype.d=function(){this.f|=8,1&this.f||$h(this)};Eo.prototype.dispose=function(){this.d()};function Se(e,t){var a=new Eo(e,t);try{a.c()}catch(o){throw a.d(),o}var r=a.d.bind(a);return r[Symbol.dispose]=r,r}var Dh,Uc,ql,w0=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,Mg=[],Ig=[];Se(function(){Dh=this.N})();function Ao(e,t){J[e]=t.bind(null,J[e]||function(){})}function Zi(e){if(ql){var t=ql;ql=void 0,t()}ql=e&&e.S()}function Rg(e){var t=this,a=e.data,r=X(a);r.value=a;var o=xe(function(){for(var c=t,u=t.__v;u=u.__;)if(u.__c){u.__c.__$f|=4;break}var d=K(function(){var v=r.value.value;return v===0?0:v===!0?"":v||""}),h=K(function(){return!Array.isArray(d.value)&&!lg(d.value)}),f=Se(function(){if(this.N=Lg,h.value){var v=d.value;c.__v&&c.__v.__e&&c.__v.__e.nodeType===3&&(c.__v.__e.data=v)}}),p=t.__$u.d;return t.__$u.d=function(){f(),p.call(this)},[h,d]},[]),s=o[0],i=o[1];return s.value?i.peek():i.value}Rg.displayName="ReactiveTextNode";Object.defineProperties(qe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Rg},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Ao("__b",function(e,t){if(typeof t.type=="string"){var a,r=t.props;for(var o in r)if(o!=="children"){var s=r[o];s instanceof qe&&(a||(t.__np=a={}),a[o]=s,r[o]=s.peek())}}e(t)});Ao("__r",function(e,t){if(e(t),t.type!==H){Zi();var a,r=t.__c;r&&(r.__$f&=-2,(a=r.__$u)===void 0&&(r.__$u=a=(function(o,s){var i;return Se(function(){i=this},{name:s}),i.c=o,i})(function(){var o;w0&&((o=a.y)==null||o.call(a)),r.__$f|=1,r.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),Uc=r,Zi(a)}});Ao("__e",function(e,t,a,r){Zi(),Uc=void 0,e(t,a,r)});Ao("diffed",function(e,t){Zi(),Uc=void 0;var a;if(typeof t.type=="string"&&(a=t.__e)){var r=t.__np,o=t.props;if(r){var s=a.U;if(s)for(var i in s){var c=s[i];c!==void 0&&!(i in r)&&(c.d(),s[i]=void 0)}else s={},a.U=s;for(var u in r){var d=s[u],h=r[u];d===void 0?(d=k0(a,u,h),s[u]=d):d.o(h,o)}for(var f in r)o[f]=r[f]}}e(t)});function k0(e,t,a,r){var o=t in e&&e.ownerSVGElement===void 0,s=m(a),i=a.peek();return{o:function(c,u){s.value=c,i=c.peek()},d:Se(function(){this.N=Lg;var c=s.value.value;i!==c?(i=void 0,o?e[t]=c:c!=null&&(c!==!1||t[4]==="-")?e.setAttribute(t,c):e.removeAttribute(t)):i=void 0})}}Ao("unmount",function(e,t){if(typeof t.type=="string"){var a=t.__e;if(a){var r=a.U;if(r){a.U=void 0;for(var o in r){var s=r[o];s&&s.d()}}}t.__np=void 0}else{var i=t.__c;if(i){var c=i.__$u;c&&(i.__$u=void 0,c.d())}}e(t)});Ao("__h",function(e,t,a,r){(r<3||r===9)&&(t.__$f|=2),e(t,a,r)});At.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var a=this.__$u,r=a&&a.s!==void 0;for(var o in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var s=2&this.__$f;if(!(r||s||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var i in e)if(i!=="__source"&&e[i]!==this.props[i])return!0;for(var c in this.props)if(!(c in e))return!0;return!1};function X(e,t){return xe(function(){return m(e,t)},[])}function jc(e,t){var a=F(e);return a.current=e,Uc.__$f|=4,xe(function(){return K(function(){return a.current()},t)},[])}var S0=typeof requestAnimationFrame>"u"?setTimeout:function(e){var t=function(){clearTimeout(a),cancelAnimationFrame(r),e()},a=setTimeout(t,35),r=requestAnimationFrame(t)},_0=function(e){queueMicrotask(function(){queueMicrotask(e)})};function C0(){zc(function(){for(var e;e=Mg.shift();)Dh.call(e)})}function T0(){Mg.push(this)===1&&(J.requestAnimationFrame||S0)(C0)}function E0(){zc(function(){for(var e;e=Ig.shift();)Dh.call(e)})}function Lg(){Ig.push(this)===1&&(J.requestAnimationFrame||_0)(E0)}function vd(e,t){var a=F(e);a.current=e,R(function(){return Se(function(){return this.N=T0,a.current()},t)},[])}var A0={};function as(e,t){for(var a in t)e[a]=t[a];return e}function gd(e,t,a){var r,o=/(?:\?([^#]*))?(#.*)?$/,s=e.match(o),i={};if(s&&s[1])for(var c=s[1].split("&"),u=0;u<c.length;u++){var d=c[u].split("=");i[decodeURIComponent(d[0])]=decodeURIComponent(d.slice(1).join("="))}e=bd(e.replace(o,"")),t=bd(t||"");for(var h=Math.max(e.length,t.length),f=0;f<h;f++)if(t[f]&&t[f].charAt(0)===":"){var p=t[f].replace(/(^:|[+*?]+$)/g,""),v=(t[f].match(/[+*?]+$/)||A0)[0]||"",w=~v.indexOf("+"),C=~v.indexOf("*"),T=e[f]||"";if(!T&&!C&&(v.indexOf("?")<0||w)){r=!1;break}if(i[p]=decodeURIComponent(T),w||C){i[p]=e.slice(f).map(decodeURIComponent).join("/");break}}else if(t[f]!==e[f]){r=!1;break}return(a.default===!0||r!==!1)&&i}function M0(e,t){return e.rank<t.rank?1:e.rank>t.rank?-1:e.index-t.index}function I0(e,t){return e.index=t,e.rank=(function(a){return a.props.default?0:bd(a.props.path).map(R0).join("")})(e),e.props}function bd(e){return e.replace(/(^\/+|\/+$)/g,"").split("/")}function R0(e){return e.charAt(0)==":"?1+"*+?".indexOf(e.charAt(e.length-1))||4:5}var L0={},Qa=[],ps=[],St=null,Ph={url:Hc()},$g=xg(Ph);function $0(){var e=wg($g);if(e===Ph){var t=U()[1];R(function(){return ps.push(t),function(){return ps.splice(ps.indexOf(t),1)}},[])}return[e,Oe]}function Hc(){var e;return""+((e=St&&St.location?St.location:St&&St.getCurrentLocation?St.getCurrentLocation():typeof location<"u"?location:L0).pathname||"")+(e.search||"")}function Oe(e,t){return t===void 0&&(t=!1),typeof e!="string"&&e.url&&(t=e.replace,e=e.url),(function(a){for(var r=Qa.length;r--;)if(Qa[r].canRoute(a))return!0;return!1})(e)&&(function(a,r){r===void 0&&(r="push"),St&&St[r]?St[r](a):typeof history<"u"&&history[r+"State"]&&history[r+"State"](null,null,a)})(e,t?"replace":"push"),Dg(e)}function Dg(e){for(var t=!1,a=0;a<Qa.length;a++)Qa[a].routeTo(e)&&(t=!0);return t}function D0(e){if(e&&e.getAttribute){var t=e.getAttribute("href"),a=e.getAttribute("target");if(t&&t.match(/^\//g)&&(!a||a.match(/^_?self$/i)))return Oe(t)}}function P0(e){return e.stopImmediatePropagation&&e.stopImmediatePropagation(),e.stopPropagation&&e.stopPropagation(),e.preventDefault(),!1}function Pg(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(D0(t))return P0(e)}while(t=t.parentNode)}}var Dp=!1;function Og(e){e.history&&(St=e.history),this.state={url:e.url||Hc()}}as(Og.prototype=new At,{shouldComponentUpdate:function(e){return e.static!==!0||e.url!==this.props.url||e.onChange!==this.props.onChange},canRoute:function(e){var t=ir(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;Dp||(Dp=!0,St||addEventListener("popstate",function(){Dg(Hc())}),addEventListener("click",Pg)),Qa.push(this),St&&(this.u=St.listen(function(t){var a=t.location||t;e.routeTo(""+(a.pathname||"")+(a.search||""))})),this.p=!1},componentWillUnmount:function(){typeof this.u=="function"&&this.u(),Qa.splice(Qa.indexOf(this),1)},componentWillUpdate:function(){this.p=!0},componentDidUpdate:function(){this.p=!1},g:function(e,t){e=e.filter(I0).sort(M0);for(var a=0;a<e.length;a++){var r=e[a],o=gd(t,r.props.path,r.props);if(o)return[r,o]}},render:function(e,t){var a,r,o=e.onChange,s=t.url,i=this.c,c=this.g(ir(e.children),s);if(c&&(r=h0(c[0],as(as({url:s,matches:a=c[1]},a),{key:void 0,ref:void 0}))),s!==(i&&i.url)){as(Ph,i=this.c={url:s,previous:i&&i.url,current:r,path:r?r.props.path:null,matches:a}),i.router=this,i.active=r?[r]:[];for(var u=ps.length;u--;)ps[u]({});typeof o=="function"&&o(i)}return nn($g.Provider,{value:i},r)}});var O0=function(e){return nn("a",as({onClick:Pg},e))};const N0={bgPrimary:"--color-bg-primary",bgSecondary:"--color-bg-secondary",bgTertiary:"--color-bg-tertiary",bgSurface:"--color-bg-surface",bgElevated:"--color-bg-elevated",bgHover:"--color-bg-hover",bgActive:"--color-bg-active",textPrimary:"--color-text-primary",textSecondary:"--color-text-secondary",textTertiary:"--color-text-tertiary",textMuted:"--color-text-muted",textInverse:"--color-text-inverse",accent:"--color-accent",accentHover:"--color-accent-hover",accentActive:"--color-accent-active",accentMuted:"--color-accent-muted",accentText:"--color-accent-text",success:"--color-success",successMuted:"--color-success-muted",warning:"--color-warning",warningMuted:"--color-warning-muted",error:"--color-error",errorMuted:"--color-error-muted",info:"--color-info",infoMuted:"--color-info-muted",border:"--color-border",borderHover:"--color-border-hover",borderFocus:"--color-border-focus",shadowSm:"--shadow-sm",shadowMd:"--shadow-md",shadowLg:"--shadow-lg",syntaxComment:"--color-syntax-comment",syntaxString:"--color-syntax-string",syntaxKeyword:"--color-syntax-keyword",syntaxFunction:"--color-syntax-function",syntaxNumber:"--color-syntax-number",syntaxOperator:"--color-syntax-operator",syntaxVariable:"--color-syntax-variable",syntaxPunctuation:"--color-syntax-punctuation",syntaxProperty:"--color-syntax-property",syntaxTag:"--color-syntax-tag",syntaxClass:"--color-syntax-class"},Ng=Object.entries(N0),F0=Ng.reduce((e,[t,a])=>(e[a]=t,e),{});function Fg(e){const t={};for(const[a,r]of Ng)t[r]=e[a];return t}function z0(e){const t={};for(const[a,r]of Object.entries(F0))t[r]=e[a];return t}function Ie(e){return{...e,colors:Fg(e.tokens)}}function U0(e){return"tokens"in e?{...e,colors:Fg(e.tokens)}:{...e,tokens:z0(e.colors)}}const Pp={selected:"system",lightTheme:"light",darkTheme:"dark"},j0=Ie({id:"light",name:"Light",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#ffffff",bgSecondary:"#f1f5f9",bgTertiary:"#e2e8f0",bgSurface:"#f8fafc",bgElevated:"#ffffff",bgHover:"#f1f5f9",bgActive:"#e2e8f0",textPrimary:"#0f172a",textSecondary:"#475569",textTertiary:"#64748b",textMuted:"#94a3b8",textInverse:"#f8fafc",accent:"#e11d48",accentHover:"#be123c",accentActive:"#9f1239",accentMuted:"#ffe4e6",accentText:"#ffffff",success:"#16a34a",successMuted:"#dcfce7",warning:"#d97706",warningMuted:"#fef3c7",error:"#dc2626",errorMuted:"#fee2e2",info:"#0284c7",infoMuted:"#e0f2fe",border:"#e2e8f0",borderHover:"#cbd5e1",borderFocus:"#e11d48",shadowSm:"0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.12), 0 4px 6px -4px rgb(0 0 0 / 0.1)",syntaxComment:"#a0a1a7",syntaxString:"#50a14f",syntaxKeyword:"#a626a4",syntaxFunction:"#4078f2",syntaxNumber:"#986801",syntaxOperator:"#0184bc",syntaxVariable:"#e45649",syntaxPunctuation:"#383a42",syntaxProperty:"#e45649",syntaxTag:"#e45649",syntaxClass:"#c18401"}}),H0=Ie({id:"dark",name:"Dark",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#0f0f12",bgSecondary:"#0a0a0c",bgTertiary:"#161619",bgSurface:"#1a1a1f",bgElevated:"#222228",bgHover:"#2a2a32",bgActive:"#363640",textPrimary:"#f4f4f5",textSecondary:"#a1a1aa",textTertiary:"#71717a",textMuted:"#52525b",textInverse:"#09090b",accent:"#f97066",accentHover:"#ef5a50",accentActive:"#dc4840",accentMuted:"#5c2320",accentText:"#ffffff",success:"#22c55e",successMuted:"#14532d",warning:"#f59e0b",warningMuted:"#451a03",error:"#f43f5e",errorMuted:"#4c0519",info:"#38bdf8",infoMuted:"#0c4a6e",border:"#252530",borderHover:"#3f3f4a",borderFocus:"#f97066",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#5c6370",syntaxString:"#98c379",syntaxKeyword:"#c678dd",syntaxFunction:"#61afef",syntaxNumber:"#d19a66",syntaxOperator:"#56b6c2",syntaxVariable:"#e06c75",syntaxPunctuation:"#abb2bf",syntaxProperty:"#e06c75",syntaxTag:"#e06c75",syntaxClass:"#e5c07b"}}),B0=Ie({id:"dracula",name:"Dracula",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#282a36",bgSecondary:"#1e1f29",bgTertiary:"#191a23",bgSurface:"#343746",bgElevated:"#44475a",bgHover:"#3c3f52",bgActive:"#44475a",textPrimary:"#f8f8f2",textSecondary:"#e6e6e0",textTertiary:"#bfbfb8",textMuted:"#6272a4",textInverse:"#282a36",accent:"#bd93f9",accentHover:"#caa9fa",accentActive:"#a67bf5",accentMuted:"#3d3560",accentText:"#282a36",success:"#50fa7b",successMuted:"#1f3528",warning:"#f1fa8c",warningMuted:"#35351f",error:"#ff5555",errorMuted:"#402020",info:"#8be9fd",infoMuted:"#1f3538",border:"#44475a",borderHover:"#565970",borderFocus:"#bd93f9",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#6272a4",syntaxString:"#f1fa8c",syntaxKeyword:"#ff79c6",syntaxFunction:"#50fa7b",syntaxNumber:"#bd93f9",syntaxOperator:"#ff79c6",syntaxVariable:"#f8f8f2",syntaxPunctuation:"#f8f8f2",syntaxProperty:"#66d9ef",syntaxTag:"#ff79c6",syntaxClass:"#8be9fd"}}),W0=Ie({id:"catppuccin-mocha",name:"Catppuccin Mocha",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#1e1e2e",bgSecondary:"#11111b",bgTertiary:"#181825",bgSurface:"#313244",bgElevated:"#45475a",bgHover:"#313244",bgActive:"#45475a",textPrimary:"#cdd6f4",textSecondary:"#bac2de",textTertiary:"#a6adc8",textMuted:"#6c7086",textInverse:"#1e1e2e",accent:"#f5c2e7",accentHover:"#f5e0dc",accentActive:"#cba6f7",accentMuted:"#3d2d40",accentText:"#1e1e2e",success:"#a6e3a1",successMuted:"#243028",warning:"#f9e2af",warningMuted:"#382f20",error:"#f38ba8",errorMuted:"#3d2430",info:"#89dceb",infoMuted:"#203035",border:"#45475a",borderHover:"#585b70",borderFocus:"#f5c2e7",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.35)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.45), 0 2px 4px -2px rgb(0 0 0 / 0.45)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.55), 0 4px 6px -4px rgb(0 0 0 / 0.55)",syntaxComment:"#6c7086",syntaxString:"#a6e3a1",syntaxKeyword:"#cba6f7",syntaxFunction:"#89b4fa",syntaxNumber:"#fab387",syntaxOperator:"#89dceb",syntaxVariable:"#f38ba8",syntaxPunctuation:"#cdd6f4",syntaxProperty:"#f5c2e7",syntaxTag:"#cba6f7",syntaxClass:"#f9e2af"}}),K0=Ie({id:"catppuccin-latte",name:"Catppuccin Latte",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#eff1f5",bgSecondary:"#dce0e8",bgTertiary:"#e6e9ef",bgSurface:"#ffffff",bgElevated:"#ffffff",bgHover:"#e6e9ef",bgActive:"#ccd0da",textPrimary:"#4c4f69",textSecondary:"#5c5f77",textTertiary:"#6c6f85",textMuted:"#9ca0b0",textInverse:"#eff1f5",accent:"#ea76cb",accentHover:"#d65db1",accentActive:"#8839ef",accentMuted:"#f5e0f0",accentText:"#ffffff",success:"#40a02b",successMuted:"#d8f0d0",warning:"#df8e1d",warningMuted:"#f9ecd0",error:"#d20f39",errorMuted:"#f9d5dd",info:"#04a5e5",infoMuted:"#d0f0f9",border:"#ccd0da",borderHover:"#bcc0cc",borderFocus:"#ea76cb",shadowSm:"0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.06)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.08)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.08)",syntaxComment:"#9ca0b0",syntaxString:"#40a02b",syntaxKeyword:"#8839ef",syntaxFunction:"#1e66f5",syntaxNumber:"#fe640b",syntaxOperator:"#04a5e5",syntaxVariable:"#d20f39",syntaxPunctuation:"#4c4f69",syntaxProperty:"#ea76cb",syntaxTag:"#8839ef",syntaxClass:"#df8e1d"}}),q0=Ie({id:"nord",name:"Nord",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#2e3440",bgSecondary:"#242933",bgTertiary:"#1f232b",bgSurface:"#3b4252",bgElevated:"#434c5e",bgHover:"#3b4252",bgActive:"#4c566a",textPrimary:"#eceff4",textSecondary:"#e5e9f0",textTertiary:"#d8dee9",textMuted:"#616e88",textInverse:"#2e3440",accent:"#8fbcbb",accentHover:"#88c0d0",accentActive:"#81a1c1",accentMuted:"#304048",accentText:"#2e3440",success:"#a3be8c",successMuted:"#2e3d2e",warning:"#ebcb8b",warningMuted:"#3d3828",error:"#bf616a",errorMuted:"#3d2830",info:"#81a1c1",infoMuted:"#283040",border:"#3b4252",borderHover:"#4c566a",borderFocus:"#8fbcbb",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.3)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5)",syntaxComment:"#616e88",syntaxString:"#a3be8c",syntaxKeyword:"#81a1c1",syntaxFunction:"#88c0d0",syntaxNumber:"#b48ead",syntaxOperator:"#81a1c1",syntaxVariable:"#d8dee9",syntaxPunctuation:"#eceff4",syntaxProperty:"#8fbcbb",syntaxTag:"#81a1c1",syntaxClass:"#8fbcbb"}}),V0=Ie({id:"gruvbox-dark",name:"Gruvbox Dark",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#282828",bgSecondary:"#1d2021",bgTertiary:"#32302f",bgSurface:"#3c3836",bgElevated:"#504945",bgHover:"#504945",bgActive:"#665c54",textPrimary:"#ebdbb2",textSecondary:"#d5c4a1",textTertiary:"#bdae93",textMuted:"#928374",textInverse:"#282828",accent:"#fe8019",accentHover:"#d65d0e",accentActive:"#af3a03",accentMuted:"#4a3526",accentText:"#282828",success:"#b8bb26",successMuted:"#3d4220",warning:"#fabd2f",warningMuted:"#4a4020",error:"#fb4934",errorMuted:"#4a2520",info:"#83a598",infoMuted:"#2a3a38",border:"#504945",borderHover:"#665c54",borderFocus:"#fe8019",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#928374",syntaxString:"#b8bb26",syntaxKeyword:"#fb4934",syntaxFunction:"#b8bb26",syntaxNumber:"#d3869b",syntaxOperator:"#fe8019",syntaxVariable:"#83a598",syntaxPunctuation:"#ebdbb2",syntaxProperty:"#8ec07c",syntaxTag:"#fb4934",syntaxClass:"#fabd2f"}}),G0=Ie({id:"gruvbox-light",name:"Gruvbox Light",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#fbf1c7",bgSecondary:"#f2e5bc",bgTertiary:"#ebdbb2",bgSurface:"#f9f5d7",bgElevated:"#ffffff",bgHover:"#ebdbb2",bgActive:"#d5c4a1",textPrimary:"#3c3836",textSecondary:"#504945",textTertiary:"#665c54",textMuted:"#928374",textInverse:"#fbf1c7",accent:"#d65d0e",accentHover:"#af3a03",accentActive:"#8f3000",accentMuted:"#f0d8c0",accentText:"#fbf1c7",success:"#79740e",successMuted:"#e8ecc8",warning:"#b57614",warningMuted:"#f5e6c8",error:"#9d0006",errorMuted:"#f5d0c8",info:"#076678",infoMuted:"#c8e8f0",border:"#d5c4a1",borderHover:"#bdae93",borderFocus:"#d65d0e",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",syntaxComment:"#928374",syntaxString:"#79740e",syntaxKeyword:"#9d0006",syntaxFunction:"#79740e",syntaxNumber:"#8f3f71",syntaxOperator:"#af3a03",syntaxVariable:"#076678",syntaxPunctuation:"#3c3836",syntaxProperty:"#427b58",syntaxTag:"#9d0006",syntaxClass:"#b57614"}}),J0=Ie({id:"solarized-dark",name:"Solarized Dark",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#002b36",bgSecondary:"#00212b",bgTertiary:"#073642",bgSurface:"#073642",bgElevated:"#094552",bgHover:"#094552",bgActive:"#0a5565",textPrimary:"#839496",textSecondary:"#93a1a1",textTertiary:"#657b83",textMuted:"#586e75",textInverse:"#002b36",accent:"#268bd2",accentHover:"#1a7cc4",accentActive:"#1569a8",accentMuted:"#0a3a52",accentText:"#fdf6e3",success:"#859900",successMuted:"#2a3a20",warning:"#b58900",warningMuted:"#3a3520",error:"#dc322f",errorMuted:"#3a2020",info:"#2aa198",infoMuted:"#1a3a38",border:"#073642",borderHover:"#094552",borderFocus:"#268bd2",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#586e75",syntaxString:"#2aa198",syntaxKeyword:"#859900",syntaxFunction:"#268bd2",syntaxNumber:"#d33682",syntaxOperator:"#859900",syntaxVariable:"#b58900",syntaxPunctuation:"#839496",syntaxProperty:"#268bd2",syntaxTag:"#cb4b16",syntaxClass:"#cb4b16"}}),Y0=Ie({id:"solarized-light",name:"Solarized Light",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#fdf6e3",bgSecondary:"#eee8d5",bgTertiary:"#e8e2cf",bgSurface:"#ffffff",bgElevated:"#ffffff",bgHover:"#eee8d5",bgActive:"#e0dac8",textPrimary:"#657b83",textSecondary:"#586e75",textTertiary:"#839496",textMuted:"#93a1a1",textInverse:"#fdf6e3",accent:"#268bd2",accentHover:"#1a7cc4",accentActive:"#1569a8",accentMuted:"#d0e8f5",accentText:"#fdf6e3",success:"#859900",successMuted:"#e8f0c8",warning:"#b58900",warningMuted:"#f5ecc8",error:"#dc322f",errorMuted:"#f5d0d0",info:"#2aa198",infoMuted:"#c8f0ec",border:"#eee8d5",borderHover:"#ddd8c5",borderFocus:"#268bd2",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",syntaxComment:"#93a1a1",syntaxString:"#2aa198",syntaxKeyword:"#859900",syntaxFunction:"#268bd2",syntaxNumber:"#d33682",syntaxOperator:"#859900",syntaxVariable:"#b58900",syntaxPunctuation:"#657b83",syntaxProperty:"#268bd2",syntaxTag:"#cb4b16",syntaxClass:"#cb4b16"}}),Z0=Ie({id:"one-dark",name:"One Dark",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#282c34",bgSecondary:"#21252b",bgTertiary:"#2c313a",bgSurface:"#3a3f4b",bgElevated:"#3e4451",bgHover:"#3a3f4b",bgActive:"#4b5263",textPrimary:"#abb2bf",textSecondary:"#9da5b4",textTertiary:"#7f848e",textMuted:"#5c6370",textInverse:"#282c34",accent:"#61afef",accentHover:"#528bcc",accentActive:"#4678a8",accentMuted:"#2a3a48",accentText:"#282c34",success:"#98c379",successMuted:"#2a3a28",warning:"#e5c07b",warningMuted:"#3a3828",error:"#e06c75",errorMuted:"#3a2828",info:"#56b6c2",infoMuted:"#203a3a",border:"#3a3f4b",borderHover:"#4b5263",borderFocus:"#61afef",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#5c6370",syntaxString:"#98c379",syntaxKeyword:"#c678dd",syntaxFunction:"#61afef",syntaxNumber:"#d19a66",syntaxOperator:"#56b6c2",syntaxVariable:"#e06c75",syntaxPunctuation:"#abb2bf",syntaxProperty:"#e06c75",syntaxTag:"#e06c75",syntaxClass:"#e5c07b"}}),X0=Ie({id:"tokyo-night",name:"Tokyo Night",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#1a1b26",bgSecondary:"#16161e",bgTertiary:"#1f2335",bgSurface:"#24283b",bgElevated:"#292e42",bgHover:"#292e42",bgActive:"#33384d",textPrimary:"#c0caf5",textSecondary:"#a9b1d6",textTertiary:"#787c99",textMuted:"#565f89",textInverse:"#1a1b26",accent:"#bb9af7",accentHover:"#9d7cd8",accentActive:"#7c5dc0",accentMuted:"#3d3560",accentText:"#1a1b26",success:"#9ece6a",successMuted:"#2a3a25",warning:"#e0af68",warningMuted:"#3a3525",error:"#f7768e",errorMuted:"#3a2530",info:"#7dcfff",infoMuted:"#1a3545",border:"#292e42",borderHover:"#3b4261",borderFocus:"#bb9af7",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#565f89",syntaxString:"#9ece6a",syntaxKeyword:"#bb9af7",syntaxFunction:"#7aa2f7",syntaxNumber:"#ff9e64",syntaxOperator:"#89ddff",syntaxVariable:"#c0caf5",syntaxPunctuation:"#c0caf5",syntaxProperty:"#73daca",syntaxTag:"#f7768e",syntaxClass:"#e0af68"}}),Q0=Ie({id:"tokyo-night-day",name:"Tokyo Night Day",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#e1e2e7",bgSecondary:"#d5d6db",bgTertiary:"#c8c9ce",bgSurface:"#ffffff",bgElevated:"#ffffff",bgHover:"#d5d6db",bgActive:"#c8c9ce",textPrimary:"#3760bf",textSecondary:"#4c6bc0",textTertiary:"#6172b0",textMuted:"#8990b3",textInverse:"#e1e2e7",accent:"#9854f1",accentHover:"#7847c4",accentActive:"#5d38a0",accentMuted:"#e8dff8",accentText:"#ffffff",success:"#587539",successMuted:"#e0f0d0",warning:"#8c6c3e",warningMuted:"#f5ecd0",error:"#f52a65",errorMuted:"#fdd8e0",info:"#007197",infoMuted:"#d0f0f8",border:"#c8c9ce",borderHover:"#b8b9be",borderFocus:"#9854f1",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",syntaxComment:"#8990b3",syntaxString:"#587539",syntaxKeyword:"#9854f1",syntaxFunction:"#2e7de9",syntaxNumber:"#b15c00",syntaxOperator:"#006a83",syntaxVariable:"#3760bf",syntaxPunctuation:"#3760bf",syntaxProperty:"#118c74",syntaxTag:"#f52a65",syntaxClass:"#8c6c3e"}}),e1=Ie({id:"rose-pine",name:"Rosé Pine",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#191724",bgSecondary:"#1f1d2e",bgTertiary:"#21202e",bgSurface:"#26233a",bgElevated:"#2a283e",bgHover:"#2a283e",bgActive:"#393552",textPrimary:"#e0def4",textSecondary:"#c4a7e7",textTertiary:"#908caa",textMuted:"#6e6a86",textInverse:"#191724",accent:"#ebbcba",accentHover:"#d4a5a5",accentActive:"#c09090",accentMuted:"#3a3040",accentText:"#191724",success:"#9ccfd8",successMuted:"#253540",warning:"#f6c177",warningMuted:"#3a3528",error:"#eb6f92",errorMuted:"#3a2535",info:"#31748f",infoMuted:"#1a2a35",border:"#26233a",borderHover:"#393552",borderFocus:"#ebbcba",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#6e6a86",syntaxString:"#f6c177",syntaxKeyword:"#31748f",syntaxFunction:"#ebbcba",syntaxNumber:"#eb6f92",syntaxOperator:"#9ccfd8",syntaxVariable:"#e0def4",syntaxPunctuation:"#908caa",syntaxProperty:"#c4a7e7",syntaxTag:"#eb6f92",syntaxClass:"#9ccfd8"}}),t1=Ie({id:"rose-pine-moon",name:"Rosé Pine Moon",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#232136",bgSecondary:"#2a273f",bgTertiary:"#2d2a45",bgSurface:"#393552",bgElevated:"#3e3a58",bgHover:"#3e3a58",bgActive:"#44415a",textPrimary:"#e0def4",textSecondary:"#c4a7e7",textTertiary:"#908caa",textMuted:"#6e6a86",textInverse:"#232136",accent:"#ea9a97",accentHover:"#d48580",accentActive:"#c07570",accentMuted:"#3a3040",accentText:"#232136",success:"#9ccfd8",successMuted:"#2a3540",warning:"#f6c177",warningMuted:"#3a3528",error:"#eb6f92",errorMuted:"#3a2535",info:"#3e8fb0",infoMuted:"#1a2a38",border:"#393552",borderHover:"#44415a",borderFocus:"#ea9a97",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#6e6a86",syntaxString:"#f6c177",syntaxKeyword:"#3e8fb0",syntaxFunction:"#ea9a97",syntaxNumber:"#eb6f92",syntaxOperator:"#9ccfd8",syntaxVariable:"#e0def4",syntaxPunctuation:"#908caa",syntaxProperty:"#c4a7e7",syntaxTag:"#eb6f92",syntaxClass:"#9ccfd8"}}),n1=Ie({id:"rose-pine-dawn",name:"Rosé Pine Dawn",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#faf4ed",bgSecondary:"#f2e9e1",bgTertiary:"#e4dfde",bgSurface:"#fffaf3",bgElevated:"#ffffff",bgHover:"#f2e9e1",bgActive:"#e4dfde",textPrimary:"#575279",textSecondary:"#797593",textTertiary:"#9893a5",textMuted:"#b4b0c3",textInverse:"#faf4ed",accent:"#d7827e",accentHover:"#c46865",accentActive:"#b05550",accentMuted:"#fae8e8",accentText:"#faf4ed",success:"#56949f",successMuted:"#e0f0f0",warning:"#ea9d34",warningMuted:"#faf0d8",error:"#b4637a",errorMuted:"#f8e0e8",info:"#286983",infoMuted:"#d8f0f8",border:"#e4dfde",borderHover:"#d5d0ce",borderFocus:"#d7827e",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",syntaxComment:"#9893a5",syntaxString:"#ea9d34",syntaxKeyword:"#286983",syntaxFunction:"#d7827e",syntaxNumber:"#b4637a",syntaxOperator:"#56949f",syntaxVariable:"#575279",syntaxPunctuation:"#797593",syntaxProperty:"#907aa9",syntaxTag:"#b4637a",syntaxClass:"#56949f"}}),a1=Ie({id:"github-dark",name:"GitHub Dark",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#0d1117",bgSecondary:"#010409",bgTertiary:"#161b22",bgSurface:"#21262d",bgElevated:"#30363d",bgHover:"#21262d",bgActive:"#30363d",textPrimary:"#e6edf3",textSecondary:"#c9d1d9",textTertiary:"#8b949e",textMuted:"#6e7681",textInverse:"#0d1117",accent:"#58a6ff",accentHover:"#388bfd",accentActive:"#1f6feb",accentMuted:"#1a3050",accentText:"#ffffff",success:"#3fb950",successMuted:"#1a3020",warning:"#d29922",warningMuted:"#3a3020",error:"#f85149",errorMuted:"#3a2020",info:"#58a6ff",infoMuted:"#1a3050",border:"#30363d",borderHover:"#484f58",borderFocus:"#58a6ff",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#8b949e",syntaxString:"#a5d6ff",syntaxKeyword:"#ff7b72",syntaxFunction:"#d2a8ff",syntaxNumber:"#79c0ff",syntaxOperator:"#ff7b72",syntaxVariable:"#ffa657",syntaxPunctuation:"#c9d1d9",syntaxProperty:"#7ee787",syntaxTag:"#7ee787",syntaxClass:"#ffa657"}}),r1=Ie({id:"github-light",name:"GitHub Light",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgTertiary:"#eaeef2",bgSurface:"#ffffff",bgElevated:"#ffffff",bgHover:"#f3f4f6",bgActive:"#eaeef2",textPrimary:"#1f2328",textSecondary:"#424a53",textTertiary:"#656d76",textMuted:"#8c959f",textInverse:"#ffffff",accent:"#0969da",accentHover:"#0860ca",accentActive:"#0550ae",accentMuted:"#ddf4ff",accentText:"#ffffff",success:"#1a7f37",successMuted:"#dafbe1",warning:"#9a6700",warningMuted:"#fff8c5",error:"#cf222e",errorMuted:"#ffebe9",info:"#0969da",infoMuted:"#ddf4ff",border:"#d0d7de",borderHover:"#afb8c1",borderFocus:"#0969da",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",syntaxComment:"#6e7781",syntaxString:"#0a3069",syntaxKeyword:"#cf222e",syntaxFunction:"#8250df",syntaxNumber:"#0550ae",syntaxOperator:"#cf222e",syntaxVariable:"#953800",syntaxPunctuation:"#1f2328",syntaxProperty:"#116329",syntaxTag:"#116329",syntaxClass:"#953800"}}),o1=Ie({id:"github-dimmed",name:"GitHub Dimmed",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#22272e",bgSecondary:"#1c2128",bgTertiary:"#2d333b",bgSurface:"#373e47",bgElevated:"#444c56",bgHover:"#2d333b",bgActive:"#373e47",textPrimary:"#adbac7",textSecondary:"#909dab",textTertiary:"#768390",textMuted:"#636e7b",textInverse:"#22272e",accent:"#539bf5",accentHover:"#4184e4",accentActive:"#316dca",accentMuted:"#1a3050",accentText:"#ffffff",success:"#57ab5a",successMuted:"#1a3020",warning:"#c69026",warningMuted:"#3a3020",error:"#e5534b",errorMuted:"#3a2020",info:"#539bf5",infoMuted:"#1a3050",border:"#444c56",borderHover:"#545d68",borderFocus:"#539bf5",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#768390",syntaxString:"#96d0ff",syntaxKeyword:"#f47067",syntaxFunction:"#dcbdfb",syntaxNumber:"#6cb6ff",syntaxOperator:"#f47067",syntaxVariable:"#f69d50",syntaxPunctuation:"#adbac7",syntaxProperty:"#8ddb8c",syntaxTag:"#8ddb8c",syntaxClass:"#f69d50"}}),s1=Ie({id:"monokai",name:"Monokai",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#272822",bgSecondary:"#1e1f1c",bgTertiary:"#2d2e27",bgSurface:"#3e3d32",bgElevated:"#49483e",bgHover:"#3e3d32",bgActive:"#49483e",textPrimary:"#f8f8f2",textSecondary:"#e6e6e0",textTertiary:"#b8b8b0",textMuted:"#75715e",textInverse:"#272822",accent:"#f92672",accentHover:"#e01f65",accentActive:"#c01a58",accentMuted:"#402030",accentText:"#ffffff",success:"#a6e22e",successMuted:"#2a3a20",warning:"#e6db74",warningMuted:"#3a3a25",error:"#f92672",errorMuted:"#402030",info:"#66d9ef",infoMuted:"#203540",border:"#49483e",borderHover:"#5a5950",borderFocus:"#f92672",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#75715e",syntaxString:"#e6db74",syntaxKeyword:"#f92672",syntaxFunction:"#a6e22e",syntaxNumber:"#ae81ff",syntaxOperator:"#f92672",syntaxVariable:"#f8f8f2",syntaxPunctuation:"#f8f8f2",syntaxProperty:"#66d9ef",syntaxTag:"#f92672",syntaxClass:"#a6e22e"}}),zg=[j0,H0,B0,Z0,s1,X0,q0,W0,K0,e1,t1,n1,V0,G0,J0,Y0,a1,r1,o1,Q0],l1=new Map(zg.map(e=>[e.id,e]));function Vl(e,t=[]){return l1.get(e)??t.find(a=>a.id===e)}const Oh="cove:",Op=1;function ge(e){try{const t=localStorage.getItem(Oh+e);return t===null?null:JSON.parse(t)}catch{return null}}function we(e,t){try{localStorage.setItem(Oh+e,JSON.stringify(t))}catch{}}function Xi(e){localStorage.removeItem(Oh+e)}const Nh="cove:session-auth";function Bc(){const e=ge("auth");return e?(e.credential&&(Fh({...e,credential:void 0}),zh(e.credential)),e):null}function Fh(e){const t={url:e.url,authMode:e.authMode,rememberMe:e.rememberMe};we("auth",t),e.credential&&(e.rememberMe?(we("credential",e.credential),Ug()):(zh(e.credential),Xi("credential")))}function i1(){Xi("auth"),Xi("credential"),Ug()}function zh(e){try{sessionStorage.setItem(Nh,JSON.stringify({credential:e}))}catch{}}function Uh(){try{const e=ge("credential");if(e)return e;const t=sessionStorage.getItem(Nh);return t&&JSON.parse(t).credential||null}catch{return null}}function Ug(){try{sessionStorage.removeItem(Nh)}catch{}}function c1(){return ge("hasCompletedOnboarding")??!1}function Np(){we("hasCompletedOnboarding",!0)}function u1(e){we("pendingTour",e)}function d1(){const e=ge("pendingTour")??!1;return e&&Xi("pendingTour"),e}const xl={timeFormat:"relative",fontSize:"md",fontFamily:"geist",codeFontFamily:"jetbrains",sidebarWidth:280};function h1(){return ge("time-format")??xl.timeFormat}function f1(e){we("time-format",e)}function p1(){return ge("font-size")??xl.fontSize}function m1(e){we("font-size",e)}function v1(){return ge("font-family")??xl.fontFamily}function g1(e){we("font-family",e)}function b1(){return ge("code-font-family")??xl.codeFontFamily}function x1(e){we("code-font-family",e)}function y1(){const e=ge("locale");return e||((navigator.language||"en").startsWith("en"),"en")}function w1(){return ge("theme-preference")}function k1(e){we("theme-preference",e)}function S1(){return ge("sidebarWidth")??xl.sidebarWidth}function _1(e){we("sidebarWidth",e)}function C1(){const e=ge("messages-session"),t=ge("messages-cache");return e&&t?{sessionKey:e,messages:t}:null}function T1(e,t){we("messages-session",e),we("messages-cache",t)}function E1(){return ge("sessions-cache")}function A1(e){we("sessions-cache",e)}function M1(){return ge("usage-cache")}function I1(e){we("usage-cache",e)}function R1(){return ge("sessions-usage-cache")}function L1(e){we("sessions-usage-cache",e)}function $1(){const e=ge("model-favorites");return new Set(e??[])}function D1(e){we("model-favorites",[...e])}function P1(){return ge("custom-themes")??[]}function O1(e){we("theme-cache",e)}const N1={useDefaults:!0,defaultAgentId:"main"};function F1(){return ge("new-chat-settings")??N1}function z1(e){we("new-chat-settings",e)}function U1(){return ge("app-mode")??"single"}function j1(e){we("app-mode",e)}function H1(){return ge("canvas-node-enabled")??!1}function B1(e){we("canvas-node-enabled",e)}function W1(){return ge("heartbeat-seen-count")??0}function K1(e){we("heartbeat-seen-count",e)}function q1(){(ge("schemaVersion")??0)<Op&&we("schemaVersion",Op)}const vt=m(G1()),jg=m(P1().map(U0)),V1=K(()=>{const e=vt.value,t=jg.value;if(e.selected==="system"){const r=window.matchMedia("(prefers-color-scheme: dark)").matches?e.darkTheme:e.lightTheme;return Vl(r,t)??Vl("dark",t)}return Vl(e.selected,t)??Vl("dark",t)});function G1(){const e=w1();return e?{...Pp,...e}:Pp}function J1(e){const t=document.documentElement;for(const[a,r]of Object.entries(e))t.style.setProperty(a,r)}function Y1(e){O1({id:e.id,appearance:e.appearance,colors:e.colors})}function Z1(e){J1(e.colors),Y1(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 ms(e){vt.value={...vt.value,selected:e}}function X1(e){vt.value={...vt.value,lightTheme:e}}function Q1(e){vt.value={...vt.value,darkTheme:e}}function xd(){return[...zg,...jg.value]}function ew(){Se(()=>{const t=V1.value;Z1(t)}),Se(()=>{k1(vt.value)}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{vt.value.selected==="system"&&(vt.value={...vt.value})})}const tw={tagline:"A cozy home for your AI assistant"},nw={welcome:"Welcome to Cove",welcomeSubtitle:"Your beautiful interface for OpenClaw",feature1Title:"Real-time Chat",feature1Desc:"Stream responses with tool calls and rich formatting",feature2Title:"Secure Connection",feature2Desc:"Connect to your own OpenClaw gateway with token or password auth",feature3Title:"Full Control",feature3Desc:"Manage sessions, cron jobs, skills, and more",getStarted:"Get Started",skipToLogin:"Skip to manual login",urlSubtitle:"Enter your OpenClaw gateway WebSocket URL",urlError:"URL must start with ws:// or wss://",troubleshootTitle:"Tips:",troubleshoot1:"Local gateway: ws://localhost:8080",troubleshoot2:"Remote gateway: wss://your-server.com:8080",troubleshoot3:"Check that your gateway is running",probeError:"Could not connect to gateway",authTitle:"Authentication",authSubtitle:"Enter your credentials to connect",authMethod:"Auth Method",rememberMeDesc:"Save credentials for automatic reconnection",connectingDesc:"Establishing secure connection to your gateway",success:"Connected!",successDesc:"You're all set. Time to start chatting with your assistant.",startChatting:"Start Chatting",failed:"Connection Failed",failedHints:"Common fixes:",hint1:"Verify the gateway URL is correct",hint2:"Check that the gateway is running",hint3:"Ensure your credentials are valid",hint4:"Try refreshing if using HTTPS with self-signed certs",showFeatureTour:"Show feature tour",modeTitle:"How would you like to use Cove?",modeSingle:"Single chat",modeSingleDesc:"One focused conversation",modeMulti:"Multi-chat (Beta)",modeMultiDesc:"Multiple conversations",canvasDesc:"Let the agent push images and content to your browser"},aw={skipTour:"Skip tour",steps:{sessions:{title:"Your Conversations",content:"All your chat sessions live here. Create new ones, rename them, or filter by type. Each session maintains its own context."},chatInput:{title:"Chat Input",content:"Type your message here. Press Enter to send, Shift+Enter for a new line. You can also drag & drop files or paste images."},modelPicker:{title:"Model Selection",content:"Switch between different AI models per session. Each model has different capabilities and response styles."},settings:{content:"Customize your experience with 12+ themes, font sizes, time formats, and more. Preferences are saved automatically."},canvasPairing:{title:"Approve Your Device",content:"Your browser needs to be approved as a canvas device. Click the approve button to allow your agent to push content here."},canvasButton:{content:"Your agent can push images, diagrams, and content directly here. Click to open the canvas panel."}}},rw={send:"Send",queue:"Queue",stop:"Stop",rename:"Rename",cancel:"Cancel",close:"Close",clear:"Clear",save:"Save",saved:"Saved",creating:"Creating...",new:"New",delete:"Delete",deleting:"Deleting...",copy:"Copy",copied:"Copied!",retry:"Retry",refresh:"Refresh",connect:"Connect",confirm:"Confirm",back:"Back",continue:"Continue",next:"Next",previous:"Previous",done:"Done",more:"More",showMore:"Show More",showLess:"Show Less",remove:"Remove",dismiss:"Dismiss",view:"View"},ow={noData:"No data",tryAgain:"Try again",success:"Success",dryRun:"Dry run",enabled:"Enabled",disabled:"Disabled",dark:"Dark",light:"Light",total:"Total",sessions:"Sessions",error:"Error",skills:"Skills",workspace:"Workspace",output:"Output",overview:"Overview",agents:"Agents",tokens:"Tokens",lastActive:"Last Active",noResultsHint:"Try adjusting your search or filters.",clearFilters:"Clear Filters",model:"Model",name:"Name",files:"Files",tools:"Tools",cove:"Cove",connectToGateway:"Connect to Gateway",connecting:"Connecting...",enableCanvas:"Enable Canvas",settings:"Settings",canvas:"Canvas",saving:"Saving...",create:"Create",edit:"Edit",newChat:"New Chat",logout:"Logout",search:"Search",download:"Download",loading:"Loading...",noItems:"No items",deleteThisSession:"Delete this session?",gatewayUrl:"Gateway URL",password:"Password",token:"Token",approved:"Approved",url:"URL",imageViewer:"Image viewer",healthy:"Healthy",usage:"Usage",channels:"Channels",instances:"Instances",cronJobs:"Cron Jobs",debug:"Debug",logs:"Logs",docs:"Docs",devices:"Devices",agent:"Agent",assistant:"Assistant",thinking:"Thinking",all:"All",main:"Main",isolated:"Isolated",channel:"Channel",default:"Default",sessionDetails:"Session Details",off:"Off",medium:"Medium",session:"Session",gateway:"Gateway",defaultAgent:"Default Agent",enable:"Enable",disable:"Disable",pending:"Pending",nextRun:"Next Run",schedule:"Schedule",version:"Version",host:"Host",commit:"Commit",uptime:"Uptime",platform:"Platform",clear:"Clear",paused:"Paused",input:"Input",configured:"Configured",result:"Result",searchSkills:"Search skills...",alwaysActive:"Always active",eligible:"Eligible",missingReqs:"Missing Reqs",createAgent:"Create Agent",deleteAgent:"Delete Agent",operators:"Operators",nodes:"Nodes",totalCost:"Total Cost"},sw={placeholder:"Type a command...",noMatches:"No matches",noCommands:"No commands found",categories:{chat:"Chat",session:"Session",model:"Model",cron:"Cron",gateway:"Gateway",settings:"Settings"},hints:{navigate:"↑↓ navigate",select:"↵ select",close:"esc close",back:"esc back"},commands:{chat:{abort:"Abort response",clear:"Clear chat",search:"Search in chat",export:"Export as Markdown",copyLast:"Copy last response"},session:{switch:"Switch session",delete:"Delete current session",copyKey:"Copy session key"},model:{change:"Change model"},cron:{run:"Run cron job",toggle:"Toggle cron job"},gateway:{restart:"Restart gateway"},settings:{theme:"Change theme",systemTheme:"System (auto)"}},confirm:{restartGateway:"Restart the gateway? Connection will drop briefly."}},lw={gatewayUrlPlaceholder:"ws://localhost:8080",passwordPlaceholder:"Enter password",tokenPlaceholder:"Enter token",rememberMe:"Remember me"},iw={generic:"Something went wrong",unknown:"An unknown error occurred",required:"This field is required",invalid:"Invalid value",errorPage:{title:"Well, that wasn't supposed to happen",subtitle:"Something got tangled up. Give it another shot?",details:"Technical details"}},cw={approvalNeeded:"Exec Approval Needed",expiresIn:"Expires in {time}",expired:"Expired",denied:"Denied",allowOnce:"Allow Once",allowAlways:"Always Allow",deny:"Deny"},uw={expand:"Expand output",lines:"{count} lines",moreLines:"⋯ {count} more lines (click to expand)",collapse:"⋯ collapse",emptyResponse:"Empty response",noTabsOpen:"No tabs open",messageSent:"Message sent",broadcastSent:"Broadcast sent",noChannels:"No channels found",channelCount:"{count} channel",channelCountPlural:"{count} channels",noResults:"No results found",messageCount:"{count} messages",noEvents:"No events found",noEmojis:"No custom emojis",emojiCount:"{count} emoji",emojiCountPlural:"{count} emojis",noScheduledEvents:"No scheduled events",eventCount:"{count} event",eventCountPlural:"{count} events",noPinnedMessages:"No pinned messages",pinnedCount:"{count} pinned message",pinnedCountPlural:"{count} pinned messages",showAll:"Show all",fieldChannel:"Channel",fieldTo:"To",fieldVia:"Via",fieldMedia:"Media",fieldId:"ID",fieldJoined:"Joined",fieldRoles:"Roles",noText:"(no text)",unnamed:"(unnamed)"},dw={lineCount:"{count} lines",searchQuery:"Search query",memoryPath:"Memory path",imagePath:"Image path",prompt:"Prompt",inputImage:"Input image",expandImage:"Click to expand image",expandedImage:"Expanded image",readingFile:"Reading file",writingFile:"Writing file",runningCommand:"Running command",editingFile:"Editing file",browserAction:"Browser action",cronAction:"Cron action",sessionStatus:"Session status",messageAction:"Message action"},hw={updateRun:"Update gateway",updateComplete:"Update complete",version:"Version",mode:"Mode",duration:"Duration",restart:"Restart",restartOk:"Restarting",restartFailed:"Failed"},fw={showRaw:"Show raw",showFormatted:"Show formatted"},pw={remaining:"{percent}% remaining",currentSession:"Current session"},mw={disconnected:"Disconnected",connecting:"Connecting",reconnecting:"Reconnecting",copyFailed:"Couldn't copy {label}. Check clipboard permissions and HTTPS context."},vw={disconnected:"Connection lost. Messages will be sent when reconnected.",reconnecting:"Reconnecting to gateway...",reconnectingAttempt:"Reconnecting... (attempt {count})",messageFailedStatus:"Failed",messageSending:"Sending",messageQueued:"Queued",messagesQueued:"{count} message queued"},gw={chat:"Chat",config:"Config",github:"GitHub",githubOpenClaw:"OpenClaw GitHub",discord:"Discord",settings:"Cove Settings",sections:{control:"Control",resources:"Resources"}},bw={agentDescription:"Choose which assistant to chat with",rememberChoice:"Remember this choice",rememberChoiceDescription:"Skip this dialog next time and use these defaults",create:"Create Chat"},xw={placeholder:"Message (Enter to send, Shift+Enter for new line)",placeholderMobile:"Message...",thinking:"Thinking...",queuedMessages:"Queued ({count})",editQueuedMessage:"Edit Queued Message",images:"Images",addImage:"Add Image",noImages:"No images attached",imageCount:"{count} image",omittedImage:"Image omitted from history ({size})",omittedImageNoSize:"Image omitted from history",scrollToBottom:"Scroll to bottom",search:"Search messages",searchPlaceholder:"Search in conversation...",match:"match",matches:"matches",emptyState:{title:"Start a conversation",titleWithName:"Chat with {name}",description:"Send a message to begin chatting with your assistant",hint:"Quick tips:",newSession:"New session"},thinkingBlock:{thoughtFor:"Thought for ~{duration}",second:"{count} second",second_plural:"{count} seconds",expandLabel:"Expand thinking",collapseLabel:"Collapse thinking"},heartbeats:"{count} heartbeat",heartbeatsTitle:"Heartbeats",noHeartbeats:"No heartbeats yet",compacting:"Compacting…",conversationCompacted:"Conversation compacted",compactionLabel:"Compacted",cronJobCompleted:"Cron job completed",dateFrom:"From",dateTo:"To",attachImage:"Attach image",dropFiles:"Drop files here",copyMarkdown:"Copy markdown",historyTruncatedLabel:"Truncated in history",historyTruncatedHint:"This message was truncated in chat history and is not the full original content.",historyTruncatedHintWithReason:"This message was truncated in chat history ({reason}) and is not the full original content."},yw={pinned:"Pinned",today:"Today",yesterday:"Yesterday",thisWeek:"This Week",older:"Older",noSessions:"No sessions yet",noResults:"No sessions match your search",rename:"Rename Session",label:"Session Label",labelPlaceholder:"Enter a name for this session",delete:"Delete Session",deleteConfirm:'Are you sure you want to delete "{name}"?',deleteWarning:"This action cannot be undone. All messages in this session will be permanently deleted.",searchPlaceholder:"Search...",filterSessions:"Filter sessions",showCron:"Show cron sessions",admin:{description:"Manage active sessions, configure overrides, and monitor usage.",label:"Label",labelPlaceholder:"Give this session a memorable name",labelHelp:"A friendly name to help identify this session in lists.",editLabel:"Edit label",overrides:"Session Overrides",contextUsed:"Context Used",verbose:"Verbose",reasoning:"Reasoning",openInChat:"Open in Chat",emptyTitle:"No Sessions",emptyDescription:"Sessions will appear here once you start chatting.",noResults:"No Matching Sessions",searchPlaceholder:"Search sessions...",count:"{count} session",filteredCount:"Showing {filtered} of {total} sessions",kinds:{cron:"Cron"},levels:{inherit:"Inherit",low:"Low",high:"High"}}},ww={addFavorite:"Add to favorites",removeFavorite:"Remove from favorites"},kw={description:"Customize your Cove experience",appearance:{title:"Appearance",useSystemTheme:"Follow system appearance",useSystemThemeDescription:"Automatically switch between light and dark themes",lightTheme:"Light Theme",darkTheme:"Dark Theme",fontSize:"Font Size",fontSizeDescription:"Adjust text size throughout the app",fontSizeSm:"Small",fontSizeLg:"Large",fontFamily:"Font Family",fontFamilyDescription:"Choose your preferred interface typeface",codeFontFamily:"Code Font",codeFontFamilyDescription:"Used for code blocks and editor surfaces",fontSystem:"System",fontGeist:"Geist",fontInter:"Inter",fontMono:"JetBrains Mono",fontDyslexic:"OpenDyslexic",codeFontJetBrains:"JetBrains Mono",codeFontSystem:"System Mono",codeFontFira:"Fira Code",codeFontSource:"Source Code Pro"},about:{title:"About"},device:{enabledDescription:"Register as a node so the agent can push content to this browser",name:"Display Name",nameDescription:"Custom name shown in node list"},preferences:{timeFormat:"Time Display",timeFormatDescription:"How timestamps are shown",timeRelative:"Relative (2 hours ago)",timeAbsolute:"Absolute (3:45 PM)"},appMode:{title:"Interface",multiChat:"Multi-chat mode (Beta)",multiChatDescription:"Show session sidebar with multiple conversations"},newChat:{useDefaults:"Always use defaults",useDefaultsDescription:"Skip the agent picker when creating new chats",defaultAgentDescription:"Which agent to use for new chats"},data:{resetDefaults:"Reset to Defaults",clearSavedLogin:"Clear Saved Login"}},Sw={description:"Schedule and manage automated tasks.",actions:{list:"List jobs",add:"Add job",update:"Update job",remove:"Remove job",run:"Run job",runs:"Run history",status:"Scheduler status",wake:"Wake scheduler"},noJobs:"No cron jobs configured",jobCount:"{count} jobs",jobTriggered:"Job triggered",jobRemoved:"Job removed",createJob:"Create Job",editJob:"Edit Job",confirmDelete:"Delete this job?",runNow:"Run Now",announces:"Announces results",running:"Running",lastOk:"Last OK",lastFailed:"Last Failed",lastRun:"Last Run",lastDuration:"Last Duration",recentRuns:"Recent Runs",noRuns:"No runs recorded yet.",searchPlaceholder:"Search jobs...",emptyTitle:"No Cron Jobs",emptyDescription:"Create a job to schedule automated tasks.",noResults:"No Matching Jobs",count:"{count} job",filteredCount:"Showing {filtered} of {total} jobs",stats:{nextWake:"Next Wake"},columns:{job:"Job",schedule:"Schedule",target:"Target",status:"Status"},scheduleKind:{cron:"Cron Expression",every:"Interval",at:"One-time"},sessionTarget:{main:"Main Session",isolated:"Isolated Session"},wakeMode:{nextHeartbeat:"Next Heartbeat",now:"Immediate"},form:{namePlaceholder:"My Job",description:"Description",descriptionPlaceholder:"What does this job do?",descriptionHint:"Optional description for this job.",timezone:"Timezone",timezonePlaceholder:"Timezone (e.g., America/New_York)",timezoneHint:"Optional IANA timezone. Suggestions appear on focus and while typing.",cronPlaceholder:"*/5 * * * *",staggerMs:"Stagger (ms)",staggerMsHint:"Optional deterministic offset (applies to Cron Expression schedules only).",staggerMsPlaceholder:"Deterministic stagger in milliseconds (optional)",showAdvanced:"Show advanced options",hideAdvanced:"Hide advanced options",intervalPlaceholder:"Interval in milliseconds",sessionTarget:"Session Target",sessionTargetHint:"Main injects into the main session. Isolated runs in a separate session.",wakeMode:"Wake Mode",wakeModeHint:"When the job triggers after scheduling.",payload:"Payload",payloadHintMain:"Text injected as a system event into the main session.",payloadHintIsolated:"Runs as an agent turn in an isolated session.",expandPayloadEditor:"Expand editor",fullscreenPayloadTitle:"Payload Editor",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",timezoneInvalid:"Timezone must be a valid IANA timezone",staggerNonNegative:"Stagger must be 0 or greater",intervalMin:"Interval must be at least 1 second",atFuture:"Time must be in the future",payloadRequired:"Payload text is required"}},_w={subtitle:"Connection diagnostics and event logging.",connection:"Connection",server:"Server",client:"Client",paths:"Paths",eventLog:"Event Log",state:"State",sessionKey:"Session Key",reconnectAttempts:"Reconnect Attempts",connectedAt:"Connected At",tickInterval:"Tick Interval",configPath:"Config Path",stateDir:"State Directory",appVersion:"App Version",userAgent:"User Agent",presenceCount:"Connected Clients",recording:"Recording",noEvents:"No events recorded",noEventsHint:"Events will appear here as they occur.",snapshots:"Snapshots",health:"Health",noData:"No data — click Refresh",recentSession:"Recent Session",heartbeatAgents:"Heartbeat Agents",showRawJson:"Show raw JSON",used:"Used",unhealthy:"Unhealthy",linked:"Linked",on:"On",ok:"OK",clickToExpand:"click to expand",noPayload:"no payload",viewEventDetails:"View {{event}} event details",manualRpc:"Manual RPC",manualRpcDesc:"Send a raw gateway method with JSON params.",method:"Method",params:"Params",paramsJson:"Params (JSON)",addParam:"Add",noParams:"No params — click Add to add one",formMode:"Form",jsonMode:"JSON",call:"Call"},Cw={serverInfo:"Server Information",capabilities:"Capabilities",capabilitiesCount:"{count} methods"},Tw={description:"Gateway log viewer with live tailing.",searchPlaceholder:"Search logs...",live:"Live",info:"Info",warnings:"Warn",noLogs:"No logs available",noLogsHint:"Logs will appear here when the gateway writes them.",noMatches:"No logs match your filter",fetchError:"Failed to fetch logs",expandLine:"Expand log details",filterByLevel:"Filter by {level} level",viewLogDetails:"View log details",logDetails:"Log Details",message:"Message",rawLine:"Raw",fields:"fields"},Ew={description:"Messaging platform integrations and status.",emptyTitle:"No Channels",emptyDescription:"No channel plugins are available.",learnMore:"Learn how to set up channels",count:"{count} channel",configure:"Configure",probe:"Health Check",probing:"Checking...",logoutTitle:"Logout from Channel",logoutConfirm:"Are you sure you want to log out of {channel}?",logoutWarning:"You may need to re-authenticate (QR code, token, etc.) to reconnect.",logoutSuccess:"Logged out of {channel}",stats:{active:"Active (24h)",errors:"Errors"},status:{connected:"Connected",notConfigured:"Not Configured"}},Aw={description:"Connected clients and services.",emptyTitle:"No Instances",emptyDescription:"No connected clients or services found.",count:"{count} instance",idleSeconds:"{count}s",idleMinutes:"{count}m",idleHours:"{count}h",stats:{gateways:"Gateways",clients:"Clients"},columns:{instance:"Instance",mode:"Mode",lastSeen:"Last Seen",idle:"Idle"}},Mw={description:"Browse and manage assistant skills.",emptyTitle:"No Skills",emptyDescription:"No skills are available in this workspace.",noResults:"No Matching Skills",count:"{count} skill",filteredCount:"Showing {filtered} of {total} skills",enabledSuccess:"Enabled {name}",disabledSuccess:"Disabled {name}",installDeps:"Install Dependencies",installTitle:"Install Dependencies for {name}",installDescription:"Choose an installation method to install the required dependencies.",installSuccess:"Successfully installed dependencies for {name}",installFailed:"Failed to install dependencies",providesBins:"Provides",skillKey:"Skill Key",location:"Location",homepage:"Homepage",missingRequirements:"Missing requirements",blockedByAllowlist:"Blocked by allowlist",primaryEnv:"Primary env var",managedDir:"Managed skills",status:{blocked:"Blocked"},source:{bundled:"Bundled",managed:"Installed",extra:"Extra"},filters:{allSources:"All Sources"},clawhub:{searchPlaceholder:"Search ClawHub skills...",install:"Install",installing:"Installing...",noDescription:"No description available",changelog:"Changelog",updated:"Updated",noResults:"No Skills Found",tryDifferentSearch:"Try a different search term.",notYetSupported:"ClawHub installation coming soon! Install manually: openclaw skills install {slug}",trending:"Trending",sortLabel:"Sort by",sortPopular:"Popular",sortTrending:"Trending",sortStars:"Most Starred",sortRecent:"Newest",by:"by",installs:"active"}},Iw={description:"Manage agent configuration and workspace files.",overview:{identityEmoji:"Emoji",avatar:"Avatar",avatarPlaceholder:"avatar.jpg or https://...",namePlaceholder:"Agent name",workspacePlaceholder:"/path/to/workspace",modelPlaceholder:"anthropic/claude-sonnet-4-20250514",editHint:"Avatar: relative path, URL, or data URI. Model: leave empty to keep current."},files:{totalTokens:"~{count} tokens injected per run",loadError:"Failed to load workspace files",loadFileError:"Failed to load file",saveError:"Failed to save file",saved:"File saved",missing:"Missing",view:"View",unsaved:"Unsaved",unsavedWarning:"You have unsaved changes. Are you sure you want to leave?",backToList:"Back to Files",emptyFile:"This file is empty.",editPlaceholder:"Enter file content...",memoryHint:{title:"About Memory Files",line1:"Files in the memory/ folder are not editable here.",line2:"Use the chat to update memory/*.md files."},meta:{agents:"Agent behavior and workspace rules",soul:"Persona and communication style",tools:"Tool usage notes and conventions",identity:"Agent identity (name, email, accounts)",user:"User profile and preferences",heartbeat:"Heartbeat checklist and reminders",bootstrap:"First-run ritual (deleted after completion)",memory:"Durable facts, preferences, and context",unknown:"Configuration file"}},tools:{profile:"Profile",profiles:{full:"Full — All tools enabled",coding:"Coding — Files, exec, web",messaging:"Messaging — Messages, sessions",minimal:"Minimal — Read-only basics"},sections:{runtime:"Runtime",web:"Web",memory:"Memory",automation:"Automation"},toolDescriptions:{read:"Read file contents",write:"Create or overwrite files",edit:"Make precise edits",exec:"Run shell commands",process:"Manage background processes",webSearch:"Search the web",webFetch:"Fetch web content",browser:"Control web browser",memorySearch:"Semantic search",memoryGet:"Read memory files",sessionsList:"List sessions",sessionsSend:"Send to session",sessionsSpawn:"Spawn sub-agent",message:"Send messages",cron:"Schedule tasks",gateway:"Gateway control",nodes:"Node devices"},enabled:"{count} enabled"},skills:{title:"Agent Skill Access",noSkills:"No eligible skills available",noSearchResults:"No skills match your search",usingAllowlist:"Using allowlist: {allowed} of {total} skills",usingAll:"Using all {count} eligible skills",useAll:"Use All Skills",useAllHint:"= agent can use any eligible skill (no allowlist).",selectAll:"Select All",selectNone:"Select None",selectSpecific:"Select specific skills",selectSpecificHint:"= agent can only use checked skills.",globalHint:"To globally enable/disable skills, visit the",page:"page",details:"Details"},create:{nameHint:"Used as the agent ID (lowercase, no spaces)",namePlaceholder:"my-agent",workspacePlaceholder:"~/agents/my-agent",emoji:"Emoji (optional)",emojiPlaceholder:"🤖",requiredFields:"Name and workspace are required",success:"Agent created"},delete:{warning:"This action cannot be undone",warningDescription:"Deleting this agent will permanently remove its configuration from OpenClaw. Make sure you have backups if needed.",willDelete:"This will permanently delete:",willDeleteConfig:"Agent configuration from openclaw.json",willDeleteBindings:"Any channel bindings for this agent",willDeleteSessions:"Session associations (session data is preserved)",includeFiles:"Also delete workspace files",includeFilesDescription:"Permanently delete all files in {path}",confirmPrompt:'Type "{id}" to confirm deletion:',confirmMismatch:"Please type the agent ID to confirm deletion",success:"Agent deleted"}},Rw={description:"Manage paired devices and authentication tokens.",emptyTitle:"No Devices",emptyDescription:"No devices have been paired yet.",noResults:"No matching devices",count:"{count} device",filteredCount:"Showing {filtered} of {total}",searchPlaceholder:"Search devices...",pendingRequests:"Pending Pairing Requests",approve:"Approve",reject:"Reject",approveSuccess:"Device approved",rejectSuccess:"Device rejected",repair:"Repair",deviceId:"Device ID",clientId:"Client ID",scopes:"Scopes",tokens:"Auth Tokens",noTokens:"No tokens",tokenActive:"Active",tokenRevoked:"Revoked",rotateToken:"Rotate token",tokenManagement:"Token Management",tokenManagementDesc:"Manage authentication tokens for {name}.",tokenCreated:"Created",tokenRotatedAt:"Rotated",rotate:"Rotate",revoke:"Revoke",tokenRotated:"Token rotated and copied to clipboard",tokenCopied:"New token copied to clipboard",toggleDetails:"Toggle details for {name}",removeDevice:"Remove Device",removeConfirm:'Are you sure you want to remove "{name}"?',removeWarning:"This device will need to be re-paired to connect again.",removeSuccess:"Device removed",filters:{allRoles:"All Roles"}},Lw={description:"Token usage and cost analytics",loadError:"Failed to load usage data",gateway:{unknown:"Unknown host"},summary:{title:"Token Usage",period:"Last {days} days",cache:"Cache Tokens",cacheRead:"Cache Read",cacheWrite:"Cache Write",unavailable:"Usage data not available"},daily:{title:"Daily Activity"},agents:{sessions:"sessions"},sessions:{noData:"No session usage data available",cost:"Cost",showing:"Showing {from}–{to} of {total}",viewDetails:"View details for {name}"},detail:{contextWeight:"Context Weight",system:"System Prompt",other:"Other",tabs:{timeline:"Timeline",messages:"Messages"},noTimeline:"No timeline data available for this session",noMessages:"No message logs available for this session",cumulativeTokens:"Cumulative Tokens",requests:"Requests",totalTokens:"Total Tokens",role:{user:"User",tool:"Tool"},tokenCount:"{count} tokens"}},$w={minutesAgo:"{count} minute ago",compact:{now:"now",minutes:"{count}m",hours:"{count}h",days:"{count}d",weeks:"{count}w",months:"{count}mo",years:"{count}y"}},Dw={close:"Close canvas",minimize:"Minimize",maximize:"Maximize",openUrlInNewTab:"Open URL in new tab",openCanvasTab:"Pop out to canvas tab",iframeTitle:"Canvas content",imageAlt:"Canvas image",noContent:"No content to display",noContentHint:"The assistant can push content here."},Pw={sidebarToggle:"Toggle sidebar",loading:"Loading",expandSection:"Expand section",collapseSection:"Collapse section"},Ow={title:"Configuration",description:"Manage OpenClaw settings",searchPlaceholder:"Search settings...",save:"Save Changes",reset:"Reset",unsavedChanges:"You have unsaved changes",saveSuccess:"Configuration saved. Gateway will restart.",noFields:"No settings found",noResults:"No matching settings",selectSection:"Select a section to configure",general:"General",noSettingsAtLevel:"No settings available at this level.",schemaNotFound:"Schema not found for path: {path}",validation:{invalidFormat:"Invalid format",mustBeString:"Must be a string",mustBeNumber:"Must be a number",mustBeInteger:"Must be an integer",mustBeBoolean:"Must be true or false",mustBeArray:"Must be an array",mustBeObject:"Must be an object",invalidOption:"Invalid option",minLength:"Must be at least {min} characters",maxLength:"Must be at most {max} characters",minimum:"Must be at least {min}",maximum:"Must be at most {max}",minItems:"Must have at least {min} items",maxItems:"Must have at most {max} items"},field:{showPassword:"Show password",hidePassword:"Hide password",addItem:"Add item",removeItem:"Remove item",dragToReorder:"Drag to reorder",moveUp:"Move up",moveDown:"Move down",invalidJson:"Invalid JSON"}},Nw={gatewayLabel:"Gateway update available",viewRelease:"View release"},Fw={app:tw,onboarding:nw,tour:aw,actions:rw,common:ow,commandPalette:sw,auth:lw,errors:iw,exec:cw,toolOutput:uw,toolInput:dw,gateway:hw,toolBlock:fw,sessionStatus:pw,status:mw,connection:vw,nav:gw,newChatModal:bw,chat:xw,sessions:yw,models:ww,settings:kw,cron:Sw,debug:_w,overview:Cw,logs:Tw,channels:Ew,instances:Aw,skills:Mw,agents:Iw,devices:Rw,usage:Lw,time:$w,canvas:Dw,accessibility:Pw,config:Ow,update:Nw},Bo={en:Fw};function zw(e){if(Bo[e])return Bo[e];const t=e.split("-")[0];return Bo[t]?Bo[t]:Bo.en}const Fp=new Set,Au=new Map,Uw={geist:()=>Promise.all([Te(()=>Promise.resolve({}),__vite__mapDeps([0])),Te(()=>Promise.resolve({}),__vite__mapDeps([1])),Te(()=>Promise.resolve({}),__vite__mapDeps([2]))]),inter:()=>Promise.all([Te(()=>Promise.resolve({}),__vite__mapDeps([3])),Te(()=>Promise.resolve({}),__vite__mapDeps([4])),Te(()=>Promise.resolve({}),__vite__mapDeps([5]))]),dyslexic:()=>Te(()=>Promise.resolve({}),__vite__mapDeps([6])),jetbrains:()=>Promise.all([Te(()=>Promise.resolve({}),__vite__mapDeps([7])),Te(()=>Promise.resolve({}),__vite__mapDeps([8])),Te(()=>Promise.resolve({}),__vite__mapDeps([9]))]),fira:()=>Promise.all([Te(()=>Promise.resolve({}),__vite__mapDeps([10])),Te(()=>Promise.resolve({}),__vite__mapDeps([11])),Te(()=>Promise.resolve({}),__vite__mapDeps([12]))]),source:()=>Promise.all([Te(()=>Promise.resolve({}),__vite__mapDeps([13])),Te(()=>Promise.resolve({}),__vite__mapDeps([14])),Te(()=>Promise.resolve({}),__vite__mapDeps([15]))])};function qa(e){if(Fp.has(e))return Promise.resolve();const t=Au.get(e);if(t)return t;const a=Uw[e]().then(()=>{Fp.add(e)}).catch(()=>{}).finally(()=>{Au.delete(e)});return Au.set(e,a),a}function jw(e){return e==="system"?Promise.resolve():qa(e==="geist"?"geist":e==="inter"?"inter":e==="dyslexic"?"dyslexic":"jetbrains")}function Hw(e){return e==="system"?Promise.resolve():qa(e==="jetbrains"?"jetbrains":e==="fira"?"fira":"source")}const ur=m(h1()),io=m(p1()),dr=m(v1()),hr=m(b1()),ot=m(F1()),Ln=m(U1()),Xe=m(H1()),yl=K(()=>Ln.value==="multi"),Bs=K(()=>Ln.value==="single");Se(()=>f1(ur.value));Se(()=>m1(io.value));Se(()=>g1(dr.value));Se(()=>x1(hr.value));Se(()=>z1(ot.value));Se(()=>j1(Ln.value));Se(()=>B1(Xe.value));typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key==="cove:canvas-node-enabled"){const t=e.newValue==="true";Xe.value!==t&&(Xe.value=t,Te(()=>Promise.resolve().then(()=>ay),void 0).then(a=>{t?a.startNodeConnection():a.stopNodeConnection()}))}});Se(()=>{document.documentElement.dataset.fontSize=io.value});Se(()=>{jw(dr.value);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[dr.value])});Se(()=>{Hw(hr.value);const e={jetbrains:'"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',system:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fira:'"Fira Code", "Fira Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',source:'"Source Code Pro", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'};document.documentElement.style.setProperty("--font-mono",e[hr.value])});const Hg=[{value:"sm",labelKey:"settings.appearance.fontSizeSm"},{value:"md",labelKey:"common.medium"},{value:"lg",labelKey:"settings.appearance.fontSizeLg"}],Bg=[{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"}],Wg=[{value:"system",labelKey:"settings.appearance.codeFontSystem"},{value:"jetbrains",labelKey:"settings.appearance.codeFontJetBrains"},{value:"fira",labelKey:"settings.appearance.codeFontFira"},{value:"source",labelKey:"settings.appearance.codeFontSource"}],Kg=[{value:"relative",labelKey:"settings.preferences.timeRelative"},{value:"local",labelKey:"settings.preferences.timeAbsolute"}];function qg(){io.value="md",dr.value="geist",hr.value="jetbrains",ur.value="relative",ot.value={useDefaults:!0,defaultAgentId:"main"},Ln.value="single"}const Bw=Object.freeze(Object.defineProperty({__proto__:null,CODE_FONT_FAMILY_OPTIONS:Wg,FONT_FAMILY_OPTIONS:Bg,FONT_SIZE_OPTIONS:Hg,TIME_FORMAT_OPTIONS:Kg,appMode:Ln,canvasNodeEnabled:Xe,codeFontFamily:hr,fontFamily:dr,fontSize:io,isMultiChatMode:yl,isSingleChatMode:Bs,newChatSettings:ot,resetToDefaults:qg,timeFormat:ur},Symbol.toStringTag,{value:"Module"})),zp={debug:0,info:1,warn:2,error:3,off:4};function Ww(){return"off"}const Kw=Ww();function Gl(e){return zp[e]>=zp[Kw]}function Jl(e,t){return`[${e}] ${t}`}function Zn(e){return{debug:(t,...a)=>{Gl("debug")&&(console.debug(Jl(e,t),...a),a.length,void 0)},info:(t,...a)=>{Gl("info")&&(console.info(Jl(e,t),...a),a.length,void 0)},warn:(t,...a)=>{Gl("warn")&&(console.warn(Jl(e,t),...a),a.length,void 0)},error:(t,...a)=>{Gl("error")&&(console.error(Jl(e,t),...a),a.length,void 0)}}}const M={gateway:Zn("gateway"),auth:Zn("auth"),chat:Zn("chat"),exec:Zn("exec"),i18n:Zn("i18n"),node:Zn("node"),ui:Zn("ui"),usage:Zn("usage")},xa=m(y1()),Up=m(zw(xa.value)),jp=K(()=>["ar","he","fa","ur"].includes(xa.value.split("-")[0]));function qw(){document.documentElement.dir=jp.value?"rtl":"ltr",document.documentElement.lang=xa.value,Se(()=>{document.documentElement.dir=jp.value?"rtl":"ltr",document.documentElement.lang=xa.value})}function Hp(e,t){return t.split(".").reduce((a,r)=>{if(a&&typeof a=="object"&&r in a)return a[r]},e)}function l(e,t){let a=Hp(Up.value,e);if(t?.count!==void 0&&typeof t.count=="number"){const o=t.count===1?e:`${e}_plural`,s=Hp(Up.value,o);s!==void 0&&(a=s)}return typeof a!="string"?(M.i18n.warn(`Missing translation: ${e}`),e):t?a.replace(/\{(\w+)\}/g,(r,o)=>t[o]?.toString()??`{${o}}`):a}function Vg(e,t="short"){const a=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(xa.value,{timeStyle:t}).format(a)}function Bp(e){const t=typeof e=="number"?new Date(e):e,a=Date.now(),r=t.getTime()-a,o=Math.round(r/1e3),s=Math.round(o/60),i=Math.round(s/60),c=Math.round(i/24),u=Math.round(c/7),d=Math.round(c/30),h=Math.round(c/365),f=new Intl.RelativeTimeFormat(xa.value,{numeric:"auto"});return Math.abs(o)<60?f.format(o,"second"):Math.abs(s)<60?f.format(s,"minute"):Math.abs(i)<24?f.format(i,"hour"):Math.abs(c)<7?f.format(c,"day"):Math.abs(u)<4?f.format(u,"week"):Math.abs(d)<12?f.format(d,"month"):f.format(h,"year")}function ne(e,t){return t?.relative?Bp(e):ur.value==="local"?Vg(e,"short"):Bp(e)}function Vw(e){const t=typeof e=="number"?new Date(e):e,a=Date.now(),r=Math.abs(t.getTime()-a),o=Math.round(r/1e3),s=Math.round(o/60),i=Math.round(s/60),c=Math.round(i/24),u=Math.round(c/7),d=Math.round(c/30),h=Math.round(c/365);return o<60?l("time.compact.now"):s<60?l("time.compact.minutes",{count:s}):i<24?l("time.compact.hours",{count:i}):c<7?l("time.compact.days",{count:c}):u<4?l("time.compact.weeks",{count:u}):d<12?l("time.compact.months",{count:d}):l("time.compact.years",{count:h})}function Qi(e){if(ur.value==="local"){const t=typeof e=="number"?new Date(e):e,a=new Date;return t.getDate()===a.getDate()&&t.getMonth()===a.getMonth()&&t.getFullYear()===a.getFullYear()?Vg(t,"short"):t.getFullYear()===a.getFullYear()?new Intl.DateTimeFormat(xa.value,{month:"short",day:"numeric"}).format(t):new Intl.DateTimeFormat(xa.value,{month:"short",year:"2-digit"}).format(t)}return Vw(e)}function Ws(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function ec(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}K`:`${Math.round(e/1e3)}K`}function jh(e){if(e==null)return"—";if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),a=Math.floor(e%6e4/1e3);return`${t}m ${a}s`}const Wp=3,Gw=1e3,Jw=3e4,Yw=1.5,Zw=3e4,Xw=3e4,Ue=m("disconnected"),D=K(()=>Ue.value==="connected"),Qw=m(!0),ia=m(null),zt=m(null),gt=m(null),Hh=m(null),Ye=m(null),Bh=m([]),Xt=m(0),wl=m(null),Mo=m(null),e2=m(null),Ks=m(null),ya=m(null),Gg=m(null),vs=m(null),gs=m(null),kl=m([]),Wh=K(()=>{const e=Gg.value,t=ya.value;if(e==null||t==null)return null;const a=Date.now()-t;return e+a});let ze=null,qr=null,t2=0,Si=null,Vr=null;const co=new Map,yd=new Set,n2=5e3;function Kp(e,t){return new Promise(a=>{if(t?.aborted){a({ok:!1,error:"Aborted"});return}let r=null,o=null,s=!1;const i=()=>{o&&(clearTimeout(o),o=null),r&&(r.onopen=null,r.onmessage=null,r.onerror=null,r.onclose=null,r.close(),r=null)},c=d=>{s||(s=!0,i(),a({ok:!1,error:d}))},u=d=>{s||(s=!0,i(),a({ok:!0,version:d}))};t?.addEventListener("abort",()=>{c("Aborted")}),o=setTimeout(()=>{c("Connection timed out")},n2);try{r=new WebSocket(e),r.onopen=()=>{M.gateway.debug("Probe: WebSocket opened, waiting for challenge...")},r.onmessage=d=>{try{const h=JSON.parse(d.data);h.type==="evt"&&h.event==="connect.challenge"?(M.gateway.debug("Probe: Received connect.challenge, gateway is valid"),u(h.payload?.version)):(M.gateway.debug("Probe: Received unexpected message:",h.type,h.event),u())}catch{c("Invalid response from server")}},r.onerror=d=>{M.gateway.error("Probe WebSocket error:",{url:e,event:d.type}),c("Connection failed")},r.onclose=d=>{d.wasClean||c("Connection closed unexpectedly")}}catch(d){c(d instanceof Error?d.message:"Failed to connect")}})}function Sl(e){const t=Xt.value>0;return ze&&(t?(ze.onclose=null,ze.close(),ze=null):uo()),qr=e,Ue.value="connecting",Qw.value=!1,ia.value=null,t||(Xt.value=0),gt.value=e.url,new Promise((a,r)=>{try{ze=new WebSocket(e.url),ze.onopen=()=>{Ue.value="authenticating"},ze.onmessage=o=>{try{const s=JSON.parse(o.data);if(Ue.value==="authenticating"&&s.type==="event"&&s.event==="connect.challenge"){a2(e).then(i=>{Ue.value="connected",ya.value=Date.now(),zt.value=i.server?.version??null,wl.value=i.server?.commit??null,Mo.value=i.server?.host??null,Hh.value=i.server?.connId??null,e2.value=i.canvasHostUrl??null,Bh.value=i.features?.methods??[],Ks.value=i.policy?.tickIntervalMs??null,kl.value=i.snapshot?.presence??[],Gg.value=i.snapshot?.uptimeMs??null,vs.value=i.snapshot?.configPath??null,gs.value=i.snapshot?.stateDir??null;const c=i.snapshot?.sessionDefaults;c?.mainSessionKey&&(Ye.value=c.mainSessionKey,M.gateway.info("Main session key:",Ye.value)),c2(),a(i)}).catch(i=>{ia.value=i.message,uo(),r(i)});return}s2(s)}catch(s){M.gateway.error(" Failed to parse message:",s)}},ze.onerror=o=>{M.gateway.error("WebSocket error:",{url:e.url,readyState:ze?.readyState,event:o.type}),ia.value="WebSocket error - check console for details"},ze.onclose=o=>{const i=Ue.value==="connected",c=Xt.value>0;Kh(),Yg(new Error("Connection closed")),(i||c)&&qr?.autoReconnect!==!1?u2():Ue.value="disconnected"}}catch(o){Ue.value="disconnected",ia.value=o instanceof Error?o.message:"Failed to connect",r(o)}})}async function a2(e){const t={minProtocol:Wp,maxProtocol:Wp,client:{id:"openclaw-control-ui",displayName:"Cove",version:"2026.2.19",platform:r2(),mode:"ui"},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 N("connect",t)}function r2(){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 uo(){qr=null,Kh(),d2(),Yg(new Error("Disconnected")),ze&&(ze.onclose=null,ze.close(),ze=null),Ue.value="disconnected",ya.value=null,zt.value=null,wl.value=null,Mo.value=null,gt.value=null,Hh.value=null,Ye.value=null,Bh.value=[],Ks.value=null,kl.value=[]}function Jg(e,t,a){return new Promise((r,o)=>{if(!ze||ze.readyState!==WebSocket.OPEN){o(new Error("Not connected"));return}const s=`req_${++t2}`,i=a?.timeout??Zw,c={type:"req",id:s,method:e,params:t},u=setTimeout(()=>{co.delete(s),o(new Error(`Request timeout: ${e}`))},i);co.set(s,{resolve:r,reject:o,timeout:u}),ze.send(JSON.stringify(c))})}function N(e,...t){return Jg(e,t[0],t[1])}function o2(e,t,a){return Jg(e,t,a)}function s2(e){switch(e.type){case"res":l2(e);break;case"event":i2(e);break;default:M.gateway.warn(" Unknown message type:",e)}}function l2(e){const t=co.get(e.id);if(!t){M.gateway.warn(" Received response for unknown request:",e.id);return}co.delete(e.id),clearTimeout(t.timeout),e.ok?t.resolve(e.payload):t.reject(new Error(e.error?.message??"Request failed"))}function i2(e){M.gateway.debug("Event received:",e.event);for(const t of yd)try{t(e)}catch(a){M.gateway.error(" Event handler error:",a)}}function Yg(e){for(const[t,a]of co)clearTimeout(a.timeout),a.reject(e);co.clear()}function _l(e){return yd.add(e),()=>yd.delete(e)}function wd(e,t){return _l(r=>{r.event===e&&t(r.payload)})}let Wo=0;const qp=3;function c2(){Kh(),Wo=0,Si=setInterval(()=>{ze?.readyState===WebSocket.OPEN&&N("health").then(()=>{Wo=0}).catch(e=>{Wo++,M.gateway.warn(`Heartbeat failed (${Wo}/${qp}):`,e instanceof Error?e.message:String(e)),Wo>=qp&&M.gateway.error("Too many consecutive heartbeat failures, connection may be unhealthy")})},Xw)}function Kh(){Si&&(clearInterval(Si),Si=null)}function u2(){if(!qr||Vr)return;Ue.value="reconnecting",Xt.value++;const e=Math.min(Gw*Math.pow(Yw,Xt.value-1),Jw);M.gateway.info(`[gateway] Reconnecting in ${Math.round(e/1e3)}s (attempt ${Xt.value})`),Vr=setTimeout(async()=>{if(Vr=null,!!qr)try{await Sl(qr)}catch{}},e)}function d2(){Vr&&(clearTimeout(Vr),Vr=null),Xt.value=0}const rs={state:Ue,isConnected:D,error:ia,version:zt,commit:wl,host:Mo,url:gt,connectionId:Hh,mainSessionKey:Ye,capabilities:Bh,tickIntervalMs:Ks,connectedAt:ya,presence:kl,reconnectAttempt:Xt,connect:Sl,disconnect:uo,send:N,subscribe:_l,on:wd},h2=6e4,f2=200,p2=100,m2=5e3,v2=1e3,Yl=`
2
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function a(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=a(o);fetch(o.href,s)}})();var gl,J,sg,lg,za,wp,ig,cg,ug,Ch,sd,ld,dg,Hs={},hg=[],i0=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,bl=Array.isArray;function Cn(e,t){for(var a in t)e[a]=t[a];return e}function Th(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function an(e,t,a){var r,o,s,i={};for(s in t)s=="key"?r=t[s]:s=="ref"?o=t[s]:i[s]=t[s];if(arguments.length>2&&(i.children=arguments.length>3?gl.call(arguments,2):a),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)i[s]===void 0&&(i[s]=e.defaultProps[s]);return hs(e,i,r,o,null)}function hs(e,t,a,r,o){var s={type:e,props:t,key:a,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++sg,__i:-1,__u:0};return o==null&&J.vnode!=null&&J.vnode(s),s}function H(e){return e.children}function Mt(e,t){this.props=e,this.context=t}function lo(e,t){if(t==null)return e.__?lo(e.__,e.__i+1):null;for(var a;t<e.__k.length;t++)if((a=e.__k[t])!=null&&a.__e!=null)return a.__e;return typeof e.type=="function"?lo(e):null}function fg(e){var t,a;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((a=e.__k[t])!=null&&a.__e!=null){e.__e=e.__c.base=a.__e;break}return fg(e)}}function id(e){(!e.__d&&(e.__d=!0)&&za.push(e)&&!Gi.__r++||wp!=J.debounceRendering)&&((wp=J.debounceRendering)||ig)(Gi)}function Gi(){for(var e,t,a,r,o,s,i,c=1;za.length;)za.length>c&&za.sort(cg),e=za.shift(),c=za.length,e.__d&&(a=void 0,r=void 0,o=(r=(t=e).__v).__e,s=[],i=[],t.__P&&((a=Cn({},r)).__v=r.__v+1,J.vnode&&J.vnode(a),Eh(t.__P,a,r,t.__n,t.__P.namespaceURI,32&r.__u?[o]:null,s,o??lo(r),!!(32&r.__u),i),a.__v=r.__v,a.__.__k[a.__i]=a,vg(s,a,i),r.__e=r.__=null,a.__e!=o&&fg(a)));Gi.__r=0}function pg(e,t,a,r,o,s,i,c,u,d,h){var f,p,v,w,C,T,b,g=r&&r.__k||hg,y=t.length;for(u=c0(a,t,g,u,y),f=0;f<y;f++)(v=a.__k[f])!=null&&(p=v.__i==-1?Hs:g[v.__i]||Hs,v.__i=f,T=Eh(e,v,p,o,s,i,c,u,d,h),w=v.__e,v.ref&&p.ref!=v.ref&&(p.ref&&Ah(p.ref,null,v),h.push(v.ref,v.__c||w,v)),C==null&&w!=null&&(C=w),(b=!!(4&v.__u))||p.__k===v.__k?u=mg(v,u,e,b):typeof v.type=="function"&&T!==void 0?u=T:w&&(u=w.nextSibling),v.__u&=-7);return a.__e=C,u}function c0(e,t,a,r,o){var s,i,c,u,d,h=a.length,f=h,p=0;for(e.__k=new Array(o),s=0;s<o;s++)(i=t[s])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[s]=hs(null,i,null,null,null):bl(i)?i=e.__k[s]=hs(H,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[s]=hs(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[s]=i,u=s+p,i.__=e,i.__b=e.__b+1,c=null,(d=i.__i=u0(i,a,u,f))!=-1&&(f--,(c=a[d])&&(c.__u|=2)),c==null||c.__v==null?(d==-1&&(o>h?p--:o<h&&p++),typeof i.type!="function"&&(i.__u|=4)):d!=u&&(d==u-1?p--:d==u+1?p++:(d>u?p--:p++,i.__u|=4))):e.__k[s]=null;if(f)for(s=0;s<h;s++)(c=a[s])!=null&&(2&c.__u)==0&&(c.__e==r&&(r=lo(c)),bg(c,c));return r}function mg(e,t,a,r){var o,s;if(typeof e.type=="function"){for(o=e.__k,s=0;o&&s<o.length;s++)o[s]&&(o[s].__=e,t=mg(o[s],t,a,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=lo(e)),a.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ir(e,t){return t=t||[],e==null||typeof e=="boolean"||(bl(e)?e.some(function(a){ir(a,t)}):t.push(e)),t}function u0(e,t,a,r){var o,s,i,c=e.key,u=e.type,d=t[a],h=d!=null&&(2&d.__u)==0;if(d===null&&c==null||h&&c==d.key&&u==d.type)return a;if(r>(h?1:0)){for(o=a-1,s=a+1;o>=0||s<t.length;)if((d=t[i=o>=0?o--:s++])!=null&&(2&d.__u)==0&&c==d.key&&u==d.type)return i}return-1}function kp(e,t,a){t[0]=="-"?e.setProperty(t,a??""):e[t]=a==null?"":typeof a!="number"||i0.test(t)?a:a+"px"}function Kl(e,t,a,r,o){var s,i;e:if(t=="style")if(typeof a=="string")e.style.cssText=a;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)a&&t in a||kp(e.style,t,"");if(a)for(t in a)r&&a[t]==r[t]||kp(e.style,t,a[t])}else if(t[0]=="o"&&t[1]=="n")s=t!=(t=t.replace(ug,"$1")),i=t.toLowerCase(),t=i in e||t=="onFocusOut"||t=="onFocusIn"?i.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=a,a?r?a.u=r.u:(a.u=Ch,e.addEventListener(t,s?ld:sd,s)):e.removeEventListener(t,s?ld:sd,s);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]=a??"";break e}catch{}typeof a=="function"||(a==null||a===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&a==1?"":a))}}function Sp(e){return function(t){if(this.l){var a=this.l[t.type+e];if(t.t==null)t.t=Ch++;else if(t.t<a.u)return;return a(J.event?J.event(t):t)}}}function Eh(e,t,a,r,o,s,i,c,u,d){var h,f,p,v,w,C,T,b,g,y,E,x,S,k,I,A,O,z=t.type;if(t.constructor!==void 0)return null;128&a.__u&&(u=!!(32&a.__u),s=[c=t.__e=a.__e]),(h=J.__b)&&h(t);e:if(typeof z=="function")try{if(b=t.props,g="prototype"in z&&z.prototype.render,y=(h=z.contextType)&&r[h.__c],E=h?y?y.props.value:h.__:r,a.__c?T=(f=t.__c=a.__c).__=f.__E:(g?t.__c=f=new z(b,E):(t.__c=f=new Mt(b,E),f.constructor=z,f.render=h0),y&&y.sub(f),f.state||(f.state={}),f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),g&&f.__s==null&&(f.__s=f.state),g&&z.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Cn({},f.__s)),Cn(f.__s,z.getDerivedStateFromProps(b,f.__s))),v=f.props,w=f.state,f.__v=t,p)g&&z.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),g&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(g&&z.getDerivedStateFromProps==null&&b!==v&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(b,E),t.__v==a.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(b,f.__s,E)===!1){for(t.__v!=a.__v&&(f.props=b,f.state=f.__s,f.__d=!1),t.__e=a.__e,t.__k=a.__k,t.__k.some(function(se){se&&(se.__=t)}),x=0;x<f._sb.length;x++)f.__h.push(f._sb[x]);f._sb=[],f.__h.length&&i.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(b,f.__s,E),g&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(v,w,C)})}if(f.context=E,f.props=b,f.__P=e,f.__e=!1,S=J.__r,k=0,g){for(f.state=f.__s,f.__d=!1,S&&S(t),h=f.render(f.props,f.state,f.context),I=0;I<f._sb.length;I++)f.__h.push(f._sb[I]);f._sb=[]}else do f.__d=!1,S&&S(t),h=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(r=Cn(Cn({},r),f.getChildContext())),g&&!p&&f.getSnapshotBeforeUpdate!=null&&(C=f.getSnapshotBeforeUpdate(v,w)),A=h,h!=null&&h.type===H&&h.key==null&&(A=gg(h.props.children)),c=pg(e,bl(A)?A:[A],t,a,r,o,s,i,c,u,d),f.base=t.__e,t.__u&=-161,f.__h.length&&i.push(f),T&&(f.__E=f.__=null)}catch(se){if(t.__v=null,u||s!=null)if(se.then){for(t.__u|=u?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,t.__e=c}else{for(O=s.length;O--;)Th(s[O]);cd(t)}else t.__e=a.__e,t.__k=a.__k,se.then||cd(t);J.__e(se,t,a)}else s==null&&t.__v==a.__v?(t.__k=a.__k,t.__e=a.__e):c=t.__e=d0(a.__e,t,a,r,o,s,i,u,d);return(h=J.diffed)&&h(t),128&t.__u?void 0:c}function cd(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(cd)}function vg(e,t,a){for(var r=0;r<a.length;r++)Ah(a[r],a[++r],a[++r]);J.__c&&J.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(s){s.call(o)})}catch(s){J.__e(s,o.__v)}})}function gg(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:bl(e)?e.map(gg):Cn({},e)}function d0(e,t,a,r,o,s,i,c,u){var d,h,f,p,v,w,C,T=a.props||Hs,b=t.props,g=t.type;if(g=="svg"?o="http://www.w3.org/2000/svg":g=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),s!=null){for(d=0;d<s.length;d++)if((v=s[d])&&"setAttribute"in v==!!g&&(g?v.localName==g:v.nodeType==3)){e=v,s[d]=null;break}}if(e==null){if(g==null)return document.createTextNode(b);e=document.createElementNS(o,g,b.is&&b),c&&(J.__m&&J.__m(t,s),c=!1),s=null}if(g==null)T===b||c&&e.data==b||(e.data=b);else{if(s=s&&gl.call(e.childNodes),!c&&s!=null)for(T={},d=0;d<e.attributes.length;d++)T[(v=e.attributes[d]).name]=v.value;for(d in T)if(v=T[d],d!="children"){if(d=="dangerouslySetInnerHTML")f=v;else if(!(d in b)){if(d=="value"&&"defaultValue"in b||d=="checked"&&"defaultChecked"in b)continue;Kl(e,d,null,v,o)}}for(d in b)v=b[d],d=="children"?p=v:d=="dangerouslySetInnerHTML"?h=v:d=="value"?w=v:d=="checked"?C=v:c&&typeof v!="function"||T[d]===v||Kl(e,d,v,T[d],o);if(h)c||f&&(h.__html==f.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(f&&(e.innerHTML=""),pg(t.type=="template"?e.content:e,bl(p)?p:[p],t,a,r,g=="foreignObject"?"http://www.w3.org/1999/xhtml":o,s,i,s?s[0]:a.__k&&lo(a,0),c,u),s!=null)for(d=s.length;d--;)Th(s[d]);c||(d="value",g=="progress"&&w==null?e.removeAttribute("value"):w!=null&&(w!==e[d]||g=="progress"&&!w||g=="option"&&w!=T[d])&&Kl(e,d,w,T[d],o),d="checked",C!=null&&C!=e[d]&&Kl(e,d,C,T[d],o))}return e}function Ah(e,t,a){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(o){J.__e(o,a)}}function bg(e,t,a){var r,o;if(J.unmount&&J.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Ah(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){J.__e(s,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&bg(r[o],t,a||typeof e.type!="function");a||Th(e.__e),e.__c=e.__=e.__e=void 0}function h0(e,t,a){return this.constructor(e,a)}function ud(e,t,a){var r,o,s,i;t==document&&(t=document.documentElement),J.__&&J.__(e,t),o=(r=!1)?null:t.__k,s=[],i=[],Eh(t,e=t.__k=an(H,null,[e]),o||Hs,Hs,t.namespaceURI,o?null:t.firstChild?gl.call(t.childNodes):null,s,o?o.__e:t.firstChild,r,i),vg(s,e,i)}function f0(e,t,a){var r,o,s,i,c=Cn({},e.props);for(s in e.type&&e.type.defaultProps&&(i=e.type.defaultProps),t)s=="key"?r=t[s]:s=="ref"?o=t[s]:c[s]=t[s]===void 0&&i!=null?i[s]:t[s];return arguments.length>2&&(c.children=arguments.length>3?gl.call(arguments,2):a),hs(e.type,c,r||e.key,o||e.ref,null)}function xg(e){function t(a){var r,o;return this.getChildContext||(r=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(s){this.props.value!=s.value&&r.forEach(function(i){i.__e=!0,id(i)})},this.sub=function(s){r.add(s);var i=s.componentWillUnmount;s.componentWillUnmount=function(){r&&r.delete(s),i&&i.call(s)}}),a.children}return t.__c="__cC"+dg++,t.__=e,t.Provider=t.__l=(t.Consumer=function(a,r){return a.children(r)}).contextType=t,t}gl=hg.slice,J={__e:function(e,t,a,r){for(var o,s,i;t=t.__;)if((o=t.__c)&&!o.__)try{if((s=o.constructor)&&s.getDerivedStateFromError!=null&&(o.setState(s.getDerivedStateFromError(e)),i=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),i=o.__d),i)return o.__E=o}catch(c){e=c}throw e}},sg=0,lg=function(e){return e!=null&&e.constructor===void 0},Mt.prototype.setState=function(e,t){var a;a=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Cn({},this.state),typeof e=="function"&&(e=e(Cn({},a),this.props)),e&&Cn(a,e),e!=null&&this.__v&&(t&&this._sb.push(t),id(this))},Mt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),id(this))},Mt.prototype.render=H,za=[],ig=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,cg=function(e,t){return e.__v.__b-t.__v.__b},Gi.__r=0,ug=/(PointerCapture)$|Capture$/i,Ch=0,sd=Sp(!1),ld=Sp(!0),dg=0;var p0=0;function n(e,t,a,r,o,s){t||(t={});var i,c,u=t;if("ref"in u)for(c in u={},t)c=="ref"?i=t[c]:u[c]=t[c];var d={type:e,props:u,key:a,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--p0,__i:-1,__u:0,__source:o,__self:s};if(typeof e=="function"&&(i=e.defaultProps))for(c in i)u[c]===void 0&&(u[c]=i[c]);return J.vnode&&J.vnode(d),d}const m0="modulepreload",v0=function(e){return"/"+e},_p={},Ee=function(t,a,r){let o=Promise.resolve();if(a&&a.length>0){let u=function(d){return Promise.all(d.map(h=>Promise.resolve(h).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=i?.nonce||i?.getAttribute("nonce");o=u(a.map(d=>{if(d=v0(d),d in _p)return;_p[d]=!0;const h=d.endsWith(".css"),f=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${f}`))return;const p=document.createElement("link");if(p.rel=h?"stylesheet":m0,h||(p.as="script"),p.crossOrigin="",p.href=d,c&&p.setAttribute("nonce",c),document.head.appendChild(p),h)return new Promise((v,w)=>{p.addEventListener("load",v),p.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return o.then(i=>{for(const c of i||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};var cr,me,_u,Cp,Bs=0,yg=[],Se=J,Tp=Se.__b,Ep=Se.__r,Ap=Se.diffed,Mp=Se.__c,Ip=Se.unmount,Rp=Se.__;function xl(e,t){Se.__h&&Se.__h(me,e,Bs||t),Bs=0;var a=me.__H||(me.__H={__:[],__h:[]});return e>=a.__.length&&a.__.push({}),a.__[e]}function U(e){return Bs=1,g0(kg,e)}function g0(e,t,a){var r=xl(cr++,2);if(r.t=e,!r.__c&&(r.__=[a?a(t):kg(void 0,t),function(c){var u=r.__N?r.__N[0]:r.__[0],d=r.t(u,c);u!==d&&(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=me,!me.__f)){var o=function(c,u,d){if(!r.__c.__H)return!0;var h=r.__c.__H.__.filter(function(p){return!!p.__c});if(h.every(function(p){return!p.__N}))return!s||s.call(this,c,u,d);var f=r.__c.props!==c;return h.forEach(function(p){if(p.__N){var v=p.__[0];p.__=p.__N,p.__N=void 0,v!==p.__[0]&&(f=!0)}}),s&&s.call(this,c,u,d)||f};me.__f=!0;var s=me.shouldComponentUpdate,i=me.componentWillUpdate;me.componentWillUpdate=function(c,u,d){if(this.__e){var h=s;s=void 0,o(c,u,d),s=h}i&&i.call(this,c,u,d)},me.shouldComponentUpdate=o}return r.__N||r.__}function R(e,t){var a=xl(cr++,3);!Se.__s&&Ih(a.__H,t)&&(a.__=e,a.u=t,me.__H.__h.push(a))}function Mh(e,t){var a=xl(cr++,4);!Se.__s&&Ih(a.__H,t)&&(a.__=e,a.u=t,me.__h.push(a))}function F(e){return Bs=5,ye(function(){return{current:e}},[])}function ye(e,t){var a=xl(cr++,7);return Ih(a.__H,t)&&(a.__=e(),a.__H=t,a.__h=e),a.__}function Q(e,t){return Bs=8,ye(function(){return e},t)}function wg(e){var t=me.context[e.__c],a=xl(cr++,9);return a.c=e,t?(a.__==null&&(a.__=!0,t.sub(me)),t.props.value):e.__}function b0(){for(var e;e=yg.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(wi),e.__H.__h.forEach(dd),e.__H.__h=[]}catch(t){e.__H.__h=[],Se.__e(t,e.__v)}}Se.__b=function(e){me=null,Tp&&Tp(e)},Se.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Rp&&Rp(e,t)},Se.__r=function(e){Ep&&Ep(e),cr=0;var t=(me=e.__c).__H;t&&(_u===me?(t.__h=[],me.__h=[],t.__.forEach(function(a){a.__N&&(a.__=a.__N),a.u=a.__N=void 0})):(t.__h.forEach(wi),t.__h.forEach(dd),t.__h=[],cr=0)),_u=me},Se.diffed=function(e){Ap&&Ap(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(yg.push(t)!==1&&Cp===Se.requestAnimationFrame||((Cp=Se.requestAnimationFrame)||x0)(b0)),t.__H.__.forEach(function(a){a.u&&(a.__H=a.u),a.u=void 0})),_u=me=null},Se.__c=function(e,t){t.some(function(a){try{a.__h.forEach(wi),a.__h=a.__h.filter(function(r){return!r.__||dd(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],Se.__e(r,a.__v)}}),Mp&&Mp(e,t)},Se.unmount=function(e){Ip&&Ip(e);var t,a=e.__c;a&&a.__H&&(a.__H.__.forEach(function(r){try{wi(r)}catch(o){t=o}}),a.__H=void 0,t&&Se.__e(t,a.__v))};var Lp=typeof requestAnimationFrame=="function";function x0(e){var t,a=function(){clearTimeout(r),Lp&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(a,35);Lp&&(t=requestAnimationFrame(a))}function wi(e){var t=me,a=e.__c;typeof a=="function"&&(e.__c=void 0,a()),me=t}function dd(e){var t=me;e.__c=e.__(),me=t}function Ih(e,t){return!e||e.length!==t.length||t.some(function(a,r){return a!==e[r]})}function kg(e,t){return typeof t=="function"?t(e):t}var y0=Symbol.for("preact-signals");function Pc(){if(ha>1)ha--;else{for(var e,t=!1;fs!==void 0;){var a=fs;for(fs=void 0,hd++;a!==void 0;){var r=a.o;if(a.o=void 0,a.f&=-3,!(8&a.f)&&Cg(a))try{a.c()}catch(o){t||(e=o,t=!0)}a=r}}if(hd=0,ha--,t)throw e}}function Oc(e){if(ha>0)return e();ha++;try{return e()}finally{Pc()}}var oe=void 0;function Sg(e){var t=oe;oe=void 0;try{return e()}finally{oe=t}}var fs=void 0,ha=0,hd=0,Ji=0;function _g(e){if(oe!==void 0){var t=e.n;if(t===void 0||t.t!==oe)return t={i:0,S:e,p:oe.s,n:void 0,t:oe,e:void 0,x:void 0,r:t},oe.s!==void 0&&(oe.s.n=t),oe.s=t,e.n=t,32&oe.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=oe.s,t.n=void 0,oe.s.n=t,oe.s=t),t}}function qe(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}qe.prototype.brand=y0;qe.prototype.h=function(){return!0};qe.prototype.S=function(e){var t=this,a=this.t;a!==e&&e.e===void 0&&(e.x=a,this.t=e,a!==void 0?a.e=e:Sg(function(){var r;(r=t.W)==null||r.call(t)}))};qe.prototype.U=function(e){var t=this;if(this.t!==void 0){var a=e.e,r=e.x;a!==void 0&&(a.x=r,e.e=void 0),r!==void 0&&(r.e=a,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&Sg(function(){var o;(o=t.Z)==null||o.call(t)}))}};qe.prototype.subscribe=function(e){var t=this;return _e(function(){var a=t.value,r=oe;oe=void 0;try{e(a)}finally{oe=r}},{name:"sub"})};qe.prototype.valueOf=function(){return this.value};qe.prototype.toString=function(){return this.value+""};qe.prototype.toJSON=function(){return this.value};qe.prototype.peek=function(){var e=oe;oe=void 0;try{return this.value}finally{oe=e}};Object.defineProperty(qe.prototype,"value",{get:function(){var e=_g(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(hd>100)throw new Error("Cycle detected");this.v=e,this.i++,Ji++,ha++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Pc()}}}});function m(e,t){return new qe(e,t)}function Cg(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 Tg(e){for(var t=e.s;t!==void 0;t=t.n){var a=t.S.n;if(a!==void 0&&(t.r=a),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Eg(e){for(var t=e.s,a=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):a=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=a}function Tr(e,t){qe.call(this,void 0),this.x=e,this.s=void 0,this.g=Ji-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Tr.prototype=new qe;Tr.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ji))return!0;if(this.g=Ji,this.f|=1,this.i>0&&!Cg(this))return this.f&=-2,!0;var e=oe;try{Tg(this),oe=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(a){this.v=a,this.f|=16,this.i++}return oe=e,Eg(this),this.f&=-2,!0};Tr.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)}qe.prototype.S.call(this,e)};Tr.prototype.U=function(e){if(this.t!==void 0&&(qe.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)}};Tr.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(Tr.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=_g(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function K(e,t){return new Tr(e,t)}function Ag(e){var t=e.u;if(e.u=void 0,typeof t=="function"){ha++;var a=oe;oe=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,Rh(e),r}finally{oe=a,Pc()}}}function Rh(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Ag(e)}function w0(e){if(oe!==this)throw new Error("Out-of-order effect");Eg(this),oe=e,this.f&=-2,8&this.f&&Rh(this),Pc()}function Ao(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}Ao.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()}};Ao.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Ag(this),Tg(this),ha++;var e=oe;return oe=this,w0.bind(this,e)};Ao.prototype.N=function(){2&this.f||(this.f|=2,this.o=fs,fs=this)};Ao.prototype.d=function(){this.f|=8,1&this.f||Rh(this)};Ao.prototype.dispose=function(){this.d()};function _e(e,t){var a=new Ao(e,t);try{a.c()}catch(o){throw a.d(),o}var r=a.d.bind(a);return r[Symbol.dispose]=r,r}var Lh,Nc,ql,k0=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,Mg=[],Ig=[];_e(function(){Lh=this.N})();function Mo(e,t){J[e]=t.bind(null,J[e]||function(){})}function Yi(e){if(ql){var t=ql;ql=void 0,t()}ql=e&&e.S()}function Rg(e){var t=this,a=e.data,r=X(a);r.value=a;var o=ye(function(){for(var c=t,u=t.__v;u=u.__;)if(u.__c){u.__c.__$f|=4;break}var d=K(function(){var v=r.value.value;return v===0?0:v===!0?"":v||""}),h=K(function(){return!Array.isArray(d.value)&&!lg(d.value)}),f=_e(function(){if(this.N=Lg,h.value){var v=d.value;c.__v&&c.__v.__e&&c.__v.__e.nodeType===3&&(c.__v.__e.data=v)}}),p=t.__$u.d;return t.__$u.d=function(){f(),p.call(this)},[h,d]},[]),s=o[0],i=o[1];return s.value?i.peek():i.value}Rg.displayName="ReactiveTextNode";Object.defineProperties(qe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Rg},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Mo("__b",function(e,t){if(typeof t.type=="string"){var a,r=t.props;for(var o in r)if(o!=="children"){var s=r[o];s instanceof qe&&(a||(t.__np=a={}),a[o]=s,r[o]=s.peek())}}e(t)});Mo("__r",function(e,t){if(e(t),t.type!==H){Yi();var a,r=t.__c;r&&(r.__$f&=-2,(a=r.__$u)===void 0&&(r.__$u=a=(function(o,s){var i;return _e(function(){i=this},{name:s}),i.c=o,i})(function(){var o;k0&&((o=a.y)==null||o.call(a)),r.__$f|=1,r.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),Nc=r,Yi(a)}});Mo("__e",function(e,t,a,r){Yi(),Nc=void 0,e(t,a,r)});Mo("diffed",function(e,t){Yi(),Nc=void 0;var a;if(typeof t.type=="string"&&(a=t.__e)){var r=t.__np,o=t.props;if(r){var s=a.U;if(s)for(var i in s){var c=s[i];c!==void 0&&!(i in r)&&(c.d(),s[i]=void 0)}else s={},a.U=s;for(var u in r){var d=s[u],h=r[u];d===void 0?(d=S0(a,u,h),s[u]=d):d.o(h,o)}for(var f in r)o[f]=r[f]}}e(t)});function S0(e,t,a,r){var o=t in e&&e.ownerSVGElement===void 0,s=m(a),i=a.peek();return{o:function(c,u){s.value=c,i=c.peek()},d:_e(function(){this.N=Lg;var c=s.value.value;i!==c?(i=void 0,o?e[t]=c:c!=null&&(c!==!1||t[4]==="-")?e.setAttribute(t,c):e.removeAttribute(t)):i=void 0})}}Mo("unmount",function(e,t){if(typeof t.type=="string"){var a=t.__e;if(a){var r=a.U;if(r){a.U=void 0;for(var o in r){var s=r[o];s&&s.d()}}}t.__np=void 0}else{var i=t.__c;if(i){var c=i.__$u;c&&(i.__$u=void 0,c.d())}}e(t)});Mo("__h",function(e,t,a,r){(r<3||r===9)&&(t.__$f|=2),e(t,a,r)});Mt.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var a=this.__$u,r=a&&a.s!==void 0;for(var o in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var s=2&this.__$f;if(!(r||s||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var i in e)if(i!=="__source"&&e[i]!==this.props[i])return!0;for(var c in this.props)if(!(c in e))return!0;return!1};function X(e,t){return ye(function(){return m(e,t)},[])}function Fc(e,t){var a=F(e);return a.current=e,Nc.__$f|=4,ye(function(){return K(function(){return a.current()},t)},[])}var _0=typeof requestAnimationFrame>"u"?setTimeout:function(e){var t=function(){clearTimeout(a),cancelAnimationFrame(r),e()},a=setTimeout(t,35),r=requestAnimationFrame(t)},C0=function(e){queueMicrotask(function(){queueMicrotask(e)})};function T0(){Oc(function(){for(var e;e=Mg.shift();)Lh.call(e)})}function E0(){Mg.push(this)===1&&(J.requestAnimationFrame||_0)(T0)}function A0(){Oc(function(){for(var e;e=Ig.shift();)Lh.call(e)})}function Lg(){Ig.push(this)===1&&(J.requestAnimationFrame||C0)(A0)}function fd(e,t){var a=F(e);a.current=e,R(function(){return _e(function(){return this.N=E0,a.current()},t)},[])}var M0={};function as(e,t){for(var a in t)e[a]=t[a];return e}function pd(e,t,a){var r,o=/(?:\?([^#]*))?(#.*)?$/,s=e.match(o),i={};if(s&&s[1])for(var c=s[1].split("&"),u=0;u<c.length;u++){var d=c[u].split("=");i[decodeURIComponent(d[0])]=decodeURIComponent(d.slice(1).join("="))}e=md(e.replace(o,"")),t=md(t||"");for(var h=Math.max(e.length,t.length),f=0;f<h;f++)if(t[f]&&t[f].charAt(0)===":"){var p=t[f].replace(/(^:|[+*?]+$)/g,""),v=(t[f].match(/[+*?]+$/)||M0)[0]||"",w=~v.indexOf("+"),C=~v.indexOf("*"),T=e[f]||"";if(!T&&!C&&(v.indexOf("?")<0||w)){r=!1;break}if(i[p]=decodeURIComponent(T),w||C){i[p]=e.slice(f).map(decodeURIComponent).join("/");break}}else if(t[f]!==e[f]){r=!1;break}return(a.default===!0||r!==!1)&&i}function I0(e,t){return e.rank<t.rank?1:e.rank>t.rank?-1:e.index-t.index}function R0(e,t){return e.index=t,e.rank=(function(a){return a.props.default?0:md(a.props.path).map(L0).join("")})(e),e.props}function md(e){return e.replace(/(^\/+|\/+$)/g,"").split("/")}function L0(e){return e.charAt(0)==":"?1+"*+?".indexOf(e.charAt(e.length-1))||4:5}var $0={},Qa=[],ps=[],_t=null,$h={url:zc()},$g=xg($h);function D0(){var e=wg($g);if(e===$h){var t=U()[1];R(function(){return ps.push(t),function(){return ps.splice(ps.indexOf(t),1)}},[])}return[e,Oe]}function zc(){var e;return""+((e=_t&&_t.location?_t.location:_t&&_t.getCurrentLocation?_t.getCurrentLocation():typeof location<"u"?location:$0).pathname||"")+(e.search||"")}function Oe(e,t){return t===void 0&&(t=!1),typeof e!="string"&&e.url&&(t=e.replace,e=e.url),(function(a){for(var r=Qa.length;r--;)if(Qa[r].canRoute(a))return!0;return!1})(e)&&(function(a,r){r===void 0&&(r="push"),_t&&_t[r]?_t[r](a):typeof history<"u"&&history[r+"State"]&&history[r+"State"](null,null,a)})(e,t?"replace":"push"),Dg(e)}function Dg(e){for(var t=!1,a=0;a<Qa.length;a++)Qa[a].routeTo(e)&&(t=!0);return t}function P0(e){if(e&&e.getAttribute){var t=e.getAttribute("href"),a=e.getAttribute("target");if(t&&t.match(/^\//g)&&(!a||a.match(/^_?self$/i)))return Oe(t)}}function O0(e){return e.stopImmediatePropagation&&e.stopImmediatePropagation(),e.stopPropagation&&e.stopPropagation(),e.preventDefault(),!1}function Pg(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(P0(t))return O0(e)}while(t=t.parentNode)}}var $p=!1;function Og(e){e.history&&(_t=e.history),this.state={url:e.url||zc()}}as(Og.prototype=new Mt,{shouldComponentUpdate:function(e){return e.static!==!0||e.url!==this.props.url||e.onChange!==this.props.onChange},canRoute:function(e){var t=ir(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;$p||($p=!0,_t||addEventListener("popstate",function(){Dg(zc())}),addEventListener("click",Pg)),Qa.push(this),_t&&(this.u=_t.listen(function(t){var a=t.location||t;e.routeTo(""+(a.pathname||"")+(a.search||""))})),this.p=!1},componentWillUnmount:function(){typeof this.u=="function"&&this.u(),Qa.splice(Qa.indexOf(this),1)},componentWillUpdate:function(){this.p=!0},componentDidUpdate:function(){this.p=!1},g:function(e,t){e=e.filter(R0).sort(I0);for(var a=0;a<e.length;a++){var r=e[a],o=pd(t,r.props.path,r.props);if(o)return[r,o]}},render:function(e,t){var a,r,o=e.onChange,s=t.url,i=this.c,c=this.g(ir(e.children),s);if(c&&(r=f0(c[0],as(as({url:s,matches:a=c[1]},a),{key:void 0,ref:void 0}))),s!==(i&&i.url)){as($h,i=this.c={url:s,previous:i&&i.url,current:r,path:r?r.props.path:null,matches:a}),i.router=this,i.active=r?[r]:[];for(var u=ps.length;u--;)ps[u]({});typeof o=="function"&&o(i)}return an($g.Provider,{value:i},r)}});var N0=function(e){return an("a",as({onClick:Pg},e))};const F0={bgPrimary:"--color-bg-primary",bgSecondary:"--color-bg-secondary",bgTertiary:"--color-bg-tertiary",bgSurface:"--color-bg-surface",bgElevated:"--color-bg-elevated",bgHover:"--color-bg-hover",bgActive:"--color-bg-active",textPrimary:"--color-text-primary",textSecondary:"--color-text-secondary",textTertiary:"--color-text-tertiary",textMuted:"--color-text-muted",textInverse:"--color-text-inverse",accent:"--color-accent",accentHover:"--color-accent-hover",accentActive:"--color-accent-active",accentMuted:"--color-accent-muted",accentText:"--color-accent-text",success:"--color-success",successMuted:"--color-success-muted",warning:"--color-warning",warningMuted:"--color-warning-muted",error:"--color-error",errorMuted:"--color-error-muted",info:"--color-info",infoMuted:"--color-info-muted",border:"--color-border",borderHover:"--color-border-hover",borderFocus:"--color-border-focus",shadowSm:"--shadow-sm",shadowMd:"--shadow-md",shadowLg:"--shadow-lg",syntaxComment:"--color-syntax-comment",syntaxString:"--color-syntax-string",syntaxKeyword:"--color-syntax-keyword",syntaxFunction:"--color-syntax-function",syntaxNumber:"--color-syntax-number",syntaxOperator:"--color-syntax-operator",syntaxVariable:"--color-syntax-variable",syntaxPunctuation:"--color-syntax-punctuation",syntaxProperty:"--color-syntax-property",syntaxTag:"--color-syntax-tag",syntaxClass:"--color-syntax-class"},Ng=Object.entries(F0),z0=Ng.reduce((e,[t,a])=>(e[a]=t,e),{});function Fg(e){const t={};for(const[a,r]of Ng)t[r]=e[a];return t}function U0(e){const t={};for(const[a,r]of Object.entries(z0))t[r]=e[a];return t}function Re(e){return{...e,colors:Fg(e.tokens)}}function j0(e){return"tokens"in e?{...e,colors:Fg(e.tokens)}:{...e,tokens:U0(e.colors)}}const Dp={selected:"system",lightTheme:"light",darkTheme:"dark"},H0=Re({id:"light",name:"Light",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#ffffff",bgSecondary:"#f1f5f9",bgTertiary:"#e2e8f0",bgSurface:"#f8fafc",bgElevated:"#ffffff",bgHover:"#f1f5f9",bgActive:"#e2e8f0",textPrimary:"#0f172a",textSecondary:"#475569",textTertiary:"#64748b",textMuted:"#94a3b8",textInverse:"#f8fafc",accent:"#e11d48",accentHover:"#be123c",accentActive:"#9f1239",accentMuted:"#ffe4e6",accentText:"#ffffff",success:"#16a34a",successMuted:"#dcfce7",warning:"#d97706",warningMuted:"#fef3c7",error:"#dc2626",errorMuted:"#fee2e2",info:"#0284c7",infoMuted:"#e0f2fe",border:"#e2e8f0",borderHover:"#cbd5e1",borderFocus:"#e11d48",shadowSm:"0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.12), 0 4px 6px -4px rgb(0 0 0 / 0.1)",syntaxComment:"#a0a1a7",syntaxString:"#50a14f",syntaxKeyword:"#a626a4",syntaxFunction:"#4078f2",syntaxNumber:"#986801",syntaxOperator:"#0184bc",syntaxVariable:"#e45649",syntaxPunctuation:"#383a42",syntaxProperty:"#e45649",syntaxTag:"#e45649",syntaxClass:"#c18401"}}),B0=Re({id:"dark",name:"Dark",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#0f0f12",bgSecondary:"#0a0a0c",bgTertiary:"#161619",bgSurface:"#1a1a1f",bgElevated:"#222228",bgHover:"#2a2a32",bgActive:"#363640",textPrimary:"#f4f4f5",textSecondary:"#a1a1aa",textTertiary:"#71717a",textMuted:"#52525b",textInverse:"#09090b",accent:"#f97066",accentHover:"#ef5a50",accentActive:"#dc4840",accentMuted:"#5c2320",accentText:"#ffffff",success:"#22c55e",successMuted:"#14532d",warning:"#f59e0b",warningMuted:"#451a03",error:"#f43f5e",errorMuted:"#4c0519",info:"#38bdf8",infoMuted:"#0c4a6e",border:"#252530",borderHover:"#3f3f4a",borderFocus:"#f97066",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#5c6370",syntaxString:"#98c379",syntaxKeyword:"#c678dd",syntaxFunction:"#61afef",syntaxNumber:"#d19a66",syntaxOperator:"#56b6c2",syntaxVariable:"#e06c75",syntaxPunctuation:"#abb2bf",syntaxProperty:"#e06c75",syntaxTag:"#e06c75",syntaxClass:"#e5c07b"}}),W0=Re({id:"dracula",name:"Dracula",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#282a36",bgSecondary:"#1e1f29",bgTertiary:"#191a23",bgSurface:"#343746",bgElevated:"#44475a",bgHover:"#3c3f52",bgActive:"#44475a",textPrimary:"#f8f8f2",textSecondary:"#e6e6e0",textTertiary:"#bfbfb8",textMuted:"#6272a4",textInverse:"#282a36",accent:"#bd93f9",accentHover:"#caa9fa",accentActive:"#a67bf5",accentMuted:"#3d3560",accentText:"#282a36",success:"#50fa7b",successMuted:"#1f3528",warning:"#f1fa8c",warningMuted:"#35351f",error:"#ff5555",errorMuted:"#402020",info:"#8be9fd",infoMuted:"#1f3538",border:"#44475a",borderHover:"#565970",borderFocus:"#bd93f9",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#6272a4",syntaxString:"#f1fa8c",syntaxKeyword:"#ff79c6",syntaxFunction:"#50fa7b",syntaxNumber:"#bd93f9",syntaxOperator:"#ff79c6",syntaxVariable:"#f8f8f2",syntaxPunctuation:"#f8f8f2",syntaxProperty:"#66d9ef",syntaxTag:"#ff79c6",syntaxClass:"#8be9fd"}}),K0=Re({id:"catppuccin-mocha",name:"Catppuccin Mocha",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#1e1e2e",bgSecondary:"#11111b",bgTertiary:"#181825",bgSurface:"#313244",bgElevated:"#45475a",bgHover:"#313244",bgActive:"#45475a",textPrimary:"#cdd6f4",textSecondary:"#bac2de",textTertiary:"#a6adc8",textMuted:"#6c7086",textInverse:"#1e1e2e",accent:"#f5c2e7",accentHover:"#f5e0dc",accentActive:"#cba6f7",accentMuted:"#3d2d40",accentText:"#1e1e2e",success:"#a6e3a1",successMuted:"#243028",warning:"#f9e2af",warningMuted:"#382f20",error:"#f38ba8",errorMuted:"#3d2430",info:"#89dceb",infoMuted:"#203035",border:"#45475a",borderHover:"#585b70",borderFocus:"#f5c2e7",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.35)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.45), 0 2px 4px -2px rgb(0 0 0 / 0.45)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.55), 0 4px 6px -4px rgb(0 0 0 / 0.55)",syntaxComment:"#6c7086",syntaxString:"#a6e3a1",syntaxKeyword:"#cba6f7",syntaxFunction:"#89b4fa",syntaxNumber:"#fab387",syntaxOperator:"#89dceb",syntaxVariable:"#f38ba8",syntaxPunctuation:"#cdd6f4",syntaxProperty:"#f5c2e7",syntaxTag:"#cba6f7",syntaxClass:"#f9e2af"}}),q0=Re({id:"catppuccin-latte",name:"Catppuccin Latte",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#eff1f5",bgSecondary:"#dce0e8",bgTertiary:"#e6e9ef",bgSurface:"#ffffff",bgElevated:"#ffffff",bgHover:"#e6e9ef",bgActive:"#ccd0da",textPrimary:"#4c4f69",textSecondary:"#5c5f77",textTertiary:"#6c6f85",textMuted:"#9ca0b0",textInverse:"#eff1f5",accent:"#ea76cb",accentHover:"#d65db1",accentActive:"#8839ef",accentMuted:"#f5e0f0",accentText:"#ffffff",success:"#40a02b",successMuted:"#d8f0d0",warning:"#df8e1d",warningMuted:"#f9ecd0",error:"#d20f39",errorMuted:"#f9d5dd",info:"#04a5e5",infoMuted:"#d0f0f9",border:"#ccd0da",borderHover:"#bcc0cc",borderFocus:"#ea76cb",shadowSm:"0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.06)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.08)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.08)",syntaxComment:"#9ca0b0",syntaxString:"#40a02b",syntaxKeyword:"#8839ef",syntaxFunction:"#1e66f5",syntaxNumber:"#fe640b",syntaxOperator:"#04a5e5",syntaxVariable:"#d20f39",syntaxPunctuation:"#4c4f69",syntaxProperty:"#ea76cb",syntaxTag:"#8839ef",syntaxClass:"#df8e1d"}}),V0=Re({id:"nord",name:"Nord",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#2e3440",bgSecondary:"#242933",bgTertiary:"#1f232b",bgSurface:"#3b4252",bgElevated:"#434c5e",bgHover:"#3b4252",bgActive:"#4c566a",textPrimary:"#eceff4",textSecondary:"#e5e9f0",textTertiary:"#d8dee9",textMuted:"#616e88",textInverse:"#2e3440",accent:"#8fbcbb",accentHover:"#88c0d0",accentActive:"#81a1c1",accentMuted:"#304048",accentText:"#2e3440",success:"#a3be8c",successMuted:"#2e3d2e",warning:"#ebcb8b",warningMuted:"#3d3828",error:"#bf616a",errorMuted:"#3d2830",info:"#81a1c1",infoMuted:"#283040",border:"#3b4252",borderHover:"#4c566a",borderFocus:"#8fbcbb",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.3)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5)",syntaxComment:"#616e88",syntaxString:"#a3be8c",syntaxKeyword:"#81a1c1",syntaxFunction:"#88c0d0",syntaxNumber:"#b48ead",syntaxOperator:"#81a1c1",syntaxVariable:"#d8dee9",syntaxPunctuation:"#eceff4",syntaxProperty:"#8fbcbb",syntaxTag:"#81a1c1",syntaxClass:"#8fbcbb"}}),G0=Re({id:"gruvbox-dark",name:"Gruvbox Dark",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#282828",bgSecondary:"#1d2021",bgTertiary:"#32302f",bgSurface:"#3c3836",bgElevated:"#504945",bgHover:"#504945",bgActive:"#665c54",textPrimary:"#ebdbb2",textSecondary:"#d5c4a1",textTertiary:"#bdae93",textMuted:"#928374",textInverse:"#282828",accent:"#fe8019",accentHover:"#d65d0e",accentActive:"#af3a03",accentMuted:"#4a3526",accentText:"#282828",success:"#b8bb26",successMuted:"#3d4220",warning:"#fabd2f",warningMuted:"#4a4020",error:"#fb4934",errorMuted:"#4a2520",info:"#83a598",infoMuted:"#2a3a38",border:"#504945",borderHover:"#665c54",borderFocus:"#fe8019",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#928374",syntaxString:"#b8bb26",syntaxKeyword:"#fb4934",syntaxFunction:"#b8bb26",syntaxNumber:"#d3869b",syntaxOperator:"#fe8019",syntaxVariable:"#83a598",syntaxPunctuation:"#ebdbb2",syntaxProperty:"#8ec07c",syntaxTag:"#fb4934",syntaxClass:"#fabd2f"}}),J0=Re({id:"gruvbox-light",name:"Gruvbox Light",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#fbf1c7",bgSecondary:"#f2e5bc",bgTertiary:"#ebdbb2",bgSurface:"#f9f5d7",bgElevated:"#ffffff",bgHover:"#ebdbb2",bgActive:"#d5c4a1",textPrimary:"#3c3836",textSecondary:"#504945",textTertiary:"#665c54",textMuted:"#928374",textInverse:"#fbf1c7",accent:"#d65d0e",accentHover:"#af3a03",accentActive:"#8f3000",accentMuted:"#f0d8c0",accentText:"#fbf1c7",success:"#79740e",successMuted:"#e8ecc8",warning:"#b57614",warningMuted:"#f5e6c8",error:"#9d0006",errorMuted:"#f5d0c8",info:"#076678",infoMuted:"#c8e8f0",border:"#d5c4a1",borderHover:"#bdae93",borderFocus:"#d65d0e",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",syntaxComment:"#928374",syntaxString:"#79740e",syntaxKeyword:"#9d0006",syntaxFunction:"#79740e",syntaxNumber:"#8f3f71",syntaxOperator:"#af3a03",syntaxVariable:"#076678",syntaxPunctuation:"#3c3836",syntaxProperty:"#427b58",syntaxTag:"#9d0006",syntaxClass:"#b57614"}}),Y0=Re({id:"solarized-dark",name:"Solarized Dark",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#002b36",bgSecondary:"#00212b",bgTertiary:"#073642",bgSurface:"#073642",bgElevated:"#094552",bgHover:"#094552",bgActive:"#0a5565",textPrimary:"#839496",textSecondary:"#93a1a1",textTertiary:"#657b83",textMuted:"#586e75",textInverse:"#002b36",accent:"#268bd2",accentHover:"#1a7cc4",accentActive:"#1569a8",accentMuted:"#0a3a52",accentText:"#fdf6e3",success:"#859900",successMuted:"#2a3a20",warning:"#b58900",warningMuted:"#3a3520",error:"#dc322f",errorMuted:"#3a2020",info:"#2aa198",infoMuted:"#1a3a38",border:"#073642",borderHover:"#094552",borderFocus:"#268bd2",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#586e75",syntaxString:"#2aa198",syntaxKeyword:"#859900",syntaxFunction:"#268bd2",syntaxNumber:"#d33682",syntaxOperator:"#859900",syntaxVariable:"#b58900",syntaxPunctuation:"#839496",syntaxProperty:"#268bd2",syntaxTag:"#cb4b16",syntaxClass:"#cb4b16"}}),Z0=Re({id:"solarized-light",name:"Solarized Light",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#fdf6e3",bgSecondary:"#eee8d5",bgTertiary:"#e8e2cf",bgSurface:"#ffffff",bgElevated:"#ffffff",bgHover:"#eee8d5",bgActive:"#e0dac8",textPrimary:"#657b83",textSecondary:"#586e75",textTertiary:"#839496",textMuted:"#93a1a1",textInverse:"#fdf6e3",accent:"#268bd2",accentHover:"#1a7cc4",accentActive:"#1569a8",accentMuted:"#d0e8f5",accentText:"#fdf6e3",success:"#859900",successMuted:"#e8f0c8",warning:"#b58900",warningMuted:"#f5ecc8",error:"#dc322f",errorMuted:"#f5d0d0",info:"#2aa198",infoMuted:"#c8f0ec",border:"#eee8d5",borderHover:"#ddd8c5",borderFocus:"#268bd2",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",syntaxComment:"#93a1a1",syntaxString:"#2aa198",syntaxKeyword:"#859900",syntaxFunction:"#268bd2",syntaxNumber:"#d33682",syntaxOperator:"#859900",syntaxVariable:"#b58900",syntaxPunctuation:"#657b83",syntaxProperty:"#268bd2",syntaxTag:"#cb4b16",syntaxClass:"#cb4b16"}}),X0=Re({id:"one-dark",name:"One Dark",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#282c34",bgSecondary:"#21252b",bgTertiary:"#2c313a",bgSurface:"#3a3f4b",bgElevated:"#3e4451",bgHover:"#3a3f4b",bgActive:"#4b5263",textPrimary:"#abb2bf",textSecondary:"#9da5b4",textTertiary:"#7f848e",textMuted:"#5c6370",textInverse:"#282c34",accent:"#61afef",accentHover:"#528bcc",accentActive:"#4678a8",accentMuted:"#2a3a48",accentText:"#282c34",success:"#98c379",successMuted:"#2a3a28",warning:"#e5c07b",warningMuted:"#3a3828",error:"#e06c75",errorMuted:"#3a2828",info:"#56b6c2",infoMuted:"#203a3a",border:"#3a3f4b",borderHover:"#4b5263",borderFocus:"#61afef",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#5c6370",syntaxString:"#98c379",syntaxKeyword:"#c678dd",syntaxFunction:"#61afef",syntaxNumber:"#d19a66",syntaxOperator:"#56b6c2",syntaxVariable:"#e06c75",syntaxPunctuation:"#abb2bf",syntaxProperty:"#e06c75",syntaxTag:"#e06c75",syntaxClass:"#e5c07b"}}),Q0=Re({id:"tokyo-night",name:"Tokyo Night",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#1a1b26",bgSecondary:"#16161e",bgTertiary:"#1f2335",bgSurface:"#24283b",bgElevated:"#292e42",bgHover:"#292e42",bgActive:"#33384d",textPrimary:"#c0caf5",textSecondary:"#a9b1d6",textTertiary:"#787c99",textMuted:"#565f89",textInverse:"#1a1b26",accent:"#bb9af7",accentHover:"#9d7cd8",accentActive:"#7c5dc0",accentMuted:"#3d3560",accentText:"#1a1b26",success:"#9ece6a",successMuted:"#2a3a25",warning:"#e0af68",warningMuted:"#3a3525",error:"#f7768e",errorMuted:"#3a2530",info:"#7dcfff",infoMuted:"#1a3545",border:"#292e42",borderHover:"#3b4261",borderFocus:"#bb9af7",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#565f89",syntaxString:"#9ece6a",syntaxKeyword:"#bb9af7",syntaxFunction:"#7aa2f7",syntaxNumber:"#ff9e64",syntaxOperator:"#89ddff",syntaxVariable:"#c0caf5",syntaxPunctuation:"#c0caf5",syntaxProperty:"#73daca",syntaxTag:"#f7768e",syntaxClass:"#e0af68"}}),e1=Re({id:"tokyo-night-day",name:"Tokyo Night Day",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#e1e2e7",bgSecondary:"#d5d6db",bgTertiary:"#c8c9ce",bgSurface:"#ffffff",bgElevated:"#ffffff",bgHover:"#d5d6db",bgActive:"#c8c9ce",textPrimary:"#3760bf",textSecondary:"#4c6bc0",textTertiary:"#6172b0",textMuted:"#8990b3",textInverse:"#e1e2e7",accent:"#9854f1",accentHover:"#7847c4",accentActive:"#5d38a0",accentMuted:"#e8dff8",accentText:"#ffffff",success:"#587539",successMuted:"#e0f0d0",warning:"#8c6c3e",warningMuted:"#f5ecd0",error:"#f52a65",errorMuted:"#fdd8e0",info:"#007197",infoMuted:"#d0f0f8",border:"#c8c9ce",borderHover:"#b8b9be",borderFocus:"#9854f1",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",syntaxComment:"#8990b3",syntaxString:"#587539",syntaxKeyword:"#9854f1",syntaxFunction:"#2e7de9",syntaxNumber:"#b15c00",syntaxOperator:"#006a83",syntaxVariable:"#3760bf",syntaxPunctuation:"#3760bf",syntaxProperty:"#118c74",syntaxTag:"#f52a65",syntaxClass:"#8c6c3e"}}),t1=Re({id:"rose-pine",name:"Rosé Pine",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#191724",bgSecondary:"#1f1d2e",bgTertiary:"#21202e",bgSurface:"#26233a",bgElevated:"#2a283e",bgHover:"#2a283e",bgActive:"#393552",textPrimary:"#e0def4",textSecondary:"#c4a7e7",textTertiary:"#908caa",textMuted:"#6e6a86",textInverse:"#191724",accent:"#ebbcba",accentHover:"#d4a5a5",accentActive:"#c09090",accentMuted:"#3a3040",accentText:"#191724",success:"#9ccfd8",successMuted:"#253540",warning:"#f6c177",warningMuted:"#3a3528",error:"#eb6f92",errorMuted:"#3a2535",info:"#31748f",infoMuted:"#1a2a35",border:"#26233a",borderHover:"#393552",borderFocus:"#ebbcba",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#6e6a86",syntaxString:"#f6c177",syntaxKeyword:"#31748f",syntaxFunction:"#ebbcba",syntaxNumber:"#eb6f92",syntaxOperator:"#9ccfd8",syntaxVariable:"#e0def4",syntaxPunctuation:"#908caa",syntaxProperty:"#c4a7e7",syntaxTag:"#eb6f92",syntaxClass:"#9ccfd8"}}),n1=Re({id:"rose-pine-moon",name:"Rosé Pine Moon",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#232136",bgSecondary:"#2a273f",bgTertiary:"#2d2a45",bgSurface:"#393552",bgElevated:"#3e3a58",bgHover:"#3e3a58",bgActive:"#44415a",textPrimary:"#e0def4",textSecondary:"#c4a7e7",textTertiary:"#908caa",textMuted:"#6e6a86",textInverse:"#232136",accent:"#ea9a97",accentHover:"#d48580",accentActive:"#c07570",accentMuted:"#3a3040",accentText:"#232136",success:"#9ccfd8",successMuted:"#2a3540",warning:"#f6c177",warningMuted:"#3a3528",error:"#eb6f92",errorMuted:"#3a2535",info:"#3e8fb0",infoMuted:"#1a2a38",border:"#393552",borderHover:"#44415a",borderFocus:"#ea9a97",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#6e6a86",syntaxString:"#f6c177",syntaxKeyword:"#3e8fb0",syntaxFunction:"#ea9a97",syntaxNumber:"#eb6f92",syntaxOperator:"#9ccfd8",syntaxVariable:"#e0def4",syntaxPunctuation:"#908caa",syntaxProperty:"#c4a7e7",syntaxTag:"#eb6f92",syntaxClass:"#9ccfd8"}}),a1=Re({id:"rose-pine-dawn",name:"Rosé Pine Dawn",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#faf4ed",bgSecondary:"#f2e9e1",bgTertiary:"#e4dfde",bgSurface:"#fffaf3",bgElevated:"#ffffff",bgHover:"#f2e9e1",bgActive:"#e4dfde",textPrimary:"#575279",textSecondary:"#797593",textTertiary:"#9893a5",textMuted:"#b4b0c3",textInverse:"#faf4ed",accent:"#d7827e",accentHover:"#c46865",accentActive:"#b05550",accentMuted:"#fae8e8",accentText:"#faf4ed",success:"#56949f",successMuted:"#e0f0f0",warning:"#ea9d34",warningMuted:"#faf0d8",error:"#b4637a",errorMuted:"#f8e0e8",info:"#286983",infoMuted:"#d8f0f8",border:"#e4dfde",borderHover:"#d5d0ce",borderFocus:"#d7827e",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",syntaxComment:"#9893a5",syntaxString:"#ea9d34",syntaxKeyword:"#286983",syntaxFunction:"#d7827e",syntaxNumber:"#b4637a",syntaxOperator:"#56949f",syntaxVariable:"#575279",syntaxPunctuation:"#797593",syntaxProperty:"#907aa9",syntaxTag:"#b4637a",syntaxClass:"#56949f"}}),r1=Re({id:"github-dark",name:"GitHub Dark",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#0d1117",bgSecondary:"#010409",bgTertiary:"#161b22",bgSurface:"#21262d",bgElevated:"#30363d",bgHover:"#21262d",bgActive:"#30363d",textPrimary:"#e6edf3",textSecondary:"#c9d1d9",textTertiary:"#8b949e",textMuted:"#6e7681",textInverse:"#0d1117",accent:"#58a6ff",accentHover:"#388bfd",accentActive:"#1f6feb",accentMuted:"#1a3050",accentText:"#ffffff",success:"#3fb950",successMuted:"#1a3020",warning:"#d29922",warningMuted:"#3a3020",error:"#f85149",errorMuted:"#3a2020",info:"#58a6ff",infoMuted:"#1a3050",border:"#30363d",borderHover:"#484f58",borderFocus:"#58a6ff",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#8b949e",syntaxString:"#a5d6ff",syntaxKeyword:"#ff7b72",syntaxFunction:"#d2a8ff",syntaxNumber:"#79c0ff",syntaxOperator:"#ff7b72",syntaxVariable:"#ffa657",syntaxPunctuation:"#c9d1d9",syntaxProperty:"#7ee787",syntaxTag:"#7ee787",syntaxClass:"#ffa657"}}),o1=Re({id:"github-light",name:"GitHub Light",appearance:"light",builtIn:!0,tokens:{bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgTertiary:"#eaeef2",bgSurface:"#ffffff",bgElevated:"#ffffff",bgHover:"#f3f4f6",bgActive:"#eaeef2",textPrimary:"#1f2328",textSecondary:"#424a53",textTertiary:"#656d76",textMuted:"#8c959f",textInverse:"#ffffff",accent:"#0969da",accentHover:"#0860ca",accentActive:"#0550ae",accentMuted:"#ddf4ff",accentText:"#ffffff",success:"#1a7f37",successMuted:"#dafbe1",warning:"#9a6700",warningMuted:"#fff8c5",error:"#cf222e",errorMuted:"#ffebe9",info:"#0969da",infoMuted:"#ddf4ff",border:"#d0d7de",borderHover:"#afb8c1",borderFocus:"#0969da",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",syntaxComment:"#6e7781",syntaxString:"#0a3069",syntaxKeyword:"#cf222e",syntaxFunction:"#8250df",syntaxNumber:"#0550ae",syntaxOperator:"#cf222e",syntaxVariable:"#953800",syntaxPunctuation:"#1f2328",syntaxProperty:"#116329",syntaxTag:"#116329",syntaxClass:"#953800"}}),s1=Re({id:"github-dimmed",name:"GitHub Dimmed",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#22272e",bgSecondary:"#1c2128",bgTertiary:"#2d333b",bgSurface:"#373e47",bgElevated:"#444c56",bgHover:"#2d333b",bgActive:"#373e47",textPrimary:"#adbac7",textSecondary:"#909dab",textTertiary:"#768390",textMuted:"#636e7b",textInverse:"#22272e",accent:"#539bf5",accentHover:"#4184e4",accentActive:"#316dca",accentMuted:"#1a3050",accentText:"#ffffff",success:"#57ab5a",successMuted:"#1a3020",warning:"#c69026",warningMuted:"#3a3020",error:"#e5534b",errorMuted:"#3a2020",info:"#539bf5",infoMuted:"#1a3050",border:"#444c56",borderHover:"#545d68",borderFocus:"#539bf5",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#768390",syntaxString:"#96d0ff",syntaxKeyword:"#f47067",syntaxFunction:"#dcbdfb",syntaxNumber:"#6cb6ff",syntaxOperator:"#f47067",syntaxVariable:"#f69d50",syntaxPunctuation:"#adbac7",syntaxProperty:"#8ddb8c",syntaxTag:"#8ddb8c",syntaxClass:"#f69d50"}}),l1=Re({id:"monokai",name:"Monokai",appearance:"dark",builtIn:!0,tokens:{bgPrimary:"#272822",bgSecondary:"#1e1f1c",bgTertiary:"#2d2e27",bgSurface:"#3e3d32",bgElevated:"#49483e",bgHover:"#3e3d32",bgActive:"#49483e",textPrimary:"#f8f8f2",textSecondary:"#e6e6e0",textTertiary:"#b8b8b0",textMuted:"#75715e",textInverse:"#272822",accent:"#f92672",accentHover:"#e01f65",accentActive:"#c01a58",accentMuted:"#402030",accentText:"#ffffff",success:"#a6e22e",successMuted:"#2a3a20",warning:"#e6db74",warningMuted:"#3a3a25",error:"#f92672",errorMuted:"#402030",info:"#66d9ef",infoMuted:"#203540",border:"#49483e",borderHover:"#5a5950",borderFocus:"#f92672",shadowSm:"0 1px 2px 0 rgb(0 0 0 / 0.4)",shadowMd:"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",shadowLg:"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)",syntaxComment:"#75715e",syntaxString:"#e6db74",syntaxKeyword:"#f92672",syntaxFunction:"#a6e22e",syntaxNumber:"#ae81ff",syntaxOperator:"#f92672",syntaxVariable:"#f8f8f2",syntaxPunctuation:"#f8f8f2",syntaxProperty:"#66d9ef",syntaxTag:"#f92672",syntaxClass:"#a6e22e"}}),zg=[H0,B0,W0,X0,l1,Q0,V0,K0,q0,t1,n1,a1,G0,J0,Y0,Z0,r1,o1,s1,e1],i1=new Map(zg.map(e=>[e.id,e]));function Vl(e,t=[]){return i1.get(e)??t.find(a=>a.id===e)}const Dh="cove:",Pp=1;function be(e){try{const t=localStorage.getItem(Dh+e);return t===null?null:JSON.parse(t)}catch{return null}}function ke(e,t){try{localStorage.setItem(Dh+e,JSON.stringify(t))}catch{}}function Zi(e){localStorage.removeItem(Dh+e)}const Ph="cove:session-auth";function Uc(){const e=be("auth");return e?(e.credential&&(Oh({...e,credential:void 0}),Nh(e.credential)),e):null}function Oh(e){const t={url:e.url,authMode:e.authMode,rememberMe:e.rememberMe};ke("auth",t),e.credential&&(e.rememberMe?(ke("credential",e.credential),Ug()):(Nh(e.credential),Zi("credential")))}function c1(){Zi("auth"),Zi("credential"),Ug()}function Nh(e){try{sessionStorage.setItem(Ph,JSON.stringify({credential:e}))}catch{}}function Fh(){try{const e=be("credential");if(e)return e;const t=sessionStorage.getItem(Ph);return t&&JSON.parse(t).credential||null}catch{return null}}function Ug(){try{sessionStorage.removeItem(Ph)}catch{}}function u1(){return be("hasCompletedOnboarding")??!1}function Op(){ke("hasCompletedOnboarding",!0)}function d1(e){ke("pendingTour",e)}function h1(){const e=be("pendingTour")??!1;return e&&Zi("pendingTour"),e}const yl={timeFormat:"relative",fontSize:"md",fontFamily:"geist",codeFontFamily:"jetbrains",sidebarWidth:280};function f1(){return be("time-format")??yl.timeFormat}function p1(e){ke("time-format",e)}function m1(){return be("font-size")??yl.fontSize}function v1(e){ke("font-size",e)}function g1(){return be("font-family")??yl.fontFamily}function b1(e){ke("font-family",e)}function x1(){return be("code-font-family")??yl.codeFontFamily}function y1(e){ke("code-font-family",e)}function w1(){const e=be("locale");return e||((navigator.language||"en").startsWith("en"),"en")}function k1(){return be("theme-preference")}function S1(e){ke("theme-preference",e)}function _1(){return be("sidebarWidth")??yl.sidebarWidth}function C1(e){ke("sidebarWidth",e)}function T1(){const e=be("messages-session"),t=be("messages-cache");return e&&t?{sessionKey:e,messages:t}:null}function E1(e,t){ke("messages-session",e),ke("messages-cache",t)}function A1(){return be("sessions-cache")}function M1(e){ke("sessions-cache",e)}function I1(){return be("usage-cache")}function R1(e){ke("usage-cache",e)}function L1(){return be("sessions-usage-cache")}function $1(e){ke("sessions-usage-cache",e)}function D1(){const e=be("model-favorites");return new Set(e??[])}function P1(e){ke("model-favorites",[...e])}function O1(){return be("custom-themes")??[]}function N1(e){ke("theme-cache",e)}const F1={useDefaults:!0,defaultAgentId:"main"};function z1(){return be("new-chat-settings")??F1}function U1(e){ke("new-chat-settings",e)}function j1(){return be("app-mode")??"single"}function H1(e){ke("app-mode",e)}function B1(){return be("canvas-node-enabled")??!1}function W1(e){ke("canvas-node-enabled",e)}function K1(){return be("heartbeat-seen-count")??0}function q1(e){ke("heartbeat-seen-count",e)}function V1(){(be("schemaVersion")??0)<Pp&&ke("schemaVersion",Pp)}const vt=m(J1()),jg=m(O1().map(j0)),G1=K(()=>{const e=vt.value,t=jg.value;if(e.selected==="system"){const r=window.matchMedia("(prefers-color-scheme: dark)").matches?e.darkTheme:e.lightTheme;return Vl(r,t)??Vl("dark",t)}return Vl(e.selected,t)??Vl("dark",t)});function J1(){const e=k1();return e?{...Dp,...e}:Dp}function Y1(e){const t=document.documentElement;for(const[a,r]of Object.entries(e))t.style.setProperty(a,r)}function Z1(e){N1({id:e.id,appearance:e.appearance,colors:e.colors})}function X1(e){Y1(e.colors),Z1(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 ms(e){vt.value={...vt.value,selected:e}}function Q1(e){vt.value={...vt.value,lightTheme:e}}function ew(e){vt.value={...vt.value,darkTheme:e}}function vd(){return[...zg,...jg.value]}function tw(){_e(()=>{const t=G1.value;X1(t)}),_e(()=>{S1(vt.value)}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{vt.value.selected==="system"&&(vt.value={...vt.value})})}const nw={tagline:"A cozy home for your AI assistant"},aw={welcome:"Welcome to Cove",welcomeSubtitle:"Your beautiful interface for OpenClaw",feature1Title:"Real-time Chat",feature1Desc:"Stream responses with tool calls and rich formatting",feature2Title:"Secure Connection",feature2Desc:"Connect to your own OpenClaw gateway with token or password auth",feature3Title:"Full Control",feature3Desc:"Manage sessions, cron jobs, skills, and more",getStarted:"Get Started",skipToLogin:"Skip to manual login",urlSubtitle:"Enter your OpenClaw gateway WebSocket URL",urlError:"URL must start with ws:// or wss://",troubleshootTitle:"Tips:",troubleshoot1:"Local gateway: ws://localhost:8080",troubleshoot2:"Remote gateway: wss://your-server.com:8080",troubleshoot3:"Check that your gateway is running",probeError:"Could not connect to gateway",authTitle:"Authentication",authSubtitle:"Enter your credentials to connect",authMethod:"Auth Method",rememberMeDesc:"Save credentials for automatic reconnection",connectingDesc:"Establishing secure connection to your gateway",success:"Connected!",successDesc:"You're all set. Time to start chatting with your assistant.",startChatting:"Start Chatting",failed:"Connection Failed",failedHints:"Common fixes:",hint1:"Verify the gateway URL is correct",hint2:"Check that the gateway is running",hint3:"Ensure your credentials are valid",hint4:"Try refreshing if using HTTPS with self-signed certs",showFeatureTour:"Show feature tour",modeTitle:"How would you like to use Cove?",modeSingle:"Single chat",modeSingleDesc:"One focused conversation",modeMulti:"Multi-chat (Beta)",modeMultiDesc:"Multiple conversations",canvasDesc:"Let the agent push images and content to your browser"},rw={skipTour:"Skip tour",steps:{sessions:{title:"Your Conversations",content:"All your chat sessions live here. Create new ones, rename them, or filter by type. Each session maintains its own context."},chatInput:{title:"Chat Input",content:"Type your message here. Press Enter to send, Shift+Enter for a new line. You can also drag & drop files or paste images."},modelPicker:{title:"Model Selection",content:"Switch between different AI models per session. Each model has different capabilities and response styles."},settings:{content:"Customize your experience with 12+ themes, font sizes, time formats, and more. Preferences are saved automatically."},canvasPairing:{title:"Approve Your Device",content:"Your browser needs to be approved as a canvas device. Click the approve button to allow your agent to push content here."},canvasButton:{content:"Your agent can push images, diagrams, and content directly here. Click to open the canvas panel."}}},ow={send:"Send",queue:"Queue",stop:"Stop",rename:"Rename",cancel:"Cancel",close:"Close",clear:"Clear",save:"Save",saved:"Saved",creating:"Creating...",new:"New",delete:"Delete",deleting:"Deleting...",copy:"Copy",copied:"Copied!",retry:"Retry",refresh:"Refresh",connect:"Connect",confirm:"Confirm",back:"Back",continue:"Continue",next:"Next",previous:"Previous",done:"Done",more:"More",showMore:"Show More",showLess:"Show Less",remove:"Remove",dismiss:"Dismiss",view:"View"},sw={noData:"No data",tryAgain:"Try again",success:"Success",dryRun:"Dry run",enabled:"Enabled",disabled:"Disabled",dark:"Dark",light:"Light",total:"Total",sessions:"Sessions",error:"Error",skills:"Skills",workspace:"Workspace",output:"Output",overview:"Overview",agents:"Agents",tokens:"Tokens",lastActive:"Last Active",noResultsHint:"Try adjusting your search or filters.",clearFilters:"Clear Filters",model:"Model",name:"Name",files:"Files",tools:"Tools",cove:"Cove",connectToGateway:"Connect to Gateway",connecting:"Connecting...",enableCanvas:"Enable Canvas",settings:"Settings",canvas:"Canvas",saving:"Saving...",create:"Create",edit:"Edit",newChat:"New Chat",logout:"Logout",search:"Search",download:"Download",loading:"Loading...",noItems:"No items",deleteThisSession:"Delete this session?",gatewayUrl:"Gateway URL",password:"Password",token:"Token",approved:"Approved",url:"URL",imageViewer:"Image viewer",healthy:"Healthy",usage:"Usage",channels:"Channels",instances:"Instances",cronJobs:"Cron Jobs",debug:"Debug",logs:"Logs",docs:"Docs",devices:"Devices",agent:"Agent",assistant:"Assistant",thinking:"Thinking",all:"All",main:"Main",isolated:"Isolated",channel:"Channel",default:"Default",sessionDetails:"Session Details",off:"Off",medium:"Medium",session:"Session",gateway:"Gateway",defaultAgent:"Default Agent",enable:"Enable",disable:"Disable",pending:"Pending",nextRun:"Next Run",schedule:"Schedule",version:"Version",uptime:"Uptime",platform:"Platform",clear:"Clear",paused:"Paused",input:"Input",configured:"Configured",result:"Result",searchSkills:"Search skills...",alwaysActive:"Always active",eligible:"Eligible",missingReqs:"Missing Reqs",createAgent:"Create Agent",deleteAgent:"Delete Agent",operators:"Operators",nodes:"Nodes",totalCost:"Total Cost"},lw={placeholder:"Type a command...",noMatches:"No matches",noCommands:"No commands found",categories:{chat:"Chat",session:"Session",model:"Model",cron:"Cron",gateway:"Gateway",settings:"Settings"},hints:{navigate:"↑↓ navigate",select:"↵ select",close:"esc close",back:"esc back"},commands:{chat:{abort:"Abort response",clear:"Clear chat",search:"Search in chat",export:"Export as Markdown",copyLast:"Copy last response"},session:{switch:"Switch session",delete:"Delete current session",copyKey:"Copy session key"},model:{change:"Change model"},cron:{run:"Run cron job",toggle:"Toggle cron job"},gateway:{restart:"Restart gateway"},settings:{theme:"Change theme",systemTheme:"System (auto)"}},confirm:{restartGateway:"Restart the gateway? Connection will drop briefly."}},iw={gatewayUrlPlaceholder:"ws://localhost:8080",passwordPlaceholder:"Enter password",tokenPlaceholder:"Enter token",rememberMe:"Remember me"},cw={generic:"Something went wrong",unknown:"An unknown error occurred",required:"This field is required",invalid:"Invalid value",errorPage:{title:"Well, that wasn't supposed to happen",subtitle:"Something got tangled up. Give it another shot?",details:"Technical details"}},uw={approvalNeeded:"Exec Approval Needed",expiresIn:"Expires in {time}",expired:"Expired",denied:"Denied",allowOnce:"Allow Once",allowAlways:"Always Allow",deny:"Deny"},dw={expand:"Expand output",lines:"{count} lines",moreLines:"⋯ {count} more lines (click to expand)",collapse:"⋯ collapse",emptyResponse:"Empty response",noTabsOpen:"No tabs open",messageSent:"Message sent",broadcastSent:"Broadcast sent",noChannels:"No channels found",channelCount:"{count} channel",channelCountPlural:"{count} channels",noResults:"No results found",messageCount:"{count} messages",noEvents:"No events found",noEmojis:"No custom emojis",emojiCount:"{count} emoji",emojiCountPlural:"{count} emojis",noScheduledEvents:"No scheduled events",eventCount:"{count} event",eventCountPlural:"{count} events",noPinnedMessages:"No pinned messages",pinnedCount:"{count} pinned message",pinnedCountPlural:"{count} pinned messages",showAll:"Show all",fieldChannel:"Channel",fieldTo:"To",fieldVia:"Via",fieldMedia:"Media",fieldId:"ID",fieldJoined:"Joined",fieldRoles:"Roles",noText:"(no text)",unnamed:"(unnamed)"},hw={lineCount:"{count} lines",searchQuery:"Search query",memoryPath:"Memory path",imagePath:"Image path",prompt:"Prompt",inputImage:"Input image",expandImage:"Click to expand image",expandedImage:"Expanded image",readingFile:"Reading file",writingFile:"Writing file",runningCommand:"Running command",editingFile:"Editing file",browserAction:"Browser action",cronAction:"Cron action",sessionStatus:"Session status",messageAction:"Message action"},fw={updateRun:"Update gateway",updateComplete:"Update complete",version:"Version",mode:"Mode",duration:"Duration",restart:"Restart",restartOk:"Restarting",restartFailed:"Failed"},pw={showRaw:"Show raw",showFormatted:"Show formatted"},mw={remaining:"{percent}% remaining",currentSession:"Current session"},vw={disconnected:"Disconnected",connecting:"Connecting",reconnecting:"Reconnecting",copyFailed:"Couldn't copy {label}. Check clipboard permissions and HTTPS context."},gw={disconnected:"Connection lost. Messages will be sent when reconnected.",reconnecting:"Reconnecting to gateway...",reconnectingAttempt:"Reconnecting... (attempt {count})",messageFailedStatus:"Failed",messageSending:"Sending",messageQueued:"Queued",messagesQueued:"{count} message queued"},bw={chat:"Chat",config:"Config",github:"GitHub",githubOpenClaw:"OpenClaw GitHub",discord:"Discord",settings:"Cove Settings",sections:{control:"Control",resources:"Resources"}},xw={agentDescription:"Choose which assistant to chat with",rememberChoice:"Remember this choice",rememberChoiceDescription:"Skip this dialog next time and use these defaults",create:"Create Chat"},yw={placeholder:"Message (Enter to send, Shift+Enter for new line)",placeholderMobile:"Message...",thinking:"Thinking...",queuedMessages:"Queued ({count})",editQueuedMessage:"Edit Queued Message",images:"Images",addImage:"Add Image",noImages:"No images attached",imageCount:"{count} image",omittedImage:"Image omitted from history ({size})",omittedImageNoSize:"Image omitted from history",scrollToBottom:"Scroll to bottom",search:"Search messages",searchPlaceholder:"Search in conversation...",match:"match",matches:"matches",emptyState:{title:"Start a conversation",titleWithName:"Chat with {name}",description:"Send a message to begin chatting with your assistant",hint:"Quick tips:",newSession:"New session"},thinkingBlock:{thoughtFor:"Thought for ~{duration}",second:"{count} second",second_plural:"{count} seconds",expandLabel:"Expand thinking",collapseLabel:"Collapse thinking"},heartbeats:"{count} heartbeat",heartbeatsTitle:"Heartbeats",noHeartbeats:"No heartbeats yet",compacting:"Compacting…",conversationCompacted:"Conversation compacted",compactionLabel:"Compacted",cronJobCompleted:"Cron job completed",dateFrom:"From",dateTo:"To",attachImage:"Attach image",dropFiles:"Drop files here",copyMarkdown:"Copy markdown",historyTruncatedLabel:"Truncated in history",historyTruncatedHint:"This message was truncated in chat history and is not the full original content.",historyTruncatedHintWithReason:"This message was truncated in chat history ({reason}) and is not the full original content."},ww={pinned:"Pinned",today:"Today",yesterday:"Yesterday",thisWeek:"This Week",older:"Older",noSessions:"No sessions yet",noResults:"No sessions match your search",rename:"Rename Session",label:"Session Label",labelPlaceholder:"Enter a name for this session",delete:"Delete Session",deleteConfirm:'Are you sure you want to delete "{name}"?',deleteWarning:"This action cannot be undone. All messages in this session will be permanently deleted.",searchPlaceholder:"Search...",filterSessions:"Filter sessions",showCron:"Show cron sessions",admin:{description:"Manage active sessions, configure overrides, and monitor usage.",label:"Label",labelPlaceholder:"Give this session a memorable name",labelHelp:"A friendly name to help identify this session in lists.",editLabel:"Edit label",overrides:"Session Overrides",contextUsed:"Context Used",verbose:"Verbose",reasoning:"Reasoning",openInChat:"Open in Chat",emptyTitle:"No Sessions",emptyDescription:"Sessions will appear here once you start chatting.",noResults:"No Matching Sessions",searchPlaceholder:"Search sessions...",count:"{count} session",filteredCount:"Showing {filtered} of {total} sessions",kinds:{cron:"Cron"},levels:{inherit:"Inherit",low:"Low",high:"High"}}},kw={addFavorite:"Add to favorites",removeFavorite:"Remove from favorites"},Sw={description:"Customize your Cove experience",appearance:{title:"Appearance",useSystemTheme:"Follow system appearance",useSystemThemeDescription:"Automatically switch between light and dark themes",lightTheme:"Light Theme",darkTheme:"Dark Theme",fontSize:"Font Size",fontSizeDescription:"Adjust text size throughout the app",fontSizeSm:"Small",fontSizeLg:"Large",fontFamily:"Font Family",fontFamilyDescription:"Choose your preferred interface typeface",codeFontFamily:"Code Font",codeFontFamilyDescription:"Used for code blocks and editor surfaces",fontSystem:"System",fontGeist:"Geist",fontInter:"Inter",fontMono:"JetBrains Mono",fontDyslexic:"OpenDyslexic",codeFontJetBrains:"JetBrains Mono",codeFontSystem:"System Mono",codeFontFira:"Fira Code",codeFontSource:"Source Code Pro"},about:{title:"About"},device:{enabledDescription:"Register as a node so the agent can push content to this browser",name:"Display Name",nameDescription:"Custom name shown in node list"},preferences:{timeFormat:"Time Display",timeFormatDescription:"How timestamps are shown",timeRelative:"Relative (2 hours ago)",timeAbsolute:"Absolute (3:45 PM)"},appMode:{title:"Interface",multiChat:"Multi-chat mode (Beta)",multiChatDescription:"Show session sidebar with multiple conversations"},newChat:{useDefaults:"Always use defaults",useDefaultsDescription:"Skip the agent picker when creating new chats",defaultAgentDescription:"Which agent to use for new chats"},data:{resetDefaults:"Reset to Defaults",clearSavedLogin:"Clear Saved Login"}},_w={description:"Schedule and manage automated tasks.",actions:{list:"List jobs",add:"Add job",update:"Update job",remove:"Remove job",run:"Run job",runs:"Run history",status:"Scheduler status",wake:"Wake scheduler"},noJobs:"No cron jobs configured",jobCount:"{count} jobs",jobTriggered:"Job triggered",jobRemoved:"Job removed",createJob:"Create Job",editJob:"Edit Job",confirmDelete:"Delete this job?",runNow:"Run Now",announces:"Announces results",running:"Running",lastOk:"Last OK",lastFailed:"Last Failed",lastRun:"Last Run",lastDuration:"Last Duration",recentRuns:"Recent Runs",runUsage:"{input} in / {output} out",noRuns:"No runs recorded yet.",deliveryStatus:{delivered:"Delivered",notDelivered:"Not Delivered",unknown:"Unknown",notRequested:"—"},searchPlaceholder:"Search jobs...",emptyTitle:"No Cron Jobs",emptyDescription:"Create a job to schedule automated tasks.",noResults:"No Matching Jobs",count:"{count} job",filteredCount:"Showing {filtered} of {total} jobs",stats:{nextWake:"Next Wake"},columns:{job:"Job",schedule:"Schedule",target:"Target",status:"Status"},scheduleKind:{cron:"Cron Expression",every:"Interval",at:"One-time"},sessionTarget:{main:"Main Session",isolated:"Isolated Session"},wakeMode:{nextHeartbeat:"Next Heartbeat",now:"Immediate"},form:{namePlaceholder:"My Job",description:"Description",descriptionPlaceholder:"What does this job do?",descriptionHint:"Optional description for this job.",timezone:"Timezone",timezonePlaceholder:"Timezone (e.g., America/New_York)",timezoneHint:"Optional IANA timezone. Suggestions appear on focus and while typing.",cronPlaceholder:"*/5 * * * *",staggerMs:"Stagger (ms)",staggerMsHint:"Optional deterministic offset (applies to Cron Expression schedules only).",staggerMsPlaceholder:"Deterministic stagger in milliseconds (optional)",showAdvanced:"Show advanced options",hideAdvanced:"Hide advanced options",intervalPlaceholder:"Interval in milliseconds",sessionTarget:"Session Target",sessionTargetHint:"Main injects into the main session. Isolated runs in a separate session.",wakeMode:"Wake Mode",wakeModeHint:"When the job triggers after scheduling.",payload:"Payload",payloadHintMain:"Text injected as a system event into the main session.",payloadHintIsolated:"Runs as an agent turn in an isolated session.",expandPayloadEditor:"Expand editor",fullscreenPayloadTitle:"Payload Editor",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",timezoneInvalid:"Timezone must be a valid IANA timezone",staggerNonNegative:"Stagger must be 0 or greater",intervalMin:"Interval must be at least 1 second",atFuture:"Time must be in the future",payloadRequired:"Payload text is required"},noTimeSet:"Once (no time set)"},Cw={subtitle:"Connection diagnostics and event logging.",connection:"Connection",server:"Server",client:"Client",paths:"Paths",eventLog:"Event Log",state:"State",sessionKey:"Session Key",reconnectAttempts:"Reconnect Attempts",connectedAt:"Connected At",tickInterval:"Tick Interval",configPath:"Config Path",stateDir:"State Directory",appVersion:"App Version",userAgent:"User Agent",presenceCount:"Connected Clients",recording:"Recording",noEvents:"No events recorded",noEventsHint:"Events will appear here as they occur.",snapshots:"Snapshots",health:"Health",noData:"No data — click Refresh",recentSession:"Recent Session",heartbeatAgents:"Heartbeat Agents",showRawJson:"Show raw JSON",used:"Used",unhealthy:"Unhealthy",linked:"Linked",on:"On",ok:"OK",clickToExpand:"click to expand",noPayload:"no payload",viewEventDetails:"View {{event}} event details",manualRpc:"Manual RPC",manualRpcDesc:"Send a raw gateway method with JSON params.",method:"Method",params:"Params",paramsJson:"Params (JSON)",addParam:"Add",noParams:"No params — click Add to add one",formMode:"Form",jsonMode:"JSON",call:"Call"},Tw={serverInfo:"Server Information",capabilities:"Capabilities",capabilitiesCount:"{count} methods"},Ew={description:"Gateway log viewer with live tailing.",searchPlaceholder:"Search logs...",live:"Live",info:"Info",warnings:"Warn",noLogs:"No logs available",noLogsHint:"Logs will appear here when the gateway writes them.",noMatches:"No logs match your filter",fetchError:"Failed to fetch logs",expandLine:"Expand log details",filterByLevel:"Filter by {level} level",viewLogDetails:"View log details",logDetails:"Log Details",message:"Message",rawLine:"Raw",fields:"fields"},Aw={description:"Messaging platform integrations and status.",emptyTitle:"No Channels",emptyDescription:"No channel plugins are available.",learnMore:"Learn how to set up channels",count:"{count} channel",configure:"Configure",probe:"Health Check",probing:"Checking...",logoutTitle:"Logout from Channel",logoutConfirm:"Are you sure you want to log out of {channel}?",logoutWarning:"You may need to re-authenticate (QR code, token, etc.) to reconnect.",logoutSuccess:"Logged out of {channel}",stats:{active:"Active (24h)",errors:"Errors"},status:{connected:"Connected",notConfigured:"Not Configured"}},Mw={description:"Connected clients and services.",emptyTitle:"No Instances",emptyDescription:"No connected clients or services found.",count:"{count} instance",idleSeconds:"{count}s",idleMinutes:"{count}m",idleHours:"{count}h",stats:{gateways:"Gateways",clients:"Clients"},columns:{instance:"Instance",mode:"Mode",lastSeen:"Last Seen",idle:"Idle"}},Iw={description:"Browse and manage assistant skills.",emptyTitle:"No Skills",emptyDescription:"No skills are available in this workspace.",noResults:"No Matching Skills",count:"{count} skill",filteredCount:"Showing {filtered} of {total} skills",enabledSuccess:"Enabled {name}",disabledSuccess:"Disabled {name}",installDeps:"Install Dependencies",installTitle:"Install Dependencies for {name}",installDescription:"Choose an installation method to install the required dependencies.",installSuccess:"Successfully installed dependencies for {name}",installFailed:"Failed to install dependencies",providesBins:"Provides",skillKey:"Skill Key",location:"Location",homepage:"Homepage",missingRequirements:"Missing requirements",blockedByAllowlist:"Blocked by allowlist",primaryEnv:"Primary env var",managedDir:"Managed skills",status:{blocked:"Blocked"},source:{bundled:"Bundled",managed:"Installed",extra:"Extra"},filters:{allSources:"All Sources"},clawhub:{searchPlaceholder:"Search ClawHub skills...",install:"Install",installing:"Installing...",noDescription:"No description available",changelog:"Changelog",updated:"Updated",noResults:"No Skills Found",tryDifferentSearch:"Try a different search term.",notYetSupported:"ClawHub installation coming soon! Install manually: openclaw skills install {slug}",trending:"Trending",sortLabel:"Sort by",sortPopular:"Popular",sortTrending:"Trending",sortStars:"Most Starred",sortRecent:"Newest",by:"by",installs:"active"}},Rw={description:"Manage agent configuration and workspace files.",overview:{identityEmoji:"Emoji",avatar:"Avatar",avatarPlaceholder:"avatar.jpg or https://...",namePlaceholder:"Agent name",workspacePlaceholder:"/path/to/workspace",modelPlaceholder:"anthropic/claude-sonnet-4-20250514",editHint:"Avatar: relative path, URL, or data URI. Model: leave empty to keep current."},files:{totalTokens:"~{count} tokens injected per run",loadError:"Failed to load workspace files",loadFileError:"Failed to load file",saveError:"Failed to save file",saved:"File saved",missing:"Missing",view:"View",unsaved:"Unsaved",unsavedWarning:"You have unsaved changes. Are you sure you want to leave?",backToList:"Back to Files",emptyFile:"This file is empty.",editPlaceholder:"Enter file content...",memoryHint:{title:"About Memory Files",line1:"Files in the memory/ folder are not editable here.",line2:"Use the chat to update memory/*.md files."},meta:{agents:"Agent behavior and workspace rules",soul:"Persona and communication style",tools:"Tool usage notes and conventions",identity:"Agent identity (name, email, accounts)",user:"User profile and preferences",heartbeat:"Heartbeat checklist and reminders",bootstrap:"First-run ritual (deleted after completion)",memory:"Durable facts, preferences, and context",unknown:"Configuration file"}},tools:{profile:"Profile",profiles:{full:"Full — All tools enabled",coding:"Coding — Files, exec, web",messaging:"Messaging — Messages, sessions",minimal:"Minimal — Read-only basics"},sections:{runtime:"Runtime",web:"Web",memory:"Memory",automation:"Automation"},toolDescriptions:{read:"Read file contents",write:"Create or overwrite files",edit:"Make precise edits",exec:"Run shell commands",process:"Manage background processes",webSearch:"Search the web",webFetch:"Fetch web content",browser:"Control web browser",memorySearch:"Semantic search",memoryGet:"Read memory files",sessionsList:"List sessions",sessionsSend:"Send to session",sessionsSpawn:"Spawn sub-agent",message:"Send messages",cron:"Schedule tasks",gateway:"Gateway control",nodes:"Node devices"},enabled:"{count} enabled"},skills:{title:"Agent Skill Access",noSkills:"No eligible skills available",noSearchResults:"No skills match your search",usingAllowlist:"Using allowlist: {allowed} of {total} skills",usingAll:"Using all {count} eligible skills",useAll:"Use All Skills",useAllHint:"= agent can use any eligible skill (no allowlist).",selectAll:"Select All",selectNone:"Select None",selectSpecific:"Select specific skills",selectSpecificHint:"= agent can only use checked skills.",globalHint:"To globally enable/disable skills, visit the",page:"page",details:"Details"},create:{nameHint:"Used as the agent ID (lowercase, no spaces)",namePlaceholder:"my-agent",workspacePlaceholder:"~/agents/my-agent",emoji:"Emoji (optional)",emojiPlaceholder:"🤖",requiredFields:"Name and workspace are required",success:"Agent created"},delete:{warning:"This action cannot be undone",warningDescription:"Deleting this agent will permanently remove its configuration from OpenClaw. Make sure you have backups if needed.",willDelete:"This will permanently delete:",willDeleteConfig:"Agent configuration from openclaw.json",willDeleteBindings:"Any channel bindings for this agent",willDeleteSessions:"Session associations (session data is preserved)",includeFiles:"Also delete workspace files",includeFilesDescription:"Permanently delete all files in {path}",confirmPrompt:'Type "{id}" to confirm deletion:',confirmMismatch:"Please type the agent ID to confirm deletion",success:"Agent deleted"}},Lw={description:"Manage paired devices and authentication tokens.",emptyTitle:"No Devices",emptyDescription:"No devices have been paired yet.",noResults:"No matching devices",count:"{count} device",filteredCount:"Showing {filtered} of {total}",searchPlaceholder:"Search devices...",pendingRequests:"Pending Pairing Requests",approve:"Approve",reject:"Reject",approveSuccess:"Device approved",rejectSuccess:"Device rejected",repair:"Repair",deviceId:"Device ID",clientId:"Client ID",scopes:"Scopes",tokens:"Auth Tokens",noTokens:"No tokens",tokenActive:"Active",tokenRevoked:"Revoked",rotateToken:"Rotate token",tokenManagement:"Token Management",tokenManagementDesc:"Manage authentication tokens for {name}.",tokenCreated:"Created",tokenRotatedAt:"Rotated",rotate:"Rotate",revoke:"Revoke",tokenRotated:"Token rotated and copied to clipboard",tokenCopied:"New token copied to clipboard",toggleDetails:"Toggle details for {name}",removeDevice:"Remove Device",removeConfirm:'Are you sure you want to remove "{name}"?',removeWarning:"This device will need to be re-paired to connect again.",removeSuccess:"Device removed",filters:{allRoles:"All Roles"}},$w={description:"Token usage and cost analytics",loadError:"Failed to load usage data",summary:{title:"Token Usage",period:"Last {days} days",cache:"Cache Tokens",cacheRead:"Cache Read",cacheWrite:"Cache Write",unavailable:"Usage data not available"},daily:{title:"Daily Activity"},timezone:{utc:"UTC",gateway:"Gateway",local:"Local"},agents:{sessions:"sessions"},sessions:{noData:"No session usage data available",cost:"Cost",showing:"Showing {from}–{to} of {total}",viewDetails:"View details for {name}"},detail:{contextWeight:"Context Weight",system:"System Prompt",other:"Other",tabs:{timeline:"Timeline",messages:"Messages"},noTimeline:"No timeline data available for this session",noMessages:"No message logs available for this session",cumulativeTokens:"Cumulative Tokens",requests:"Requests",totalTokens:"Total Tokens",role:{user:"User",tool:"Tool"},tokenCount:"{count} tokens"}},Dw={minutesAgo:"{count} minute ago",compact:{now:"now",minutes:"{count}m",hours:"{count}h",days:"{count}d",weeks:"{count}w",months:"{count}mo",years:"{count}y"}},Pw={close:"Close canvas",minimize:"Minimize",maximize:"Maximize",openUrlInNewTab:"Open URL in new tab",openCanvasTab:"Pop out to canvas tab",iframeTitle:"Canvas content",imageAlt:"Canvas image",noContent:"No content to display",noContentHint:"The assistant can push content here."},Ow={sidebarToggle:"Toggle sidebar",loading:"Loading",expandSection:"Expand section",collapseSection:"Collapse section"},Nw={title:"Configuration",description:"Manage OpenClaw settings",searchPlaceholder:"Search settings...",save:"Save Changes",reset:"Reset",unsavedChanges:"You have unsaved changes",saveSuccess:"Configuration saved. Gateway will restart.",noFields:"No settings found",noResults:"No matching settings",selectSection:"Select a section to configure",general:"General",noSettingsAtLevel:"No settings available at this level.",schemaNotFound:"Schema not found for path: {path}",validation:{invalidFormat:"Invalid format",mustBeString:"Must be a string",mustBeNumber:"Must be a number",mustBeInteger:"Must be an integer",mustBeBoolean:"Must be true or false",mustBeArray:"Must be an array",mustBeObject:"Must be an object",invalidOption:"Invalid option",minLength:"Must be at least {min} characters",maxLength:"Must be at most {max} characters",minimum:"Must be at least {min}",maximum:"Must be at most {max}",minItems:"Must have at least {min} items",maxItems:"Must have at most {max} items"},field:{showPassword:"Show password",hidePassword:"Hide password",addItem:"Add item",removeItem:"Remove item",dragToReorder:"Drag to reorder",moveUp:"Move up",moveDown:"Move down",invalidJson:"Invalid JSON"}},Fw={gatewayLabel:"Gateway update available",viewRelease:"View release"},zw={app:nw,onboarding:aw,tour:rw,actions:ow,common:sw,commandPalette:lw,auth:iw,errors:cw,exec:uw,toolOutput:dw,toolInput:hw,gateway:fw,toolBlock:pw,sessionStatus:mw,status:vw,connection:gw,nav:bw,newChatModal:xw,chat:yw,sessions:ww,models:kw,settings:Sw,cron:_w,debug:Cw,overview:Tw,logs:Ew,channels:Aw,instances:Mw,skills:Iw,agents:Rw,devices:Lw,usage:$w,time:Dw,canvas:Pw,accessibility:Ow,config:Nw,update:Fw},Bo={en:zw};function Uw(e){if(Bo[e])return Bo[e];const t=e.split("-")[0];return Bo[t]?Bo[t]:Bo.en}const Np=new Set,Cu=new Map,jw={geist:()=>Promise.all([Ee(()=>Promise.resolve({}),__vite__mapDeps([0])),Ee(()=>Promise.resolve({}),__vite__mapDeps([1])),Ee(()=>Promise.resolve({}),__vite__mapDeps([2]))]),inter:()=>Promise.all([Ee(()=>Promise.resolve({}),__vite__mapDeps([3])),Ee(()=>Promise.resolve({}),__vite__mapDeps([4])),Ee(()=>Promise.resolve({}),__vite__mapDeps([5]))]),dyslexic:()=>Ee(()=>Promise.resolve({}),__vite__mapDeps([6])),jetbrains:()=>Promise.all([Ee(()=>Promise.resolve({}),__vite__mapDeps([7])),Ee(()=>Promise.resolve({}),__vite__mapDeps([8])),Ee(()=>Promise.resolve({}),__vite__mapDeps([9]))]),fira:()=>Promise.all([Ee(()=>Promise.resolve({}),__vite__mapDeps([10])),Ee(()=>Promise.resolve({}),__vite__mapDeps([11])),Ee(()=>Promise.resolve({}),__vite__mapDeps([12]))]),source:()=>Promise.all([Ee(()=>Promise.resolve({}),__vite__mapDeps([13])),Ee(()=>Promise.resolve({}),__vite__mapDeps([14])),Ee(()=>Promise.resolve({}),__vite__mapDeps([15]))])};function qa(e){if(Np.has(e))return Promise.resolve();const t=Cu.get(e);if(t)return t;const a=jw[e]().then(()=>{Np.add(e)}).catch(()=>{}).finally(()=>{Cu.delete(e)});return Cu.set(e,a),a}function Hw(e){return e==="system"?Promise.resolve():qa(e==="geist"?"geist":e==="inter"?"inter":e==="dyslexic"?"dyslexic":"jetbrains")}function Bw(e){return e==="system"?Promise.resolve():qa(e==="jetbrains"?"jetbrains":e==="fira"?"fira":"source")}const ur=m(f1()),io=m(m1()),dr=m(g1()),hr=m(x1()),rt=m(z1()),$n=m(j1()),Ze=m(B1()),wl=K(()=>$n.value==="multi"),Ws=K(()=>$n.value==="single");_e(()=>p1(ur.value));_e(()=>v1(io.value));_e(()=>b1(dr.value));_e(()=>y1(hr.value));_e(()=>U1(rt.value));_e(()=>H1($n.value));_e(()=>W1(Ze.value));typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key==="cove:canvas-node-enabled"){const t=e.newValue==="true";Ze.value!==t&&(Ze.value=t,Ee(()=>Promise.resolve().then(()=>ay),void 0).then(a=>{t?a.startNodeConnection():a.stopNodeConnection()}))}});_e(()=>{document.documentElement.dataset.fontSize=io.value});_e(()=>{Hw(dr.value);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[dr.value])});_e(()=>{Bw(hr.value);const e={jetbrains:'"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',system:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fira:'"Fira Code", "Fira Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',source:'"Source Code Pro", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'};document.documentElement.style.setProperty("--font-mono",e[hr.value])});const Hg=[{value:"sm",labelKey:"settings.appearance.fontSizeSm"},{value:"md",labelKey:"common.medium"},{value:"lg",labelKey:"settings.appearance.fontSizeLg"}],Bg=[{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"}],Wg=[{value:"system",labelKey:"settings.appearance.codeFontSystem"},{value:"jetbrains",labelKey:"settings.appearance.codeFontJetBrains"},{value:"fira",labelKey:"settings.appearance.codeFontFira"},{value:"source",labelKey:"settings.appearance.codeFontSource"}],Kg=[{value:"relative",labelKey:"settings.preferences.timeRelative"},{value:"local",labelKey:"settings.preferences.timeAbsolute"}];function qg(){io.value="md",dr.value="geist",hr.value="jetbrains",ur.value="relative",rt.value={useDefaults:!0,defaultAgentId:"main"},$n.value="single"}const Ww=Object.freeze(Object.defineProperty({__proto__:null,CODE_FONT_FAMILY_OPTIONS:Wg,FONT_FAMILY_OPTIONS:Bg,FONT_SIZE_OPTIONS:Hg,TIME_FORMAT_OPTIONS:Kg,appMode:$n,canvasNodeEnabled:Ze,codeFontFamily:hr,fontFamily:dr,fontSize:io,isMultiChatMode:wl,isSingleChatMode:Ws,newChatSettings:rt,resetToDefaults:qg,timeFormat:ur},Symbol.toStringTag,{value:"Module"})),Fp={debug:0,info:1,warn:2,error:3,off:4};function Kw(){return"off"}const qw=Kw();function Gl(e){return Fp[e]>=Fp[qw]}function Jl(e,t){return`[${e}] ${t}`}function Xn(e){return{debug:(t,...a)=>{Gl("debug")&&(console.debug(Jl(e,t),...a),a.length,void 0)},info:(t,...a)=>{Gl("info")&&(console.info(Jl(e,t),...a),a.length,void 0)},warn:(t,...a)=>{Gl("warn")&&(console.warn(Jl(e,t),...a),a.length,void 0)},error:(t,...a)=>{Gl("error")&&(console.error(Jl(e,t),...a),a.length,void 0)}}}const M={gateway:Xn("gateway"),auth:Xn("auth"),chat:Xn("chat"),exec:Xn("exec"),i18n:Xn("i18n"),node:Xn("node"),ui:Xn("ui"),usage:Xn("usage")},xa=m(w1()),zp=m(Uw(xa.value)),Up=K(()=>["ar","he","fa","ur"].includes(xa.value.split("-")[0]));function Vw(){document.documentElement.dir=Up.value?"rtl":"ltr",document.documentElement.lang=xa.value,_e(()=>{document.documentElement.dir=Up.value?"rtl":"ltr",document.documentElement.lang=xa.value})}function jp(e,t){return t.split(".").reduce((a,r)=>{if(a&&typeof a=="object"&&r in a)return a[r]},e)}function l(e,t){let a=jp(zp.value,e);if(t?.count!==void 0&&typeof t.count=="number"){const o=t.count===1?e:`${e}_plural`,s=jp(zp.value,o);s!==void 0&&(a=s)}return typeof a!="string"?(M.i18n.warn(`Missing translation: ${e}`),e):t?a.replace(/\{(\w+)\}/g,(r,o)=>t[o]?.toString()??`{${o}}`):a}function Vg(e,t="short"){const a=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(xa.value,{timeStyle:t}).format(a)}function Hp(e){const t=typeof e=="number"?new Date(e):e,a=Date.now(),r=t.getTime()-a,o=Math.round(r/1e3),s=Math.round(o/60),i=Math.round(s/60),c=Math.round(i/24),u=Math.round(c/7),d=Math.round(c/30),h=Math.round(c/365),f=new Intl.RelativeTimeFormat(xa.value,{numeric:"auto"});return Math.abs(o)<60?f.format(o,"second"):Math.abs(s)<60?f.format(s,"minute"):Math.abs(i)<24?f.format(i,"hour"):Math.abs(c)<7?f.format(c,"day"):Math.abs(u)<4?f.format(u,"week"):Math.abs(d)<12?f.format(d,"month"):f.format(h,"year")}function ae(e,t){return t?.relative?Hp(e):ur.value==="local"?Vg(e,"short"):Hp(e)}function Gw(e){const t=typeof e=="number"?new Date(e):e,a=Date.now(),r=Math.abs(t.getTime()-a),o=Math.round(r/1e3),s=Math.round(o/60),i=Math.round(s/60),c=Math.round(i/24),u=Math.round(c/7),d=Math.round(c/30),h=Math.round(c/365);return o<60?l("time.compact.now"):s<60?l("time.compact.minutes",{count:s}):i<24?l("time.compact.hours",{count:i}):c<7?l("time.compact.days",{count:c}):u<4?l("time.compact.weeks",{count:u}):d<12?l("time.compact.months",{count:d}):l("time.compact.years",{count:h})}function Xi(e){if(ur.value==="local"){const t=typeof e=="number"?new Date(e):e,a=new Date;return t.getDate()===a.getDate()&&t.getMonth()===a.getMonth()&&t.getFullYear()===a.getFullYear()?Vg(t,"short"):t.getFullYear()===a.getFullYear()?new Intl.DateTimeFormat(xa.value,{month:"short",day:"numeric"}).format(t):new Intl.DateTimeFormat(xa.value,{month:"short",year:"2-digit"}).format(t)}return Gw(e)}function Ks(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function co(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}K`:`${Math.round(e/1e3)}K`}function zh(e){if(e==null)return"—";if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),a=Math.floor(e%6e4/1e3);return`${t}m ${a}s`}const Bp=3,Jw=1e3,Yw=3e4,Zw=1.5,Xw=3e4,Qw=3e4,Ue=m("disconnected"),D=K(()=>Ue.value==="connected"),e2=m(!0),ia=m(null),jt=m(null),gt=m(null),Uh=m(null),Je=m(null),jh=m([]),Qt=m(0),t2=m(null),qs=m(null),ya=m(null),Gg=m(null),vs=m(null),gs=m(null),kl=m([]),Hh=K(()=>{const e=Gg.value,t=ya.value;if(e==null||t==null)return null;const a=Date.now()-t;return e+a});let ze=null,qr=null,n2=0,ki=null,Vr=null;const uo=new Map,gd=new Set,a2=5e3;function Wp(e,t){return new Promise(a=>{if(t?.aborted){a({ok:!1,error:"Aborted"});return}let r=null,o=null,s=!1;const i=()=>{o&&(clearTimeout(o),o=null),r&&(r.onopen=null,r.onmessage=null,r.onerror=null,r.onclose=null,r.close(),r=null)},c=d=>{s||(s=!0,i(),a({ok:!1,error:d}))},u=d=>{s||(s=!0,i(),a({ok:!0,version:d}))};t?.addEventListener("abort",()=>{c("Aborted")}),o=setTimeout(()=>{c("Connection timed out")},a2);try{r=new WebSocket(e),r.onopen=()=>{M.gateway.debug("Probe: WebSocket opened, waiting for challenge...")},r.onmessage=d=>{try{const h=JSON.parse(d.data);h.type==="evt"&&h.event==="connect.challenge"?(M.gateway.debug("Probe: Received connect.challenge, gateway is valid"),u(h.payload?.version)):(M.gateway.debug("Probe: Received unexpected message:",h.type,h.event),u())}catch{c("Invalid response from server")}},r.onerror=d=>{M.gateway.error("Probe WebSocket error:",{url:e,event:d.type}),c("Connection failed")},r.onclose=d=>{d.wasClean||c("Connection closed unexpectedly")}}catch(d){c(d instanceof Error?d.message:"Failed to connect")}})}function Sl(e){const t=Qt.value>0;return ze&&(t?(ze.onclose=null,ze.close(),ze=null):ho()),qr=e,Ue.value="connecting",e2.value=!1,ia.value=null,t||(Qt.value=0),gt.value=e.url,new Promise((a,r)=>{try{ze=new WebSocket(e.url),ze.onopen=()=>{Ue.value="authenticating"},ze.onmessage=o=>{try{const s=JSON.parse(o.data);if(Ue.value==="authenticating"&&s.type==="event"&&s.event==="connect.challenge"){r2(e).then(i=>{Ue.value="connected",ya.value=Date.now(),jt.value=i.server?.version??null,Uh.value=i.server?.connId??null,t2.value=i.canvasHostUrl??null,jh.value=i.features?.methods??[],qs.value=i.policy?.tickIntervalMs??null,kl.value=i.snapshot?.presence??[],Gg.value=i.snapshot?.uptimeMs??null,vs.value=i.snapshot?.configPath??null,gs.value=i.snapshot?.stateDir??null;const c=i.snapshot?.sessionDefaults;c?.mainSessionKey&&(Je.value=c.mainSessionKey,M.gateway.info("Main session key:",Je.value)),u2(),a(i)}).catch(i=>{ia.value=i.message,ho(),r(i)});return}l2(s)}catch(s){M.gateway.error(" Failed to parse message:",s)}},ze.onerror=o=>{M.gateway.error("WebSocket error:",{url:e.url,readyState:ze?.readyState,event:o.type}),ia.value="WebSocket error - check console for details"},ze.onclose=o=>{const i=Ue.value==="connected",c=Qt.value>0;Bh(),Yg(new Error("Connection closed")),(i||c)&&qr?.autoReconnect!==!1?d2():Ue.value="disconnected"}}catch(o){Ue.value="disconnected",ia.value=o instanceof Error?o.message:"Failed to connect",r(o)}})}async function r2(e){const t={minProtocol:Bp,maxProtocol:Bp,client:{id:"openclaw-control-ui",displayName:"Cove",version:"2026.3.2",platform:o2(),mode:"ui"},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 N("connect",t)}function o2(){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 ho(){qr=null,Bh(),h2(),Yg(new Error("Disconnected")),ze&&(ze.onclose=null,ze.close(),ze=null),Ue.value="disconnected",ya.value=null,jt.value=null,gt.value=null,Uh.value=null,Je.value=null,jh.value=[],qs.value=null,kl.value=[]}function Jg(e,t,a){return new Promise((r,o)=>{if(!ze||ze.readyState!==WebSocket.OPEN){o(new Error("Not connected"));return}const s=`req_${++n2}`,i=a?.timeout??Xw,c={type:"req",id:s,method:e,params:t},u=setTimeout(()=>{uo.delete(s),o(new Error(`Request timeout: ${e}`))},i);uo.set(s,{resolve:r,reject:o,timeout:u}),ze.send(JSON.stringify(c))})}function N(e,...t){return Jg(e,t[0],t[1])}function s2(e,t,a){return Jg(e,t,a)}function l2(e){switch(e.type){case"res":i2(e);break;case"event":c2(e);break;default:M.gateway.warn(" Unknown message type:",e)}}function i2(e){const t=uo.get(e.id);if(!t){M.gateway.warn(" Received response for unknown request:",e.id);return}uo.delete(e.id),clearTimeout(t.timeout),e.ok?t.resolve(e.payload):t.reject(new Error(e.error?.message??"Request failed"))}function c2(e){M.gateway.debug("Event received:",e.event);for(const t of gd)try{t(e)}catch(a){M.gateway.error(" Event handler error:",a)}}function Yg(e){for(const[t,a]of uo)clearTimeout(a.timeout),a.reject(e);uo.clear()}function _l(e){return gd.add(e),()=>gd.delete(e)}function bd(e,t){return _l(r=>{r.event===e&&t(r.payload)})}let Wo=0;const Kp=3;function u2(){Bh(),Wo=0,ki=setInterval(()=>{ze?.readyState===WebSocket.OPEN&&N("health").then(()=>{Wo=0}).catch(e=>{Wo++,M.gateway.warn(`Heartbeat failed (${Wo}/${Kp}):`,e instanceof Error?e.message:String(e)),Wo>=Kp&&M.gateway.error("Too many consecutive heartbeat failures, connection may be unhealthy")})},Qw)}function Bh(){ki&&(clearInterval(ki),ki=null)}function d2(){if(!qr||Vr)return;Ue.value="reconnecting",Qt.value++;const e=Math.min(Jw*Math.pow(Zw,Qt.value-1),Yw);M.gateway.info(`[gateway] Reconnecting in ${Math.round(e/1e3)}s (attempt ${Qt.value})`),Vr=setTimeout(async()=>{if(Vr=null,!!qr)try{await Sl(qr)}catch{}},e)}function h2(){Vr&&(clearTimeout(Vr),Vr=null),Qt.value=0}const rs={state:Ue,isConnected:D,error:ia,version:jt,url:gt,connectionId:Uh,mainSessionKey:Je,capabilities:jh,tickIntervalMs:qs,connectedAt:ya,presence:kl,reconnectAttempt:Qt,connect:Sl,disconnect:ho,send:N,subscribe:_l,on:bd},f2=6e4,p2=200,m2=100,v2=5e3,g2=1e3,Yl=`
3
3
 
4
- `,g2=300,b2="2026.2.19",Zl={docs:"https://docs.openclaw.ai",github:"https://github.com/MaudeCode/cove",githubOpenClaw:"https://github.com/openclaw/openclaw",discord:"https://discord.com/invite/clawd"};function Zg(e,t){const a=m(e.value);let r=null;return e.subscribe(o=>{r&&clearTimeout(r),r=setTimeout(()=>{a.value=o},t)}),a}const x2=[/read heartbeat\.md/i,/heartbeat poll/i,/if nothing needs attention.*reply.*heartbeat_ok/i],y2=/^\s*heartbeat_ok\s*$/i,w2=/^\s*\[cron\]/i;function k2(e){return e.role!=="user"?!1:x2.some(t=>t.test(e.content))}function qh(e){return e.role!=="assistant"?!1:y2.test(e.content)}function S2(e){return e.role!=="assistant"?!1:w2.test(e.content)}function Xg(e){return k2(e)||qh(e)}const _2=[/^pre-compaction memory flush/i,/^read heartbeat\.md if it exists/i];function C2(e){return e.role!=="user"?!1:_2.some(t=>t.test(e.content))}function T2(e){let t=e;t=t.replace(/^Conversation info \(untrusted metadata\):\s*```json\s*\{[^}]*\}\s*```\s*/s,"");const a=t.match(/^\[([^\]]+)\]\s*/);if(a){const r=a[1]??"";(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(r)||/\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(r))&&(t=t.slice(a[0].length))}return t.includes("[message_id:")&&(t=t.split(/\r?\n/).filter(r=>!/^\s*\[message_id:\s*[^\]]+\]\s*$/i.test(r)).join(`
5
- `)),t.trim()}const E2=[/^<summary>/i,/the conversation.*compacted/i,/context was summarized/i];function A2(e){return e.role!=="user"?!1:E2.some(t=>t.test(e.content))}function bs(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Vh(e){return e?e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"):!1}function Gh(e){return typeof e=="string"&&e.trim().length>0}function Jh(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Qg(e,t){const a=Math.floor(e/1e3),r=Math.floor(a/60),o=Math.floor(r/60),s=Math.floor(o/24);return s>0?t?.includeMinutesWhenDays?`${s}d ${o%24}h ${r%60}m`:`${s}d ${o%24}h`:o>0?`${o}h ${r%60}m`:r>0?`${r}m ${a%60}s`:`${a}s`}function M2(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 eb(e){return/^\d/.test(e)?`v${e}`:e}const I2=[":discord:",":telegram:",":signal:",":slack:",":whatsapp:",":imessage:"];function fr(e){return e===Ye.value||e==="main"||e.endsWith(":main")}function R2(e){return ab(e.key)==="cron"}function tb(e){return/^agent:[^:]+:chat:[^:]+$/.test(e)}function L2(e){return ab(e.key)==="spawn"}function nb(e){const t=e.key.toLowerCase();return I2.some(a=>t.includes(a))?!0:e.kind==="group"}function $2(e){const t=e.split(":");return t.length>=2&&t[0]==="agent"?t[1]:null}function ab(e){const t=e.split(":");return t.length>=3&&t[0]==="agent"?t[2]:null}function rb(e){return e.split("-").map(bs).join(" ")}function Vp(e){return e.includes("-")&&e.length>20}function D2(e){if(fr(e.key))return"pinned";const t=e.updatedAt??e.lastActiveAt;if(!t)return"older";const a=new Date,r=new Date(t),o=new Date(a.getFullYear(),a.getMonth(),a.getDate()),s=new Date(o);s.setDate(s.getDate()-1);const i=new Date(o);return i.setDate(i.getDate()-o.getDay()),r>=o?"today":r>=s?"yesterday":r>=i?"thisWeek":"older"}function P2(e){const t=new Map([["pinned",[]],["today",[]],["yesterday",[]],["thisWeek",[]],["older",[]]]);for(const a of e){const r=D2(a);t.get(r).push(a)}return t}function O2(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 er(e){return e.key.includes(":cron:")?"cron":nb(e)?"channel":fr(e.key)?"main":"isolated"}function ae(e){return e instanceof Error?e.message:String(e)}const Mt=m(E1()??[]),In=m(null),qs=m(null),Vs=m(""),N2=Zg(Vs,300),Gs=m(!1),F2=m(!0),Gp=m(!1),Yh=m(null),kd=m(null),rt=K(()=>{const e=In.value;return!e||e==="main"?Ye.value??"main":e}),z2=K(()=>Mt.value.find(e=>e.key===rt.value)??null);function Cl(e){const t=rt.value;return!e||!t||e===t}function U2(e){return e.displayName?e.displayName:e.label?e.label:e.key}function j2(e){return nb(e)?"channel":fr(e.key)?"main":"isolated"}const Sd=K(()=>{let e=Mt.value;qs.value&&(e=e.filter(a=>j2(a)===qs.value)),Gs.value||(e=e.filter(a=>!R2(a))),F2.value||(e=e.filter(a=>!L2(a)));const t=N2.value.toLowerCase().trim();return t&&(e=e.filter(a=>{const r=U2(a).toLowerCase(),o=(a.channel??"").toLowerCase(),s=(a.model??"").toLowerCase();return r.includes(t)||o.includes(t)||s.includes(t)})),[...e].sort((a,r)=>{const o=fr(a.key),s=fr(r.key);return o&&!s?-1:s&&!o?1:(r.updatedAt??0)-(a.updatedAt??0)})}),H2=K(()=>P2(Sd.value));async function Wc(e){Gp.value=!0,kd.value=null;try{const t=await N("sessions.list",{limit:e?.limit??100,...e});Mt.value=t.sessions??[],A1(Mt.value)}catch(t){throw kd.value=t instanceof Error?t.message:String(t),t}finally{Gp.value=!1}}function ho(e){In.value=e}function B2(e){qs.value=e}function Jp(e){Vs.value=e}function W2(){Gs.value=!Gs.value}function K2(){Mt.value=[],In.value=null,kd.value=null}function Zh(e,t){Mt.value=Mt.value.map(a=>a.key===e?{...a,...t}:a)}function q2(e){Mt.value=Mt.value.filter(t=>t.key!==e),In.value===e&&(In.value=null),Yh.value=null}function V2(e){return new Promise(t=>{Yh.value=e,setTimeout(()=>{q2(e),t()},g2)})}let Xh=null;function G2(){const e=C1();return e?(Xh=e.sessionKey,e.messages):[]}function J2(e,t){T1(e,t),Xh=e}function Y2(){return Xh}const je=m(G2()),_d=m(!1),tc=m(null),Z2=m("off"),fa=m(!1),nc=m(void 0),Va=m(!1),ac=m(-1),ob=K(()=>je.value.filter(Xg)),X2=K(()=>ob.value.length),Tn=m(""),Qh=Zg(Tn,300),mt=m(!1),Xl=m(null),Gr=m(null),Jr=m(null),sb=K(()=>Gr.value!==null||Jr.value!==null);function Q2(){Gr.value=null,Jr.value=null}const lb=K(()=>{let e=je.value;const t=Gr.value,a=Jr.value;(t||a)&&(e=e.filter(o=>{const s=new Date(o.timestamp);if(t&&s<t)return!1;if(a){const i=new Date(a);if(i.setHours(23,59,59,999),s>i)return!1}return!0}));const r=Qh.value.trim().toLowerCase();return r&&(e=e.filter(o=>o.content.toLowerCase().includes(r))),e}),ek=K(()=>!Qh.value.trim().toLowerCase()&&!sb.value?0:lb.value.length),It=m([]),ib=K(()=>It.value.length>0),de=m(new Map),tk=K(()=>{for(const e of de.value.values())if(e.status==="pending"||e.status==="streaming")return e;return null}),cb=K(()=>tk.value!==null);function ef(e){for(const t of de.value.values())if(t.sessionKey===e&&(t.status==="pending"||t.status==="streaming"))return t;return null}function nk(e){const t=ef(e);return t?{isStreaming:!0,content:t.content,toolCalls:t.toolCalls}:{isStreaming:!1,content:"",toolCalls:[]}}function Kc(e,t){const a=de.value.get(e);if(!a)return;const r=new Map(de.value);r.set(e,{...a,...t}),de.value=r}function tf(e,t){setTimeout(()=>{const a=new Map(de.value);a.delete(e),de.value=a},t)}function nf(e,t,a){je.value=je.value.map(r=>r.id===e?{...r,status:t,error:a}:r)}function qc(){je.value=[],tc.value=null}function ak(e){je.value=e,Va.value=!1,nc.value=void 0,ac.value=-1}function rc(e){const t=je.value.findIndex(a=>a.id===e.id);if(t>=0){je.value=je.value.map((a,r)=>r===t?{...a,...e}:a);return}je.value=[...je.value,e]}function ub(e){nf(e,"sending",void 0)}function rk(e){nf(e,"sent",void 0)}function Yp(e,t){nf(e,"failed",t)}function Io(e,t){const a=new Map(de.value);a.set(e,{runId:e,sessionKey:t,startedAt:Date.now(),status:"pending",content:"",toolCalls:[]}),de.value=a}function xs(e,t,a=[],r){const o=de.value.get(e);o&&Kc(e,{status:"streaming",content:t,toolCalls:a,lastBlockStart:r??o.lastBlockStart})}function oc(e,t){const a=de.value.get(e),r=t?.content??a?.content??"";Kc(e,{status:"complete",message:t,content:r}),t&&Cl(a?.sessionKey)&&(a?.sessionKey==="unknown"&&ok(t)||rc(t)),tf(e,p2)}function ok(e){const t=je.value;for(let a=t.length-1;a>=0;a--){const r=t[a];if(r.role==="assistant"){if(Date.now()-r.timestamp>6e4)break;if(e.toolCalls&&r.toolCalls){const o=new Set(e.toolCalls.map(i=>i.id));if(r.toolCalls.some(i=>o.has(i.id))){const i=r.toolCalls.map(u=>{const d=e.toolCalls?.find(h=>h.id===u.id);return d?{...u,status:d.status,result:d.result,completedAt:d.completedAt}:u});let c=r.content;if(e.content&&!r.content.endsWith(e.content)){const u=r.content?`
4
+ `,b2=300,x2="2026.3.2",Zl={docs:"https://docs.openclaw.ai",github:"https://github.com/MaudeCode/cove",githubOpenClaw:"https://github.com/openclaw/openclaw",discord:"https://discord.com/invite/clawd"};function Zg(e,t){const a=m(e.value);let r=null;return e.subscribe(o=>{r&&clearTimeout(r),r=setTimeout(()=>{a.value=o},t)}),a}const y2=[/read heartbeat\.md/i,/heartbeat poll/i,/if nothing needs attention.*reply.*heartbeat_ok/i],w2=/^\s*heartbeat_ok\s*$/i,k2=/^\s*\[cron\]/i;function S2(e){return e.role!=="user"?!1:y2.some(t=>t.test(e.content))}function Wh(e){return e.role!=="assistant"?!1:w2.test(e.content)}function _2(e){return e.role!=="assistant"?!1:k2.test(e.content)}function Xg(e){return S2(e)||Wh(e)}const C2=[/^pre-compaction memory flush/i,/^read heartbeat\.md if it exists/i];function T2(e){return e.role!=="user"?!1:C2.some(t=>t.test(e.content))}function E2(e){let t=e;t=t.replace(/^Conversation info \(untrusted metadata\):\s*```json\s*\{[^}]*\}\s*```\s*/s,"");const a=t.match(/^\[([^\]]+)\]\s*/);if(a){const r=a[1]??"";(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(r)||/\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(r))&&(t=t.slice(a[0].length))}return t.includes("[message_id:")&&(t=t.split(/\r?\n/).filter(r=>!/^\s*\[message_id:\s*[^\]]+\]\s*$/i.test(r)).join(`
5
+ `)),t.trim()}const A2=[/^<summary>/i,/the conversation.*compacted/i,/context was summarized/i];function M2(e){return e.role!=="user"?!1:A2.some(t=>t.test(e.content))}function bs(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Kh(e){return e?e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"):!1}function qh(e){return typeof e=="string"&&e.trim().length>0}function Vh(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Qg(e,t){const a=Math.floor(e/1e3),r=Math.floor(a/60),o=Math.floor(r/60),s=Math.floor(o/24);return s>0?t?.includeMinutesWhenDays?`${s}d ${o%24}h ${r%60}m`:`${s}d ${o%24}h`:o>0?`${o}h ${r%60}m`:r>0?`${r}m ${a%60}s`:`${a}s`}function I2(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 eb(e){return/^\d/.test(e)?`v${e}`:e}const R2=[":discord:",":telegram:",":signal:",":slack:",":whatsapp:",":imessage:"];function fr(e){return e===Je.value||e==="main"||e.endsWith(":main")}function L2(e){return ab(e.key)==="cron"}function tb(e){return/^agent:[^:]+:chat:[^:]+$/.test(e)}function $2(e){return ab(e.key)==="spawn"}function nb(e){const t=e.key.toLowerCase();return R2.some(a=>t.includes(a))?!0:e.kind==="group"}function D2(e){const t=e.split(":");return t.length>=2&&t[0]==="agent"?t[1]:null}function ab(e){const t=e.split(":");return t.length>=3&&t[0]==="agent"?t[2]:null}function rb(e){return e.split("-").map(bs).join(" ")}function qp(e){return e.includes("-")&&e.length>20}function P2(e){if(fr(e.key))return"pinned";const t=e.updatedAt??e.lastActiveAt;if(!t)return"older";const a=new Date,r=new Date(t),o=new Date(a.getFullYear(),a.getMonth(),a.getDate()),s=new Date(o);s.setDate(s.getDate()-1);const i=new Date(o);return i.setDate(i.getDate()-o.getDay()),r>=o?"today":r>=s?"yesterday":r>=i?"thisWeek":"older"}function O2(e){const t=new Map([["pinned",[]],["today",[]],["yesterday",[]],["thisWeek",[]],["older",[]]]);for(const a of e){const r=P2(a);t.get(r).push(a)}return t}function N2(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 er(e){return e.key.includes(":cron:")?"cron":nb(e)?"channel":fr(e.key)?"main":"isolated"}function ne(e){return e instanceof Error?e.message:String(e)}const It=m(A1()??[]),Rn=m(null),Vs=m(null),Gs=m(""),F2=Zg(Gs,300),Js=m(!1),z2=m(!0),Vp=m(!1),Gh=m(null),xd=m(null),at=K(()=>{const e=Rn.value;return!e||e==="main"?Je.value??"main":e}),U2=K(()=>It.value.find(e=>e.key===at.value)??null);function Cl(e){const t=at.value;return!e||!t||e===t}function j2(e){return e.displayName?e.displayName:e.label?e.label:e.key}function H2(e){return nb(e)?"channel":fr(e.key)?"main":"isolated"}const yd=K(()=>{let e=It.value;Vs.value&&(e=e.filter(a=>H2(a)===Vs.value)),Js.value||(e=e.filter(a=>!L2(a))),z2.value||(e=e.filter(a=>!$2(a)));const t=F2.value.toLowerCase().trim();return t&&(e=e.filter(a=>{const r=j2(a).toLowerCase(),o=(a.channel??"").toLowerCase(),s=(a.model??"").toLowerCase();return r.includes(t)||o.includes(t)||s.includes(t)})),[...e].sort((a,r)=>{const o=fr(a.key),s=fr(r.key);return o&&!s?-1:s&&!o?1:(r.updatedAt??0)-(a.updatedAt??0)})}),B2=K(()=>O2(yd.value));async function jc(e){Vp.value=!0,xd.value=null;try{const t=await N("sessions.list",{limit:e?.limit??100,...e});It.value=t.sessions??[],M1(It.value)}catch(t){throw xd.value=t instanceof Error?t.message:String(t),t}finally{Vp.value=!1}}function fo(e){Rn.value=e}function W2(e){Vs.value=e}function Gp(e){Gs.value=e}function K2(){Js.value=!Js.value}function q2(){It.value=[],Rn.value=null,xd.value=null}function Jh(e,t){It.value=It.value.map(a=>a.key===e?{...a,...t}:a)}function V2(e){It.value=It.value.filter(t=>t.key!==e),Rn.value===e&&(Rn.value=null),Gh.value=null}function G2(e){return new Promise(t=>{Gh.value=e,setTimeout(()=>{V2(e),t()},b2)})}let Yh=null;function J2(){const e=T1();return e?(Yh=e.sessionKey,e.messages):[]}function Y2(e,t){E1(e,t),Yh=e}function Z2(){return Yh}const je=m(J2()),wd=m(!1),Qi=m(null),X2=m("off"),fa=m(!1),ec=m(void 0),Va=m(!1),tc=m(-1),ob=K(()=>je.value.filter(Xg)),Q2=K(()=>ob.value.length),Tn=m(""),Zh=Zg(Tn,300),mt=m(!1),Xl=m(null),Gr=m(null),Jr=m(null),sb=K(()=>Gr.value!==null||Jr.value!==null);function ek(){Gr.value=null,Jr.value=null}const lb=K(()=>{let e=je.value;const t=Gr.value,a=Jr.value;(t||a)&&(e=e.filter(o=>{const s=new Date(o.timestamp);if(t&&s<t)return!1;if(a){const i=new Date(a);if(i.setHours(23,59,59,999),s>i)return!1}return!0}));const r=Zh.value.trim().toLowerCase();return r&&(e=e.filter(o=>o.content.toLowerCase().includes(r))),e}),tk=K(()=>!Zh.value.trim().toLowerCase()&&!sb.value?0:lb.value.length),Rt=m([]),ib=K(()=>Rt.value.length>0),de=m(new Map),nk=K(()=>{for(const e of de.value.values())if(e.status==="pending"||e.status==="streaming")return e;return null}),cb=K(()=>nk.value!==null);function Xh(e){for(const t of de.value.values())if(t.sessionKey===e&&(t.status==="pending"||t.status==="streaming"))return t;return null}function ak(e){const t=Xh(e);return t?{isStreaming:!0,content:t.content,toolCalls:t.toolCalls}:{isStreaming:!1,content:"",toolCalls:[]}}function Hc(e,t){const a=de.value.get(e);if(!a)return;const r=new Map(de.value);r.set(e,{...a,...t}),de.value=r}function Qh(e,t){setTimeout(()=>{const a=new Map(de.value);a.delete(e),de.value=a},t)}function ef(e,t,a){je.value=je.value.map(r=>r.id===e?{...r,status:t,error:a}:r)}function Bc(){je.value=[],Qi.value=null}function rk(e){je.value=e,Va.value=!1,ec.value=void 0,tc.value=-1}function nc(e){const t=je.value.findIndex(a=>a.id===e.id);if(t>=0){je.value=je.value.map((a,r)=>r===t?{...a,...e}:a);return}je.value=[...je.value,e]}function ub(e){ef(e,"sending",void 0)}function ok(e){ef(e,"sent",void 0)}function Jp(e,t){ef(e,"failed",t)}function Io(e,t){const a=new Map(de.value);a.set(e,{runId:e,sessionKey:t,startedAt:Date.now(),status:"pending",content:"",toolCalls:[]}),de.value=a}function xs(e,t,a=[],r){const o=de.value.get(e);o&&Hc(e,{status:"streaming",content:t,toolCalls:a,lastBlockStart:r??o.lastBlockStart})}function ac(e,t){const a=de.value.get(e),r=t?.content??a?.content??"";Hc(e,{status:"complete",message:t,content:r}),t&&Cl(a?.sessionKey)&&(a?.sessionKey==="unknown"&&sk(t)||nc(t)),Qh(e,m2)}function sk(e){const t=je.value;for(let a=t.length-1;a>=0;a--){const r=t[a];if(r.role==="assistant"){if(Date.now()-r.timestamp>6e4)break;if(e.toolCalls&&r.toolCalls){const o=new Set(e.toolCalls.map(i=>i.id));if(r.toolCalls.some(i=>o.has(i.id))){const i=r.toolCalls.map(u=>{const d=e.toolCalls?.find(h=>h.id===u.id);return d?{...u,status:d.status,result:d.result,completedAt:d.completedAt}:u});let c=r.content;if(e.content&&!r.content.endsWith(e.content)){const u=r.content?`
6
6
 
7
- `:"";c=r.content+u+e.content}return je.value=t.map(u=>u.id===r.id?{...u,content:c,toolCalls:i}:u),!0}}}}return!1}function Cd(e,t){Kc(e,{status:"error",error:t}),tf(e,m2)}function sk(e){Kc(e,{status:"aborted"}),tf(e,v2)}function lk(){de.value=new Map}function Zp(e){It.value=[...It.value,e]}function db(e){It.value=It.value.filter(t=>t.id!==e)}function ik(e,t,a){It.value=It.value.map(r=>r.id===e?{...r,content:t,images:a}:r)}const Td=m(new Map);function Xp(e){return Td.value.get(e)||""}function hb(e,t){const a=new Map(Td.value);t?a.set(e,t):a.delete(e),Td.value=a}function ck(e){hb(e,"")}const fb="[chat.history omitted: message too large]",pb=/(?:\r?\n)\.\.\.\(truncated\)\.\.\.\s*$/u;function sc(e){if(typeof e=="string")return{text:e,toolCalls:[],images:[]};const t=[],a=[],r=[],o=[];let s=0;for(const c of e)switch(c.type){case"text":{t.push(c.text),s+=c.text.length;break}case"image":{const u=c.omitted===!0||c.source?.omitted===!0,d=typeof c.bytes=="number"?c.bytes:typeof c.source?.bytes=="number"?c.source.bytes:void 0;if(u){r.push({url:"",alt:"Image omitted",omitted:!0,bytes:d});break}if(c.source?.type==="base64"&&c.source.data)r.push({url:`data:${c.source.media_type};base64,${c.source.data}`,alt:"Image"});else if(c.data){const h=c.data.startsWith("data:")?c.data:`data:${c.mimeType||"image/png"};base64,${c.data}`;r.push({url:h,alt:"Image"})}break}case"tool_use":{a.push({id:c.id,name:c.name,args:c.input,status:"running",startedAt:Date.now(),insertedAtContentLength:s});break}case"toolCall":{a.push({id:c.id,name:c.name,args:c.arguments,status:"pending",insertedAtContentLength:s});break}case"tool_result":{const u=a.find(d=>d.id===c.id);u&&(u.result=c.content,u.status="complete",u.completedAt=Date.now());break}case"thinking":{const u=c.thinking?.trim();u&&o.push(u);break}}const i=o.length>0?o.join(`
7
+ `:"";c=r.content+u+e.content}return je.value=t.map(u=>u.id===r.id?{...u,content:c,toolCalls:i}:u),!0}}}}return!1}function kd(e,t){Hc(e,{status:"error",error:t}),Qh(e,v2)}function lk(e){Hc(e,{status:"aborted"}),Qh(e,g2)}function ik(){de.value=new Map}function Yp(e){Rt.value=[...Rt.value,e]}function db(e){Rt.value=Rt.value.filter(t=>t.id!==e)}function ck(e,t,a){Rt.value=Rt.value.map(r=>r.id===e?{...r,content:t,images:a}:r)}const Sd=m(new Map);function Zp(e){return Sd.value.get(e)||""}function hb(e,t){const a=new Map(Sd.value);t?a.set(e,t):a.delete(e),Sd.value=a}function uk(e){hb(e,"")}const fb="[chat.history omitted: message too large]",pb=/(?:\r?\n)\.\.\.\(truncated\)\.\.\.\s*$/u;function rc(e){if(typeof e=="string")return{text:e,toolCalls:[],images:[]};const t=[],a=[],r=[],o=[];let s=0;for(const c of e)switch(c.type){case"text":{t.push(c.text),s+=c.text.length;break}case"image":{const u=c.omitted===!0||c.source?.omitted===!0,d=typeof c.bytes=="number"?c.bytes:typeof c.source?.bytes=="number"?c.source.bytes:void 0;if(u){r.push({url:"",alt:"Image omitted",omitted:!0,bytes:d});break}if(c.source?.type==="base64"&&c.source.data)r.push({url:`data:${c.source.media_type};base64,${c.source.data}`,alt:"Image"});else if(c.data){const h=c.data.startsWith("data:")?c.data:`data:${c.mimeType||"image/png"};base64,${c.data}`;r.push({url:h,alt:"Image"})}break}case"tool_use":{a.push({id:c.id,name:c.name,args:c.input,status:"running",startedAt:Date.now(),insertedAtContentLength:s});break}case"toolCall":{a.push({id:c.id,name:c.name,args:c.arguments,status:"pending",insertedAtContentLength:s});break}case"tool_result":{const u=a.find(d=>d.id===c.id);u&&(u.result=c.content,u.status="complete",u.completedAt=Date.now());break}case"thinking":{const u=c.thinking?.trim();u&&o.push(u);break}}const i=o.length>0?o.join(`
8
8
 
9
9
  `):void 0;return{text:t.join(`
10
- `),toolCalls:a,images:r,thinking:i}}function uk(e,t){const a=sc(e.content),r=dk(e),o=e.role==="toolResult"?"assistant":e.role,s=o==="user"?T2(a.text):a.text,i=hk(s),c=fk(s),u={id:t,role:o,content:c,images:a.images.length>0?a.images:void 0,toolCalls:a.toolCalls.length>0?a.toolCalls:void 0,thinking:a.thinking,timestamp:e.timestamp??Date.now(),isStreaming:!1};return r.kind==="compaction"&&(u.kind="compaction"),r.truncated===!0?(u.historyTruncated=!0,typeof r.reason=="string"&&r.reason.length>0&&(u.historyTruncationReason=r.reason)):i&&(u.historyTruncated=!0,u.content.includes(fb)&&(u.historyTruncationReason="oversized")),u}function dk(e){const t=e,a=e.__openclaw,r=typeof a?.kind=="string"?a.kind:typeof t["__openclaw.kind"]=="string"?t["__openclaw.kind"]:void 0,o=typeof a?.id=="string"?a.id:typeof t["__openclaw.id"]=="string"?t["__openclaw.id"]:void 0,s=typeof a?.truncated=="boolean"?a.truncated:typeof t["__openclaw.truncated"]=="boolean"?t["__openclaw.truncated"]:void 0,i=typeof a?.reason=="string"?a.reason:typeof t["__openclaw.reason"]=="string"?t["__openclaw.reason"]:void 0;return{kind:r,id:o,truncated:s,reason:i}}function hk(e){const t=e.trim();return t?!!(pb.test(e)||t.includes(fb)):!1}function fk(e){return e.replace(pb,"")}function pk(e,t){const a=new Map;for(const r of e)a.set(r.id,{...r});for(const r of t){const o=a.get(r.id);o?a.set(r.id,{...o,...r,startedAt:o.startedAt??r.startedAt}):a.set(r.id,r)}return Array.from(a.values())}function Ed(e){if(!e||typeof e!="object")return e;if(Array.isArray(e)&&e.length>0){const a=e[0];if(a?.type==="text"&&typeof a.text=="string")return a.text}const t=e;if(Array.isArray(t.content)&&t.content.length>0){const a=t.content[0];if(a?.type==="text"&&typeof a.text=="string")return a.text}return e}const Mu=new Map;function mk(e){const t=new Map;for(const a of e)a.role==="toolResult"&&a.toolCallId&&t.set(a.toolCallId,{content:Ed(a.content),isError:a.isError??!1});return t}function vk(e,t){if(e.toolCalls)for(const a of e.toolCalls){const r=t.get(a.id);r&&(a.result=r.content,a.status=r.isError?"error":"complete",a.completedAt=Date.now())}}function gk(e,t){return e.role==="assistant"&&t.role==="assistant"&&Math.abs(t.timestamp-e.timestamp)<h2}function bk(e,t){const a=e.content.length,r=e.content&&t.content?`
10
+ `),toolCalls:a,images:r,thinking:i}}function dk(e,t){const a=rc(e.content),r=hk(e),o=e.role==="toolResult"?"assistant":e.role,s=o==="user"?E2(a.text):a.text,i=fk(s),c=pk(s),u={id:t,role:o,content:c,images:a.images.length>0?a.images:void 0,toolCalls:a.toolCalls.length>0?a.toolCalls:void 0,thinking:a.thinking,timestamp:e.timestamp??Date.now(),isStreaming:!1};return r.kind==="compaction"&&(u.kind="compaction"),r.truncated===!0?(u.historyTruncated=!0,typeof r.reason=="string"&&r.reason.length>0&&(u.historyTruncationReason=r.reason)):i&&(u.historyTruncated=!0,u.content.includes(fb)&&(u.historyTruncationReason="oversized")),u}function hk(e){const t=e,a=e.__openclaw,r=typeof a?.kind=="string"?a.kind:typeof t["__openclaw.kind"]=="string"?t["__openclaw.kind"]:void 0,o=typeof a?.id=="string"?a.id:typeof t["__openclaw.id"]=="string"?t["__openclaw.id"]:void 0,s=typeof a?.truncated=="boolean"?a.truncated:typeof t["__openclaw.truncated"]=="boolean"?t["__openclaw.truncated"]:void 0,i=typeof a?.reason=="string"?a.reason:typeof t["__openclaw.reason"]=="string"?t["__openclaw.reason"]:void 0;return{kind:r,id:o,truncated:s,reason:i}}function fk(e){const t=e.trim();return t?!!(pb.test(e)||t.includes(fb)):!1}function pk(e){return e.replace(pb,"")}function mk(e,t){const a=new Map;for(const r of e)a.set(r.id,{...r});for(const r of t){const o=a.get(r.id);o?a.set(r.id,{...o,...r,startedAt:o.startedAt??r.startedAt}):a.set(r.id,r)}return Array.from(a.values())}function _d(e){if(!e||typeof e!="object")return e;if(Array.isArray(e)&&e.length>0){const a=e[0];if(a?.type==="text"&&typeof a.text=="string")return a.text}const t=e;if(Array.isArray(t.content)&&t.content.length>0){const a=t.content[0];if(a?.type==="text"&&typeof a.text=="string")return a.text}return e}const Tu=new Map;function vk(e){const t=new Map;for(const a of e)a.role==="toolResult"&&a.toolCallId&&t.set(a.toolCallId,{content:_d(a.content),isError:a.isError??!1});return t}function gk(e,t){if(e.toolCalls)for(const a of e.toolCalls){const r=t.get(a.id);r&&(a.result=r.content,a.status=r.isError?"error":"complete",a.completedAt=Date.now())}}function bk(e,t){return e.role==="assistant"&&t.role==="assistant"&&Math.abs(t.timestamp-e.timestamp)<f2}function xk(e,t){const a=e.content.length,r=e.content&&t.content?`
11
11
 
12
- `:"";if(t.toolCalls&&t.toolCalls.length>0){const o=t.toolCalls.map(s=>({...s,insertedAtContentLength:s.insertedAtContentLength!==void 0?a+r.length+s.insertedAtContentLength:void 0}));e.toolCalls=[...e.toolCalls??[],...o]}t.content&&(e.content=e.content?`${e.content}${r}${t.content}`:t.content),e.timestamp=Math.max(e.timestamp,t.timestamp),t.historyTruncated&&(e.historyTruncated=!0,!e.historyTruncationReason&&t.historyTruncationReason&&(e.historyTruncationReason=t.historyTruncationReason))}async function Vc(e,t=f2){const a=Mu.get(e);if(a)return M.chat.debug("History load already in progress for session, waiting:",e),a;const r=xk(e,t);Mu.set(e,r);try{await r}finally{Mu.delete(e)}}async function xk(e,t){_d.value=!0,tc.value=null;try{const a=await N("chat.history",{sessionKey:e,limit:t}),r=mk(a.messages),o=[];for(let s=0;s<a.messages.length;s++){const i=a.messages[s];if(i.role==="toolResult")continue;const c=uk(i,`hist_${s}_${Date.now()}`);vk(c,r);const u=o[o.length-1];if(u&&gk(u,c)){bk(u,c);continue}o.push(c)}ak(o),J2(e,o),a.thinkingLevel&&(Z2.value=a.thinkingLevel)}catch(a){throw tc.value=a instanceof Error?a.message:String(a),a}finally{_d.value=!1}}function yk(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 wk(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.runId=="string"&&typeof t.stream=="string"&&["lifecycle","assistant","tool","error","compaction","thinking"].includes(t.stream)&&typeof t.seq=="number"&&typeof t.ts=="number"}function mb(e,t,a){if(!e)return{content:t};if(t.startsWith(e))return{content:t};if(a!==void 0&&a>0&&a<=e.length){const o=e.slice(0,a),s=e.slice(a);if(t.startsWith(s))return{content:o+t,lastBlockStart:a};if(s.startsWith(t))return{content:e,lastBlockStart:a};if(t.length<s.length&&!s.includes(t)){const i=e.length+Yl.length;return{content:e+Yl+t,lastBlockStart:i}}return{content:o+t,lastBlockStart:a}}const r=e.length+Yl.length;return{content:e+Yl+t,lastBlockStart:r}}function kk(e,t){const a=e.trim().replace(/\s+/g," ");return a.length<=t?a:a.slice(0,t).trim()+"…"}async function Sk(e,t){if(!tb(e))return;const a=kk(t,50);if(!a){M.chat.debug("autoRenameSession: empty message, skipping");return}try{M.chat.debug("autoRenameSession: renaming",{sessionKey:e,title:a}),await N("sessions.patch",{key:e,label:a}),Zh(e,{label:a}),M.chat.info("autoRenameSession: renamed session",{sessionKey:e,title:a})}catch(r){M.chat.error("autoRenameSession: failed",{sessionKey:e,error:r})}}const _k=["/new","/reset"];function Ck(e){const t=e.trim().toLowerCase();return _k.some(a=>t===a||t.startsWith(`${a} `))}let Tk=0;function Ek(e){if(!e||e.length===0)return;const t=[];for(const a of e)a.type==="image"&&t.push({url:a.content,alt:a.fileName});return t.length>0?t:void 0}function Ak(){return`cove_${Date.now()}_${++Tk}`}async function vb(e,t,a){const r=a?.messageId??Ak(),o=`user_${r}`,s=a?.messageId!=null,i={id:o,role:"user",content:t,images:Ek(a?.attachments),timestamp:Date.now(),isStreaming:!1,status:"sending",sessionKey:e};if(!D.value)return M.chat.info("Not connected, queuing message"),i.status="queued",Zp(i),r;if(cb.value&&!s)return M.chat.info("Currently streaming, queuing message"),i.status="queued",Zp(i),r;s?ub(o):rc(i),Io(r,e);try{M.chat.debug("Sending message to session:",e);const c=await N("chat.send",{sessionKey:e,message:t,thinking:a?.thinking,timeoutMs:a?.timeoutMs,idempotencyKey:r,attachments:a?.attachments});if(c.status==="error"){const u=c.summary??"Unknown error";throw Cd(r,u),Yp(o,u),new Error(u)}if(rk(o),Ck(t)&&(M.chat.info("Reset command detected, clearing messages for session:",e),setTimeout(()=>{qc(),Vc(e).catch(u=>{M.chat.warn("Failed to reload history after reset:",u)})},100)),!s&&tb(e)){const u=Mt.value.find(h=>h.key===e),d=l("common.newChat");u?.label===d&&Sk(e,t).catch(h=>{M.chat.warn("Auto-rename failed:",h instanceof Error?h.message:String(h))})}return r}catch(c){const u=c instanceof Error?c.message:String(c);throw M.chat.error("chat.send failed:",c),Cd(r,u),Yp(o,u),c}}async function af(e){if(!e.sessionKey){M.chat.warn("Cannot resend message - missing sessionKey:",e.id);return}db(e.id),je.value.find(r=>r.id===e.id)?ub(e.id):rc({...e,status:"sending"});const a=e.id.replace(/^user_/,"");await vb(e.sessionKey,e.content,{messageId:a})}async function Ad(e){if(cb.value){M.chat.debug("Still streaming, not processing queue");return}const t=It.value.find(a=>a.sessionKey===e);if(!t){M.chat.debug("No queued messages for session");return}M.chat.info("Processing next queued message:",t.id);try{await af(t)}catch(a){M.chat.error("Failed to send queued message:",a)}}async function Mk(e){let t=It.value.find(a=>a.id===e);if(t||(t=je.value.find(a=>a.id===e&&a.status==="failed")),!t){M.chat.warn("Cannot retry message - not found:",e);return}await af(t)}async function Ik(){const e=[...It.value];if(e.length!==0){M.chat.info(`Processing ${e.length} queued messages`);for(const t of e)try{await af(t)}catch(a){M.chat.error("Failed to send queued message:",a)}}}async function gb(e){await N("chat.abort",{sessionKey:e})}let ys=null,ws=null;const wa=new Set;function Rk(){return ys&&ws||(M.chat.info("Subscribing to chat events"),ys=wd("chat",e=>{if(!yk(e)){M.chat.warn("Invalid chat event payload:",e);return}Nk(e)}),ws=wd("agent",e=>{if(!wk(e)){M.chat.warn("Invalid agent event payload:",e);return}const t=e;t.stream==="tool"?Ok(t):t.stream==="lifecycle"?t.data?.phase==="start"?Lk(t):(t.data?.phase==="end"||t.data?.phase==="error")&&$k(t):t.stream==="compaction"?Dk(t):t.stream==="assistant"&&Pk(t)})),Md}function Md(){ys&&(ys(),ys=null),ws&&(ws(),ws=null),wa.clear()}function Lk(e){const{runId:t,sessionKey:a}=e;if(!Cl(a)||wa.has(t))return;!de.value.get(t)&&a&&(M.chat.debug("Creating run on-the-fly for lifecycle start:",t,"session:",a),Io(t,a))}function $k(e){const{runId:t,sessionKey:a}=e;if(!Cl(a))return;if(wa.has(t)){wa.delete(t),fa.value&&(M.chat.warn("Clearing stale isCompacting flag via lifecycle end for run:",t),zc(()=>{fa.value=!1,Va.value=!0}));return}const r=de.value.get(t);if(r&&(r.status==="pending"||r.status==="streaming")){M.chat.debug("Completing run via lifecycle end:",t,"phase:",e.data?.phase);const o=!r.content;if(r.content){const s={id:`assistant_${t}`,role:"assistant",content:r.content,toolCalls:r.toolCalls?.length?r.toolCalls:void 0,timestamp:Date.now()};oc(t,s)}else oc(t);if(r.sessionKey&&(setTimeout(()=>Ad(r.sessionKey),100),o)){const s=r.sessionKey;setTimeout(()=>{Vc(s).catch(i=>{M.chat.warn("Failed to refresh history after heartbeat:",i)})},500)}}}function Dk(e){const t=e.data?.phase;if(M.chat.info("Compaction event:",t,"runId:",e.runId,"isCompacting:",fa.value),e.runId&&wa.add(e.runId),t==="start"){if(e.runId&&de.value.has(e.runId)){M.chat.debug("Removing ghost run created before compaction registration:",e.runId);const a=new Map(de.value);a.delete(e.runId),de.value=a}fa.value=!0}else if(t==="end"){const a=je.value.length,r=typeof e.data?.summary=="string"?e.data.summary:void 0;zc(()=>{fa.value=!1,nc.value=r,Va.value=!0,ac.value=a}),M.chat.info("Compaction ended, divider at index:",a)}}function Pk(e){const{runId:t,sessionKey:a,data:r}=e,o=typeof r?.text=="string"?r.text:null;if(!o||wa.has(t)||!Cl(a))return;let s=de.value.get(t);if(!s&&a&&(M.chat.debug("Creating run for assistant stream:",t,"session:",a),Io(t,a),s=de.value.get(t)),!s)return;const{content:i,lastBlockStart:c}=mb(s.content,o,s.lastBlockStart);xs(t,i,s.toolCalls,c)}function Ok(e){const{runId:t,sessionKey:a,data:r}=e;if(!r||wa.has(t)||!Cl(a))return;M.chat.debug("Tool event received",{runId:t,phase:r.phase,toolCallId:r.toolCallId,toolName:r.name});let o=de.value.get(t);if(!o&&(M.chat.debug("Creating run on-the-fly for tool event:",t,"session:",a),Io(t,a??"unknown"),o=de.value.get(t),!o))return;const s=r.toolCallId??`tool_${Date.now()}`,i=r.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(d=>d.id)});const u=()=>{let d=c.findIndex(h=>h.id===s);return d<0?(M.chat.debug("Creating missing tool call:",s),c.push({id:s,name:i,args:r.args,status:"running",startedAt:Date.now(),insertedAtContentLength:o.content.length,contentSnapshotAtStart:o.content}),d=c.length-1):r.args&&!c[d].args&&(c[d]={...c[d],args:r.args}),d};switch(r.phase){case"start":{if(c.some(d=>d.id===s)){M.chat.debug("Tool start skipped - duplicate",{toolCallId:s});return}setTimeout(()=>{const d=de.value.get(t);if(!d){M.chat.warn("Tool start deferred - run no longer exists",{runId:t,toolCallId:s});return}const h=[...d.toolCalls];if(h.some(p=>p.id===s)){M.chat.debug("Tool start deferred skipped - duplicate",{toolCallId:s});return}const f={id:s,name:i,args:r.args,status:"running",startedAt:Date.now(),insertedAtContentLength:d.content.length,contentSnapshotAtStart:d.content};M.chat.debug("Tool start processed",{toolCallId:s,toolName:i,insertedAtContentLength:f.insertedAtContentLength,contentSnapshotLen:d.content.length}),h.push(f),xs(t,d.content,h)},0);break}case"update":{const d=u();c[d]={...c[d],result:Ed(r.partialResult)},xs(t,o.content,c);break}case"result":{const d=u();c[d]={...c[d],result:Ed(r.result),status:r.isError?"error":"complete",completedAt:Date.now()},xs(t,o.content,c);break}}}function Nk(e){const{runId:t,state:a,errorMessage:r}=e;if(wa.has(t)){M.chat.debug("Skipping chat event for compaction run:",t,a);return}switch(M.chat.debug("Chat event:",a,t,"session:",e.sessionKey),a){case"delta":Fk(e);break;case"final":zk(e);break;case"aborted":sk(t);break;case"error":Cd(t,r??"Unknown error");break}}function Fk(e){const{runId:t,sessionKey:a,message:r}=e;if(!r)return;const o=sc(r.content);let s=de.value.get(t);if(!s&&(M.chat.debug("Creating run on-the-fly for delta:",t,"session:",a),Io(t,a),s=de.value.get(t),!s)||o.toolCalls.length===0)return;M.chat.debug("Delta event - processing tool calls only",{runId:t,parsedToolCallsCount:o.toolCalls.length,existingToolCallsCount:s.toolCalls.length});const i=pk(s.toolCalls,o.toolCalls);xs(t,s.content,i,s.lastBlockStart)}function zk(e){const{runId:t,sessionKey:a,message:r}=e;let o=de.value.get(t);if(M.chat.debug("Final event received",{runId:t,hasExistingRun:!!o,existingContentLen:o?.content?.length,existingToolCallsCount:o?.toolCalls?.length,hasMessage:!!r}),o||(M.chat.debug("Creating run on-the-fly for final:",t,"session:",a),Io(t,a),o=de.value.get(t)),!o){M.chat.warn("Final event with no run and couldn't create one:",t);return}if(r?.content){const d=sc(r.content);if(d.text&&qh({role:"assistant",content:d.text})){M.chat.debug("Heartbeat detected, completing run without message:",t),oc(t),setTimeout(()=>Ad(a),100);return}}let s=o?.content??"",i=[];if(r?.content){const d=sc(r.content);M.chat.debug("Final message parsed",{runId:t,parsedTextLen:d.text.length,parsedToolCallsCount:d.toolCalls.length,existingContentLen:s.length,willUseFinaContent:d.text.length>=s.length}),d.text.length>=s.length?(s=d.text,i=d.toolCalls):d.text&&(M.chat.debug("Final merging partial text",{existingLen:s.length,parsedLen:d.text.length}),s=mb(s,d.text,o?.lastBlockStart).content)}M.chat.debug("Final content determined",{runId:t,finalContentLen:s.length,finalContentPreview:s.slice(-200)});const c=o?.toolCalls?.map(d=>{const h={...d};(h.status==="running"||h.status==="pending")&&(h.status="complete",h.completedAt=Date.now());const f=i.find(p=>p.id===d.id);return f?.insertedAtContentLength!==void 0&&(h.insertedAtContentLength=f.insertedAtContentLength),delete h.contentSnapshotAtStart,h}),u={id:`assistant_${t}`,role:"assistant",content:s,toolCalls:c?.length?c:void 0,timestamp:r?.timestamp??Date.now()};oc(t,u),setTimeout(()=>{Ad(a)},100)}async function rf(e){Rk(),await Vc(e)}function Uk(){Md(),qc()}function jk(e){if(!e)return null;if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"))return e;if(e.startsWith("/")){const t=gt.value;if(t)return`${t.replace(/^ws/,"http")}${e}`}return e}const Hk="Assistant",Bk="🤖",Wk="You",Id=m(Hk),Rd=m(Bk),Kk=m(null),qk=m(Wk),Vk=m(null),Qp=m(!1);async function of(e){Qp.value=!0;try{const a=await N("agent.identity.get",e?{sessionKey:e}:{});a&&(a.name&&(Id.value=a.name),a.avatar&&(Rd.value=jk(a.avatar)),a.agentId&&(Kk.value=a.agentId),M.ui.info("Loaded assistant identity:",Id.value,"avatar:",Rd.value))}catch(t){M.ui.error("Failed to load assistant identity:",t)}finally{Qp.value=!1}}const Gk=300*1e3,bb=m(Zk()),em=m(!1),tm=m(null);let _i=null;const sf=K(()=>{const e=bb.value;return e?e.providers.find(t=>t.provider==="anthropic")??null:null}),Jk=K(()=>{const e=sf.value;return e!==null&&e.windows.length>0&&!e.error}),Yk=K(()=>{const e=sf.value;if(!e||e.windows.length===0)return null;const t=e.windows.find(a=>a.label==="Week");return t||e.windows[0]});function Zk(){const e=M1();return e?(M.usage.debug("Loaded cached usage"),e):null}async function nm(){if(!D.value){M.usage.debug("Skipping usage fetch - not connected");return}em.value=!0,tm.value=null;try{const e=await rs.send("usage.status");bb.value=e,I1(e),M.usage.debug("Usage fetched:",e)}catch(e){const t=e instanceof Error?e.message:"Failed to fetch usage";tm.value=t,M.usage.error("Usage fetch failed:",t)}finally{em.value=!1}}function lf(){xb(),nm(),_i=setInterval(()=>{nm()},Gk),M.usage.debug("Usage polling started")}function xb(){_i&&(clearInterval(_i),_i=null,M.usage.debug("Usage polling stopped"))}let am=!1;D.subscribe(e=>{am&&!e&&xb(),am=e});const ka=m([]),yb=m(null),rm=m(!1),om=m(null),Xk=K(()=>{const e=new Map;for(const t of ka.value){const a=t.provider;e.has(a)||e.set(a,[]),e.get(a).push(t)}return e});async function cf(){rm.value=!0,om.value=null;try{const[e,t]=await Promise.all([N("models.list",{}),N("status",{}).catch(()=>null)]);ka.value=e.models??[],M.ui.debug("Loaded models:",ka.value.length);const a=t?.sessions?.defaults?.model;a&&(yb.value=a,M.ui.debug("Default model:",a))}catch(e){om.value=e instanceof Error?e.message:String(e),M.ui.error("Failed to load models:",e)}finally{rm.value=!1}}function Qk(e){return ka.value.find(t=>t.id===e)}function e4(e){const t=Qk(e);return t?t.name:e.replace(/^anthropic\//,"").replace(/^openai\//,"").replace(/^claude-/,"").replace(/^gpt-/,"")}const wb="cove:dismissed-update-version",Gc=m(null),kb=m(typeof localStorage<"u"?localStorage.getItem(wb):null);let sm=!1;function t4(){sm||(sm=!0,_l(e=>{if(e.event==="update.available"&&e.payload){const t=e.payload;Gc.value=t.updateAvailable}}))}function n4(){const e=Gc.value;return e?kb.value===e.latestVersion:!1}function lm(){const e=Gc.value;e&&(kb.value=e.latestVersion,localStorage.setItem(wb,e.latestVersion))}const Ci=m([]),lc=m("main"),a4=m("main"),Iu=m(!1),im=m(null),Ld=K(()=>Ci.value.map(e=>({value:e.id,label:`${e.identity?.emoji||"🤖"} ${e.identity?.name||e.name||e.id}`})));async function Sb(){if(Iu.value){M.gateway.debug("loadAgents: already loading, skipping");return}Iu.value=!0,im.value=null;try{M.gateway.debug("loadAgents: fetching from gateway");const e=await N("agents.list",{});if(e&&Array.isArray(e.agents))Ci.value=e.agents,lc.value=e.defaultId||"main",a4.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}),im.value=t,Ci.value.length===0&&(Ci.value=[{id:"main",identity:{name:"Main",emoji:"🤖"}}],lc.value="main")}finally{Iu.value=!1}}const r4=200,o4=480,Ga=288,uf=1024,s4=typeof window<"u"&&window.innerWidth<uf,Nt=m(!s4);function df(){window.innerWidth<uf&&(Nt.value=!1)}const Ti=m(S1()),Ru=m(!1);Se(()=>{_1(Ti.value)});const _b=m("/"),Lu=m(!1),Js=m(!1),l4=20,i4=100,cm=Ga*.3,c4=75,na=m(null),Pt=m(!1);function u4(){R(()=>{const e=()=>window.innerWidth<uf;let t=0,a=0,r=!1,o=!1;const s=u=>{if(!e())return;const d=u.touches[0];t=d.clientX,a=d.clientY;const h=d.clientX>=l4&&d.clientX<=i4;r=h,o=Nt.value,(h||o)&&(na.value=o?Ga:0)},i=u=>{if(!e()||!r&&!o)return;const d=u.touches[0],h=d.clientX-t;if(Math.abs(d.clientY-a)>c4&&!Pt.value){na.value=null,r=!1;return}if((Math.abs(h)>10||Pt.value)&&(Pt.value=!0,u.preventDefault()),!Pt.value)return;let p;o?p=Ga+h:p=h,p=Math.max(0,Math.min(Ga,p)),na.value=p},c=()=>{if(!Pt.value){na.value=null,r=!1,o=!1;return}const u=na.value??0;o?Nt.value=u>Ga-cm:Nt.value=u>cm,na.value=null,Pt.value=!1,r=!1,o=!1};return document.addEventListener("touchstart",s,{passive:!0}),document.addEventListener("touchmove",i,{passive:!1}),document.addEventListener("touchend",c,{passive:!0}),document.addEventListener("touchcancel",c,{passive:!0}),()=>{document.removeEventListener("touchstart",s),document.removeEventListener("touchmove",i),document.removeEventListener("touchend",c),document.removeEventListener("touchcancel",c)}},[])}function d4({direction:e,onResizeStart:t,onResize:a,onResizeEnd:r,class:o=""}){const s=F(0),i=F(!1),c=F({move:null,up:null});R(()=>()=>{c.current.move&&document.removeEventListener("mousemove",c.current.move),c.current.up&&document.removeEventListener("mouseup",c.current.up),i.current&&(document.body.style.cursor="",document.body.style.userSelect="")},[]);const u=Q(h=>{h.preventDefault(),i.current=!0,s.current=e==="horizontal"?h.clientX:h.clientY,t?.();const f=v=>{if(!i.current)return;const w=e==="horizontal"?v.clientX:v.clientY,C=w-s.current;s.current=w,a(C)},p=()=>{i.current=!1,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",p),c.current.move=null,c.current.up=null,document.body.style.cursor="",document.body.style.userSelect="",r?.()};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,a,t,r]),d=e==="horizontal";return n("div",{onMouseDown:u,class:`
12
+ `:"";if(t.toolCalls&&t.toolCalls.length>0){const o=t.toolCalls.map(s=>({...s,insertedAtContentLength:s.insertedAtContentLength!==void 0?a+r.length+s.insertedAtContentLength:void 0}));e.toolCalls=[...e.toolCalls??[],...o]}t.content&&(e.content=e.content?`${e.content}${r}${t.content}`:t.content),e.timestamp=Math.max(e.timestamp,t.timestamp),t.historyTruncated&&(e.historyTruncated=!0,!e.historyTruncationReason&&t.historyTruncationReason&&(e.historyTruncationReason=t.historyTruncationReason))}async function Wc(e,t=p2){const a=Tu.get(e);if(a)return M.chat.debug("History load already in progress for session, waiting:",e),a;const r=yk(e,t);Tu.set(e,r);try{await r}finally{Tu.delete(e)}}async function yk(e,t){wd.value=!0,Qi.value=null;try{const a=await N("chat.history",{sessionKey:e,limit:t}),r=vk(a.messages),o=[];for(let s=0;s<a.messages.length;s++){const i=a.messages[s];if(i.role==="toolResult")continue;const c=dk(i,`hist_${s}_${Date.now()}`);gk(c,r);const u=o[o.length-1];if(u&&bk(u,c)){xk(u,c);continue}o.push(c)}rk(o),Y2(e,o),a.thinkingLevel&&(X2.value=a.thinkingLevel)}catch(a){throw Qi.value=a instanceof Error?a.message:String(a),a}finally{wd.value=!1}}function wk(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 kk(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.runId=="string"&&typeof t.stream=="string"&&["lifecycle","assistant","tool","error","compaction","thinking"].includes(t.stream)&&typeof t.seq=="number"&&typeof t.ts=="number"}function mb(e,t,a){if(!e)return{content:t};if(t.startsWith(e))return{content:t};if(a!==void 0&&a>0&&a<=e.length){const o=e.slice(0,a),s=e.slice(a);if(t.startsWith(s))return{content:o+t,lastBlockStart:a};if(s.startsWith(t))return{content:e,lastBlockStart:a};if(t.length<s.length&&!s.includes(t)){const i=e.length+Yl.length;return{content:e+Yl+t,lastBlockStart:i}}return{content:o+t,lastBlockStart:a}}const r=e.length+Yl.length;return{content:e+Yl+t,lastBlockStart:r}}function Sk(e,t){const a=e.trim().replace(/\s+/g," ");return a.length<=t?a:a.slice(0,t).trim()+"…"}async function _k(e,t){if(!tb(e))return;const a=Sk(t,50);if(!a){M.chat.debug("autoRenameSession: empty message, skipping");return}try{M.chat.debug("autoRenameSession: renaming",{sessionKey:e,title:a}),await N("sessions.patch",{key:e,label:a}),Jh(e,{label:a}),M.chat.info("autoRenameSession: renamed session",{sessionKey:e,title:a})}catch(r){M.chat.error("autoRenameSession: failed",{sessionKey:e,error:r})}}const Ck=["/new","/reset"];function Tk(e){const t=e.trim().toLowerCase();return Ck.some(a=>t===a||t.startsWith(`${a} `))}let Ek=0;function Ak(e){if(!e||e.length===0)return;const t=[];for(const a of e)a.type==="image"&&t.push({url:a.content,alt:a.fileName});return t.length>0?t:void 0}function Mk(){return`cove_${Date.now()}_${++Ek}`}async function vb(e,t,a){const r=a?.messageId??Mk(),o=`user_${r}`,s=a?.messageId!=null,i={id:o,role:"user",content:t,images:Ak(a?.attachments),timestamp:Date.now(),isStreaming:!1,status:"sending",sessionKey:e};if(!D.value)return M.chat.info("Not connected, queuing message"),i.status="queued",Yp(i),r;if(cb.value&&!s)return M.chat.info("Currently streaming, queuing message"),i.status="queued",Yp(i),r;s?ub(o):nc(i),Io(r,e);try{M.chat.debug("Sending message to session:",e);const c=await N("chat.send",{sessionKey:e,message:t,thinking:a?.thinking,timeoutMs:a?.timeoutMs,idempotencyKey:r,attachments:a?.attachments});if(c.status==="error"){const u=c.summary??"Unknown error";throw kd(r,u),Jp(o,u),new Error(u)}if(ok(o),Tk(t)&&(M.chat.info("Reset command detected, clearing messages for session:",e),setTimeout(()=>{Bc(),Wc(e).catch(u=>{M.chat.warn("Failed to reload history after reset:",u)})},100)),!s&&tb(e)){const u=It.value.find(h=>h.key===e),d=l("common.newChat");u?.label===d&&_k(e,t).catch(h=>{M.chat.warn("Auto-rename failed:",h instanceof Error?h.message:String(h))})}return r}catch(c){const u=c instanceof Error?c.message:String(c);throw M.chat.error("chat.send failed:",c),kd(r,u),Jp(o,u),c}}async function tf(e){if(!e.sessionKey){M.chat.warn("Cannot resend message - missing sessionKey:",e.id);return}db(e.id),je.value.find(r=>r.id===e.id)?ub(e.id):nc({...e,status:"sending"});const a=e.id.replace(/^user_/,"");await vb(e.sessionKey,e.content,{messageId:a})}async function Cd(e){if(cb.value){M.chat.debug("Still streaming, not processing queue");return}const t=Rt.value.find(a=>a.sessionKey===e);if(!t){M.chat.debug("No queued messages for session");return}M.chat.info("Processing next queued message:",t.id);try{await tf(t)}catch(a){M.chat.error("Failed to send queued message:",a)}}async function Ik(e){let t=Rt.value.find(a=>a.id===e);if(t||(t=je.value.find(a=>a.id===e&&a.status==="failed")),!t){M.chat.warn("Cannot retry message - not found:",e);return}await tf(t)}async function Rk(){const e=[...Rt.value];if(e.length!==0){M.chat.info(`Processing ${e.length} queued messages`);for(const t of e)try{await tf(t)}catch(a){M.chat.error("Failed to send queued message:",a)}}}async function gb(e){await N("chat.abort",{sessionKey:e})}let ys=null,ws=null;const wa=new Set;function Lk(){return ys&&ws||(M.chat.info("Subscribing to chat events"),ys=bd("chat",e=>{if(!wk(e)){M.chat.warn("Invalid chat event payload:",e);return}Fk(e)}),ws=bd("agent",e=>{if(!kk(e)){M.chat.warn("Invalid agent event payload:",e);return}const t=e;t.stream==="tool"?Nk(t):t.stream==="lifecycle"?t.data?.phase==="start"?$k(t):(t.data?.phase==="end"||t.data?.phase==="error")&&Dk(t):t.stream==="compaction"?Pk(t):t.stream==="assistant"&&Ok(t)})),Td}function Td(){ys&&(ys(),ys=null),ws&&(ws(),ws=null),wa.clear()}function $k(e){const{runId:t,sessionKey:a}=e;if(!Cl(a)||wa.has(t))return;!de.value.get(t)&&a&&(M.chat.debug("Creating run on-the-fly for lifecycle start:",t,"session:",a),Io(t,a))}function Dk(e){const{runId:t,sessionKey:a}=e;if(!Cl(a))return;if(wa.has(t)){wa.delete(t),fa.value&&(M.chat.warn("Clearing stale isCompacting flag via lifecycle end for run:",t),Oc(()=>{fa.value=!1,Va.value=!0}));return}const r=de.value.get(t);if(r&&(r.status==="pending"||r.status==="streaming")){M.chat.debug("Completing run via lifecycle end:",t,"phase:",e.data?.phase);const o=!r.content;if(r.content){const s={id:`assistant_${t}`,role:"assistant",content:r.content,toolCalls:r.toolCalls?.length?r.toolCalls:void 0,timestamp:Date.now()};ac(t,s)}else ac(t);if(r.sessionKey&&(setTimeout(()=>Cd(r.sessionKey),100),o)){const s=r.sessionKey;setTimeout(()=>{Wc(s).catch(i=>{M.chat.warn("Failed to refresh history after heartbeat:",i)})},500)}}}function Pk(e){const t=e.data?.phase;if(M.chat.info("Compaction event:",t,"runId:",e.runId,"isCompacting:",fa.value),e.runId&&wa.add(e.runId),t==="start"){if(e.runId&&de.value.has(e.runId)){M.chat.debug("Removing ghost run created before compaction registration:",e.runId);const a=new Map(de.value);a.delete(e.runId),de.value=a}fa.value=!0}else if(t==="end"){const a=je.value.length,r=typeof e.data?.summary=="string"?e.data.summary:void 0;Oc(()=>{fa.value=!1,ec.value=r,Va.value=!0,tc.value=a}),M.chat.info("Compaction ended, divider at index:",a)}}function Ok(e){const{runId:t,sessionKey:a,data:r}=e,o=typeof r?.text=="string"?r.text:null;if(!o||wa.has(t)||!Cl(a))return;let s=de.value.get(t);if(!s&&a&&(M.chat.debug("Creating run for assistant stream:",t,"session:",a),Io(t,a),s=de.value.get(t)),!s)return;const{content:i,lastBlockStart:c}=mb(s.content,o,s.lastBlockStart);xs(t,i,s.toolCalls,c)}function Nk(e){const{runId:t,sessionKey:a,data:r}=e;if(!r||wa.has(t)||!Cl(a))return;M.chat.debug("Tool event received",{runId:t,phase:r.phase,toolCallId:r.toolCallId,toolName:r.name});let o=de.value.get(t);if(!o&&(M.chat.debug("Creating run on-the-fly for tool event:",t,"session:",a),Io(t,a??"unknown"),o=de.value.get(t),!o))return;const s=r.toolCallId??`tool_${Date.now()}`,i=r.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(d=>d.id)});const u=()=>{let d=c.findIndex(h=>h.id===s);return d<0?(M.chat.debug("Creating missing tool call:",s),c.push({id:s,name:i,args:r.args,status:"running",startedAt:Date.now(),insertedAtContentLength:o.content.length,contentSnapshotAtStart:o.content}),d=c.length-1):r.args&&!c[d].args&&(c[d]={...c[d],args:r.args}),d};switch(r.phase){case"start":{if(c.some(d=>d.id===s)){M.chat.debug("Tool start skipped - duplicate",{toolCallId:s});return}setTimeout(()=>{const d=de.value.get(t);if(!d){M.chat.warn("Tool start deferred - run no longer exists",{runId:t,toolCallId:s});return}const h=[...d.toolCalls];if(h.some(p=>p.id===s)){M.chat.debug("Tool start deferred skipped - duplicate",{toolCallId:s});return}const f={id:s,name:i,args:r.args,status:"running",startedAt:Date.now(),insertedAtContentLength:d.content.length,contentSnapshotAtStart:d.content};M.chat.debug("Tool start processed",{toolCallId:s,toolName:i,insertedAtContentLength:f.insertedAtContentLength,contentSnapshotLen:d.content.length}),h.push(f),xs(t,d.content,h)},0);break}case"update":{const d=u();c[d]={...c[d],result:_d(r.partialResult)},xs(t,o.content,c);break}case"result":{const d=u();c[d]={...c[d],result:_d(r.result),status:r.isError?"error":"complete",completedAt:Date.now()},xs(t,o.content,c);break}}}function Fk(e){const{runId:t,state:a,errorMessage:r}=e;if(wa.has(t)){M.chat.debug("Skipping chat event for compaction run:",t,a);return}switch(M.chat.debug("Chat event:",a,t,"session:",e.sessionKey),a){case"delta":zk(e);break;case"final":Uk(e);break;case"aborted":lk(t);break;case"error":kd(t,r??"Unknown error");break}}function zk(e){const{runId:t,sessionKey:a,message:r}=e;if(!r)return;const o=rc(r.content);let s=de.value.get(t);if(!s&&(M.chat.debug("Creating run on-the-fly for delta:",t,"session:",a),Io(t,a),s=de.value.get(t),!s)||o.toolCalls.length===0)return;M.chat.debug("Delta event - processing tool calls only",{runId:t,parsedToolCallsCount:o.toolCalls.length,existingToolCallsCount:s.toolCalls.length});const i=mk(s.toolCalls,o.toolCalls);xs(t,s.content,i,s.lastBlockStart)}function Uk(e){const{runId:t,sessionKey:a,message:r}=e;let o=de.value.get(t);if(M.chat.debug("Final event received",{runId:t,hasExistingRun:!!o,existingContentLen:o?.content?.length,existingToolCallsCount:o?.toolCalls?.length,hasMessage:!!r}),o||(M.chat.debug("Creating run on-the-fly for final:",t,"session:",a),Io(t,a),o=de.value.get(t)),!o){M.chat.warn("Final event with no run and couldn't create one:",t);return}if(r?.content){const d=rc(r.content);if(d.text&&Wh({role:"assistant",content:d.text})){M.chat.debug("Heartbeat detected, completing run without message:",t),ac(t),setTimeout(()=>Cd(a),100);return}}let s=o?.content??"",i=[];if(r?.content){const d=rc(r.content);M.chat.debug("Final message parsed",{runId:t,parsedTextLen:d.text.length,parsedToolCallsCount:d.toolCalls.length,existingContentLen:s.length,willUseFinaContent:d.text.length>=s.length}),d.text.length>=s.length?(s=d.text,i=d.toolCalls):d.text&&(M.chat.debug("Final merging partial text",{existingLen:s.length,parsedLen:d.text.length}),s=mb(s,d.text,o?.lastBlockStart).content)}M.chat.debug("Final content determined",{runId:t,finalContentLen:s.length,finalContentPreview:s.slice(-200)});const c=o?.toolCalls?.map(d=>{const h={...d};(h.status==="running"||h.status==="pending")&&(h.status="complete",h.completedAt=Date.now());const f=i.find(p=>p.id===d.id);return f?.insertedAtContentLength!==void 0&&(h.insertedAtContentLength=f.insertedAtContentLength),delete h.contentSnapshotAtStart,h}),u={id:`assistant_${t}`,role:"assistant",content:s,toolCalls:c?.length?c:void 0,timestamp:r?.timestamp??Date.now()};ac(t,u),setTimeout(()=>{Cd(a)},100)}async function nf(e){Lk(),await Wc(e)}function jk(){Td(),Bc()}function Hk(e){if(!e)return null;if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"))return e;if(e.startsWith("/")){const t=gt.value;if(t)return`${t.replace(/^ws/,"http")}${e}`}return e}const Bk="Assistant",Wk="🤖",Kk="You",Ed=m(Bk),Ad=m(Wk),qk=m(null),Vk=m(Kk),Gk=m(null),Xp=m(!1);async function af(e){Xp.value=!0;try{const a=await N("agent.identity.get",e?{sessionKey:e}:{});a&&(a.name&&(Ed.value=a.name),a.avatar&&(Ad.value=Hk(a.avatar)),a.agentId&&(qk.value=a.agentId),M.ui.info("Loaded assistant identity:",Ed.value,"avatar:",Ad.value))}catch(t){M.ui.error("Failed to load assistant identity:",t)}finally{Xp.value=!1}}const Jk=300*1e3,bb=m(Xk()),Qp=m(!1),em=m(null);let Si=null;const rf=K(()=>{const e=bb.value;return e?e.providers.find(t=>t.provider==="anthropic")??null:null}),Yk=K(()=>{const e=rf.value;return e!==null&&e.windows.length>0&&!e.error}),Zk=K(()=>{const e=rf.value;if(!e||e.windows.length===0)return null;const t=e.windows.find(a=>a.label==="Week");return t||e.windows[0]});function Xk(){const e=I1();return e?(M.usage.debug("Loaded cached usage"),e):null}async function tm(){if(!D.value){M.usage.debug("Skipping usage fetch - not connected");return}Qp.value=!0,em.value=null;try{const e=await rs.send("usage.status");bb.value=e,R1(e),M.usage.debug("Usage fetched:",e)}catch(e){const t=e instanceof Error?e.message:"Failed to fetch usage";em.value=t,M.usage.error("Usage fetch failed:",t)}finally{Qp.value=!1}}function of(){xb(),tm(),Si=setInterval(()=>{tm()},Jk),M.usage.debug("Usage polling started")}function xb(){Si&&(clearInterval(Si),Si=null,M.usage.debug("Usage polling stopped"))}let nm=!1;D.subscribe(e=>{nm&&!e&&xb(),nm=e});const ka=m([]),yb=m(null),am=m(!1),rm=m(null),Qk=K(()=>{const e=new Map;for(const t of ka.value){const a=t.provider;e.has(a)||e.set(a,[]),e.get(a).push(t)}return e});async function sf(){am.value=!0,rm.value=null;try{const[e,t]=await Promise.all([N("models.list",{}),N("status",{}).catch(()=>null)]);ka.value=e.models??[],M.ui.debug("Loaded models:",ka.value.length);const a=t?.sessions?.defaults?.model;a&&(yb.value=a,M.ui.debug("Default model:",a))}catch(e){rm.value=e instanceof Error?e.message:String(e),M.ui.error("Failed to load models:",e)}finally{am.value=!1}}function e4(e){return ka.value.find(t=>t.id===e)}function t4(e){const t=e4(e);return t?t.name:e.replace(/^anthropic\//,"").replace(/^openai\//,"").replace(/^claude-/,"").replace(/^gpt-/,"")}const wb="cove:dismissed-update-version",Kc=m(null),kb=m(typeof localStorage<"u"?localStorage.getItem(wb):null);let om=!1;function n4(){om||(om=!0,_l(e=>{if(e.event==="update.available"&&e.payload){const t=e.payload;Kc.value=t.updateAvailable}}))}function a4(){const e=Kc.value;return e?kb.value===e.latestVersion:!1}function sm(){const e=Kc.value;e&&(kb.value=e.latestVersion,localStorage.setItem(wb,e.latestVersion))}const _i=m([]),oc=m("main"),r4=m("main"),Eu=m(!1),lm=m(null),Md=K(()=>_i.value.map(e=>({value:e.id,label:`${e.identity?.emoji||"🤖"} ${e.identity?.name||e.name||e.id}`})));async function Sb(){if(Eu.value){M.gateway.debug("loadAgents: already loading, skipping");return}Eu.value=!0,lm.value=null;try{M.gateway.debug("loadAgents: fetching from gateway");const e=await N("agents.list",{});if(e&&Array.isArray(e.agents))_i.value=e.agents,oc.value=e.defaultId||"main",r4.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}),lm.value=t,_i.value.length===0&&(_i.value=[{id:"main",identity:{name:"Main",emoji:"🤖"}}],oc.value="main")}finally{Eu.value=!1}}const o4=200,s4=480,Ga=288,lf=1024,l4=typeof window<"u"&&window.innerWidth<lf,zt=m(!l4);function cf(){window.innerWidth<lf&&(zt.value=!1)}const Ci=m(_1()),Au=m(!1);_e(()=>{C1(Ci.value)});const _b=m("/"),Mu=m(!1),Ys=m(!1),i4=20,c4=100,im=Ga*.3,u4=75,aa=m(null),Nt=m(!1);function d4(){R(()=>{const e=()=>window.innerWidth<lf;let t=0,a=0,r=!1,o=!1;const s=u=>{if(!e())return;const d=u.touches[0];t=d.clientX,a=d.clientY;const h=d.clientX>=i4&&d.clientX<=c4;r=h,o=zt.value,(h||o)&&(aa.value=o?Ga:0)},i=u=>{if(!e()||!r&&!o)return;const d=u.touches[0],h=d.clientX-t;if(Math.abs(d.clientY-a)>u4&&!Nt.value){aa.value=null,r=!1;return}if((Math.abs(h)>10||Nt.value)&&(Nt.value=!0,u.preventDefault()),!Nt.value)return;let p;o?p=Ga+h:p=h,p=Math.max(0,Math.min(Ga,p)),aa.value=p},c=()=>{if(!Nt.value){aa.value=null,r=!1,o=!1;return}const u=aa.value??0;o?zt.value=u>Ga-im:zt.value=u>im,aa.value=null,Nt.value=!1,r=!1,o=!1};return document.addEventListener("touchstart",s,{passive:!0}),document.addEventListener("touchmove",i,{passive:!1}),document.addEventListener("touchend",c,{passive:!0}),document.addEventListener("touchcancel",c,{passive:!0}),()=>{document.removeEventListener("touchstart",s),document.removeEventListener("touchmove",i),document.removeEventListener("touchend",c),document.removeEventListener("touchcancel",c)}},[])}function h4({direction:e,onResizeStart:t,onResize:a,onResizeEnd:r,class:o=""}){const s=F(0),i=F(!1),c=F({move:null,up:null});R(()=>()=>{c.current.move&&document.removeEventListener("mousemove",c.current.move),c.current.up&&document.removeEventListener("mouseup",c.current.up),i.current&&(document.body.style.cursor="",document.body.style.userSelect="")},[]);const u=Q(h=>{h.preventDefault(),i.current=!0,s.current=e==="horizontal"?h.clientX:h.clientY,t?.();const f=v=>{if(!i.current)return;const w=e==="horizontal"?v.clientX:v.clientY,C=w-s.current;s.current=w,a(C)},p=()=>{i.current=!1,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",p),c.current.move=null,c.current.up=null,document.body.style.cursor="",document.body.style.userSelect="",r?.()};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,a,t,r]),d=e==="horizontal";return n("div",{onMouseDown:u,class:`
13
13
  ${d?"w-1 cursor-col-resize hover:w-1.5":"h-1 cursor-row-resize hover:h-1.5"}
14
14
  bg-transparent hover:bg-[var(--color-accent)]/30 active:bg-[var(--color-accent)]/50
15
15
  transition-all duration-150 ease-out
16
16
  flex-shrink-0
17
17
  ${o}
18
- `,role:"separator","aria-orientation":d?"horizontal":"vertical","aria-label":"Resize handle"})}const h4=(...e)=>e.filter((t,a,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===a).join(" ").trim();const um=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const f4=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,r)=>r?r.toUpperCase():a.toLowerCase());const dm=e=>{const t=f4(e);return t.charAt(0).toUpperCase()+t.slice(1)};var p4={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 m4=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const v4=({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:r,children:o,iconNode:s,class:i="",...c})=>nn("svg",{...p4,width:String(t),height:t,stroke:e,"stroke-width":r?Number(a)*24/Number(t):a,class:["lucide",i].join(" "),...!o&&!m4(c)&&{"aria-hidden":"true"},...c},[...s.map(([u,d])=>nn(u,d)),...ir(o)]);const L=(e,t)=>{const a=({class:r="",className:o="",children:s,...i})=>nn(v4,{...i,iconNode:t,class:h4(`lucide-${um(dm(e))}`,`lucide-${um(e)}`,r,o)},s);return a.displayName=dm(e),a};const pa=L("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 g4=L("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const Jc=L("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Yc=L("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const hf=L("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 b4=L("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 Cb=L("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 hm=L("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 x4=L("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]);const y4=L("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 Ro=L("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 w4=L("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 on=L("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Ne=L("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Tb=L("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const Ve=L("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const Tl=L("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Zc=L("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 k4=L("circle-arrow-up",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);const Lo=L("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 Er=L("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 S4=L("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const ve=L("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const _4=L("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);const El=L("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 ic=L("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 C4=L("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 Rt=L("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 Eb=L("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 $o=L("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 Ab=L("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 ff=L("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 an=L("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 T4=L("flame",[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]]);const E4=L("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 A4=L("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 cc=L("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 M4=L("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 I4=L("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 rn=L("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 Mb=L("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 fm=L("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 Ib=L("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 Rb=L("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 R4=L("image-off",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);const Yr=L("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 Al=L("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 Xc=L("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 $d=L("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 L4=L("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 $4=L("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 Lb=L("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 $b=L("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const pm=L("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 D4=L("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 Db=L("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);const P4=L("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);const Pb=L("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 $n=L("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 Ob=L("monitor-play",[["path",{d:"M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z",key:"vbtd3f"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);const Gt=L("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 mm=L("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 $u=L("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 Nb=L("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 O4=L("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 N4=L("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 fo=L("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 F4=L("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 pf=L("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 Sa=L("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const mf=L("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 uc=L("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 z4=L("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 Qe=L("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 Qc=L("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 vf=L("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 Dd=L("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);const ct=L("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const Fb=L("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 pr=L("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 gf=L("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 bf=L("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 U4=L("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 eu=L("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 j4=L("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 po=L("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const tu=L("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 H4=L("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const xf=L("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 vm=L("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 B4=L("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);const zb=L("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 bt=L("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 Pd=L("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);const Aa=L("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 Ub=L("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const ca=L("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 W4=L("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 K4=L("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 q4=L("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 jb=L("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 dc=L("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 Hb=L("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=L("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Pn=L("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 Bb(e,t){for(var a in t)e[a]=t[a];return e}function gm(e,t){for(var a in e)if(a!=="__source"&&!(a in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function bm(e,t){this.props=e,this.context=t}(bm.prototype=new At).isPureReactComponent=!0,bm.prototype.shouldComponentUpdate=function(e,t){return gm(this.props,e)||gm(this.state,t)};var xm=J.__b;J.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),xm&&xm(e)};var V4=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Ml(e){function t(a){var r=Bb({},a);return delete r.ref,e(r,a.ref||null)}return t.$$typeof=V4,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var G4=J.__e;J.__e=function(e,t,a,r){if(e.then){for(var o,s=t;s=s.__;)if((o=s.__c)&&o.__c)return t.__e==null&&(t.__e=a.__e,t.__k=a.__k),o.__c(e,t)}G4(e,t,a,r)};var ym=J.unmount;function Wb(e,t,a){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Bb({},e)).__c!=null&&(e.__c.__P===a&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Wb(r,t,a)})),e}function Kb(e,t,a){return e&&a&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Kb(r,t,a)}),e.__c&&e.__c.__P===t&&(e.__e&&a.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=a)),e}function Du(){this.__u=0,this.o=null,this.__b=null}function qb(e){if(!e.__)return null;var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Ql(){this.i=null,this.l=null}J.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),ym&&ym(e)},(Du.prototype=new At).__c=function(e,t){var a=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(a);var o=qb(r.__v),s=!1,i=function(){s||r.__z||(s=!0,a.__R=null,o?o(u):u())};a.__R=i;var c=a.__P;a.__P=null;var u=function(){if(!--r.__u){if(r.state.__a){var d=r.state.__a;r.__v.__k[0]=Kb(d,d.__c.__P,d.__c.__O)}var h;for(r.setState({__a:r.__b=null});h=r.o.pop();)h.__P=c,h.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(i,i)},Du.prototype.componentWillUnmount=function(){this.o=[]},Du.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var a=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Wb(this.__b,a,r.__O=r.__P)}this.__b=null}var o=t.__a&&nn(H,null,e.fallback);return o&&(o.__u&=-33),[nn(H,null,t.__a?null:e.children),o]};var wm=function(e,t,a){if(++a[1]===a[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(a=e.i;a;){for(;a.length>3;)a.pop()();if(a[1]<a[0])break;e.i=a=a[2]}};function J4(e){return this.getChildContext=function(){return e.context},e.children}function Y4(e){var t=this,a=e.h;if(t.componentWillUnmount=function(){fd(null,t.v),t.v=null,t.h=null},t.h&&t.h!==a&&t.componentWillUnmount(),!t.v){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.h=a,t.v={nodeType:1,parentNode:a,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:a.namespaceURI,insertBefore:function(o,s){this.childNodes.push(o),t.h.insertBefore(o,s)},removeChild:function(o){this.childNodes.splice(this.childNodes.indexOf(o)>>>1,1),t.h.removeChild(o)}}}fd(nn(J4,{context:t.context},e.__v),t.v)}function nu(e,t){var a=nn(Y4,{__v:e,h:t});return a.containerInfo=t,a}(Ql.prototype=new At).__a=function(e){var t=this,a=qb(t.__v),r=t.l.get(e);return r[0]++,function(o){var s=function(){t.props.revealOrder?(r.push(o),wm(t,e,r)):o()};a?a(s):s()}},Ql.prototype.render=function(e){this.i=null,this.l=new Map;var t=ir(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var a=t.length;a--;)this.l.set(t[a],this.i=[1,0,this.i]);return e.children},Ql.prototype.componentDidUpdate=Ql.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,a){wm(e,a,t)})};var Z4=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,X4=/^(?: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]/,Q4=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,eS=/[A-Z0-9]/g,tS=typeof document<"u",nS=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};At.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(At.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var km=J.event;function aS(){}function rS(){return this.cancelBubble}function oS(){return this.defaultPrevented}J.event=function(e){return km&&(e=km(e)),e.persist=aS,e.isPropagationStopped=rS,e.isDefaultPrevented=oS,e.nativeEvent=e};var sS={enumerable:!1,configurable:!0,get:function(){return this.class}},Sm=J.vnode;J.vnode=function(e){typeof e.type=="string"&&(function(t){var a=t.props,r=t.type,o={},s=r.indexOf("-")===-1;for(var i in a){var c=a[i];if(!(i==="value"&&"defaultValue"in a&&c==null||tS&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var u=i.toLowerCase();i==="defaultValue"&&"value"in a&&a.value==null?i="value":i==="download"&&c===!0?c="":u==="translate"&&c==="no"?c=!1:u[0]==="o"&&u[1]==="n"?u==="ondoubleclick"?i="ondblclick":u!=="onchange"||r!=="input"&&r!=="textarea"||nS(a.type)?u==="onfocus"?i="onfocusin":u==="onblur"?i="onfocusout":Q4.test(i)&&(i=u):u=i="oninput":s&&X4.test(i)?i=i.replace(eS,"-$&").toLowerCase():c===null&&(c=void 0),u==="oninput"&&o[i=u]&&(i="oninputCapture"),o[i]=c}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=ir(a.children).forEach(function(d){d.props.selected=o.value.indexOf(d.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=ir(a.children).forEach(function(d){d.props.selected=o.multiple?o.defaultValue.indexOf(d.props.value)!=-1:o.defaultValue==d.props.value})),a.class&&!a.className?(o.class=a.class,Object.defineProperty(o,"className",sS)):(a.className&&!a.class||a.class&&a.className)&&(o.class=o.className=a.className),t.props=o})(e),e.$$typeof=Z4,Sm&&Sm(e)};var _m=J.__r;J.__r=function(e){_m&&_m(e),e.__c};var Cm=J.diffed;J.diffed=function(e){Cm&&Cm(e);var t=e.props,a=e.__e;a!=null&&e.type==="textarea"&&"value"in t&&t.value!==a.value&&(a.value=t.value==null?"":t.value)};const lS={xs:{container:"w-3 h-3",thickness:"2px"},sm:{container:"w-4 h-4",thickness:"2px"},md:{container:"w-6 h-6",thickness:"3px"},lg:{container:"w-8 h-8",thickness:"3px"}};function te({size:e="md",label:t,class:a}){const r=lS[e];return n("span",{class:`cove-spinner ${r.container} ${a||""}`,style:{"--spinner-thickness":r.thickness},role:"status","aria-label":t||l("accessibility.loading"),children:n("span",{class:"sr-only",children:t||l("accessibility.loading")})})}const Vb=xg(null);function Tm({children:e}){const[t,a]=U(null),[r,o]=U(!1),s=F(null),i=F(null),c=F(null);R(()=>()=>{i.current&&cancelAnimationFrame(i.current),c.current&&clearTimeout(c.current)},[]);const u=Q(f=>{c.current&&(clearTimeout(c.current),c.current=null),s.current=f.ownerId,o(!0),i.current=requestAnimationFrame(()=>{a({...f,isVisible:!0}),i.current=null})},[]),d=Q(f=>{if(f&&s.current&&f!==s.current)return;i.current&&(cancelAnimationFrame(i.current),i.current=null);const p=s.current;a(v=>v?{...v,isVisible:!1}:null),c.current=window.setTimeout(()=>{if(p!==s.current){c.current=null;return}o(!1),a(null),s.current=null,c.current=null},150)},[]),h=Q((f,p)=>{a(v=>!v||v.ownerId!==p?v:{...v,triggerRect:f})},[]);return R(()=>{if(!r)return;const f=p=>{p.key==="Escape"&&d()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r,d]),n(Vb.Provider,{value:{show:u,hide:d,update:h},children:[e,r&&nu(n(iS,{state:t}),document.body)]})}function iS({state:e}){const t=F(null),[a,r]=U("top"),[o,s]=U(null);if(Rh(()=>{if(!e?.triggerRect||!t.current){s(null);return}const h=t.current.getBoundingClientRect(),{adjustedPlacement:f,pos:p}=cS(e.triggerRect,h,e.placement);r(f),s(p)},[e?.triggerRect,e?.placement,e?.content]),!e?.triggerRect)return null;const{content:i,isVisible:c}=e,u=o!==null;return n("div",{ref:t,role:"tooltip",class:`
18
+ `,role:"separator","aria-orientation":d?"horizontal":"vertical","aria-label":"Resize handle"})}const f4=(...e)=>e.filter((t,a,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===a).join(" ").trim();const cm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const p4=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,r)=>r?r.toUpperCase():a.toLowerCase());const um=e=>{const t=p4(e);return t.charAt(0).toUpperCase()+t.slice(1)};var m4={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 v4=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const g4=({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:r,children:o,iconNode:s,class:i="",...c})=>an("svg",{...m4,width:String(t),height:t,stroke:e,"stroke-width":r?Number(a)*24/Number(t):a,class:["lucide",i].join(" "),...!o&&!v4(c)&&{"aria-hidden":"true"},...c},[...s.map(([u,d])=>an(u,d)),...ir(o)]);const L=(e,t)=>{const a=({class:r="",className:o="",children:s,...i})=>an(g4,{...i,iconNode:t,class:f4(`lucide-${cm(um(e))}`,`lucide-${cm(e)}`,r,o)},s);return a.displayName=um(e),a};const pa=L("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 b4=L("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const qc=L("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const Vc=L("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const uf=L("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 x4=L("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 Cb=L("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 dm=L("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 y4=L("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]);const w4=L("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 Ro=L("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 k4=L("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 on=L("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Ne=L("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Tb=L("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const Ve=L("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const Tl=L("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Gc=L("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 S4=L("circle-arrow-up",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);const Lo=L("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 Er=L("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 _4=L("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const ge=L("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const C4=L("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);const El=L("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 sc=L("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 T4=L("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 Lt=L("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 Eb=L("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 $o=L("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 Ab=L("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 df=L("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 Dn=L("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 E4=L("flame",[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]]);const A4=L("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 M4=L("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 lc=L("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 I4=L("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 R4=L("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 rn=L("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 Mb=L("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 hm=L("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 Ib=L("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 Rb=L("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 L4=L("image-off",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);const Yr=L("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 Al=L("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const Jc=L("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 Id=L("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 $4=L("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 D4=L("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 Lb=L("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 $b=L("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const fm=L("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 P4=L("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 Db=L("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);const O4=L("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);const Pb=L("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 Pn=L("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 Ob=L("monitor-play",[["path",{d:"M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z",key:"vbtd3f"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);const En=L("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 pm=L("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 Iu=L("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 Nb=L("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 N4=L("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 F4=L("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 po=L("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 z4=L("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 hf=L("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 Sa=L("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const ff=L("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 ic=L("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 U4=L("rectangle-ellipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);const Xe=L("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const Yc=L("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 pf=L("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 Rd=L("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);const it=L("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const Fb=L("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 pr=L("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 mf=L("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 vf=L("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 j4=L("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 Zc=L("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 H4=L("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 mo=L("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const Xc=L("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 B4=L("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const gf=L("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 mm=L("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 W4=L("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);const zb=L("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 bt=L("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 Ld=L("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);const Aa=L("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 Ub=L("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const ca=L("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 K4=L("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 q4=L("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 V4=L("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 jb=L("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 cc=L("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 Hb=L("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=L("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const Nn=L("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 Bb(e,t){for(var a in t)e[a]=t[a];return e}function vm(e,t){for(var a in e)if(a!=="__source"&&!(a in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function gm(e,t){this.props=e,this.context=t}(gm.prototype=new Mt).isPureReactComponent=!0,gm.prototype.shouldComponentUpdate=function(e,t){return vm(this.props,e)||vm(this.state,t)};var bm=J.__b;J.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),bm&&bm(e)};var G4=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Ml(e){function t(a){var r=Bb({},a);return delete r.ref,e(r,a.ref||null)}return t.$$typeof=G4,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var J4=J.__e;J.__e=function(e,t,a,r){if(e.then){for(var o,s=t;s=s.__;)if((o=s.__c)&&o.__c)return t.__e==null&&(t.__e=a.__e,t.__k=a.__k),o.__c(e,t)}J4(e,t,a,r)};var xm=J.unmount;function Wb(e,t,a){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Bb({},e)).__c!=null&&(e.__c.__P===a&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Wb(r,t,a)})),e}function Kb(e,t,a){return e&&a&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Kb(r,t,a)}),e.__c&&e.__c.__P===t&&(e.__e&&a.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=a)),e}function Ru(){this.__u=0,this.o=null,this.__b=null}function qb(e){if(!e.__)return null;var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Ql(){this.i=null,this.l=null}J.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),xm&&xm(e)},(Ru.prototype=new Mt).__c=function(e,t){var a=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(a);var o=qb(r.__v),s=!1,i=function(){s||r.__z||(s=!0,a.__R=null,o?o(u):u())};a.__R=i;var c=a.__P;a.__P=null;var u=function(){if(!--r.__u){if(r.state.__a){var d=r.state.__a;r.__v.__k[0]=Kb(d,d.__c.__P,d.__c.__O)}var h;for(r.setState({__a:r.__b=null});h=r.o.pop();)h.__P=c,h.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(i,i)},Ru.prototype.componentWillUnmount=function(){this.o=[]},Ru.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var a=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Wb(this.__b,a,r.__O=r.__P)}this.__b=null}var o=t.__a&&an(H,null,e.fallback);return o&&(o.__u&=-33),[an(H,null,t.__a?null:e.children),o]};var ym=function(e,t,a){if(++a[1]===a[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(a=e.i;a;){for(;a.length>3;)a.pop()();if(a[1]<a[0])break;e.i=a=a[2]}};function Y4(e){return this.getChildContext=function(){return e.context},e.children}function Z4(e){var t=this,a=e.h;if(t.componentWillUnmount=function(){ud(null,t.v),t.v=null,t.h=null},t.h&&t.h!==a&&t.componentWillUnmount(),!t.v){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.h=a,t.v={nodeType:1,parentNode:a,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:a.namespaceURI,insertBefore:function(o,s){this.childNodes.push(o),t.h.insertBefore(o,s)},removeChild:function(o){this.childNodes.splice(this.childNodes.indexOf(o)>>>1,1),t.h.removeChild(o)}}}ud(an(Y4,{context:t.context},e.__v),t.v)}function Qc(e,t){var a=an(Z4,{__v:e,h:t});return a.containerInfo=t,a}(Ql.prototype=new Mt).__a=function(e){var t=this,a=qb(t.__v),r=t.l.get(e);return r[0]++,function(o){var s=function(){t.props.revealOrder?(r.push(o),ym(t,e,r)):o()};a?a(s):s()}},Ql.prototype.render=function(e){this.i=null,this.l=new Map;var t=ir(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var a=t.length;a--;)this.l.set(t[a],this.i=[1,0,this.i]);return e.children},Ql.prototype.componentDidUpdate=Ql.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,a){ym(e,a,t)})};var X4=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Q4=/^(?: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]/,eS=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,tS=/[A-Z0-9]/g,nS=typeof document<"u",aS=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};Mt.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Mt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var wm=J.event;function rS(){}function oS(){return this.cancelBubble}function sS(){return this.defaultPrevented}J.event=function(e){return wm&&(e=wm(e)),e.persist=rS,e.isPropagationStopped=oS,e.isDefaultPrevented=sS,e.nativeEvent=e};var lS={enumerable:!1,configurable:!0,get:function(){return this.class}},km=J.vnode;J.vnode=function(e){typeof e.type=="string"&&(function(t){var a=t.props,r=t.type,o={},s=r.indexOf("-")===-1;for(var i in a){var c=a[i];if(!(i==="value"&&"defaultValue"in a&&c==null||nS&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var u=i.toLowerCase();i==="defaultValue"&&"value"in a&&a.value==null?i="value":i==="download"&&c===!0?c="":u==="translate"&&c==="no"?c=!1:u[0]==="o"&&u[1]==="n"?u==="ondoubleclick"?i="ondblclick":u!=="onchange"||r!=="input"&&r!=="textarea"||aS(a.type)?u==="onfocus"?i="onfocusin":u==="onblur"?i="onfocusout":eS.test(i)&&(i=u):u=i="oninput":s&&Q4.test(i)?i=i.replace(tS,"-$&").toLowerCase():c===null&&(c=void 0),u==="oninput"&&o[i=u]&&(i="oninputCapture"),o[i]=c}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=ir(a.children).forEach(function(d){d.props.selected=o.value.indexOf(d.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=ir(a.children).forEach(function(d){d.props.selected=o.multiple?o.defaultValue.indexOf(d.props.value)!=-1:o.defaultValue==d.props.value})),a.class&&!a.className?(o.class=a.class,Object.defineProperty(o,"className",lS)):(a.className&&!a.class||a.class&&a.className)&&(o.class=o.className=a.className),t.props=o})(e),e.$$typeof=X4,km&&km(e)};var Sm=J.__r;J.__r=function(e){Sm&&Sm(e),e.__c};var _m=J.diffed;J.diffed=function(e){_m&&_m(e);var t=e.props,a=e.__e;a!=null&&e.type==="textarea"&&"value"in t&&t.value!==a.value&&(a.value=t.value==null?"":t.value)};const iS={xs:{container:"w-3 h-3",thickness:"2px"},sm:{container:"w-4 h-4",thickness:"2px"},md:{container:"w-6 h-6",thickness:"3px"},lg:{container:"w-8 h-8",thickness:"3px"}};function te({size:e="md",label:t,class:a}){const r=iS[e];return n("span",{class:`cove-spinner ${r.container} ${a||""}`,style:{"--spinner-thickness":r.thickness},role:"status","aria-label":t||l("accessibility.loading"),children:n("span",{class:"sr-only",children:t||l("accessibility.loading")})})}const Vb=xg(null);function Cm({children:e}){const[t,a]=U(null),[r,o]=U(!1),s=F(null),i=F(null),c=F(null);R(()=>()=>{i.current&&cancelAnimationFrame(i.current),c.current&&clearTimeout(c.current)},[]);const u=Q(f=>{c.current&&(clearTimeout(c.current),c.current=null),s.current=f.ownerId,o(!0),i.current=requestAnimationFrame(()=>{a({...f,isVisible:!0}),i.current=null})},[]),d=Q(f=>{if(f&&s.current&&f!==s.current)return;i.current&&(cancelAnimationFrame(i.current),i.current=null);const p=s.current;a(v=>v?{...v,isVisible:!1}:null),c.current=window.setTimeout(()=>{if(p!==s.current){c.current=null;return}o(!1),a(null),s.current=null,c.current=null},150)},[]),h=Q((f,p)=>{a(v=>!v||v.ownerId!==p?v:{...v,triggerRect:f})},[]);return R(()=>{if(!r)return;const f=p=>{p.key==="Escape"&&d()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r,d]),n(Vb.Provider,{value:{show:u,hide:d,update:h},children:[e,r&&Qc(n(cS,{state:t}),document.body)]})}function cS({state:e}){const t=F(null),[a,r]=U("top"),[o,s]=U(null);if(Mh(()=>{if(!e?.triggerRect||!t.current){s(null);return}const h=t.current.getBoundingClientRect(),{adjustedPlacement:f,pos:p}=uS(e.triggerRect,h,e.placement);r(f),s(p)},[e?.triggerRect,e?.placement,e?.content]),!e?.triggerRect)return null;const{content:i,isVisible:c}=e,u=o!==null;return n("div",{ref:t,role:"tooltip",class:`
19
19
  fixed z-[9999] pointer-events-none
20
20
  transition-opacity duration-150
21
21
  ${c&&u?"opacity-100":"opacity-0"}
@@ -27,8 +27,8 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/400-lAWKXRoJ.cs
27
27
  whitespace-nowrap
28
28
  `,children:i}),n("div",{class:`
29
29
  absolute w-0 h-0 border-[6px]
30
- ${uS(a)}
31
- `})]})}function cS(e,t,a){const s={width:window.innerWidth,height:window.innerHeight},i={top:e.top,bottom:s.height-e.bottom,left:e.left,right:s.width-e.right},c={top:i.top>=t.height+8+8,bottom:i.bottom>=t.height+8+8,left:i.left>=t.width+8+8,right:i.right>=t.width+8+8};let u=a;a==="top"&&!c.top?u=c.bottom?"bottom":c.left?"left":c.right?"right":"bottom":a==="bottom"&&!c.bottom?u=c.top?"top":c.left?"left":c.right?"right":"top":a==="left"&&!c.left?u=c.right?"right":c.top?"top":c.bottom?"bottom":"right":a==="right"&&!c.right&&(u=c.left?"left":c.top?"top":c.bottom?"bottom":"left");let d,h;switch(u){case"top":d=e.top-t.height-8,h=e.left+e.width/2-t.width/2;break;case"bottom":d=e.bottom+8,h=e.left+e.width/2-t.width/2;break;case"left":d=e.top+e.height/2-t.height/2,h=e.left-t.width-8;break;case"right":d=e.top+e.height/2-t.height/2,h=e.right+8;break}return h=Math.max(8,Math.min(h,s.width-t.width-8)),d=Math.max(8,Math.min(d,s.height-t.height-8)),{adjustedPlacement:u,pos:{top:d,left:h}}}function uS(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 dS=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0;function Do({content:e,placement:t="top",delay:a=300,children:r,class:o,disabled:s=!1}){const i=wg(Vb),c=F(null),u=F(null),d=F(Symbol("tooltip-owner")),h=s||dS(),f=Q(()=>{h||!i||(c.current=window.setTimeout(()=>{if(u.current){const v=u.current.getBoundingClientRect();i.show({ownerId:d.current,content:e,placement:t,triggerRect:v})}},a))},[i,e,t,a,h]),p=Q(()=>{c.current&&(clearTimeout(c.current),c.current=null),i?.hide(d.current)},[i]);return R(()=>()=>{c.current&&clearTimeout(c.current)},[]),i?n("div",{ref:u,class:`inline-flex ${o||""}`,onMouseEnter:f,onMouseLeave:p,onFocus:f,onBlur:p,children:r}):n("div",{class:`inline-flex ${o||""}`,children:r})}const hS={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"}},fS={default:`
30
+ ${dS(a)}
31
+ `})]})}function uS(e,t,a){const s={width:window.innerWidth,height:window.innerHeight},i={top:e.top,bottom:s.height-e.bottom,left:e.left,right:s.width-e.right},c={top:i.top>=t.height+8+8,bottom:i.bottom>=t.height+8+8,left:i.left>=t.width+8+8,right:i.right>=t.width+8+8};let u=a;a==="top"&&!c.top?u=c.bottom?"bottom":c.left?"left":c.right?"right":"bottom":a==="bottom"&&!c.bottom?u=c.top?"top":c.left?"left":c.right?"right":"top":a==="left"&&!c.left?u=c.right?"right":c.top?"top":c.bottom?"bottom":"right":a==="right"&&!c.right&&(u=c.left?"left":c.top?"top":c.bottom?"bottom":"left");let d,h;switch(u){case"top":d=e.top-t.height-8,h=e.left+e.width/2-t.width/2;break;case"bottom":d=e.bottom+8,h=e.left+e.width/2-t.width/2;break;case"left":d=e.top+e.height/2-t.height/2,h=e.left-t.width-8;break;case"right":d=e.top+e.height/2-t.height/2,h=e.right+8;break}return h=Math.max(8,Math.min(h,s.width-t.width-8)),d=Math.max(8,Math.min(d,s.height-t.height-8)),{adjustedPlacement:u,pos:{top:d,left:h}}}function dS(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 hS=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0;function Do({content:e,placement:t="top",delay:a=300,children:r,class:o,disabled:s=!1}){const i=wg(Vb),c=F(null),u=F(null),d=F(Symbol("tooltip-owner")),h=s||hS(),f=Q(()=>{h||!i||(c.current=window.setTimeout(()=>{if(u.current){const v=u.current.getBoundingClientRect();i.show({ownerId:d.current,content:e,placement:t,triggerRect:v})}},a))},[i,e,t,a,h]),p=Q(()=>{c.current&&(clearTimeout(c.current),c.current=null),i?.hide(d.current)},[i]);return R(()=>()=>{c.current&&clearTimeout(c.current)},[]),i?n("div",{ref:u,class:`inline-flex ${o||""}`,onMouseEnter:f,onMouseLeave:p,onFocus:f,onBlur:p,children:r}):n("div",{class:`inline-flex ${o||""}`,children:r})}const fS={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"}},pS={default:`
32
32
  text-[var(--color-text-secondary)]
33
33
  hover:bg-[var(--color-bg-secondary)] hover:text-[var(--color-text-primary)]
34
34
  focus-visible:ring-[var(--color-accent)]
@@ -40,27 +40,27 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/400-lAWKXRoJ.cs
40
40
  text-[var(--color-text-secondary)]
41
41
  hover:bg-[var(--color-error)]/10 hover:text-[var(--color-error)]
42
42
  focus-visible:ring-[var(--color-error)]
43
- `},q=Ml(({icon:e,label:t,size:a="md",variant:r="default",loading:o=!1,disabled:s,showTooltip:i=!0,tooltipPlacement:c="top",class:u,...d},h)=>{const f=s||o,p=hS[a],v=n("button",{ref:h,type:"button",disabled:f,"aria-label":t,class:`
43
+ `},q=Ml(({icon:e,label:t,size:a="md",variant:r="default",loading:o=!1,disabled:s,showTooltip:i=!0,tooltipPlacement:c="top",class:u,...d},h)=>{const f=s||o,p=fS[a],v=n("button",{ref:h,type:"button",disabled:f,"aria-label":t,class:`
44
44
  inline-flex items-center justify-center cursor-pointer
45
45
  rounded-md transition-all duration-200 ease-out
46
46
  hover:scale-105 active:scale-95
47
47
  focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2
48
48
  disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100 disabled:active:scale-100
49
49
  ${p.button}
50
- ${fS[r]}
50
+ ${pS[r]}
51
51
  ${u||""}
52
- `,...d,children:o?n(te,{size:"sm"}):n("span",{class:`${p.icon} flex items-center justify-center [&>svg]:w-full [&>svg]:h-full`,"aria-hidden":"true",children:e})});return i&&t?n(Do,{content:t,placement:c,delay:400,children:v}):v});q.displayName="IconButton";const pS={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)]"},mS={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)]"},vS={sm:"px-1.5 py-0.5 text-xs",md:"px-2 py-1 text-xs"};function Z({variant:e="default",size:t="md",dot:a=!1,children:r,class:o}){return n("span",{class:`
52
+ `,...d,children:o?n(te,{size:"sm"}):n("span",{class:`${p.icon} flex items-center justify-center [&>svg]:w-full [&>svg]:h-full`,"aria-hidden":"true",children:e})});return i&&t?n(Do,{content:t,placement:c,delay:400,children:v}):v});q.displayName="IconButton";const mS={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)]"},vS={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)]"},gS={sm:"px-1.5 py-0.5 text-xs",md:"px-2 py-1 text-xs"};function Z({variant:e="default",size:t="md",dot:a=!1,children:r,class:o}){return n("span",{class:`
53
53
  inline-flex items-center gap-1.5
54
54
  font-medium rounded-full
55
- ${pS[e]}
56
- ${vS[t]}
55
+ ${mS[e]}
56
+ ${gS[t]}
57
57
  ${o||""}
58
- `,children:[a&&n("span",{class:`w-1.5 h-1.5 rounded-full ${mS[e]}`,"aria-hidden":"true"}),r]})}function Ia(e,t,a=!0){R(()=>{if(!a)return;const r=o=>{const s=Array.isArray(e)?e:[e],i=o.target;s.some(u=>u.current?.contains(i))||t()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[e,t,a])}function Gb(){const e=X2.value,[t,a]=U(!1),[r,o]=U(W1),s=F(null),i=F(null),c=Math.floor(e/2),u=Math.max(0,c-r),d=Q(()=>{o(c),K1(c),a(!1)},[c]);Ia([i,s],d,t);const f=ob.value.filter(qh).slice(-10).reverse();return n("div",{class:"relative inline-block",ref:i,children:[n(q,{icon:n(Rb,{class:"w-4 h-4"}),label:l("chat.heartbeats",{count:e}),onClick:()=>t?d():a(!0),variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"}),u>0&&n(Z,{variant:"default",class:"absolute -top-1.5 -right-1.5 min-w-[1.25rem] h-5 text-xs px-1 pointer-events-none",children:u}),t&&n("div",{ref:s,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:l("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:l("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:ne(p.timestamp)})]},p.id))})]})]})}const gS={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 au({size:e="md",class:t="",animated:a=!1}){const r=gS[e];return n("img",{src:"/cove-icon.png",alt:"Cove",class:`${r} ${a?"group-hover:scale-110 transition-transform":""} ${t}`.trim()})}function Ar({class:e}){return n(Ma,{class:e||"w-5 h-5","aria-hidden":"true"})}function Jb({class:e}){return n(Sa,{class:e||"w-4 h-4","aria-hidden":"true"})}function bS({class:e}){return n(P4,{class:e||"w-5 h-5","aria-hidden":"true"})}function xS({class:e}){return n(bf,{class:e||"w-5 h-5","aria-hidden":"true"})}function Yb({class:e}){return n(Ob,{class:e||"w-5 h-5","aria-hidden":"true"})}function yS({class:e}){return n(Db,{class:e||"w-5 h-5","aria-hidden":"true"})}function Po({class:e,open:t}){return n(Ne,{class:`${e||"w-4 h-4"} transition-transform ${t?"rotate-180":""}`,"aria-hidden":"true"})}function wS({class:e}){return n(g4,{class:e||"w-5 h-5","aria-hidden":"true"})}function kS({class:e}){return n($o,{class:e||"w-3 h-3","aria-hidden":"true"})}function SS({class:e}){return n(Fb,{class:e||"w-5 h-5","aria-hidden":"true"})}function _S({class:e}){return n(H4,{class:e||"w-5 h-5",fill:"currentColor","aria-hidden":"true"})}function CS({class:e}){return n(Eb,{class:e||"w-5 h-5","aria-hidden":"true"})}function Zb({class:e}){return n(fo,{class:e||"w-5 h-5","aria-hidden":"true"})}function Xb({class:e}){return n(bt,{class:e||"w-5 h-5","aria-hidden":"true"})}function TS({class:e}){return n(M4,{class:e||"w-5 h-5","aria-hidden":"true"})}function ES({class:e}){return n(F4,{class:e||"w-5 h-5","aria-hidden":"true"})}function yf({class:e}){return n(ct,{class:e||"w-5 h-5","aria-hidden":"true"})}function AS({class:e}){return n(on,{class:e||"w-5 h-5","aria-hidden":"true"})}function MS({class:e}){return n(Yr,{class:e||"w-5 h-5","aria-hidden":"true"})}function Qb(e){return e>=90?"critical":e>=80?"high":e>=50?"medium":"low"}function IS(){const[e,t]=U(!1),a=F(null);if(!Jk.value)return null;Ia(a,()=>t(!1),e);const r=sf.value,o=Yk.value;if(!r||!o)return null;const s=Qb(o.usedPercent),i=`${r.displayName} Usage`;return n("div",{ref:a,class:"relative",children:[n(Do,{content:i,placement:"bottom",disabled:e,children:n("button",{type:"button",onClick:()=>t(!e),class:"flex items-center gap-2 px-2 py-1 rounded-md cursor-pointer hover:bg-[var(--color-bg-surface)] transition-colors","aria-expanded":e,"aria-label":`Anthropic usage: ${Math.round(o.usedPercent)}% ${o.label}`,children:[n("div",{class:"w-16 h-1.5 bg-[var(--color-border)] rounded-full overflow-hidden",children:n("div",{class:`h-full rounded-full transition-all ${ex(s)}`,style:{width:`${Math.min(100,o.usedPercent)}%`}})}),n("span",{class:`text-xs font-medium ${tx(s)}`,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:r.displayName}),r.plan&&n("span",{class:"text-xs text-[var(--color-text-muted)] bg-[var(--color-bg-secondary)] px-2 py-0.5 rounded",children:r.plan})]}),n("div",{class:"space-y-3",children:r.windows.map(c=>n(RS,{window:c},c.label))})]})]})}function RS({window:e}){const t=Qb(e.usedPercent),a=e.resetAt?LS(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 ${tx(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 ${ex(t)}`,style:{width:`${Math.min(100,e.usedPercent)}%`}})}),a&&n("div",{class:"text-[10px] text-[var(--color-text-muted)] mt-1",children:["Resets ",a]})]})}function ex(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 tx(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 LS(e){const t=Date.now(),a=e-t;if(a<0)return"soon";const r=Math.floor(a/(1e3*60*60)),o=Math.floor(a%(1e3*60*60)/(1e3*60));return r>24?`in ${Math.floor(r/24)}d`:r>0?`in ${r}h ${o}m`:`in ${o}m`}function $S(){return n("header",{class:"h-[var(--topbar-height)] 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(q,{icon:Nt.value?n(Ar,{}):n(bS,{}),label:l("accessibility.sidebarToggle"),onClick:()=>Nt.value=!Nt.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(au,{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:l("common.cove")})]})]}),n("div",{class:"flex items-center gap-4",children:[(()=>{const e=DS(Ue.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:[l(e.label),D.value&&zt.value&&zt.value!=="dev"&&n("span",{class:"text-[var(--color-text-muted)]",children:[" v",zt.value]})]})]})})(),n("div",{class:"sm:hidden flex items-center gap-1",children:[n(Gb,{}),Xe.value&&n("div",{"data-tour":"canvas",children:n(q,{icon:n(Yb,{}),label:l("common.canvas"),onClick:()=>Js.value=!Js.value,variant:"ghost",size:"md"})}),n(q,{icon:n(yf,{}),label:l("chat.search"),onClick:()=>mt.value=!0,variant:"ghost",size:"md"})]}),n(IS,{}),n("div",{"data-tour":"settings",children:n(q,{icon:n(xS,{}),label:l("nav.settings"),onClick:()=>{const e=Hc()==="/settings";Oe(e?_b.value:"/settings")},variant:"ghost",size:"md"})})]})]})})}const Em={connected:{dot:"bg-[var(--color-success)]",text:"text-[var(--color-success)]",label:"common.healthy"},connecting:{dot:"bg-[var(--color-warning)]",text:"text-[var(--color-warning)]",label:"status.connecting"},authenticating:{dot:"bg-[var(--color-warning)]",text:"text-[var(--color-warning)]",label:"status.connecting"},reconnecting:{dot:"bg-[var(--color-warning)]",text:"text-[var(--color-warning)]",label:"status.reconnecting"},error:{dot:"bg-[var(--color-error)]",text:"text-[var(--color-error)]",label:"common.error"},disconnected:{dot:"bg-[var(--color-text-muted)]",text:"text-[var(--color-text-muted)]",label:"status.disconnected"}};function DS(e){return Em[e]??Em.disconnected}function PS(e){return`https://github.com/openclaw/openclaw/releases/tag/${e.startsWith("v")?e:`v${e}`}`}function OS(){const e=Gc.value,t=F(0),a=F(!1),r=X(0),o=X(!1);if(!e||n4())return null;const s=d=>{t.current=d.touches[0].clientY,a.current=!0},i=d=>{if(!a.current)return;const h=t.current-d.touches[0].clientY;r.value=Math.max(0,h)},c=()=>{a.current=!1,r.value>50?(o.value=!0,setTimeout(()=>{lm(),o.value=!1,r.value=0},150)):r.value=0},u=o.value?-100:-r.value;return n("div",{class:"fixed top-2 left-2 right-2 sm:left-1/2 sm:-translate-x-1/2 sm:right-auto sm:w-auto z-50 pointer-events-none",style:{paddingTop:"env(safe-area-inset-top)"},children:n("div",{class:`
58
+ `,children:[a&&n("span",{class:`w-1.5 h-1.5 rounded-full ${vS[e]}`,"aria-hidden":"true"}),r]})}function Ia(e,t,a=!0){R(()=>{if(!a)return;const r=o=>{const s=Array.isArray(e)?e:[e],i=o.target;s.some(u=>u.current?.contains(i))||t()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[e,t,a])}function Gb(){const e=Q2.value,[t,a]=U(!1),[r,o]=U(K1),s=F(null),i=F(null),c=Math.floor(e/2),u=Math.max(0,c-r),d=Q(()=>{o(c),q1(c),a(!1)},[c]);Ia([i,s],d,t);const f=ob.value.filter(Wh).slice(-10).reverse();return n("div",{class:"relative inline-block",ref:i,children:[n(q,{icon:n(Rb,{class:"w-4 h-4"}),label:l("chat.heartbeats",{count:e}),onClick:()=>t?d():a(!0),variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"}),u>0&&n(Z,{variant:"default",class:"absolute -top-1.5 -right-1.5 min-w-[1.25rem] h-5 text-xs px-1 pointer-events-none",children:u}),t&&n("div",{ref:s,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:l("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:l("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:ae(p.timestamp)})]},p.id))})]})]})}const bS={sm:"w-6 h-6 rounded",md:"w-8 h-8 rounded-lg",lg:"w-20 h-20 rounded-2xl",xl:"w-24 h-24 rounded-2xl shadow-lg"};function eu({size:e="md",class:t="",animated:a=!1}){const r=bS[e];return n("img",{src:"/cove-icon.png",alt:"Cove",class:`${r} ${a?"group-hover:scale-110 transition-transform":""} ${t}`.trim()})}function Ar({class:e}){return n(Ma,{class:e||"w-5 h-5","aria-hidden":"true"})}function Jb({class:e}){return n(Sa,{class:e||"w-4 h-4","aria-hidden":"true"})}function xS({class:e}){return n(O4,{class:e||"w-5 h-5","aria-hidden":"true"})}function yS({class:e}){return n(vf,{class:e||"w-5 h-5","aria-hidden":"true"})}function Yb({class:e}){return n(Ob,{class:e||"w-5 h-5","aria-hidden":"true"})}function wS({class:e}){return n(Db,{class:e||"w-5 h-5","aria-hidden":"true"})}function Po({class:e,open:t}){return n(Ne,{class:`${e||"w-4 h-4"} transition-transform ${t?"rotate-180":""}`,"aria-hidden":"true"})}function kS({class:e}){return n(b4,{class:e||"w-5 h-5","aria-hidden":"true"})}function SS({class:e}){return n($o,{class:e||"w-3 h-3","aria-hidden":"true"})}function _S({class:e}){return n(Fb,{class:e||"w-5 h-5","aria-hidden":"true"})}function CS({class:e}){return n(B4,{class:e||"w-5 h-5",fill:"currentColor","aria-hidden":"true"})}function TS({class:e}){return n(Eb,{class:e||"w-5 h-5","aria-hidden":"true"})}function Zb({class:e}){return n(po,{class:e||"w-5 h-5","aria-hidden":"true"})}function Xb({class:e}){return n(bt,{class:e||"w-5 h-5","aria-hidden":"true"})}function ES({class:e}){return n(I4,{class:e||"w-5 h-5","aria-hidden":"true"})}function AS({class:e}){return n(z4,{class:e||"w-5 h-5","aria-hidden":"true"})}function bf({class:e}){return n(it,{class:e||"w-5 h-5","aria-hidden":"true"})}function MS({class:e}){return n(on,{class:e||"w-5 h-5","aria-hidden":"true"})}function IS({class:e}){return n(Yr,{class:e||"w-5 h-5","aria-hidden":"true"})}function Qb(e){return e>=90?"critical":e>=80?"high":e>=50?"medium":"low"}function RS(){const[e,t]=U(!1),a=F(null);if(!Yk.value)return null;Ia(a,()=>t(!1),e);const r=rf.value,o=Zk.value;if(!r||!o)return null;const s=Qb(o.usedPercent),i=`${r.displayName} Usage`;return n("div",{ref:a,class:"relative",children:[n(Do,{content:i,placement:"bottom",disabled:e,children:n("button",{type:"button",onClick:()=>t(!e),class:"flex items-center gap-2 px-2 py-1 rounded-md cursor-pointer hover:bg-[var(--color-bg-surface)] transition-colors","aria-expanded":e,"aria-label":`Anthropic usage: ${Math.round(o.usedPercent)}% ${o.label}`,children:[n("div",{class:"w-16 h-1.5 bg-[var(--color-border)] rounded-full overflow-hidden",children:n("div",{class:`h-full rounded-full transition-all ${ex(s)}`,style:{width:`${Math.min(100,o.usedPercent)}%`}})}),n("span",{class:`text-xs font-medium ${tx(s)}`,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:r.displayName}),r.plan&&n("span",{class:"text-xs text-[var(--color-text-muted)] bg-[var(--color-bg-secondary)] px-2 py-0.5 rounded",children:r.plan})]}),n("div",{class:"space-y-3",children:r.windows.map(c=>n(LS,{window:c},c.label))})]})]})}function LS({window:e}){const t=Qb(e.usedPercent),a=e.resetAt?$S(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 ${tx(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 ${ex(t)}`,style:{width:`${Math.min(100,e.usedPercent)}%`}})}),a&&n("div",{class:"text-[10px] text-[var(--color-text-muted)] mt-1",children:["Resets ",a]})]})}function ex(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 tx(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 $S(e){const t=Date.now(),a=e-t;if(a<0)return"soon";const r=Math.floor(a/(1e3*60*60)),o=Math.floor(a%(1e3*60*60)/(1e3*60));return r>24?`in ${Math.floor(r/24)}d`:r>0?`in ${r}h ${o}m`:`in ${o}m`}function DS(){return n("header",{class:"h-[var(--topbar-height)] 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(q,{icon:zt.value?n(Ar,{}):n(xS,{}),label:l("accessibility.sidebarToggle"),onClick:()=>zt.value=!zt.value,variant:"ghost",size:"md"})}),n("a",{href:"/",class:"hidden sm:flex items-center gap-2.5 font-semibold text-lg group no-underline",children:[n(eu,{size:"md",animated:!0}),n("span",{class:"bg-gradient-to-r from-[var(--color-accent)] to-[color-mix(in_oklch,var(--color-accent),var(--color-text-primary)_40%)] bg-clip-text text-transparent",children:l("common.cove")})]})]}),n("div",{class:"flex items-center gap-4",children:[(()=>{const e=PS(Ue.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:[l(e.label),D.value&&jt.value&&jt.value!=="dev"&&n("span",{class:"text-[var(--color-text-muted)]",children:[" v",jt.value]})]})]})})(),n("div",{class:"sm:hidden flex items-center gap-1",children:[n(Gb,{}),Ze.value&&n("div",{"data-tour":"canvas",children:n(q,{icon:n(Yb,{}),label:l("common.canvas"),onClick:()=>Ys.value=!Ys.value,variant:"ghost",size:"md"})}),n(q,{icon:n(bf,{}),label:l("chat.search"),onClick:()=>mt.value=!0,variant:"ghost",size:"md"})]}),n(RS,{}),n("div",{"data-tour":"settings",children:n(q,{icon:n(yS,{}),label:l("nav.settings"),onClick:()=>{const e=zc()==="/settings";Oe(e?_b.value:"/settings")},variant:"ghost",size:"md"})})]})]})})}const Tm={connected:{dot:"bg-[var(--color-success)]",text:"text-[var(--color-success)]",label:"common.healthy"},connecting:{dot:"bg-[var(--color-warning)]",text:"text-[var(--color-warning)]",label:"status.connecting"},authenticating:{dot:"bg-[var(--color-warning)]",text:"text-[var(--color-warning)]",label:"status.connecting"},reconnecting:{dot:"bg-[var(--color-warning)]",text:"text-[var(--color-warning)]",label:"status.reconnecting"},error:{dot:"bg-[var(--color-error)]",text:"text-[var(--color-error)]",label:"common.error"},disconnected:{dot:"bg-[var(--color-text-muted)]",text:"text-[var(--color-text-muted)]",label:"status.disconnected"}};function PS(e){return Tm[e]??Tm.disconnected}function OS(e){return`https://github.com/openclaw/openclaw/releases/tag/${e.startsWith("v")?e:`v${e}`}`}function NS(){const e=Kc.value,t=F(0),a=F(!1),r=X(0),o=X(!1);if(!e||a4())return null;const s=d=>{t.current=d.touches[0].clientY,a.current=!0},i=d=>{if(!a.current)return;const h=t.current-d.touches[0].clientY;r.value=Math.max(0,h)},c=()=>{a.current=!1,r.value>50?(o.value=!0,setTimeout(()=>{sm(),o.value=!1,r.value=0},150)):r.value=0},u=o.value?-100:-r.value;return n("div",{class:"fixed top-2 left-2 right-2 sm:left-1/2 sm:-translate-x-1/2 sm:right-auto sm:w-auto z-50 pointer-events-none",style:{paddingTop:"env(safe-area-inset-top)"},children:n("div",{class:`
59
59
  pointer-events-auto rounded-xl shadow-lg border border-[var(--color-border)]
60
60
  bg-[var(--color-bg-surface)] text-[var(--color-text-primary)]
61
61
  px-4 py-2.5 flex items-center justify-between gap-3
62
62
  ${o.value?"transition-transform duration-150":r.value>0?"":"animate-slide-in-top"}
63
- `,style:{transform:`translateY(${u}px)`},role:"alert",onTouchStart:s,onTouchMove:i,onTouchEnd:c,children:[n("div",{class:"flex items-center gap-3 min-w-0",children:[n(Rt,{class:"w-5 h-5 flex-shrink-0 text-[var(--color-accent)]","aria-hidden":"true"}),n("div",{class:"flex flex-col min-w-0",children:[n("span",{class:"text-xs text-[var(--color-text-muted)]",children:l("update.gatewayLabel")}),n("span",{class:"text-sm font-medium truncate",children:[e.currentVersion," → ",e.latestVersion]})]})]}),n("div",{class:"flex items-center flex-shrink-0",children:[n("a",{href:PS(e.latestVersion),target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center justify-center gap-1 text-[var(--color-accent)] hover:underline whitespace-nowrap min-w-11 min-h-11 sm:min-w-0 sm:min-h-0 sm:px-2 text-sm",children:[n("span",{class:"hidden sm:inline",children:l("update.viewRelease")}),n($o,{class:"w-4 h-4","aria-hidden":"true"})]}),n("button",{type:"button",onClick:lm,class:"inline-flex items-center justify-center min-w-11 min-h-11 sm:min-w-0 sm:min-h-0 sm:p-1.5 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-bg-tertiary)] rounded-lg","aria-label":l("actions.dismiss"),children:n(Ma,{class:"w-4 h-4"})})]})]})})}const NS={primary:`
63
+ `,style:{transform:`translateY(${u}px)`},role:"alert",onTouchStart:s,onTouchMove:i,onTouchEnd:c,children:[n("div",{class:"flex items-center gap-3 min-w-0",children:[n(Lt,{class:"w-5 h-5 flex-shrink-0 text-[var(--color-accent)]","aria-hidden":"true"}),n("div",{class:"flex flex-col min-w-0",children:[n("span",{class:"text-xs text-[var(--color-text-muted)]",children:l("update.gatewayLabel")}),n("span",{class:"text-sm font-medium truncate",children:[e.currentVersion," → ",e.latestVersion]})]})]}),n("div",{class:"flex items-center flex-shrink-0",children:[n("a",{href:OS(e.latestVersion),target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center justify-center gap-1 text-[var(--color-accent)] hover:underline whitespace-nowrap min-w-11 min-h-11 sm:min-w-0 sm:min-h-0 sm:px-2 text-sm",children:[n("span",{class:"hidden sm:inline",children:l("update.viewRelease")}),n($o,{class:"w-4 h-4","aria-hidden":"true"})]}),n("button",{type:"button",onClick:sm,class:"inline-flex items-center justify-center min-w-11 min-h-11 sm:min-w-0 sm:min-h-0 sm:p-1.5 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-bg-tertiary)] rounded-lg","aria-label":l("actions.dismiss"),children:n(Ma,{class:"w-4 h-4"})})]})]})})}const FS={primary:`
64
64
  bg-[var(--color-accent)] text-white
65
65
  hover:opacity-90
66
66
  focus-visible:ring-[var(--color-accent)]
@@ -77,7 +77,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/400-lAWKXRoJ.cs
77
77
  bg-[var(--color-error)] text-white
78
78
  hover:opacity-90
79
79
  focus-visible:ring-[var(--color-error)]
80
- `},FS={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"},P=Ml(({type:e="button",variant:t="primary",size:a="md",loading:r=!1,icon:o,iconRight:s,fullWidth:i=!1,disabled:c,children:u,class:d,...h},f)=>n("button",{ref:f,type:e,disabled:c||r,class:`
80
+ `},zS={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"},P=Ml(({type:e="button",variant:t="primary",size:a="md",loading:r=!1,icon:o,iconRight:s,fullWidth:i=!1,disabled:c,children:u,class:d,...h},f)=>n("button",{ref:f,type:e,disabled:c||r,class:`
81
81
  inline-flex items-center justify-center
82
82
  font-medium rounded-xl
83
83
  transition-all duration-200 ease-out
@@ -85,19 +85,19 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/400-lAWKXRoJ.cs
85
85
  active:scale-[0.97] active:shadow-none
86
86
  focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2
87
87
  disabled:opacity-40 disabled:cursor-not-allowed disabled:shadow-none disabled:active:scale-100 disabled:grayscale disabled:hover:opacity-40
88
- ${NS[t]}
89
- ${FS[a]}
88
+ ${FS[t]}
89
+ ${zS[a]}
90
90
  ${i?"w-full":""}
91
91
  ${d||""}
92
- `,...h,children:[r?n(te,{size:a==="lg"?"md":"sm"}):o?n("span",{class:"flex-shrink-0","aria-hidden":"true",children:o}):null,u&&n("span",{children:u}),s&&!r&&n("span",{class:"flex-shrink-0","aria-hidden":"true",children:s})]}));P.displayName="Button";const Pu=['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 zS(e,t={}){const{enabled:a=!0,autoFocus:r=!0,returnFocusTo:o}=t,s=F(null);R(()=>{if(!a||!e.current)return;if(s.current=document.activeElement,r){const d=e.current.querySelectorAll(Pu)[0];d&&requestAnimationFrame(()=>{d.focus()})}function i(u){if(u.key!=="Tab"||!e.current)return;const d=e.current.querySelectorAll(Pu);if(d.length===0)return;const h=d[0],f=d[d.length-1];if(u.shiftKey&&document.activeElement===h){u.preventDefault(),f.focus();return}if(!u.shiftKey&&document.activeElement===f){u.preventDefault(),h.focus();return}e.current.contains(document.activeElement)||(u.preventDefault(),h.focus())}function c(u){if(!e.current)return;const d=u.target;if(!e.current.contains(d)){const h=e.current.querySelectorAll(Pu);h.length>0&&h[0].focus()}}return document.addEventListener("keydown",i),document.addEventListener("focusin",c),()=>{document.removeEventListener("keydown",i),document.removeEventListener("focusin",c);const u=o?.current??s.current;u&&typeof u.focus=="function"&&u.focus()}},[a,r,e,o])}const Ou=250,US=80,jS={sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl",full:"sm:max-w-4xl"};function We({open:e,onClose:t,title:a,size:r="md",hideCloseButton:o=!1,closeOnBackdrop:s=!0,closeOnEscape:i=!0,children:c,footer:u}){const d=F(null),h=F(null),[f,p]=U(e),v=F(!1),w=F(null),C=Q(()=>{if(v.current)return;v.current=!0;const x=d.current,S=h.current;x&&(x.style.transition=`transform ${Ou}ms ease-out`,x.style.transform="translateY(100%)"),S&&(S.style.transition=`opacity ${Ou}ms ease-out`,S.style.opacity="0"),setTimeout(()=>{p(!1),v.current=!1,t()},Ou)},[t]);R(()=>{e?(p(!0),v.current=!1):f&&!v.current&&C()},[e,f,C]),R(()=>{e&&d.current&&requestAnimationFrame(()=>{d.current&&(d.current.style.transform="",d.current.style.transition=""),h.current&&(h.current.style.opacity="",h.current.style.transition="")})},[e]),zS(d,{enabled:e&&!v.current,autoFocus:!1});const T=Q(x=>{x.key==="Escape"&&i&&!v.current&&C()},[i,C]),b=Q(x=>{w.current=x.touches[0].clientY,d.current&&(d.current.style.transition="none")},[]),g=Q(x=>{if(w.current===null)return;const k=x.touches[0].clientY-w.current;if(k>0&&(d.current&&(d.current.style.transform=`translateY(${k}px)`),h.current)){const I=Math.max(0,1-k/300);h.current.style.opacity=String(I)}},[]),y=Q(()=>{if(w.current===null)return;const x=d.current;if(x){const k=x.style.transform.match(/translateY\((\d+)px\)/);(k?parseInt(k[1],10):0)>US?C():(x.style.transition="transform 150ms ease-out",x.style.transform="translateY(0)",h.current&&(h.current.style.transition="opacity 150ms ease-out",h.current.style.opacity="1"))}w.current=null},[C]);return R(()=>{if(f)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[f]),R(()=>{if(f)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[f,T]),f?nu(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":a?"modal-title":void 0,children:[n("div",{ref:h,class:"absolute inset-0 bg-black/40 backdrop-blur-md animate-fade-in",onClick:()=>{s&&!v.current&&C()},"aria-hidden":"true"}),n("div",{ref:d,tabIndex:-1,class:`
93
- relative w-full ${jS[r]}
92
+ `,...h,children:[r?n(te,{size:a==="lg"?"md":"sm"}):o?n("span",{class:"flex-shrink-0","aria-hidden":"true",children:o}):null,u&&n("span",{children:u}),s&&!r&&n("span",{class:"flex-shrink-0","aria-hidden":"true",children:s})]}));P.displayName="Button";const Lu=['a[href]:not([disabled]):not([tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','[tabindex]:not([tabindex="-1"]):not([disabled])'].join(", ");function US(e,t={}){const{enabled:a=!0,autoFocus:r=!0,returnFocusTo:o}=t,s=F(null);R(()=>{if(!a||!e.current)return;if(s.current=document.activeElement,r){const d=e.current.querySelectorAll(Lu)[0];d&&requestAnimationFrame(()=>{d.focus()})}function i(u){if(u.key!=="Tab"||!e.current)return;const d=e.current.querySelectorAll(Lu);if(d.length===0)return;const h=d[0],f=d[d.length-1];if(u.shiftKey&&document.activeElement===h){u.preventDefault(),f.focus();return}if(!u.shiftKey&&document.activeElement===f){u.preventDefault(),h.focus();return}e.current.contains(document.activeElement)||(u.preventDefault(),h.focus())}function c(u){if(!e.current)return;const d=u.target;if(!e.current.contains(d)){const h=e.current.querySelectorAll(Lu);h.length>0&&h[0].focus()}}return document.addEventListener("keydown",i),document.addEventListener("focusin",c),()=>{document.removeEventListener("keydown",i),document.removeEventListener("focusin",c);const u=o?.current??s.current;u&&typeof u.focus=="function"&&u.focus()}},[a,r,e,o])}const $u=250,jS=80,HS={sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl",full:"sm:max-w-4xl"};function We({open:e,onClose:t,title:a,size:r="md",hideCloseButton:o=!1,closeOnBackdrop:s=!0,closeOnEscape:i=!0,children:c,footer:u}){const d=F(null),h=F(null),[f,p]=U(e),v=F(!1),w=F(null),C=Q(()=>{if(v.current)return;v.current=!0;const x=d.current,S=h.current;x&&(x.style.transition=`transform ${$u}ms ease-out`,x.style.transform="translateY(100%)"),S&&(S.style.transition=`opacity ${$u}ms ease-out`,S.style.opacity="0"),setTimeout(()=>{p(!1),v.current=!1,t()},$u)},[t]);R(()=>{e?(p(!0),v.current=!1):f&&!v.current&&C()},[e,f,C]),R(()=>{e&&d.current&&requestAnimationFrame(()=>{d.current&&(d.current.style.transform="",d.current.style.transition=""),h.current&&(h.current.style.opacity="",h.current.style.transition="")})},[e]),US(d,{enabled:e&&!v.current,autoFocus:!1});const T=Q(x=>{x.key==="Escape"&&i&&!v.current&&C()},[i,C]),b=Q(x=>{w.current=x.touches[0].clientY,d.current&&(d.current.style.transition="none")},[]),g=Q(x=>{if(w.current===null)return;const k=x.touches[0].clientY-w.current;if(k>0&&(d.current&&(d.current.style.transform=`translateY(${k}px)`),h.current)){const I=Math.max(0,1-k/300);h.current.style.opacity=String(I)}},[]),y=Q(()=>{if(w.current===null)return;const x=d.current;if(x){const k=x.style.transform.match(/translateY\((\d+)px\)/);(k?parseInt(k[1],10):0)>jS?C():(x.style.transition="transform 150ms ease-out",x.style.transform="translateY(0)",h.current&&(h.current.style.transition="opacity 150ms ease-out",h.current.style.opacity="1"))}w.current=null},[C]);return R(()=>{if(f)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[f]),R(()=>{if(f)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[f,T]),f?Qc(n("div",{class:"fixed inset-0 z-50 flex items-end sm:items-center justify-center sm:p-4",role:"dialog","aria-modal":"true","aria-labelledby":a?"modal-title":void 0,children:[n("div",{ref:h,class:"absolute inset-0 bg-black/40 backdrop-blur-md animate-fade-in",onClick:()=>{s&&!v.current&&C()},"aria-hidden":"true"}),n("div",{ref:d,tabIndex:-1,class:`
93
+ relative w-full ${HS[r]}
94
94
  bg-[var(--color-bg-surface)]
95
95
  border border-[var(--color-border)]
96
96
  max-h-[85vh] sm:max-h-[90vh] flex flex-col
97
97
  focus:outline-none shadow-soft-xl
98
98
  rounded-t-xl border-b-0 sm:rounded-xl sm:border-b
99
99
  animate-slide-up-full sm:animate-scale-in
100
- `,children:[n("div",{class:"sm:hidden flex justify-center pt-3 pb-2 cursor-grab active:cursor-grabbing",onTouchStart:b,onTouchMove:g,onTouchEnd:y,"aria-hidden":"true",children:n("div",{class:"w-10 h-1 rounded-full bg-[var(--color-text-muted)]/40"})}),a&&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:a}),!o&&n(q,{icon:n(Ar,{}),label:l("actions.close"),variant:"ghost",size:"sm",onClick:C,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}),u&&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:u})]})]}),document.body):null}const HS={sm:"px-2.5 py-1.5 text-xs",md:"px-3 py-2 text-sm",lg:"px-4 py-3 text-base"},Y=Ml(({size:e="md",error:t,leftElement:a,rightElement:r,fullWidth:o=!1,disabled:s,class:i,...c},u)=>{const d=!!t;return n("div",{class:`${o?"w-full":""}`,children:[n("div",{class:"relative",children:[a&&n("div",{class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-[var(--color-text-muted)]",children:a}),n("input",{ref:u,disabled:s,class:`
100
+ `,children:[n("div",{class:"sm:hidden flex justify-center pt-3 pb-2 cursor-grab active:cursor-grabbing",onTouchStart:b,onTouchMove:g,onTouchEnd:y,"aria-hidden":"true",children:n("div",{class:"w-10 h-1 rounded-full bg-[var(--color-text-muted)]/40"})}),a&&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:a}),!o&&n(q,{icon:n(Ar,{}),label:l("actions.close"),variant:"ghost",size:"sm",onClick:C,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}),u&&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:u})]})]}),document.body):null}const BS={sm:"px-2.5 py-1.5 text-xs",md:"px-3 py-2 text-sm",lg:"px-4 py-3 text-base"},Y=Ml(({size:e="md",error:t,leftElement:a,rightElement:r,fullWidth:o=!1,disabled:s,class:i,...c},u)=>{const d=!!t;return n("div",{class:`${o?"w-full":""}`,children:[n("div",{class:"relative",children:[a&&n("div",{class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-[var(--color-text-muted)]",children:a}),n("input",{ref:u,disabled:s,class:`
101
101
  block rounded-xl
102
102
  bg-[var(--color-bg-primary)]
103
103
  border transition-all duration-200 ease-out
@@ -106,18 +106,18 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/400-lAWKXRoJ.cs
106
106
  focus:outline-none focus:ring-2 focus:ring-offset-0
107
107
  disabled:opacity-50 disabled:cursor-not-allowed disabled:shadow-none
108
108
  ${d?"border-[var(--color-error)] focus:ring-[var(--color-error)]":"border-[var(--color-border)] focus:ring-[var(--color-accent)] focus:border-transparent"}
109
- ${HS[e]}
109
+ ${BS[e]}
110
110
  ${a?"pl-10":""}
111
111
  ${r?"pr-10":""}
112
112
  ${o?"w-full":""}
113
113
  ${i||""}
114
- `,"aria-invalid":d,"aria-describedby":d?`${c.id}-error`:void 0,...c}),r&&n("div",{class:"absolute inset-y-0 right-0 flex items-center pr-3 text-[var(--color-text-muted)]",children:r})]}),typeof t=="string"&&t&&n("p",{id:`${c.id}-error`,class:"mt-1 text-xs text-[var(--color-error)]",role:"alert",children:t})]})});Y.displayName="Input";function De({label:e,labelAction:t,htmlFor:a,error:r,hint:o,required:s,children:i,class:c}){return n("div",{class:c,children:[(e||t)&&n("div",{class:"flex items-center justify-between gap-2 mb-1.5",children:[e&&n("label",{htmlFor:a,class:"block text-sm font-medium text-[var(--color-text-secondary)]",children:[e,s&&n("span",{class:"text-[var(--color-error)] ml-0.5",children:"*"})]}),t&&n("div",{class:"flex-shrink-0",children:t})]}),i,o&&!r&&n("p",{class:"mt-1 text-xs text-[var(--color-text-muted)]",children:o}),r&&n("p",{class:"mt-1 text-xs text-[var(--color-error)]",children:r})]})}function hc(e){if(e.displayName)return e.displayName;if(e.label)return e.label;const t=e.key.split(":");if(t.length>=3&&t[0]==="agent"){const a=t[2];return a==="main"?rb(t[1]):bs(a)}if(t.length>=2){const a=t[t.length-1];if(Vp(a)){const r=t[t.length-2];if(r&&!Vp(r))return bs(r)}return bs(a)}return e.key}function BS(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 WS(e){const t=e.channel??e.lastChannel;return!t||t==="webchat"?null:bs(t)}function Am({session:e,isActive:t=!1,isMain:a=!1,onClick:r,onRename:o,onDelete:s}){const[i,c]=U(!1),[u,d]=U(!1),h=F(null),f=F(null);Ia(h,()=>c(!1),i);const p=()=>{if(!i&&f.current){const S=f.current.getBoundingClientRect();let k=f.current.parentElement;for(;k&&getComputedStyle(k).overflowY!=="auto";)k=k.parentElement;const A=(k?k.getBoundingClientRect().bottom:window.innerHeight)-S.bottom;d(A<100)}c(!i)},v=BS(e),w=WS(e),C=O2(e.totalTokens??e.contextTokens),T=e.updatedAt||e.lastActiveAt,b=$2(e.key),g=b?rb(b):null,y=Yh.value===e.key,x=!!ef(e.key);return n("div",{class:`relative group transition-all duration-300 ${y?"opacity-0 scale-95 -translate-x-2":""}`,children:[n("button",{type:"button",onClick:r,class:`
114
+ `,"aria-invalid":d,"aria-describedby":d?`${c.id}-error`:void 0,...c}),r&&n("div",{class:"absolute inset-y-0 right-0 flex items-center pr-3 text-[var(--color-text-muted)]",children:r})]}),typeof t=="string"&&t&&n("p",{id:`${c.id}-error`,class:"mt-1 text-xs text-[var(--color-error)]",role:"alert",children:t})]})});Y.displayName="Input";function De({label:e,labelAction:t,htmlFor:a,error:r,hint:o,required:s,children:i,class:c}){return n("div",{class:c,children:[(e||t)&&n("div",{class:"flex items-center justify-between gap-2 mb-1.5",children:[e&&n("label",{htmlFor:a,class:"block text-sm font-medium text-[var(--color-text-secondary)]",children:[e,s&&n("span",{class:"text-[var(--color-error)] ml-0.5",children:"*"})]}),t&&n("div",{class:"flex-shrink-0",children:t})]}),i,o&&!r&&n("p",{class:"mt-1 text-xs text-[var(--color-text-muted)]",children:o}),r&&n("p",{class:"mt-1 text-xs text-[var(--color-error)]",children:r})]})}function uc(e){if(e.displayName)return e.displayName;if(e.label)return e.label;const t=e.key.split(":");if(t.length>=3&&t[0]==="agent"){const a=t[2];return a==="main"?rb(t[1]):bs(a)}if(t.length>=2){const a=t[t.length-1];if(qp(a)){const r=t[t.length-2];if(r&&!qp(r))return bs(r)}return bs(a)}return e.key}function WS(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 KS(e){const t=e.channel??e.lastChannel;return!t||t==="webchat"?null:bs(t)}function Em({session:e,isActive:t=!1,isMain:a=!1,onClick:r,onRename:o,onDelete:s}){const[i,c]=U(!1),[u,d]=U(!1),h=F(null),f=F(null);Ia(h,()=>c(!1),i);const p=()=>{if(!i&&f.current){const S=f.current.getBoundingClientRect();let k=f.current.parentElement;for(;k&&getComputedStyle(k).overflowY!=="auto";)k=k.parentElement;const A=(k?k.getBoundingClientRect().bottom:window.innerHeight)-S.bottom;d(A<100)}c(!i)},v=WS(e),w=KS(e),C=N2(e.totalTokens??e.contextTokens),T=e.updatedAt||e.lastActiveAt,b=D2(e.key),g=b?rb(b):null,y=Gh.value===e.key,x=!!Xh(e.key);return n("div",{class:`relative group transition-all duration-300 ${y?"opacity-0 scale-95 -translate-x-2":""}`,children:[n("button",{type:"button",onClick:r,class:`
115
115
  w-full text-left px-3 py-2.5 rounded-xl text-sm
116
116
  flex items-start gap-2.5 transition-all duration-200 ease-out
117
117
  ${x?"ai-glow":""}
118
118
  ${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)]"}
119
- `,children:[x?n(te,{size:"xs",class:"flex-shrink-0 mt-0.5 text-[var(--color-accent)]"}):a?n(ES,{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:hc(e)}),v&&n("span",{class:`text-[10px] font-medium ${v.color}`,children:v.label})]}),n("span",{class:"flex items-center gap-1.5 text-xs text-[var(--color-text-muted)] mt-0.5 overflow-hidden",children:[g&&n("span",{class:"truncate flex-shrink",children:g}),w&&n(H,{children:[g&&n("span",{class:"flex-shrink-0 text-[var(--color-border)]",children:"•"}),n("span",{class:"truncate flex-shrink text-[var(--color-accent)]/70",children:w})]}),C&&n(H,{children:[(g||w)&&n("span",{class:"flex-shrink-0 text-[var(--color-border)]",children:"•"}),n("span",{class:"flex-shrink-0",title:`${e.totalTokens??e.contextTokens} tokens`,children:C})]}),n("span",{class:"flex-1 min-w-0"}),T&&n("span",{class:"whitespace-nowrap flex-shrink-0",children:Qi(new Date(T))})]})]})]}),(o||s)&&n("div",{ref:h,class:"absolute right-2 top-2",children:[n("button",{ref:f,type:"button",onClick:S=>{S.stopPropagation(),p()},class:`p-1 rounded-lg transition-all duration-150
120
- ${i?"bg-[var(--color-bg-secondary)] text-[var(--color-text-primary)]":"opacity-0 group-hover:opacity-100 hover:bg-[var(--color-bg-secondary)] text-[var(--color-text-muted)]"}`,"aria-label":"Session actions","aria-haspopup":"menu","aria-expanded":i,children:n(CS,{class:"w-4 h-4"})}),i&&n("div",{role:"menu","aria-label":"Session actions",class:`absolute right-0 w-36 bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-lg shadow-lg z-50 py-1 ${u?"bottom-full mb-1":"top-full mt-1"}`,children:[o&&n("button",{type:"button",role:"menuitem",onClick:S=>{S.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(Zb,{class:"w-4 h-4"}),l("actions.rename")]}),s&&n("button",{type:"button",role:"menuitem",onClick:S=>{S.stopPropagation(),c(!1),s(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(Xb,{class:"w-4 h-4"}),l("actions.delete")]})]})]})]})}function KS({session:e,onClose:t,onRename:a}){const[r,o]=U(""),[s,i]=U(!1),c=F(null);R(()=>{e&&(o(hc(e)),setTimeout(()=>c.current?.select(),100))},[e]);const u=async f=>{if(f.preventDefault(),!(!e||!r.trim())){i(!0);try{await a(e,r.trim()),t()}finally{i(!1)}}};if(!e)return null;const d=hc(e),h=r.trim()!==d;return n(We,{open:!!e,onClose:t,title:l("sessions.rename"),children:n("form",{onSubmit:u,children:[n(De,{label:l("sessions.label"),htmlFor:"session-label",children:n(Y,{ref:c,id:"session-label",type:"text",value:r,onInput:f=>o(f.target.value),placeholder:l("sessions.labelPlaceholder"),fullWidth:!0})}),n("div",{class:"flex justify-end gap-2 mt-4",children:[n(P,{variant:"ghost",onClick:t,disabled:s,children:l("actions.cancel")}),n(P,{type:"submit",variant:"primary",loading:s,disabled:!r.trim()||!h,children:l("actions.save")})]})]})})}function qS({session:e,onClose:t,onDelete:a}){const[r,o]=U(!1),s=async()=>{if(e){o(!0);try{t(),await new Promise(i=>setTimeout(i,100)),await a(e)}catch{}finally{o(!1)}}};return e?n(We,{open:!!e,onClose:t,title:l("sessions.delete"),children:[n("p",{class:"text-sm text-[var(--color-text-secondary)] mb-4",children:l("sessions.deleteConfirm",{name:hc(e)})}),n("p",{class:"text-xs text-[var(--color-text-muted)] mb-4",children:l("sessions.deleteWarning")}),n("div",{class:"flex justify-end gap-2",children:[n(P,{variant:"ghost",onClick:t,disabled:r,children:l("actions.cancel")}),n(P,{variant:"danger",onClick:s,loading:r,children:l("actions.delete")})]})]}):null}const VS={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:a,size:r="md",placeholder:o="Select...","aria-label":s,class:i,disabled:c=!1,align:u="left",width:d}){const[h,f]=U(!1),[p,v]=U(-1),[w,C]=U(void 0),T=F(null),b=F(null),g=F(null),y=VS[r],x=t.find(A=>A.value===e)?.label??o;Rh(()=>{!d&&g.current&&C(g.current.offsetWidth)},[t,d]);const S=Q(()=>{f(!1),v(-1)},[]),k=Q(A=>{a(A),S(),T.current?.focus()},[a,S]);Ia([T,b],S,h);const I=Q(A=>{if(!h){(A.key==="Enter"||A.key===" "||A.key==="ArrowDown")&&(A.preventDefault(),f(!0),v(0));return}switch(A.key){case"Escape":A.preventDefault(),S(),T.current?.focus();break;case"ArrowDown":A.preventDefault(),v(O=>Math.min(O+1,t.length-1));break;case"ArrowUp":A.preventDefault(),v(O=>Math.max(O-1,0));break;case"Enter":case" ":A.preventDefault(),p>=0&&!t[p]?.disabled&&k(t[p].value);break;case"Tab":S();break}},[h,t,p,S,k]);return n("div",{class:`relative ${i??"inline-block"}`,children:[n("div",{ref:g,"aria-hidden":"true",class:`
119
+ `,children:[x?n(te,{size:"xs",class:"flex-shrink-0 mt-0.5 text-[var(--color-accent)]"}):a?n(AS,{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:uc(e)}),v&&n("span",{class:`text-[10px] font-medium ${v.color}`,children:v.label})]}),n("span",{class:"flex items-center gap-1.5 text-xs text-[var(--color-text-muted)] mt-0.5 overflow-hidden",children:[g&&n("span",{class:"truncate flex-shrink",children:g}),w&&n(H,{children:[g&&n("span",{class:"flex-shrink-0 text-[var(--color-border)]",children:"•"}),n("span",{class:"truncate flex-shrink text-[var(--color-accent)]/70",children:w})]}),C&&n(H,{children:[(g||w)&&n("span",{class:"flex-shrink-0 text-[var(--color-border)]",children:"•"}),n("span",{class:"flex-shrink-0",title:`${e.totalTokens??e.contextTokens} tokens`,children:C})]}),n("span",{class:"flex-1 min-w-0"}),T&&n("span",{class:"whitespace-nowrap flex-shrink-0",children:Xi(new Date(T))})]})]})]}),(o||s)&&n("div",{ref:h,class:"absolute right-2 top-2",children:[n("button",{ref:f,type:"button",onClick:S=>{S.stopPropagation(),p()},class:`p-1 rounded-lg transition-all duration-150
120
+ ${i?"bg-[var(--color-bg-secondary)] text-[var(--color-text-primary)]":"opacity-0 group-hover:opacity-100 hover:bg-[var(--color-bg-secondary)] text-[var(--color-text-muted)]"}`,"aria-label":"Session actions","aria-haspopup":"menu","aria-expanded":i,children:n(TS,{class:"w-4 h-4"})}),i&&n("div",{role:"menu","aria-label":"Session actions",class:`absolute right-0 w-36 bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-lg shadow-lg z-50 py-1 ${u?"bottom-full mb-1":"top-full mt-1"}`,children:[o&&n("button",{type:"button",role:"menuitem",onClick:S=>{S.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(Zb,{class:"w-4 h-4"}),l("actions.rename")]}),s&&n("button",{type:"button",role:"menuitem",onClick:S=>{S.stopPropagation(),c(!1),s(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(Xb,{class:"w-4 h-4"}),l("actions.delete")]})]})]})]})}function qS({session:e,onClose:t,onRename:a}){const[r,o]=U(""),[s,i]=U(!1),c=F(null);R(()=>{e&&(o(uc(e)),setTimeout(()=>c.current?.select(),100))},[e]);const u=async f=>{if(f.preventDefault(),!(!e||!r.trim())){i(!0);try{await a(e,r.trim()),t()}finally{i(!1)}}};if(!e)return null;const d=uc(e),h=r.trim()!==d;return n(We,{open:!!e,onClose:t,title:l("sessions.rename"),children:n("form",{onSubmit:u,children:[n(De,{label:l("sessions.label"),htmlFor:"session-label",children:n(Y,{ref:c,id:"session-label",type:"text",value:r,onInput:f=>o(f.target.value),placeholder:l("sessions.labelPlaceholder"),fullWidth:!0})}),n("div",{class:"flex justify-end gap-2 mt-4",children:[n(P,{variant:"ghost",onClick:t,disabled:s,children:l("actions.cancel")}),n(P,{type:"submit",variant:"primary",loading:s,disabled:!r.trim()||!h,children:l("actions.save")})]})]})})}function VS({session:e,onClose:t,onDelete:a}){const[r,o]=U(!1),s=async()=>{if(e){o(!0);try{t(),await new Promise(i=>setTimeout(i,100)),await a(e)}catch{}finally{o(!1)}}};return e?n(We,{open:!!e,onClose:t,title:l("sessions.delete"),children:[n("p",{class:"text-sm text-[var(--color-text-secondary)] mb-4",children:l("sessions.deleteConfirm",{name:uc(e)})}),n("p",{class:"text-xs text-[var(--color-text-muted)] mb-4",children:l("sessions.deleteWarning")}),n("div",{class:"flex justify-end gap-2",children:[n(P,{variant:"ghost",onClick:t,disabled:r,children:l("actions.cancel")}),n(P,{variant:"danger",onClick:s,loading:r,children:l("actions.delete")})]})]}):null}const GS={sm:{trigger:"px-3 py-2.5 text-sm sm:px-2.5 sm:py-1.5 sm:text-xs",menu:"text-sm sm:text-xs",option:"px-3 py-2.5 sm:px-2.5 sm:py-1.5"},md:{trigger:"px-4 py-3 text-base sm:px-3 sm:py-2 sm:text-sm",menu:"text-base sm:text-sm",option:"px-4 py-3 sm:px-3 sm:py-2"},lg:{trigger:"px-4 py-3 text-base",menu:"text-base",option:"px-4 py-3"}};function Me({value:e,options:t,onChange:a,size:r="md",placeholder:o="Select...","aria-label":s,class:i,disabled:c=!1,align:u="left",width:d}){const[h,f]=U(!1),[p,v]=U(-1),[w,C]=U(void 0),T=F(null),b=F(null),g=F(null),y=GS[r],x=t.find(A=>A.value===e)?.label??o;Mh(()=>{!d&&g.current&&C(g.current.offsetWidth)},[t,d]);const S=Q(()=>{f(!1),v(-1)},[]),k=Q(A=>{a(A),S(),T.current?.focus()},[a,S]);Ia([T,b],S,h);const I=Q(A=>{if(!h){(A.key==="Enter"||A.key===" "||A.key==="ArrowDown")&&(A.preventDefault(),f(!0),v(0));return}switch(A.key){case"Escape":A.preventDefault(),S(),T.current?.focus();break;case"ArrowDown":A.preventDefault(),v(O=>Math.min(O+1,t.length-1));break;case"ArrowUp":A.preventDefault(),v(O=>Math.max(O-1,0));break;case"Enter":case" ":A.preventDefault(),p>=0&&!t[p]?.disabled&&k(t[p].value);break;case"Tab":S();break}},[h,t,p,S,k]);return n("div",{class:`relative ${i??"inline-block"}`,children:[n("div",{ref:g,"aria-hidden":"true",class:`
121
121
  invisible absolute flex items-center gap-2
122
122
  ${y.trigger}
123
123
  `,children:[n("span",{children:t.reduce((A,O)=>O.label.length>A.length?O.label:A,o)}),n(Ne,{class:"w-4 h-4 flex-shrink-0"})]}),n("button",{ref:T,type:"button",onClick:()=>!c&&f(!h),onKeyDown:I,disabled:c,"aria-label":s,"aria-haspopup":"listbox","aria-expanded":h,style:d?{width:d}:w&&!i?.includes("w-full")?{minWidth:`${w}px`}:void 0,class:`
@@ -147,7 +147,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/400-lAWKXRoJ.cs
147
147
  flex items-center justify-center
148
148
  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)]
149
149
  ${e?"bg-[var(--color-accent)] border-[var(--color-accent)]":"bg-[var(--color-bg-primary)] border-[var(--color-border)] hover:border-[var(--color-accent)]"}
150
- `,"aria-hidden":"true",children:e&&n(AS,{class:"w-3 h-3 text-white"})}),(a||r)&&n("div",{class:"flex-1 min-w-0",children:[a&&n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:a}),r&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-0.5",children:r})]})]})}function GS({open:e,onClose:t,onCreate:a}){const[r,o]=U(ot.value.defaultAgentId||lc.value),[s,i]=U(!1),c=()=>{s&&(ot.value={...ot.value,defaultAgentId:r,useDefaults:!0}),a(r),t()},u=()=>{o(ot.value.defaultAgentId||lc.value),i(!1),t()};return Ld.value.length===0?null:n(We,{open:e,onClose:u,title:l("common.newChat"),children:n("div",{class:"space-y-6",children:[n("div",{children:[n("label",{class:"block text-sm font-medium text-[var(--color-text-primary)] mb-2",children:l("common.agent")}),n(Ae,{value:r,onChange:o,options:Ld.value,class:"w-full"}),n("p",{class:"mt-1.5 text-xs text-[var(--color-text-muted)]",children:l("newChatModal.agentDescription")})]}),n(nx,{checked:s,onChange:i,label:l("newChatModal.rememberChoice"),description:l("newChatModal.rememberChoiceDescription")}),n("div",{class:"flex justify-end gap-3 pt-2",children:[n(P,{variant:"secondary",onClick:u,children:l("actions.cancel")}),n(P,{variant:"primary",onClick:c,children:l("newChatModal.create")})]})]})})}const JS={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"}},Be=Ml(({checked:e,onChange:t,size:a="md",label:r,description:o,disabled:s,class:i,id:c,...u},d)=>{const h=JS[a],f=c?`${c}-label`:void 0,p=c?`${c}-desc`:void 0;return n("div",{class:`flex items-start justify-between gap-3 ${i||""}`,children:[(r||o)&&n("div",{class:"flex flex-col",children:[r&&n("span",{id:f,class:"text-sm font-medium text-[var(--color-text-primary)]",children:r}),o&&n("span",{id:p,class:"text-xs text-[var(--color-text-muted)]",children:o})]}),n("button",{ref:d,type:"button",role:"switch","aria-checked":e,"aria-labelledby":f,"aria-describedby":p,disabled:s,onClick:()=>t(!e),class:`
150
+ `,"aria-hidden":"true",children:e&&n(MS,{class:"w-3 h-3 text-white"})}),(a||r)&&n("div",{class:"flex-1 min-w-0",children:[a&&n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:a}),r&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-0.5",children:r})]})]})}function JS({open:e,onClose:t,onCreate:a}){const[r,o]=U(rt.value.defaultAgentId||oc.value),[s,i]=U(!1),c=()=>{s&&(rt.value={...rt.value,defaultAgentId:r,useDefaults:!0}),a(r),t()},u=()=>{o(rt.value.defaultAgentId||oc.value),i(!1),t()};return Md.value.length===0?null:n(We,{open:e,onClose:u,title:l("common.newChat"),children:n("div",{class:"space-y-6",children:[n("div",{children:[n("label",{class:"block text-sm font-medium text-[var(--color-text-primary)] mb-2",children:l("common.agent")}),n(Me,{value:r,onChange:o,options:Md.value,class:"w-full"}),n("p",{class:"mt-1.5 text-xs text-[var(--color-text-muted)]",children:l("newChatModal.agentDescription")})]}),n(nx,{checked:s,onChange:i,label:l("newChatModal.rememberChoice"),description:l("newChatModal.rememberChoiceDescription")}),n("div",{class:"flex justify-end gap-3 pt-2",children:[n(P,{variant:"secondary",onClick:u,children:l("actions.cancel")}),n(P,{variant:"primary",onClick:c,children:l("newChatModal.create")})]})]})})}const YS={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"}},Be=Ml(({checked:e,onChange:t,size:a="md",label:r,description:o,disabled:s,class:i,id:c,...u},d)=>{const h=YS[a],f=c?`${c}-label`:void 0,p=c?`${c}-desc`:void 0;return n("div",{class:`flex items-start justify-between gap-3 ${i||""}`,children:[(r||o)&&n("div",{class:"flex flex-col",children:[r&&n("span",{id:f,class:"text-sm font-medium text-[var(--color-text-primary)]",children:r}),o&&n("span",{id:p,class:"text-xs text-[var(--color-text-muted)]",children:o})]}),n("button",{ref:d,type:"button",role:"switch","aria-checked":e,"aria-labelledby":f,"aria-describedby":p,disabled:s,onClick:()=>t(!e),class:`
151
151
  relative inline-flex flex-shrink-0 items-center
152
152
  rounded-full transition-colors
153
153
  focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] focus-visible:ring-offset-2
@@ -159,45 +159,45 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/400-lAWKXRoJ.cs
159
159
  transform transition-transform
160
160
  ${h.thumb}
161
161
  ${e?h.translate:"translate-x-0.5"}
162
- `})})]})});Be.displayName="Toggle";const YS={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 ZS({selected:e=!1,size:t="sm",onClick:a,disabled:r=!1,children:o,class:s}){return n("button",{type:"button",onClick:a,disabled:r,class:`
162
+ `})})]})});Be.displayName="Toggle";const ZS={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 XS({selected:e=!1,size:t="sm",onClick:a,disabled:r=!1,children:o,class:s}){return n("button",{type:"button",onClick:a,disabled:r,class:`
163
163
  inline-flex items-center justify-center
164
164
  font-medium rounded-md transition-colors
165
165
  focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] focus-visible:ring-offset-1
166
166
  disabled:opacity-50 disabled:cursor-not-allowed
167
- ${YS[t]}
167
+ ${ZS[t]}
168
168
  ${e?"bg-[var(--color-accent)] text-white":"bg-[var(--color-bg-primary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-secondary)]"}
169
169
  ${s||""}
170
- `,children:o})}function XS(){const[e,t]=U(!1),a=F(null),r=Vs.value.trim()!=="",o=qs.value!==null,s=r||o||Gs.value;R(()=>{s&&t(!0)},[s]),R(()=>{e&&a.current&&a.current.focus()},[e]);const i=[{value:null,label:l("common.all")},{value:"main",label:l("common.main")},{value:"isolated",label:l("common.isolated")},{value:"channel",label:l("common.channel")}];return n("div",{class:"px-2 py-1.5",children:[n("div",{class:"flex items-center justify-between",children:[n("h3",{class:"text-xs font-semibold text-[var(--color-accent)] uppercase tracking-wider",children:l("common.sessions")}),n("button",{type:"button",onClick:()=>t(!e),class:`p-1 rounded transition-colors ${s?"text-[var(--color-accent)] bg-[var(--color-accent)]/10":"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]"}`,"aria-label":l("sessions.filterSessions"),children:n(TS,{class:"w-3.5 h-3.5"})})]}),e&&n("div",{class:"mt-2 space-y-2",children:[n("div",{children:n(Y,{ref:a,type:"text",value:Vs.value,onInput:c=>Jp(c.target.value),onKeyDown:c=>{c.key==="Escape"&&!s&&t(!1)},placeholder:l("sessions.searchPlaceholder"),size:"sm",fullWidth:!0,leftElement:n(yf,{class:"w-3.5 h-3.5"}),rightElement:r?n("button",{type:"button",onClick:()=>Jp(""),class:"p-0.5 rounded text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]","aria-label":l("actions.clear"),children:n(Ar,{class:"w-3 h-3"})}):void 0})}),n("div",{class:"flex flex-wrap gap-1",children:i.map(c=>n(ZS,{size:"xs",selected:qs.value===c.value,onClick:()=>B2(c.value),children:c.label},c.value??"all"))}),n(Be,{size:"sm",checked:Gs.value,onChange:W2,label:l("sessions.showCron")})]})]})}function Mm(e){Oe(`/chat/${encodeURIComponent(e)}`),df()}const QS={pinned:"sessions.pinned",today:"sessions.today",yesterday:"sessions.yesterday",thisWeek:"sessions.thisWeek",older:"sessions.older"},e_=["pinned","today","yesterday","thisWeek","older"];function t_({onRename:e,onDelete:t}){const a=H2.value,r=Sd.value.length>0,o=Gh(Vs.value);return r?o?n("ul",{class:"space-y-0.5",children:Sd.value.map(s=>n("li",{children:n(Am,{session:s,isActive:rt.value===s.key&&Qt.value.startsWith("/chat"),isMain:fr(s.key),onClick:()=>Mm(s.key),onRename:e,onDelete:t})},s.key))}):n("div",{class:"space-y-3",children:e_.map(s=>{const i=a.get(s);return!i||i.length===0?null:n("div",{children:[s!=="pinned"&&n("h4",{class:"text-[10px] font-semibold text-[var(--color-text-muted)] uppercase tracking-wider px-2 py-1",children:l(QS[s])}),n("ul",{class:"space-y-0.5",children:i.map(u=>n("li",{children:n(Am,{session:u,isActive:rt.value===u.key&&Qt.value.startsWith("/chat"),isMain:fr(u.key),onClick:()=>Mm(u.key),onRename:e,onDelete:t})},u.key))})]},s)})}):n("p",{class:"text-sm text-[var(--color-text-muted)] px-2 py-4",children:l(o?"sessions.noResults":"sessions.noSessions")})}const Ei={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"},Nu={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"},Fu={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"},zu={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"},Uu={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"},ju={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"},Hu={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"},et="w-5 h-5",n_=()=>n($4,{class:et,"aria-hidden":"true"}),a_=()=>n(w4,{class:et,"aria-hidden":"true"}),r_=()=>n(Lb,{class:et,"aria-hidden":"true"}),o_=()=>n(dc,{class:et,"aria-hidden":"true"}),s_=()=>n($d,{class:et,"aria-hidden":"true"}),l_=()=>n(ve,{class:et,"aria-hidden":"true"}),i_=()=>n(Pn,{class:et,"aria-hidden":"true"}),c_=()=>n(Cb,{class:et,"aria-hidden":"true"}),u_=()=>n(po,{class:et,"aria-hidden":"true"}),d_=()=>n(bf,{class:et,"aria-hidden":"true"}),h_=()=>n(j4,{class:et,"aria-hidden":"true"}),f_=()=>n(an,{class:et,"aria-hidden":"true"}),p_=()=>n(b4,{class:et,"aria-hidden":"true"}),Im=()=>n(I4,{class:et,"aria-hidden":"true"}),m_=()=>n("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",class:et,"aria-hidden":"true",children:n("path",{fill:"currentColor",d:Ei.path})}),v_=()=>n(O4,{class:et,"aria-hidden":"true"}),g_=[{titleKey:"nav.sections.control",items:[{id:"overview",labelKey:"common.overview",icon:n_,requiresConnection:!0},{id:"usage",labelKey:"common.usage",icon:a_,requiresConnection:!0},{id:"channels",labelKey:"common.channels",icon:r_,requiresConnection:!0},{id:"instances",labelKey:"common.instances",icon:o_,requiresConnection:!0},{id:"sessions",labelKey:"common.sessions",icon:s_,requiresConnection:!0},{id:"cron",labelKey:"common.cronJobs",icon:l_,requiresConnection:!0}]},{titleKey:"common.agent",items:[{id:"skills",labelKey:"common.skills",icon:i_,requiresConnection:!0},{id:"agents",labelKey:"common.agents",icon:c_,requiresConnection:!0},{id:"devices",labelKey:"common.devices",icon:u_,requiresConnection:!0}]},{titleKey:"common.settings",items:[{id:"settings",labelKey:"nav.settings",icon:v_},{id:"config",labelKey:"nav.config",icon:d_,requiresConnection:!0},{id:"debug",labelKey:"common.debug",icon:h_,requiresConnection:!0},{id:"logs",labelKey:"common.logs",icon:f_,requiresConnection:!0}]},{titleKey:"nav.sections.resources",items:[{id:"docs",labelKey:"common.docs",icon:p_,external:Zl.docs},{id:"github",labelKey:"nav.github",icon:Im,external:Zl.github},{id:"github-openclaw",labelKey:"nav.githubOpenClaw",icon:Im,external:Zl.githubOpenClaw},{id:"discord",labelKey:"nav.discord",icon:m_,external:Zl.discord}]}],ax="cove:nav-sections";function rx(e){try{const t=`${ax}-${e}`,a=localStorage.getItem(t);return a?JSON.parse(a):{}}catch{return{}}}function b_(e,t,a){try{const r=`${ax}-${e}`,o=rx(e);o[t]=a,localStorage.setItem(r,JSON.stringify(o))}catch{}}function x_({item:e}){const t=`/${e.id}`,a=jc(()=>!e.external&&(Qt.value===t||e.id==="chat"&&Qt.value.startsWith("/chat"))),r=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(r,{})}),l(e.labelKey),n(kS,{class:"w-3 h-3 ml-auto text-[var(--color-text-muted)]"})]}):n("button",{type:"button",onClick:()=>{Qt.value=t,Oe(t),df()},class:`
170
+ `,children:o})}function QS(){const[e,t]=U(!1),a=F(null),r=Gs.value.trim()!=="",o=Vs.value!==null,s=r||o||Js.value;R(()=>{s&&t(!0)},[s]),R(()=>{e&&a.current&&a.current.focus()},[e]);const i=[{value:null,label:l("common.all")},{value:"main",label:l("common.main")},{value:"isolated",label:l("common.isolated")},{value:"channel",label:l("common.channel")}];return n("div",{class:"px-2 py-1.5",children:[n("div",{class:"flex items-center justify-between",children:[n("h3",{class:"text-xs font-semibold text-[var(--color-accent)] uppercase tracking-wider",children:l("common.sessions")}),n("button",{type:"button",onClick:()=>t(!e),class:`p-1 rounded transition-colors ${s?"text-[var(--color-accent)] bg-[var(--color-accent)]/10":"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]"}`,"aria-label":l("sessions.filterSessions"),children:n(ES,{class:"w-3.5 h-3.5"})})]}),e&&n("div",{class:"mt-2 space-y-2",children:[n("div",{children:n(Y,{ref:a,type:"text",value:Gs.value,onInput:c=>Gp(c.target.value),onKeyDown:c=>{c.key==="Escape"&&!s&&t(!1)},placeholder:l("sessions.searchPlaceholder"),size:"sm",fullWidth:!0,leftElement:n(bf,{class:"w-3.5 h-3.5"}),rightElement:r?n("button",{type:"button",onClick:()=>Gp(""),class:"p-0.5 rounded text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]","aria-label":l("actions.clear"),children:n(Ar,{class:"w-3 h-3"})}):void 0})}),n("div",{class:"flex flex-wrap gap-1",children:i.map(c=>n(XS,{size:"xs",selected:Vs.value===c.value,onClick:()=>W2(c.value),children:c.label},c.value??"all"))}),n(Be,{size:"sm",checked:Js.value,onChange:K2,label:l("sessions.showCron")})]})]})}function Am(e){Oe(`/chat/${encodeURIComponent(e)}`),cf()}const e_={pinned:"sessions.pinned",today:"sessions.today",yesterday:"sessions.yesterday",thisWeek:"sessions.thisWeek",older:"sessions.older"},t_=["pinned","today","yesterday","thisWeek","older"];function n_({onRename:e,onDelete:t}){const a=B2.value,r=yd.value.length>0,o=qh(Gs.value);return r?o?n("ul",{class:"space-y-0.5",children:yd.value.map(s=>n("li",{children:n(Em,{session:s,isActive:at.value===s.key&&en.value.startsWith("/chat"),isMain:fr(s.key),onClick:()=>Am(s.key),onRename:e,onDelete:t})},s.key))}):n("div",{class:"space-y-3",children:t_.map(s=>{const i=a.get(s);return!i||i.length===0?null:n("div",{children:[s!=="pinned"&&n("h4",{class:"text-[10px] font-semibold text-[var(--color-text-muted)] uppercase tracking-wider px-2 py-1",children:l(e_[s])}),n("ul",{class:"space-y-0.5",children:i.map(u=>n("li",{children:n(Em,{session:u,isActive:at.value===u.key&&en.value.startsWith("/chat"),isMain:fr(u.key),onClick:()=>Am(u.key),onRename:e,onDelete:t})},u.key))})]},s)})}):n("p",{class:"text-sm text-[var(--color-text-muted)] px-2 py-4",children:l(o?"sessions.noResults":"sessions.noSessions")})}const Ti={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"},Du={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"},Pu={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"},Ou={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"},Nu={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"},Fu={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"},zu={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"},Qe="w-5 h-5",a_=()=>n(D4,{class:Qe,"aria-hidden":"true"}),r_=()=>n(k4,{class:Qe,"aria-hidden":"true"}),o_=()=>n(Lb,{class:Qe,"aria-hidden":"true"}),s_=()=>n(cc,{class:Qe,"aria-hidden":"true"}),l_=()=>n(Id,{class:Qe,"aria-hidden":"true"}),i_=()=>n(ge,{class:Qe,"aria-hidden":"true"}),c_=()=>n(Nn,{class:Qe,"aria-hidden":"true"}),u_=()=>n(Cb,{class:Qe,"aria-hidden":"true"}),d_=()=>n(mo,{class:Qe,"aria-hidden":"true"}),h_=()=>n(vf,{class:Qe,"aria-hidden":"true"}),f_=()=>n(H4,{class:Qe,"aria-hidden":"true"}),p_=()=>n(Dn,{class:Qe,"aria-hidden":"true"}),m_=()=>n(x4,{class:Qe,"aria-hidden":"true"}),Mm=()=>n(R4,{class:Qe,"aria-hidden":"true"}),v_=()=>n("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",class:Qe,"aria-hidden":"true",children:n("path",{fill:"currentColor",d:Ti.path})}),g_=()=>n(N4,{class:Qe,"aria-hidden":"true"}),b_=[{titleKey:"nav.sections.control",items:[{id:"overview",labelKey:"common.overview",icon:a_,requiresConnection:!0},{id:"usage",labelKey:"common.usage",icon:r_,requiresConnection:!0},{id:"channels",labelKey:"common.channels",icon:o_,requiresConnection:!0},{id:"instances",labelKey:"common.instances",icon:s_,requiresConnection:!0},{id:"sessions",labelKey:"common.sessions",icon:l_,requiresConnection:!0},{id:"cron",labelKey:"common.cronJobs",icon:i_,requiresConnection:!0}]},{titleKey:"common.agent",items:[{id:"skills",labelKey:"common.skills",icon:c_,requiresConnection:!0},{id:"agents",labelKey:"common.agents",icon:u_,requiresConnection:!0},{id:"devices",labelKey:"common.devices",icon:d_,requiresConnection:!0}]},{titleKey:"common.settings",items:[{id:"settings",labelKey:"nav.settings",icon:g_},{id:"config",labelKey:"nav.config",icon:h_,requiresConnection:!0},{id:"debug",labelKey:"common.debug",icon:f_,requiresConnection:!0},{id:"logs",labelKey:"common.logs",icon:p_,requiresConnection:!0}]},{titleKey:"nav.sections.resources",items:[{id:"docs",labelKey:"common.docs",icon:m_,external:Zl.docs},{id:"github",labelKey:"nav.github",icon:Mm,external:Zl.github},{id:"github-openclaw",labelKey:"nav.githubOpenClaw",icon:Mm,external:Zl.githubOpenClaw},{id:"discord",labelKey:"nav.discord",icon:v_,external:Zl.discord}]}],ax="cove:nav-sections";function rx(e){try{const t=`${ax}-${e}`,a=localStorage.getItem(t);return a?JSON.parse(a):{}}catch{return{}}}function x_(e,t,a){try{const r=`${ax}-${e}`,o=rx(e);o[t]=a,localStorage.setItem(r,JSON.stringify(o))}catch{}}function y_({item:e}){const t=`/${e.id}`,a=Fc(()=>!e.external&&(en.value===t||e.id==="chat"&&en.value.startsWith("/chat"))),r=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(r,{})}),l(e.labelKey),n(SS,{class:"w-3 h-3 ml-auto text-[var(--color-text-muted)]"})]}):n("button",{type:"button",onClick:()=>{en.value=t,Oe(t),cf()},class:`
171
171
  w-full flex items-center gap-3 px-3.5 py-2.5 rounded-xl text-sm
172
172
  transition-all duration-200 ease-out
173
173
  ${a.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)]"}
174
- `,children:[n("span",{class:"w-5 h-5 flex-shrink-0","aria-hidden":"true",children:n(r,{})}),l(e.labelKey)]})}function y_({section:e,mode:t,defaultOpen:a=!1}){const o=rx(t)[e.titleKey]??a,s=X(o),i=e.items;return i.length===0?null:n("div",{class:"border-b border-[var(--color-border)] last:border-b-0",children:[n("button",{type:"button",onClick:()=>{const u=!s.value;s.value=u,b_(t,e.titleKey,u)},"aria-expanded":s.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:l(e.titleKey)}),n(Po,{open:s.value})]}),s.value&&n("ul",{id:`nav-section-${e.titleKey}`,class:"px-3 pb-2 space-y-0.5",role:"list",children:i.map(u=>n("li",{children:n(x_,{item:u})},u.id))})]})}function ox({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:g_.map(a=>n(y_,{section:a,mode:t,defaultOpen:e},`${t}-${a.titleKey}`))})}const Qt=m(window.location.pathname.replace(/\/+$/,"")||"/");function w_({isStreaming:e}){const t=Qt.value==="/"||Qt.value.startsWith("/chat");return n("button",{type:"button",onClick:()=>{Qt.value="/chat",Oe("/chat"),df()},class:`w-full flex items-center gap-3 px-3.5 py-2.5 rounded-xl text-sm transition-all duration-200 ease-out ${t?"bg-[var(--color-accent)]/10 text-[var(--color-accent)] shadow-soft-sm":"hover:bg-[var(--color-bg-primary)] hover:shadow-soft-sm text-[var(--color-text-secondary)]"} ${e?"ai-glow":""}`,children:[e?n(te,{size:"xs",class:"flex-shrink-0 text-[var(--color-accent)]"}):n(Pb,{class:"w-5 h-5 flex-shrink-0","aria-hidden":"true"}),l("nav.chat")]})}function k_(){const[e,t]=U(null),[a,r]=U(null),o=async(u,d)=>{try{await N("sessions.patch",{key:u.key,label:d}),Zh(u.key,{label:d})}catch(h){throw M.ui.error("Failed to rename session:",h),h}},s=async u=>{try{await N("sessions.delete",{key:u.key}),await V2(u.key),In.value===u.key&&Oe("/chat")}catch(d){throw M.ui.error("Failed to delete session:",d),d}},i=()=>{ot.value.useDefaults?c(ot.value.defaultAgentId):Lu.value=!0},c=async u=>{const d=crypto.randomUUID(),h=`agent:${u}:chat:${d}`;try{await N("sessions.patch",{key:h,label:l("common.newChat")}),await Wc(),Oe(`/chat/${encodeURIComponent(h)}`)}catch(f){M.ui.error("Failed to create new chat:",f)}};return n("div",{class:"h-full flex flex-col",children:[yl.value?n(H,{children:[n("div",{class:"p-3",children:n(P,{variant:"primary",disabled:!D.value,onClick:i,fullWidth:!0,icon:n(Jb,{}),children:l("common.newChat")})}),n("div",{class:"flex-1 overflow-y-auto px-3 pb-3","data-tour":"sessions",children:[n(XS,{}),n(t_,{onRename:t,onDelete:r})]}),n(ox,{})]}):n(S_,{}),n(KS,{session:e,onClose:()=>t(null),onRename:o}),n(qS,{session:a,onClose:()=>r(null),onDelete:s}),n(GS,{open:Lu.value,onClose:()=>Lu.value=!1,onCreate:c})]})}function S_(){de.value;const e=Ye.value,t=e?!!ef(e):!1;return n("div",{class:"flex-1 overflow-y-auto",children:[n("div",{class:"px-3 py-2",children:n(w_,{isStreaming:t})}),n(ox,{expanded:!0})]})}const sx="cove:canvasPanel";function __(){try{const e=localStorage.getItem(sx);if(e){const t=JSON.parse(e),a=window.innerWidth-100,r=window.innerHeight-50;return(t.x>a||t.x<0)&&(t.x=100),(t.y>r||t.y<0)&&(t.y=100),t.width>window.innerWidth&&(t.width=400),t.height>window.innerHeight&&(t.height=350),t}}catch{}return null}const Il=__(),Hr=m(Il?.dockPosition??"floating"),Od=m(Il?.x??100),Nd=m(Il?.y??100),Zr=m(Il?.width??400),fc=m(Il?.height??350),lx=m(!1),PI=m("floating"),OI=m(!1);Se(()=>{const e={dockPosition:Hr.value,x:Od.value,y:Nd.value,width:Zr.value,height:fc.value};localStorage.setItem(sx,JSON.stringify(e))});const NI=280,FI=200,zI=.5,UI=.6,jI=40,C_=44,HI=1024,BI=K(()=>{if(lx.value)return{width:"auto",height:`${C_}px`,left:`${Od.value}px`,top:`${Nd.value}px`,borderRadius:"9999px"};switch(Hr.value){case"left":return{left:"0",top:"0",width:`${Zr.value}px`,height:"100%",borderRadius:"0 12px 12px 0"};case"right":return{right:"0",top:"0",width:`${Zr.value}px`,height:"100%",borderRadius:"12px 0 0 12px"};case"top":return{left:"0",top:"var(--topbar-height)",width:"100%",height:`${fc.value}px`,borderRadius:"0 0 12px 12px"};default:return{left:`${Od.value}px`,top:`${Nd.value}px`,width:`${Zr.value}px`,height:`${fc.value}px`,borderRadius:"12px"}}});function WI(e){if("touches"in e){const t=e.touches[0]||e.changedTouches[0];return{x:t.clientX,y:t.clientY}}return{x:e.clientX,y:e.clientY}}function T_({children:e}){u4();const t=Js.value&&!lx.value&&Hr.value!=="floating",a={};t&&(Hr.value==="left"?a.paddingLeft=`${Zr.value}px`:Hr.value==="right"?a.paddingRight=`${Zr.value}px`:Hr.value==="top"&&(a.paddingTop=`${fc.value}px`));const r=o=>{const s=Math.max(r4,Math.min(o4,Ti.value+o));Ti.value=s};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($S,{}),n(OS,{}),n("div",{class:"flex-1 flex overflow-hidden",style:a,children:[(Nt.value||Pt.value)&&n("div",{class:"fixed inset-0 bg-black z-40 lg:hidden",style:{opacity:Pt.value?(na.value??0)/Ga*.5:.5,transition:Pt.value?"none":"opacity 200ms ease-out"},onClick:()=>Nt.value=!1,"aria-hidden":"true"}),n("aside",{style:{"--sidebar-width":`${Ti.value}px`,transform:Pt.value?`translateX(${(na.value??0)-Ga}px)`:void 0},class:`
174
+ `,children:[n("span",{class:"w-5 h-5 flex-shrink-0","aria-hidden":"true",children:n(r,{})}),l(e.labelKey)]})}function w_({section:e,mode:t,defaultOpen:a=!1}){const o=rx(t)[e.titleKey]??a,s=X(o),i=e.items;return i.length===0?null:n("div",{class:"border-b border-[var(--color-border)] last:border-b-0",children:[n("button",{type:"button",onClick:()=>{const u=!s.value;s.value=u,x_(t,e.titleKey,u)},"aria-expanded":s.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:l(e.titleKey)}),n(Po,{open:s.value})]}),s.value&&n("ul",{id:`nav-section-${e.titleKey}`,class:"px-3 pb-2 space-y-0.5",role:"list",children:i.map(u=>n("li",{children:n(y_,{item:u})},u.id))})]})}function ox({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:b_.map(a=>n(w_,{section:a,mode:t,defaultOpen:e},`${t}-${a.titleKey}`))})}const en=m(window.location.pathname.replace(/\/+$/,"")||"/");function k_({isStreaming:e}){const t=en.value==="/"||en.value.startsWith("/chat");return n("button",{type:"button",onClick:()=>{en.value="/chat",Oe("/chat"),cf()},class:`w-full flex items-center gap-3 px-3.5 py-2.5 rounded-xl text-sm transition-all duration-200 ease-out ${t?"bg-[var(--color-accent)]/10 text-[var(--color-accent)] shadow-soft-sm":"hover:bg-[var(--color-bg-primary)] hover:shadow-soft-sm text-[var(--color-text-secondary)]"} ${e?"ai-glow":""}`,children:[e?n(te,{size:"xs",class:"flex-shrink-0 text-[var(--color-accent)]"}):n(Pb,{class:"w-5 h-5 flex-shrink-0","aria-hidden":"true"}),l("nav.chat")]})}function S_(){const[e,t]=U(null),[a,r]=U(null),o=async(u,d)=>{try{await N("sessions.patch",{key:u.key,label:d}),Jh(u.key,{label:d})}catch(h){throw M.ui.error("Failed to rename session:",h),h}},s=async u=>{try{await N("sessions.delete",{key:u.key}),await G2(u.key),Rn.value===u.key&&Oe("/chat")}catch(d){throw M.ui.error("Failed to delete session:",d),d}},i=()=>{rt.value.useDefaults?c(rt.value.defaultAgentId):Mu.value=!0},c=async u=>{const d=crypto.randomUUID(),h=`agent:${u}:chat:${d}`;try{await N("sessions.patch",{key:h,label:l("common.newChat")}),await jc(),Oe(`/chat/${encodeURIComponent(h)}`)}catch(f){M.ui.error("Failed to create new chat:",f)}};return n("div",{class:"h-full flex flex-col",children:[wl.value?n(H,{children:[n("div",{class:"p-3",children:n(P,{variant:"primary",disabled:!D.value,onClick:i,fullWidth:!0,icon:n(Jb,{}),children:l("common.newChat")})}),n("div",{class:"flex-1 overflow-y-auto px-3 pb-3","data-tour":"sessions",children:[n(QS,{}),n(n_,{onRename:t,onDelete:r})]}),n(ox,{})]}):n(__,{}),n(qS,{session:e,onClose:()=>t(null),onRename:o}),n(VS,{session:a,onClose:()=>r(null),onDelete:s}),n(JS,{open:Mu.value,onClose:()=>Mu.value=!1,onCreate:c})]})}function __(){de.value;const e=Je.value,t=e?!!Xh(e):!1;return n("div",{class:"flex-1 overflow-y-auto",children:[n("div",{class:"px-3 py-2",children:n(k_,{isStreaming:t})}),n(ox,{expanded:!0})]})}const sx="cove:canvasPanel";function C_(){try{const e=localStorage.getItem(sx);if(e){const t=JSON.parse(e),a=window.innerWidth-100,r=window.innerHeight-50;return(t.x>a||t.x<0)&&(t.x=100),(t.y>r||t.y<0)&&(t.y=100),t.width>window.innerWidth&&(t.width=400),t.height>window.innerHeight&&(t.height=350),t}}catch{}return null}const Il=C_(),Hr=m(Il?.dockPosition??"floating"),$d=m(Il?.x??100),Dd=m(Il?.y??100),Zr=m(Il?.width??400),dc=m(Il?.height??350),lx=m(!1),UI=m("floating"),jI=m(!1);_e(()=>{const e={dockPosition:Hr.value,x:$d.value,y:Dd.value,width:Zr.value,height:dc.value};localStorage.setItem(sx,JSON.stringify(e))});const HI=280,BI=200,WI=.5,KI=.6,qI=40,T_=44,VI=1024,GI=K(()=>{if(lx.value)return{width:"auto",height:`${T_}px`,left:`${$d.value}px`,top:`${Dd.value}px`,borderRadius:"9999px"};switch(Hr.value){case"left":return{left:"0",top:"0",width:`${Zr.value}px`,height:"100%",borderRadius:"0 12px 12px 0"};case"right":return{right:"0",top:"0",width:`${Zr.value}px`,height:"100%",borderRadius:"12px 0 0 12px"};case"top":return{left:"0",top:"var(--topbar-height)",width:"100%",height:`${dc.value}px`,borderRadius:"0 0 12px 12px"};default:return{left:`${$d.value}px`,top:`${Dd.value}px`,width:`${Zr.value}px`,height:`${dc.value}px`,borderRadius:"12px"}}});function JI(e){if("touches"in e){const t=e.touches[0]||e.changedTouches[0];return{x:t.clientX,y:t.clientY}}return{x:e.clientX,y:e.clientY}}function E_({children:e}){d4();const t=Ys.value&&!lx.value&&Hr.value!=="floating",a={};t&&(Hr.value==="left"?a.paddingLeft=`${Zr.value}px`:Hr.value==="right"?a.paddingRight=`${Zr.value}px`:Hr.value==="top"&&(a.paddingTop=`${dc.value}px`));const r=o=>{const s=Math.max(o4,Math.min(s4,Ci.value+o));Ci.value=s};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(DS,{}),n(NS,{}),n("div",{class:"flex-1 flex overflow-hidden",style:a,children:[(zt.value||Nt.value)&&n("div",{class:"fixed inset-0 bg-black z-40 lg:hidden",style:{opacity:Nt.value?(aa.value??0)/Ga*.5:.5,transition:Nt.value?"none":"opacity 200ms ease-out"},onClick:()=>zt.value=!1,"aria-hidden":"true"}),n("aside",{style:{"--sidebar-width":`${Ci.value}px`,transform:Nt.value?`translateX(${(aa.value??0)-Ga}px)`:void 0},class:`
175
175
  fixed inset-y-0 left-0 z-50 w-72 p-2 pr-0 pt-16
176
176
  lg:bg-[var(--color-bg-secondary)]
177
- ${Pt.value?"":"transition-transform duration-200 ease-out"}
178
- ${!Pt.value&&(Nt.value?"translate-x-0":"-translate-x-full")}
177
+ ${Nt.value?"":"transition-transform duration-200 ease-out"}
178
+ ${!Nt.value&&(zt.value?"translate-x-0":"-translate-x-full")}
179
179
  lg:relative lg:inset-auto lg:z-auto lg:pt-2 lg:translate-x-0
180
180
  lg:w-[var(--sidebar-width)]
181
- ${!Nt.value&&"lg:w-0 lg:p-0"}
182
- ${Ru.value?"lg:transition-none":""}
183
- `,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(k_,{})})}),Nt.value&&n("div",{class:"hidden lg:flex items-center py-2",children:n(d4,{direction:"horizontal",onResizeStart:()=>Ru.value=!0,onResize:r,onResizeEnd:()=>Ru.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 mo=m([]);let E_=0;function ei(e,t="info",a=5e3){const r=`toast-${++E_}`;return mo.value=[...mo.value,{id:r,type:t,message:e,duration:a}].slice(-5),r}function A_(e){mo.value=mo.value.filter(t=>t.id!==e)}const V={success:(e,t)=>ei(e,"success",t),error:(e,t)=>ei(e,"error",t),warning:(e,t)=>ei(e,"warning",t),info:(e,t)=>ei(e,"info",t)},M_={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 I_({id:e,type:t,message:a,duration:r=5e3,onDismiss:o}){const s=M_[t];return R(()=>{if(r<=0)return;const i=setTimeout(()=>{o(e)},r);return()=>clearTimeout(i)},[e,r,o]),n("div",{role:"alert","aria-live":"polite",class:`
181
+ ${!zt.value&&"lg:w-0 lg:p-0"}
182
+ ${Au.value?"lg:transition-none":""}
183
+ `,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(S_,{})})}),zt.value&&n("div",{class:"hidden lg:flex items-center py-2",children:n(h4,{direction:"horizontal",onResizeStart:()=>Au.value=!0,onResize:r,onResizeEnd:()=>Au.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 vo=m([]);let A_=0;function ei(e,t="info",a=5e3){const r=`toast-${++A_}`;return vo.value=[...vo.value,{id:r,type:t,message:e,duration:a}].slice(-5),r}function M_(e){vo.value=vo.value.filter(t=>t.id!==e)}const V={success:(e,t)=>ei(e,"success",t),error:(e,t)=>ei(e,"error",t),warning:(e,t)=>ei(e,"warning",t),info:(e,t)=>ei(e,"info",t)},I_={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 R_({id:e,type:t,message:a,duration:r=5e3,onDismiss:o}){const s=I_[t];return R(()=>{if(r<=0)return;const i=setTimeout(()=>{o(e)},r);return()=>clearTimeout(i)},[e,r,o]),n("div",{role:"alert","aria-live":"polite",class:`
184
184
  flex items-start gap-3 p-4
185
185
  rounded-xl border shadow-soft-lg
186
186
  backdrop-blur-sm
187
187
  ${s.bg} ${s.border}
188
188
  animate-slide-in
189
- `,children:[n("span",{class:`flex-shrink-0 ${s.icon}`,"aria-hidden":"true",children:n($_,{type:t})}),n("p",{class:"flex-1 text-sm text-[var(--color-text-primary)]",children:a}),n(q,{icon:n(Ar,{class:"w-4 h-4"}),label:l("actions.close"),variant:"ghost",size:"sm",onClick:()=>o(e)})]})}const R_={"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 L_({position:e="top-right"}){return mo.value.length===0?null:n("div",{class:`fixed z-50 flex flex-col gap-2 w-full max-w-sm ${R_[e]}`,"aria-label":"Notifications",children:mo.value.map(t=>n(I_,{...t,onDismiss:A_},t.id))})}function $_({type:e}){const t="w-5 h-5";switch(e){case"success":return n(on,{class:t,"aria-hidden":"true"});case"error":return n(Ma,{class:t,"aria-hidden":"true"});case"warning":return n(Aa,{class:t,"aria-hidden":"true"});default:return n(Al,{class:t,"aria-hidden":"true"})}}class Rm extends At{constructor(t){super(t),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,a){this.setState({errorInfo:a}),this.props.onError?.(t,a),M.ui.error("ErrorBoundary caught error:",t),M.ui.error("Component stack:",a.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(D_,{error:this.state.error,errorInfo:this.state.errorInfo,onRetry:this.handleRetry}):this.props.children}}function D_({error:e,errorInfo:t,onRetry:a}){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:l("errors.generic")}),n("p",{class:"text-[var(--color-text-muted)] mb-6",children:e?.message||l("errors.unknown")}),n(P,{onClick:a,variant:"primary",children:l("actions.retry")}),!1]})})}const En=m([]),Ys=m(new Map),P_=300*1e3,Fd=new Map;function O_(){const e=Date.now(),t=[];for(const[a,r]of Fd)e-r>P_&&t.push(a);if(t.length>0){const a=new Map(Ys.value);for(const r of t)a.delete(r),Fd.delete(r);Ys.value=a,M.exec.debug(`Pruned ${t.length} old resolved approval(s)`)}}const pc=m(!1),mc=m(null);function N_(e){const t={request:e,expiresAtMs:e.expiresAtMs,receivedAt:Date.now()};En.value=[...En.value,t],M.exec.info(`Exec approval queued: ${e.command} (${En.value.length} pending)`)}function F_(e){En.value=En.value.filter(t=>t.request.requestId!==e)}function z_(){const e=Date.now(),t=En.value.length;En.value=En.value.filter(r=>r.expiresAtMs>e);const a=t-En.value.length;a>0&&M.exec.info(`Pruned ${a} expired exec approval(s)`)}async function U_(e,t){pc.value=!0,mc.value=null;try{await N("exec.approval.resolve",{id:e,decision:t}),F_(e);const a=new Map(Ys.value);a.set(e,t),Ys.value=a,Fd.set(e,Date.now()),O_(),M.exec.info(`Exec ${t} (direct): id=${e}`)}catch(a){const r=a instanceof Error?a.message:"Failed to send decision";throw mc.value=r,M.exec.error(`Exec approval error: ${r}`),a}finally{pc.value=!1}}let Ai=null,Mi=null;function j_(){ix(),Ai=_l(e=>{if(e.event==="exec.approval.requested"&&e.payload){const t=e.payload,a={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};a.expiresAtMs>Date.now()?N_(a):M.exec.debug("Ignoring already-expired approval request")}}),Mi=setInterval(z_,1e3),M.exec.info("Exec approval system initialized")}function ix(){Ai&&(Ai(),Ai=null),Mi&&(clearInterval(Mi),Mi=null),En.value=[],pc.value=!1,mc.value=null}let Lm=!1;D.subscribe(e=>{Lm&&!e&&ix(),Lm=e});const os=new Map;let $m=!1;function H_(){$m||($m=!0,window.addEventListener("popstate",()=>{const e=new URLSearchParams(window.location.search);for(const[t,a]of os)a.signal.value=e.get(t)}))}function Dm(e,t){const a=new URL(window.location.href);t===null||t===""?a.searchParams.delete(e):a.searchParams.set(e,t),window.history.replaceState({},"",a.toString())}function he(e,t={}){const{defaultValue:a=null,ready:r=!0}=t;H_();const o=xe(()=>m(!1),[e]),s=xe(()=>{const c=os.get(e);if(c)return c.refCount++,c.signal;const d=new URLSearchParams(window.location.search).get(e)??a,h=m(d);return os.set(e,{signal:h,refCount:1}),h},[e]);R(()=>()=>{const c=os.get(e);c&&(c.refCount--,c.refCount<=0&&os.delete(e))},[e]),R(()=>{r&&!o.value&&(o.value=!0)},[r]),R(()=>{if(!r)return;const u=new URLSearchParams(window.location.search).get(e);s.value!==u&&Dm(e,s.value)},[e,s.value,r]);const i=xe(()=>c=>{s.value=c,Dm(e,c)},[e,s]);return[s,i,o]}function ru(){window.history.pushState({},"",window.location.href)}function Oo(e,t,a={}){const{pushHistory:r=!1}=a,o=new Set(e.value),s=o.has(t);return s?o.delete(t):o.add(t),e.value=o,r&&!s&&ru(),!s}function Zs(e,t={}){const{parse:a=h=>h,serialize:r=String,...o}=t,[s,i,c]=he(e,o),u=xe(()=>{const h=s.value?s.value.split(",").map(a).filter(Boolean):[];return m(new Set(h))},[e]);R(()=>{const h=s.value?s.value.split(",").map(a).filter(Boolean):[];u.value=new Set(h)},[s.value]);const d=xe(()=>h=>{u.value=h;const f=Array.from(h).map(r);i(f.length>0?f.join(","):null)},[i]);return[u,d,c]}function Mr(e,t){R(()=>{t(e.value||null)},[e.value])}function He(e,t,a){R(()=>{e.value&&(t.value=a(e.value))},[])}function Rn(e,t,a){R(()=>{t(e.value===a?null:e.value)},[e.value])}var Pm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function B_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bu={exports:{}},Om;function W_(){return Om||(Om=1,(function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var a=(function(r){var o=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,s=0,i={},c={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function g(y){return y instanceof u?new u(y.type,g(y.content),y.alias):Array.isArray(y)?y.map(g):y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(g){return Object.prototype.toString.call(g).slice(8,-1)},objId:function(g){return g.__id||Object.defineProperty(g,"__id",{value:++s}),g.__id},clone:function g(y,E){E=E||{};var x,S;switch(c.util.type(y)){case"Object":if(S=c.util.objId(y),E[S])return E[S];x={},E[S]=x;for(var k in y)y.hasOwnProperty(k)&&(x[k]=g(y[k],E));return x;case"Array":return S=c.util.objId(y),E[S]?E[S]:(x=[],E[S]=x,y.forEach(function(I,A){x[A]=g(I,E)}),x);default:return y}},getLanguage:function(g){for(;g;){var y=o.exec(g.className);if(y)return y[1].toLowerCase();g=g.parentElement}return"none"},setLanguage:function(g,y){g.className=g.className.replace(RegExp(o,"gi"),""),g.classList.add("language-"+y)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(x){var g=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(x.stack)||[])[1];if(g){var y=document.getElementsByTagName("script");for(var E in y)if(y[E].src==g)return y[E]}return null}},isActive:function(g,y,E){for(var x="no-"+y;g;){var S=g.classList;if(S.contains(y))return!0;if(S.contains(x))return!1;g=g.parentElement}return!!E}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(g,y){var E=c.util.clone(c.languages[g]);for(var x in y)E[x]=y[x];return E},insertBefore:function(g,y,E,x){x=x||c.languages;var S=x[g],k={};for(var I in S)if(S.hasOwnProperty(I)){if(I==y)for(var A in E)E.hasOwnProperty(A)&&(k[A]=E[A]);E.hasOwnProperty(I)||(k[I]=S[I])}var O=x[g];return x[g]=k,c.languages.DFS(c.languages,function(z,se){se===O&&z!=g&&(this[z]=k)}),k},DFS:function g(y,E,x,S){S=S||{};var k=c.util.objId;for(var I in y)if(y.hasOwnProperty(I)){E.call(y,I,y[I],x||I);var A=y[I],O=c.util.type(A);O==="Object"&&!S[k(A)]?(S[k(A)]=!0,g(A,E,null,S)):O==="Array"&&!S[k(A)]&&(S[k(A)]=!0,g(A,E,I,S))}}},plugins:{},highlightAll:function(g,y){c.highlightAllUnder(document,g,y)},highlightAllUnder:function(g,y,E){var x={callback:E,container:g,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};c.hooks.run("before-highlightall",x),x.elements=Array.prototype.slice.apply(x.container.querySelectorAll(x.selector)),c.hooks.run("before-all-elements-highlight",x);for(var S=0,k;k=x.elements[S++];)c.highlightElement(k,y===!0,x.callback)},highlightElement:function(g,y,E){var x=c.util.getLanguage(g),S=c.languages[x];c.util.setLanguage(g,x);var k=g.parentElement;k&&k.nodeName.toLowerCase()==="pre"&&c.util.setLanguage(k,x);var I=g.textContent,A={element:g,language:x,grammar:S,code:I};function O(se){A.highlightedCode=se,c.hooks.run("before-insert",A),A.element.innerHTML=A.highlightedCode,c.hooks.run("after-highlight",A),c.hooks.run("complete",A),E&&E.call(A.element)}if(c.hooks.run("before-sanity-check",A),k=A.element.parentElement,k&&k.nodeName.toLowerCase()==="pre"&&!k.hasAttribute("tabindex")&&k.setAttribute("tabindex","0"),!A.code){c.hooks.run("complete",A),E&&E.call(A.element);return}if(c.hooks.run("before-highlight",A),!A.grammar){O(c.util.encode(A.code));return}if(y&&r.Worker){var z=new Worker(c.filename);z.onmessage=function(se){O(se.data)},z.postMessage(JSON.stringify({language:A.language,code:A.code,immediateClose:!0}))}else O(c.highlight(A.code,A.grammar,A.language))},highlight:function(g,y,E){var x={code:g,grammar:y,language:E};if(c.hooks.run("before-tokenize",x),!x.grammar)throw new Error('The language "'+x.language+'" has no grammar.');return x.tokens=c.tokenize(x.code,x.grammar),c.hooks.run("after-tokenize",x),u.stringify(c.util.encode(x.tokens),x.language)},tokenize:function(g,y){var E=y.rest;if(E){for(var x in E)y[x]=E[x];delete y.rest}var S=new f;return p(S,S.head,g),h(g,S,y,S.head,0),w(S)},hooks:{all:{},add:function(g,y){var E=c.hooks.all;E[g]=E[g]||[],E[g].push(y)},run:function(g,y){var E=c.hooks.all[g];if(!(!E||!E.length))for(var x=0,S;S=E[x++];)S(y)}},Token:u};r.Prism=c;function u(g,y,E,x){this.type=g,this.content=y,this.alias=E,this.length=(x||"").length|0}u.stringify=function g(y,E){if(typeof y=="string")return y;if(Array.isArray(y)){var x="";return y.forEach(function(O){x+=g(O,E)}),x}var S={type:y.type,content:g(y.content,E),tag:"span",classes:["token",y.type],attributes:{},language:E},k=y.alias;k&&(Array.isArray(k)?Array.prototype.push.apply(S.classes,k):S.classes.push(k)),c.hooks.run("wrap",S);var I="";for(var A in S.attributes)I+=" "+A+'="'+(S.attributes[A]||"").replace(/"/g,"&quot;")+'"';return"<"+S.tag+' class="'+S.classes.join(" ")+'"'+I+">"+S.content+"</"+S.tag+">"};function d(g,y,E,x){g.lastIndex=y;var S=g.exec(E);if(S&&x&&S[1]){var k=S[1].length;S.index+=k,S[0]=S[0].slice(k)}return S}function h(g,y,E,x,S,k){for(var I in E)if(!(!E.hasOwnProperty(I)||!E[I])){var A=E[I];A=Array.isArray(A)?A:[A];for(var O=0;O<A.length;++O){if(k&&k.cause==I+","+O)return;var z=A[O],se=z.inside,Fe=!!z.lookbehind,tt=!!z.greedy,Re=z.alias;if(tt&&!z.pattern.global){var Gn=z.pattern.toString().match(/[imsuy]*$/)[0];z.pattern=RegExp(z.pattern.source,Gn+"g")}for(var Jn=z.pattern||z,be=x.next,W=S;be!==y.tail&&!(k&&W>=k.reach);W+=be.value.length,be=be.next){var ce=be.value;if(y.length>g.length)return;if(!(ce instanceof u)){var me=1,ht;if(tt){if(ht=d(Jn,W,g,Fe),!ht||ht.index>=g.length)break;var ln=ht.index,Le=ht.index+ht[0].length,Bt=W;for(Bt+=be.value.length;ln>=Bt;)be=be.next,Bt+=be.value.length;if(Bt-=be.value.length,W=Bt,be.value instanceof u)continue;for(var ue=be;ue!==y.tail&&(Bt<Le||typeof ue.value=="string");ue=ue.next)me++,Bt+=ue.value.length;me--,ce=g.slice(W,Bt),ht.index-=W}else if(ht=d(Jn,0,ce,Fe),!ht)continue;var ln=ht.index,Yn=ht[0],cn=ce.slice(0,ln),Uo=ce.slice(ln+Yn.length),Ra=W+ce.length;k&&Ra>k.reach&&(k.reach=Ra);var La=be.prev;cn&&(La=p(y,La,cn),W+=cn.length),v(y,La,me);var Nl=new u(I,se?c.tokenize(Yn,se):Yn,Re,Yn);if(be=p(y,La,Nl),Uo&&p(y,be,Uo),me>1){var un={cause:I+","+O,reach:Ra};h(g,y,E,be.prev,W,un),k&&un.reach>k.reach&&(k.reach=un.reach)}}}}}}function f(){var g={value:null,prev:null,next:null},y={value:null,prev:g,next:null};g.next=y,this.head=g,this.tail=y,this.length=0}function p(g,y,E){var x=y.next,S={value:E,prev:y,next:x};return y.next=S,x.prev=S,g.length++,S}function v(g,y,E){for(var x=y.next,S=0;S<E&&x!==g.tail;S++)x=x.next;y.next=x,x.prev=y,g.length-=S}function w(g){for(var y=[],E=g.head.next;E!==g.tail;)y.push(E.value),E=E.next;return y}if(!r.document)return r.addEventListener&&(c.disableWorkerMessageHandler||r.addEventListener("message",function(g){var y=JSON.parse(g.data),E=y.language,x=y.code,S=y.immediateClose;r.postMessage(c.highlight(x,c.languages[E],E)),S&&r.close()},!1)),c;var C=c.util.currentScript();C&&(c.filename=C.src,C.hasAttribute("data-manual")&&(c.manual=!0));function T(){c.manual||c.highlightAll()}if(!c.manual){var b=document.readyState;b==="loading"||b==="interactive"&&C&&C.defer?document.addEventListener("DOMContentLoaded",T):window.requestAnimationFrame?window.requestAnimationFrame(T):window.setTimeout(T,16)}return c})(t);e.exports&&(e.exports=a),typeof Pm<"u"&&(Pm.Prism=a),a.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]},a.languages.markup.tag.inside["attr-value"].inside.entity=a.languages.markup.entity,a.languages.markup.doctype.inside["internal-subset"].inside=a.languages.markup,a.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&amp;/,"&"))}),Object.defineProperty(a.languages.markup.tag,"addInlined",{value:function(o,s){var i={};i["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:a.languages[s]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var c={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};c["language-"+s]={pattern:/[\s\S]+/,inside:a.languages[s]};var u={};u[o]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return o}),"i"),lookbehind:!0,greedy:!0,inside:c},a.languages.insertBefore("markup","cdata",u)}}),Object.defineProperty(a.languages.markup.tag,"addAttribute",{value:function(r,o){a.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\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:a.languages[o]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),a.languages.html=a.languages.markup,a.languages.mathml=a.languages.markup,a.languages.svg=a.languages.markup,a.languages.xml=a.languages.extend("markup",{}),a.languages.ssml=a.languages.xml,a.languages.atom=a.languages.xml,a.languages.rss=a.languages.xml,(function(r){var o=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.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:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var s=r.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(a),a.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:/[{}[\];(),.:]/},a.languages.javascript=a.languages.extend("clike",{"class-name":[a.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}|\?\?=?|\?\.?|[~:]/}),a.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,a.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:a.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:a.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:a.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:a.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:a.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),a.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:a.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"}}),a.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),a.languages.markup&&(a.languages.markup.tag.addInlined("script","javascript"),a.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")),a.languages.js=a.languages.javascript,(function(){if(typeof a>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading…",o=function(C,T){return"✖ Error "+C+" while fetching file: "+T},s="✖ Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},c="data-src-status",u="loading",d="loaded",h="failed",f="pre[data-src]:not(["+c+'="'+d+'"]):not(['+c+'="'+u+'"])';function p(C,T,b){var g=new XMLHttpRequest;g.open("GET",C,!0),g.onreadystatechange=function(){g.readyState==4&&(g.status<400&&g.responseText?T(g.responseText):g.status>=400?b(o(g.status,g.statusText)):b(s))},g.send(null)}function v(C){var T=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(C||"");if(T){var b=Number(T[1]),g=T[2],y=T[3];return g?y?[b,Number(y)]:[b,void 0]:[b,b]}}a.hooks.add("before-highlightall",function(C){C.selector+=", "+f}),a.hooks.add("before-sanity-check",function(C){var T=C.element;if(T.matches(f)){C.code="",T.setAttribute(c,u);var b=T.appendChild(document.createElement("CODE"));b.textContent=r;var g=T.getAttribute("data-src"),y=C.language;if(y==="none"){var E=(/\.(\w+)$/.exec(g)||[,"none"])[1];y=i[E]||E}a.util.setLanguage(b,y),a.util.setLanguage(T,y);var x=a.plugins.autoloader;x&&x.loadLanguages(y),p(g,function(S){T.setAttribute(c,d);var k=v(T.getAttribute("data-range"));if(k){var I=S.split(/\r\n?|\n/g),A=k[0],O=k[1]==null?I.length:k[1];A<0&&(A+=I.length),A=Math.max(0,Math.min(A-1,I.length)),O<0&&(O+=I.length),O=Math.max(0,Math.min(O,I.length)),S=I.slice(A,O).join(`
190
- `),T.hasAttribute("data-start")||T.setAttribute("data-start",String(A+1))}b.textContent=S,a.highlightElement(b)},function(S){T.setAttribute(c,h),b.textContent=S})}}),a.plugins.fileHighlight={highlight:function(T){for(var b=(T||document).querySelectorAll(f),g=0,y;y=b[g++];)a.highlightElement(y)}};var w=!1;a.fileHighlight=function(){w||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),w=!0),a.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(Bu)),Bu.exports}var K_=W_();const en=B_(K_);var Nm={},Fm;function q_(){return Fm||(Fm=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)),Nm}q_();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),a=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,o=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function s(u,d){return u=u.replace(/<S>/g,function(){return a}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return o}),RegExp(u,d)}o=s(o).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=s(/<\/?(?:[\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:s(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:s(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var i=function(u){return u?typeof u=="string"?u:typeof u.content=="string"?u.content:u.content.map(i).join(""):""},c=function(u){for(var d=[],h=0;h<u.length;h++){var f=u[h],p=!1;if(typeof f!="string"&&(f.type==="tag"&&f.content[0]&&f.content[0].type==="tag"?f.content[0].content[0].content==="</"?d.length>0&&d[d.length-1].tagName===i(f.content[0].content[1])&&d.pop():f.content[f.content.length-1].content==="/>"||d.push({tagName:i(f.content[0].content[1]),openedBraces:0}):d.length>0&&f.type==="punctuation"&&f.content==="{"?d[d.length-1].openedBraces++:d.length>0&&d[d.length-1].openedBraces>0&&f.type==="punctuation"&&f.content==="}"?d[d.length-1].openedBraces--:p=!0),(p||typeof f=="string")&&d.length>0&&d[d.length-1].openedBraces===0){var v=i(f);h<u.length-1&&(typeof u[h+1]=="string"||u[h+1].type==="plain-text")&&(v+=i(u[h+1]),u.splice(h+1,1)),h>0&&(typeof u[h-1]=="string"||u[h-1].type==="plain-text")&&(v=i(u[h-1])+v,u.splice(h-1,1),h--),u[h]=new e.Token("plain-text",v,null,v)}f.content&&typeof f.content!="string"&&c(f.content)}};e.hooks.add("after-tokenize",function(u){u.language!=="jsx"&&u.language!=="tsx"||c(u.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 a=e.languages.tsx.tag;a.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+a.pattern.source+")",a.pattern.flags),a.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",a={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:a,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:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:a}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.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}},a.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"],s=r.variable[1].inside,i=0;i<o.length;i++)s[o[i]]=e.languages.bash[o[i]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism);var zm={},Um;function V_(){return Um||(Um=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:/![sra](?=[:}]$)/,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),zm}V_();var jm={},Hm;function G_(){return Hm||(Hm=1,(function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,a=0;a<2;a++)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)),jm}G_();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[\]{},]+/,a=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+a.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+a.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}),s=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(c,u){u=(u||"").replace(/m/g,"")+"m";var d=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return c});return RegExp(d,u)}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 r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+o+"|"+s+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(s),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:a,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml})(Prism);(function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function a(h){return h=h.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+h+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),s=/\|?[ \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+s+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+s+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+s+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(r),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:a(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:a(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:a(/(~~?)(?:(?!~)<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:a(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(h){["url","bold","italic","strike","code-snippet"].forEach(function(f){h!==f&&(e.languages.markdown[h].inside.content.inside[f]=e.languages.markdown[f])})}),e.hooks.add("after-tokenize",function(h){if(h.language!=="markdown"&&h.language!=="md")return;function f(p){if(!(!p||typeof p=="string"))for(var v=0,w=p.length;v<w;v++){var C=p[v];if(C.type!=="code"){f(C.content);continue}var T=C.content[1],b=C.content[3];if(T&&b&&T.type==="code-language"&&b.type==="code-block"&&typeof T.content=="string"){var g=T.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");g=(/[a-z][\w-]*/i.exec(g)||[""])[0].toLowerCase();var y="language-"+g;b.alias?typeof b.alias=="string"?b.alias=[b.alias,y]:b.alias.push(y):b.alias=[y]}}}f(h.tokens)}),e.hooks.add("wrap",function(h){if(h.type==="code-block"){for(var f="",p=0,v=h.classes.length;p<v;p++){var w=h.classes[p],C=/language-(.+)/.exec(w);if(C){f=C[1];break}}var T=e.languages[f];if(T)h.content=e.highlight(d(h.content),T,f);else if(f&&f!=="none"&&e.plugins.autoloader){var b="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);h.attributes.id=b,e.plugins.autoloader.loadLanguages(f,function(){var g=document.getElementById(b);g&&(g.innerHTML=e.highlight(g.textContent,e.languages[f],f))})}}});var i=RegExp(e.languages.markup.tag.pattern.source,"gi"),c={amp:"&",lt:"<",gt:">",quot:'"'},u=String.fromCodePoint||String.fromCharCode;function d(h){var f=h.replace(i,"");return f=f.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(p,v){if(v=v.toLowerCase(),v[0]==="#"){var w;return v[1]==="x"?w=parseInt(v.slice(2),16):w=Number(v.slice(1)),u(w)}else{var C=c[v];return C||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(a){var r=t[a],o=[];/^\w+$/.test(a)||o.push(/\w+/.exec(a)[0]),a==="diff"&&o.push("bold"),e.languages.diff[a]={pattern:RegExp("^(?:["+r+`].*(?:\r
189
+ `,children:[n("span",{class:`flex-shrink-0 ${s.icon}`,"aria-hidden":"true",children:n(D_,{type:t})}),n("p",{class:"flex-1 text-sm text-[var(--color-text-primary)]",children:a}),n(q,{icon:n(Ar,{class:"w-4 h-4"}),label:l("actions.close"),variant:"ghost",size:"sm",onClick:()=>o(e)})]})}const L_={"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 $_({position:e="top-right"}){return vo.value.length===0?null:n("div",{class:`fixed z-50 flex flex-col gap-2 w-full max-w-sm ${L_[e]}`,"aria-label":"Notifications",children:vo.value.map(t=>n(R_,{...t,onDismiss:M_},t.id))})}function D_({type:e}){const t="w-5 h-5";switch(e){case"success":return n(on,{class:t,"aria-hidden":"true"});case"error":return n(Ma,{class:t,"aria-hidden":"true"});case"warning":return n(Aa,{class:t,"aria-hidden":"true"});default:return n(Al,{class:t,"aria-hidden":"true"})}}class Im extends Mt{constructor(t){super(t),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,a){this.setState({errorInfo:a}),this.props.onError?.(t,a),M.ui.error("ErrorBoundary caught error:",t),M.ui.error("Component stack:",a.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(P_,{error:this.state.error,errorInfo:this.state.errorInfo,onRetry:this.handleRetry}):this.props.children}}function P_({error:e,errorInfo:t,onRetry:a}){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:l("errors.generic")}),n("p",{class:"text-[var(--color-text-muted)] mb-6",children:e?.message||l("errors.unknown")}),n(P,{onClick:a,variant:"primary",children:l("actions.retry")}),!1]})})}const An=m([]),Zs=m(new Map),O_=300*1e3,Pd=new Map;function N_(){const e=Date.now(),t=[];for(const[a,r]of Pd)e-r>O_&&t.push(a);if(t.length>0){const a=new Map(Zs.value);for(const r of t)a.delete(r),Pd.delete(r);Zs.value=a,M.exec.debug(`Pruned ${t.length} old resolved approval(s)`)}}const hc=m(!1),fc=m(null);function F_(e){const t={request:e,expiresAtMs:e.expiresAtMs,receivedAt:Date.now()};An.value=[...An.value,t],M.exec.info(`Exec approval queued: ${e.command} (${An.value.length} pending)`)}function z_(e){An.value=An.value.filter(t=>t.request.requestId!==e)}function U_(){const e=Date.now(),t=An.value.length;An.value=An.value.filter(r=>r.expiresAtMs>e);const a=t-An.value.length;a>0&&M.exec.info(`Pruned ${a} expired exec approval(s)`)}async function j_(e,t){hc.value=!0,fc.value=null;try{await N("exec.approval.resolve",{id:e,decision:t}),z_(e);const a=new Map(Zs.value);a.set(e,t),Zs.value=a,Pd.set(e,Date.now()),N_(),M.exec.info(`Exec ${t} (direct): id=${e}`)}catch(a){const r=a instanceof Error?a.message:"Failed to send decision";throw fc.value=r,M.exec.error(`Exec approval error: ${r}`),a}finally{hc.value=!1}}let Ei=null,Ai=null;function H_(){ix(),Ei=_l(e=>{if(e.event==="exec.approval.requested"&&e.payload){const t=e.payload,a={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};a.expiresAtMs>Date.now()?F_(a):M.exec.debug("Ignoring already-expired approval request")}}),Ai=setInterval(U_,1e3),M.exec.info("Exec approval system initialized")}function ix(){Ei&&(Ei(),Ei=null),Ai&&(clearInterval(Ai),Ai=null),An.value=[],hc.value=!1,fc.value=null}let Rm=!1;D.subscribe(e=>{Rm&&!e&&ix(),Rm=e});const os=new Map;let Lm=!1;function B_(){Lm||(Lm=!0,window.addEventListener("popstate",()=>{const e=new URLSearchParams(window.location.search);for(const[t,a]of os)a.signal.value=e.get(t)}))}function $m(e,t){const a=new URL(window.location.href);t===null||t===""?a.searchParams.delete(e):a.searchParams.set(e,t),window.history.replaceState({},"",a.toString())}function fe(e,t={}){const{defaultValue:a=null,ready:r=!0}=t;B_();const o=ye(()=>m(!1),[e]),s=ye(()=>{const c=os.get(e);if(c)return c.refCount++,c.signal;const d=new URLSearchParams(window.location.search).get(e)??a,h=m(d);return os.set(e,{signal:h,refCount:1}),h},[e]);R(()=>()=>{const c=os.get(e);c&&(c.refCount--,c.refCount<=0&&os.delete(e))},[e]),R(()=>{r&&!o.value&&(o.value=!0)},[r]),R(()=>{if(!r)return;const u=new URLSearchParams(window.location.search).get(e);s.value!==u&&$m(e,s.value)},[e,s.value,r]);const i=ye(()=>c=>{s.value=c,$m(e,c)},[e,s]);return[s,i,o]}function tu(){window.history.pushState({},"",window.location.href)}function Oo(e,t,a={}){const{pushHistory:r=!1}=a,o=new Set(e.value),s=o.has(t);return s?o.delete(t):o.add(t),e.value=o,r&&!s&&tu(),!s}function Xs(e,t={}){const{parse:a=h=>h,serialize:r=String,...o}=t,[s,i,c]=fe(e,o),u=ye(()=>{const h=s.value?s.value.split(",").map(a).filter(Boolean):[];return m(new Set(h))},[e]);R(()=>{const h=s.value?s.value.split(",").map(a).filter(Boolean):[];u.value=new Set(h)},[s.value]);const d=ye(()=>h=>{u.value=h;const f=Array.from(h).map(r);i(f.length>0?f.join(","):null)},[i]);return[u,d,c]}function Mr(e,t){R(()=>{t(e.value||null)},[e.value])}function He(e,t,a){R(()=>{e.value&&(t.value=a(e.value))},[])}function Ln(e,t,a){R(()=>{t(e.value===a?null:e.value)},[e.value])}var Dm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function W_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Uu={exports:{}},Pm;function K_(){return Pm||(Pm=1,(function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var a=(function(r){var o=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,s=0,i={},c={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function g(y){return y instanceof u?new u(y.type,g(y.content),y.alias):Array.isArray(y)?y.map(g):y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(g){return Object.prototype.toString.call(g).slice(8,-1)},objId:function(g){return g.__id||Object.defineProperty(g,"__id",{value:++s}),g.__id},clone:function g(y,E){E=E||{};var x,S;switch(c.util.type(y)){case"Object":if(S=c.util.objId(y),E[S])return E[S];x={},E[S]=x;for(var k in y)y.hasOwnProperty(k)&&(x[k]=g(y[k],E));return x;case"Array":return S=c.util.objId(y),E[S]?E[S]:(x=[],E[S]=x,y.forEach(function(I,A){x[A]=g(I,E)}),x);default:return y}},getLanguage:function(g){for(;g;){var y=o.exec(g.className);if(y)return y[1].toLowerCase();g=g.parentElement}return"none"},setLanguage:function(g,y){g.className=g.className.replace(RegExp(o,"gi"),""),g.classList.add("language-"+y)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(x){var g=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(x.stack)||[])[1];if(g){var y=document.getElementsByTagName("script");for(var E in y)if(y[E].src==g)return y[E]}return null}},isActive:function(g,y,E){for(var x="no-"+y;g;){var S=g.classList;if(S.contains(y))return!0;if(S.contains(x))return!1;g=g.parentElement}return!!E}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(g,y){var E=c.util.clone(c.languages[g]);for(var x in y)E[x]=y[x];return E},insertBefore:function(g,y,E,x){x=x||c.languages;var S=x[g],k={};for(var I in S)if(S.hasOwnProperty(I)){if(I==y)for(var A in E)E.hasOwnProperty(A)&&(k[A]=E[A]);E.hasOwnProperty(I)||(k[I]=S[I])}var O=x[g];return x[g]=k,c.languages.DFS(c.languages,function(z,se){se===O&&z!=g&&(this[z]=k)}),k},DFS:function g(y,E,x,S){S=S||{};var k=c.util.objId;for(var I in y)if(y.hasOwnProperty(I)){E.call(y,I,y[I],x||I);var A=y[I],O=c.util.type(A);O==="Object"&&!S[k(A)]?(S[k(A)]=!0,g(A,E,null,S)):O==="Array"&&!S[k(A)]&&(S[k(A)]=!0,g(A,E,I,S))}}},plugins:{},highlightAll:function(g,y){c.highlightAllUnder(document,g,y)},highlightAllUnder:function(g,y,E){var x={callback:E,container:g,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};c.hooks.run("before-highlightall",x),x.elements=Array.prototype.slice.apply(x.container.querySelectorAll(x.selector)),c.hooks.run("before-all-elements-highlight",x);for(var S=0,k;k=x.elements[S++];)c.highlightElement(k,y===!0,x.callback)},highlightElement:function(g,y,E){var x=c.util.getLanguage(g),S=c.languages[x];c.util.setLanguage(g,x);var k=g.parentElement;k&&k.nodeName.toLowerCase()==="pre"&&c.util.setLanguage(k,x);var I=g.textContent,A={element:g,language:x,grammar:S,code:I};function O(se){A.highlightedCode=se,c.hooks.run("before-insert",A),A.element.innerHTML=A.highlightedCode,c.hooks.run("after-highlight",A),c.hooks.run("complete",A),E&&E.call(A.element)}if(c.hooks.run("before-sanity-check",A),k=A.element.parentElement,k&&k.nodeName.toLowerCase()==="pre"&&!k.hasAttribute("tabindex")&&k.setAttribute("tabindex","0"),!A.code){c.hooks.run("complete",A),E&&E.call(A.element);return}if(c.hooks.run("before-highlight",A),!A.grammar){O(c.util.encode(A.code));return}if(y&&r.Worker){var z=new Worker(c.filename);z.onmessage=function(se){O(se.data)},z.postMessage(JSON.stringify({language:A.language,code:A.code,immediateClose:!0}))}else O(c.highlight(A.code,A.grammar,A.language))},highlight:function(g,y,E){var x={code:g,grammar:y,language:E};if(c.hooks.run("before-tokenize",x),!x.grammar)throw new Error('The language "'+x.language+'" has no grammar.');return x.tokens=c.tokenize(x.code,x.grammar),c.hooks.run("after-tokenize",x),u.stringify(c.util.encode(x.tokens),x.language)},tokenize:function(g,y){var E=y.rest;if(E){for(var x in E)y[x]=E[x];delete y.rest}var S=new f;return p(S,S.head,g),h(g,S,y,S.head,0),w(S)},hooks:{all:{},add:function(g,y){var E=c.hooks.all;E[g]=E[g]||[],E[g].push(y)},run:function(g,y){var E=c.hooks.all[g];if(!(!E||!E.length))for(var x=0,S;S=E[x++];)S(y)}},Token:u};r.Prism=c;function u(g,y,E,x){this.type=g,this.content=y,this.alias=E,this.length=(x||"").length|0}u.stringify=function g(y,E){if(typeof y=="string")return y;if(Array.isArray(y)){var x="";return y.forEach(function(O){x+=g(O,E)}),x}var S={type:y.type,content:g(y.content,E),tag:"span",classes:["token",y.type],attributes:{},language:E},k=y.alias;k&&(Array.isArray(k)?Array.prototype.push.apply(S.classes,k):S.classes.push(k)),c.hooks.run("wrap",S);var I="";for(var A in S.attributes)I+=" "+A+'="'+(S.attributes[A]||"").replace(/"/g,"&quot;")+'"';return"<"+S.tag+' class="'+S.classes.join(" ")+'"'+I+">"+S.content+"</"+S.tag+">"};function d(g,y,E,x){g.lastIndex=y;var S=g.exec(E);if(S&&x&&S[1]){var k=S[1].length;S.index+=k,S[0]=S[0].slice(k)}return S}function h(g,y,E,x,S,k){for(var I in E)if(!(!E.hasOwnProperty(I)||!E[I])){var A=E[I];A=Array.isArray(A)?A:[A];for(var O=0;O<A.length;++O){if(k&&k.cause==I+","+O)return;var z=A[O],se=z.inside,Fe=!!z.lookbehind,et=!!z.greedy,he=z.alias;if(et&&!z.pattern.global){var yt=z.pattern.toString().match(/[imsuy]*$/)[0];z.pattern=RegExp(z.pattern.source,yt+"g")}for(var $t=z.pattern||z,xe=x.next,W=S;xe!==y.tail&&!(k&&W>=k.reach);W+=xe.value.length,xe=xe.next){var ce=xe.value;if(y.length>g.length)return;if(!(ce instanceof u)){var ve=1,dt;if(et){if(dt=d($t,W,g,Fe),!dt||dt.index>=g.length)break;var ln=dt.index,Le=dt.index+dt[0].length,Kt=W;for(Kt+=xe.value.length;ln>=Kt;)xe=xe.next,Kt+=xe.value.length;if(Kt-=xe.value.length,W=Kt,xe.value instanceof u)continue;for(var ue=xe;ue!==y.tail&&(Kt<Le||typeof ue.value=="string");ue=ue.next)ve++,Kt+=ue.value.length;ve--,ce=g.slice(W,Kt),dt.index-=W}else if(dt=d($t,0,ce,Fe),!dt)continue;var ln=dt.index,Zn=dt[0],cn=ce.slice(0,ln),Uo=ce.slice(ln+Zn.length),Ra=W+ce.length;k&&Ra>k.reach&&(k.reach=Ra);var La=xe.prev;cn&&(La=p(y,La,cn),W+=cn.length),v(y,La,ve);var Nl=new u(I,se?c.tokenize(Zn,se):Zn,he,Zn);if(xe=p(y,La,Nl),Uo&&p(y,xe,Uo),ve>1){var un={cause:I+","+O,reach:Ra};h(g,y,E,xe.prev,W,un),k&&un.reach>k.reach&&(k.reach=un.reach)}}}}}}function f(){var g={value:null,prev:null,next:null},y={value:null,prev:g,next:null};g.next=y,this.head=g,this.tail=y,this.length=0}function p(g,y,E){var x=y.next,S={value:E,prev:y,next:x};return y.next=S,x.prev=S,g.length++,S}function v(g,y,E){for(var x=y.next,S=0;S<E&&x!==g.tail;S++)x=x.next;y.next=x,x.prev=y,g.length-=S}function w(g){for(var y=[],E=g.head.next;E!==g.tail;)y.push(E.value),E=E.next;return y}if(!r.document)return r.addEventListener&&(c.disableWorkerMessageHandler||r.addEventListener("message",function(g){var y=JSON.parse(g.data),E=y.language,x=y.code,S=y.immediateClose;r.postMessage(c.highlight(x,c.languages[E],E)),S&&r.close()},!1)),c;var C=c.util.currentScript();C&&(c.filename=C.src,C.hasAttribute("data-manual")&&(c.manual=!0));function T(){c.manual||c.highlightAll()}if(!c.manual){var b=document.readyState;b==="loading"||b==="interactive"&&C&&C.defer?document.addEventListener("DOMContentLoaded",T):window.requestAnimationFrame?window.requestAnimationFrame(T):window.setTimeout(T,16)}return c})(t);e.exports&&(e.exports=a),typeof Dm<"u"&&(Dm.Prism=a),a.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]},a.languages.markup.tag.inside["attr-value"].inside.entity=a.languages.markup.entity,a.languages.markup.doctype.inside["internal-subset"].inside=a.languages.markup,a.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&amp;/,"&"))}),Object.defineProperty(a.languages.markup.tag,"addInlined",{value:function(o,s){var i={};i["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:a.languages[s]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var c={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};c["language-"+s]={pattern:/[\s\S]+/,inside:a.languages[s]};var u={};u[o]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return o}),"i"),lookbehind:!0,greedy:!0,inside:c},a.languages.insertBefore("markup","cdata",u)}}),Object.defineProperty(a.languages.markup.tag,"addAttribute",{value:function(r,o){a.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\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:a.languages[o]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),a.languages.html=a.languages.markup,a.languages.mathml=a.languages.markup,a.languages.svg=a.languages.markup,a.languages.xml=a.languages.extend("markup",{}),a.languages.ssml=a.languages.xml,a.languages.atom=a.languages.xml,a.languages.rss=a.languages.xml,(function(r){var o=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.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:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var s=r.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(a),a.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:/[{}[\];(),.:]/},a.languages.javascript=a.languages.extend("clike",{"class-name":[a.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}|\?\?=?|\?\.?|[~:]/}),a.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,a.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:a.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:a.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:a.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:a.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:a.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),a.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:a.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"}}),a.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),a.languages.markup&&(a.languages.markup.tag.addInlined("script","javascript"),a.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")),a.languages.js=a.languages.javascript,(function(){if(typeof a>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading…",o=function(C,T){return"✖ Error "+C+" while fetching file: "+T},s="✖ Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},c="data-src-status",u="loading",d="loaded",h="failed",f="pre[data-src]:not(["+c+'="'+d+'"]):not(['+c+'="'+u+'"])';function p(C,T,b){var g=new XMLHttpRequest;g.open("GET",C,!0),g.onreadystatechange=function(){g.readyState==4&&(g.status<400&&g.responseText?T(g.responseText):g.status>=400?b(o(g.status,g.statusText)):b(s))},g.send(null)}function v(C){var T=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(C||"");if(T){var b=Number(T[1]),g=T[2],y=T[3];return g?y?[b,Number(y)]:[b,void 0]:[b,b]}}a.hooks.add("before-highlightall",function(C){C.selector+=", "+f}),a.hooks.add("before-sanity-check",function(C){var T=C.element;if(T.matches(f)){C.code="",T.setAttribute(c,u);var b=T.appendChild(document.createElement("CODE"));b.textContent=r;var g=T.getAttribute("data-src"),y=C.language;if(y==="none"){var E=(/\.(\w+)$/.exec(g)||[,"none"])[1];y=i[E]||E}a.util.setLanguage(b,y),a.util.setLanguage(T,y);var x=a.plugins.autoloader;x&&x.loadLanguages(y),p(g,function(S){T.setAttribute(c,d);var k=v(T.getAttribute("data-range"));if(k){var I=S.split(/\r\n?|\n/g),A=k[0],O=k[1]==null?I.length:k[1];A<0&&(A+=I.length),A=Math.max(0,Math.min(A-1,I.length)),O<0&&(O+=I.length),O=Math.max(0,Math.min(O,I.length)),S=I.slice(A,O).join(`
190
+ `),T.hasAttribute("data-start")||T.setAttribute("data-start",String(A+1))}b.textContent=S,a.highlightElement(b)},function(S){T.setAttribute(c,h),b.textContent=S})}}),a.plugins.fileHighlight={highlight:function(T){for(var b=(T||document).querySelectorAll(f),g=0,y;y=b[g++];)a.highlightElement(y)}};var w=!1;a.fileHighlight=function(){w||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),w=!0),a.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(Uu)),Uu.exports}var q_=K_();const tn=W_(q_);var Om={},Nm;function V_(){return Nm||(Nm=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)),Om}V_();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),a=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,o=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function s(u,d){return u=u.replace(/<S>/g,function(){return a}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return o}),RegExp(u,d)}o=s(o).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=s(/<\/?(?:[\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:s(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:s(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var i=function(u){return u?typeof u=="string"?u:typeof u.content=="string"?u.content:u.content.map(i).join(""):""},c=function(u){for(var d=[],h=0;h<u.length;h++){var f=u[h],p=!1;if(typeof f!="string"&&(f.type==="tag"&&f.content[0]&&f.content[0].type==="tag"?f.content[0].content[0].content==="</"?d.length>0&&d[d.length-1].tagName===i(f.content[0].content[1])&&d.pop():f.content[f.content.length-1].content==="/>"||d.push({tagName:i(f.content[0].content[1]),openedBraces:0}):d.length>0&&f.type==="punctuation"&&f.content==="{"?d[d.length-1].openedBraces++:d.length>0&&d[d.length-1].openedBraces>0&&f.type==="punctuation"&&f.content==="}"?d[d.length-1].openedBraces--:p=!0),(p||typeof f=="string")&&d.length>0&&d[d.length-1].openedBraces===0){var v=i(f);h<u.length-1&&(typeof u[h+1]=="string"||u[h+1].type==="plain-text")&&(v+=i(u[h+1]),u.splice(h+1,1)),h>0&&(typeof u[h-1]=="string"||u[h-1].type==="plain-text")&&(v=i(u[h-1])+v,u.splice(h-1,1),h--),u[h]=new e.Token("plain-text",v,null,v)}f.content&&typeof f.content!="string"&&c(f.content)}};e.hooks.add("after-tokenize",function(u){u.language!=="jsx"&&u.language!=="tsx"||c(u.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 a=e.languages.tsx.tag;a.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+a.pattern.source+")",a.pattern.flags),a.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",a={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:a,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:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:a}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.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}},a.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"],s=r.variable[1].inside,i=0;i<o.length;i++)s[o[i]]=e.languages.bash[o[i]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism);var Fm={},zm;function G_(){return zm||(zm=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:/![sra](?=[:}]$)/,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),Fm}G_();var Um={},jm;function J_(){return jm||(jm=1,(function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,a=0;a<2;a++)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)),Um}J_();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[\]{},]+/,a=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+a.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+a.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}),s=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(c,u){u=(u||"").replace(/m/g,"")+"m";var d=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return c});return RegExp(d,u)}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 r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+o+"|"+s+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(s),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:a,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml})(Prism);(function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function a(h){return h=h.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+h+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),s=/\|?[ \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+s+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+s+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+s+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(r),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:a(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:a(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:a(/(~~?)(?:(?!~)<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:a(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(h){["url","bold","italic","strike","code-snippet"].forEach(function(f){h!==f&&(e.languages.markdown[h].inside.content.inside[f]=e.languages.markdown[f])})}),e.hooks.add("after-tokenize",function(h){if(h.language!=="markdown"&&h.language!=="md")return;function f(p){if(!(!p||typeof p=="string"))for(var v=0,w=p.length;v<w;v++){var C=p[v];if(C.type!=="code"){f(C.content);continue}var T=C.content[1],b=C.content[3];if(T&&b&&T.type==="code-language"&&b.type==="code-block"&&typeof T.content=="string"){var g=T.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");g=(/[a-z][\w-]*/i.exec(g)||[""])[0].toLowerCase();var y="language-"+g;b.alias?typeof b.alias=="string"?b.alias=[b.alias,y]:b.alias.push(y):b.alias=[y]}}}f(h.tokens)}),e.hooks.add("wrap",function(h){if(h.type==="code-block"){for(var f="",p=0,v=h.classes.length;p<v;p++){var w=h.classes[p],C=/language-(.+)/.exec(w);if(C){f=C[1];break}}var T=e.languages[f];if(T)h.content=e.highlight(d(h.content),T,f);else if(f&&f!=="none"&&e.plugins.autoloader){var b="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);h.attributes.id=b,e.plugins.autoloader.loadLanguages(f,function(){var g=document.getElementById(b);g&&(g.innerHTML=e.highlight(g.textContent,e.languages[f],f))})}}});var i=RegExp(e.languages.markup.tag.pattern.source,"gi"),c={amp:"&",lt:"<",gt:">",quot:'"'},u=String.fromCodePoint||String.fromCharCode;function d(h){var f=h.replace(i,"");return f=f.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(p,v){if(v=v.toLowerCase(),v[0]==="#"){var w;return v[1]==="x"?w=parseInt(v.slice(2),16):w=Number(v.slice(1)),u(w)}else{var C=c[v];return C||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(a){var r=t[a],o=[];/^\w+$/.test(a)||o.push(/\w+/.exec(a)[0]),a==="diff"&&o.push("bold"),e.languages.diff[a]={pattern:RegExp("^(?:["+r+`].*(?:\r
191
191
  ?|
192
- |(?![\\s\\S])))+`,"m"),alias:o,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(a)[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 a=e.languages.markup;a&&(a.tag.addInlined("style","css"),a.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 a(r){return r.replace(/__/g,function(){return t})}e.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(a(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(a(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(Prism);const{entries:cx,setPrototypeOf:Bm,isFrozen:J_,getPrototypeOf:Y_,getOwnPropertyDescriptor:Z_}=Object;let{freeze:ut,seal:jt,create:zd}=Object,{apply:Ud,construct:jd}=typeof Reflect<"u"&&Reflect;ut||(ut=function(t){return t});jt||(jt=function(t){return t});Ud||(Ud=function(t,a){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];return t.apply(a,o)});jd||(jd=function(t){for(var a=arguments.length,r=new Array(a>1?a-1:0),o=1;o<a;o++)r[o-1]=arguments[o];return new t(...r)});const ti=dt(Array.prototype.forEach),X_=dt(Array.prototype.lastIndexOf),Wm=dt(Array.prototype.pop),Ko=dt(Array.prototype.push),Q_=dt(Array.prototype.splice),Ii=dt(String.prototype.toLowerCase),Wu=dt(String.prototype.toString),Ku=dt(String.prototype.match),qo=dt(String.prototype.replace),e3=dt(String.prototype.indexOf),t3=dt(String.prototype.trim),Wt=dt(Object.prototype.hasOwnProperty),nt=dt(RegExp.prototype.test),Vo=n3(TypeError);function dt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var a=arguments.length,r=new Array(a>1?a-1:0),o=1;o<a;o++)r[o-1]=arguments[o];return Ud(e,t,r)}}function n3(e){return function(){for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];return jd(e,a)}}function ee(e,t){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ii;Bm&&Bm(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=a(o);s!==o&&(J_(t)||(t[r]=s),o=s)}e[o]=!0}return e}function a3(e){for(let t=0;t<e.length;t++)Wt(e,t)||(e[t]=null);return e}function pn(e){const t=zd(null);for(const[a,r]of cx(e))Wt(e,a)&&(Array.isArray(r)?t[a]=a3(r):r&&typeof r=="object"&&r.constructor===Object?t[a]=pn(r):t[a]=r);return t}function Go(e,t){for(;e!==null;){const r=Z_(e,t);if(r){if(r.get)return dt(r.get);if(typeof r.value=="function")return dt(r.value)}e=Y_(e)}function a(){return null}return a}const Km=ut(["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"]),qu=ut(["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"]),Vu=ut(["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"]),r3=ut(["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"]),Gu=ut(["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"]),o3=ut(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),qm=ut(["#text"]),Vm=ut(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ju=ut(["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"]),Gm=ut(["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"]),ni=ut(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),s3=jt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),l3=jt(/<%[\w\W]*|[\w\W]*%>/gm),i3=jt(/\$\{[\w\W]*/gm),c3=jt(/^data-[\-\w.\u00B7-\uFFFF]+$/),u3=jt(/^aria-[\-\w]+$/),ux=jt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),d3=jt(/^(?:\w+script|data):/i),h3=jt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),dx=jt(/^html$/i),f3=jt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Jm=Object.freeze({__proto__:null,ARIA_ATTR:u3,ATTR_WHITESPACE:h3,CUSTOM_ELEMENT:f3,DATA_ATTR:c3,DOCTYPE_NAME:dx,ERB_EXPR:l3,IS_ALLOWED_URI:ux,IS_SCRIPT_OR_DATA:d3,MUSTACHE_EXPR:s3,TMPLIT_EXPR:i3});const Jo={element:1,text:3,progressingInstruction:7,comment:8,document:9},p3=function(){return typeof window>"u"?null:window},m3=function(t,a){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";a&&a.hasAttribute(o)&&(r=a.getAttribute(o));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Ym=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function hx(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p3();const t=B=>hx(B);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Jo.document||!e.Element)return t.isSupported=!1,t;let{document:a}=e;const r=a,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:i,Node:c,Element:u,NodeFilter:d,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:v}=e,w=u.prototype,C=Go(w,"cloneNode"),T=Go(w,"remove"),b=Go(w,"nextSibling"),g=Go(w,"childNodes"),y=Go(w,"parentNode");if(typeof i=="function"){const B=a.createElement("template");B.content&&B.content.ownerDocument&&(a=B.content.ownerDocument)}let E,x="";const{implementation:S,createNodeIterator:k,createDocumentFragment:I,getElementsByTagName:A}=a,{importNode:O}=r;let z=Ym();t.isSupported=typeof cx=="function"&&typeof y=="function"&&S&&S.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:se,ERB_EXPR:Fe,TMPLIT_EXPR:tt,DATA_ATTR:Re,ARIA_ATTR:Gn,IS_SCRIPT_OR_DATA:Jn,ATTR_WHITESPACE:be,CUSTOM_ELEMENT:W}=Jm;let{IS_ALLOWED_URI:ce}=Jm,me=null;const ht=ee({},[...Km,...qu,...Vu,...Gu,...qm]);let Le=null;const Bt=ee({},[...Vm,...Ju,...Gm,...ni]);let ue=Object.seal(zd(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}})),ln=null,Yn=null;const cn=Object.seal(zd(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Uo=!0,Ra=!0,La=!1,Nl=!0,un=!1,Fl=!0,$a=!1,gu=!1,bu=!1,$r=!1,zl=!1,Ul=!1,op=!0,sp=!1;const Qy="user-content-";let xu=!0,jo=!1,Dr={},dn=null;const yu=ee({},["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 lp=null;const ip=ee({},["audio","video","img","source","image","track"]);let wu=null;const cp=ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),jl="http://www.w3.org/1998/Math/MathML",Hl="http://www.w3.org/2000/svg",On="http://www.w3.org/1999/xhtml";let Pr=On,ku=!1,Su=null;const e0=ee({},[jl,Hl,On],Wu);let Bl=ee({},["mi","mo","mn","ms","mtext"]),Wl=ee({},["annotation-xml"]);const t0=ee({},["title","style","font","a","script"]);let Ho=null;const n0=["application/xhtml+xml","text/html"],a0="text/html";let $e=null,Or=null;const r0=a.createElement("form"),up=function(_){return _ instanceof RegExp||_ instanceof Function},_u=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Or&&Or===_)){if((!_||typeof _!="object")&&(_={}),_=pn(_),Ho=n0.indexOf(_.PARSER_MEDIA_TYPE)===-1?a0:_.PARSER_MEDIA_TYPE,$e=Ho==="application/xhtml+xml"?Wu:Ii,me=Wt(_,"ALLOWED_TAGS")?ee({},_.ALLOWED_TAGS,$e):ht,Le=Wt(_,"ALLOWED_ATTR")?ee({},_.ALLOWED_ATTR,$e):Bt,Su=Wt(_,"ALLOWED_NAMESPACES")?ee({},_.ALLOWED_NAMESPACES,Wu):e0,wu=Wt(_,"ADD_URI_SAFE_ATTR")?ee(pn(cp),_.ADD_URI_SAFE_ATTR,$e):cp,lp=Wt(_,"ADD_DATA_URI_TAGS")?ee(pn(ip),_.ADD_DATA_URI_TAGS,$e):ip,dn=Wt(_,"FORBID_CONTENTS")?ee({},_.FORBID_CONTENTS,$e):yu,ln=Wt(_,"FORBID_TAGS")?ee({},_.FORBID_TAGS,$e):pn({}),Yn=Wt(_,"FORBID_ATTR")?ee({},_.FORBID_ATTR,$e):pn({}),Dr=Wt(_,"USE_PROFILES")?_.USE_PROFILES:!1,Uo=_.ALLOW_ARIA_ATTR!==!1,Ra=_.ALLOW_DATA_ATTR!==!1,La=_.ALLOW_UNKNOWN_PROTOCOLS||!1,Nl=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,un=_.SAFE_FOR_TEMPLATES||!1,Fl=_.SAFE_FOR_XML!==!1,$a=_.WHOLE_DOCUMENT||!1,$r=_.RETURN_DOM||!1,zl=_.RETURN_DOM_FRAGMENT||!1,Ul=_.RETURN_TRUSTED_TYPE||!1,bu=_.FORCE_BODY||!1,op=_.SANITIZE_DOM!==!1,sp=_.SANITIZE_NAMED_PROPS||!1,xu=_.KEEP_CONTENT!==!1,jo=_.IN_PLACE||!1,ce=_.ALLOWED_URI_REGEXP||ux,Pr=_.NAMESPACE||On,Bl=_.MATHML_TEXT_INTEGRATION_POINTS||Bl,Wl=_.HTML_INTEGRATION_POINTS||Wl,ue=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&up(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ue.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&up(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ue.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ue.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),un&&(Ra=!1),zl&&($r=!0),Dr&&(me=ee({},qm),Le=[],Dr.html===!0&&(ee(me,Km),ee(Le,Vm)),Dr.svg===!0&&(ee(me,qu),ee(Le,Ju),ee(Le,ni)),Dr.svgFilters===!0&&(ee(me,Vu),ee(Le,Ju),ee(Le,ni)),Dr.mathMl===!0&&(ee(me,Gu),ee(Le,Gm),ee(Le,ni))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?cn.tagCheck=_.ADD_TAGS:(me===ht&&(me=pn(me)),ee(me,_.ADD_TAGS,$e))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?cn.attributeCheck=_.ADD_ATTR:(Le===Bt&&(Le=pn(Le)),ee(Le,_.ADD_ATTR,$e))),_.ADD_URI_SAFE_ATTR&&ee(wu,_.ADD_URI_SAFE_ATTR,$e),_.FORBID_CONTENTS&&(dn===yu&&(dn=pn(dn)),ee(dn,_.FORBID_CONTENTS,$e)),_.ADD_FORBID_CONTENTS&&(dn===yu&&(dn=pn(dn)),ee(dn,_.ADD_FORBID_CONTENTS,$e)),xu&&(me["#text"]=!0),$a&&ee(me,["html","head","body"]),me.table&&(ee(me,["tbody"]),delete ln.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Vo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Vo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=_.TRUSTED_TYPES_POLICY,x=E.createHTML("")}else E===void 0&&(E=m3(v,o)),E!==null&&typeof x=="string"&&(x=E.createHTML(""));ut&&ut(_),Or=_}},dp=ee({},[...qu,...Vu,...r3]),hp=ee({},[...Gu,...o3]),o0=function(_){let $=y(_);(!$||!$.tagName)&&($={namespaceURI:Pr,tagName:"template"});const j=Ii(_.tagName),fe=Ii($.tagName);return Su[_.namespaceURI]?_.namespaceURI===Hl?$.namespaceURI===On?j==="svg":$.namespaceURI===jl?j==="svg"&&(fe==="annotation-xml"||Bl[fe]):!!dp[j]:_.namespaceURI===jl?$.namespaceURI===On?j==="math":$.namespaceURI===Hl?j==="math"&&Wl[fe]:!!hp[j]:_.namespaceURI===On?$.namespaceURI===Hl&&!Wl[fe]||$.namespaceURI===jl&&!Bl[fe]?!1:!hp[j]&&(t0[j]||!dp[j]):!!(Ho==="application/xhtml+xml"&&Su[_.namespaceURI]):!1},hn=function(_){Ko(t.removed,{element:_});try{y(_).removeChild(_)}catch{T(_)}},Da=function(_,$){try{Ko(t.removed,{attribute:$.getAttributeNode(_),from:$})}catch{Ko(t.removed,{attribute:null,from:$})}if($.removeAttribute(_),_==="is")if($r||zl)try{hn($)}catch{}else try{$.setAttribute(_,"")}catch{}},fp=function(_){let $=null,j=null;if(bu)_="<remove></remove>"+_;else{const _e=Ku(_,/^[\r\n\t ]+/);j=_e&&_e[0]}Ho==="application/xhtml+xml"&&Pr===On&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const fe=E?E.createHTML(_):_;if(Pr===On)try{$=new p().parseFromString(fe,Ho)}catch{}if(!$||!$.documentElement){$=S.createDocument(Pr,"template",null);try{$.documentElement.innerHTML=ku?x:fe}catch{}}const Ge=$.body||$.documentElement;return _&&j&&Ge.insertBefore(a.createTextNode(j),Ge.childNodes[0]||null),Pr===On?A.call($,$a?"html":"body")[0]:$a?$.documentElement:Ge},pp=function(_){return k.call(_.ownerDocument||_,_,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Cu=function(_){return _ instanceof f&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof h)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},mp=function(_){return typeof c=="function"&&_ instanceof c};function Nn(B,_,$){ti(B,j=>{j.call(t,_,$,Or)})}const vp=function(_){let $=null;if(Nn(z.beforeSanitizeElements,_,null),Cu(_))return hn(_),!0;const j=$e(_.nodeName);if(Nn(z.uponSanitizeElement,_,{tagName:j,allowedTags:me}),Fl&&_.hasChildNodes()&&!mp(_.firstElementChild)&&nt(/<[/\w!]/g,_.innerHTML)&&nt(/<[/\w!]/g,_.textContent)||_.nodeType===Jo.progressingInstruction||Fl&&_.nodeType===Jo.comment&&nt(/<[/\w]/g,_.data))return hn(_),!0;if(!(cn.tagCheck instanceof Function&&cn.tagCheck(j))&&(!me[j]||ln[j])){if(!ln[j]&&bp(j)&&(ue.tagNameCheck instanceof RegExp&&nt(ue.tagNameCheck,j)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(j)))return!1;if(xu&&!dn[j]){const fe=y(_)||_.parentNode,Ge=g(_)||_.childNodes;if(Ge&&fe){const _e=Ge.length;for(let ft=_e-1;ft>=0;--ft){const Fn=C(Ge[ft],!0);Fn.__removalCount=(_.__removalCount||0)+1,fe.insertBefore(Fn,b(_))}}}return hn(_),!0}return _ instanceof u&&!o0(_)||(j==="noscript"||j==="noembed"||j==="noframes")&&nt(/<\/no(script|embed|frames)/i,_.innerHTML)?(hn(_),!0):(un&&_.nodeType===Jo.text&&($=_.textContent,ti([se,Fe,tt],fe=>{$=qo($,fe," ")}),_.textContent!==$&&(Ko(t.removed,{element:_.cloneNode()}),_.textContent=$)),Nn(z.afterSanitizeElements,_,null),!1)},gp=function(_,$,j){if(op&&($==="id"||$==="name")&&(j in a||j in r0))return!1;if(!(Ra&&!Yn[$]&&nt(Re,$))){if(!(Uo&&nt(Gn,$))){if(!(cn.attributeCheck instanceof Function&&cn.attributeCheck($,_))){if(!Le[$]||Yn[$]){if(!(bp(_)&&(ue.tagNameCheck instanceof RegExp&&nt(ue.tagNameCheck,_)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(_))&&(ue.attributeNameCheck instanceof RegExp&&nt(ue.attributeNameCheck,$)||ue.attributeNameCheck instanceof Function&&ue.attributeNameCheck($,_))||$==="is"&&ue.allowCustomizedBuiltInElements&&(ue.tagNameCheck instanceof RegExp&&nt(ue.tagNameCheck,j)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(j))))return!1}else if(!wu[$]){if(!nt(ce,qo(j,be,""))){if(!(($==="src"||$==="xlink:href"||$==="href")&&_!=="script"&&e3(j,"data:")===0&&lp[_])){if(!(La&&!nt(Jn,qo(j,be,"")))){if(j)return!1}}}}}}}return!0},bp=function(_){return _!=="annotation-xml"&&Ku(_,W)},xp=function(_){Nn(z.beforeSanitizeAttributes,_,null);const{attributes:$}=_;if(!$||Cu(_))return;const j={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Le,forceKeepAttr:void 0};let fe=$.length;for(;fe--;){const Ge=$[fe],{name:_e,namespaceURI:ft,value:Fn}=Ge,Nr=$e(_e),Tu=Fn;let Ke=_e==="value"?Tu:t3(Tu);if(j.attrName=Nr,j.attrValue=Ke,j.keepAttr=!0,j.forceKeepAttr=void 0,Nn(z.uponSanitizeAttribute,_,j),Ke=j.attrValue,sp&&(Nr==="id"||Nr==="name")&&(Da(_e,_),Ke=Qy+Ke),Fl&&nt(/((--!?|])>)|<\/(style|title|textarea)/i,Ke)){Da(_e,_);continue}if(Nr==="attributename"&&Ku(Ke,"href")){Da(_e,_);continue}if(j.forceKeepAttr)continue;if(!j.keepAttr){Da(_e,_);continue}if(!Nl&&nt(/\/>/i,Ke)){Da(_e,_);continue}un&&ti([se,Fe,tt],wp=>{Ke=qo(Ke,wp," ")});const yp=$e(_.nodeName);if(!gp(yp,Nr,Ke)){Da(_e,_);continue}if(E&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!ft)switch(v.getAttributeType(yp,Nr)){case"TrustedHTML":{Ke=E.createHTML(Ke);break}case"TrustedScriptURL":{Ke=E.createScriptURL(Ke);break}}if(Ke!==Tu)try{ft?_.setAttributeNS(ft,_e,Ke):_.setAttribute(_e,Ke),Cu(_)?hn(_):Wm(t.removed)}catch{Da(_e,_)}}Nn(z.afterSanitizeAttributes,_,null)},s0=function B(_){let $=null;const j=pp(_);for(Nn(z.beforeSanitizeShadowDOM,_,null);$=j.nextNode();)Nn(z.uponSanitizeShadowNode,$,null),vp($),xp($),$.content instanceof s&&B($.content);Nn(z.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(B){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=null,j=null,fe=null,Ge=null;if(ku=!B,ku&&(B="<!-->"),typeof B!="string"&&!mp(B))if(typeof B.toString=="function"){if(B=B.toString(),typeof B!="string")throw Vo("dirty is not a string, aborting")}else throw Vo("toString is not a function");if(!t.isSupported)return B;if(gu||_u(_),t.removed=[],typeof B=="string"&&(jo=!1),jo){if(B.nodeName){const Fn=$e(B.nodeName);if(!me[Fn]||ln[Fn])throw Vo("root node is forbidden and cannot be sanitized in-place")}}else if(B instanceof c)$=fp("<!---->"),j=$.ownerDocument.importNode(B,!0),j.nodeType===Jo.element&&j.nodeName==="BODY"||j.nodeName==="HTML"?$=j:$.appendChild(j);else{if(!$r&&!un&&!$a&&B.indexOf("<")===-1)return E&&Ul?E.createHTML(B):B;if($=fp(B),!$)return $r?null:Ul?x:""}$&&bu&&hn($.firstChild);const _e=pp(jo?B:$);for(;fe=_e.nextNode();)vp(fe),xp(fe),fe.content instanceof s&&s0(fe.content);if(jo)return B;if($r){if(zl)for(Ge=I.call($.ownerDocument);$.firstChild;)Ge.appendChild($.firstChild);else Ge=$;return(Le.shadowroot||Le.shadowrootmode)&&(Ge=O.call(r,Ge,!0)),Ge}let ft=$a?$.outerHTML:$.innerHTML;return $a&&me["!doctype"]&&$.ownerDocument&&$.ownerDocument.doctype&&$.ownerDocument.doctype.name&&nt(dx,$.ownerDocument.doctype.name)&&(ft="<!DOCTYPE "+$.ownerDocument.doctype.name+`>
193
- `+ft),un&&ti([se,Fe,tt],Fn=>{ft=qo(ft,Fn," ")}),E&&Ul?E.createHTML(ft):ft},t.setConfig=function(){let B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_u(B),gu=!0},t.clearConfig=function(){Or=null,gu=!1},t.isValidAttribute=function(B,_,$){Or||_u({});const j=$e(B),fe=$e(_);return gp(j,fe,$)},t.addHook=function(B,_){typeof _=="function"&&Ko(z[B],_)},t.removeHook=function(B,_){if(_!==void 0){const $=X_(z[B],_);return $===-1?void 0:Q_(z[B],$,1)[0]}return Wm(z[B])},t.removeHooks=function(B){z[B]=[]},t.removeAllHooks=function(){z=Ym()},t}var fx=hx();const v3={ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","p","br","hr","ul","ol","li","dl","dt","dd","strong","em","b","i","u","s","strike","del","ins","sub","sup","small","mark","abbr","code","pre","kbd","samp","var","blockquote","q","cite","a","img","figure","figcaption","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","div","span","details","summary"],ALLOWED_ATTR:["href","src","alt","title","class","id","name","target","rel","width","height","colspan","rowspan","scope","start","type","open","aria-label","aria-hidden","aria-describedby","role","tabindex","data-line","data-language"],ADD_ATTR:["target","rel"],FORBID_TAGS:["script","style","iframe","object","embed","form","input","button"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur"],ALLOW_DATA_ATTR:!1,ADD_DATA_URI_TAGS:["img"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|data):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i};function px(e){return fx.sanitize(e,{...v3,RETURN_TRUSTED_TYPE:!1})}function vc(e){return fx.sanitize(e,{ALLOWED_TAGS:["span","code","pre","br"],ALLOWED_ATTR:["class"],FORBID_TAGS:["script","style"],FORBID_ATTR:["onerror","onload","onclick"],RETURN_TRUSTED_TYPE:!1})}const g3={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",json:"json",py:"python",rs:"rust",go:"go",yaml:"yaml",yml:"yaml",md:"markdown",css:"css",sql:"sql",toml:"toml",sh:"bash",bash:"bash",zsh:"bash",diff:"diff",patch:"diff"};function b3(e){const t=e.split(".").pop()?.toLowerCase();return t&&g3[t]||null}function mx(e){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t),"json"}catch{}return t.startsWith("#!/")?t.includes("python")?"python":t.includes("node")?"javascript":(t.includes("bash")||t.includes("/sh"),"bash"):/^[\w-]+:\s/m.test(t)&&!t.includes("{")?"yaml":t.startsWith("diff ")||t.startsWith("---")&&t.includes("+++")?"diff":null}function x3({open:e,onClose:t,content:a,title:r,language:o}){const s=F(null),[i,c]=U(!1),u=xe(()=>{const p=o||mx(a);if(!p||!en.languages[p])return null;try{const v=en.highlight(a,en.languages[p],p);return vc(v)}catch{return null}},[a,o]),d=Q(p=>{p.key==="Escape"&&t()},[t]);R(()=>{if(e)return document.body.style.overflow="hidden",document.addEventListener("keydown",d),()=>{document.body.style.overflow="",document.removeEventListener("keydown",d)}},[e,d]),R(()=>{e&&s.current&&s.current.focus()},[e]);const h=async()=>{const p=typeof navigator<"u"?navigator.clipboard:null;if(!p?.writeText){M.ui.warn("Clipboard API not available");return}try{await p.writeText(a),c(!0),setTimeout(()=>c(!1),2e3)}catch(v){M.ui.warn("Failed to copy output to clipboard",v)}};if(!e)return null;const f=a.split(`
194
- `);return nu(n("div",{class:"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 md:p-10",role:"dialog","aria-modal":"true","aria-labelledby":"output-modal-title",children:[n("div",{class:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t,"aria-hidden":"true"}),n("div",{ref:s,tabIndex:-1,class:"relative w-full h-full max-w-[95vw] max-h-[90vh] flex flex-col bg-[var(--color-bg-primary)] border border-[var(--color-border)] rounded-lg shadow-2xl focus:outline-none overflow-hidden",children:[n("div",{class:"flex items-center justify-between px-4 py-3 border-b border-[var(--color-border)] bg-[var(--color-bg-surface)]",children:[n("h2",{id:"output-modal-title",class:"text-sm font-medium text-[var(--color-text-primary)]",children:[r,n("span",{class:"ml-2 text-xs text-[var(--color-text-muted)]",children:l("toolOutput.lines",{count:f.length})})]}),n("div",{class:"flex items-center gap-2",children:[n("button",{type:"button",onClick:h,class:"text-xs px-2 py-1 rounded bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] transition-colors",children:l(i?"actions.copied":"actions.copy")}),n(q,{icon:n(Ar,{}),label:l("actions.close"),variant:"ghost",size:"sm",onClick:t})]})]}),n("div",{class:"flex-1 overflow-auto bg-[var(--color-bg-tertiary)]",children:u?n("pre",{class:"text-xs font-mono leading-relaxed p-4 whitespace-pre-wrap break-words",dangerouslySetInnerHTML:{__html:u}}):n("pre",{class:"text-xs font-mono leading-relaxed p-4 text-[var(--color-text-primary)] whitespace-pre-wrap break-words",children:a})})]})]}),document.body)}function ye({content:e,maxLines:t=30,error:a=!1,filePath:r}){const o=F(null),[s,i]=U(!1),[c,u]=U(!1),d=()=>{i(!1),requestAnimationFrame(()=>{o.current?.scrollIntoView({behavior:"smooth",block:"nearest"})})},h=typeof e=="object"&&e!==null,f=h?JSON.stringify(e,null,2):String(e),p=f.split(`
192
+ |(?![\\s\\S])))+`,"m"),alias:o,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(a)[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 a=e.languages.markup;a&&(a.tag.addInlined("style","css"),a.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 a(r){return r.replace(/__/g,function(){return t})}e.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(a(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(a(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(Prism);const{entries:cx,setPrototypeOf:Hm,isFrozen:Y_,getPrototypeOf:Z_,getOwnPropertyDescriptor:X_}=Object;let{freeze:ct,seal:Bt,create:Od}=Object,{apply:Nd,construct:Fd}=typeof Reflect<"u"&&Reflect;ct||(ct=function(t){return t});Bt||(Bt=function(t){return t});Nd||(Nd=function(t,a){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];return t.apply(a,o)});Fd||(Fd=function(t){for(var a=arguments.length,r=new Array(a>1?a-1:0),o=1;o<a;o++)r[o-1]=arguments[o];return new t(...r)});const ti=ut(Array.prototype.forEach),Q_=ut(Array.prototype.lastIndexOf),Bm=ut(Array.prototype.pop),Ko=ut(Array.prototype.push),e3=ut(Array.prototype.splice),Mi=ut(String.prototype.toLowerCase),ju=ut(String.prototype.toString),Hu=ut(String.prototype.match),qo=ut(String.prototype.replace),t3=ut(String.prototype.indexOf),n3=ut(String.prototype.trim),qt=ut(Object.prototype.hasOwnProperty),tt=ut(RegExp.prototype.test),Vo=a3(TypeError);function ut(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var a=arguments.length,r=new Array(a>1?a-1:0),o=1;o<a;o++)r[o-1]=arguments[o];return Nd(e,t,r)}}function a3(e){return function(){for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];return Fd(e,a)}}function ee(e,t){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Mi;Hm&&Hm(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=a(o);s!==o&&(Y_(t)||(t[r]=s),o=s)}e[o]=!0}return e}function r3(e){for(let t=0;t<e.length;t++)qt(e,t)||(e[t]=null);return e}function pn(e){const t=Od(null);for(const[a,r]of cx(e))qt(e,a)&&(Array.isArray(r)?t[a]=r3(r):r&&typeof r=="object"&&r.constructor===Object?t[a]=pn(r):t[a]=r);return t}function Go(e,t){for(;e!==null;){const r=X_(e,t);if(r){if(r.get)return ut(r.get);if(typeof r.value=="function")return ut(r.value)}e=Z_(e)}function a(){return null}return a}const Wm=ct(["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"]),Bu=ct(["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"]),Wu=ct(["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"]),o3=ct(["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"]),Ku=ct(["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"]),s3=ct(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Km=ct(["#text"]),qm=ct(["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"]),qu=ct(["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"]),Vm=ct(["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"]),ni=ct(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),l3=Bt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),i3=Bt(/<%[\w\W]*|[\w\W]*%>/gm),c3=Bt(/\$\{[\w\W]*/gm),u3=Bt(/^data-[\-\w.\u00B7-\uFFFF]+$/),d3=Bt(/^aria-[\-\w]+$/),ux=Bt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),h3=Bt(/^(?:\w+script|data):/i),f3=Bt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),dx=Bt(/^html$/i),p3=Bt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Gm=Object.freeze({__proto__:null,ARIA_ATTR:d3,ATTR_WHITESPACE:f3,CUSTOM_ELEMENT:p3,DATA_ATTR:u3,DOCTYPE_NAME:dx,ERB_EXPR:i3,IS_ALLOWED_URI:ux,IS_SCRIPT_OR_DATA:h3,MUSTACHE_EXPR:l3,TMPLIT_EXPR:c3});const Jo={element:1,text:3,progressingInstruction:7,comment:8,document:9},m3=function(){return typeof window>"u"?null:window},v3=function(t,a){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";a&&a.hasAttribute(o)&&(r=a.getAttribute(o));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Jm=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function hx(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m3();const t=B=>hx(B);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Jo.document||!e.Element)return t.isSupported=!1,t;let{document:a}=e;const r=a,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:i,Node:c,Element:u,NodeFilter:d,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:v}=e,w=u.prototype,C=Go(w,"cloneNode"),T=Go(w,"remove"),b=Go(w,"nextSibling"),g=Go(w,"childNodes"),y=Go(w,"parentNode");if(typeof i=="function"){const B=a.createElement("template");B.content&&B.content.ownerDocument&&(a=B.content.ownerDocument)}let E,x="";const{implementation:S,createNodeIterator:k,createDocumentFragment:I,getElementsByTagName:A}=a,{importNode:O}=r;let z=Jm();t.isSupported=typeof cx=="function"&&typeof y=="function"&&S&&S.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:se,ERB_EXPR:Fe,TMPLIT_EXPR:et,DATA_ATTR:he,ARIA_ATTR:yt,IS_SCRIPT_OR_DATA:$t,ATTR_WHITESPACE:xe,CUSTOM_ELEMENT:W}=Gm;let{IS_ALLOWED_URI:ce}=Gm,ve=null;const dt=ee({},[...Wm,...Bu,...Wu,...Ku,...Km]);let Le=null;const Kt=ee({},[...qm,...qu,...Vm,...ni]);let ue=Object.seal(Od(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}})),ln=null,Zn=null;const cn=Object.seal(Od(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Uo=!0,Ra=!0,La=!1,Nl=!0,un=!1,Fl=!0,$a=!1,pu=!1,mu=!1,$r=!1,zl=!1,Ul=!1,rp=!0,op=!1;const e0="user-content-";let vu=!0,jo=!1,Dr={},dn=null;const gu=ee({},["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 sp=null;const lp=ee({},["audio","video","img","source","image","track"]);let bu=null;const ip=ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),jl="http://www.w3.org/1998/Math/MathML",Hl="http://www.w3.org/2000/svg",Fn="http://www.w3.org/1999/xhtml";let Pr=Fn,xu=!1,yu=null;const t0=ee({},[jl,Hl,Fn],ju);let Bl=ee({},["mi","mo","mn","ms","mtext"]),Wl=ee({},["annotation-xml"]);const n0=ee({},["title","style","font","a","script"]);let Ho=null;const a0=["application/xhtml+xml","text/html"],r0="text/html";let $e=null,Or=null;const o0=a.createElement("form"),cp=function(_){return _ instanceof RegExp||_ instanceof Function},wu=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Or&&Or===_)){if((!_||typeof _!="object")&&(_={}),_=pn(_),Ho=a0.indexOf(_.PARSER_MEDIA_TYPE)===-1?r0:_.PARSER_MEDIA_TYPE,$e=Ho==="application/xhtml+xml"?ju:Mi,ve=qt(_,"ALLOWED_TAGS")?ee({},_.ALLOWED_TAGS,$e):dt,Le=qt(_,"ALLOWED_ATTR")?ee({},_.ALLOWED_ATTR,$e):Kt,yu=qt(_,"ALLOWED_NAMESPACES")?ee({},_.ALLOWED_NAMESPACES,ju):t0,bu=qt(_,"ADD_URI_SAFE_ATTR")?ee(pn(ip),_.ADD_URI_SAFE_ATTR,$e):ip,sp=qt(_,"ADD_DATA_URI_TAGS")?ee(pn(lp),_.ADD_DATA_URI_TAGS,$e):lp,dn=qt(_,"FORBID_CONTENTS")?ee({},_.FORBID_CONTENTS,$e):gu,ln=qt(_,"FORBID_TAGS")?ee({},_.FORBID_TAGS,$e):pn({}),Zn=qt(_,"FORBID_ATTR")?ee({},_.FORBID_ATTR,$e):pn({}),Dr=qt(_,"USE_PROFILES")?_.USE_PROFILES:!1,Uo=_.ALLOW_ARIA_ATTR!==!1,Ra=_.ALLOW_DATA_ATTR!==!1,La=_.ALLOW_UNKNOWN_PROTOCOLS||!1,Nl=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,un=_.SAFE_FOR_TEMPLATES||!1,Fl=_.SAFE_FOR_XML!==!1,$a=_.WHOLE_DOCUMENT||!1,$r=_.RETURN_DOM||!1,zl=_.RETURN_DOM_FRAGMENT||!1,Ul=_.RETURN_TRUSTED_TYPE||!1,mu=_.FORCE_BODY||!1,rp=_.SANITIZE_DOM!==!1,op=_.SANITIZE_NAMED_PROPS||!1,vu=_.KEEP_CONTENT!==!1,jo=_.IN_PLACE||!1,ce=_.ALLOWED_URI_REGEXP||ux,Pr=_.NAMESPACE||Fn,Bl=_.MATHML_TEXT_INTEGRATION_POINTS||Bl,Wl=_.HTML_INTEGRATION_POINTS||Wl,ue=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&cp(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ue.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&cp(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ue.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ue.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),un&&(Ra=!1),zl&&($r=!0),Dr&&(ve=ee({},Km),Le=[],Dr.html===!0&&(ee(ve,Wm),ee(Le,qm)),Dr.svg===!0&&(ee(ve,Bu),ee(Le,qu),ee(Le,ni)),Dr.svgFilters===!0&&(ee(ve,Wu),ee(Le,qu),ee(Le,ni)),Dr.mathMl===!0&&(ee(ve,Ku),ee(Le,Vm),ee(Le,ni))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?cn.tagCheck=_.ADD_TAGS:(ve===dt&&(ve=pn(ve)),ee(ve,_.ADD_TAGS,$e))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?cn.attributeCheck=_.ADD_ATTR:(Le===Kt&&(Le=pn(Le)),ee(Le,_.ADD_ATTR,$e))),_.ADD_URI_SAFE_ATTR&&ee(bu,_.ADD_URI_SAFE_ATTR,$e),_.FORBID_CONTENTS&&(dn===gu&&(dn=pn(dn)),ee(dn,_.FORBID_CONTENTS,$e)),_.ADD_FORBID_CONTENTS&&(dn===gu&&(dn=pn(dn)),ee(dn,_.ADD_FORBID_CONTENTS,$e)),vu&&(ve["#text"]=!0),$a&&ee(ve,["html","head","body"]),ve.table&&(ee(ve,["tbody"]),delete ln.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Vo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Vo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=_.TRUSTED_TYPES_POLICY,x=E.createHTML("")}else E===void 0&&(E=v3(v,o)),E!==null&&typeof x=="string"&&(x=E.createHTML(""));ct&&ct(_),Or=_}},up=ee({},[...Bu,...Wu,...o3]),dp=ee({},[...Ku,...s3]),s0=function(_){let $=y(_);(!$||!$.tagName)&&($={namespaceURI:Pr,tagName:"template"});const j=Mi(_.tagName),pe=Mi($.tagName);return yu[_.namespaceURI]?_.namespaceURI===Hl?$.namespaceURI===Fn?j==="svg":$.namespaceURI===jl?j==="svg"&&(pe==="annotation-xml"||Bl[pe]):!!up[j]:_.namespaceURI===jl?$.namespaceURI===Fn?j==="math":$.namespaceURI===Hl?j==="math"&&Wl[pe]:!!dp[j]:_.namespaceURI===Fn?$.namespaceURI===Hl&&!Wl[pe]||$.namespaceURI===jl&&!Bl[pe]?!1:!dp[j]&&(n0[j]||!up[j]):!!(Ho==="application/xhtml+xml"&&yu[_.namespaceURI]):!1},hn=function(_){Ko(t.removed,{element:_});try{y(_).removeChild(_)}catch{T(_)}},Da=function(_,$){try{Ko(t.removed,{attribute:$.getAttributeNode(_),from:$})}catch{Ko(t.removed,{attribute:null,from:$})}if($.removeAttribute(_),_==="is")if($r||zl)try{hn($)}catch{}else try{$.setAttribute(_,"")}catch{}},hp=function(_){let $=null,j=null;if(mu)_="<remove></remove>"+_;else{const Ce=Hu(_,/^[\r\n\t ]+/);j=Ce&&Ce[0]}Ho==="application/xhtml+xml"&&Pr===Fn&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const pe=E?E.createHTML(_):_;if(Pr===Fn)try{$=new p().parseFromString(pe,Ho)}catch{}if(!$||!$.documentElement){$=S.createDocument(Pr,"template",null);try{$.documentElement.innerHTML=xu?x:pe}catch{}}const Ge=$.body||$.documentElement;return _&&j&&Ge.insertBefore(a.createTextNode(j),Ge.childNodes[0]||null),Pr===Fn?A.call($,$a?"html":"body")[0]:$a?$.documentElement:Ge},fp=function(_){return k.call(_.ownerDocument||_,_,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},ku=function(_){return _ instanceof f&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof h)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},pp=function(_){return typeof c=="function"&&_ instanceof c};function zn(B,_,$){ti(B,j=>{j.call(t,_,$,Or)})}const mp=function(_){let $=null;if(zn(z.beforeSanitizeElements,_,null),ku(_))return hn(_),!0;const j=$e(_.nodeName);if(zn(z.uponSanitizeElement,_,{tagName:j,allowedTags:ve}),Fl&&_.hasChildNodes()&&!pp(_.firstElementChild)&&tt(/<[/\w!]/g,_.innerHTML)&&tt(/<[/\w!]/g,_.textContent)||_.nodeType===Jo.progressingInstruction||Fl&&_.nodeType===Jo.comment&&tt(/<[/\w]/g,_.data))return hn(_),!0;if(!(cn.tagCheck instanceof Function&&cn.tagCheck(j))&&(!ve[j]||ln[j])){if(!ln[j]&&gp(j)&&(ue.tagNameCheck instanceof RegExp&&tt(ue.tagNameCheck,j)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(j)))return!1;if(vu&&!dn[j]){const pe=y(_)||_.parentNode,Ge=g(_)||_.childNodes;if(Ge&&pe){const Ce=Ge.length;for(let ht=Ce-1;ht>=0;--ht){const Un=C(Ge[ht],!0);Un.__removalCount=(_.__removalCount||0)+1,pe.insertBefore(Un,b(_))}}}return hn(_),!0}return _ instanceof u&&!s0(_)||(j==="noscript"||j==="noembed"||j==="noframes")&&tt(/<\/no(script|embed|frames)/i,_.innerHTML)?(hn(_),!0):(un&&_.nodeType===Jo.text&&($=_.textContent,ti([se,Fe,et],pe=>{$=qo($,pe," ")}),_.textContent!==$&&(Ko(t.removed,{element:_.cloneNode()}),_.textContent=$)),zn(z.afterSanitizeElements,_,null),!1)},vp=function(_,$,j){if(rp&&($==="id"||$==="name")&&(j in a||j in o0))return!1;if(!(Ra&&!Zn[$]&&tt(he,$))){if(!(Uo&&tt(yt,$))){if(!(cn.attributeCheck instanceof Function&&cn.attributeCheck($,_))){if(!Le[$]||Zn[$]){if(!(gp(_)&&(ue.tagNameCheck instanceof RegExp&&tt(ue.tagNameCheck,_)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(_))&&(ue.attributeNameCheck instanceof RegExp&&tt(ue.attributeNameCheck,$)||ue.attributeNameCheck instanceof Function&&ue.attributeNameCheck($,_))||$==="is"&&ue.allowCustomizedBuiltInElements&&(ue.tagNameCheck instanceof RegExp&&tt(ue.tagNameCheck,j)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(j))))return!1}else if(!bu[$]){if(!tt(ce,qo(j,xe,""))){if(!(($==="src"||$==="xlink:href"||$==="href")&&_!=="script"&&t3(j,"data:")===0&&sp[_])){if(!(La&&!tt($t,qo(j,xe,"")))){if(j)return!1}}}}}}}return!0},gp=function(_){return _!=="annotation-xml"&&Hu(_,W)},bp=function(_){zn(z.beforeSanitizeAttributes,_,null);const{attributes:$}=_;if(!$||ku(_))return;const j={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Le,forceKeepAttr:void 0};let pe=$.length;for(;pe--;){const Ge=$[pe],{name:Ce,namespaceURI:ht,value:Un}=Ge,Nr=$e(Ce),Su=Un;let Ke=Ce==="value"?Su:n3(Su);if(j.attrName=Nr,j.attrValue=Ke,j.keepAttr=!0,j.forceKeepAttr=void 0,zn(z.uponSanitizeAttribute,_,j),Ke=j.attrValue,op&&(Nr==="id"||Nr==="name")&&(Da(Ce,_),Ke=e0+Ke),Fl&&tt(/((--!?|])>)|<\/(style|title|textarea)/i,Ke)){Da(Ce,_);continue}if(Nr==="attributename"&&Hu(Ke,"href")){Da(Ce,_);continue}if(j.forceKeepAttr)continue;if(!j.keepAttr){Da(Ce,_);continue}if(!Nl&&tt(/\/>/i,Ke)){Da(Ce,_);continue}un&&ti([se,Fe,et],yp=>{Ke=qo(Ke,yp," ")});const xp=$e(_.nodeName);if(!vp(xp,Nr,Ke)){Da(Ce,_);continue}if(E&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!ht)switch(v.getAttributeType(xp,Nr)){case"TrustedHTML":{Ke=E.createHTML(Ke);break}case"TrustedScriptURL":{Ke=E.createScriptURL(Ke);break}}if(Ke!==Su)try{ht?_.setAttributeNS(ht,Ce,Ke):_.setAttribute(Ce,Ke),ku(_)?hn(_):Bm(t.removed)}catch{Da(Ce,_)}}zn(z.afterSanitizeAttributes,_,null)},l0=function B(_){let $=null;const j=fp(_);for(zn(z.beforeSanitizeShadowDOM,_,null);$=j.nextNode();)zn(z.uponSanitizeShadowNode,$,null),mp($),bp($),$.content instanceof s&&B($.content);zn(z.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(B){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=null,j=null,pe=null,Ge=null;if(xu=!B,xu&&(B="<!-->"),typeof B!="string"&&!pp(B))if(typeof B.toString=="function"){if(B=B.toString(),typeof B!="string")throw Vo("dirty is not a string, aborting")}else throw Vo("toString is not a function");if(!t.isSupported)return B;if(pu||wu(_),t.removed=[],typeof B=="string"&&(jo=!1),jo){if(B.nodeName){const Un=$e(B.nodeName);if(!ve[Un]||ln[Un])throw Vo("root node is forbidden and cannot be sanitized in-place")}}else if(B instanceof c)$=hp("<!---->"),j=$.ownerDocument.importNode(B,!0),j.nodeType===Jo.element&&j.nodeName==="BODY"||j.nodeName==="HTML"?$=j:$.appendChild(j);else{if(!$r&&!un&&!$a&&B.indexOf("<")===-1)return E&&Ul?E.createHTML(B):B;if($=hp(B),!$)return $r?null:Ul?x:""}$&&mu&&hn($.firstChild);const Ce=fp(jo?B:$);for(;pe=Ce.nextNode();)mp(pe),bp(pe),pe.content instanceof s&&l0(pe.content);if(jo)return B;if($r){if(zl)for(Ge=I.call($.ownerDocument);$.firstChild;)Ge.appendChild($.firstChild);else Ge=$;return(Le.shadowroot||Le.shadowrootmode)&&(Ge=O.call(r,Ge,!0)),Ge}let ht=$a?$.outerHTML:$.innerHTML;return $a&&ve["!doctype"]&&$.ownerDocument&&$.ownerDocument.doctype&&$.ownerDocument.doctype.name&&tt(dx,$.ownerDocument.doctype.name)&&(ht="<!DOCTYPE "+$.ownerDocument.doctype.name+`>
193
+ `+ht),un&&ti([se,Fe,et],Un=>{ht=qo(ht,Un," ")}),E&&Ul?E.createHTML(ht):ht},t.setConfig=function(){let B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};wu(B),pu=!0},t.clearConfig=function(){Or=null,pu=!1},t.isValidAttribute=function(B,_,$){Or||wu({});const j=$e(B),pe=$e(_);return vp(j,pe,$)},t.addHook=function(B,_){typeof _=="function"&&Ko(z[B],_)},t.removeHook=function(B,_){if(_!==void 0){const $=Q_(z[B],_);return $===-1?void 0:e3(z[B],$,1)[0]}return Bm(z[B])},t.removeHooks=function(B){z[B]=[]},t.removeAllHooks=function(){z=Jm()},t}var fx=hx();const g3={ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","p","br","hr","ul","ol","li","dl","dt","dd","strong","em","b","i","u","s","strike","del","ins","sub","sup","small","mark","abbr","code","pre","kbd","samp","var","blockquote","q","cite","a","img","figure","figcaption","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","div","span","details","summary"],ALLOWED_ATTR:["href","src","alt","title","class","id","name","target","rel","width","height","colspan","rowspan","scope","start","type","open","aria-label","aria-hidden","aria-describedby","role","tabindex","data-line","data-language"],ADD_ATTR:["target","rel"],FORBID_TAGS:["script","style","iframe","object","embed","form","input","button"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur"],ALLOW_DATA_ATTR:!1,ADD_DATA_URI_TAGS:["img"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|data):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i};function px(e){return fx.sanitize(e,{...g3,RETURN_TRUSTED_TYPE:!1})}function pc(e){return fx.sanitize(e,{ALLOWED_TAGS:["span","code","pre","br"],ALLOWED_ATTR:["class"],FORBID_TAGS:["script","style"],FORBID_ATTR:["onerror","onload","onclick"],RETURN_TRUSTED_TYPE:!1})}const b3={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",json:"json",py:"python",rs:"rust",go:"go",yaml:"yaml",yml:"yaml",md:"markdown",css:"css",sql:"sql",toml:"toml",sh:"bash",bash:"bash",zsh:"bash",diff:"diff",patch:"diff"};function x3(e){const t=e.split(".").pop()?.toLowerCase();return t&&b3[t]||null}function mx(e){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t),"json"}catch{}return t.startsWith("#!/")?t.includes("python")?"python":t.includes("node")?"javascript":(t.includes("bash")||t.includes("/sh"),"bash"):/^[\w-]+:\s/m.test(t)&&!t.includes("{")?"yaml":t.startsWith("diff ")||t.startsWith("---")&&t.includes("+++")?"diff":null}function y3({open:e,onClose:t,content:a,title:r,language:o}){const s=F(null),[i,c]=U(!1),u=ye(()=>{const p=o||mx(a);if(!p||!tn.languages[p])return null;try{const v=tn.highlight(a,tn.languages[p],p);return pc(v)}catch{return null}},[a,o]),d=Q(p=>{p.key==="Escape"&&t()},[t]);R(()=>{if(e)return document.body.style.overflow="hidden",document.addEventListener("keydown",d),()=>{document.body.style.overflow="",document.removeEventListener("keydown",d)}},[e,d]),R(()=>{e&&s.current&&s.current.focus()},[e]);const h=async()=>{const p=typeof navigator<"u"?navigator.clipboard:null;if(!p?.writeText){M.ui.warn("Clipboard API not available");return}try{await p.writeText(a),c(!0),setTimeout(()=>c(!1),2e3)}catch(v){M.ui.warn("Failed to copy output to clipboard",v)}};if(!e)return null;const f=a.split(`
194
+ `);return Qc(n("div",{class:"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 md:p-10",role:"dialog","aria-modal":"true","aria-labelledby":"output-modal-title",children:[n("div",{class:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:t,"aria-hidden":"true"}),n("div",{ref:s,tabIndex:-1,class:"relative w-full h-full max-w-[95vw] max-h-[90vh] flex flex-col bg-[var(--color-bg-primary)] border border-[var(--color-border)] rounded-lg shadow-2xl focus:outline-none overflow-hidden",children:[n("div",{class:"flex items-center justify-between px-4 py-3 border-b border-[var(--color-border)] bg-[var(--color-bg-surface)]",children:[n("h2",{id:"output-modal-title",class:"text-sm font-medium text-[var(--color-text-primary)]",children:[r,n("span",{class:"ml-2 text-xs text-[var(--color-text-muted)]",children:l("toolOutput.lines",{count:f.length})})]}),n("div",{class:"flex items-center gap-2",children:[n("button",{type:"button",onClick:h,class:"text-xs px-2 py-1 rounded bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] transition-colors",children:l(i?"actions.copied":"actions.copy")}),n(q,{icon:n(Ar,{}),label:l("actions.close"),variant:"ghost",size:"sm",onClick:t})]})]}),n("div",{class:"flex-1 overflow-auto bg-[var(--color-bg-tertiary)]",children:u?n("pre",{class:"text-xs font-mono leading-relaxed p-4 whitespace-pre-wrap break-words",dangerouslySetInnerHTML:{__html:u}}):n("pre",{class:"text-xs font-mono leading-relaxed p-4 text-[var(--color-text-primary)] whitespace-pre-wrap break-words",children:a})})]})]}),document.body)}function we({content:e,maxLines:t=30,error:a=!1,filePath:r}){const o=F(null),[s,i]=U(!1),[c,u]=U(!1),d=()=>{i(!1),requestAnimationFrame(()=>{o.current?.scrollIntoView({behavior:"smooth",block:"nearest"})})},h=typeof e=="object"&&e!==null,f=h?JSON.stringify(e,null,2):String(e),p=f.split(`
195
195
  `),v=p.length>t,w=s||!v?f:p.slice(0,t).join(`
196
- `),C=h?"json":(r?b3(r):null)||mx(f),T=xe(()=>{if(a||!C||!en.languages[C])return null;try{const y=en.highlight(w,en.languages[C],C);return vc(y)}catch{return null}},[w,C,a]),b=`text-xs p-2 rounded-md overflow-x-auto font-mono leading-relaxed whitespace-pre-wrap ${a?"bg-[var(--color-error)]/10 text-[var(--color-error)]":"bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)]"}`,g="block w-full text-left text-xs py-1 px-2 bg-[var(--color-bg-secondary)] rounded-b-md border-t border-[var(--color-border)] transition-colors";return n(H,{children:[n("div",{ref:o,class:"relative group",children:[(v||p.length>10)&&n(q,{icon:n(yS,{}),label:l("toolOutput.expand"),variant:"ghost",size:"sm",showTooltip:!1,onClick:()=>u(!0),class:"!absolute top-2 right-2 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity z-10 bg-[var(--color-bg-surface)]/90 hover:bg-[var(--color-bg-secondary)]"}),T?n("pre",{class:`${b} ${s?"":"max-h-[300px]"}`,dangerouslySetInnerHTML:{__html:T}}):n("pre",{class:`${b} ${s?"":"max-h-[300px]"}`,children:w}),v&&!s&&n("button",{type:"button",onClick:()=>i(!0),class:`${g} text-[var(--color-accent)] hover:text-[var(--color-accent-hover)]`,children:l("toolOutput.moreLines",{count:p.length-t})}),v&&s&&n("button",{type:"button",onClick:d,class:`${g} text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]`,children:l("toolOutput.collapse")})]}),n(x3,{open:c,onClose:()=>u(!1),content:f,title:l("common.output"),language:C||void 0})]})}function xt({children:e,mono:t=!0,inline:a=!1,class:r=""}){return n("div",{class:`text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)] ${t?"font-mono":""} ${a?"flex items-center gap-2":""} ${r}`.trim(),children:e})}function st({children:e,title:t}){return n("span",{class:"text-[10px] text-[var(--color-text-muted)] bg-[var(--color-bg-secondary)] px-1.5 py-0.5 rounded",title:t,children:e})}function wt({children:e,class:t=""}){return n("div",{class:`text-xs text-[var(--color-text-muted)] italic p-2 ${t}`.trim(),children:e})}function ea({children:e,header:t,success:a=!0}){return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-2",children:[n("div",{class:"flex items-center gap-2",children:[a&&n("span",{class:"text-[var(--color-success)]",children:"✓"}),t]}),e]})}function Hd({children:e}){return n("div",{class:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-[var(--color-text-muted)]",children:e})}function Kt({label:e,children:t,mono:a=!1,small:r=!1}){const o=["text-[var(--color-text-primary)]",a?"font-mono":"",r?"text-[10px]":""].filter(Boolean).join(" ");return n(H,{children:[n("span",{children:[e,":"]}),n("span",{class:o,children:t})]})}function Vn(e){if(typeof e=="object"&&e!==null)return e;if(typeof e=="string")try{return JSON.parse(e)}catch{return null}return null}function vx(e){const t=Vn(e);return t&&t.status==="error"&&typeof t.error=="string"?{status:"error",error:t.error,tool:t.tool}:null}function y3({result:e}){const a=Vn(e)?.results;if(!a||!Array.isArray(a)||a.length===0)return n(ye,{content:e,maxLines:20});const r=o=>o?o.replace(/\n?<<<EXTERNAL_UNTRUSTED_CONTENT>>>\nSource: Web Search\n---\n?/g,"").replace(/\n?<<<END_EXTERNAL_UNTRUSTED_CONTENT>>>/g,"").replace(/<\/?strong>/g,"").trim():"";return n("div",{class:"space-y-2",children:a.map((o,s)=>n("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",class:"block text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-1 border border-transparent hover:border-[var(--color-accent)]/50 transition-colors cursor-pointer no-underline",children:[n("div",{class:"font-medium text-[var(--color-text-primary)]",children:r(o.title)}),n("div",{class:"text-[var(--color-accent)] truncate",children:o.url}),o.description&&n("div",{class:"text-[var(--color-text-muted)]",children:r(o.description)})]},s))})}function w3({args:e}){const t=e.url;return n(xt,{children:[n("span",{class:"sr-only",children:[l("common.url"),": "]}),"🌐 ",t]})}function k3({result:e}){const t=Vn(e);if(!t?.text)return n(ye,{content:e,maxLines:20});const a=t.text.replace(/\n?<<<EXTERNAL_UNTRUSTED_CONTENT>>>\nSource: Web Fetch\n---\n?/g,"").replace(/\n?<<<END_EXTERNAL_UNTRUSTED_CONTENT>>>/g,"").trim();return n("div",{class:"space-y-2",children:[n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] font-mono text-[var(--color-text-muted)]",children:[t.url," ",t.status&&`(${t.status})`]}),n(ye,{content:a,maxLines:30,filePath:"content.md"})]})}function S3({args:e}){const t=e.path,a=e.from,r=e.lines,o=a&&r?`${a}-${a+r-1}`:a?`${a}+`:void 0;return n(xt,{inline:!0,children:[n("span",{class:"sr-only",children:[l("toolInput.memoryPath"),": "]}),n("span",{children:["📄 ",t,o&&n("span",{class:"text-[var(--color-text-muted)]",children:[":",o]})]}),r&&n(st,{children:l("toolOutput.lines",{count:r})})]})}function _3({result:e}){const a=Vn(e)?.results;return!a||!Array.isArray(a)||a.length===0?n(ye,{content:e,maxLines:20}):n("div",{class:"space-y-3",children:a.map((r,o)=>n("div",{class:"space-y-1",children:[n("div",{class:"flex items-center justify-between text-xs px-1",children:[n("div",{class:"font-mono text-[var(--color-accent)]",children:[r.path,r.startLine&&r.endLine&&n("span",{class:"text-[var(--color-text-muted)]",children:[":",r.startLine,"-",r.endLine]})]}),r.score!==void 0&&n("div",{class:"text-[var(--color-text-muted)]",children:[(r.score*100).toFixed(0),"%"]})]}),r.snippet&&n(ye,{content:r.snippet.replace(/\nSource:.*$/,"").trim(),filePath:r.path,maxLines:10})]},o))})}function C3({result:e}){const t=Vn(e);return t?.text?n(ye,{content:t.text,filePath:t.path,maxLines:30}):n(ye,{content:e,maxLines:20})}function wf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ir=wf();function gx(e){Ir=e}var Ua={exec:()=>null};function re(e,t=""){let a=typeof e=="string"?e:e.source,r={replace:(o,s)=>{let i=typeof s=="string"?s:s.source;return i=i.replace(it.caret,"$1"),a=a.replace(o,i),r},getRegex:()=>new RegExp(a,t)};return r}var T3=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),it={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,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"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},E3=/^(?:[ \t]*(?:\n|$))+/,A3=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,M3=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Rl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,I3=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,kf=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,bx=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,xx=re(bx).replace(/bull/g,kf).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(),R3=re(bx).replace(/bull/g,kf).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(),Sf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,L3=/^[^\n]+/,_f=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,$3=re(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_f).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),D3=re(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,kf).getRegex(),ou="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",Cf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,P3=re("^ {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",Cf).replace("tag",ou).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),yx=re(Sf).replace("hr",Rl).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[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ou).getRegex(),O3=re(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",yx).getRegex(),Tf={blockquote:O3,code:A3,def:$3,fences:M3,heading:I3,hr:Rl,html:P3,lheading:xx,list:D3,newline:E3,paragraph:yx,table:Ua,text:L3},Zm=re("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Rl).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[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ou).getRegex(),N3={...Tf,lheading:R3,table:Zm,paragraph:re(Sf).replace("hr",Rl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Zm).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ou).getRegex()},F3={...Tf,html:re(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Cf).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:Ua,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:re(Sf).replace("hr",Rl).replace("heading",` *#{1,6} *[^
197
- ]`).replace("lheading",xx).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},z3=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,U3=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,wx=/^( {2,}|\\)\n(?!\s*$)/,j3=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,su=/[\p{P}\p{S}]/u,Ef=/[\s\p{P}\p{S}]/u,kx=/[^\s\p{P}\p{S}]/u,H3=re(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ef).getRegex(),Sx=/(?!~)[\p{P}\p{S}]/u,B3=/(?!~)[\s\p{P}\p{S}]/u,W3=/(?:[^\s\p{P}\p{S}]|~)/u,_x=/(?![*_])[\p{P}\p{S}]/u,K3=/(?![*_])[\s\p{P}\p{S}]/u,q3=/(?:[^\s\p{P}\p{S}]|[*_])/u,V3=re(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",T3?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Cx=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,G3=re(Cx,"u").replace(/punct/g,su).getRegex(),J3=re(Cx,"u").replace(/punct/g,Sx).getRegex(),Tx="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Y3=re(Tx,"gu").replace(/notPunctSpace/g,kx).replace(/punctSpace/g,Ef).replace(/punct/g,su).getRegex(),Z3=re(Tx,"gu").replace(/notPunctSpace/g,W3).replace(/punctSpace/g,B3).replace(/punct/g,Sx).getRegex(),X3=re("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,kx).replace(/punctSpace/g,Ef).replace(/punct/g,su).getRegex(),Q3=re(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,_x).getRegex(),eC="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",tC=re(eC,"gu").replace(/notPunctSpace/g,q3).replace(/punctSpace/g,K3).replace(/punct/g,_x).getRegex(),nC=re(/\\(punct)/,"gu").replace(/punct/g,su).getRegex(),aC=re(/^<(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(),rC=re(Cf).replace("(?:-->|$)","-->").getRegex(),oC=re("^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",rC).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),gc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,sC=re(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",gc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ex=re(/^!?\[(label)\]\[(ref)\]/).replace("label",gc).replace("ref",_f).getRegex(),Ax=re(/^!?\[(ref)\](?:\[\])?/).replace("ref",_f).getRegex(),lC=re("reflink|nolink(?!\\()","g").replace("reflink",Ex).replace("nolink",Ax).getRegex(),Xm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Af={_backpedal:Ua,anyPunctuation:nC,autolink:aC,blockSkip:V3,br:wx,code:U3,del:Ua,delLDelim:Ua,delRDelim:Ua,emStrongLDelim:G3,emStrongRDelimAst:Y3,emStrongRDelimUnd:X3,escape:z3,link:sC,nolink:Ax,punctuation:H3,reflink:Ex,reflinkSearch:lC,tag:oC,text:j3,url:Ua},iC={...Af,link:re(/^!?\[(label)\]\((.*?)\)/).replace("label",gc).getRegex(),reflink:re(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",gc).getRegex()},Bd={...Af,emStrongRDelimAst:Z3,emStrongLDelim:J3,delLDelim:Q3,delRDelim:tC,url:re(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Xm).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:re(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Xm).getRegex()},cC={...Bd,br:re(wx).replace("{2,}","*").getRegex(),text:re(Bd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ai={normal:Tf,gfm:N3,pedantic:F3},Yo={normal:Af,gfm:Bd,breaks:cC,pedantic:iC},uC={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Qm=e=>uC[e];function mn(e,t){if(t){if(it.escapeTest.test(e))return e.replace(it.escapeReplace,Qm)}else if(it.escapeTestNoEncode.test(e))return e.replace(it.escapeReplaceNoEncode,Qm);return e}function ev(e){try{e=encodeURI(e).replace(it.percentDecode,"%")}catch{return null}return e}function tv(e,t){let a=e.replace(it.findPipe,(s,i,c)=>{let u=!1,d=i;for(;--d>=0&&c[d]==="\\";)u=!u;return u?"|":" |"}),r=a.split(it.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(it.slashPipe,"|");return r}function Zo(e,t,a){let r=e.length;if(r===0)return"";let o=0;for(;o<r&&e.charAt(r-o-1)===t;)o++;return e.slice(0,r-o)}function dC(e,t){if(e.indexOf(t[1])===-1)return-1;let a=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])a++;else if(e[r]===t[1]&&(a--,a<0))return r;return a>0?-2:-1}function hC(e,t=0){let a=t,r="";for(let o of e)if(o===" "){let s=4-a%4;r+=" ".repeat(s),a+=s}else r+=o,a++;return r}function nv(e,t,a,r,o){let s=t.href,i=t.title||null,c=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let u={type:e[0].charAt(0)==="!"?"image":"link",raw:a,href:s,title:i,text:c,tokens:r.inlineTokens(c)};return r.state.inLink=!1,u}function fC(e,t,a){let r=e.match(a.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
196
+ `),C=h?"json":(r?x3(r):null)||mx(f),T=ye(()=>{if(a||!C||!tn.languages[C])return null;try{const y=tn.highlight(w,tn.languages[C],C);return pc(y)}catch{return null}},[w,C,a]),b=`text-xs p-2 rounded-md overflow-x-auto font-mono leading-relaxed whitespace-pre-wrap ${a?"bg-[var(--color-error)]/10 text-[var(--color-error)]":"bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)]"}`,g="block w-full text-left text-xs py-1 px-2 bg-[var(--color-bg-secondary)] rounded-b-md border-t border-[var(--color-border)] transition-colors";return n(H,{children:[n("div",{ref:o,class:"relative group",children:[(v||p.length>10)&&n(q,{icon:n(wS,{}),label:l("toolOutput.expand"),variant:"ghost",size:"sm",showTooltip:!1,onClick:()=>u(!0),class:"!absolute top-2 right-2 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity z-10 bg-[var(--color-bg-surface)]/90 hover:bg-[var(--color-bg-secondary)]"}),T?n("pre",{class:`${b} ${s?"":"max-h-[300px]"}`,dangerouslySetInnerHTML:{__html:T}}):n("pre",{class:`${b} ${s?"":"max-h-[300px]"}`,children:w}),v&&!s&&n("button",{type:"button",onClick:()=>i(!0),class:`${g} text-[var(--color-accent)] hover:text-[var(--color-accent-hover)]`,children:l("toolOutput.moreLines",{count:p.length-t})}),v&&s&&n("button",{type:"button",onClick:d,class:`${g} text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]`,children:l("toolOutput.collapse")})]}),n(y3,{open:c,onClose:()=>u(!1),content:f,title:l("common.output"),language:C||void 0})]})}function xt({children:e,mono:t=!0,inline:a=!1,class:r=""}){return n("div",{class:`text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)] ${t?"font-mono":""} ${a?"flex items-center gap-2":""} ${r}`.trim(),children:e})}function ot({children:e,title:t}){return n("span",{class:"text-[10px] text-[var(--color-text-muted)] bg-[var(--color-bg-secondary)] px-1.5 py-0.5 rounded",title:t,children:e})}function kt({children:e,class:t=""}){return n("div",{class:`text-xs text-[var(--color-text-muted)] italic p-2 ${t}`.trim(),children:e})}function ta({children:e,header:t,success:a=!0}){return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-2",children:[n("div",{class:"flex items-center gap-2",children:[a&&n("span",{class:"text-[var(--color-success)]",children:"✓"}),t]}),e]})}function zd({children:e}){return n("div",{class:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-[var(--color-text-muted)]",children:e})}function Vt({label:e,children:t,mono:a=!1,small:r=!1}){const o=["text-[var(--color-text-primary)]",a?"font-mono":"",r?"text-[10px]":""].filter(Boolean).join(" ");return n(H,{children:[n("span",{children:[e,":"]}),n("span",{class:o,children:t})]})}function Yn(e){if(typeof e=="object"&&e!==null)return e;if(typeof e=="string")try{return JSON.parse(e)}catch{return null}return null}function vx(e){const t=Yn(e);return t&&t.status==="error"&&typeof t.error=="string"?{status:"error",error:t.error,tool:t.tool}:null}function w3({result:e}){const a=Yn(e)?.results;if(!a||!Array.isArray(a)||a.length===0)return n(we,{content:e,maxLines:20});const r=o=>o?o.replace(/\n?<<<EXTERNAL_UNTRUSTED_CONTENT>>>\nSource: Web Search\n---\n?/g,"").replace(/\n?<<<END_EXTERNAL_UNTRUSTED_CONTENT>>>/g,"").replace(/<\/?strong>/g,"").trim():"";return n("div",{class:"space-y-2",children:a.map((o,s)=>n("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",class:"block text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-1 border border-transparent hover:border-[var(--color-accent)]/50 transition-colors cursor-pointer no-underline",children:[n("div",{class:"font-medium text-[var(--color-text-primary)]",children:r(o.title)}),n("div",{class:"text-[var(--color-accent)] truncate",children:o.url}),o.description&&n("div",{class:"text-[var(--color-text-muted)]",children:r(o.description)})]},s))})}function k3({args:e}){const t=e.url;return n(xt,{children:[n("span",{class:"sr-only",children:[l("common.url"),": "]}),"🌐 ",t]})}function S3({result:e}){const t=Yn(e);if(!t?.text)return n(we,{content:e,maxLines:20});const a=t.text.replace(/\n?<<<EXTERNAL_UNTRUSTED_CONTENT>>>\nSource: Web Fetch\n---\n?/g,"").replace(/\n?<<<END_EXTERNAL_UNTRUSTED_CONTENT>>>/g,"").trim();return n("div",{class:"space-y-2",children:[n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] font-mono text-[var(--color-text-muted)]",children:[t.url," ",t.status&&`(${t.status})`]}),n(we,{content:a,maxLines:30,filePath:"content.md"})]})}function _3({args:e}){const t=e.path,a=e.from,r=e.lines,o=a&&r?`${a}-${a+r-1}`:a?`${a}+`:void 0;return n(xt,{inline:!0,children:[n("span",{class:"sr-only",children:[l("toolInput.memoryPath"),": "]}),n("span",{children:["📄 ",t,o&&n("span",{class:"text-[var(--color-text-muted)]",children:[":",o]})]}),r&&n(ot,{children:l("toolOutput.lines",{count:r})})]})}function C3({result:e}){const a=Yn(e)?.results;return!a||!Array.isArray(a)||a.length===0?n(we,{content:e,maxLines:20}):n("div",{class:"space-y-3",children:a.map((r,o)=>n("div",{class:"space-y-1",children:[n("div",{class:"flex items-center justify-between text-xs px-1",children:[n("div",{class:"font-mono text-[var(--color-accent)]",children:[r.path,r.startLine&&r.endLine&&n("span",{class:"text-[var(--color-text-muted)]",children:[":",r.startLine,"-",r.endLine]})]}),r.score!==void 0&&n("div",{class:"text-[var(--color-text-muted)]",children:[(r.score*100).toFixed(0),"%"]})]}),r.snippet&&n(we,{content:r.snippet.replace(/\nSource:.*$/,"").trim(),filePath:r.path,maxLines:10})]},o))})}function T3({result:e}){const t=Yn(e);return t?.text?n(we,{content:t.text,filePath:t.path,maxLines:30}):n(we,{content:e,maxLines:20})}function xf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ir=xf();function gx(e){Ir=e}var Ua={exec:()=>null};function re(e,t=""){let a=typeof e=="string"?e:e.source,r={replace:(o,s)=>{let i=typeof s=="string"?s:s.source;return i=i.replace(lt.caret,"$1"),a=a.replace(o,i),r},getRegex:()=>new RegExp(a,t)};return r}var E3=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),lt={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,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"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},A3=/^(?:[ \t]*(?:\n|$))+/,M3=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,I3=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Rl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,R3=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,yf=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,bx=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,xx=re(bx).replace(/bull/g,yf).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(),L3=re(bx).replace(/bull/g,yf).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(),wf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$3=/^[^\n]+/,kf=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,D3=re(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",kf).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),P3=re(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,yf).getRegex(),nu="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",Sf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,O3=re("^ {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",Sf).replace("tag",nu).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),yx=re(wf).replace("hr",Rl).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[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",nu).getRegex(),N3=re(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",yx).getRegex(),_f={blockquote:N3,code:M3,def:D3,fences:I3,heading:R3,hr:Rl,html:O3,lheading:xx,list:P3,newline:A3,paragraph:yx,table:Ua,text:$3},Ym=re("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Rl).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[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",nu).getRegex(),F3={..._f,lheading:L3,table:Ym,paragraph:re(wf).replace("hr",Rl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ym).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",nu).getRegex()},z3={..._f,html:re(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Sf).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:Ua,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:re(wf).replace("hr",Rl).replace("heading",` *#{1,6} *[^
197
+ ]`).replace("lheading",xx).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},U3=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,j3=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,wx=/^( {2,}|\\)\n(?!\s*$)/,H3=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,au=/[\p{P}\p{S}]/u,Cf=/[\s\p{P}\p{S}]/u,kx=/[^\s\p{P}\p{S}]/u,B3=re(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Cf).getRegex(),Sx=/(?!~)[\p{P}\p{S}]/u,W3=/(?!~)[\s\p{P}\p{S}]/u,K3=/(?:[^\s\p{P}\p{S}]|~)/u,_x=/(?![*_])[\p{P}\p{S}]/u,q3=/(?![*_])[\s\p{P}\p{S}]/u,V3=/(?:[^\s\p{P}\p{S}]|[*_])/u,G3=re(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",E3?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Cx=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,J3=re(Cx,"u").replace(/punct/g,au).getRegex(),Y3=re(Cx,"u").replace(/punct/g,Sx).getRegex(),Tx="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Z3=re(Tx,"gu").replace(/notPunctSpace/g,kx).replace(/punctSpace/g,Cf).replace(/punct/g,au).getRegex(),X3=re(Tx,"gu").replace(/notPunctSpace/g,K3).replace(/punctSpace/g,W3).replace(/punct/g,Sx).getRegex(),Q3=re("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,kx).replace(/punctSpace/g,Cf).replace(/punct/g,au).getRegex(),eC=re(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,_x).getRegex(),tC="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",nC=re(tC,"gu").replace(/notPunctSpace/g,V3).replace(/punctSpace/g,q3).replace(/punct/g,_x).getRegex(),aC=re(/\\(punct)/,"gu").replace(/punct/g,au).getRegex(),rC=re(/^<(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(),oC=re(Sf).replace("(?:-->|$)","-->").getRegex(),sC=re("^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",oC).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),mc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,lC=re(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",mc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ex=re(/^!?\[(label)\]\[(ref)\]/).replace("label",mc).replace("ref",kf).getRegex(),Ax=re(/^!?\[(ref)\](?:\[\])?/).replace("ref",kf).getRegex(),iC=re("reflink|nolink(?!\\()","g").replace("reflink",Ex).replace("nolink",Ax).getRegex(),Zm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Tf={_backpedal:Ua,anyPunctuation:aC,autolink:rC,blockSkip:G3,br:wx,code:j3,del:Ua,delLDelim:Ua,delRDelim:Ua,emStrongLDelim:J3,emStrongRDelimAst:Z3,emStrongRDelimUnd:Q3,escape:U3,link:lC,nolink:Ax,punctuation:B3,reflink:Ex,reflinkSearch:iC,tag:sC,text:H3,url:Ua},cC={...Tf,link:re(/^!?\[(label)\]\((.*?)\)/).replace("label",mc).getRegex(),reflink:re(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",mc).getRegex()},Ud={...Tf,emStrongRDelimAst:X3,emStrongLDelim:Y3,delLDelim:eC,delRDelim:nC,url:re(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Zm).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:re(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Zm).getRegex()},uC={...Ud,br:re(wx).replace("{2,}","*").getRegex(),text:re(Ud.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ai={normal:_f,gfm:F3,pedantic:z3},Yo={normal:Tf,gfm:Ud,breaks:uC,pedantic:cC},dC={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Xm=e=>dC[e];function mn(e,t){if(t){if(lt.escapeTest.test(e))return e.replace(lt.escapeReplace,Xm)}else if(lt.escapeTestNoEncode.test(e))return e.replace(lt.escapeReplaceNoEncode,Xm);return e}function Qm(e){try{e=encodeURI(e).replace(lt.percentDecode,"%")}catch{return null}return e}function ev(e,t){let a=e.replace(lt.findPipe,(s,i,c)=>{let u=!1,d=i;for(;--d>=0&&c[d]==="\\";)u=!u;return u?"|":" |"}),r=a.split(lt.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(lt.slashPipe,"|");return r}function Zo(e,t,a){let r=e.length;if(r===0)return"";let o=0;for(;o<r&&e.charAt(r-o-1)===t;)o++;return e.slice(0,r-o)}function hC(e,t){if(e.indexOf(t[1])===-1)return-1;let a=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])a++;else if(e[r]===t[1]&&(a--,a<0))return r;return a>0?-2:-1}function fC(e,t=0){let a=t,r="";for(let o of e)if(o===" "){let s=4-a%4;r+=" ".repeat(s),a+=s}else r+=o,a++;return r}function tv(e,t,a,r,o){let s=t.href,i=t.title||null,c=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let u={type:e[0].charAt(0)==="!"?"image":"link",raw:a,href:s,title:i,text:c,tokens:r.inlineTokens(c)};return r.state.inLink=!1,u}function pC(e,t,a){let r=e.match(a.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
198
198
  `).map(s=>{let i=s.match(a.other.beginningSpace);if(i===null)return s;let[c]=i;return c.length>=o.length?s.slice(o.length):s}).join(`
199
- `)}var bc=class{options;rules;lexer;constructor(e){this.options=e||Ir}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 a=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?a:Zo(a,`
200
- `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let a=t[0],r=fC(a,t[3]||"",this.rules);return{type:"code",raw:a,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let a=t[2].trim();if(this.rules.other.endingHash.test(a)){let r=Zo(a,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(a=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:a,tokens:this.lexer.inline(a)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Zo(t[0],`
199
+ `)}var vc=class{options;rules;lexer;constructor(e){this.options=e||Ir}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 a=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?a:Zo(a,`
200
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let a=t[0],r=pC(a,t[3]||"",this.rules);return{type:"code",raw:a,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let a=t[2].trim();if(this.rules.other.endingHash.test(a)){let r=Zo(a,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(a=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:a,tokens:this.lexer.inline(a)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Zo(t[0],`
201
201
  `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let a=Zo(t[0],`
202
202
  `).split(`
203
203
  `),r="",o="",s=[];for(;a.length>0;){let i=!1,c=[],u;for(u=0;u<a.length;u++)if(this.rules.other.blockquoteStart.test(a[u]))c.push(a[u]),i=!0;else if(!i)c.push(a[u]);else break;a=a.slice(u);let d=c.join(`
@@ -209,17 +209,17 @@ ${h}`:h;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
209
209
  `),C=this.blockquote(w);s[s.length-1]=C,r=r.substring(0,r.length-v.raw.length)+C.raw,o=o.substring(0,o.length-v.text.length)+C.text;break}else if(p?.type==="list"){let v=p,w=v.raw+`
210
210
  `+a.join(`
211
211
  `),C=this.list(w);s[s.length-1]=C,r=r.substring(0,r.length-p.raw.length)+C.raw,o=o.substring(0,o.length-v.raw.length)+C.raw,a=w.substring(s.at(-1).raw.length).split(`
212
- `);continue}}return{type:"blockquote",raw:r,tokens:s,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let a=t[1].trim(),r=a.length>1,o={type:"list",raw:"",ordered:r,start:r?+a.slice(0,-1):"",loose:!1,items:[]};a=r?`\\d{1,9}\\${a.slice(-1)}`:`\\${a}`,this.options.pedantic&&(a=r?a:"[*+-]");let s=this.rules.other.listItemRegex(a),i=!1;for(;e;){let u=!1,d="",h="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let f=hC(t[2].split(`
212
+ `);continue}}return{type:"blockquote",raw:r,tokens:s,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let a=t[1].trim(),r=a.length>1,o={type:"list",raw:"",ordered:r,start:r?+a.slice(0,-1):"",loose:!1,items:[]};a=r?`\\d{1,9}\\${a.slice(-1)}`:`\\${a}`,this.options.pedantic&&(a=r?a:"[*+-]");let s=this.rules.other.listItemRegex(a),i=!1;for(;e;){let u=!1,d="",h="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let f=fC(t[2].split(`
213
213
  `,1)[0],t[1].length),p=e.split(`
214
214
  `,1)[0],v=!f.trim(),w=0;if(this.options.pedantic?(w=2,h=f.trimStart()):v?w=t[1].length+1:(w=f.search(this.rules.other.nonSpaceChar),w=w>4?1:w,h=f.slice(w),w+=t[1].length),v&&this.rules.other.blankLine.test(p)&&(d+=p+`
215
215
  `,e=e.substring(p.length+1),u=!0),!u){let C=this.rules.other.nextBulletRegex(w),T=this.rules.other.hrRegex(w),b=this.rules.other.fencesBeginRegex(w),g=this.rules.other.headingBeginRegex(w),y=this.rules.other.htmlBeginRegex(w),E=this.rules.other.blockquoteBeginRegex(w);for(;e;){let x=e.split(`
216
216
  `,1)[0],S;if(p=x,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),S=p):S=p.replace(this.rules.other.tabCharGlobal," "),b.test(p)||g.test(p)||y.test(p)||E.test(p)||C.test(p)||T.test(p))break;if(S.search(this.rules.other.nonSpaceChar)>=w||!p.trim())h+=`
217
217
  `+S.slice(w);else{if(v||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||b.test(f)||g.test(f)||T.test(f))break;h+=`
218
218
  `+p}v=!p.trim(),d+=x+`
219
- `,e=e.substring(x.length+1),f=S.slice(w)}}o.loose||(i?o.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(i=!0)),o.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=d}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 u of o.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),u.tokens[0]?.type==="text"||u.tokens[0]?.type==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(u.raw);if(d){let h={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};u.checked=h.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=h.raw+u.tokens[0].raw,u.tokens[0].text=h.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(h)):u.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):u.tokens.unshift(h)}}if(!o.loose){let d=u.tokens.filter(f=>f.type==="space"),h=d.length>0&&d.some(f=>this.rules.other.anyLine.test(f.raw));o.loose=h}}if(o.loose)for(let u of o.items){u.loose=!0;for(let d of u.tokens)d.type==="text"&&(d.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 a=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=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:a,raw:t[0],href:r,title:o}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let a=tv(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
220
- `):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(a.length===r.length){for(let i of r)this.rules.other.tableAlignRight.test(i)?s.align.push("right"):this.rules.other.tableAlignCenter.test(i)?s.align.push("center"):this.rules.other.tableAlignLeft.test(i)?s.align.push("left"):s.align.push(null);for(let i=0;i<a.length;i++)s.header.push({text:a[i],tokens:this.lexer.inline(a[i]),header:!0,align:s.align[i]});for(let i of o)s.rows.push(tv(i,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:s.align[u]})));return s}}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 a=t[1].charAt(t[1].length-1)===`
221
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:a,tokens:this.lexer.inline(a)}}}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 a=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(a)){if(!this.rules.other.endAngleBracket.test(a))return;let s=Zo(a.slice(0,-1),"\\");if((a.length-s.length)%2===0)return}else{let s=dC(t[2],"()");if(s===-2)return;if(s>-1){let i=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,i).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],o=s[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(a)?r=r.slice(1):r=r.slice(1,-1)),nv(t,{href:r&&r.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 a;if((a=this.rules.inline.reflink.exec(e))||(a=this.rules.inline.nolink.exec(e))){let r=(a[2]||a[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let s=a[0].charAt(0);return{type:"text",raw:s,text:s}}return nv(a,o,a[0],this.lexer,this.rules)}}emStrong(e,t,a=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&a.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!a||this.rules.inline.punctuation.exec(a))){let o=[...r[0]].length-1,s,i,c=o,u=0,d=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+o);(r=d.exec(t))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(i=[...s].length,r[3]||r[4]){c+=i;continue}else if((r[5]||r[6])&&o%3&&!((o+i)%3)){u+=i;continue}if(c-=i,c>0)continue;i=Math.min(i,i+c+u);let h=[...r[0]][0].length,f=e.slice(0,o+r.index+h+i);if(Math.min(o,i)%2){let v=f.slice(1,-1);return{type:"em",raw:f,text:v,tokens:this.lexer.inlineTokens(v)}}let p=f.slice(2,-2);return{type:"strong",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let a=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(a),o=this.rules.other.startingSpaceChar.test(a)&&this.rules.other.endingSpaceChar.test(a);return r&&o&&(a=a.substring(1,a.length-1)),{type:"codespan",raw:t[0],text:a}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,a=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!a||this.rules.inline.punctuation.exec(a))){let o=[...r[0]].length-1,s,i,c=o,u=this.rules.inline.delRDelim;for(u.lastIndex=0,t=t.slice(-1*e.length+o);(r=u.exec(t))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(i=[...s].length,i!==o))continue;if(r[3]||r[4]){c+=i;continue}if(c-=i,c>0)continue;i=Math.min(i,i+c);let d=[...r[0]][0].length,h=e.slice(0,o+r.index+d+i),f=h.slice(o,-o);return{type:"del",raw:h,text:f,tokens:this.lexer.inlineTokens(f)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let a,r;return t[2]==="@"?(a=t[1],r="mailto:"+a):(a=t[1],r=a),{type:"link",raw:t[0],text:a,href:r,tokens:[{type:"text",raw:a,text:a}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let a,r;if(t[2]==="@")a=t[0],r="mailto:"+a;else{let o;do o=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(o!==t[0]);a=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0]}return{type:"link",raw:t[0],text:a,href:r,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let a=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:a}}}},qt=class Wd{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Ir,this.options.tokenizer=this.options.tokenizer||new bc,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 a={other:it,block:ai.normal,inline:Yo.normal};this.options.pedantic?(a.block=ai.pedantic,a.inline=Yo.pedantic):this.options.gfm&&(a.block=ai.gfm,this.options.breaks?a.inline=Yo.breaks:a.inline=Yo.gfm),this.tokenizer.rules=a}static get rules(){return{block:ai,inline:Yo}}static lex(t,a){return new Wd(a).lex(t)}static lexInline(t,a){return new Wd(a).inlineTokens(t)}lex(t){t=t.replace(it.carriageReturn,`
222
- `),this.blockTokens(t,this.tokens);for(let a=0;a<this.inlineQueue.length;a++){let r=this.inlineQueue[a];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,a=[],r=!1){for(this.options.pedantic&&(t=t.replace(it.tabCharGlobal," ").replace(it.spaceLine,""));t;){let o;if(this.options.extensions?.block?.some(i=>(o=i.call({lexer:this},t,a))?(t=t.substring(o.raw.length),a.push(o),!0):!1))continue;if(o=this.tokenizer.space(t)){t=t.substring(o.raw.length);let i=a.at(-1);o.raw.length===1&&i!==void 0?i.raw+=`
219
+ `,e=e.substring(x.length+1),f=S.slice(w)}}o.loose||(i?o.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(i=!0)),o.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=d}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 u of o.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),u.tokens[0]?.type==="text"||u.tokens[0]?.type==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(u.raw);if(d){let h={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};u.checked=h.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=h.raw+u.tokens[0].raw,u.tokens[0].text=h.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(h)):u.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):u.tokens.unshift(h)}}if(!o.loose){let d=u.tokens.filter(f=>f.type==="space"),h=d.length>0&&d.some(f=>this.rules.other.anyLine.test(f.raw));o.loose=h}}if(o.loose)for(let u of o.items){u.loose=!0;for(let d of u.tokens)d.type==="text"&&(d.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 a=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=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:a,raw:t[0],href:r,title:o}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let a=ev(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
220
+ `):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(a.length===r.length){for(let i of r)this.rules.other.tableAlignRight.test(i)?s.align.push("right"):this.rules.other.tableAlignCenter.test(i)?s.align.push("center"):this.rules.other.tableAlignLeft.test(i)?s.align.push("left"):s.align.push(null);for(let i=0;i<a.length;i++)s.header.push({text:a[i],tokens:this.lexer.inline(a[i]),header:!0,align:s.align[i]});for(let i of o)s.rows.push(ev(i,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:s.align[u]})));return s}}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 a=t[1].charAt(t[1].length-1)===`
221
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:a,tokens:this.lexer.inline(a)}}}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 a=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(a)){if(!this.rules.other.endAngleBracket.test(a))return;let s=Zo(a.slice(0,-1),"\\");if((a.length-s.length)%2===0)return}else{let s=hC(t[2],"()");if(s===-2)return;if(s>-1){let i=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,i).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],o=s[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(a)?r=r.slice(1):r=r.slice(1,-1)),tv(t,{href:r&&r.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 a;if((a=this.rules.inline.reflink.exec(e))||(a=this.rules.inline.nolink.exec(e))){let r=(a[2]||a[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let s=a[0].charAt(0);return{type:"text",raw:s,text:s}}return tv(a,o,a[0],this.lexer,this.rules)}}emStrong(e,t,a=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&a.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!a||this.rules.inline.punctuation.exec(a))){let o=[...r[0]].length-1,s,i,c=o,u=0,d=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+o);(r=d.exec(t))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(i=[...s].length,r[3]||r[4]){c+=i;continue}else if((r[5]||r[6])&&o%3&&!((o+i)%3)){u+=i;continue}if(c-=i,c>0)continue;i=Math.min(i,i+c+u);let h=[...r[0]][0].length,f=e.slice(0,o+r.index+h+i);if(Math.min(o,i)%2){let v=f.slice(1,-1);return{type:"em",raw:f,text:v,tokens:this.lexer.inlineTokens(v)}}let p=f.slice(2,-2);return{type:"strong",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let a=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(a),o=this.rules.other.startingSpaceChar.test(a)&&this.rules.other.endingSpaceChar.test(a);return r&&o&&(a=a.substring(1,a.length-1)),{type:"codespan",raw:t[0],text:a}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,a=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!a||this.rules.inline.punctuation.exec(a))){let o=[...r[0]].length-1,s,i,c=o,u=this.rules.inline.delRDelim;for(u.lastIndex=0,t=t.slice(-1*e.length+o);(r=u.exec(t))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(i=[...s].length,i!==o))continue;if(r[3]||r[4]){c+=i;continue}if(c-=i,c>0)continue;i=Math.min(i,i+c);let d=[...r[0]][0].length,h=e.slice(0,o+r.index+d+i),f=h.slice(o,-o);return{type:"del",raw:h,text:f,tokens:this.lexer.inlineTokens(f)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let a,r;return t[2]==="@"?(a=t[1],r="mailto:"+a):(a=t[1],r=a),{type:"link",raw:t[0],text:a,href:r,tokens:[{type:"text",raw:a,text:a}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let a,r;if(t[2]==="@")a=t[0],r="mailto:"+a;else{let o;do o=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(o!==t[0]);a=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0]}return{type:"link",raw:t[0],text:a,href:r,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let a=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:a}}}},Gt=class jd{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Ir,this.options.tokenizer=this.options.tokenizer||new vc,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 a={other:lt,block:ai.normal,inline:Yo.normal};this.options.pedantic?(a.block=ai.pedantic,a.inline=Yo.pedantic):this.options.gfm&&(a.block=ai.gfm,this.options.breaks?a.inline=Yo.breaks:a.inline=Yo.gfm),this.tokenizer.rules=a}static get rules(){return{block:ai,inline:Yo}}static lex(t,a){return new jd(a).lex(t)}static lexInline(t,a){return new jd(a).inlineTokens(t)}lex(t){t=t.replace(lt.carriageReturn,`
222
+ `),this.blockTokens(t,this.tokens);for(let a=0;a<this.inlineQueue.length;a++){let r=this.inlineQueue[a];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,a=[],r=!1){for(this.options.pedantic&&(t=t.replace(lt.tabCharGlobal," ").replace(lt.spaceLine,""));t;){let o;if(this.options.extensions?.block?.some(i=>(o=i.call({lexer:this},t,a))?(t=t.substring(o.raw.length),a.push(o),!0):!1))continue;if(o=this.tokenizer.space(t)){t=t.substring(o.raw.length);let i=a.at(-1);o.raw.length===1&&i!==void 0?i.raw+=`
223
223
  `:a.push(o);continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length);let i=a.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
224
224
  `)?"":`
225
225
  `)+o.raw,i.text+=`
@@ -232,7 +232,7 @@ ${h}`:h;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
232
232
  `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):a.push(o),r=s.length!==t.length,t=t.substring(o.raw.length);continue}if(o=this.tokenizer.text(t)){t=t.substring(o.raw.length);let i=a.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
233
233
  `)?"":`
234
234
  `)+o.raw,i.text+=`
235
- `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):a.push(o);continue}if(t){let i="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,a}inline(t,a=[]){return this.inlineQueue.push({src:t,tokens:a}),a}inlineTokens(t,a=[]){let r=t,o=null;if(this.tokens.links){let u=Object.keys(this.tokens.links);if(u.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)u.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,o.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(o=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)s=o[2]?o[2].length:0,r=r.slice(0,o.index+s)+"["+"a".repeat(o[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let i=!1,c="";for(;t;){i||(c=""),i=!1;let u;if(this.options.extensions?.inline?.some(h=>(u=h.call({lexer:this},t,a))?(t=t.substring(u.raw.length),a.push(u),!0):!1))continue;if(u=this.tokenizer.escape(t)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.tag(t)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.link(t)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(u.raw.length);let h=a.at(-1);u.type==="text"&&h?.type==="text"?(h.raw+=u.raw,h.text+=u.text):a.push(u);continue}if(u=this.tokenizer.emStrong(t,r,c)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.codespan(t)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.br(t)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.del(t,r,c)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.autolink(t)){t=t.substring(u.raw.length),a.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(t))){t=t.substring(u.raw.length),a.push(u);continue}let d=t;if(this.options.extensions?.startInline){let h=1/0,f=t.slice(1),p;this.options.extensions.startInline.forEach(v=>{p=v.call({lexer:this},f),typeof p=="number"&&p>=0&&(h=Math.min(h,p))}),h<1/0&&h>=0&&(d=t.substring(0,h+1))}if(u=this.tokenizer.inlineText(d)){t=t.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(c=u.raw.slice(-1)),i=!0;let h=a.at(-1);h?.type==="text"?(h.raw+=u.raw,h.text+=u.text):a.push(u);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 a}},xc=class{options;parser;constructor(e){this.options=e||Ir}space(e){return""}code({text:e,lang:t,escaped:a}){let r=(t||"").match(it.notSpaceStart)?.[0],o=e.replace(it.endingNewline,"")+`
235
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):a.push(o);continue}if(t){let i="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,a}inline(t,a=[]){return this.inlineQueue.push({src:t,tokens:a}),a}inlineTokens(t,a=[]){let r=t,o=null;if(this.tokens.links){let u=Object.keys(this.tokens.links);if(u.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)u.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,o.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(o=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)s=o[2]?o[2].length:0,r=r.slice(0,o.index+s)+"["+"a".repeat(o[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let i=!1,c="";for(;t;){i||(c=""),i=!1;let u;if(this.options.extensions?.inline?.some(h=>(u=h.call({lexer:this},t,a))?(t=t.substring(u.raw.length),a.push(u),!0):!1))continue;if(u=this.tokenizer.escape(t)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.tag(t)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.link(t)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(u.raw.length);let h=a.at(-1);u.type==="text"&&h?.type==="text"?(h.raw+=u.raw,h.text+=u.text):a.push(u);continue}if(u=this.tokenizer.emStrong(t,r,c)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.codespan(t)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.br(t)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.del(t,r,c)){t=t.substring(u.raw.length),a.push(u);continue}if(u=this.tokenizer.autolink(t)){t=t.substring(u.raw.length),a.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(t))){t=t.substring(u.raw.length),a.push(u);continue}let d=t;if(this.options.extensions?.startInline){let h=1/0,f=t.slice(1),p;this.options.extensions.startInline.forEach(v=>{p=v.call({lexer:this},f),typeof p=="number"&&p>=0&&(h=Math.min(h,p))}),h<1/0&&h>=0&&(d=t.substring(0,h+1))}if(u=this.tokenizer.inlineText(d)){t=t.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(c=u.raw.slice(-1)),i=!0;let h=a.at(-1);h?.type==="text"?(h.raw+=u.raw,h.text+=u.text):a.push(u);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 a}},gc=class{options;parser;constructor(e){this.options=e||Ir}space(e){return""}code({text:e,lang:t,escaped:a}){let r=(t||"").match(lt.notSpaceStart)?.[0],o=e.replace(lt.endingNewline,"")+`
236
236
  `;return r?'<pre><code class="language-'+mn(r)+'">'+(a?o:mn(o,!0))+`</code></pre>
237
237
  `:"<pre><code>"+(a?o:mn(o,!0))+`</code></pre>
238
238
  `}blockquote({tokens:e}){return`<blockquote>
@@ -250,22 +250,22 @@ ${this.parser.parse(e)}</blockquote>
250
250
  `}tablerow({text:e}){return`<tr>
251
251
  ${e}</tr>
252
252
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),a=e.header?"th":"td";return(e.align?`<${a} align="${e.align}">`:`<${a}>`)+t+`</${a}>
253
- `}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>${mn(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:a}){let r=this.parser.parseInline(a),o=ev(e);if(o===null)return r;e=o;let s='<a href="'+e+'"';return t&&(s+=' title="'+mn(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:a,tokens:r}){r&&(a=this.parser.parseInline(r,this.parser.textRenderer));let o=ev(e);if(o===null)return mn(a);e=o;let s=`<img src="${e}" alt="${mn(a)}"`;return t&&(s+=` title="${mn(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:mn(e.text)}},Mf=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}},Vt=class Kd{options;renderer;textRenderer;constructor(t){this.options=t||Ir,this.options.renderer=this.options.renderer||new xc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Mf}static parse(t,a){return new Kd(a).parse(t)}static parseInline(t,a){return new Kd(a).parseInline(t)}parse(t){let a="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let i=o,c=this.options.extensions.renderers[i.type].call({parser:this},i);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){a+=c||"";continue}}let s=o;switch(s.type){case"space":{a+=this.renderer.space(s);break}case"hr":{a+=this.renderer.hr(s);break}case"heading":{a+=this.renderer.heading(s);break}case"code":{a+=this.renderer.code(s);break}case"table":{a+=this.renderer.table(s);break}case"blockquote":{a+=this.renderer.blockquote(s);break}case"list":{a+=this.renderer.list(s);break}case"checkbox":{a+=this.renderer.checkbox(s);break}case"html":{a+=this.renderer.html(s);break}case"def":{a+=this.renderer.def(s);break}case"paragraph":{a+=this.renderer.paragraph(s);break}case"text":{a+=this.renderer.text(s);break}default:{let i='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return a}parseInline(t,a=this.renderer){let r="";for(let o=0;o<t.length;o++){let s=t[o];if(this.options.extensions?.renderers?.[s.type]){let c=this.options.extensions.renderers[s.type].call({parser:this},s);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=c||"";continue}}let i=s;switch(i.type){case"escape":{r+=a.text(i);break}case"html":{r+=a.html(i);break}case"link":{r+=a.link(i);break}case"image":{r+=a.image(i);break}case"checkbox":{r+=a.checkbox(i);break}case"strong":{r+=a.strong(i);break}case"em":{r+=a.em(i);break}case"codespan":{r+=a.codespan(i);break}case"br":{r+=a.br(i);break}case"del":{r+=a.del(i);break}case"text":{r+=a.text(i);break}default:{let c='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},ss=class{options;block;constructor(e){this.options=e||Ir}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?qt.lex:qt.lexInline}provideParser(){return this.block?Vt.parse:Vt.parseInline}},Mx=class{defaults=wf();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Vt;Renderer=xc;TextRenderer=Mf;Lexer=qt;Tokenizer=bc;Hooks=ss;constructor(...e){this.use(...e)}walkTokens(e,t){let a=[];for(let r of e)switch(a=a.concat(t.call(this,r)),r.type){case"table":{let o=r;for(let s of o.header)a=a.concat(this.walkTokens(s.tokens,t));for(let s of o.rows)for(let i of s)a=a.concat(this.walkTokens(i.tokens,t));break}case"list":{let o=r;a=a.concat(this.walkTokens(o.items,t));break}default:{let o=r;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(s=>{let i=o[s].flat(1/0);a=a.concat(this.walkTokens(i,t))}):o.tokens&&(a=a.concat(this.walkTokens(o.tokens,t)))}}return a}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(a=>{let r={...a};if(r.async=this.defaults.async||r.async||!1,a.extensions&&(a.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let s=t.renderers[o.name];s?t.renderers[o.name]=function(...i){let c=o.renderer.apply(this,i);return c===!1&&(c=s.apply(this,i)),c}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[o.level];s?s.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)}),r.extensions=t),a.renderer){let o=this.defaults.renderer||new xc(this.defaults);for(let s in a.renderer){if(!(s in o))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let i=s,c=a.renderer[i],u=o[i];o[i]=(...d)=>{let h=c.apply(o,d);return h===!1&&(h=u.apply(o,d)),h||""}}r.renderer=o}if(a.tokenizer){let o=this.defaults.tokenizer||new bc(this.defaults);for(let s in a.tokenizer){if(!(s in o))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let i=s,c=a.tokenizer[i],u=o[i];o[i]=(...d)=>{let h=c.apply(o,d);return h===!1&&(h=u.apply(o,d)),h}}r.tokenizer=o}if(a.hooks){let o=this.defaults.hooks||new ss;for(let s in a.hooks){if(!(s in o))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let i=s,c=a.hooks[i],u=o[i];ss.passThroughHooks.has(s)?o[i]=d=>{if(this.defaults.async&&ss.passThroughHooksRespectAsync.has(s))return(async()=>{let f=await c.call(o,d);return u.call(o,f)})();let h=c.call(o,d);return u.call(o,h)}:o[i]=(...d)=>{if(this.defaults.async)return(async()=>{let f=await c.apply(o,d);return f===!1&&(f=await u.apply(o,d)),f})();let h=c.apply(o,d);return h===!1&&(h=u.apply(o,d)),h}}r.hooks=o}if(a.walkTokens){let o=this.defaults.walkTokens,s=a.walkTokens;r.walkTokens=function(i){let c=[];return c.push(s.call(this,i)),o&&(c=c.concat(o.call(this,i))),c}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return qt.lex(e,t??this.defaults)}parser(e,t){return Vt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,a)=>{let r={...a},o={...this.defaults,...r},s=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return s(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 s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let i=o.hooks?await o.hooks.preprocess(t):t,c=await(o.hooks?await o.hooks.provideLexer():e?qt.lex:qt.lexInline)(i,o),u=o.hooks?await o.hooks.processAllTokens(c):c;o.walkTokens&&await Promise.all(this.walkTokens(u,o.walkTokens));let d=await(o.hooks?await o.hooks.provideParser():e?Vt.parse:Vt.parseInline)(u,o);return o.hooks?await o.hooks.postprocess(d):d})().catch(s);try{o.hooks&&(t=o.hooks.preprocess(t));let i=(o.hooks?o.hooks.provideLexer():e?qt.lex:qt.lexInline)(t,o);o.hooks&&(i=o.hooks.processAllTokens(i)),o.walkTokens&&this.walkTokens(i,o.walkTokens);let c=(o.hooks?o.hooks.provideParser():e?Vt.parse:Vt.parseInline)(i,o);return o.hooks&&(c=o.hooks.postprocess(c)),c}catch(i){return s(i)}}}onError(e,t){return a=>{if(a.message+=`
254
- Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+mn(a.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(a);throw a}}},mr=new Mx;function ie(e,t){return mr.parse(e,t)}ie.options=ie.setOptions=function(e){return mr.setOptions(e),ie.defaults=mr.defaults,gx(ie.defaults),ie};ie.getDefaults=wf;ie.defaults=Ir;ie.use=function(...e){return mr.use(...e),ie.defaults=mr.defaults,gx(ie.defaults),ie};ie.walkTokens=function(e,t){return mr.walkTokens(e,t)};ie.parseInline=mr.parseInline;ie.Parser=Vt;ie.parser=Vt.parse;ie.Renderer=xc;ie.TextRenderer=Mf;ie.Lexer=qt;ie.lexer=qt.lex;ie.Tokenizer=bc;ie.Hooks=ss;ie.parse=ie;ie.options;ie.setOptions;ie.use;ie.walkTokens;ie.parseInline;Vt.parse;qt.lex;const pC={js:"javascript",ts:"typescript",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",yml:"yaml",dockerfile:"docker","":"plaintext"};function Ix(e){const t=e.toLowerCase().trim();return pC[t]||t}function ls(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function mC(e,t){const a=Ix(t);if(en.languages[a])try{return en.highlight(e,en.languages[a],a)}catch{}return ls(e)}function vC(){const e=new Mx({gfm:!0,breaks:!0});return e.use({renderer:{code(t){const a=t.lang||"",r=t.text,o=mC(r,a);return`<pre class="code-block${a?` language-${Ix(a)}`:""}"><code>${o}</code></pre>`},link(t){const a=t.href,r=t.title?` title="${ls(t.title)}"`:"",o=t.text;return a.startsWith("http://")||a.startsWith("https://")?`<a href="${ls(a)}"${r} target="_blank" rel="noopener noreferrer">${o}</a>`:`<a href="${ls(a)}"${r}>${o}</a>`},html(t){return ls(t.text)}}}),e}const gC=vC();function If(e){return gC.parse(e)}function bC({args:e}){const[t,a]=U(!1),r=e.image,o=e.prompt,s=r?.startsWith("http");return n("div",{class:"space-y-2",children:[s&&n("button",{type:"button",onClick:()=>a(!0),class:"rounded-md overflow-hidden bg-[var(--color-bg-tertiary)] p-2 cursor-pointer hover:bg-[var(--color-bg-secondary)] transition-colors","aria-label":l("toolInput.expandImage"),children:n("img",{src:r,alt:l("toolInput.inputImage"),class:"max-h-[150px] max-w-full rounded object-contain",loading:"lazy"})}),!s&&r&&n(xt,{children:[n("span",{class:"sr-only",children:[l("toolInput.imagePath"),": "]}),"🖼️ ",r]}),o&&n(xt,{children:[n("span",{class:"sr-only",children:[l("toolInput.prompt"),": "]}),"💬 ",o]}),t&&s&&n("div",{role:"dialog","aria-modal":"true","aria-label":l("common.imageViewer"),class:"fixed inset-0 z-[9999] bg-black/90 flex items-center justify-center p-4",onClick:()=>a(!1),onKeyDown:i=>i.key==="Escape"&&a(!1),tabIndex:0,children:[n("button",{type:"button",onClick:()=>a(!1),class:"absolute top-4 right-4 p-2 rounded-full bg-black/50 text-white hover:bg-black/70 transition-colors","aria-label":l("actions.close"),children:"✕"}),n("img",{src:r,alt:l("toolInput.expandedImage"),class:"max-h-[90vh] max-w-[90vw] object-contain rounded-lg",onClick:i=>i.stopPropagation(),onKeyDown:i=>i.stopPropagation()})]})]})}function xC({result:e}){const t=typeof e=="string"?e:String(e),a=xe(()=>If(t),[t]);return n("div",{class:"prose prose-sm dark:prose-invert max-w-none text-sm leading-relaxed p-2 rounded-md bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)] [&_strong]:text-[var(--color-text-primary)] [&_em]:text-[var(--color-text-secondary)]",dangerouslySetInnerHTML:{__html:a}})}function yC({args:e}){const t=e.sessionKey,a=e.model;return!t&&!a?n(xt,{children:[n("span",{class:"sr-only",children:[l("toolInput.sessionStatus"),": "]}),n("span",{children:["📊 ",l("sessionStatus.currentSession")]})]}):n(xt,{inline:!0,children:[n("span",{class:"sr-only",children:[l("toolInput.sessionStatus"),": "]}),n("span",{children:"📊"}),t&&n(st,{title:t,children:["🧵 ",wC(t)]}),a&&n(st,{children:["🧠 ",a]})]})}function wC(e){return e.length<=30?e:e.slice(0,15)+"…"+e.slice(-12)}function kC(e){const t=e.trim().split(`
255
- `),a=[];for(const r of t){const o=r.match(new RegExp("^(\\p{Emoji}+)\\s*(.+)$","u"));if(o){const s=o[2],i=s.indexOf(":");i>0?a.push({emoji:o[1],label:s.slice(0,i).trim(),value:s.slice(i+1).trim()}):a.push({emoji:o[1],label:"",value:s.trim()})}}return a}function av(e){const t=e.match(/(\d+)%/);return t?parseInt(t[1],10):null}function rv({percent:e,color:t,label:a}){const r=t||(e>66?"var(--color-success)":e>33?"var(--color-warning)":"var(--color-error)");return n("div",{class:"flex items-center gap-2 mt-1.5",children:[n("div",{class:"h-2 w-28 bg-[var(--color-bg-secondary)] rounded-full overflow-hidden",role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:n("div",{class:"h-full rounded-full transition-all",style:{width:`${e}%`,backgroundColor:r}})}),a&&n("span",{class:"text-[var(--color-text-muted)] text-xs",children:a})]})}function SC({result:e}){const t=typeof e=="string"?e:String(e),a=kC(t);return a.length===0?n(ye,{content:e,maxLines:20}):n("div",{class:"rounded-md bg-[var(--color-bg-tertiary)] overflow-hidden",children:a.map((r,o)=>{const s=r.label==="Context"?av(r.value):null,i=r.label==="Usage"?av(r.value):null;return n("div",{class:`flex items-start gap-3 px-3 py-2 text-sm ${o>0?"border-t border-[var(--color-border)]/50":""}`,children:[n("span",{class:"flex-shrink-0 w-6 text-center text-base",children:r.emoji}),r.label&&n("span",{class:"font-medium text-[var(--color-text-muted)] w-20 flex-shrink-0",children:r.label}),n("div",{class:"flex-1 min-w-0",children:[n("span",{class:"text-[var(--color-text-primary)]",children:r.value}),s!==null&&n(rv,{percent:s,color:"var(--color-accent)",label:`${s}%`}),i!==null&&n(rv,{percent:i,label:l("sessionStatus.remaining",{percent:i})})]})]},o)})})}function _C({args:e}){const t=e.action,a=e.profile,r=e.targetUrl??e.url;return n(xt,{inline:!0,children:[n("span",{class:"sr-only",children:[l("toolInput.browserAction"),": "]}),n("span",{children:["🌐 ",t]}),a&&n(st,{children:a}),r&&n("span",{class:"text-[var(--color-accent)] truncate",children:r})]})}function CC({result:e}){if(typeof e=="string"){const a=e.replace(/<<<EXTERNAL_UNTRUSTED_CONTENT>>>\nSource: Browser\n---\n?/g,"").replace(/\n?<<<END_EXTERNAL_UNTRUSTED_CONTENT>>>/g,"").trim();try{const r=JSON.parse(a);if(r?.tabs)return n(ov,{tabs:r.tabs})}catch{}return a?n(ye,{content:a,maxLines:30}):n(wt,{children:l("toolOutput.emptyResponse")})}const t=Vn(e);return t?.tabs?n(ov,{tabs:t.tabs}):n(ye,{content:e,maxLines:20})}function ov({tabs:e}){return e.length===0?n(wt,{children:l("toolOutput.noTabsOpen")}):n("div",{class:"space-y-1",children:e.map((t,a)=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{class:"text-[var(--color-text-muted)]",children:"🌐"}),n("span",{class:"font-medium text-[var(--color-text-primary)] truncate",children:t.title||"Untitled"}),t.url&&t.url!=="about:blank"&&n("span",{class:"text-[var(--color-accent)] truncate text-[10px]",children:t.url})]},t.targetId??a))})}var TC=["className","activeClass","activeClassName","path"];function EC(e){var t=e.className,a=e.activeClass,r=e.activeClassName,o=e.path,s=(function(h,f){if(h==null)return{};var p,v,w={},C=Object.keys(h);for(v=0;v<C.length;v++)f.indexOf(p=C[v])>=0||(w[p]=h[p]);return w})(e,TC),i=$0()[0],c=o&&i.path&&gd(i.path,o,{})||gd(i.url,s.href,{}),u=s.class||t||"",d=c&&(a||r)||"";return s.class=u+(u&&d&&" ")+d,nn(O0,s)}function AC(e){const t=new Date(e),a=r=>String(r).padStart(2,"0");return`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())}T${a(t.getHours())}:${a(t.getMinutes())}`}function MC(e){return new Date(e).getTime()}function Xs(e){switch(e.kind){case"cron":return e.expr+(e.tz?` (${e.tz})`:"")+(e.staggerMs!==void 0?` +${e.staggerMs}ms`:"");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 ${ne(e.atMs)}`}}function Rf(e){return e.enabled?e.state.runningAtMs?l("cron.running"):e.state.nextRunAtMs?ne(e.state.nextRunAtMs,{relative:!0}):"—":"—"}function IC(e){return e.state.lastRunAtMs?ne(e.state.lastRunAtMs,{relative:!0}):"—"}function Lf(e){return e.enabled?e.state.runningAtMs?{variant:"warning",label:l("cron.running")}:e.state.lastStatus==="error"?{variant:"error",label:l("cron.lastFailed")}:e.state.lastStatus==="ok"?{variant:"success",label:l("cron.lastOk")}:{variant:"default",label:l("common.pending")}:{variant:"default",label:l("common.disabled")}}function RC(e){const t=e.trim().split(/\s+/);if(t.length<5||t.length>6)return!1;const a=/^(\*|(\d+(-\d+)?(,\d+(-\d+)?)*)(\/\d+)?|\*\/\d+)$/;return t.every(r=>a.test(r))}const LC=[{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"}],$C=[{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 sv(e){if(!e||typeof e!="object")return"";const t=e;if(t.kind==="at"&&typeof t.at=="string")return`Once at ${ne(new Date(t.at).getTime(),{relative:!0})}`;try{return Xs(e)}catch{return String(t.kind||"")}}function DC({args:e}){const t=e.action,a=e.jobId,r=e.job,o=r?.name,s=e.patch,i={list:l("cron.actions.list"),add:l("cron.actions.add"),update:l("cron.actions.update"),remove:l("cron.actions.remove"),run:l("cron.actions.run"),runs:l("cron.actions.runs"),status:l("cron.actions.status"),wake:l("cron.actions.wake")},u={list:"📋",add:"➕",update:"✏️",remove:"🗑️",run:"▶️",runs:"📊",status:"📡",wake:"⏰"}[t]||"⏰",d=i[t]||t;if(t==="add"&&r){const h=r.schedule,f=r.sessionTarget;return n("div",{class:"space-y-1",children:[n(xt,{inline:!0,children:[n("span",{class:"sr-only",children:[l("toolInput.cronAction"),": "]}),n("span",{children:[u," ",d]}),o&&n(st,{children:o})]}),n("div",{class:"text-xs text-[var(--color-text-muted)] pl-1 flex flex-wrap gap-x-3",children:[h&&n("span",{children:[h.kind==="cron"&&`🕐 ${h.expr}`,h.kind==="every"&&`🔄 Every ${h.everyMs/1e3}s`,h.kind==="at"&&"📅 One-time"]}),f&&n("span",{children:["→ ",f]})]})]})}return n(xt,{inline:!0,children:[n("span",{class:"sr-only",children:[l("toolInput.cronAction"),": "]}),n("span",{children:[u," ",d]}),(a||o)&&n(st,{children:o||a?.slice(0,8)||""}),s&&Object.keys(s).length>0&&n("span",{class:"text-[var(--color-text-muted)]",children:["(",Object.keys(s).join(", "),")"]})]})}function PC({result:e}){const t=Vn(e);if(t&&"enabled"in t&&"nextWakeAtMs"in t){const a=t;return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-1",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:`w-2 h-2 rounded-full ${a.enabled?"bg-[var(--color-success)]":"bg-[var(--color-text-muted)]"}`}),n("span",{class:"font-medium",children:a.enabled?l("common.enabled"):l("common.disabled")}),typeof a.jobs=="number"&&n("span",{class:"text-[var(--color-text-muted)]",children:["• ",l("cron.jobCount",{count:a.jobs})]})]}),a.nextWakeAtMs&&n("div",{class:"text-[var(--color-text-muted)]",children:[l("cron.stats.nextWake"),": ",ne(a.nextWakeAtMs,{relative:!0})]})]})}if(t&&"entries"in t&&Array.isArray(t.entries)){const a=t.entries.slice(0,5);return a.length===0?n(wt,{children:l("cron.noRuns")}):n("div",{class:"space-y-1",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:[l("cron.recentRuns")," (",a.length,")"]}),a.map((r,o)=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{class:`w-2 h-2 rounded-full flex-shrink-0 ${r.status==="ok"?"bg-[var(--color-success)]":r.status==="error"?"bg-[var(--color-error)]":"bg-[var(--color-text-muted)]"}`}),r.runAtMs&&n("span",{class:"text-[var(--color-text-muted)]",children:ne(r.runAtMs,{relative:!0})}),r.durationMs&&n("span",{class:"text-[var(--color-text-muted)]",children:["(",Math.round(r.durationMs/1e3),"s)"]}),r.summary&&n("span",{class:"truncate flex-1 text-[var(--color-text-primary)]",title:r.summary,children:r.summary.split(`
256
- `)[0].slice(0,60)})]},r.ts??o))]})}if(t&&"jobs"in t&&Array.isArray(t.jobs)){const a=t.jobs;return a.length===0?n(wt,{children:l("cron.noJobs")}):n("div",{class:"space-y-1",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:l("cron.jobCount",{count:a.length})}),a.map(r=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{class:`w-2 h-2 rounded-full flex-shrink-0 ${r.enabled?"bg-[var(--color-success)]":"bg-[var(--color-text-muted)]"}`}),n("span",{class:"font-medium text-[var(--color-text-primary)] truncate flex-1",children:r.name||r.id?.slice(0,8)}),r.schedule&&n("span",{class:"text-[var(--color-text-muted)] font-mono text-[10px]",children:sv(r.schedule)}),r.state?.nextRunAtMs&&n("span",{class:"text-[var(--color-accent)] text-[10px]",children:ne(r.state.nextRunAtMs,{relative:!0})})]},r.id))]})}if(t&&("id"in t||"name"in t)&&!("ok"in t)){const a=t;return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-2",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:`w-2 h-2 rounded-full ${a.enabled?"bg-[var(--color-success)]":"bg-[var(--color-text-muted)]"}`}),n("span",{class:"font-medium text-[var(--color-text-primary)]",children:a.name||a.id?.slice(0,8)}),n(EC,{href:`/cron?job=${a.id}`,class:"text-[var(--color-accent)] hover:underline ml-auto",children:l("actions.view")})]}),n("div",{class:"grid grid-cols-2 gap-x-4 gap-y-1 text-[var(--color-text-muted)]",children:[a.schedule&&n(H,{children:[n("span",{children:[l("cron.columns.schedule"),":"]}),n("span",{class:"font-mono",children:sv(a.schedule)})]}),a.sessionTarget&&n(H,{children:[n("span",{children:[l("cron.form.sessionTarget"),":"]}),n("span",{children:a.sessionTarget})]}),a.delivery?.mode&&n(H,{children:[n("span",{children:[l("cron.form.announceResults"),":"]}),n("span",{children:a.delivery.mode==="announce"?"✓":"—"})]}),a.deleteAfterRun&&n(H,{children:[n("span",{children:[l("cron.scheduleKind.at"),":"]}),n("span",{children:"✓"})]})]}),a.state?.nextRunAtMs&&n("div",{class:"text-[var(--color-text-muted)] pt-1 border-t border-[var(--color-border)]",children:[l("cron.stats.nextWake"),": ",ne(a.state.nextRunAtMs,{relative:!0})]})]})}if(t&&"ok"in t&&t.ok===!0){const a=t;let r=l("common.success");return a.ran&&(r=l("cron.jobTriggered")),a.removed&&(r=l("cron.jobRemoved")),n(wt,{children:n("span",{class:"text-[var(--color-success)]",children:["✓ ",r]})})}return n(ye,{content:e,maxLines:20})}const Ri={telegram:"Telegram",whatsapp:"WhatsApp",discord:"Discord",irc:"IRC",googlechat:"Google Chat",slack:"Slack",signal:"Signal",imessage:"iMessage",bluebubbles:"BlueBubbles",imsg:"iMessage",gchat:"Google Chat","google-chat":"Google Chat","internet-relay-chat":"IRC"},OC={send:"💬",broadcast:"📢",reply:"↩️",sendWithEffect:"✨",sendAttachment:"📎",unsend:"🗑️",react:"👍",reactions:"😀",read:"👁️",edit:"✏️",delete:"🗑️",pin:"📌",unpin:"📌","list-pins":"📌","thread-create":"🧵","thread-list":"🧵","thread-reply":"🧵",search:"🔍",sticker:"🎨","emoji-list":"😀","emoji-upload":"😀","sticker-upload":"🎨","channel-info":"ℹ️","channel-list":"📋","channel-create":"➕","channel-edit":"✏️","channel-delete":"🗑️","channel-move":"↔️","category-create":"📁","category-edit":"📁","category-delete":"📁",poll:"📊","member-info":"👤","role-info":"🎭",permissions:"🔐","voice-status":"🎤","event-list":"📅","event-create":"📅",renameGroup:"✏️",setGroupIcon:"🖼️",addParticipant:"➕",removeParticipant:"➖",leaveGroup:"🚪"},Rx={send:"Send",broadcast:"Broadcast",reply:"Reply",sendWithEffect:"Send with Effect",sendAttachment:"Send Attachment",unsend:"Unsend",react:"React",reactions:"Get Reactions",read:"Mark Read",edit:"Edit",delete:"Delete",pin:"Pin",unpin:"Unpin","list-pins":"List Pins","thread-create":"Create Thread","thread-list":"List Threads","thread-reply":"Reply in Thread",search:"Search",sticker:"Send Sticker","emoji-list":"List Emoji","emoji-upload":"Upload Emoji","sticker-upload":"Upload Sticker","channel-info":"Channel Info","channel-list":"List Channels","channel-create":"Create Channel","channel-edit":"Edit Channel","channel-delete":"Delete Channel","channel-move":"Move Channel","category-create":"Create Category","category-edit":"Edit Category","category-delete":"Delete Category",poll:"Create Poll","member-info":"Member Info","role-info":"Role Info",permissions:"Permissions","voice-status":"Voice Status","event-list":"List Events","event-create":"Create Event",renameGroup:"Rename Group",setGroupIcon:"Set Group Icon",addParticipant:"Add Participant",removeParticipant:"Remove Participant",leaveGroup:"Leave Group"};function NC({args:e}){const t=e.action,a=e.channel,r=OC[t]||"💬",o=Rx[t]||t,s=a?Ri[a]||a:void 0,i=new Set(["action","channel","dryRun"]),c=Object.entries(e).filter(([u,d])=>!i.has(u)&&d!==void 0&&d!==null);return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("div",{class:"flex items-center gap-2 mb-2",children:[n("span",{class:"sr-only",children:[l("toolInput.messageAction"),": "]}),n("span",{children:[r," ",o]}),s&&n(st,{children:s}),e.dryRun&&n(st,{children:l("common.dryRun")})]}),c.length>0&&n("div",{class:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-[var(--color-text-muted)]",children:c.map(([u,d])=>n(H,{children:[n("span",{children:[u,":"]},`${u}-label`),n("span",{class:"text-[var(--color-text-primary)] truncate",title:String(d),children:typeof d=="object"?JSON.stringify(d):String(d)},`${u}-value`)]}))})]})}function FC(e,t){return e.length<=t?e:e.slice(0,t-1)+"…"}function zC(e){return e.startsWith("+")||e.startsWith("user:")||e.startsWith("channel:")?e:e.length>20?e.slice(0,8)+"…"+e.slice(-8):e}function UC({result:e}){let t=e;if(typeof e=="string"){if(!e.trim())return n(wt,{children:l("toolOutput.messageSent")});try{t=JSON.parse(e)}catch{return n(ye,{content:e,maxLines:10})}}const a=Vn(t);if(!a)return n(ye,{content:e,maxLines:20});if("results"in a&&Array.isArray(a.results)){const r=a.results,o=r.filter(i=>i.ok).length,s=r.length-o;return n("div",{class:"space-y-1",children:[n(wt,{children:[n("span",{class:"text-[var(--color-success)]",children:["✓ ",l("toolOutput.broadcastSent")]}),n("span",{class:"text-[var(--color-text-muted)]",children:[" ","— ",o,"/",r.length," ",l("common.success").toLowerCase(),s>0&&`, ${s} failed`]})]}),r.slice(0,5).map((i,c)=>n("div",{class:"flex items-center gap-2 text-xs px-2 py-1 rounded bg-[var(--color-bg-tertiary)]",children:[n("span",{class:i.ok?"text-[var(--color-success)]":"text-[var(--color-error)]",children:i.ok?"✓":"✗"}),n("span",{class:"text-[var(--color-text-muted)]",children:i.to}),i.error&&n("span",{class:"text-[var(--color-error)] truncate",children:i.error})]},c)),r.length>5&&n("div",{class:"text-xs text-[var(--color-text-muted)] px-2",children:["+",r.length-5," more"]})]})}if("channels"in a&&Array.isArray(a.channels)){const r=a.channels,o=r.some(u=>"guild_id"in u),s=r.length===1?l("toolOutput.channelCount",{count:r.length}):l("toolOutput.channelCountPlural",{count:r.length}),i={0:{icon:"#",label:"text"},2:{icon:"🔊",label:"voice"},4:{icon:"📁",label:"category"},5:{icon:"📢",label:"announcement"},13:{icon:"🎭",label:"stage"},15:{icon:"💬",label:"forum"}},c=u=>{if(o&&typeof u.type=="number"){const d=i[u.type]||{icon:"•",label:`type ${u.type}`};return{icon:d.icon,typeLabel:d.label}}return{icon:"•",typeLabel:u.type!==void 0?String(u.type):null}};return n(ea,{header:n(H,{children:[n("span",{class:"font-medium text-[var(--color-text-primary)]",children:s}),o&&n(st,{children:"Discord"})]}),children:n("details",{open:!0,children:[n("summary",{class:"cursor-pointer text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]",children:l("toolOutput.showAll")}),n("div",{class:"mt-2 space-y-0.5 max-h-60 overflow-y-auto font-mono",children:r.map((u,d)=>{const h=c(u);return n("div",{class:"flex items-center gap-2 text-[var(--color-text-muted)]",children:[n("span",{class:"w-4 text-center",children:h.icon}),n("span",{class:"text-[var(--color-text-primary)]",children:u.name||l("toolOutput.unnamed")}),h.typeLabel&&n("span",{class:"text-[10px] opacity-50",children:h.typeLabel}),n("span",{class:"ml-auto text-[10px] opacity-30",children:u.id})]},u.id||d)})})]})})}if("member"in a&&typeof a.member=="object"&&a.member!==null){const r=a.member,o=r.nick||r.user?.global_name||r.user?.username||"Unknown",s=r.joined_at?new Date(r.joined_at).toLocaleDateString():null;return n(ea,{header:n(H,{children:[n("span",{class:"font-medium text-[var(--color-text-primary)]",children:["👤 ",o]}),r.user?.username&&r.user.username!==o&&n("span",{class:"text-[var(--color-text-muted)]",children:["@",r.user.username]})]}),children:n(Hd,{children:[r.user?.id&&n(Kt,{label:l("toolOutput.fieldId"),mono:!0,small:!0,children:r.user.id}),s&&n(Kt,{label:l("toolOutput.fieldJoined"),children:s}),r.roles&&r.roles.length>0&&n(Kt,{label:l("toolOutput.fieldRoles"),children:r.roles.length})]})})}if("emojis"in a&&Array.isArray(a.emojis)){const r=a.emojis;if(r.length===0)return n(wt,{children:n("span",{class:"text-[var(--color-text-muted)]",children:l("toolOutput.noEmojis")})});const o=r.length===1?l("toolOutput.emojiCount",{count:r.length}):l("toolOutput.emojiCountPlural",{count:r.length});return n(ea,{header:n("span",{class:"font-medium text-[var(--color-text-primary)]",children:o}),children:n("div",{class:"flex flex-wrap gap-1 max-h-40 overflow-y-auto",children:r.map((s,i)=>n("span",{class:"text-[var(--color-text-muted)]",title:s.name,children:[":",s.name,":"]},s.id||i))})})}if("events"in a&&Array.isArray(a.events)){const r=a.events;if(r.length===0)return n(wt,{children:n("span",{class:"text-[var(--color-text-muted)]",children:l("toolOutput.noScheduledEvents")})});const o=r.length===1?l("toolOutput.eventCount",{count:r.length}):l("toolOutput.eventCountPlural",{count:r.length});return n(ea,{header:n("span",{class:"font-medium text-[var(--color-text-primary)]",children:["📅 ",o]}),children:n("div",{class:"space-y-1 max-h-40 overflow-y-auto",children:r.map((s,i)=>n("div",{class:"flex items-center gap-2 text-[var(--color-text-muted)]",children:[n("span",{class:"text-[var(--color-text-primary)]",children:s.name||l("toolOutput.unnamed")}),s.scheduled_start_time&&n("span",{class:"text-[10px]",children:new Date(s.scheduled_start_time).toLocaleString()})]},s.id||i))})})}if("pins"in a&&Array.isArray(a.pins)){const r=a.pins;if(r.length===0)return n(wt,{children:n("span",{class:"text-[var(--color-text-muted)]",children:l("toolOutput.noPinnedMessages")})});const o=r.length===1?l("toolOutput.pinnedCount",{count:r.length}):l("toolOutput.pinnedCountPlural",{count:r.length});return n(ea,{header:n("span",{class:"font-medium text-[var(--color-text-primary)]",children:["📌 ",o]}),children:n("div",{class:"space-y-1 max-h-40 overflow-y-auto",children:r.map((s,i)=>n("div",{class:"text-[var(--color-text-muted)]",children:[s.author?.username&&n("span",{class:"font-medium",children:[s.author.username,": "]}),n("span",{class:"text-[var(--color-text-primary)]",children:s.content?s.content.length>60?s.content.slice(0,60)+"...":s.content:l("toolOutput.noText")})]},s.id||i))})})}if("ok"in a&&a.ok===!0){const{ok:r,action:o,channel:s,dryRun:i,...c}=a,u=Object.keys(c).length>0;return n(ea,{header:n(H,{children:[n("span",{class:"font-medium text-[var(--color-text-primary)]",children:o?Rx[o]||o:l("common.success")}),s&&n(st,{children:Ri[s]||s}),i&&n(st,{children:l("common.dryRun")})]}),children:u&&n("pre",{class:"p-2 bg-[var(--color-bg-secondary)] rounded text-[10px] overflow-x-auto max-h-80 overflow-y-auto",children:JSON.stringify(c,null,2)})})}if("question"in a&&"options"in a){const r=a;return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-2",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{children:"📊"}),n("span",{class:"font-medium text-[var(--color-text-primary)]",children:r.question}),r.dryRun&&n(st,{children:l("common.dryRun")})]}),r.options&&r.options.length>0&&n("div",{class:"space-y-1 pl-5",children:r.options.map((o,s)=>n("div",{class:"text-[var(--color-text-muted)]",children:["• ",o]},s))}),n("div",{class:"text-[var(--color-text-muted)] text-[10px]",children:[r.channel&&(Ri[r.channel]||r.channel),r.to&&` → ${zC(r.to)}`]})]})}if("channels"in a&&Array.isArray(a.channels)){const r=a.channels;return r.length===0?n(wt,{children:l("toolOutput.noChannels")}):n("div",{class:"space-y-1",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:l("toolOutput.channelCount",{count:r.length})}),r.slice(0,10).map((o,s)=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{class:"text-[var(--color-text-muted)]",children:"#"}),n("span",{class:"font-medium text-[var(--color-text-primary)] truncate",children:o.name||o.id}),o.topic&&n("span",{class:"text-[var(--color-text-muted)] truncate text-[10px]",children:o.topic})]},o.id??s)),r.length>10&&n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:["+",r.length-10," more"]})]})}if("messages"in a&&Array.isArray(a.messages)){const r=a.messages;return r.length===0?n(wt,{children:l("toolOutput.noResults")}):n("div",{class:"space-y-1",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:l("toolOutput.messageCount",{count:r.length})}),r.slice(0,5).map((o,s)=>n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[o.author&&n("span",{class:"font-medium text-[var(--color-accent)]",children:[o.author,": "]}),n("span",{class:"text-[var(--color-text-primary)]",children:FC(o.content||"",80)})]},o.id??s)),r.length>5&&n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:["+",r.length-5," more"]})]})}if("events"in a&&Array.isArray(a.events)){const r=a.events;return r.length===0?n(wt,{children:l("toolOutput.noEvents")}):n("div",{class:"space-y-1",children:r.slice(0,5).map((o,s)=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{children:"📅"}),n("span",{class:"font-medium text-[var(--color-text-primary)]",children:o.name}),o.startTime&&n("span",{class:"text-[var(--color-text-muted)] text-[10px]",children:o.startTime})]},o.id??s))})}if("username"in a||"displayName"in a){const r=a;return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-1",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{children:"👤"}),n("span",{class:"font-medium text-[var(--color-text-primary)]",children:r.displayName||r.username}),r.username&&r.displayName&&n("span",{class:"text-[var(--color-text-muted)]",children:["@",r.username]})]}),r.roles&&r.roles.length>0&&n("div",{class:"flex flex-wrap gap-1 pl-5",children:[r.roles.slice(0,5).map((o,s)=>n(st,{children:o},s)),r.roles.length>5&&n("span",{class:"text-[10px] text-[var(--color-text-muted)]",children:["+",r.roles.length-5]})]})]})}if("channel"in a&&"to"in a){const r=a;return n(ea,{header:n(H,{children:[n("span",{class:"font-medium text-[var(--color-text-primary)]",children:l("toolOutput.messageSent")}),r.dryRun&&n(st,{children:l("common.dryRun")})]}),children:n(Hd,{children:[n(Kt,{label:l("toolOutput.fieldChannel"),children:r.channel&&(Ri[r.channel]||r.channel)}),n(Kt,{label:l("toolOutput.fieldTo"),children:r.to}),r.via&&n(Kt,{label:l("toolOutput.fieldVia"),children:r.via}),r.mediaUrl!==void 0&&n(Kt,{label:l("toolOutput.fieldMedia"),children:r.mediaUrl||"none"})]})})}return n(ye,{content:e,maxLines:20})}function jC({args:e}){const t=e.action;if(t==="update.run"){const a=e.note;return n(xt,{inline:!0,children:[n("span",{children:"🔄"}),n("span",{class:"text-[var(--color-text-primary)]",children:l("gateway.updateRun")}),a&&n("span",{class:"text-[var(--color-text-muted)]",children:["— ",a]})]})}return n(xt,{children:[n("span",{class:"text-[var(--color-text-muted)]",children:"gateway"})," ",n("span",{class:"text-[var(--color-text-primary)]",children:t||"unknown"})]})}function HC({result:e}){const t=Vn(e),a=t?.result?.result;if(a?.before?.version||a?.after?.version){const r=a.before?.version,o=a.after?.version,s=a.mode,i=a.durationMs,c=t?.result?.restart,u=n("span",{class:"font-medium text-[var(--color-text-primary)]",children:l("gateway.updateComplete")});return n(ea,{header:u,success:a.status==="ok",children:n(Hd,{children:[r&&o&&n(Kt,{label:l("gateway.version"),children:[n("span",{class:"text-[var(--color-text-muted)]",children:r}),n("span",{class:"mx-1.5",children:"→"}),n("span",{class:"text-[var(--color-success)] font-medium",children:o})]}),s&&n(Kt,{label:l("gateway.mode"),children:s}),i&&n(Kt,{label:l("gateway.duration"),children:jh(i)}),c&&n(Kt,{label:l("gateway.restart"),children:c.ok?n("span",{class:"text-[var(--color-success)]",children:l("gateway.restartOk")}):n("span",{class:"text-[var(--color-error)]",children:l("gateway.restartFailed")})})]})})}return n(ye,{content:e,maxLines:15})}function BC({result:e}){return n("div",{class:"text-xs p-3 rounded-md bg-[var(--color-error)]/10 border border-[var(--color-error)]/20",children:[n("div",{class:"font-medium text-[var(--color-error)] mb-1",children:l("common.error")}),n("div",{class:"text-[var(--color-text-primary)] whitespace-pre-wrap",children:e.error})]})}function WC({result:e,error:t,toolName:a,filePath:r}){const o=vx(e);if(o)return n(BC,{result:o});switch(a){case"web_search":return n(y3,{result:e});case"web_fetch":return n(k3,{result:e});case"memory_search":return n(_3,{result:e});case"memory_get":return n(C3,{result:e});case"image":return n(xC,{result:e});case"session_status":return n(SC,{result:e});case"browser":return n(CC,{result:e});case"cron":return n(PC,{result:e});case"message":return n(UC,{result:e});case"gateway":return n(HC,{result:e});default:return n(ye,{content:e,maxLines:20,error:t,filePath:r})}}function KC({args:e}){const t=e.file_path??e.path,a=e.offset,r=e.limit,o=a&&r?`${a}-${a+r-1}`:a?`${a}+`:void 0;return n(xt,{inline:!0,children:[n("span",{class:"sr-only",children:[l("toolInput.readingFile"),": "]}),n("span",{children:["📄 ",t,o&&n("span",{class:"text-[var(--color-text-muted)]",children:[":",o]})]}),r&&n(st,{children:l("toolInput.lineCount",{count:r})})]})}function qC({args:e}){const t=e.file_path??e.path,a=e.content;return n("div",{class:"space-y-2",children:[n(xt,{children:[n("span",{class:"sr-only",children:[l("toolInput.writingFile"),": "]}),"📄 ",t]}),n(ye,{content:a,filePath:t,maxLines:30})]})}function VC({args:e}){const t=e.command,a=e.workdir||e.cwd,r=a?`# cwd: ${a}
257
- ${t}`:t;return n("div",{children:[n("span",{class:"sr-only",children:[l("toolInput.runningCommand"),": "]}),n(ye,{content:r,filePath:"command.sh",maxLines:20})]})}function GC(e,t){const a=e.length,r=t.length,o=Array(a+1).fill(null).map(()=>Array(r+1).fill(0));for(let s=1;s<=a;s++)for(let i=1;i<=r;i++)e[s-1]===t[i-1]?o[s][i]=o[s-1][i-1]+1:o[s][i]=Math.max(o[s-1][i],o[s][i-1]);return o}function JC(e,t,a){const r=e.split(`
253
+ `}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>${mn(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:a}){let r=this.parser.parseInline(a),o=Qm(e);if(o===null)return r;e=o;let s='<a href="'+e+'"';return t&&(s+=' title="'+mn(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:a,tokens:r}){r&&(a=this.parser.parseInline(r,this.parser.textRenderer));let o=Qm(e);if(o===null)return mn(a);e=o;let s=`<img src="${e}" alt="${mn(a)}"`;return t&&(s+=` title="${mn(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:mn(e.text)}},Ef=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}},Jt=class Hd{options;renderer;textRenderer;constructor(t){this.options=t||Ir,this.options.renderer=this.options.renderer||new gc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ef}static parse(t,a){return new Hd(a).parse(t)}static parseInline(t,a){return new Hd(a).parseInline(t)}parse(t){let a="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let i=o,c=this.options.extensions.renderers[i.type].call({parser:this},i);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){a+=c||"";continue}}let s=o;switch(s.type){case"space":{a+=this.renderer.space(s);break}case"hr":{a+=this.renderer.hr(s);break}case"heading":{a+=this.renderer.heading(s);break}case"code":{a+=this.renderer.code(s);break}case"table":{a+=this.renderer.table(s);break}case"blockquote":{a+=this.renderer.blockquote(s);break}case"list":{a+=this.renderer.list(s);break}case"checkbox":{a+=this.renderer.checkbox(s);break}case"html":{a+=this.renderer.html(s);break}case"def":{a+=this.renderer.def(s);break}case"paragraph":{a+=this.renderer.paragraph(s);break}case"text":{a+=this.renderer.text(s);break}default:{let i='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return a}parseInline(t,a=this.renderer){let r="";for(let o=0;o<t.length;o++){let s=t[o];if(this.options.extensions?.renderers?.[s.type]){let c=this.options.extensions.renderers[s.type].call({parser:this},s);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=c||"";continue}}let i=s;switch(i.type){case"escape":{r+=a.text(i);break}case"html":{r+=a.html(i);break}case"link":{r+=a.link(i);break}case"image":{r+=a.image(i);break}case"checkbox":{r+=a.checkbox(i);break}case"strong":{r+=a.strong(i);break}case"em":{r+=a.em(i);break}case"codespan":{r+=a.codespan(i);break}case"br":{r+=a.br(i);break}case"del":{r+=a.del(i);break}case"text":{r+=a.text(i);break}default:{let c='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},ss=class{options;block;constructor(e){this.options=e||Ir}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?Gt.lex:Gt.lexInline}provideParser(){return this.block?Jt.parse:Jt.parseInline}},Mx=class{defaults=xf();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Jt;Renderer=gc;TextRenderer=Ef;Lexer=Gt;Tokenizer=vc;Hooks=ss;constructor(...e){this.use(...e)}walkTokens(e,t){let a=[];for(let r of e)switch(a=a.concat(t.call(this,r)),r.type){case"table":{let o=r;for(let s of o.header)a=a.concat(this.walkTokens(s.tokens,t));for(let s of o.rows)for(let i of s)a=a.concat(this.walkTokens(i.tokens,t));break}case"list":{let o=r;a=a.concat(this.walkTokens(o.items,t));break}default:{let o=r;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(s=>{let i=o[s].flat(1/0);a=a.concat(this.walkTokens(i,t))}):o.tokens&&(a=a.concat(this.walkTokens(o.tokens,t)))}}return a}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(a=>{let r={...a};if(r.async=this.defaults.async||r.async||!1,a.extensions&&(a.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let s=t.renderers[o.name];s?t.renderers[o.name]=function(...i){let c=o.renderer.apply(this,i);return c===!1&&(c=s.apply(this,i)),c}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[o.level];s?s.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)}),r.extensions=t),a.renderer){let o=this.defaults.renderer||new gc(this.defaults);for(let s in a.renderer){if(!(s in o))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let i=s,c=a.renderer[i],u=o[i];o[i]=(...d)=>{let h=c.apply(o,d);return h===!1&&(h=u.apply(o,d)),h||""}}r.renderer=o}if(a.tokenizer){let o=this.defaults.tokenizer||new vc(this.defaults);for(let s in a.tokenizer){if(!(s in o))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let i=s,c=a.tokenizer[i],u=o[i];o[i]=(...d)=>{let h=c.apply(o,d);return h===!1&&(h=u.apply(o,d)),h}}r.tokenizer=o}if(a.hooks){let o=this.defaults.hooks||new ss;for(let s in a.hooks){if(!(s in o))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let i=s,c=a.hooks[i],u=o[i];ss.passThroughHooks.has(s)?o[i]=d=>{if(this.defaults.async&&ss.passThroughHooksRespectAsync.has(s))return(async()=>{let f=await c.call(o,d);return u.call(o,f)})();let h=c.call(o,d);return u.call(o,h)}:o[i]=(...d)=>{if(this.defaults.async)return(async()=>{let f=await c.apply(o,d);return f===!1&&(f=await u.apply(o,d)),f})();let h=c.apply(o,d);return h===!1&&(h=u.apply(o,d)),h}}r.hooks=o}if(a.walkTokens){let o=this.defaults.walkTokens,s=a.walkTokens;r.walkTokens=function(i){let c=[];return c.push(s.call(this,i)),o&&(c=c.concat(o.call(this,i))),c}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Gt.lex(e,t??this.defaults)}parser(e,t){return Jt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,a)=>{let r={...a},o={...this.defaults,...r},s=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return s(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 s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let i=o.hooks?await o.hooks.preprocess(t):t,c=await(o.hooks?await o.hooks.provideLexer():e?Gt.lex:Gt.lexInline)(i,o),u=o.hooks?await o.hooks.processAllTokens(c):c;o.walkTokens&&await Promise.all(this.walkTokens(u,o.walkTokens));let d=await(o.hooks?await o.hooks.provideParser():e?Jt.parse:Jt.parseInline)(u,o);return o.hooks?await o.hooks.postprocess(d):d})().catch(s);try{o.hooks&&(t=o.hooks.preprocess(t));let i=(o.hooks?o.hooks.provideLexer():e?Gt.lex:Gt.lexInline)(t,o);o.hooks&&(i=o.hooks.processAllTokens(i)),o.walkTokens&&this.walkTokens(i,o.walkTokens);let c=(o.hooks?o.hooks.provideParser():e?Jt.parse:Jt.parseInline)(i,o);return o.hooks&&(c=o.hooks.postprocess(c)),c}catch(i){return s(i)}}}onError(e,t){return a=>{if(a.message+=`
254
+ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+mn(a.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(a);throw a}}},mr=new Mx;function ie(e,t){return mr.parse(e,t)}ie.options=ie.setOptions=function(e){return mr.setOptions(e),ie.defaults=mr.defaults,gx(ie.defaults),ie};ie.getDefaults=xf;ie.defaults=Ir;ie.use=function(...e){return mr.use(...e),ie.defaults=mr.defaults,gx(ie.defaults),ie};ie.walkTokens=function(e,t){return mr.walkTokens(e,t)};ie.parseInline=mr.parseInline;ie.Parser=Jt;ie.parser=Jt.parse;ie.Renderer=gc;ie.TextRenderer=Ef;ie.Lexer=Gt;ie.lexer=Gt.lex;ie.Tokenizer=vc;ie.Hooks=ss;ie.parse=ie;ie.options;ie.setOptions;ie.use;ie.walkTokens;ie.parseInline;Jt.parse;Gt.lex;const mC={js:"javascript",ts:"typescript",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",yml:"yaml",dockerfile:"docker","":"plaintext"};function Ix(e){const t=e.toLowerCase().trim();return mC[t]||t}function ls(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function vC(e,t){const a=Ix(t);if(tn.languages[a])try{return tn.highlight(e,tn.languages[a],a)}catch{}return ls(e)}function gC(){const e=new Mx({gfm:!0,breaks:!0});return e.use({renderer:{code(t){const a=t.lang||"",r=t.text,o=vC(r,a);return`<pre class="code-block${a?` language-${Ix(a)}`:""}"><code>${o}</code></pre>`},link(t){const a=t.href,r=t.title?` title="${ls(t.title)}"`:"",o=t.text;return a.startsWith("http://")||a.startsWith("https://")?`<a href="${ls(a)}"${r} target="_blank" rel="noopener noreferrer">${o}</a>`:`<a href="${ls(a)}"${r}>${o}</a>`},html(t){return ls(t.text)}}}),e}const bC=gC();function Af(e){return bC.parse(e)}function xC({args:e}){const[t,a]=U(!1),r=e.image,o=e.prompt,s=r?.startsWith("http");return n("div",{class:"space-y-2",children:[s&&n("button",{type:"button",onClick:()=>a(!0),class:"rounded-md overflow-hidden bg-[var(--color-bg-tertiary)] p-2 cursor-pointer hover:bg-[var(--color-bg-secondary)] transition-colors","aria-label":l("toolInput.expandImage"),children:n("img",{src:r,alt:l("toolInput.inputImage"),class:"max-h-[150px] max-w-full rounded object-contain",loading:"lazy"})}),!s&&r&&n(xt,{children:[n("span",{class:"sr-only",children:[l("toolInput.imagePath"),": "]}),"🖼️ ",r]}),o&&n(xt,{children:[n("span",{class:"sr-only",children:[l("toolInput.prompt"),": "]}),"💬 ",o]}),t&&s&&n("div",{role:"dialog","aria-modal":"true","aria-label":l("common.imageViewer"),class:"fixed inset-0 z-[9999] bg-black/90 flex items-center justify-center p-4",onClick:()=>a(!1),onKeyDown:i=>i.key==="Escape"&&a(!1),tabIndex:0,children:[n("button",{type:"button",onClick:()=>a(!1),class:"absolute top-4 right-4 p-2 rounded-full bg-black/50 text-white hover:bg-black/70 transition-colors","aria-label":l("actions.close"),children:"✕"}),n("img",{src:r,alt:l("toolInput.expandedImage"),class:"max-h-[90vh] max-w-[90vw] object-contain rounded-lg",onClick:i=>i.stopPropagation(),onKeyDown:i=>i.stopPropagation()})]})]})}function yC({result:e}){const t=typeof e=="string"?e:String(e),a=ye(()=>Af(t),[t]);return n("div",{class:"prose prose-sm dark:prose-invert max-w-none text-sm leading-relaxed p-2 rounded-md bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)] [&_strong]:text-[var(--color-text-primary)] [&_em]:text-[var(--color-text-secondary)]",dangerouslySetInnerHTML:{__html:a}})}function wC({args:e}){const t=e.sessionKey,a=e.model;return!t&&!a?n(xt,{children:[n("span",{class:"sr-only",children:[l("toolInput.sessionStatus"),": "]}),n("span",{children:["📊 ",l("sessionStatus.currentSession")]})]}):n(xt,{inline:!0,children:[n("span",{class:"sr-only",children:[l("toolInput.sessionStatus"),": "]}),n("span",{children:"📊"}),t&&n(ot,{title:t,children:["🧵 ",kC(t)]}),a&&n(ot,{children:["🧠 ",a]})]})}function kC(e){return e.length<=30?e:e.slice(0,15)+"…"+e.slice(-12)}function SC(e){const t=e.trim().split(`
255
+ `),a=[];for(const r of t){const o=r.match(new RegExp("^(\\p{Emoji}+)\\s*(.+)$","u"));if(o){const s=o[2],i=s.indexOf(":");i>0?a.push({emoji:o[1],label:s.slice(0,i).trim(),value:s.slice(i+1).trim()}):a.push({emoji:o[1],label:"",value:s.trim()})}}return a}function nv(e){const t=e.match(/(\d+)%/);return t?parseInt(t[1],10):null}function av({percent:e,color:t,label:a}){const r=t||(e>66?"var(--color-success)":e>33?"var(--color-warning)":"var(--color-error)");return n("div",{class:"flex items-center gap-2 mt-1.5",children:[n("div",{class:"h-2 w-28 bg-[var(--color-bg-secondary)] rounded-full overflow-hidden",role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:n("div",{class:"h-full rounded-full transition-all",style:{width:`${e}%`,backgroundColor:r}})}),a&&n("span",{class:"text-[var(--color-text-muted)] text-xs",children:a})]})}function _C({result:e}){const t=typeof e=="string"?e:String(e),a=SC(t);return a.length===0?n(we,{content:e,maxLines:20}):n("div",{class:"rounded-md bg-[var(--color-bg-tertiary)] overflow-hidden",children:a.map((r,o)=>{const s=r.label==="Context"?nv(r.value):null,i=r.label==="Usage"?nv(r.value):null;return n("div",{class:`flex items-start gap-3 px-3 py-2 text-sm ${o>0?"border-t border-[var(--color-border)]/50":""}`,children:[n("span",{class:"flex-shrink-0 w-6 text-center text-base",children:r.emoji}),r.label&&n("span",{class:"font-medium text-[var(--color-text-muted)] w-20 flex-shrink-0",children:r.label}),n("div",{class:"flex-1 min-w-0",children:[n("span",{class:"text-[var(--color-text-primary)]",children:r.value}),s!==null&&n(av,{percent:s,color:"var(--color-accent)",label:`${s}%`}),i!==null&&n(av,{percent:i,label:l("sessionStatus.remaining",{percent:i})})]})]},o)})})}function CC({args:e}){const t=e.action,a=e.profile,r=e.targetUrl??e.url;return n(xt,{inline:!0,children:[n("span",{class:"sr-only",children:[l("toolInput.browserAction"),": "]}),n("span",{children:["🌐 ",t]}),a&&n(ot,{children:a}),r&&n("span",{class:"text-[var(--color-accent)] truncate",children:r})]})}function TC({result:e}){if(typeof e=="string"){const a=e.replace(/<<<EXTERNAL_UNTRUSTED_CONTENT>>>\nSource: Browser\n---\n?/g,"").replace(/\n?<<<END_EXTERNAL_UNTRUSTED_CONTENT>>>/g,"").trim();try{const r=JSON.parse(a);if(r?.tabs)return n(rv,{tabs:r.tabs})}catch{}return a?n(we,{content:a,maxLines:30}):n(kt,{children:l("toolOutput.emptyResponse")})}const t=Yn(e);return t?.tabs?n(rv,{tabs:t.tabs}):n(we,{content:e,maxLines:20})}function rv({tabs:e}){return e.length===0?n(kt,{children:l("toolOutput.noTabsOpen")}):n("div",{class:"space-y-1",children:e.map((t,a)=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{class:"text-[var(--color-text-muted)]",children:"🌐"}),n("span",{class:"font-medium text-[var(--color-text-primary)] truncate",children:t.title||"Untitled"}),t.url&&t.url!=="about:blank"&&n("span",{class:"text-[var(--color-accent)] truncate text-[10px]",children:t.url})]},t.targetId??a))})}var EC=["className","activeClass","activeClassName","path"];function AC(e){var t=e.className,a=e.activeClass,r=e.activeClassName,o=e.path,s=(function(h,f){if(h==null)return{};var p,v,w={},C=Object.keys(h);for(v=0;v<C.length;v++)f.indexOf(p=C[v])>=0||(w[p]=h[p]);return w})(e,EC),i=D0()[0],c=o&&i.path&&pd(i.path,o,{})||pd(i.url,s.href,{}),u=s.class||t||"",d=c&&(a||r)||"";return s.class=u+(u&&d&&" ")+d,an(N0,s)}function Mf(e){if(typeof e.atMs=="number"&&Number.isFinite(e.atMs))return e.atMs;if(typeof e.at=="string"){const t=new Date(e.at).getTime();return Number.isFinite(t)?t:void 0}}function MC(e){const t=new Date(e),a=r=>String(r).padStart(2,"0");return`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())}T${a(t.getHours())}:${a(t.getMinutes())}`}function IC(e){return new Date(e).getTime()}function Qs(e){switch(e.kind){case"cron":return e.expr+(e.tz?` (${e.tz})`:"")+(e.staggerMs!==void 0?` +${e.staggerMs}ms`:"");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":{const t=Mf(e);return t?`Once at ${ae(t)}`:l("cron.noTimeSet")}}}function If(e){return e.enabled?e.state.runningAtMs?l("cron.running"):e.state.nextRunAtMs?ae(e.state.nextRunAtMs,{relative:!0}):"—":"—"}function RC(e){return e.state.lastRunAtMs?ae(e.state.lastRunAtMs,{relative:!0}):"—"}function Rf(e){if(!e.enabled)return{variant:"default",label:l("common.disabled")};if(e.state.runningAtMs)return{variant:"warning",label:l("cron.running")};const t=e.state.lastRunStatus??e.state.lastStatus;return t==="error"?{variant:"error",label:l("cron.lastFailed")}:t==="ok"?{variant:"success",label:l("cron.lastOk")}:{variant:"default",label:l("common.pending")}}function LC(e){switch(e){case"delivered":return{variant:"success",label:l("cron.deliveryStatus.delivered")};case"not-delivered":return{variant:"error",label:l("cron.deliveryStatus.notDelivered")};case"unknown":return{variant:"warning",label:l("cron.deliveryStatus.unknown")};case"not-requested":return{variant:"default",label:l("cron.deliveryStatus.notRequested")}}}function $C(e){const t=e.trim().split(/\s+/);if(t.length<5||t.length>6)return!1;const a=/^(\*|(\d+(-\d+)?(,\d+(-\d+)?)*)(\/\d+)?|\*\/\d+)$/;return t.every(r=>a.test(r))}const DC=[{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"}],PC=[{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 ov(e){if(!e||typeof e!="object")return"";try{return Qs(e)}catch{return String(e.kind||"")}}function OC({args:e}){const t=e.action,a=e.jobId,r=e.job,o=r?.name,s=e.patch,i={list:l("cron.actions.list"),add:l("cron.actions.add"),update:l("cron.actions.update"),remove:l("cron.actions.remove"),run:l("cron.actions.run"),runs:l("cron.actions.runs"),status:l("cron.actions.status"),wake:l("cron.actions.wake")},u={list:"📋",add:"➕",update:"✏️",remove:"🗑️",run:"▶️",runs:"📊",status:"📡",wake:"⏰"}[t]||"⏰",d=i[t]||t;if(t==="add"&&r){const h=r.schedule,f=r.sessionTarget;return n("div",{class:"space-y-1",children:[n(xt,{inline:!0,children:[n("span",{class:"sr-only",children:[l("toolInput.cronAction"),": "]}),n("span",{children:[u," ",d]}),o&&n(ot,{children:o})]}),n("div",{class:"text-xs text-[var(--color-text-muted)] pl-1 flex flex-wrap gap-x-3",children:[h&&n("span",{children:[h.kind==="cron"&&`🕐 ${h.expr}`,h.kind==="every"&&`🔄 Every ${h.everyMs/1e3}s`,h.kind==="at"&&"📅 One-time"]}),f&&n("span",{children:["→ ",f]})]})]})}return n(xt,{inline:!0,children:[n("span",{class:"sr-only",children:[l("toolInput.cronAction"),": "]}),n("span",{children:[u," ",d]}),(a||o)&&n(ot,{children:o||a?.slice(0,8)||""}),s&&Object.keys(s).length>0&&n("span",{class:"text-[var(--color-text-muted)]",children:["(",Object.keys(s).join(", "),")"]})]})}function NC({result:e}){const t=Yn(e);if(t&&"enabled"in t&&"nextWakeAtMs"in t){const a=t;return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-1",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:`w-2 h-2 rounded-full ${a.enabled?"bg-[var(--color-success)]":"bg-[var(--color-text-muted)]"}`}),n("span",{class:"font-medium",children:a.enabled?l("common.enabled"):l("common.disabled")}),typeof a.jobs=="number"&&n("span",{class:"text-[var(--color-text-muted)]",children:["• ",l("cron.jobCount",{count:a.jobs})]})]}),a.nextWakeAtMs&&n("div",{class:"text-[var(--color-text-muted)]",children:[l("cron.stats.nextWake"),": ",ae(a.nextWakeAtMs,{relative:!0})]})]})}if(t&&"entries"in t&&Array.isArray(t.entries)){const a=t.entries.slice(0,5);return a.length===0?n(kt,{children:l("cron.noRuns")}):n("div",{class:"space-y-1",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:[l("cron.recentRuns")," (",a.length,")"]}),a.map((r,o)=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{class:`w-2 h-2 rounded-full flex-shrink-0 ${r.status==="ok"?"bg-[var(--color-success)]":r.status==="error"?"bg-[var(--color-error)]":"bg-[var(--color-text-muted)]"}`}),r.runAtMs&&n("span",{class:"text-[var(--color-text-muted)]",children:ae(r.runAtMs,{relative:!0})}),r.durationMs&&n("span",{class:"text-[var(--color-text-muted)]",children:["(",Math.round(r.durationMs/1e3),"s)"]}),r.summary&&n("span",{class:"truncate flex-1 text-[var(--color-text-primary)]",title:r.summary,children:r.summary.split(`
256
+ `)[0].slice(0,60)})]},r.ts??o))]})}if(t&&"jobs"in t&&Array.isArray(t.jobs)){const a=t.jobs;return a.length===0?n(kt,{children:l("cron.noJobs")}):n("div",{class:"space-y-1",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:l("cron.jobCount",{count:a.length})}),a.map(r=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{class:`w-2 h-2 rounded-full flex-shrink-0 ${r.enabled?"bg-[var(--color-success)]":"bg-[var(--color-text-muted)]"}`}),n("span",{class:"font-medium text-[var(--color-text-primary)] truncate flex-1",children:r.name||r.id?.slice(0,8)}),r.schedule&&n("span",{class:"text-[var(--color-text-muted)] font-mono text-[10px]",children:ov(r.schedule)}),r.state?.nextRunAtMs&&n("span",{class:"text-[var(--color-accent)] text-[10px]",children:ae(r.state.nextRunAtMs,{relative:!0})})]},r.id))]})}if(t&&("id"in t||"name"in t)&&!("ok"in t)){const a=t;return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-2",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:`w-2 h-2 rounded-full ${a.enabled?"bg-[var(--color-success)]":"bg-[var(--color-text-muted)]"}`}),n("span",{class:"font-medium text-[var(--color-text-primary)]",children:a.name||a.id?.slice(0,8)}),n(AC,{href:`/cron?job=${a.id}`,class:"text-[var(--color-accent)] hover:underline ml-auto",children:l("actions.view")})]}),n("div",{class:"grid grid-cols-2 gap-x-4 gap-y-1 text-[var(--color-text-muted)]",children:[a.schedule&&n(H,{children:[n("span",{children:[l("cron.columns.schedule"),":"]}),n("span",{class:"font-mono",children:ov(a.schedule)})]}),a.sessionTarget&&n(H,{children:[n("span",{children:[l("cron.form.sessionTarget"),":"]}),n("span",{children:a.sessionTarget})]}),a.delivery?.mode&&n(H,{children:[n("span",{children:[l("cron.form.announceResults"),":"]}),n("span",{children:a.delivery.mode==="announce"?"✓":"—"})]}),a.deleteAfterRun&&n(H,{children:[n("span",{children:[l("cron.scheduleKind.at"),":"]}),n("span",{children:"✓"})]})]}),a.state?.nextRunAtMs&&n("div",{class:"text-[var(--color-text-muted)] pt-1 border-t border-[var(--color-border)]",children:[l("cron.stats.nextWake"),": ",ae(a.state.nextRunAtMs,{relative:!0})]})]})}if(t&&"ok"in t&&t.ok===!0){const a=t;let r=l("common.success");return a.ran&&(r=l("cron.jobTriggered")),a.removed&&(r=l("cron.jobRemoved")),n(kt,{children:n("span",{class:"text-[var(--color-success)]",children:["✓ ",r]})})}return n(we,{content:e,maxLines:20})}const Ii={telegram:"Telegram",whatsapp:"WhatsApp",discord:"Discord",irc:"IRC",googlechat:"Google Chat",slack:"Slack",signal:"Signal",imessage:"iMessage",bluebubbles:"BlueBubbles",imsg:"iMessage",gchat:"Google Chat","google-chat":"Google Chat","internet-relay-chat":"IRC"},FC={send:"💬",broadcast:"📢",reply:"↩️",sendWithEffect:"✨",sendAttachment:"📎",unsend:"🗑️",react:"👍",reactions:"😀",read:"👁️",edit:"✏️",delete:"🗑️",pin:"📌",unpin:"📌","list-pins":"📌","thread-create":"🧵","thread-list":"🧵","thread-reply":"🧵",search:"🔍",sticker:"🎨","emoji-list":"😀","emoji-upload":"😀","sticker-upload":"🎨","channel-info":"ℹ️","channel-list":"📋","channel-create":"➕","channel-edit":"✏️","channel-delete":"🗑️","channel-move":"↔️","category-create":"📁","category-edit":"📁","category-delete":"📁",poll:"📊","member-info":"👤","role-info":"🎭",permissions:"🔐","voice-status":"🎤","event-list":"📅","event-create":"📅",renameGroup:"✏️",setGroupIcon:"🖼️",addParticipant:"➕",removeParticipant:"➖",leaveGroup:"🚪"},Rx={send:"Send",broadcast:"Broadcast",reply:"Reply",sendWithEffect:"Send with Effect",sendAttachment:"Send Attachment",unsend:"Unsend",react:"React",reactions:"Get Reactions",read:"Mark Read",edit:"Edit",delete:"Delete",pin:"Pin",unpin:"Unpin","list-pins":"List Pins","thread-create":"Create Thread","thread-list":"List Threads","thread-reply":"Reply in Thread",search:"Search",sticker:"Send Sticker","emoji-list":"List Emoji","emoji-upload":"Upload Emoji","sticker-upload":"Upload Sticker","channel-info":"Channel Info","channel-list":"List Channels","channel-create":"Create Channel","channel-edit":"Edit Channel","channel-delete":"Delete Channel","channel-move":"Move Channel","category-create":"Create Category","category-edit":"Edit Category","category-delete":"Delete Category",poll:"Create Poll","member-info":"Member Info","role-info":"Role Info",permissions:"Permissions","voice-status":"Voice Status","event-list":"List Events","event-create":"Create Event",renameGroup:"Rename Group",setGroupIcon:"Set Group Icon",addParticipant:"Add Participant",removeParticipant:"Remove Participant",leaveGroup:"Leave Group"};function zC({args:e}){const t=e.action,a=e.channel,r=FC[t]||"💬",o=Rx[t]||t,s=a?Ii[a]||a:void 0,i=new Set(["action","channel","dryRun"]),c=Object.entries(e).filter(([u,d])=>!i.has(u)&&d!==void 0&&d!==null);return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("div",{class:"flex items-center gap-2 mb-2",children:[n("span",{class:"sr-only",children:[l("toolInput.messageAction"),": "]}),n("span",{children:[r," ",o]}),s&&n(ot,{children:s}),e.dryRun&&n(ot,{children:l("common.dryRun")})]}),c.length>0&&n("div",{class:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-[var(--color-text-muted)]",children:c.map(([u,d])=>n(H,{children:[n("span",{children:[u,":"]},`${u}-label`),n("span",{class:"text-[var(--color-text-primary)] truncate",title:String(d),children:typeof d=="object"?JSON.stringify(d):String(d)},`${u}-value`)]}))})]})}function UC(e,t){return e.length<=t?e:e.slice(0,t-1)+"…"}function jC(e){return e.startsWith("+")||e.startsWith("user:")||e.startsWith("channel:")?e:e.length>20?e.slice(0,8)+"…"+e.slice(-8):e}function HC({result:e}){let t=e;if(typeof e=="string"){if(!e.trim())return n(kt,{children:l("toolOutput.messageSent")});try{t=JSON.parse(e)}catch{return n(we,{content:e,maxLines:10})}}const a=Yn(t);if(!a)return n(we,{content:e,maxLines:20});if("results"in a&&Array.isArray(a.results)){const r=a.results,o=r.filter(i=>i.ok).length,s=r.length-o;return n("div",{class:"space-y-1",children:[n(kt,{children:[n("span",{class:"text-[var(--color-success)]",children:["✓ ",l("toolOutput.broadcastSent")]}),n("span",{class:"text-[var(--color-text-muted)]",children:[" ","— ",o,"/",r.length," ",l("common.success").toLowerCase(),s>0&&`, ${s} failed`]})]}),r.slice(0,5).map((i,c)=>n("div",{class:"flex items-center gap-2 text-xs px-2 py-1 rounded bg-[var(--color-bg-tertiary)]",children:[n("span",{class:i.ok?"text-[var(--color-success)]":"text-[var(--color-error)]",children:i.ok?"✓":"✗"}),n("span",{class:"text-[var(--color-text-muted)]",children:i.to}),i.error&&n("span",{class:"text-[var(--color-error)] truncate",children:i.error})]},c)),r.length>5&&n("div",{class:"text-xs text-[var(--color-text-muted)] px-2",children:["+",r.length-5," more"]})]})}if("channels"in a&&Array.isArray(a.channels)){const r=a.channels,o=r.some(u=>"guild_id"in u),s=r.length===1?l("toolOutput.channelCount",{count:r.length}):l("toolOutput.channelCountPlural",{count:r.length}),i={0:{icon:"#",label:"text"},2:{icon:"🔊",label:"voice"},4:{icon:"📁",label:"category"},5:{icon:"📢",label:"announcement"},13:{icon:"🎭",label:"stage"},15:{icon:"💬",label:"forum"}},c=u=>{if(o&&typeof u.type=="number"){const d=i[u.type]||{icon:"•",label:`type ${u.type}`};return{icon:d.icon,typeLabel:d.label}}return{icon:"•",typeLabel:u.type!==void 0?String(u.type):null}};return n(ta,{header:n(H,{children:[n("span",{class:"font-medium text-[var(--color-text-primary)]",children:s}),o&&n(ot,{children:"Discord"})]}),children:n("details",{open:!0,children:[n("summary",{class:"cursor-pointer text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]",children:l("toolOutput.showAll")}),n("div",{class:"mt-2 space-y-0.5 max-h-60 overflow-y-auto font-mono",children:r.map((u,d)=>{const h=c(u);return n("div",{class:"flex items-center gap-2 text-[var(--color-text-muted)]",children:[n("span",{class:"w-4 text-center",children:h.icon}),n("span",{class:"text-[var(--color-text-primary)]",children:u.name||l("toolOutput.unnamed")}),h.typeLabel&&n("span",{class:"text-[10px] opacity-50",children:h.typeLabel}),n("span",{class:"ml-auto text-[10px] opacity-30",children:u.id})]},u.id||d)})})]})})}if("member"in a&&typeof a.member=="object"&&a.member!==null){const r=a.member,o=r.nick||r.user?.global_name||r.user?.username||"Unknown",s=r.joined_at?new Date(r.joined_at).toLocaleDateString():null;return n(ta,{header:n(H,{children:[n("span",{class:"font-medium text-[var(--color-text-primary)]",children:["👤 ",o]}),r.user?.username&&r.user.username!==o&&n("span",{class:"text-[var(--color-text-muted)]",children:["@",r.user.username]})]}),children:n(zd,{children:[r.user?.id&&n(Vt,{label:l("toolOutput.fieldId"),mono:!0,small:!0,children:r.user.id}),s&&n(Vt,{label:l("toolOutput.fieldJoined"),children:s}),r.roles&&r.roles.length>0&&n(Vt,{label:l("toolOutput.fieldRoles"),children:r.roles.length})]})})}if("emojis"in a&&Array.isArray(a.emojis)){const r=a.emojis;if(r.length===0)return n(kt,{children:n("span",{class:"text-[var(--color-text-muted)]",children:l("toolOutput.noEmojis")})});const o=r.length===1?l("toolOutput.emojiCount",{count:r.length}):l("toolOutput.emojiCountPlural",{count:r.length});return n(ta,{header:n("span",{class:"font-medium text-[var(--color-text-primary)]",children:o}),children:n("div",{class:"flex flex-wrap gap-1 max-h-40 overflow-y-auto",children:r.map((s,i)=>n("span",{class:"text-[var(--color-text-muted)]",title:s.name,children:[":",s.name,":"]},s.id||i))})})}if("events"in a&&Array.isArray(a.events)){const r=a.events;if(r.length===0)return n(kt,{children:n("span",{class:"text-[var(--color-text-muted)]",children:l("toolOutput.noScheduledEvents")})});const o=r.length===1?l("toolOutput.eventCount",{count:r.length}):l("toolOutput.eventCountPlural",{count:r.length});return n(ta,{header:n("span",{class:"font-medium text-[var(--color-text-primary)]",children:["📅 ",o]}),children:n("div",{class:"space-y-1 max-h-40 overflow-y-auto",children:r.map((s,i)=>n("div",{class:"flex items-center gap-2 text-[var(--color-text-muted)]",children:[n("span",{class:"text-[var(--color-text-primary)]",children:s.name||l("toolOutput.unnamed")}),s.scheduled_start_time&&n("span",{class:"text-[10px]",children:new Date(s.scheduled_start_time).toLocaleString()})]},s.id||i))})})}if("pins"in a&&Array.isArray(a.pins)){const r=a.pins;if(r.length===0)return n(kt,{children:n("span",{class:"text-[var(--color-text-muted)]",children:l("toolOutput.noPinnedMessages")})});const o=r.length===1?l("toolOutput.pinnedCount",{count:r.length}):l("toolOutput.pinnedCountPlural",{count:r.length});return n(ta,{header:n("span",{class:"font-medium text-[var(--color-text-primary)]",children:["📌 ",o]}),children:n("div",{class:"space-y-1 max-h-40 overflow-y-auto",children:r.map((s,i)=>n("div",{class:"text-[var(--color-text-muted)]",children:[s.author?.username&&n("span",{class:"font-medium",children:[s.author.username,": "]}),n("span",{class:"text-[var(--color-text-primary)]",children:s.content?s.content.length>60?s.content.slice(0,60)+"...":s.content:l("toolOutput.noText")})]},s.id||i))})})}if("ok"in a&&a.ok===!0){const{ok:r,action:o,channel:s,dryRun:i,...c}=a,u=Object.keys(c).length>0;return n(ta,{header:n(H,{children:[n("span",{class:"font-medium text-[var(--color-text-primary)]",children:o?Rx[o]||o:l("common.success")}),s&&n(ot,{children:Ii[s]||s}),i&&n(ot,{children:l("common.dryRun")})]}),children:u&&n("pre",{class:"p-2 bg-[var(--color-bg-secondary)] rounded text-[10px] overflow-x-auto max-h-80 overflow-y-auto",children:JSON.stringify(c,null,2)})})}if("question"in a&&"options"in a){const r=a;return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-2",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{children:"📊"}),n("span",{class:"font-medium text-[var(--color-text-primary)]",children:r.question}),r.dryRun&&n(ot,{children:l("common.dryRun")})]}),r.options&&r.options.length>0&&n("div",{class:"space-y-1 pl-5",children:r.options.map((o,s)=>n("div",{class:"text-[var(--color-text-muted)]",children:["• ",o]},s))}),n("div",{class:"text-[var(--color-text-muted)] text-[10px]",children:[r.channel&&(Ii[r.channel]||r.channel),r.to&&` → ${jC(r.to)}`]})]})}if("channels"in a&&Array.isArray(a.channels)){const r=a.channels;return r.length===0?n(kt,{children:l("toolOutput.noChannels")}):n("div",{class:"space-y-1",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:l("toolOutput.channelCount",{count:r.length})}),r.slice(0,10).map((o,s)=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{class:"text-[var(--color-text-muted)]",children:"#"}),n("span",{class:"font-medium text-[var(--color-text-primary)] truncate",children:o.name||o.id}),o.topic&&n("span",{class:"text-[var(--color-text-muted)] truncate text-[10px]",children:o.topic})]},o.id??s)),r.length>10&&n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:["+",r.length-10," more"]})]})}if("messages"in a&&Array.isArray(a.messages)){const r=a.messages;return r.length===0?n(kt,{children:l("toolOutput.noResults")}):n("div",{class:"space-y-1",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:l("toolOutput.messageCount",{count:r.length})}),r.slice(0,5).map((o,s)=>n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[o.author&&n("span",{class:"font-medium text-[var(--color-accent)]",children:[o.author,": "]}),n("span",{class:"text-[var(--color-text-primary)]",children:UC(o.content||"",80)})]},o.id??s)),r.length>5&&n("div",{class:"text-xs text-[var(--color-text-muted)] px-1",children:["+",r.length-5," more"]})]})}if("events"in a&&Array.isArray(a.events)){const r=a.events;return r.length===0?n(kt,{children:l("toolOutput.noEvents")}):n("div",{class:"space-y-1",children:r.slice(0,5).map((o,s)=>n("div",{class:"flex items-center gap-2 text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)]",children:[n("span",{children:"📅"}),n("span",{class:"font-medium text-[var(--color-text-primary)]",children:o.name}),o.startTime&&n("span",{class:"text-[var(--color-text-muted)] text-[10px]",children:o.startTime})]},o.id??s))})}if("username"in a||"displayName"in a){const r=a;return n("div",{class:"text-xs p-2 rounded-md bg-[var(--color-bg-tertiary)] space-y-1",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{children:"👤"}),n("span",{class:"font-medium text-[var(--color-text-primary)]",children:r.displayName||r.username}),r.username&&r.displayName&&n("span",{class:"text-[var(--color-text-muted)]",children:["@",r.username]})]}),r.roles&&r.roles.length>0&&n("div",{class:"flex flex-wrap gap-1 pl-5",children:[r.roles.slice(0,5).map((o,s)=>n(ot,{children:o},s)),r.roles.length>5&&n("span",{class:"text-[10px] text-[var(--color-text-muted)]",children:["+",r.roles.length-5]})]})]})}if("channel"in a&&"to"in a){const r=a;return n(ta,{header:n(H,{children:[n("span",{class:"font-medium text-[var(--color-text-primary)]",children:l("toolOutput.messageSent")}),r.dryRun&&n(ot,{children:l("common.dryRun")})]}),children:n(zd,{children:[n(Vt,{label:l("toolOutput.fieldChannel"),children:r.channel&&(Ii[r.channel]||r.channel)}),n(Vt,{label:l("toolOutput.fieldTo"),children:r.to}),r.via&&n(Vt,{label:l("toolOutput.fieldVia"),children:r.via}),r.mediaUrl!==void 0&&n(Vt,{label:l("toolOutput.fieldMedia"),children:r.mediaUrl||"none"})]})})}return n(we,{content:e,maxLines:20})}function BC({args:e}){const t=e.action;if(t==="update.run"){const a=e.note;return n(xt,{inline:!0,children:[n("span",{children:"🔄"}),n("span",{class:"text-[var(--color-text-primary)]",children:l("gateway.updateRun")}),a&&n("span",{class:"text-[var(--color-text-muted)]",children:["— ",a]})]})}return n(xt,{children:[n("span",{class:"text-[var(--color-text-muted)]",children:"gateway"})," ",n("span",{class:"text-[var(--color-text-primary)]",children:t||"unknown"})]})}function WC({result:e}){const t=Yn(e),a=t?.result?.result;if(a?.before?.version||a?.after?.version){const r=a.before?.version,o=a.after?.version,s=a.mode,i=a.durationMs,c=t?.result?.restart,u=n("span",{class:"font-medium text-[var(--color-text-primary)]",children:l("gateway.updateComplete")});return n(ta,{header:u,success:a.status==="ok",children:n(zd,{children:[r&&o&&n(Vt,{label:l("gateway.version"),children:[n("span",{class:"text-[var(--color-text-muted)]",children:r}),n("span",{class:"mx-1.5",children:"→"}),n("span",{class:"text-[var(--color-success)] font-medium",children:o})]}),s&&n(Vt,{label:l("gateway.mode"),children:s}),i&&n(Vt,{label:l("gateway.duration"),children:zh(i)}),c&&n(Vt,{label:l("gateway.restart"),children:c.ok?n("span",{class:"text-[var(--color-success)]",children:l("gateway.restartOk")}):n("span",{class:"text-[var(--color-error)]",children:l("gateway.restartFailed")})})]})})}return n(we,{content:e,maxLines:15})}function KC({result:e}){return n("div",{class:"text-xs p-3 rounded-md bg-[var(--color-error)]/10 border border-[var(--color-error)]/20",children:[n("div",{class:"font-medium text-[var(--color-error)] mb-1",children:l("common.error")}),n("div",{class:"text-[var(--color-text-primary)] whitespace-pre-wrap",children:e.error})]})}function qC({result:e,error:t,toolName:a,filePath:r}){const o=vx(e);if(o)return n(KC,{result:o});switch(a){case"web_search":return n(w3,{result:e});case"web_fetch":return n(S3,{result:e});case"memory_search":return n(C3,{result:e});case"memory_get":return n(T3,{result:e});case"image":return n(yC,{result:e});case"session_status":return n(_C,{result:e});case"browser":return n(TC,{result:e});case"cron":return n(NC,{result:e});case"message":return n(HC,{result:e});case"gateway":return n(WC,{result:e});default:return n(we,{content:e,maxLines:20,error:t,filePath:r})}}function VC({args:e}){const t=e.file_path??e.path,a=e.offset,r=e.limit,o=a&&r?`${a}-${a+r-1}`:a?`${a}+`:void 0;return n(xt,{inline:!0,children:[n("span",{class:"sr-only",children:[l("toolInput.readingFile"),": "]}),n("span",{children:["📄 ",t,o&&n("span",{class:"text-[var(--color-text-muted)]",children:[":",o]})]}),r&&n(ot,{children:l("toolInput.lineCount",{count:r})})]})}function GC({args:e}){const t=e.file_path??e.path,a=e.content;return n("div",{class:"space-y-2",children:[n(xt,{children:[n("span",{class:"sr-only",children:[l("toolInput.writingFile"),": "]}),"📄 ",t]}),n(we,{content:a,filePath:t,maxLines:30})]})}function JC({args:e}){const t=e.command,a=e.workdir||e.cwd,r=a?`# cwd: ${a}
257
+ ${t}`:t;return n("div",{children:[n("span",{class:"sr-only",children:[l("toolInput.runningCommand"),": "]}),n(we,{content:r,filePath:"command.sh",maxLines:20})]})}function YC(e,t){const a=e.length,r=t.length,o=Array(a+1).fill(null).map(()=>Array(r+1).fill(0));for(let s=1;s<=a;s++)for(let i=1;i<=r;i++)e[s-1]===t[i-1]?o[s][i]=o[s-1][i-1]+1:o[s][i]=Math.max(o[s-1][i],o[s][i-1]);return o}function ZC(e,t,a){const r=e.split(`
258
258
  `),o=t.split(`
259
- `),s=a||"file",i=GC(r,o),c=[];let u=r.length,d=o.length;for(;u>0||d>0;)u>0&&d>0&&r[u-1]===o[d-1]?(c.unshift(` ${r[u-1]}`),u--,d--):d>0&&(u===0||i[u][d-1]>=i[u-1][d])?(c.unshift(`+${o[d-1]}`),d--):(c.unshift(`-${r[u-1]}`),u--);return[...[`--- a/${s}`,`+++ b/${s}`,`@@ -1,${r.length} +1,${o.length} @@`],...c].join(`
260
- `)}function YC({args:e}){const t=e.old_string??e.oldText??"",a=e.new_string??e.newText??"",r=e.file_path??e.path??"";if(!t&&!a)return n(ye,{content:e});const o=JC(t,a,r);return n("div",{children:[n("span",{class:"sr-only",children:[l("toolInput.editingFile"),": "]}),n(ye,{content:o,filePath:"changes.diff",maxLines:40})]})}function ZC({args:e}){const t=e.query;return n(xt,{children:[n("span",{class:"sr-only",children:[l("toolInput.searchQuery"),": "]}),"🔍 ",t]})}const ta=new Set,XC=100;function QC(){ta.clear()}function e5(e){if(!e||typeof e!="object")return!1;const t=e;if(!t.details||typeof t.details!="object")return!1;const a=t.details;return a.status==="approval-pending"&&typeof a.approvalId=="string"}function t5({toolCall:e}){const t=F(null),a=e5(e.result),r=ta.has(e.id)||a,o=X(r),s=()=>{const h=o.value;if(o.value=!o.value,o.value){if(ta.size>=XC){const f=ta.values().next().value;f&&ta.delete(f)}ta.add(e.id)}else ta.delete(e.id),h&&t.current&&requestAnimationFrame(()=>{t.current?.scrollIntoView({behavior:"smooth",block:"nearest"})})};R(()=>{a&&!o.value&&(o.value=!0,ta.add(e.id))},[a,e.id]);const i=e.completedAt&&e.startedAt?e.completedAt-e.startedAt:null,u=e.result!==void 0&&vx(e.result)!==null?"error":e.status,d=o5(u,a);return n("div",{ref:t,class:"rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] overflow-hidden",children:[n("button",{type:"button",onClick:s,class:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-[var(--color-bg-secondary)] transition-colors","aria-expanded":o.value,children:[n("span",{class:`text-sm flex-shrink-0 ${d.color}`,children:d.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:s5(e)}),i!==null&&n("span",{class:"text-[10px] text-[var(--color-text-muted)] bg-[var(--color-bg-secondary)] px-1.5 py-0.5 rounded flex-shrink-0",children:jh(i)}),n(Po,{class:"w-4 h-4 text-[var(--color-text-muted)] flex-shrink-0",open:o.value})]}),o.value&&n("div",{class:"px-3 py-2 border-t border-[var(--color-border)] bg-[var(--color-bg-secondary)] space-y-3",children:[e.args&&Object.keys(e.args).length>0&&n(lv,{label:"Input",raw:e.args,children:n(n5,{toolCall:e})}),a&&n(a5,{approvalId:e.result.details.approvalId,expiresAtMs:e.result.details.expiresAtMs}),e.result!==void 0&&!a&&n(lv,{label:"Output",raw:e.result,children:n(WC,{result:e.result,error:e.status==="error",toolName:e.name,filePath:e.args?.path??e.args?.file_path})}),e.status==="error"&&!e.result&&n("div",{class:"text-xs text-[var(--color-error)]",children:"Tool execution failed"})]})]})}function n5({toolCall:e}){const t=e.name.toLowerCase(),a=e.args;return t==="edit"?n(YC,{args:a}):t==="exec"&&a.command?n(VC,{args:a}):t==="read"?n(KC,{args:a}):t==="write"?n(qC,{args:a}):e.name==="web_search"||e.name==="memory_search"?n(ZC,{args:a}):e.name==="web_fetch"?n(w3,{args:a}):e.name==="memory_get"?n(S3,{args:a}):e.name==="image"?n(bC,{args:a}):e.name==="browser"?n(_C,{args:a}):e.name==="cron"?n(DC,{args:a}):e.name==="session_status"?n(yC,{args:a}):e.name==="message"?n(NC,{args:a}):e.name==="gateway"?n(jC,{args:a}):n(ye,{content:a})}function a5({approvalId:e,expiresAtMs:t}){const a=pc.value,r=mc.value,o=Ys.value.get(e),[s,i]=U(Math.max(0,t-Date.now())),[c,u]=U(null),d=o??c;R(()=>{const p=()=>{const w=Math.max(0,t-Date.now());i(w)};p();const v=setInterval(p,1e3);return()=>clearInterval(v)},[t]);const h=async p=>{try{await U_(e,p),u(p)}catch{}};if(d){const p=d==="deny";return n("div",{class:`text-xs italic ${p?"text-[var(--color-error)]":"text-[var(--color-success)]"}`,role:"status","aria-live":"polite",children:l(p?"exec.denied":"common.approved")})}return s<=0?n("div",{class:"text-xs text-[var(--color-text-muted)] italic",children:l("exec.expired")}):n("div",{class:"space-y-2",role:"region","aria-label":l("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:l("exec.approvalNeeded")}),n("span",{class:"text-[10px] text-[var(--color-text-muted)]","aria-label":l("exec.expiresIn",{time:`${Math.ceil(s/1e3)}s`}),children:[Math.ceil(s/1e3),"s"]})]}),r&&n("div",{class:"text-xs text-[var(--color-error)]",role:"alert",children:r}),n("div",{class:"flex gap-2",children:[n(P,{variant:"primary",size:"sm",onClick:()=>h("allow-once"),disabled:a,children:l("exec.allowOnce")}),n(P,{variant:"secondary",size:"sm",onClick:()=>h("allow-always"),disabled:a,children:l("exec.allowAlways")}),n(P,{variant:"ghost",size:"sm",onClick:()=>h("deny"),disabled:a,children:l("exec.deny")})]})]})}function r5(e){if(typeof e=="string")try{const t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}return JSON.stringify(e,null,2)}function lv({label:e,children:t,raw:a}){const r=X(!1);return n("div",{children:[n("div",{class:"flex items-center gap-2 mb-1",children:[n("span",{class:"text-[10px] font-medium text-[var(--color-text-muted)] uppercase tracking-wide",children:e}),a!==void 0&&n("button",{type:"button",onClick:()=>r.value=!r.value,class:"text-[10px] text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors","aria-pressed":r.value,children:r.value?l("toolBlock.showFormatted"):l("toolBlock.showRaw")})]}),r.value&&a!==void 0?n(ye,{content:r5(a),filePath:"raw.json",maxLines:30}):t]})}function o5(e,t=!1){if(t)return{icon:"⏳",color:"text-[var(--color-warning)]"};switch(e){case"pending":return{icon:"○",color:"text-[var(--color-text-muted)]"};case"running":return{icon:n(te,{size:"xs",class:"text-[var(--color-accent)]"}),color:""};case"complete":return{icon:"✓",color:"text-[var(--color-success)]"};case"error":return{icon:"✗",color:"text-[var(--color-error)]"};default:return{icon:"○",color:"text-[var(--color-text-muted)]"}}}function s5(e){const t=e.args||{};if(t.path||t.file_path)return l5(String(t.path||t.file_path));if(t.command)return Li(String(t.command),60);if(t.query)return Li(String(t.query),60);if(t.url)return i5(String(t.url));if(t.action)return String(t.action);for(const[a,r]of Object.entries(t))if(typeof r=="string"&&r.length>0&&!a.startsWith("_"))return Li(r,50);return""}function Li(e,t){return e.length<=t?e:e.slice(0,t-1)+"…"}function l5(e){const t=e.split("/").filter(Boolean);return t.length<=2?e:"…/"+t.slice(-2).join("/")}function i5(e){try{const t=new URL(e),a=t.pathname.length>30?t.pathname.slice(0,30)+"…":t.pathname;return t.hostname+a}catch{return Li(e,50)}}function yc({size:e="md",colorClass:t}){const a=e==="sm"?"w-1 h-1":"w-1.5 h-1.5",r=t??"bg-[var(--color-accent)]";return n("span",{class:"inline-flex items-end gap-1",children:[n("span",{class:`${a} rounded-full ${r} animate-bounce-dot-1`}),n("span",{class:`${a} rounded-full ${r} animate-bounce-dot-2`}),n("span",{class:`${a} rounded-full ${r} animate-bounce-dot-3`})]})}const c5="bg-[var(--color-warning-muted)] rounded px-0.5";function u5(e,t){if(!t)return;const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:i=>{const c=i.parentElement;return c?.closest("pre, code")||c?.tagName==="MARK"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),r=[];let o;for(;o=a.nextNode();)r.push(o);const s=t.toLowerCase();for(const i of r){const c=i.textContent||"",u=c.toLowerCase(),d=[];let h=0,f;for(;(f=u.indexOf(s,h))!==-1;)d.push({start:f,end:f+t.length}),h=f+1;if(d.length===0)continue;const p=document.createDocumentFragment();let v=0;for(const w of d){w.start>v&&p.appendChild(document.createTextNode(c.slice(v,w.start)));const C=document.createElement("mark");C.className=c5,C.textContent=c.slice(w.start,w.end),p.appendChild(C),v=w.end}v<c.length&&p.appendChild(document.createTextNode(c.slice(v))),i.replaceWith(p)}}function Ll({content:e,isStreaming:t=!1}){const a=F(null),r=xe(()=>{if(!e)return"";const s=If(e);return px(s)},[e]),o=Qh.value.trim();return R(()=>{if(!a.current)return;const s=a.current.querySelectorAll("pre.code-block");for(const i of s){if(i.querySelector(".copy-button"))return;const c=document.createElement("button");c.className="copy-button",c.textContent=l("actions.copy"),c.setAttribute("type","button"),c.onclick=async()=>{const u=i.querySelector("code")?.textContent||"";try{await navigator.clipboard.writeText(u),c.textContent=l("actions.copied"),setTimeout(()=>{c.textContent=l("actions.copy")},2e3)}catch{const d=document.createElement("textarea");d.value=u,document.body.appendChild(d),d.select(),document.execCommand("copy"),document.body.removeChild(d),c.textContent=l("actions.copied"),setTimeout(()=>{c.textContent=l("actions.copy")},2e3)}},i.classList.add("relative"),i.insertBefore(c,i.firstChild)}},[r]),R(()=>{!a.current||!o||(a.current.innerHTML=r,u5(a.current,o))},[r,o]),!e&&t?n("span",{class:"inline-flex items-center gap-2 text-[var(--color-text-muted)]",children:[l("chat.thinking"),n(yc,{})]}):n("div",{ref:a,class:"message-content prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:r}})}const ri=`
259
+ `),s=a||"file",i=YC(r,o),c=[];let u=r.length,d=o.length;for(;u>0||d>0;)u>0&&d>0&&r[u-1]===o[d-1]?(c.unshift(` ${r[u-1]}`),u--,d--):d>0&&(u===0||i[u][d-1]>=i[u-1][d])?(c.unshift(`+${o[d-1]}`),d--):(c.unshift(`-${r[u-1]}`),u--);return[...[`--- a/${s}`,`+++ b/${s}`,`@@ -1,${r.length} +1,${o.length} @@`],...c].join(`
260
+ `)}function XC({args:e}){const t=e.old_string??e.oldText??"",a=e.new_string??e.newText??"",r=e.file_path??e.path??"";if(!t&&!a)return n(we,{content:e});const o=ZC(t,a,r);return n("div",{children:[n("span",{class:"sr-only",children:[l("toolInput.editingFile"),": "]}),n(we,{content:o,filePath:"changes.diff",maxLines:40})]})}function QC({args:e}){const t=e.query;return n(xt,{children:[n("span",{class:"sr-only",children:[l("toolInput.searchQuery"),": "]}),"🔍 ",t]})}const na=new Set,e5=100;function t5(){na.clear()}function n5(e){if(!e||typeof e!="object")return!1;const t=e;if(!t.details||typeof t.details!="object")return!1;const a=t.details;return a.status==="approval-pending"&&typeof a.approvalId=="string"}function a5({toolCall:e}){const t=F(null),a=n5(e.result),r=na.has(e.id)||a,o=X(r),s=()=>{const h=o.value;if(o.value=!o.value,o.value){if(na.size>=e5){const f=na.values().next().value;f&&na.delete(f)}na.add(e.id)}else na.delete(e.id),h&&t.current&&requestAnimationFrame(()=>{t.current?.scrollIntoView({behavior:"smooth",block:"nearest"})})};R(()=>{a&&!o.value&&(o.value=!0,na.add(e.id))},[a,e.id]);const i=e.completedAt&&e.startedAt?e.completedAt-e.startedAt:null,u=e.result!==void 0&&vx(e.result)!==null?"error":e.status,d=l5(u,a);return n("div",{ref:t,class:"rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] overflow-hidden",children:[n("button",{type:"button",onClick:s,class:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-[var(--color-bg-secondary)] transition-colors","aria-expanded":o.value,children:[n("span",{class:`text-sm flex-shrink-0 ${d.color}`,children:d.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:i5(e)}),i!==null&&n("span",{class:"text-[10px] text-[var(--color-text-muted)] bg-[var(--color-bg-secondary)] px-1.5 py-0.5 rounded flex-shrink-0",children:zh(i)}),n(Po,{class:"w-4 h-4 text-[var(--color-text-muted)] flex-shrink-0",open:o.value})]}),o.value&&n("div",{class:"px-3 py-2 border-t border-[var(--color-border)] bg-[var(--color-bg-secondary)] space-y-3",children:[e.args&&Object.keys(e.args).length>0&&n(sv,{label:"Input",raw:e.args,children:n(r5,{toolCall:e})}),a&&n(o5,{approvalId:e.result.details.approvalId,expiresAtMs:e.result.details.expiresAtMs}),e.result!==void 0&&!a&&n(sv,{label:"Output",raw:e.result,children:n(qC,{result:e.result,error:e.status==="error",toolName:e.name,filePath:e.args?.path??e.args?.file_path})}),e.status==="error"&&!e.result&&n("div",{class:"text-xs text-[var(--color-error)]",children:"Tool execution failed"})]})]})}function r5({toolCall:e}){const t=e.name.toLowerCase(),a=e.args;return t==="edit"?n(XC,{args:a}):t==="exec"&&a.command?n(JC,{args:a}):t==="read"?n(VC,{args:a}):t==="write"?n(GC,{args:a}):e.name==="web_search"||e.name==="memory_search"?n(QC,{args:a}):e.name==="web_fetch"?n(k3,{args:a}):e.name==="memory_get"?n(_3,{args:a}):e.name==="image"?n(xC,{args:a}):e.name==="browser"?n(CC,{args:a}):e.name==="cron"?n(OC,{args:a}):e.name==="session_status"?n(wC,{args:a}):e.name==="message"?n(zC,{args:a}):e.name==="gateway"?n(BC,{args:a}):n(we,{content:a})}function o5({approvalId:e,expiresAtMs:t}){const a=hc.value,r=fc.value,o=Zs.value.get(e),[s,i]=U(Math.max(0,t-Date.now())),[c,u]=U(null),d=o??c;R(()=>{const p=()=>{const w=Math.max(0,t-Date.now());i(w)};p();const v=setInterval(p,1e3);return()=>clearInterval(v)},[t]);const h=async p=>{try{await j_(e,p),u(p)}catch{}};if(d){const p=d==="deny";return n("div",{class:`text-xs italic ${p?"text-[var(--color-error)]":"text-[var(--color-success)]"}`,role:"status","aria-live":"polite",children:l(p?"exec.denied":"common.approved")})}return s<=0?n("div",{class:"text-xs text-[var(--color-text-muted)] italic",children:l("exec.expired")}):n("div",{class:"space-y-2",role:"region","aria-label":l("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:l("exec.approvalNeeded")}),n("span",{class:"text-[10px] text-[var(--color-text-muted)]","aria-label":l("exec.expiresIn",{time:`${Math.ceil(s/1e3)}s`}),children:[Math.ceil(s/1e3),"s"]})]}),r&&n("div",{class:"text-xs text-[var(--color-error)]",role:"alert",children:r}),n("div",{class:"flex gap-2",children:[n(P,{variant:"primary",size:"sm",onClick:()=>h("allow-once"),disabled:a,children:l("exec.allowOnce")}),n(P,{variant:"secondary",size:"sm",onClick:()=>h("allow-always"),disabled:a,children:l("exec.allowAlways")}),n(P,{variant:"ghost",size:"sm",onClick:()=>h("deny"),disabled:a,children:l("exec.deny")})]})]})}function s5(e){if(typeof e=="string")try{const t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}return JSON.stringify(e,null,2)}function sv({label:e,children:t,raw:a}){const r=X(!1);return n("div",{children:[n("div",{class:"flex items-center gap-2 mb-1",children:[n("span",{class:"text-[10px] font-medium text-[var(--color-text-muted)] uppercase tracking-wide",children:e}),a!==void 0&&n("button",{type:"button",onClick:()=>r.value=!r.value,class:"text-[10px] text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors","aria-pressed":r.value,children:r.value?l("toolBlock.showFormatted"):l("toolBlock.showRaw")})]}),r.value&&a!==void 0?n(we,{content:s5(a),filePath:"raw.json",maxLines:30}):t]})}function l5(e,t=!1){if(t)return{icon:"⏳",color:"text-[var(--color-warning)]"};switch(e){case"pending":return{icon:"○",color:"text-[var(--color-text-muted)]"};case"running":return{icon:n(te,{size:"xs",class:"text-[var(--color-accent)]"}),color:""};case"complete":return{icon:"✓",color:"text-[var(--color-success)]"};case"error":return{icon:"✗",color:"text-[var(--color-error)]"};default:return{icon:"○",color:"text-[var(--color-text-muted)]"}}}function i5(e){const t=e.args||{};if(t.path||t.file_path)return c5(String(t.path||t.file_path));if(t.command)return Ri(String(t.command),60);if(t.query)return Ri(String(t.query),60);if(t.url)return u5(String(t.url));if(t.action)return String(t.action);for(const[a,r]of Object.entries(t))if(typeof r=="string"&&r.length>0&&!a.startsWith("_"))return Ri(r,50);return""}function Ri(e,t){return e.length<=t?e:e.slice(0,t-1)+"…"}function c5(e){const t=e.split("/").filter(Boolean);return t.length<=2?e:"…/"+t.slice(-2).join("/")}function u5(e){try{const t=new URL(e),a=t.pathname.length>30?t.pathname.slice(0,30)+"…":t.pathname;return t.hostname+a}catch{return Ri(e,50)}}function bc({size:e="md",colorClass:t}){const a=e==="sm"?"w-1 h-1":"w-1.5 h-1.5",r=t??"bg-[var(--color-accent)]";return n("span",{class:"inline-flex items-end gap-1",children:[n("span",{class:`${a} rounded-full ${r} animate-bounce-dot-1`}),n("span",{class:`${a} rounded-full ${r} animate-bounce-dot-2`}),n("span",{class:`${a} rounded-full ${r} animate-bounce-dot-3`})]})}const d5="bg-[var(--color-warning-muted)] rounded px-0.5";function h5(e,t){if(!t)return;const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:i=>{const c=i.parentElement;return c?.closest("pre, code")||c?.tagName==="MARK"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),r=[];let o;for(;o=a.nextNode();)r.push(o);const s=t.toLowerCase();for(const i of r){const c=i.textContent||"",u=c.toLowerCase(),d=[];let h=0,f;for(;(f=u.indexOf(s,h))!==-1;)d.push({start:f,end:f+t.length}),h=f+1;if(d.length===0)continue;const p=document.createDocumentFragment();let v=0;for(const w of d){w.start>v&&p.appendChild(document.createTextNode(c.slice(v,w.start)));const C=document.createElement("mark");C.className=d5,C.textContent=c.slice(w.start,w.end),p.appendChild(C),v=w.end}v<c.length&&p.appendChild(document.createTextNode(c.slice(v))),i.replaceWith(p)}}function Ll({content:e,isStreaming:t=!1}){const a=F(null),r=ye(()=>{if(!e)return"";const s=Af(e);return px(s)},[e]),o=Zh.value.trim();return R(()=>{if(!a.current)return;const s=a.current.querySelectorAll("pre.code-block");for(const i of s){if(i.querySelector(".copy-button"))return;const c=document.createElement("button");c.className="copy-button",c.textContent=l("actions.copy"),c.setAttribute("type","button"),c.onclick=async()=>{const u=i.querySelector("code")?.textContent||"";try{await navigator.clipboard.writeText(u),c.textContent=l("actions.copied"),setTimeout(()=>{c.textContent=l("actions.copy")},2e3)}catch{const d=document.createElement("textarea");d.value=u,document.body.appendChild(d),d.select(),document.execCommand("copy"),document.body.removeChild(d),c.textContent=l("actions.copied"),setTimeout(()=>{c.textContent=l("actions.copy")},2e3)}},i.classList.add("relative"),i.insertBefore(c,i.firstChild)}},[r]),R(()=>{!a.current||!o||(a.current.innerHTML=r,h5(a.current,o))},[r,o]),!e&&t?n("span",{class:"inline-flex items-center gap-2 text-[var(--color-text-muted)]",children:[l("chat.thinking"),n(bc,{})]}):n("div",{ref:a,class:"message-content prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:r}})}const ri=`
261
261
  p-2 rounded-full cursor-pointer
262
262
  bg-white/10 text-white hover:bg-white/20
263
263
  transition-colors
264
- `;async function d5(e,t){try{const r=await(await fetch(e)).blob(),o=URL.createObjectURL(r),s=document.createElement("a");s.href=o,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o)}catch{window.open(e,"_blank")}}function h5(e,t){try{const r=new URL(e).pathname.split("/").pop();if(r&&/\.(png|jpe?g|gif|webp|svg)$/i.test(r))return r}catch{}return`image-${t+1}.png`}function Lx({images:e}){const[t,a]=U(null),r=F(null),o=e.filter(u=>!u.omitted&&!!u.url),s=new Map;let i=0;for(const[u,d]of e.entries())!d.omitted&&d.url&&s.set(u,i++);if(R(()=>{t!==null&&r.current?.focus()},[t]),R(()=>{t!==null&&t>=o.length&&a(null)},[t,o.length]),e.length===0)return null;const c=(u,d,h)=>{u.stopPropagation(),d5(d,h5(d,h))};return n(H,{children:[n("div",{class:"flex flex-wrap gap-2 mt-2",children:e.map((u,d)=>n("div",{class:"relative group",children:u.omitted?n("div",{class:`
264
+ `;async function f5(e,t){try{const r=await(await fetch(e)).blob(),o=URL.createObjectURL(r),s=document.createElement("a");s.href=o,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o)}catch{window.open(e,"_blank")}}function p5(e,t){try{const r=new URL(e).pathname.split("/").pop();if(r&&/\.(png|jpe?g|gif|webp|svg)$/i.test(r))return r}catch{}return`image-${t+1}.png`}function Lx({images:e}){const[t,a]=U(null),r=F(null),o=e.filter(u=>!u.omitted&&!!u.url),s=new Map;let i=0;for(const[u,d]of e.entries())!d.omitted&&d.url&&s.set(u,i++);if(R(()=>{t!==null&&r.current?.focus()},[t]),R(()=>{t!==null&&t>=o.length&&a(null)},[t,o.length]),e.length===0)return null;const c=(u,d,h)=>{u.stopPropagation(),f5(d,p5(d,h))};return n(H,{children:[n("div",{class:"flex flex-wrap gap-2 mt-2",children:e.map((u,d)=>n("div",{class:"relative group",children:u.omitted?n("div",{class:`
265
265
  w-[200px] h-[140px] rounded-lg border border-dashed border-[var(--color-border)]
266
266
  bg-[var(--color-bg-secondary)] px-3 py-2
267
267
  flex flex-col items-center justify-center gap-2 text-center
268
- `,title:u.bytes!=null?l("chat.omittedImage",{size:Ws(u.bytes)}):l("chat.omittedImageNoSize"),children:[n(R4,{class:"w-5 h-5 text-[var(--color-text-muted)]","aria-hidden":"true"}),n("p",{class:"text-xs text-[var(--color-text-secondary)] leading-tight",children:u.bytes!=null?l("chat.omittedImage",{size:Ws(u.bytes)}):l("chat.omittedImageNoSize")})]}):n(H,{children:[n("button",{type:"button",onClick:()=>{const h=s.get(d);h!==void 0&&a(h)},class:`
268
+ `,title:u.bytes!=null?l("chat.omittedImage",{size:Ks(u.bytes)}):l("chat.omittedImageNoSize"),children:[n(L4,{class:"w-5 h-5 text-[var(--color-text-muted)]","aria-hidden":"true"}),n("p",{class:"text-xs text-[var(--color-text-secondary)] leading-tight",children:u.bytes!=null?l("chat.omittedImage",{size:Ks(u.bytes)}):l("chat.omittedImageNoSize")})]}):n(H,{children:[n("button",{type:"button",onClick:()=>{const h=s.get(d);h!==void 0&&a(h)},class:`
269
269
  relative rounded-lg overflow-hidden cursor-pointer
270
270
  border border-[var(--color-border)]
271
271
  hover:border-[var(--color-accent)] hover:shadow-md
@@ -276,13 +276,13 @@ ${t}`:t;return n("div",{children:[n("span",{class:"sr-only",children:[l("toolInp
276
276
  opacity-0 group-hover:opacity-100
277
277
  hover:bg-black/80
278
278
  transition-all
279
- `,children:n(Rt,{class:"w-4 h-4"})})]})},d))}),t!==null&&o.length>0&&n("div",{ref:r,role:"dialog","aria-modal":"true","aria-label":l("common.imageViewer"),class:"fixed inset-0 z-[9999] bg-black/80 flex items-center justify-center p-4 outline-none",onClick:()=>a(null),onKeyDown:u=>{u.key==="Escape"&&a(null),u.key==="ArrowLeft"&&a((t-1+o.length)%o.length),u.key==="ArrowRight"&&a((t+1)%o.length)},tabIndex:0,children:[n("div",{class:"absolute top-4 right-4 flex items-center gap-2",children:[n("button",{type:"button",onClick:u=>c(u,o[t].url,t),"aria-label":l("common.download"),class:ri,children:n(Rt,{class:"w-6 h-6"})}),n("button",{type:"button",onClick:()=>a(null),"aria-label":l("actions.close"),class:ri,children:n(Ma,{class:"w-6 h-6"})})]}),o.length>1&&n(H,{children:[n("button",{type:"button",onClick:u=>{u.stopPropagation(),a((t-1+o.length)%o.length)},"aria-label":l("actions.back"),class:`${ri} absolute left-4 p-3 text-2xl`,children:"‹"}),n("button",{type:"button",onClick:u=>{u.stopPropagation(),a((t+1)%o.length)},"aria-label":l("actions.next"),class:`${ri} absolute right-4 p-3 text-2xl`,children:"›"})]}),n("img",{src:o[t].url,alt:o[t].alt||`Image ${t+1}`,class:"max-w-full max-h-full object-contain rounded-lg",onClick:u=>u.stopPropagation(),onKeyDown:u=>u.stopPropagation()}),o.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," / ",o.length]})]})]})}const f5=2e3;function iv({icon:e,label:t,onClick:a}){return n("button",{role:"menuitem",onClick:a,class:`
279
+ `,children:n(Lt,{class:"w-4 h-4"})})]})},d))}),t!==null&&o.length>0&&n("div",{ref:r,role:"dialog","aria-modal":"true","aria-label":l("common.imageViewer"),class:"fixed inset-0 z-[9999] bg-black/80 flex items-center justify-center p-4 outline-none",onClick:()=>a(null),onKeyDown:u=>{u.key==="Escape"&&a(null),u.key==="ArrowLeft"&&a((t-1+o.length)%o.length),u.key==="ArrowRight"&&a((t+1)%o.length)},tabIndex:0,children:[n("div",{class:"absolute top-4 right-4 flex items-center gap-2",children:[n("button",{type:"button",onClick:u=>c(u,o[t].url,t),"aria-label":l("common.download"),class:ri,children:n(Lt,{class:"w-6 h-6"})}),n("button",{type:"button",onClick:()=>a(null),"aria-label":l("actions.close"),class:ri,children:n(Ma,{class:"w-6 h-6"})})]}),o.length>1&&n(H,{children:[n("button",{type:"button",onClick:u=>{u.stopPropagation(),a((t-1+o.length)%o.length)},"aria-label":l("actions.back"),class:`${ri} absolute left-4 p-3 text-2xl`,children:"‹"}),n("button",{type:"button",onClick:u=>{u.stopPropagation(),a((t+1)%o.length)},"aria-label":l("actions.next"),class:`${ri} absolute right-4 p-3 text-2xl`,children:"›"})]}),n("img",{src:o[t].url,alt:o[t].alt||`Image ${t+1}`,class:"max-w-full max-h-full object-contain rounded-lg",onClick:u=>u.stopPropagation(),onKeyDown:u=>u.stopPropagation()}),o.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," / ",o.length]})]})]})}const m5=2e3;function lv({icon:e,label:t,onClick:a}){return n("button",{role:"menuitem",onClick:a,class:`
280
280
  w-full px-3 py-2 text-left text-sm
281
281
  flex items-center gap-2
282
282
  text-[var(--color-text-primary)]
283
283
  hover:bg-[var(--color-bg-hover)]
284
284
  transition-colors cursor-pointer
285
- `,children:[e,t]})}function $x({content:e,visible:t=!1}){const[a,r]=U(!1),[o,s]=U(null),i=F(null),c=F(null);Ia([i,c],()=>r(!1),a),R(()=>{if(!o)return;const f=setTimeout(()=>s(null),f5);return()=>clearTimeout(f)},[o]);const u=Q(async f=>{const p=f==="formatted"?M2(e):e,v=l(f==="formatted"?"actions.copy":"chat.copyMarkdown");try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(p),s(f),r(!1)}catch{V.error(l("status.copyFailed",{label:v}))}},[e]),d=(f,p)=>o===f?n(on,{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?l("actions.copied"):p;return n("div",{class:"relative",children:[n("button",{ref:c,onClick:()=>r(!a),"aria-label":l("actions.more"),"aria-expanded":a,"aria-haspopup":"menu",class:`
285
+ `,children:[e,t]})}function $x({content:e,visible:t=!1}){const[a,r]=U(!1),[o,s]=U(null),i=F(null),c=F(null);Ia([i,c],()=>r(!1),a),R(()=>{if(!o)return;const f=setTimeout(()=>s(null),m5);return()=>clearTimeout(f)},[o]);const u=Q(async f=>{const p=f==="formatted"?I2(e):e,v=l(f==="formatted"?"actions.copy":"chat.copyMarkdown");try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(p),s(f),r(!1)}catch{V.error(l("status.copyFailed",{label:v}))}},[e]),d=(f,p)=>o===f?n(on,{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?l("actions.copied"):p;return n("div",{class:"relative",children:[n("button",{ref:c,onClick:()=>r(!a),"aria-label":l("actions.more"),"aria-expanded":a,"aria-haspopup":"menu",class:`
286
286
  p-1 rounded
287
287
  text-[var(--color-text-muted)]
288
288
  hover:text-[var(--color-text-secondary)]
@@ -296,16 +296,16 @@ ${t}`:t;return n("div",{children:[n("span",{class:"sr-only",children:[l("toolInp
296
296
  bg-[var(--color-bg-surface)]
297
297
  border border-[var(--color-border)]
298
298
  rounded-lg shadow-lg
299
- `,children:[n(iv,{icon:d("formatted",El),label:h("formatted",l("actions.copy")),onClick:()=>u("formatted")}),n(iv,{icon:d("raw",an),label:h("raw",l("chat.copyMarkdown")),onClick:()=>u("raw")})]})]})}function $f({reason:e,class:t}){const a=e?l("chat.historyTruncatedHintWithReason",{reason:e}):l("chat.historyTruncatedHint");return n("span",{class:`inline-flex items-center gap-1 text-[11px] text-[var(--color-text-muted)] ${t??""}`,title:a,"aria-label":a,children:[n(Dd,{class:"w-3 h-3","aria-hidden":"true"}),n("span",{children:l("chat.historyTruncatedLabel")})]})}function p5({message:e,userName:t="You",userAvatar:a}){const r=X(!1),o=e.status==="queued",s=e.status==="sending",i=e.status==="failed",c=o||s,u=()=>{e.id&&Mk(e.id)};return n("div",{class:"group",onMouseEnter:()=>r.value=!0,onMouseLeave:()=>r.value=!1,children:[n("div",{class:"flex items-center gap-2 mb-1.5",children:[Vh(a)?n("img",{src:a,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:a||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(ve,{class:"w-3 h-3","aria-hidden":"true"}),l("connection.messageQueued")]}):s?n("span",{class:"flex items-center gap-1",children:[n(yc,{size:"sm",colorClass:"bg-current"}),l("connection.messageSending")]}):i?n("span",{class:"flex items-center gap-1 text-[var(--color-error)]",children:[n(Zc,{class:"w-3 h-3","aria-hidden":"true"}),l("connection.messageFailedStatus")]}):ne(e.timestamp)}),n("div",{class:"flex-1"}),!c&&e.content&&n($x,{content:e.content,visible:r.value})]}),n("div",{class:`
299
+ `,children:[n(lv,{icon:d("formatted",El),label:h("formatted",l("actions.copy")),onClick:()=>u("formatted")}),n(lv,{icon:d("raw",Dn),label:h("raw",l("chat.copyMarkdown")),onClick:()=>u("raw")})]})]})}function Lf({reason:e,class:t}){const a=e?l("chat.historyTruncatedHintWithReason",{reason:e}):l("chat.historyTruncatedHint");return n("span",{class:`inline-flex items-center gap-1 text-[11px] text-[var(--color-text-muted)] ${t??""}`,title:a,"aria-label":a,children:[n(Rd,{class:"w-3 h-3","aria-hidden":"true"}),n("span",{children:l("chat.historyTruncatedLabel")})]})}function v5({message:e,userName:t="You",userAvatar:a}){const r=X(!1),o=e.status==="queued",s=e.status==="sending",i=e.status==="failed",c=o||s,u=()=>{e.id&&Ik(e.id)};return n("div",{class:"group",onMouseEnter:()=>r.value=!0,onMouseLeave:()=>r.value=!1,children:[n("div",{class:"flex items-center gap-2 mb-1.5",children:[Kh(a)?n("img",{src:a,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:a||t.charAt(0).toUpperCase()}),n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:t}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:o?n("span",{class:"flex items-center gap-1 text-[var(--color-warning)]",children:[n(ge,{class:"w-3 h-3","aria-hidden":"true"}),l("connection.messageQueued")]}):s?n("span",{class:"flex items-center gap-1",children:[n(bc,{size:"sm",colorClass:"bg-current"}),l("connection.messageSending")]}):i?n("span",{class:"flex items-center gap-1 text-[var(--color-error)]",children:[n(Gc,{class:"w-3 h-3","aria-hidden":"true"}),l("connection.messageFailedStatus")]}):ae(e.timestamp)}),n("div",{class:"flex-1"}),!c&&e.content&&n($x,{content:e.content,visible:r.value})]}),n("div",{class:`
300
300
  rounded-xl px-4 py-3
301
301
  ${i?"bg-[var(--color-error)]/10 border border-[var(--color-error)]/20":c?"bg-[var(--color-bg-secondary)] border border-[var(--color-border)] opacity-80":"bg-[var(--color-accent)]/10 border border-[var(--color-accent)]/20"}
302
- `,children:[e.images&&e.images.length>0&&n(Lx,{images:e.images}),e.content&&n("div",{class:`text-[var(--color-text-primary)] ${e.images?.length?"mt-2":""}`,children:n(Ll,{content:e.content})}),!c&&e.historyTruncated&&n($f,{reason:e.historyTruncationReason,class:"mt-2"}),i&&n("div",{class:"mt-2 pt-2 border-t border-[var(--color-error)]/20",children:n("button",{onClick:u,class:`px-3 py-1.5 rounded-lg text-xs font-medium
302
+ `,children:[e.images&&e.images.length>0&&n(Lx,{images:e.images}),e.content&&n("div",{class:`text-[var(--color-text-primary)] ${e.images?.length?"mt-2":""}`,children:n(Ll,{content:e.content})}),!c&&e.historyTruncated&&n(Lf,{reason:e.historyTruncationReason,class:"mt-2"}),i&&n("div",{class:"mt-2 pt-2 border-t border-[var(--color-error)]/20",children:n("button",{onClick:u,class:`px-3 py-1.5 rounded-lg text-xs font-medium
303
303
  bg-[var(--color-error)]/10 text-[var(--color-error)]
304
304
  hover:bg-[var(--color-error)]/20
305
305
  active:scale-95 transition-all duration-150
306
- flex items-center gap-1.5`,children:[n(Qe,{class:"w-3 h-3","aria-hidden":"true"}),l("actions.retry")]})})]})]})}function m5({content:e}){const[t,a]=U(!1),r=Math.max(1,Math.round(e.length/500)),o=l(r===1?"chat.thinkingBlock.second":"chat.thinkingBlock.second_plural",{count:r});return n("div",{class:"thinking-block border border-[var(--color-border)] rounded-lg overflow-hidden my-2",children:[n("button",{type:"button",onClick:()=>a(!t),"aria-expanded":t,"aria-label":l(t?"chat.thinkingBlock.collapseLabel":"chat.thinkingBlock.expandLabel"),class:"w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--color-text-muted)] hover:bg-[var(--color-bg-hover)] transition-colors",children:[t?n(Ne,{class:"w-4 h-4 flex-shrink-0","aria-hidden":"true"}):n(Ve,{class:"w-4 h-4 flex-shrink-0","aria-hidden":"true"}),n(x4,{class:"w-4 h-4 flex-shrink-0 text-[var(--color-text-muted)]","aria-hidden":"true"}),n("span",{class:"font-medium",children:t?l("common.thinking"):l("chat.thinkingBlock.thoughtFor",{duration:o})})]}),t&&n("div",{class:"px-3 pb-3 border-t border-[var(--color-border)] bg-[var(--color-bg-subtle)]",children:n("div",{class:"pt-3 text-sm text-[var(--color-text-secondary)]",children:n(Ll,{content:e})})})]})}function v5(e){return/^https?:\/\//i.test(e)}function g5(e){return/^data:/i.test(e)}function b5(e){return e.trim().replace(/^[`"'[{(]+/,"").replace(/[`"'\\})\],]+$/,"")}function x5(e){const t=[],a=[],r=e.split(`
307
- `),o=[];for(const s of r){const i=s.trim();if(!i.startsWith("MEDIA:")){o.push(s);continue}const c=i.slice(6).trim(),u=b5(c);if(!u){o.push(s);continue}v5(u)||g5(u)?t.push(u):a.push(u)}return{text:o.join(`
308
- `).trim(),mediaUrls:t,localPaths:a}}function y5(e){return e.map((t,a)=>({url:t,alt:`Image ${a+1}`}))}function w5(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(s=>({id:s.id.slice(-8),name:s.name,insertedAt:s.insertedAtContentLength}))});const a=[...t].sort((s,i)=>{const c=s.insertedAtContentLength??1/0,u=i.insertedAtContentLength??1/0;return c-u}),r=[];let o=0;for(const s of a){const i=s.insertedAtContentLength;if(!(i===void 0||i===1/0)){if(i>o){const c=e.slice(o,i);c.trim()&&(r.push({type:"text",content:c}),M.chat.debug("buildContentBlocks: added text block",{from:o,to:i,textLen:c.length}))}r.push({type:"tool",toolCall:s}),o=i}}if(o<e.length){const s=e.slice(o);M.chat.debug("buildContentBlocks: checking remaining text",{currentPos:o,contentLen:e.length,remainingLen:s.length,remainingTrimmedLen:s.trim().length,remainingPreview:s.slice(0,100)}),s.trim()&&(r.push({type:"text",content:s}),M.chat.debug("buildContentBlocks: added remaining text block"))}for(const s of a)s.insertedAtContentLength===void 0&&r.push({type:"tool",toolCall:s});return M.chat.debug("buildContentBlocks result",{totalBlocks:r.length,blockTypes:r.map(s=>s.type)}),r}function k5({message:e,assistantName:t="Assistant",assistantAvatar:a,isStreaming:r=!1}){const o=X(!1),s=x5(e.content),i=y5(s.mediaUrls),c=[...e.images??[],...i],u=w5(s.text,e.toolCalls??[]),d=u.length>0||r||c.length>0||!!e.thinking;return M.chat.debug("AssistantMessage render",{messageId:e.id,contentLen:e.content.length,toolCallsCount:e.toolCalls?.length??0,blocksCount:u.length,imagesCount:c.length,localPaths:s.localPaths,isStreaming:r}),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:[Vh(a)?n("img",{src:a,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:a||"🤖"}),n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:t}),!r&&e.timestamp&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:ne(e.timestamp)}),!r&&e.historyTruncated&&n($f,{reason:e.historyTruncationReason}),n("div",{class:"flex-1"}),!r&&e.content&&n($x,{content:e.content,visible:o.value})]}),n("div",{class:"space-y-3",children:[e.thinking&&n(m5,{content:e.thinking}),u.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(Ll,{content:h.content,isStreaming:!1})},`text-${f}`):n("div",{children:n(t5,{toolCall:h.toolCall})},h.toolCall.id))),c.length>0&&n(Lx,{images:c}),s.localPaths.length>0&&n("div",{class:"text-xs text-[var(--color-text-muted)] italic",children:s.localPaths.length===1?`📎 File: ${s.localPaths[0]}`:`📎 ${s.localPaths.length} files attached`}),r&&n("span",{class:"ml-1",children:n(yc,{})}),!d&&r&&n("span",{class:"inline-flex items-center gap-2 text-[var(--color-text-muted)]",children:[l("chat.thinking"),n(yc,{})]})]})]})}function S5({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(Al,{class:"w-full h-full","aria-hidden":"true"})}),n("div",{class:"flex-1 text-sm text-[var(--color-text-muted)] italic",children:[e.historyTruncated&&n($f,{reason:e.historyTruncationReason,class:"mb-1"}),n(Ll,{content:e.content})]})]})}function cv({message:e,isStreaming:t=!1,assistantName:a,assistantAvatar:r,userName:o,userAvatar:s}){switch(e.role){case"user":return n(p5,{message:e,userName:o,userAvatar:s});case"assistant":return n(k5,{message:e,isStreaming:t,assistantName:a,assistantAvatar:r});case"system":return n(S5,{message:e});default:return null}}function _5({messages:e}){const[t,a]=U(!1);if(e.length===0)return null;const o=(e[0]?.content??"").replace(/^\s*\[cron\]\s*/i,"");return n("div",{class:"rounded-lg border overflow-hidden bg-[var(--color-text-muted)]/5 border-[var(--color-border)]",children:[n("button",{type:"button",onClick:()=>a(!t),class:"w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors cursor-pointer","aria-expanded":t,children:[n("span",{children:"⏰"}),n("span",{class:"flex-1 text-left",children:l("chat.cronJobCompleted")}),n(Po,{open:t,class:"w-4 h-4"})]}),t&&n("div",{class:"border-t border-[var(--color-border)] px-3 py-2",children:n("div",{class:"text-sm text-[var(--color-text-secondary)] whitespace-pre-wrap max-h-[400px] overflow-y-auto",children:o})})]})}function oi({messages:e,summary:t,active:a}){const[r,o]=U(!1),s=e?.[0],i=t??s?.content,c=!!i&&i.trim().length>0&&i.toLowerCase()!=="compaction",u=s?.timestamp?ne(s.timestamp):void 0,d="flex items-center gap-1.5 px-3 py-1 text-xs tracking-wide uppercase rounded-full border";return a?n("div",{class:"my-4",children:n("div",{class:"flex items-center gap-3 select-none",role:"status",children:[n("div",{class:"flex-1 h-px bg-[var(--color-border)]"}),n("span",{class:`${d} border-[var(--color-border)] text-[var(--color-text-muted)]`,children:[n($b,{class:"w-3 h-3 animate-spin","aria-hidden":"true"}),n("span",{children:l("chat.compacting")})]}),n("div",{class:"flex-1 h-px bg-[var(--color-border)]"})]})}):n("div",{class:"my-4",children:[n("div",{class:"flex items-center gap-3 select-none",role:"separator",children:[n("div",{class:"flex-1 h-px bg-[var(--color-border)]"}),c?n("button",{type:"button",onClick:()=>o(!r),class:`${d} border-[var(--color-border)] text-[var(--color-text-muted)] cursor-pointer hover:text-[var(--color-text-secondary)] hover:border-[var(--color-text-muted)] transition-colors`,"aria-label":l("chat.conversationCompacted"),"aria-expanded":r,title:u,children:[n(Dd,{class:"w-3 h-3","aria-hidden":"true"}),n("span",{children:l("chat.compactionLabel")}),r?n(Tl,{class:"w-3 h-3","aria-hidden":"true"}):n(Ne,{class:"w-3 h-3","aria-hidden":"true"})]}):n("span",{class:`${d} border-[var(--color-border)] text-[var(--color-text-muted)]`,title:u,children:[n(Dd,{class:"w-3 h-3","aria-hidden":"true"}),n("span",{children:l("chat.compactionLabel")})]}),n("div",{class:"flex-1 h-px bg-[var(--color-border)]"})]}),r&&c&&n("div",{class:"mt-2 mx-8 px-3 py-2 text-sm text-[var(--color-text-secondary)] bg-[var(--color-bg-secondary)] rounded-lg border border-[var(--color-border)] whitespace-pre-wrap max-h-[300px] overflow-y-auto",children:i})]})}const C5=["Su","Mo","Tu","We","Th","Fr","Sa"],T5=["January","February","March","April","May","June","July","August","September","October","November","December"];function E5(e,t){return new Date(e,t+1,0).getDate()}function A5(e,t){return new Date(e,t,1).getDay()}function M5(e){return e?e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):""}function uv({value:e,onChange:t,placeholder:a="Select date",class:r="",minDate:o,maxDate:s}){const[i,c]=U(!1),[u,d]=U(()=>e??new Date),[h,f]=U(!1),p=F(null);Ia(p,()=>c(!1),i);const v=()=>{if(p.current){const A=p.current.getBoundingClientRect();f(A.left+280>window.innerWidth)}c(!i)},w=u.getFullYear(),C=u.getMonth(),T=E5(w,C),b=A5(w,C),g=()=>{d(new Date(w,C-1,1))},y=()=>{d(new Date(w,C+1,1))},E=A=>{t(new Date(w,C,A)),c(!1)},x=A=>e?e.getFullYear()===w&&e.getMonth()===C&&e.getDate()===A:!1,S=A=>{const O=new Date;return O.getFullYear()===w&&O.getMonth()===C&&O.getDate()===A},k=A=>{const O=new Date(w,C,A);if(o){const z=new Date(o.getFullYear(),o.getMonth(),o.getDate());if(O<z)return!0}if(s){const z=new Date(s.getFullYear(),s.getMonth(),s.getDate());if(O>z)return!0}return!1},I=[];for(let A=0;A<b;A++)I.push(null);for(let A=1;A<=T;A++)I.push(A);return n("div",{ref:p,class:`relative ${r}`,children:[n("button",{type:"button",onClick:v,class:`
306
+ flex items-center gap-1.5`,children:[n(Xe,{class:"w-3 h-3","aria-hidden":"true"}),l("actions.retry")]})})]})]})}function g5({content:e}){const[t,a]=U(!1),r=Math.max(1,Math.round(e.length/500)),o=l(r===1?"chat.thinkingBlock.second":"chat.thinkingBlock.second_plural",{count:r});return n("div",{class:"thinking-block border border-[var(--color-border)] rounded-lg overflow-hidden my-2",children:[n("button",{type:"button",onClick:()=>a(!t),"aria-expanded":t,"aria-label":l(t?"chat.thinkingBlock.collapseLabel":"chat.thinkingBlock.expandLabel"),class:"w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--color-text-muted)] hover:bg-[var(--color-bg-hover)] transition-colors",children:[t?n(Ne,{class:"w-4 h-4 flex-shrink-0","aria-hidden":"true"}):n(Ve,{class:"w-4 h-4 flex-shrink-0","aria-hidden":"true"}),n(y4,{class:"w-4 h-4 flex-shrink-0 text-[var(--color-text-muted)]","aria-hidden":"true"}),n("span",{class:"font-medium",children:t?l("common.thinking"):l("chat.thinkingBlock.thoughtFor",{duration:o})})]}),t&&n("div",{class:"px-3 pb-3 border-t border-[var(--color-border)] bg-[var(--color-bg-subtle)]",children:n("div",{class:"pt-3 text-sm text-[var(--color-text-secondary)]",children:n(Ll,{content:e})})})]})}function b5(e){return/^https?:\/\//i.test(e)}function x5(e){return/^data:/i.test(e)}function y5(e){return e.trim().replace(/^[`"'[{(]+/,"").replace(/[`"'\\})\],]+$/,"")}function w5(e){const t=[],a=[],r=e.split(`
307
+ `),o=[];for(const s of r){const i=s.trim();if(!i.startsWith("MEDIA:")){o.push(s);continue}const c=i.slice(6).trim(),u=y5(c);if(!u){o.push(s);continue}b5(u)||x5(u)?t.push(u):a.push(u)}return{text:o.join(`
308
+ `).trim(),mediaUrls:t,localPaths:a}}function k5(e){return e.map((t,a)=>({url:t,alt:`Image ${a+1}`}))}function S5(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(s=>({id:s.id.slice(-8),name:s.name,insertedAt:s.insertedAtContentLength}))});const a=[...t].sort((s,i)=>{const c=s.insertedAtContentLength??1/0,u=i.insertedAtContentLength??1/0;return c-u}),r=[];let o=0;for(const s of a){const i=s.insertedAtContentLength;if(!(i===void 0||i===1/0)){if(i>o){const c=e.slice(o,i);c.trim()&&(r.push({type:"text",content:c}),M.chat.debug("buildContentBlocks: added text block",{from:o,to:i,textLen:c.length}))}r.push({type:"tool",toolCall:s}),o=i}}if(o<e.length){const s=e.slice(o);M.chat.debug("buildContentBlocks: checking remaining text",{currentPos:o,contentLen:e.length,remainingLen:s.length,remainingTrimmedLen:s.trim().length,remainingPreview:s.slice(0,100)}),s.trim()&&(r.push({type:"text",content:s}),M.chat.debug("buildContentBlocks: added remaining text block"))}for(const s of a)s.insertedAtContentLength===void 0&&r.push({type:"tool",toolCall:s});return M.chat.debug("buildContentBlocks result",{totalBlocks:r.length,blockTypes:r.map(s=>s.type)}),r}function _5({message:e,assistantName:t="Assistant",assistantAvatar:a,isStreaming:r=!1}){const o=X(!1),s=w5(e.content),i=k5(s.mediaUrls),c=[...e.images??[],...i],u=S5(s.text,e.toolCalls??[]),d=u.length>0||r||c.length>0||!!e.thinking;return M.chat.debug("AssistantMessage render",{messageId:e.id,contentLen:e.content.length,toolCallsCount:e.toolCalls?.length??0,blocksCount:u.length,imagesCount:c.length,localPaths:s.localPaths,isStreaming:r}),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:[Kh(a)?n("img",{src:a,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:a||"🤖"}),n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:t}),!r&&e.timestamp&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:ae(e.timestamp)}),!r&&e.historyTruncated&&n(Lf,{reason:e.historyTruncationReason}),n("div",{class:"flex-1"}),!r&&e.content&&n($x,{content:e.content,visible:o.value})]}),n("div",{class:"space-y-3",children:[e.thinking&&n(g5,{content:e.thinking}),u.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(Ll,{content:h.content,isStreaming:!1})},`text-${f}`):n("div",{children:n(a5,{toolCall:h.toolCall})},h.toolCall.id))),c.length>0&&n(Lx,{images:c}),s.localPaths.length>0&&n("div",{class:"text-xs text-[var(--color-text-muted)] italic",children:s.localPaths.length===1?`📎 File: ${s.localPaths[0]}`:`📎 ${s.localPaths.length} files attached`}),r&&n("span",{class:"ml-1",children:n(bc,{})}),!d&&r&&n("span",{class:"inline-flex items-center gap-2 text-[var(--color-text-muted)]",children:[l("chat.thinking"),n(bc,{})]})]})]})}function C5({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(Al,{class:"w-full h-full","aria-hidden":"true"})}),n("div",{class:"flex-1 text-sm text-[var(--color-text-muted)] italic",children:[e.historyTruncated&&n(Lf,{reason:e.historyTruncationReason,class:"mb-1"}),n(Ll,{content:e.content})]})]})}function iv({message:e,isStreaming:t=!1,assistantName:a,assistantAvatar:r,userName:o,userAvatar:s}){switch(e.role){case"user":return n(v5,{message:e,userName:o,userAvatar:s});case"assistant":return n(_5,{message:e,isStreaming:t,assistantName:a,assistantAvatar:r});case"system":return n(C5,{message:e});default:return null}}function T5({messages:e}){const[t,a]=U(!1);if(e.length===0)return null;const o=(e[0]?.content??"").replace(/^\s*\[cron\]\s*/i,"");return n("div",{class:"rounded-lg border overflow-hidden bg-[var(--color-text-muted)]/5 border-[var(--color-border)]",children:[n("button",{type:"button",onClick:()=>a(!t),class:"w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors cursor-pointer","aria-expanded":t,children:[n("span",{children:"⏰"}),n("span",{class:"flex-1 text-left",children:l("chat.cronJobCompleted")}),n(Po,{open:t,class:"w-4 h-4"})]}),t&&n("div",{class:"border-t border-[var(--color-border)] px-3 py-2",children:n("div",{class:"text-sm text-[var(--color-text-secondary)] whitespace-pre-wrap max-h-[400px] overflow-y-auto",children:o})})]})}function oi({messages:e,summary:t,active:a}){const[r,o]=U(!1),s=e?.[0],i=t??s?.content,c=!!i&&i.trim().length>0&&i.toLowerCase()!=="compaction",u=s?.timestamp?ae(s.timestamp):void 0,d="flex items-center gap-1.5 px-3 py-1 text-xs tracking-wide uppercase rounded-full border";return a?n("div",{class:"my-4",children:n("div",{class:"flex items-center gap-3 select-none",role:"status",children:[n("div",{class:"flex-1 h-px bg-[var(--color-border)]"}),n("span",{class:`${d} border-[var(--color-border)] text-[var(--color-text-muted)]`,children:[n($b,{class:"w-3 h-3 animate-spin","aria-hidden":"true"}),n("span",{children:l("chat.compacting")})]}),n("div",{class:"flex-1 h-px bg-[var(--color-border)]"})]})}):n("div",{class:"my-4",children:[n("div",{class:"flex items-center gap-3 select-none",role:"separator",children:[n("div",{class:"flex-1 h-px bg-[var(--color-border)]"}),c?n("button",{type:"button",onClick:()=>o(!r),class:`${d} border-[var(--color-border)] text-[var(--color-text-muted)] cursor-pointer hover:text-[var(--color-text-secondary)] hover:border-[var(--color-text-muted)] transition-colors`,"aria-label":l("chat.conversationCompacted"),"aria-expanded":r,title:u,children:[n(Rd,{class:"w-3 h-3","aria-hidden":"true"}),n("span",{children:l("chat.compactionLabel")}),r?n(Tl,{class:"w-3 h-3","aria-hidden":"true"}):n(Ne,{class:"w-3 h-3","aria-hidden":"true"})]}):n("span",{class:`${d} border-[var(--color-border)] text-[var(--color-text-muted)]`,title:u,children:[n(Rd,{class:"w-3 h-3","aria-hidden":"true"}),n("span",{children:l("chat.compactionLabel")})]}),n("div",{class:"flex-1 h-px bg-[var(--color-border)]"})]}),r&&c&&n("div",{class:"mt-2 mx-8 px-3 py-2 text-sm text-[var(--color-text-secondary)] bg-[var(--color-bg-secondary)] rounded-lg border border-[var(--color-border)] whitespace-pre-wrap max-h-[300px] overflow-y-auto",children:i})]})}const E5=["Su","Mo","Tu","We","Th","Fr","Sa"],A5=["January","February","March","April","May","June","July","August","September","October","November","December"];function M5(e,t){return new Date(e,t+1,0).getDate()}function I5(e,t){return new Date(e,t,1).getDay()}function R5(e){return e?e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):""}function cv({value:e,onChange:t,placeholder:a="Select date",class:r="",minDate:o,maxDate:s}){const[i,c]=U(!1),[u,d]=U(()=>e??new Date),[h,f]=U(!1),p=F(null);Ia(p,()=>c(!1),i);const v=()=>{if(p.current){const A=p.current.getBoundingClientRect();f(A.left+280>window.innerWidth)}c(!i)},w=u.getFullYear(),C=u.getMonth(),T=M5(w,C),b=I5(w,C),g=()=>{d(new Date(w,C-1,1))},y=()=>{d(new Date(w,C+1,1))},E=A=>{t(new Date(w,C,A)),c(!1)},x=A=>e?e.getFullYear()===w&&e.getMonth()===C&&e.getDate()===A:!1,S=A=>{const O=new Date;return O.getFullYear()===w&&O.getMonth()===C&&O.getDate()===A},k=A=>{const O=new Date(w,C,A);if(o){const z=new Date(o.getFullYear(),o.getMonth(),o.getDate());if(O<z)return!0}if(s){const z=new Date(s.getFullYear(),s.getMonth(),s.getDate());if(O>z)return!0}return!1},I=[];for(let A=0;A<b;A++)I.push(null);for(let A=1;A<=T;A++)I.push(A);return n("div",{ref:p,class:`relative ${r}`,children:[n("button",{type:"button",onClick:v,class:`
309
309
  flex items-center justify-between gap-2 w-full
310
310
  px-2.5 py-1.5 text-sm rounded-lg
311
311
  bg-[var(--color-bg-primary)]
@@ -313,24 +313,24 @@ ${t}`:t;return n("div",{children:[n("span",{class:"sr-only",children:[l("toolInp
313
313
  ${i?"border-[var(--color-accent)]/50":""}
314
314
  hover:border-[var(--color-border-hover)]
315
315
  transition-colors text-left
316
- `,children:[n("span",{class:e?"text-[var(--color-text-primary)]":"text-[var(--color-text-muted)]",children:e?M5(e):a}),n(Po,{open:i,class:"w-3.5 h-3.5 text-[var(--color-text-muted)]"})]}),i&&n("div",{class:`absolute top-full mt-1 z-50 p-3 rounded-lg shadow-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] min-w-[260px] ${h?"right-0":"left-0"}`,children:[n("div",{class:"flex items-center justify-between mb-3",children:[n("button",{type:"button",onClick:g,class:"p-1.5 rounded-md hover:bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] transition-colors",children:n("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2",children:n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 19l-7-7 7-7"})})}),n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:[T5[C]," ",w]}),n("button",{type:"button",onClick:y,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:C5.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:I.map((A,O)=>{const z=A!==null&&k(A);return n("div",{class:"aspect-square",children:A!==null&&n("button",{type:"button",onClick:()=>!z&&E(A),disabled:z,class:`
316
+ `,children:[n("span",{class:e?"text-[var(--color-text-primary)]":"text-[var(--color-text-muted)]",children:e?R5(e):a}),n(Po,{open:i,class:"w-3.5 h-3.5 text-[var(--color-text-muted)]"})]}),i&&n("div",{class:`absolute top-full mt-1 z-50 p-3 rounded-lg shadow-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] min-w-[260px] ${h?"right-0":"left-0"}`,children:[n("div",{class:"flex items-center justify-between mb-3",children:[n("button",{type:"button",onClick:g,class:"p-1.5 rounded-md hover:bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] transition-colors",children:n("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2",children:n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 19l-7-7 7-7"})})}),n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:[A5[C]," ",w]}),n("button",{type:"button",onClick:y,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:E5.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:I.map((A,O)=>{const z=A!==null&&k(A);return n("div",{class:"aspect-square",children:A!==null&&n("button",{type:"button",onClick:()=>!z&&E(A),disabled:z,class:`
317
317
  w-full h-full flex items-center justify-center
318
318
  text-sm rounded-md transition-colors
319
319
  ${z?"text-[var(--color-text-muted)]/40 cursor-not-allowed":x(A)?"bg-[var(--color-accent)] text-[var(--color-accent-text)] font-medium":S(A)?"bg-[var(--color-accent)]/10 text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)] hover:bg-[var(--color-bg-secondary)]"}
320
- `,children:A})},O)})}),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 I5(){const e=F(null),t=mt.value,a=Q(()=>{mt.value=!1,Tn.value="",Q2()},[]);R(()=>{mt.value&&e.current&&e.current.focus()},[mt.value]),R(()=>{const i=c=>{(c.metaKey||c.ctrlKey)&&c.key==="f"&&(c.preventDefault(),mt.value=!0),c.key==="Escape"&&mt.value&&a()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[a]);const r=ek.value,s=Gh(Tn.value)||sb.value;return n(H,{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(q,{icon:n(yf,{}),label:l("chat.search"),onClick:()=>mt.value=!0,variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"}),n(Gb,{}),n("div",{"data-tour":"canvas",class:Xe.value?void 0:"hidden",children:n(q,{icon:n(Yb,{}),label:l("common.canvas"),onClick:()=>Js.value=!Js.value,variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"})})]}),n("div",{class:`absolute top-0 left-0 right-0 z-10 flex items-center gap-3 px-3 py-2 bg-[var(--color-bg-surface)] border-b border-[var(--color-border)] transition-opacity ${t?"opacity-100":"opacity-0 pointer-events-none"}`,children:[n(q,{icon:n(Ar,{}),label:l("actions.close"),onClick:a,variant:"ghost",size:"sm",tabIndex:t?0:-1}),n("div",{class:"flex-1 flex items-center gap-2 min-w-[120px]",children:[n("div",{class:"flex-1",children:n(Y,{ref:e,type:"text",value:Tn.value,onInput:i=>Tn.value=i.target.value,placeholder:l("chat.searchPlaceholder"),size:"sm",fullWidth:!0,class:"text-sm",tabIndex:t?0:-1})}),s&&n("span",{class:"text-xs text-[var(--color-text-muted)] whitespace-nowrap",children:[r," ",l(r===1?"chat.match":"chat.matches")]})]}),n("div",{class:"hidden sm:flex items-center gap-1.5 flex-shrink-0",children:[n(uv,{value:Gr.value,onChange:i=>Gr.value=i,placeholder:l("chat.dateFrom"),class:"w-[130px]",maxDate:Jr.value}),n("span",{class:"text-[var(--color-text-muted)] text-sm",children:"–"}),n(uv,{value:Jr.value,onChange:i=>Jr.value=i,placeholder:l("chat.dateTo"),class:"w-[130px]",minDate:Gr.value})]})]})]})}function R5(e){const t=[],a=new Set;for(let r=0;r<e.length;r++)if(e[r].kind==="compaction")for(let o=Math.max(0,r-2);o<=Math.min(e.length-1,r+2);o++)a.add(o);for(let r=0;r<e.length;r++){const o=e[r];if(!Xg(o)&&!C2(o))if(o.kind==="compaction")t.push({type:"compaction",messages:[o]});else if(A2(o)){if(a.has(r))continue;t.push({type:"compaction",messages:[o]})}else S2(o)?t.push({type:"cron",message:o}):t.push({type:"message",message:o})}return t}const dv=["bg-[var(--color-bg-hover)]","rounded-lg","transition-colors"],L5="cursor-pointer hover:bg-[var(--color-bg-hover)] rounded-lg transition-colors";function $5({messages:e,isLoading:t=!1,error:a=null,streamingContent:r="",streamingToolCalls:o=[],isStreaming:s=!1,assistantName:i,assistantAvatar:c,userName:u,userAvatar:d,queuedCount:h=0}){M.chat.debug("MessageList render",{messagesCount:e.length,streamingContentLen:r.length,streamingToolCallsCount:o.length,isStreaming:s,queuedCount:h});const f=F(null),p=F(null),v=X(!1),w=F(!0),C=Q((S=!0)=>{requestAnimationFrame(()=>{f.current&&f.current.scrollTo({top:f.current.scrollHeight,behavior:S?"smooth":"auto"})})},[]),T=Q(()=>{if(!f.current)return;const{scrollTop:S,scrollHeight:k,clientHeight:I}=f.current,A=k-S-I;v.value=A>100,w.current=A<50},[]),b=o.filter(S=>S.status==="complete"||S.status==="error").length,g=F(null);R(()=>{const S=e[e.length-1],k=S?.role==="user"&&S.id!==g.current;(k||h>0||w.current)&&(k&&(w.current=!0),C(!1)),g.current=S?.id??null},[e.length,r.length,o.length,b,h,C]),R(()=>{C(!1)},[C]),R(()=>{if(!f.current)return;const S=()=>{w.current&&C(!1)},k=f.current;return k.addEventListener("load",S,!0),()=>k.removeEventListener("load",S,!0)},[C]),R(()=>{const S=Xl.value;if(!S||!f.current)return;const k=f.current.querySelector(`[data-message-id="${S}"]`);k&&(k.scrollIntoView({behavior:"smooth",block:"center"}),k.classList.add(...dv),setTimeout(()=>{k.classList.remove(...dv)},2e3)),Xl.value=null},[Xl.value]);const y=s?{id:"streaming",role:"assistant",content:r,toolCalls:o.length>0?o:void 0,timestamp:Date.now(),isStreaming:!0}:null,E=xe(()=>R5(e),[e]),x=xe(()=>{const S=ac.value;if(S<0||!Va.value)return-1;for(let k=0;k<E.length;k++){const I=E[k],A=I.type==="message"||I.type==="cron"?I.message:I.type==="compaction"&&I.messages.length>0?I.messages[0]:null;if(A&&e.indexOf(A)>=S)return k}return E.length},[E,ac.value,Va.value]);return n("div",{class:"relative flex-1 flex flex-col overflow-hidden",children:[n("div",{class:"relative h-0 overflow-visible z-10",children:n(I5,{})}),n("div",{ref:f,onScroll:T,class:"flex-1 overflow-y-auto",role:"list","aria-label":"Messages",children:n("div",{class:"max-w-5xl mx-auto px-6 py-6 min-h-full flex flex-col",children:[t&&n("div",{class:"flex justify-center py-8",children:n(te,{size:"md",label:l("common.loading")})}),a&&n("div",{class:"flex justify-center py-8",children:n("div",{class:"text-[var(--color-error)] text-center",children:n("p",{children:a})})}),!t&&!a&&e.length===0&&!s&&n("div",{class:"flex-1 flex items-center justify-center py-16",children:n("div",{class:"text-center max-w-md",children:[Vh(c)?n("img",{src:c,alt:i||l("common.assistant"),class:"w-20 h-20 rounded-2xl mx-auto mb-4 opacity-90"}):c?n("div",{class:"text-6xl mx-auto mb-4",role:"img","aria-label":i||l("common.assistant"),children:c}):n(au,{size:"lg",class:"mx-auto mb-4 opacity-80"}),n("h3",{class:"text-xl font-medium mb-2",children:i?l("chat.emptyState.titleWithName",{name:i}):l("chat.emptyState.title")}),n("p",{class:"text-[var(--color-text-muted)] mb-6",children:l("chat.emptyState.description")}),n("div",{class:"text-sm text-[var(--color-text-muted)]",children:[n("p",{class:"mb-2",children:l("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:l("common.search")})]}),n("span",{class:"flex items-center gap-1",children:[n("kbd",{class:"px-1.5 py-0.5 rounded bg-[var(--color-bg-tertiary)] font-mono",children:"/new"}),n("span",{class:"ml-1",children:l("chat.emptyState.newSession")})]})]})]})]})}),n("div",{class:"space-y-6",children:[E.map((S,k)=>{const I=!fa.value&&Va.value&&x===k,A=[];if(I&&A.push(n(oi,{summary:nc.value},"compaction-ephemeral")),S.type==="compaction")A.push(n(oi,{messages:S.messages},`compaction-${k}`));else if(S.type==="cron")A.push(n(_5,{messages:[S.message]},`cron-${k}`));else{const O=S.message,z=mt.value,se=()=>{Xl.value=O.id,Tn.value="",mt.value=!1};A.push(n("div",{"data-message-id":O.id,...z&&{onClick:se,onKeyDown:Fe=>{Fe.key==="Enter"&&se()},role:"button",tabIndex:0},class:`-mx-2 px-2 py-1 rounded-lg ${z?L5:""}`,children:n(cv,{message:O,assistantName:i,assistantAvatar:c,userName:u,userAvatar:d})},O.id))}return A}),!fa.value&&Va.value&&x>=E.length&&n(oi,{summary:nc.value}),fa.value&&n(oi,{active:!0}),y&&n(cv,{message:y,isStreaming:!0,assistantName:i,assistantAvatar:c})]}),n("div",{ref:p,class:"h-1"})]})}),v.value&&n("div",{class:"absolute bottom-4 right-4",children:n(q,{icon:n(wS,{}),label:l("chat.scrollToBottom"),onClick:()=>{w.current=!0,C(!0)},variant:"default",size:"md",class:"shadow-lg bg-[var(--color-bg-surface)] border border-[var(--color-border)]"})})]})}const D5=["image/png","image/jpeg","image/gif","image/webp"],hv=10*1024*1024,qd=3.5*1024*1024,si=2e3;function Df(e){return D5.includes(e)}let P5=0;function fv(){return`attachment_${Date.now()}_${++P5}`}async function Dx(e){return new Promise((t,a)=>{const r=new Image,o=document.createElement("canvas"),s=o.getContext("2d");if(!s){a(new Error("Canvas not supported"));return}r.onload=()=>{let{width:i,height:c}=r;if(i>si||c>si){const w=Math.min(si/i,si/c);i=Math.round(i*w),c=Math.round(c*w)}o.width=i,o.height=c,s.drawImage(r,0,0,i,c);const u=e.type==="image/png"?"image/png":"image/jpeg";let d=.9,h=o.toDataURL(u,d);if(u==="image/jpeg")for(;h.length>qd&&d>.1;)d-=.1,h=o.toDataURL(u,d);let f=1;for(;h.length>qd&&f>.2;)f-=.1,o.width=Math.round(i*f),o.height=Math.round(c*f),s.drawImage(r,0,0,o.width,o.height),h=o.toDataURL(u,u==="image/jpeg"?.8:void 0);const p=h.split(",")[1]||"",v=Math.round(p.length*3/4);URL.revokeObjectURL(r.src),t({content:h,size:v})},r.onerror=()=>{URL.revokeObjectURL(r.src),a(new Error("Failed to load image"))},r.src=URL.createObjectURL(e)})}async function pv(e){if(Df(e.type)){const{content:a,size:r}=await Dx(e);return{id:fv(),type:"image",mimeType:e.type==="image/png"?"image/png":"image/jpeg",fileName:e.name,content:a,size:r,previewUrl:a}}return new Promise((a,r)=>{const o=new FileReader;o.onload=()=>{const s=o.result;a({id:fv(),type:"file",mimeType:e.type||"application/octet-stream",fileName:e.name,content:s,size:e.size})},o.onerror=()=>r(new Error("Failed to read file")),o.readAsDataURL(e)})}function O5(){const e=X([]),t=X(!1),a=X(null);R(()=>()=>{for(const d of e.value)d.previewUrl&&URL.revokeObjectURL(d.previewUrl)},[]);const r=Q(async d=>{const h=Array.from(d);a.value=null,t.value=!0;try{for(const f of h){if(f.size>hv){a.value=`File "${f.name}" is too large (max 10MB)`;continue}if(!Df(f.type)&&f.size>qd){a.value=`File "${f.name}" is too large (max 400KB for non-images)`;continue}try{const p=await pv(f);e.value=[...e.value,p]}catch{a.value=`Failed to read "${f.name}"`}}}finally{t.value=!1}},[]),o=Q(d=>{const h=e.value.find(f=>f.id===d);h?.previewUrl&&URL.revokeObjectURL(h.previewUrl),e.value=e.value.filter(f=>f.id!==d)},[]),s=Q(()=>{for(const d of e.value)d.previewUrl&&URL.revokeObjectURL(d.previewUrl);e.value=[]},[]),i=Q(()=>e.value.map(d=>({type:d.type,mimeType:d.mimeType,fileName:d.fileName,content:d.content})),[]),c=Q(async d=>{const h=d.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;d.preventDefault(),a.value=null,t.value=!0;try{for(const p of f){const v=p.getAsFile();if(v){if(v.size>hv){a.value="Pasted image is too large (max 10MB)";continue}try{const w=await pv(v);e.value=[...e.value,w]}catch{a.value="Failed to read pasted image"}}}}finally{t.value=!1}return!0},[]),u=Q(()=>{a.value=null},[]);return{attachments:e.value,addFiles:r,removeAttachment:o,clearAttachments:s,getPayloads:i,handlePaste:c,isProcessing:t.value,error:a.value,clearError:u}}function N5(e){if(!e)return null;const t=e.indexOf("/");return t===-1?null:e.substring(0,t)}function F5(e){if(!e)return null;const t=N5(e);return t||(ka.value.find(r=>r.id===e)?.provider??null)}function z5({sessionKey:e,currentModel:t,onModelChange:a}){const[r,o]=U(!1),[s,i]=U(!1),[c,u]=U(()=>$1()),d=F(null);if(Ia(d,()=>o(!1),r),ka.value.length===0)return null;const h=t??yb.value??ka.value[0]?.id,f=F5(h),p=f?Xk.value.get(f)??[]:[],v=xe(()=>[...p.filter((g,y,E)=>E.findIndex(x=>x.id===g.id)===y)].sort((g,y)=>{if(g.id===h)return-1;if(y.id===h)return 1;const E=c.has(g.id),x=c.has(y.id);return E&&!x?-1:!E&&x?1:g.name.localeCompare(y.name)}),[p,h,c]);if(v.length===0)return null;const w=t?e4(t):l("common.default"),C=(b,g)=>{g.preventDefault(),g.stopPropagation();const y=new Set(c);y.has(b)?y.delete(b):y.add(b),u(y),D1(y)},T=async b=>{if(b===t){o(!1);return}i(!0);try{await N("sessions.patch",{key:e,model:b}),a?.(b),M.ui.debug("Model changed to:",b)}catch(g){M.ui.error("Failed to change model:",g)}finally{i(!1),o(!1)}};return n("div",{ref:d,class:"relative",children:[n("button",{type:"button",onClick:()=>o(!r),disabled:s,class:`flex items-center gap-1 px-2 py-1 rounded-lg text-xs
320
+ `,children:A})},O)})}),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 L5(){const e=F(null),t=mt.value,a=Q(()=>{mt.value=!1,Tn.value="",ek()},[]);R(()=>{mt.value&&e.current&&e.current.focus()},[mt.value]),R(()=>{const i=c=>{(c.metaKey||c.ctrlKey)&&c.key==="f"&&(c.preventDefault(),mt.value=!0),c.key==="Escape"&&mt.value&&a()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[a]);const r=tk.value,s=qh(Tn.value)||sb.value;return n(H,{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(q,{icon:n(bf,{}),label:l("chat.search"),onClick:()=>mt.value=!0,variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"}),n(Gb,{}),n("div",{"data-tour":"canvas",class:Ze.value?void 0:"hidden",children:n(q,{icon:n(Yb,{}),label:l("common.canvas"),onClick:()=>Ys.value=!Ys.value,variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"})})]}),n("div",{class:`absolute top-0 left-0 right-0 z-10 flex items-center gap-3 px-3 py-2 bg-[var(--color-bg-surface)] border-b border-[var(--color-border)] transition-opacity ${t?"opacity-100":"opacity-0 pointer-events-none"}`,children:[n(q,{icon:n(Ar,{}),label:l("actions.close"),onClick:a,variant:"ghost",size:"sm",tabIndex:t?0:-1}),n("div",{class:"flex-1 flex items-center gap-2 min-w-[120px]",children:[n("div",{class:"flex-1",children:n(Y,{ref:e,type:"text",value:Tn.value,onInput:i=>Tn.value=i.target.value,placeholder:l("chat.searchPlaceholder"),size:"sm",fullWidth:!0,class:"text-sm",tabIndex:t?0:-1})}),s&&n("span",{class:"text-xs text-[var(--color-text-muted)] whitespace-nowrap",children:[r," ",l(r===1?"chat.match":"chat.matches")]})]}),n("div",{class:"hidden sm:flex items-center gap-1.5 flex-shrink-0",children:[n(cv,{value:Gr.value,onChange:i=>Gr.value=i,placeholder:l("chat.dateFrom"),class:"w-[130px]",maxDate:Jr.value}),n("span",{class:"text-[var(--color-text-muted)] text-sm",children:"–"}),n(cv,{value:Jr.value,onChange:i=>Jr.value=i,placeholder:l("chat.dateTo"),class:"w-[130px]",minDate:Gr.value})]})]})]})}function $5(e){const t=[],a=new Set;for(let r=0;r<e.length;r++)if(e[r].kind==="compaction")for(let o=Math.max(0,r-2);o<=Math.min(e.length-1,r+2);o++)a.add(o);for(let r=0;r<e.length;r++){const o=e[r];if(!Xg(o)&&!T2(o))if(o.kind==="compaction")t.push({type:"compaction",messages:[o]});else if(M2(o)){if(a.has(r))continue;t.push({type:"compaction",messages:[o]})}else _2(o)?t.push({type:"cron",message:o}):t.push({type:"message",message:o})}return t}const uv=["bg-[var(--color-bg-hover)]","rounded-lg","transition-colors"],D5="cursor-pointer hover:bg-[var(--color-bg-hover)] rounded-lg transition-colors";function P5({messages:e,isLoading:t=!1,error:a=null,streamingContent:r="",streamingToolCalls:o=[],isStreaming:s=!1,assistantName:i,assistantAvatar:c,userName:u,userAvatar:d,queuedCount:h=0}){M.chat.debug("MessageList render",{messagesCount:e.length,streamingContentLen:r.length,streamingToolCallsCount:o.length,isStreaming:s,queuedCount:h});const f=F(null),p=F(null),v=X(!1),w=F(!0),C=Q((S=!0)=>{requestAnimationFrame(()=>{f.current&&f.current.scrollTo({top:f.current.scrollHeight,behavior:S?"smooth":"auto"})})},[]),T=Q(()=>{if(!f.current)return;const{scrollTop:S,scrollHeight:k,clientHeight:I}=f.current,A=k-S-I;v.value=A>100,w.current=A<50},[]),b=o.filter(S=>S.status==="complete"||S.status==="error").length,g=F(null);R(()=>{const S=e[e.length-1],k=S?.role==="user"&&S.id!==g.current;(k||h>0||w.current)&&(k&&(w.current=!0),C(!1)),g.current=S?.id??null},[e.length,r.length,o.length,b,h,C]),R(()=>{C(!1)},[C]),R(()=>{if(!f.current)return;const S=()=>{w.current&&C(!1)},k=f.current;return k.addEventListener("load",S,!0),()=>k.removeEventListener("load",S,!0)},[C]),R(()=>{const S=Xl.value;if(!S||!f.current)return;const k=f.current.querySelector(`[data-message-id="${S}"]`);k&&(k.scrollIntoView({behavior:"smooth",block:"center"}),k.classList.add(...uv),setTimeout(()=>{k.classList.remove(...uv)},2e3)),Xl.value=null},[Xl.value]);const y=s?{id:"streaming",role:"assistant",content:r,toolCalls:o.length>0?o:void 0,timestamp:Date.now(),isStreaming:!0}:null,E=ye(()=>$5(e),[e]),x=ye(()=>{const S=tc.value;if(S<0||!Va.value)return-1;for(let k=0;k<E.length;k++){const I=E[k],A=I.type==="message"||I.type==="cron"?I.message:I.type==="compaction"&&I.messages.length>0?I.messages[0]:null;if(A&&e.indexOf(A)>=S)return k}return E.length},[E,tc.value,Va.value]);return n("div",{class:"relative flex-1 flex flex-col overflow-hidden",children:[n("div",{class:"relative h-0 overflow-visible z-10",children:n(L5,{})}),n("div",{ref:f,onScroll:T,class:"flex-1 overflow-y-auto",role:"list","aria-label":"Messages",children:n("div",{class:"max-w-5xl mx-auto px-6 py-6 min-h-full flex flex-col",children:[t&&n("div",{class:"flex justify-center py-8",children:n(te,{size:"md",label:l("common.loading")})}),a&&n("div",{class:"flex justify-center py-8",children:n("div",{class:"text-[var(--color-error)] text-center",children:n("p",{children:a})})}),!t&&!a&&e.length===0&&!s&&n("div",{class:"flex-1 flex items-center justify-center py-16",children:n("div",{class:"text-center max-w-md",children:[Kh(c)?n("img",{src:c,alt:i||l("common.assistant"),class:"w-20 h-20 rounded-2xl mx-auto mb-4 opacity-90"}):c?n("div",{class:"text-6xl mx-auto mb-4",role:"img","aria-label":i||l("common.assistant"),children:c}):n(eu,{size:"lg",class:"mx-auto mb-4 opacity-80"}),n("h3",{class:"text-xl font-medium mb-2",children:i?l("chat.emptyState.titleWithName",{name:i}):l("chat.emptyState.title")}),n("p",{class:"text-[var(--color-text-muted)] mb-6",children:l("chat.emptyState.description")}),n("div",{class:"text-sm text-[var(--color-text-muted)]",children:[n("p",{class:"mb-2",children:l("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:l("common.search")})]}),n("span",{class:"flex items-center gap-1",children:[n("kbd",{class:"px-1.5 py-0.5 rounded bg-[var(--color-bg-tertiary)] font-mono",children:"/new"}),n("span",{class:"ml-1",children:l("chat.emptyState.newSession")})]})]})]})]})}),n("div",{class:"space-y-6",children:[E.map((S,k)=>{const I=!fa.value&&Va.value&&x===k,A=[];if(I&&A.push(n(oi,{summary:ec.value},"compaction-ephemeral")),S.type==="compaction")A.push(n(oi,{messages:S.messages},`compaction-${k}`));else if(S.type==="cron")A.push(n(T5,{messages:[S.message]},`cron-${k}`));else{const O=S.message,z=mt.value,se=()=>{Xl.value=O.id,Tn.value="",mt.value=!1};A.push(n("div",{"data-message-id":O.id,...z&&{onClick:se,onKeyDown:Fe=>{Fe.key==="Enter"&&se()},role:"button",tabIndex:0},class:`-mx-2 px-2 py-1 rounded-lg ${z?D5:""}`,children:n(iv,{message:O,assistantName:i,assistantAvatar:c,userName:u,userAvatar:d})},O.id))}return A}),!fa.value&&Va.value&&x>=E.length&&n(oi,{summary:ec.value}),fa.value&&n(oi,{active:!0}),y&&n(iv,{message:y,isStreaming:!0,assistantName:i,assistantAvatar:c})]}),n("div",{ref:p,class:"h-1"})]})}),v.value&&n("div",{class:"absolute bottom-4 right-4",children:n(q,{icon:n(kS,{}),label:l("chat.scrollToBottom"),onClick:()=>{w.current=!0,C(!0)},variant:"default",size:"md",class:"shadow-lg bg-[var(--color-bg-surface)] border border-[var(--color-border)]"})})]})}const O5=["image/png","image/jpeg","image/gif","image/webp"],dv=10*1024*1024,Bd=3.5*1024*1024,si=2e3;function $f(e){return O5.includes(e)}let N5=0;function hv(){return`attachment_${Date.now()}_${++N5}`}async function Dx(e){return new Promise((t,a)=>{const r=new Image,o=document.createElement("canvas"),s=o.getContext("2d");if(!s){a(new Error("Canvas not supported"));return}r.onload=()=>{let{width:i,height:c}=r;if(i>si||c>si){const w=Math.min(si/i,si/c);i=Math.round(i*w),c=Math.round(c*w)}o.width=i,o.height=c,s.drawImage(r,0,0,i,c);const u=e.type==="image/png"?"image/png":"image/jpeg";let d=.9,h=o.toDataURL(u,d);if(u==="image/jpeg")for(;h.length>Bd&&d>.1;)d-=.1,h=o.toDataURL(u,d);let f=1;for(;h.length>Bd&&f>.2;)f-=.1,o.width=Math.round(i*f),o.height=Math.round(c*f),s.drawImage(r,0,0,o.width,o.height),h=o.toDataURL(u,u==="image/jpeg"?.8:void 0);const p=h.split(",")[1]||"",v=Math.round(p.length*3/4);URL.revokeObjectURL(r.src),t({content:h,size:v})},r.onerror=()=>{URL.revokeObjectURL(r.src),a(new Error("Failed to load image"))},r.src=URL.createObjectURL(e)})}async function fv(e){if($f(e.type)){const{content:a,size:r}=await Dx(e);return{id:hv(),type:"image",mimeType:e.type==="image/png"?"image/png":"image/jpeg",fileName:e.name,content:a,size:r,previewUrl:a}}return new Promise((a,r)=>{const o=new FileReader;o.onload=()=>{const s=o.result;a({id:hv(),type:"file",mimeType:e.type||"application/octet-stream",fileName:e.name,content:s,size:e.size})},o.onerror=()=>r(new Error("Failed to read file")),o.readAsDataURL(e)})}function F5(){const e=X([]),t=X(!1),a=X(null);R(()=>()=>{for(const d of e.value)d.previewUrl&&URL.revokeObjectURL(d.previewUrl)},[]);const r=Q(async d=>{const h=Array.from(d);a.value=null,t.value=!0;try{for(const f of h){if(f.size>dv){a.value=`File "${f.name}" is too large (max 10MB)`;continue}if(!$f(f.type)&&f.size>Bd){a.value=`File "${f.name}" is too large (max 400KB for non-images)`;continue}try{const p=await fv(f);e.value=[...e.value,p]}catch{a.value=`Failed to read "${f.name}"`}}}finally{t.value=!1}},[]),o=Q(d=>{const h=e.value.find(f=>f.id===d);h?.previewUrl&&URL.revokeObjectURL(h.previewUrl),e.value=e.value.filter(f=>f.id!==d)},[]),s=Q(()=>{for(const d of e.value)d.previewUrl&&URL.revokeObjectURL(d.previewUrl);e.value=[]},[]),i=Q(()=>e.value.map(d=>({type:d.type,mimeType:d.mimeType,fileName:d.fileName,content:d.content})),[]),c=Q(async d=>{const h=d.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;d.preventDefault(),a.value=null,t.value=!0;try{for(const p of f){const v=p.getAsFile();if(v){if(v.size>dv){a.value="Pasted image is too large (max 10MB)";continue}try{const w=await fv(v);e.value=[...e.value,w]}catch{a.value="Failed to read pasted image"}}}}finally{t.value=!1}return!0},[]),u=Q(()=>{a.value=null},[]);return{attachments:e.value,addFiles:r,removeAttachment:o,clearAttachments:s,getPayloads:i,handlePaste:c,isProcessing:t.value,error:a.value,clearError:u}}function z5(e){if(!e)return null;const t=e.indexOf("/");return t===-1?null:e.substring(0,t)}function U5(e){if(!e)return null;const t=z5(e);return t||(ka.value.find(r=>r.id===e)?.provider??null)}function j5({sessionKey:e,currentModel:t,onModelChange:a}){const[r,o]=U(!1),[s,i]=U(!1),[c,u]=U(()=>D1()),d=F(null);if(Ia(d,()=>o(!1),r),ka.value.length===0)return null;const h=t??yb.value??ka.value[0]?.id,f=U5(h),p=f?Qk.value.get(f)??[]:[],v=ye(()=>[...p.filter((g,y,E)=>E.findIndex(x=>x.id===g.id)===y)].sort((g,y)=>{if(g.id===h)return-1;if(y.id===h)return 1;const E=c.has(g.id),x=c.has(y.id);return E&&!x?-1:!E&&x?1:g.name.localeCompare(y.name)}),[p,h,c]);if(v.length===0)return null;const w=t?t4(t):l("common.default"),C=(b,g)=>{g.preventDefault(),g.stopPropagation();const y=new Set(c);y.has(b)?y.delete(b):y.add(b),u(y),P1(y)},T=async b=>{if(b===t){o(!1);return}i(!0);try{await N("sessions.patch",{key:e,model:b}),a?.(b),M.ui.debug("Model changed to:",b)}catch(g){M.ui.error("Failed to change model:",g)}finally{i(!1),o(!1)}};return n("div",{ref:d,class:"relative",children:[n("button",{type:"button",onClick:()=>o(!r),disabled:s,class:`flex items-center gap-1 px-2 py-1 rounded-lg text-xs
321
321
  text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]
322
322
  hover:bg-[var(--color-bg-secondary)] transition-colors
323
- disabled:opacity-50`,children:[n("span",{class:"max-w-[120px] truncate",children:w}),n(Po,{class:"w-3 h-3",open:r})]}),r&&n("div",{class:"absolute bottom-full left-0 mb-1 w-56 max-h-64 overflow-y-auto bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-lg shadow-lg z-50",children:v.map(b=>{const g=c.has(b.id),y=(t??h)===b.id;return n("div",{class:`flex items-center gap-1 px-2 py-2 transition-colors ${y?"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:E=>C(b.id,E),class:`p-1 -m-1 text-xs transition-colors rounded hover:bg-[var(--color-bg-tertiary)] ${g?"text-[var(--color-warning)]":"text-[var(--color-text-muted)] hover:text-[var(--color-warning)]/70"}`,title:l(g?"models.removeFavorite":"models.addFavorite"),"aria-label":l(g?"models.removeFavorite":"models.addFavorite"),children:g?"★":"☆"}),n("button",{type:"button",onClick:()=>T(b.id),class:"flex-1 text-left text-sm flex items-center gap-2 min-w-0",children:[n("span",{class:"truncate",children:b.name}),b.reasoning&&n("span",{class:"text-[10px] text-[var(--color-warning)] flex-shrink-0",children:"🧠"})]})]},b.id)})})]})}function U5({onCancel:e,onConfirm:t,confirmLabel:a,confirmDisabled:r,cancelLabel:o}){return n("div",{class:"flex flex-col-reverse sm:flex-row sm:justify-end gap-2",children:[n(P,{variant:"secondary",onClick:e,fullWidth:!0,class:"sm:w-auto",children:o||l("actions.cancel")}),n(P,{onClick:t,disabled:r,fullWidth:!0,class:"sm:w-auto",children:a||l("actions.confirm")})]})}function Pf({message:e,onCancel:t,onDelete:a,isDeleting:r}){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(P,{variant:"ghost",onClick:t,fullWidth:!0,class:"sm:w-auto",children:l("actions.cancel")}),n(P,{variant:"danger",icon:n(bt,{class:"w-4 h-4"}),onClick:a,disabled:r,fullWidth:!0,class:"sm:w-auto",children:r?n(te,{size:"sm"}):l("actions.delete")})]})]})}function Px({onCancel:e,onSave:t,isSaving:a,saveDisabled:r,saveLabel:o,isEdit:s,onDeleteClick:i,extraContent:c}){return n("div",{class:"flex flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-3",children:[n("div",{class:"flex items-center justify-between sm:justify-start gap-3",children:[s&&i&&n(P,{size:"sm",variant:"ghost",icon:n(bt,{class:"w-4 h-4"}),onClick:i,class:"text-[var(--color-error)] hover:bg-[var(--color-error)]/10",children:l("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(P,{variant:"secondary",onClick:e,fullWidth:!0,class:"sm:w-auto",children:l("actions.cancel")}),n(P,{onClick:t,disabled:a||r,fullWidth:!0,class:"sm:w-auto",children:a?n(te,{size:"sm"}):o||l("actions.save")})]})]})]})}const j5=100,mv=120;function H5(){const e=It.value,[t,a]=U(new Set),[r,o]=U(null),[s,i]=U(""),[c,u]=U([]),d=F(null);if(e.length===0)return null;const h=b=>{a(g=>{const y=new Set(g);return y.has(b)?y.delete(b):y.add(b),y})},f=b=>{o(b),i(b.content),u(b.images??[])},p=()=>{if(!r)return!1;const b=r.content,g=r.images??[];if(s.trim()!==b||c.length!==g.length)return!0;for(let y=0;y<c.length;y++)if(c[y].url!==g[y].url)return!0;return!1},v=()=>{r&&(s.trim()||c.length>0)&&p()&&(ik(r.id,s.trim(),c.length>0?c:void 0),o(null),i(""),u([]))},w=()=>{o(null),i(""),u([])},C=b=>{u(g=>g.filter((y,E)=>E!==b))},T=async b=>{if(!b||b.length===0)return;const g=[];for(const y of Array.from(b))if(Df(y.type))try{const{content:E}=await Dx(y);g.push({url:E,alt:y.name})}catch{}g.length>0&&u(y=>[...y,...g]),d.current&&(d.current.value="")};return n(H,{children:[n("div",{class:"mb-2 space-y-2",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] font-medium",children:l("chat.queuedMessages",{count:e.length})}),n("div",{class:"space-y-1",children:e.map(b=>{const g=b.content.length>j5,y=t.has(b.id),E=b.images&&b.images.length>0;return n("div",{class:"px-3 py-2 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:[n("div",{class:"flex items-start gap-2",children:[n("div",{class:"flex-1 min-w-0",children:[n("p",{class:`text-sm text-[var(--color-text-secondary)] break-words ${g&&!y?"line-clamp-1":"whitespace-pre-wrap"}`,children:b.content}),E&&n("div",{class:"mt-1 flex items-center gap-1 text-xs text-[var(--color-text-muted)]",children:[n(MS,{class:"w-3 h-3"}),n("span",{children:l("chat.imageCount",{count:b.images.length})})]})]}),n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[n("button",{type:"button",onClick:()=>f(b),class:"p-1 rounded hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)] hover:text-[var(--color-accent)] transition-colors",title:l("common.edit"),"aria-label":l("common.edit"),children:n(Zb,{class:"w-4 h-4"})}),n("button",{type:"button",onClick:()=>db(b.id),class:"p-1 rounded hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)] hover:text-[var(--color-error)] transition-colors",title:l("actions.remove"),"aria-label":l("actions.remove"),children:n(Xb,{class:"w-4 h-4"})})]})]}),g&&n("button",{type:"button",onClick:()=>h(b.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(Po,{class:"w-3 h-3",open:y}),l(y?"actions.showLess":"actions.showMore")]})]},b.id)})})]}),n(We,{open:!!r,onClose:w,title:l("chat.editQueuedMessage"),size:"lg",footer:n(U5,{onCancel:w,onConfirm:v,confirmLabel:l("actions.save"),confirmDisabled:!s.trim()&&c.length===0||!p()}),children:n("div",{class:"space-y-4",children:[n("textarea",{value:s,onInput:b=>i(b.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:l("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:l("chat.images")}),n(P,{variant:"ghost",size:"sm",icon:n(Jb,{class:"w-4 h-4"}),onClick:()=>d.current?.click(),children:l("chat.addImage")}),n("input",{ref:d,type:"file",accept:"image/*",multiple:!0,class:"hidden",onChange:b=>T(b.target.files)})]}),c.length>0?n("div",{class:"flex flex-wrap gap-2",children:c.map((b,g)=>n("div",{class:"relative group",children:[n("img",{src:b.url,alt:b.alt||`Image ${g+1}`,class:"rounded-lg object-cover border border-[var(--color-border)]",style:{width:mv,height:mv}}),n("button",{type:"button",onClick:()=>C(g),class:"absolute -top-2 -right-2 p-1 rounded-full bg-[var(--color-error)] text-white opacity-0 group-hover:opacity-100 transition-opacity shadow-sm",title:l("actions.remove"),"aria-label":l("actions.remove"),children:n(Ar,{class:"w-3 h-3"})})]},g))}):n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("chat.noImages")})]})]})})]})}function B5({attachments:e,onRemove:t,isProcessing:a}){return e.length===0&&!a?null:n("div",{class:"flex flex-wrap gap-2 px-4 pb-2 items-center",children:[e.map(r=>n(W5,{attachment:r,onRemove:()=>t(r.id)},r.id)),a&&n("div",{class:`
323
+ disabled:opacity-50`,children:[n("span",{class:"max-w-[120px] truncate",children:w}),n(Po,{class:"w-3 h-3",open:r})]}),r&&n("div",{class:"absolute bottom-full left-0 mb-1 w-56 max-h-64 overflow-y-auto bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-lg shadow-lg z-50",children:v.map(b=>{const g=c.has(b.id),y=(t??h)===b.id;return n("div",{class:`flex items-center gap-1 px-2 py-2 transition-colors ${y?"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:E=>C(b.id,E),class:`p-1 -m-1 text-xs transition-colors rounded hover:bg-[var(--color-bg-tertiary)] ${g?"text-[var(--color-warning)]":"text-[var(--color-text-muted)] hover:text-[var(--color-warning)]/70"}`,title:l(g?"models.removeFavorite":"models.addFavorite"),"aria-label":l(g?"models.removeFavorite":"models.addFavorite"),children:g?"★":"☆"}),n("button",{type:"button",onClick:()=>T(b.id),class:"flex-1 text-left text-sm flex items-center gap-2 min-w-0",children:[n("span",{class:"truncate",children:b.name}),b.reasoning&&n("span",{class:"text-[10px] text-[var(--color-warning)] flex-shrink-0",children:"🧠"})]})]},b.id)})})]})}function H5({onCancel:e,onConfirm:t,confirmLabel:a,confirmDisabled:r,cancelLabel:o}){return n("div",{class:"flex flex-col-reverse sm:flex-row sm:justify-end gap-2",children:[n(P,{variant:"secondary",onClick:e,fullWidth:!0,class:"sm:w-auto",children:o||l("actions.cancel")}),n(P,{onClick:t,disabled:r,fullWidth:!0,class:"sm:w-auto",children:a||l("actions.confirm")})]})}function Df({message:e,onCancel:t,onDelete:a,isDeleting:r}){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(P,{variant:"ghost",onClick:t,fullWidth:!0,class:"sm:w-auto",children:l("actions.cancel")}),n(P,{variant:"danger",icon:n(bt,{class:"w-4 h-4"}),onClick:a,disabled:r,fullWidth:!0,class:"sm:w-auto",children:r?n(te,{size:"sm"}):l("actions.delete")})]})]})}function Px({onCancel:e,onSave:t,isSaving:a,saveDisabled:r,saveLabel:o,isEdit:s,onDeleteClick:i,extraContent:c}){return n("div",{class:"flex flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-3",children:[n("div",{class:"flex items-center justify-between sm:justify-start gap-3",children:[s&&i&&n(P,{size:"sm",variant:"ghost",icon:n(bt,{class:"w-4 h-4"}),onClick:i,class:"text-[var(--color-error)] hover:bg-[var(--color-error)]/10",children:l("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(P,{variant:"secondary",onClick:e,fullWidth:!0,class:"sm:w-auto",children:l("actions.cancel")}),n(P,{onClick:t,disabled:a||r,fullWidth:!0,class:"sm:w-auto",children:a?n(te,{size:"sm"}):o||l("actions.save")})]})]})]})}const B5=100,pv=120;function W5(){const e=Rt.value,[t,a]=U(new Set),[r,o]=U(null),[s,i]=U(""),[c,u]=U([]),d=F(null);if(e.length===0)return null;const h=b=>{a(g=>{const y=new Set(g);return y.has(b)?y.delete(b):y.add(b),y})},f=b=>{o(b),i(b.content),u(b.images??[])},p=()=>{if(!r)return!1;const b=r.content,g=r.images??[];if(s.trim()!==b||c.length!==g.length)return!0;for(let y=0;y<c.length;y++)if(c[y].url!==g[y].url)return!0;return!1},v=()=>{r&&(s.trim()||c.length>0)&&p()&&(ck(r.id,s.trim(),c.length>0?c:void 0),o(null),i(""),u([]))},w=()=>{o(null),i(""),u([])},C=b=>{u(g=>g.filter((y,E)=>E!==b))},T=async b=>{if(!b||b.length===0)return;const g=[];for(const y of Array.from(b))if($f(y.type))try{const{content:E}=await Dx(y);g.push({url:E,alt:y.name})}catch{}g.length>0&&u(y=>[...y,...g]),d.current&&(d.current.value="")};return n(H,{children:[n("div",{class:"mb-2 space-y-2",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] font-medium",children:l("chat.queuedMessages",{count:e.length})}),n("div",{class:"space-y-1",children:e.map(b=>{const g=b.content.length>B5,y=t.has(b.id),E=b.images&&b.images.length>0;return n("div",{class:"px-3 py-2 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:[n("div",{class:"flex items-start gap-2",children:[n("div",{class:"flex-1 min-w-0",children:[n("p",{class:`text-sm text-[var(--color-text-secondary)] break-words ${g&&!y?"line-clamp-1":"whitespace-pre-wrap"}`,children:b.content}),E&&n("div",{class:"mt-1 flex items-center gap-1 text-xs text-[var(--color-text-muted)]",children:[n(IS,{class:"w-3 h-3"}),n("span",{children:l("chat.imageCount",{count:b.images.length})})]})]}),n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[n("button",{type:"button",onClick:()=>f(b),class:"p-1 rounded hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)] hover:text-[var(--color-accent)] transition-colors",title:l("common.edit"),"aria-label":l("common.edit"),children:n(Zb,{class:"w-4 h-4"})}),n("button",{type:"button",onClick:()=>db(b.id),class:"p-1 rounded hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)] hover:text-[var(--color-error)] transition-colors",title:l("actions.remove"),"aria-label":l("actions.remove"),children:n(Xb,{class:"w-4 h-4"})})]})]}),g&&n("button",{type:"button",onClick:()=>h(b.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(Po,{class:"w-3 h-3",open:y}),l(y?"actions.showLess":"actions.showMore")]})]},b.id)})})]}),n(We,{open:!!r,onClose:w,title:l("chat.editQueuedMessage"),size:"lg",footer:n(H5,{onCancel:w,onConfirm:v,confirmLabel:l("actions.save"),confirmDisabled:!s.trim()&&c.length===0||!p()}),children:n("div",{class:"space-y-4",children:[n("textarea",{value:s,onInput:b=>i(b.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:l("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:l("chat.images")}),n(P,{variant:"ghost",size:"sm",icon:n(Jb,{class:"w-4 h-4"}),onClick:()=>d.current?.click(),children:l("chat.addImage")}),n("input",{ref:d,type:"file",accept:"image/*",multiple:!0,class:"hidden",onChange:b=>T(b.target.files)})]}),c.length>0?n("div",{class:"flex flex-wrap gap-2",children:c.map((b,g)=>n("div",{class:"relative group",children:[n("img",{src:b.url,alt:b.alt||`Image ${g+1}`,class:"rounded-lg object-cover border border-[var(--color-border)]",style:{width:pv,height:pv}}),n("button",{type:"button",onClick:()=>C(g),class:"absolute -top-2 -right-2 p-1 rounded-full bg-[var(--color-error)] text-white opacity-0 group-hover:opacity-100 transition-opacity shadow-sm",title:l("actions.remove"),"aria-label":l("actions.remove"),children:n(Ar,{class:"w-3 h-3"})})]},g))}):n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("chat.noImages")})]})]})})]})}function K5({attachments:e,onRemove:t,isProcessing:a}){return e.length===0&&!a?null:n("div",{class:"flex flex-wrap gap-2 px-4 pb-2 items-center",children:[e.map(r=>n(q5,{attachment:r,onRemove:()=>t(r.id)},r.id)),a&&n("div",{class:`
324
324
  w-16 h-16 rounded-lg
325
325
  border border-[var(--color-border)]
326
326
  bg-[var(--color-bg-secondary)]
327
327
  flex items-center justify-center
328
- `,children:n(te,{size:"sm"})})]})}function W5({attachment:e,onRemove:t}){const a=e.type==="image",r=K5(e.size);return n("div",{class:"relative group",children:[n(Do,{content:`${e.fileName} (${r})`,placement:"top",children:n("div",{class:`
328
+ `,children:n(te,{size:"sm"})})]})}function q5({attachment:e,onRemove:t}){const a=e.type==="image",r=V5(e.size);return n("div",{class:"relative group",children:[n(Do,{content:`${e.fileName} (${r})`,placement:"top",children:n("div",{class:`
329
329
  relative w-16 h-16 rounded-lg overflow-hidden
330
330
  border border-[var(--color-border)]
331
331
  bg-[var(--color-bg-secondary)]
332
332
  flex items-center justify-center
333
- `,children:a&&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:[a?n(Yr,{class:"w-6 h-6"}):n(an,{class:"w-6 h-6"}),n("span",{class:"text-[8px] truncate max-w-[56px] px-1",children:q5(e.fileName)})]})})}),n("button",{type:"button",onClick:t,"aria-label":l("actions.remove"),class:`
333
+ `,children:a&&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:[a?n(Yr,{class:"w-6 h-6"}):n(Dn,{class:"w-6 h-6"}),n("span",{class:"text-[8px] truncate max-w-[56px] px-1",children:G5(e.fileName)})]})})}),n("button",{type:"button",onClick:t,"aria-label":l("actions.remove"),class:`
334
334
  absolute -top-1.5 -right-1.5
335
335
  w-5 h-5 rounded-full
336
336
  bg-[var(--color-bg-surface)] border border-[var(--color-border)]
@@ -338,17 +338,17 @@ ${t}`:t;return n("div",{children:[n("span",{class:"sr-only",children:[l("toolInp
338
338
  opacity-0 group-hover:opacity-100
339
339
  hover:bg-[var(--color-error)] hover:border-[var(--color-error)] hover:text-white
340
340
  transition-all cursor-pointer
341
- `,children:n(Ma,{class:"w-3 h-3"})})]})}function K5(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function q5(e){return e.split(".").pop()?.toUpperCase()||"FILE"}const vv=160;function V5({onSend:e,onAbort:t,disabled:a=!1,isStreaming:r=!1,placeholder:o,sessionKey:s,currentModel:i,onModelChange:c}){const u=F(null),d=F(null),h=F(null),f=X(s?Xp(s):""),p=X(!1),{attachments:v,addFiles:w,removeAttachment:C,clearAttachments:T,getPayloads:b,handlePaste:g,isProcessing:y,error:E,clearError:x}=O5(),S=Q(()=>{const W=u.current;if(!W)return;W.style.height="auto";const ce=Math.min(W.scrollHeight,vv);W.style.height=`${ce}px`},[]),k=Q(W=>{const ce=W.target.value;f.value=ce,s&&hb(s,ce),S()},[S,s]),I=Q(()=>{const W=f.value.trim(),ce=b();!W&&ce.length===0||a||(e(W,ce.length>0?ce:void 0),f.value="",s&&ck(s),T(),u.current&&(u.current.style.height="auto"))},[e,a,b,T,s]),A=Q(W=>{if((W.metaKey||W.ctrlKey)&&W.key==="Enter"){W.preventDefault(),I();return}W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),I())},[I]),O=Q(async W=>{await g(W)},[g]),z=Q(W=>{const ce=W.target;ce.files&&ce.files.length>0&&(w(ce.files),ce.value="")},[w]),se=Q(W=>{W.preventDefault(),W.stopPropagation(),p.value=!0},[]),Fe=Q(W=>{W.preventDefault(),W.stopPropagation(),!(W.relatedTarget&&h.current?.contains(W.relatedTarget))&&(p.value=!1)},[]),tt=Q(W=>{W.preventDefault(),W.stopPropagation()},[]),Re=Q(async W=>{W.preventDefault(),W.stopPropagation(),p.value=!1;const ce=W.dataTransfer?.files;ce&&ce.length>0&&await w(ce)},[w]);R(()=>{if(u.current?.focus(),s){const W=Xp(s);f.value=W,W&&requestAnimationFrame(S)}},[s,S]),R(()=>{if(E){const W=setTimeout(x,5e3);return()=>clearTimeout(W)}},[E,x]);const Gn=Gh(f.value),Jn=v.length>0,be=(Gn||Jn)&&!a;return n("div",{class:"pb-3 pt-2",children:n("div",{class:"max-w-5xl mx-auto px-6",children:[n(H5,{}),E&&n("div",{class:"mb-2 px-3 py-2 text-sm text-[var(--color-error)] bg-[var(--color-error)]/10 rounded-lg",children:E}),n("div",{ref:h,"data-tour":"chat-input",onDragEnter:se,onDragLeave:Fe,onDragOver:tt,onDrop:Re,class:`
341
+ `,children:n(Ma,{class:"w-3 h-3"})})]})}function V5(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function G5(e){return e.split(".").pop()?.toUpperCase()||"FILE"}const mv=160;function J5({onSend:e,onAbort:t,disabled:a=!1,isStreaming:r=!1,placeholder:o,sessionKey:s,currentModel:i,onModelChange:c}){const u=F(null),d=F(null),h=F(null),f=X(s?Zp(s):""),p=X(!1),{attachments:v,addFiles:w,removeAttachment:C,clearAttachments:T,getPayloads:b,handlePaste:g,isProcessing:y,error:E,clearError:x}=F5(),S=Q(()=>{const W=u.current;if(!W)return;W.style.height="auto";const ce=Math.min(W.scrollHeight,mv);W.style.height=`${ce}px`},[]),k=Q(W=>{const ce=W.target.value;f.value=ce,s&&hb(s,ce),S()},[S,s]),I=Q(()=>{const W=f.value.trim(),ce=b();!W&&ce.length===0||a||(e(W,ce.length>0?ce:void 0),f.value="",s&&uk(s),T(),u.current&&(u.current.style.height="auto"))},[e,a,b,T,s]),A=Q(W=>{if((W.metaKey||W.ctrlKey)&&W.key==="Enter"){W.preventDefault(),I();return}W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),I())},[I]),O=Q(async W=>{await g(W)},[g]),z=Q(W=>{const ce=W.target;ce.files&&ce.files.length>0&&(w(ce.files),ce.value="")},[w]),se=Q(W=>{W.preventDefault(),W.stopPropagation(),p.value=!0},[]),Fe=Q(W=>{W.preventDefault(),W.stopPropagation(),!(W.relatedTarget&&h.current?.contains(W.relatedTarget))&&(p.value=!1)},[]),et=Q(W=>{W.preventDefault(),W.stopPropagation()},[]),he=Q(async W=>{W.preventDefault(),W.stopPropagation(),p.value=!1;const ce=W.dataTransfer?.files;ce&&ce.length>0&&await w(ce)},[w]);R(()=>{if(u.current?.focus(),s){const W=Zp(s);f.value=W,W&&requestAnimationFrame(S)}},[s,S]),R(()=>{if(E){const W=setTimeout(x,5e3);return()=>clearTimeout(W)}},[E,x]);const yt=qh(f.value),$t=v.length>0,xe=(yt||$t)&&!a;return n("div",{class:"pb-3 pt-2",children:n("div",{class:"max-w-5xl mx-auto px-6",children:[n(W5,{}),E&&n("div",{class:"mb-2 px-3 py-2 text-sm text-[var(--color-error)] bg-[var(--color-error)]/10 rounded-lg",children:E}),n("div",{ref:h,"data-tour":"chat-input",onDragEnter:se,onDragLeave:Fe,onDragOver:et,onDrop:he,class:`
342
342
  relative flex flex-col bg-[var(--color-bg-surface)] border rounded-xl
343
343
  transition-all duration-200
344
344
  ${p.value?"border-[var(--color-accent)] bg-[var(--color-accent)]/5":"border-[var(--color-border)] focus-within:border-[var(--color-accent)]"}
345
- `,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:l("chat.dropFiles")})}),(Jn||y)&&n("div",{class:"pt-3 px-4",children:n(B5,{attachments:v,onRemove:C,isProcessing:y})}),n("textarea",{ref:u,value:f.value,onInput:k,onKeyDown:A,onPaste:O,disabled:a,placeholder:o||(window.innerWidth<640?l("chat.placeholderMobile"):l("chat.placeholder")),rows:1,class:`
345
+ `,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:l("chat.dropFiles")})}),($t||y)&&n("div",{class:"pt-3 px-4",children:n(K5,{attachments:v,onRemove:C,isProcessing:y})}),n("textarea",{ref:u,value:f.value,onInput:k,onKeyDown:A,onPaste:O,disabled:a,placeholder:o||(window.innerWidth<640?l("chat.placeholderMobile"):l("chat.placeholder")),rows:1,class:`
346
346
  w-full px-4 pb-1 text-base sm:text-sm rounded-t-xl resize-none
347
347
  bg-transparent border-none
348
348
  placeholder:text-[var(--color-text-muted)]
349
349
  disabled:opacity-50 disabled:cursor-not-allowed
350
- ${Jn?"pt-2":"pt-3"}
351
- `,style:{minHeight:"44px",maxHeight:`${vv}px`,outline:"none"}}),n("input",{ref:d,type:"file",multiple:!0,accept:"image/*",onChange:z,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:[s&&n("div",{"data-tour":"model-picker",children:n(z5,{sessionKey:s,currentModel:i,onModelChange:c})}),n(Do,{content:l("chat.attachImage"),placement:"top",children:n("button",{type:"button",onClick:()=>d.current?.click(),disabled:a,"aria-label":l("chat.attachImage"),class:`
350
+ ${$t?"pt-2":"pt-3"}
351
+ `,style:{minHeight:"44px",maxHeight:`${mv}px`,outline:"none"}}),n("input",{ref:d,type:"file",multiple:!0,accept:"image/*",onChange:z,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:[s&&n("div",{"data-tour":"model-picker",children:n(j5,{sessionKey:s,currentModel:i,onModelChange:c})}),n(Do,{content:l("chat.attachImage"),placement:"top",children:n("button",{type:"button",onClick:()=>d.current?.click(),disabled:a,"aria-label":l("chat.attachImage"),class:`
352
352
  p-1.5 rounded-lg cursor-pointer
353
353
  text-[var(--color-text-muted)]
354
354
  hover:text-[var(--color-text-secondary)]
@@ -358,13 +358,13 @@ ${t}`:t;return n("div",{children:[n("span",{class:"sr-only",children:[l("toolInp
358
358
  `,children:n(Yr,{class:"w-4 h-4","aria-hidden":"true"})})})]}),n("div",{class:"flex items-center gap-1.5",children:[r&&n("button",{type:"button",onClick:t,"aria-label":l("actions.stop"),class:`p-2 sm:px-3 sm:py-1.5 rounded-lg flex items-center justify-center gap-1.5 cursor-pointer
359
359
  bg-[var(--color-error)]/10 text-[var(--color-error)]
360
360
  hover:bg-[var(--color-error)]/20
361
- active:scale-95 transition-all duration-150`,children:[n(_S,{class:"w-4 h-4"}),n("span",{class:"hidden sm:inline text-xs font-medium",children:l("actions.stop")})]}),n("button",{type:"button",onClick:I,disabled:!be,"aria-label":l(r?"actions.queue":"actions.send"),class:`p-2 sm:px-3 sm:py-1.5 rounded-lg flex items-center justify-center gap-1.5
361
+ active:scale-95 transition-all duration-150`,children:[n(CS,{class:"w-4 h-4"}),n("span",{class:"hidden sm:inline text-xs font-medium",children:l("actions.stop")})]}),n("button",{type:"button",onClick:I,disabled:!xe,"aria-label":l(r?"actions.queue":"actions.send"),class:`p-2 sm:px-3 sm:py-1.5 rounded-lg flex items-center justify-center gap-1.5
362
362
  transition-all duration-150 active:scale-95
363
- ${be?"bg-[var(--color-accent)] text-white hover:opacity-90 cursor-pointer":"bg-[var(--color-bg-secondary)] text-[var(--color-text-muted)] cursor-not-allowed"}`,children:[n(SS,{class:"w-4 h-4"}),n("span",{class:"hidden sm:inline text-xs font-medium",children:l(r?"actions.queue":"actions.send")})]})]})]})]})]})})}function G5(){const e=Ue.value;if(e==="connected"||e==="connecting"||e==="authenticating")return null;const t=e==="reconnecting",a=It.value.length;return n("div",{class:`
363
+ ${xe?"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(_S,{class:"w-4 h-4"}),n("span",{class:"hidden sm:inline text-xs font-medium",children:l(r?"actions.queue":"actions.send")})]})]})]})]})]})})}function Y5(){const e=Ue.value;if(e==="connected"||e==="connecting"||e==="authenticating")return null;const t=e==="reconnecting",a=Rt.value.length;return n("div",{class:`
364
364
  px-4 py-2 text-sm flex items-center justify-center gap-2
365
365
  animate-[fade-in_150ms_ease-out_100ms_forwards] opacity-0
366
366
  ${t?"bg-[var(--color-warning)]/10 text-[var(--color-warning)]":"bg-[var(--color-error)]/10 text-[var(--color-error)]"}
367
- `,role:"alert",children:[n("span",{class:"flex-shrink-0",children:t?n($b,{class:"w-4 h-4 animate-spin","aria-hidden":"true"}):n(Aa,{class:"w-4 h-4","aria-hidden":"true"})}),n("span",{children:t?Xt.value>1?l("connection.reconnectingAttempt",{count:Xt.value}):l("connection.reconnecting"):l("connection.disconnected")}),ib.value&&n("span",{class:"text-xs opacity-75",children:["• ",l("connection.messagesQueued",{count:a})]})]})}function li({sessionKey:e}){const t=F(null),a=F(!1),[r,o]=he("q");He(r,Tn,u=>u),R(()=>{r.value&&!mt.value&&(mt.value=!0)},[r.value]),Mr(Tn,o),R(()=>{const u=e?decodeURIComponent(e):null;if(Bs.value&&Ye.value){In.value!==Ye.value&&ho(Ye.value),u&&u!==Ye.value&&Oe(`/chat/${encodeURIComponent(Ye.value)}`,!0);return}if(!u&&Ye.value){Oe(`/chat/${encodeURIComponent(Ye.value)}`,!0);return}const d=u||"main";d!==In.value&&ho(d)},[e,Ye.value,Bs.value]),R(()=>{const u=rt.value;if(!u||u===t.current)return;t.current=u,Y2()!==u&&(qc(),QC(),Tn.value="",mt.value=!1),Vc(u).catch(()=>{})},[In.value]),R(()=>{const u=D.value,d=a.current;a.current=u,!(!u||d)&&(lk(),ib.value&&Ik())},[Ue.value]);const s=async(u,d)=>{const h=rt.value;if(h)try{await vb(h,u,{attachments:d})}catch{}},i=()=>{const u=rt.value;u&&gb(u)},c=jc(()=>nk(rt.value));return n("div",{class:"flex-1 flex flex-col overflow-hidden relative",children:[n(G5,{}),n($5,{messages:lb.value,isLoading:_d.value,error:tc.value,streamingContent:c.value.content,streamingToolCalls:c.value.toolCalls,isStreaming:c.value.isStreaming,assistantName:Id.value,assistantAvatar:Rd.value??void 0,userName:qk.value,userAvatar:Vk.value??void 0,queuedCount:It.value.length}),n(V5,{onSend:s,onAbort:i,disabled:!1,isStreaming:c.value.isStreaming,sessionKey:rt.value,currentModel:z2.value?.model,onModelChange:u=>{rt.value&&Zh(rt.value,{model:u})}})]})}const Of=Ml(({size:e="md",error:t,fullWidth:a,class:r,...o},s)=>{const[i,c]=U(!1);return n(Y,{ref:s,type:i?"text":"password",size:e,error:t,fullWidth:a,rightElement:n("button",{type:"button",onClick:()=>c(!i),class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors","aria-label":i?"Hide password":"Show password",tabIndex:-1,children:i?n(Ab,{class:"w-4 h-4"}):n(ff,{class:"w-4 h-4"})}),class:r,...o})});Of.displayName="PasswordInput";const J5={default:`
367
+ `,role:"alert",children:[n("span",{class:"flex-shrink-0",children:t?n($b,{class:"w-4 h-4 animate-spin","aria-hidden":"true"}):n(Aa,{class:"w-4 h-4","aria-hidden":"true"})}),n("span",{children:t?Qt.value>1?l("connection.reconnectingAttempt",{count:Qt.value}):l("connection.reconnecting"):l("connection.disconnected")}),ib.value&&n("span",{class:"text-xs opacity-75",children:["• ",l("connection.messagesQueued",{count:a})]})]})}function li({sessionKey:e}){const t=F(null),a=F(!1),[r,o]=fe("q");He(r,Tn,u=>u),R(()=>{r.value&&!mt.value&&(mt.value=!0)},[r.value]),Mr(Tn,o),R(()=>{const u=e?decodeURIComponent(e):null;if(Ws.value&&Je.value){Rn.value!==Je.value&&fo(Je.value),u&&u!==Je.value&&Oe(`/chat/${encodeURIComponent(Je.value)}`,!0);return}if(!u&&Je.value){Oe(`/chat/${encodeURIComponent(Je.value)}`,!0);return}const d=u||"main";d!==Rn.value&&fo(d)},[e,Je.value,Ws.value]),R(()=>{const u=at.value;if(!u||u===t.current)return;t.current=u,Z2()!==u&&(Bc(),t5(),Tn.value="",mt.value=!1),Wc(u).catch(()=>{})},[Rn.value]),R(()=>{const u=D.value,d=a.current;a.current=u,!(!u||d)&&(ik(),ib.value&&Rk())},[Ue.value]);const s=async(u,d)=>{const h=at.value;if(h)try{await vb(h,u,{attachments:d})}catch{}},i=()=>{const u=at.value;u&&gb(u)},c=Fc(()=>ak(at.value));return n("div",{class:"flex-1 flex flex-col overflow-hidden relative",children:[n(Y5,{}),n(P5,{messages:lb.value,isLoading:wd.value,error:Qi.value,streamingContent:c.value.content,streamingToolCalls:c.value.toolCalls,isStreaming:c.value.isStreaming,assistantName:Ed.value,assistantAvatar:Ad.value??void 0,userName:Vk.value,userAvatar:Gk.value??void 0,queuedCount:Rt.value.length}),n(J5,{onSend:s,onAbort:i,disabled:!1,isStreaming:c.value.isStreaming,sessionKey:at.value,currentModel:U2.value?.model,onModelChange:u=>{at.value&&Jh(at.value,{model:u})}})]})}const Pf=Ml(({size:e="md",error:t,fullWidth:a,class:r,...o},s)=>{const[i,c]=U(!1);return n(Y,{ref:s,type:i?"text":"password",size:e,error:t,fullWidth:a,rightElement:n("button",{type:"button",onClick:()=>c(!i),class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors","aria-label":i?"Hide password":"Show password",tabIndex:-1,children:i?n(Ab,{class:"w-4 h-4"}):n(df,{class:"w-4 h-4"})}),class:r,...o})});Pf.displayName="PasswordInput";const Z5={default:`
368
368
  bg-[var(--color-bg-surface)]
369
369
  border border-[var(--color-border)]
370
370
  shadow-soft-sm
@@ -380,25 +380,25 @@ ${t}`:t;return n("div",{children:[n("span",{class:"sr-only",children:[l("toolInp
380
380
  bg-transparent
381
381
  border border-[var(--color-border)]
382
382
  transition-colors duration-200 ease-out
383
- `},Yu={none:"",sm:"p-3",md:"p-4",lg:"p-6"};function G({variant:e="default",padding:t="md",title:a,subtitle:r,headerActions:o,footer:s,children:i,class:c,...u}){const d=a||r||o;return n("div",{class:`rounded-xl ${J5[e]} ${c||""}`,...u,children:[d&&n("div",{class:`
383
+ `},Vu={none:"",sm:"p-3",md:"p-4",lg:"p-6"};function G({variant:e="default",padding:t="md",title:a,subtitle:r,headerActions:o,footer:s,children:i,class:c,...u}){const d=a||r||o;return n("div",{class:`rounded-xl ${Z5[e]} ${c||""}`,...u,children:[d&&n("div",{class:`
384
384
  flex items-start justify-between gap-4
385
- ${t!=="none"?Yu[t]:"p-4"}
385
+ ${t!=="none"?Vu[t]:"p-4"}
386
386
  ${i||s?"border-b border-[var(--color-border)]":""}
387
- `,children:[n("div",{children:[a&&n("h3",{class:"font-medium text-[var(--color-text-primary)]",children:a}),r&&n("p",{class:"text-sm text-[var(--color-text-muted)] mt-0.5",children:r})]}),o&&n("div",{class:"flex items-center gap-2",children:o})]}),i&&n("div",{class:Yu[t],children:i}),s&&n("div",{class:`
388
- ${Yu[t]}
387
+ `,children:[n("div",{children:[a&&n("h3",{class:"font-medium text-[var(--color-text-primary)]",children:a}),r&&n("p",{class:"text-sm text-[var(--color-text-muted)] mt-0.5",children:r})]}),o&&n("div",{class:"flex items-center gap-2",children:o})]}),i&&n("div",{class:Vu[t],children:i}),s&&n("div",{class:`
388
+ ${Vu[t]}
389
389
  border-t border-[var(--color-border)]
390
390
  bg-[var(--color-bg-secondary)]/50
391
391
  rounded-b-2xl
392
- `,children:s})]})}function Y5(){const e=X(""),t=X(""),a=X("token"),r=X(!1),o=X(!0),s=X(null),i=h=>{if(!h.trim())return l("errors.required");if(!h.startsWith("ws://")&&!h.startsWith("wss://"))return"URL must start with ws:// or wss://";try{new URL(h)}catch{return l("errors.invalid")}return null},c=async()=>{const h=i(e.value);if(h){s.value=h;return}s.value=null,r.value=!0;try{await Sl({url:e.value,token:a.value==="token"?t.value:void 0,password:a.value==="password"?t.value:void 0,autoReconnect:!0}),Fh({url:e.value,authMode:a.value,rememberMe:o.value,credential:t.value}),await Wc(),await Sb(),await of(),ho("main"),await rf("main"),lf(),cf()}catch(f){M.auth.error("Connect failed:",f)}finally{r.value=!1}},u=h=>{h.key==="Enter"&&(h.preventDefault(),c())};if(!e.value){const h=Bc();if(h){e.value=h.url,a.value=h.authMode,o.value=h.rememberMe;const f=Uh();f&&(t.value=f)}}const d=[{value:"token",label:l("common.token")},{value:"password",label:l("common.password")}];return n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-8",children:n("div",{class:"w-full max-w-sm mx-auto min-h-full flex flex-col justify-center py-4 sm:py-0",children:[n("div",{class:"text-center mb-4 sm:mb-8",children:[n(au,{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:l("common.cove")}),n("p",{class:"text-sm sm:text-base text-[var(--color-text-muted)] mt-1",children:l("app.tagline")})]}),n(G,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:l("common.connectToGateway")}),n("div",{class:"space-y-3 sm:space-y-4",children:[n(De,{label:l("common.gatewayUrl"),htmlFor:"gateway-url",error:s.value||void 0,children:n(Y,{id:"gateway-url",type:"url",value:e.value,onInput:h=>{e.value=h.target.value,s.value=null},onKeyDown:u,placeholder:l("auth.gatewayUrlPlaceholder"),error:s.value||void 0,autoCorrect:"off",autoCapitalize:"off",spellcheck:!1,fullWidth:!0})}),n(De,{label:"Auth Mode",children:n(Ae,{value:a.value,onChange:h=>a.value=h,options:d,"aria-label":"Auth Mode",class:"w-full"})}),n(De,{label:a.value==="token"?l("common.token"):l("common.password"),htmlFor:"auth-credential",children:n(Of,{id:"auth-credential",value:t.value,onInput:h=>t.value=h.target.value,onKeyDown:u,placeholder:a.value==="token"?l("auth.tokenPlaceholder"):l("auth.passwordPlaceholder"),fullWidth:!0})}),n(Be,{checked:o.value,onChange:h=>o.value=h,label:l("auth.rememberMe"),size:"sm"}),n(P,{variant:"primary",onClick:c,disabled:r.value||!e.value.trim(),loading:r.value,fullWidth:!0,children:r.value?l("common.connecting"):l("actions.connect")}),ia.value&&n("p",{class:"text-sm text-[var(--color-error)] text-center",children:ia.value})]})]})]})})}class lu extends At{constructor(t){super(t),this.state={hasError:!1,error:null,detailsOpen:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,a){const{viewName:r}=this.props;M.ui.error(`ViewErrorBoundary caught error in ${r||"unknown view"}:`,t),M.ui.error("Component stack:",a.componentStack)}handleRetry=()=>{this.setState({hasError:!1,error:null,detailsOpen:!1}),this.props.onRetry?.()};toggleDetails=()=>{this.setState(t=>({detailsOpen:!t.detailsOpen}))};copyError=async()=>{const{error:t}=this.state;if(!t)return;const a=l("actions.copy"),r=typeof navigator<"u"?navigator.clipboard:null;if(!r?.writeText){V.error(l("status.copyFailed",{label:a}));return}try{const o=`${t.name}: ${t.message}
392
+ `,children:s})]})}function X5(){const e=X(""),t=X(""),a=X("token"),r=X(!1),o=X(!0),s=X(null),i=h=>{if(!h.trim())return l("errors.required");if(!h.startsWith("ws://")&&!h.startsWith("wss://"))return"URL must start with ws:// or wss://";try{new URL(h)}catch{return l("errors.invalid")}return null},c=async()=>{const h=i(e.value);if(h){s.value=h;return}s.value=null,r.value=!0;try{await Sl({url:e.value,token:a.value==="token"?t.value:void 0,password:a.value==="password"?t.value:void 0,autoReconnect:!0}),Oh({url:e.value,authMode:a.value,rememberMe:o.value,credential:t.value}),await jc(),await Sb(),await af(),fo("main"),await nf("main"),of(),sf()}catch(f){M.auth.error("Connect failed:",f)}finally{r.value=!1}},u=h=>{h.key==="Enter"&&(h.preventDefault(),c())};if(!e.value){const h=Uc();if(h){e.value=h.url,a.value=h.authMode,o.value=h.rememberMe;const f=Fh();f&&(t.value=f)}}const d=[{value:"token",label:l("common.token")},{value:"password",label:l("common.password")}];return n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-8",children:n("div",{class:"w-full max-w-sm mx-auto min-h-full flex flex-col justify-center py-4 sm:py-0",children:[n("div",{class:"text-center mb-4 sm:mb-8",children:[n(eu,{size:"lg",class:"mx-auto mb-2 sm:mb-3 sm:w-16 sm:h-16"}),n("h1",{class:"text-xl sm:text-2xl font-bold",children:l("common.cove")}),n("p",{class:"text-sm sm:text-base text-[var(--color-text-muted)] mt-1",children:l("app.tagline")})]}),n(G,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:l("common.connectToGateway")}),n("div",{class:"space-y-3 sm:space-y-4",children:[n(De,{label:l("common.gatewayUrl"),htmlFor:"gateway-url",error:s.value||void 0,children:n(Y,{id:"gateway-url",type:"url",value:e.value,onInput:h=>{e.value=h.target.value,s.value=null},onKeyDown:u,placeholder:l("auth.gatewayUrlPlaceholder"),error:s.value||void 0,autoCorrect:"off",autoCapitalize:"off",spellcheck:!1,fullWidth:!0})}),n(De,{label:"Auth Mode",children:n(Me,{value:a.value,onChange:h=>a.value=h,options:d,"aria-label":"Auth Mode",class:"w-full"})}),n(De,{label:a.value==="token"?l("common.token"):l("common.password"),htmlFor:"auth-credential",children:n(Pf,{id:"auth-credential",value:t.value,onInput:h=>t.value=h.target.value,onKeyDown:u,placeholder:a.value==="token"?l("auth.tokenPlaceholder"):l("auth.passwordPlaceholder"),fullWidth:!0})}),n(Be,{checked:o.value,onChange:h=>o.value=h,label:l("auth.rememberMe"),size:"sm"}),n(P,{variant:"primary",onClick:c,disabled:r.value||!e.value.trim(),loading:r.value,fullWidth:!0,children:r.value?l("common.connecting"):l("actions.connect")}),ia.value&&n("p",{class:"text-sm text-[var(--color-error)] text-center",children:ia.value})]})]})]})})}class ru extends Mt{constructor(t){super(t),this.state={hasError:!1,error:null,detailsOpen:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,a){const{viewName:r}=this.props;M.ui.error(`ViewErrorBoundary caught error in ${r||"unknown view"}:`,t),M.ui.error("Component stack:",a.componentStack)}handleRetry=()=>{this.setState({hasError:!1,error:null,detailsOpen:!1}),this.props.onRetry?.()};toggleDetails=()=>{this.setState(t=>({detailsOpen:!t.detailsOpen}))};copyError=async()=>{const{error:t}=this.state;if(!t)return;const a=l("actions.copy"),r=typeof navigator<"u"?navigator.clipboard:null;if(!r?.writeText){V.error(l("status.copyFailed",{label:a}));return}try{const o=`${t.name}: ${t.message}
393
393
 
394
- ${t.stack||""}`;await r.writeText(o),V.success(l("actions.copied"))}catch(o){M.ui.error("Failed to copy view error details:",o),V.error(l("status.copyFailed",{label:a}))}};render(){if(this.state.hasError){const{error:t,detailsOpen:a}=this.state;return n("div",{class:"flex-1 flex flex-col items-center justify-start p-8 pt-16 overflow-auto",role:"alert",children:n("div",{class:"max-w-lg w-full text-center space-y-6",children:[n("img",{src:"/confused-lobster.png",alt:"",class:"w-80 h-auto mx-auto rounded-xl","aria-hidden":"true"}),n("div",{class:"space-y-2",children:[n("h2",{class:"text-xl font-semibold text-[var(--color-text-primary)]",children:l("errors.errorPage.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("errors.errorPage.subtitle")})]}),n(P,{onClick:this.handleRetry,variant:"secondary",icon:n(Qe,{class:"w-4 h-4"}),children:l("actions.retry")}),t&&n("div",{class:"text-left",children:[n("button",{type:"button",onClick:this.toggleDetails,class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors",children:[a?n(Tl,{class:"w-4 h-4"}):n(Ne,{class:"w-4 h-4"}),l("errors.errorPage.details")]}),a&&n("div",{class:"mt-2 relative",children:[n("pre",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg text-xs text-[var(--color-text-muted)] overflow-x-auto max-h-40 overflow-y-auto",children:n("code",{children:[t.name,": ",t.message,t.stack&&`
394
+ ${t.stack||""}`;await r.writeText(o),V.success(l("actions.copied"))}catch(o){M.ui.error("Failed to copy view error details:",o),V.error(l("status.copyFailed",{label:a}))}};render(){if(this.state.hasError){const{error:t,detailsOpen:a}=this.state;return n("div",{class:"flex-1 flex flex-col items-center justify-start p-8 pt-16 overflow-auto",role:"alert",children:n("div",{class:"max-w-lg w-full text-center space-y-6",children:[n("img",{src:"/confused-lobster.png",alt:"",class:"w-80 h-auto mx-auto rounded-xl","aria-hidden":"true"}),n("div",{class:"space-y-2",children:[n("h2",{class:"text-xl font-semibold text-[var(--color-text-primary)]",children:l("errors.errorPage.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("errors.errorPage.subtitle")})]}),n(P,{onClick:this.handleRetry,variant:"secondary",icon:n(Xe,{class:"w-4 h-4"}),children:l("actions.retry")}),t&&n("div",{class:"text-left",children:[n("button",{type:"button",onClick:this.toggleDetails,class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors",children:[a?n(Tl,{class:"w-4 h-4"}):n(Ne,{class:"w-4 h-4"}),l("errors.errorPage.details")]}),a&&n("div",{class:"mt-2 relative",children:[n("pre",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg text-xs text-[var(--color-text-muted)] overflow-x-auto max-h-40 overflow-y-auto",children:n("code",{children:[t.name,": ",t.message,t.stack&&`
395
395
 
396
- ${t.stack}`]})}),n("button",{type:"button",onClick:this.copyError,class:"absolute top-2 right-2 p-1.5 rounded bg-[var(--color-bg-secondary)] hover:bg-[var(--color-bg-hover)] transition-colors",title:l("actions.copy"),children:n(El,{class:"w-3.5 h-3.5"})})]})]})]})})}return this.props.children}}const Z5={"4xl":"max-w-4xl","5xl":"max-w-5xl","6xl":"max-w-6xl","7xl":"max-w-7xl",full:"max-w-full"};function sn({viewName:e,children:t,maxWidth:a="5xl"}){return n(lu,{viewName:e,children:n("div",{class:"flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6",children:n("div",{class:`${Z5[a]} mx-auto space-y-4 sm:space-y-6`,children:t})})})}function le({icon:e,label:t,value:a,active:r,highlight:o,onClick:s,class:i,subtext:c,href:u}){const d=!!s||!!u,h=n(H,{children:[n("div",{class:`p-1.5 sm:p-2 rounded-lg ${r?"bg-[var(--color-accent)]/20":"bg-[var(--color-bg-tertiary)]"}`,children:n(e,{class:`w-4 h-4 sm:w-5 sm:h-5 ${r?"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:a}),n("div",{class:"text-[10px] sm:text-sm text-[var(--color-text-muted)] truncate",children:t}),c&&n("div",{class:"text-xs text-[var(--color-text-muted)] truncate",children:c})]})]}),f=`
396
+ ${t.stack}`]})}),n("button",{type:"button",onClick:this.copyError,class:"absolute top-2 right-2 p-1.5 rounded bg-[var(--color-bg-secondary)] hover:bg-[var(--color-bg-hover)] transition-colors",title:l("actions.copy"),children:n(El,{class:"w-3.5 h-3.5"})})]})]})]})})}return this.props.children}}const Q5={"4xl":"max-w-4xl","5xl":"max-w-5xl","6xl":"max-w-6xl","7xl":"max-w-7xl",full:"max-w-full"};function sn({viewName:e,children:t,maxWidth:a="5xl"}){return n(ru,{viewName:e,children:n("div",{class:"flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6",children:n("div",{class:`${Q5[a]} mx-auto space-y-4 sm:space-y-6`,children:t})})})}function le({icon:e,label:t,value:a,active:r,highlight:o,onClick:s,class:i,subtext:c,href:u}){const d=!!s||!!u,h=n(H,{children:[n("div",{class:`p-1.5 sm:p-2 rounded-lg ${r?"bg-[var(--color-accent)]/20":"bg-[var(--color-bg-tertiary)]"}`,children:n(e,{class:`w-4 h-4 sm:w-5 sm:h-5 ${r?"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:a}),n("div",{class:"text-[10px] sm:text-sm text-[var(--color-text-muted)] truncate",children:t}),c&&n("div",{class:"text-xs text-[var(--color-text-muted)] truncate",children:c})]})]}),f=`
397
397
  flex items-center gap-1.5 sm:gap-3 p-2 sm:p-4 rounded-xl text-left transition-all
398
398
  ${r?"bg-[var(--color-accent)]/10 border-2 border-[var(--color-accent)]":"bg-[var(--color-bg-secondary)] border-2 border-transparent"}
399
399
  ${d?"hover:bg-[var(--color-bg-tertiary)] cursor-pointer":""}
400
400
  ${i||""}
401
- `;return d?u&&!s?n("a",{href:u,class:f,children:h}):n("button",{type:"button",onClick:s,class:f,children:h}):n("div",{class:f,children:h})}const Ja=m(null),Xr=m([]),Br=m(null);async function X5(){if(D.value){try{const e=await N("cron.status");Ja.value={enabled:e.enabled??!1,jobCount:e.jobs??0,nextWakeMs:e.nextWakeAtMs??null}}catch{Ja.value=null}try{const e=await N("channels.status"),t=[],a=e.channelOrder??[];for(const r of a){const o=e.channelAccounts?.[r]??[];for(const s of o)t.push({id:s.accountId,type:r,connected:s.connected??s.running??!1})}Xr.value=t}catch{Xr.value=[]}try{const t=(await N("skills.status")).skills??[];Br.value={total:t.length,eligible:t.filter(a=>a.eligible).length}}catch{Br.value=null}}}const Q5=K(()=>{const e=Wh.value;return e==null?null:Qg(e)}),eT=K(()=>window.location.protocol==="https:"||window.location.hostname==="localhost"),tT=K(()=>gt.value?.startsWith("wss://")??!1),gv=K(()=>Xr.value.filter(e=>e.connected).length),nT=K(()=>{const e=Ja.value?.nextWakeMs;if(!e)return null;const t=Date.now(),a=e-t;return a<0?"now":a<6e4?`${Math.floor(a/1e3)}s`:a<36e5?`${Math.floor(a/6e4)}m`:a<864e5?`${Math.floor(a/36e5)}h`:`${Math.floor(a/864e5)}d`});function bv({value:e,label:t}){const[a,r]=U(!1);return n("div",{class:"py-2",children:[n("div",{class:"flex items-center justify-between mb-1",children:[n("span",{class:"text-[var(--color-text-muted)] text-sm",children:t}),n(q,{onClick:async()=>{try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),2e3)}catch{V.error(l("status.copyFailed",{label:t}))}},icon:a?n(on,{class:"text-[var(--color-success)]"}):n(El,{}),label:`Copy ${t}`,size:"sm",variant:"ghost",class:"flex-shrink-0"})]}),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 ii({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 aT(e){const t=D.value,a=Ue.value;return R(()=>{t&&X5()},[t]),n(sn,{viewName:l("common.overview"),children:[!eT.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(Aa,{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&&gt.value&&!tT.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(eu,{class:"w-5 h-5 text-[var(--color-warning)] flex-shrink-0 mt-0.5"}),n("div",{children:[n("div",{class:"font-medium text-[var(--color-warning)]",children:"Insecure WebSocket"}),n("p",{class:"text-sm text-[var(--color-text-secondary)] mt-1",children:["Connected via ",n("code",{class:"bg-[var(--color-bg-secondary)] px-1 rounded",children:"ws://"})," ","instead of ",n("code",{class:"bg-[var(--color-bg-secondary)] px-1 rounded",children:"wss://"}),". Traffic is not encrypted."]})]})]}),n(G,{padding:"md",children:[n("div",{class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[n("div",{class:"flex items-center gap-3",children:[t?n("div",{class:"p-2 rounded-lg bg-[var(--color-success)]/10",children:n(dc,{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(jb,{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(Z,{variant:t?"success":a==="connecting"?"warning":"error",dot:!0,size:"sm",children:l(a==="connected"?"common.healthy":a==="connecting"||a==="authenticating"?"status.connecting":a==="reconnecting"?"status.reconnecting":"status.disconnected")})]})]}),t&&n(P,{variant:"secondary",size:"sm",onClick:()=>uo(),children:"Disconnect"})]}),t&&gt.value&&n("div",{class:"border-t border-[var(--color-border)] pt-4 mt-4 space-y-1",children:[n(bv,{label:"URL",value:gt.value}),rs.connectionId.value&&n(bv,{label:"Connection ID",value:rs.connectionId.value})]})]}),t&&n("div",{class:"grid grid-cols-2 md:grid-cols-3 gap-2 sm:gap-4",children:[n(le,{icon:ve,label:"Uptime",value:Q5.value??"—",subtext:ya.value?`Since ${ne(ya.value)}`:void 0,href:"/stats"}),n(le,{icon:ca,label:"Instances",value:kl.value.length,subtext:"Connected clients",href:"/instances"}),n(le,{icon:$n,label:"Sessions",value:Mt.value.length,subtext:"Active sessions",href:"/sessions"}),n(le,{icon:Pn,label:"Cron",value:Ja.value?.enabled?"Enabled":"Disabled",subtext:Ja.value?.nextWakeMs?`Next wake: ${nT.value}`:Ja.value?.jobCount?`${Ja.value.jobCount} jobs`:void 0,href:"/cron"}),n(le,{icon:uc,label:"Channels",value:Xr.value.length>0?gv.value:"—",subtext:Xr.value.length>0?`${gv.value}/${Xr.value.length} connected`:"No channels configured",href:"/channels"}),n(le,{icon:tu,label:"Skills",value:Br.value?.eligible??"—",subtext:Br.value?`${Br.value.eligible}/${Br.value.total} active`:void 0,href:"/skills"})]}),t&&n(G,{title:l("overview.serverInfo"),padding:"md",children:n("div",{class:"divide-y divide-[var(--color-border)]",children:[n(ii,{label:l("common.version"),value:zt.value}),n(ii,{label:l("common.commit"),value:wl.value?.substring(0,8)}),n(ii,{label:l("common.host"),value:Mo.value}),n(ii,{label:l("overview.capabilities"),value:rs.capabilities.value.length>0?l("overview.capabilitiesCount",{count:rs.capabilities.value.length}):null})]})})]})}function Ht({title:e,subtitle:t,actions:a,class:r}){const o=typeof t=="string"?n("p",{class:"text-sm text-[var(--color-text-muted)] mt-1",children:t}):t;return n("div",{class:`space-y-1 ${r??""}`,children:[n("div",{class:"flex items-center justify-between gap-3",children:[n("h1",{class:"text-xl font-semibold text-[var(--color-text-primary)]",children:e}),a&&n("div",{class:"flex items-center gap-2 flex-shrink-0",children:a})]}),o]})}const rT={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 No({icon:e,iconVariant:t="default",title:a,subtitle:r,badges:o,meta:s,actions:i,onClick:c}){const u=n("div",{class:"flex items-start gap-3 w-full",children:[n("div",{class:`p-1.5 rounded-lg flex-shrink-0 ${rT[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:a}),o]}),r&&n("div",{class:"text-xs text-[var(--color-text-muted)] font-mono truncate mb-2",children:r}),s&&s.length>0&&n("div",{class:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-[var(--color-text-muted)]",children:s.map((d,h)=>n("span",{class:"flex items-center gap-1",title:d.title,children:[d.icon&&n(d.icon,{class:"w-3 h-3"}),d.value]},`${h}-${d.value}`))})]}),i&&n("div",{class:"flex-shrink-0",children:i})]});return c?n("button",{type:"button","aria-label":a,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:u}):n("div",{class:"p-3 rounded-lg bg-[var(--color-bg-secondary)] overflow-hidden",children:u})}function oT({job:e,onRun:t,onToggleEnabled:a,isRunning:r}){return n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[n(q,{icon:n(pf,{class:"w-4 h-4"}),label:l("cron.runNow"),size:"sm",variant:"ghost",disabled:r,onClick:o=>{o.stopPropagation(),t(e)}}),n(q,{icon:e.enabled?n(Er,{class:"w-4 h-4"}):n(Lo,{class:"w-4 h-4"}),label:e.enabled?l("common.disable"):l("common.enable"),size:"sm",variant:"ghost",onClick:o=>{o.stopPropagation(),a(e)},class:e.enabled?"text-[var(--color-text-muted)]":"text-[var(--color-success)]"})]})}function sT({job:e,onEdit:t}){const a=Lf(e),r=e.delivery?.mode==="announce";return n(No,{icon:ve,iconVariant:e.enabled?a.variant==="error"?"error":"success":"default",title:e.name,badges:n(H,{children:[r&&n(hf,{class:"w-3.5 h-3.5 text-[var(--color-info)]","aria-label":l("cron.announces")}),n(Z,{variant:a.variant,size:"sm",children:a.label})]}),meta:[{icon:Ro,value:Xs(e.schedule)},{icon:zb,value:Rf(e)}],onClick:()=>t(e)})}function lT({job:e,onEdit:t,onRun:a,onToggleEnabled:r,isRunning:o}){const s=Lf(e),i=e.delivery?.mode==="announce";return n("tr",{class:"group hover:bg-[var(--color-bg-hover)] cursor-pointer transition-colors",onClick:()=>t(e),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t(e))},tabIndex:0,"aria-label":l("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(ve,{class:`w-4 h-4 ${e.enabled?"text-[var(--color-success)]":"text-[var(--color-text-muted)]"}`})}),n("div",{class:"min-w-0 flex-1",children:[n("div",{class:"font-medium truncate flex items-center gap-1.5",title:e.name,children:[e.name,i&&n(hf,{class:"w-3.5 h-3.5 text-[var(--color-info)] flex-shrink-0","aria-label":l("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(Ro,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{class:"truncate",title:Xs(e.schedule),children:Xs(e.schedule)})]})}),n("td",{class:"py-3 px-4",children:n(Z,{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(zb,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:Rf(e)})]})}),n("td",{class:"py-3 px-4",children:n(Z,{variant:s.variant,size:"sm",children:s.label})}),n("td",{class:"py-3 px-4",children:n(oT,{job:e,onRun:a,onToggleEnabled:r,isRunning:o})})]})}const Ox=["UTC","America/New_York","America/Los_Angeles","Europe/London","Europe/Paris","Europe/Berlin","Europe/Madrid","Africa/Johannesburg","Asia/Dubai","Asia/Kolkata","Asia/Shanghai","Asia/Tokyo","Asia/Singapore","America/Sao_Paulo","America/Mexico_City","Australia/Sydney","Pacific/Auckland"],iT=(()=>{try{if("supportedValuesOf"in Intl&&typeof Intl.supportedValuesOf=="function")return Intl.supportedValuesOf("timeZone")}catch{}return[]})(),Nx=(()=>{try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return e?[e]:[]}catch{return[]}})(),cT=Array.from(new Set([...Nx,...Ox,...iT])),uT=Array.from(new Set([...Nx,...Ox]));function dT(e,t=12){const a=e.trim().toLowerCase();if(!a)return uT.slice(0,t);const r=[],o=[];for(const s of cT){const i=s.toLowerCase();i.startsWith(a)?r.push(s):i.includes(a)&&o.push(s)}return[...r,...o].slice(0,t)}function hT(e){try{return new Intl.DateTimeFormat(void 0,{timeZone:e}).format(0),!0}catch{return!1}}let xv=0;function fT({value:e,onValueChange:t,suggestions:a,onSelectSuggestion:r,minCharsToOpen:o=2,clearable:s=!1,clearAriaLabel:i="Clear",fullWidth:c=!1,...u}){const[d,h]=U(!1),[f,p]=U(-1),v=F(null),w=F(null),C=F("");C.current||(xv+=1,C.current=`autocomplete-input-${xv}-listbox`);const T=e.trim().length>=o,b=T?a:[],g=d&&b.length>0,y=g&&f>=0?`${C.current}-option-${f}`:void 0,E=Q(()=>{h(!1),p(-1)},[]);Ia(v,E,d);const x=Q(I=>{t(I),r?.(I),E()},[E,r,t]),S=I=>{if(I.key==="ArrowDown"){if(!g){b.length>0&&(I.preventDefault(),h(!0),p(0));return}I.preventDefault(),p(A=>Math.min(A+1,b.length-1));return}if(I.key==="ArrowUp"&&g){I.preventDefault(),p(A=>Math.max(A-1,0));return}if(I.key==="Enter"&&g&&f>=0){I.preventDefault(),x(b[f]);return}if(I.key==="Escape"&&d){I.preventDefault(),E();return}I.key==="Tab"&&d&&E()},k=s&&e.trim().length>0;return n("div",{ref:v,class:`relative ${c?"w-full":""}`,children:[n(Y,{...u,ref:w,value:e,onInput:I=>{t(I.target.value),d||h(!0),p(-1)},onFocus:()=>{T&&b.length>0&&h(!0)},onKeyDown:S,autoComplete:"off",role:"combobox","aria-autocomplete":"list","aria-expanded":g,"aria-controls":C.current,"aria-activedescendant":y,rightElement:k?n("button",{type:"button","aria-label":i,class:"rounded-full text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)] focus:ring-offset-0",onMouseDown:I=>I.preventDefault(),onClick:()=>{t(""),p(-1),h(!0),w.current?.focus()},children:n(Er,{class:"w-4 h-4"})}):void 0,fullWidth:c}),g&&n("div",{id:C.current,role:"listbox",class:"absolute z-30 top-full mt-1 left-0 right-0 rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-primary)] shadow-lg overflow-y-auto max-h-56",children:b.map((I,A)=>n("button",{id:`${C.current}-option-${A}`,type:"button",role:"option","aria-selected":A===f,class:`w-full text-left px-3 py-2 text-sm transition-colors ${A===f?"bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)]":"text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-secondary)]"}`,onMouseEnter:()=>p(A),onMouseDown:O=>{O.preventDefault(),x(I)},children:I},I))})]})}function pT({isOpen:e,onToggle:t,collapsedLabel:a,expandedLabel:r,children:o,class:s,buttonClass:i,contentClass:c}){return n("div",{class:s,children:[n("button",{type:"button",class:i||"inline-flex items-center gap-1.5 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors",onClick:()=>t(!e),"aria-expanded":e,children:[e?n(Ne,{class:"w-3.5 h-3.5","aria-hidden":"true"}):n(Ve,{class:"w-3.5 h-3.5","aria-hidden":"true"}),e?r??a:a]}),e&&n("div",{class:c,children:o})]})}function tr({class:e="",fullWidth:t=!1,rows:a=3,error:r=!1,...o}){return n("textarea",{rows:a,class:`
401
+ `;return d?u&&!s?n("a",{href:u,class:f,children:h}):n("button",{type:"button",onClick:s,class:f,children:h}):n("div",{class:f,children:h})}const Ja=m(null),Xr=m([]),Br=m(null);async function eT(){if(D.value){try{const e=await N("cron.status");Ja.value={enabled:e.enabled??!1,jobCount:e.jobs??0,nextWakeMs:e.nextWakeAtMs??null}}catch{Ja.value=null}try{const e=await N("channels.status"),t=[],a=e.channelOrder??[];for(const r of a){const o=e.channelAccounts?.[r]??[];for(const s of o)t.push({id:s.accountId,type:r,connected:s.connected??s.running??!1})}Xr.value=t}catch{Xr.value=[]}try{const t=(await N("skills.status")).skills??[];Br.value={total:t.length,eligible:t.filter(a=>a.eligible).length}}catch{Br.value=null}}}const tT=K(()=>{const e=Hh.value;return e==null?null:Qg(e)}),nT=K(()=>window.location.protocol==="https:"||window.location.hostname==="localhost"),aT=K(()=>gt.value?.startsWith("wss://")??!1),vv=K(()=>Xr.value.filter(e=>e.connected).length),rT=K(()=>{const e=Ja.value?.nextWakeMs;if(!e)return null;const t=Date.now(),a=e-t;return a<0?"now":a<6e4?`${Math.floor(a/1e3)}s`:a<36e5?`${Math.floor(a/6e4)}m`:a<864e5?`${Math.floor(a/36e5)}h`:`${Math.floor(a/864e5)}d`});function gv({value:e,label:t}){const[a,r]=U(!1);return n("div",{class:"py-2",children:[n("div",{class:"flex items-center justify-between mb-1",children:[n("span",{class:"text-[var(--color-text-muted)] text-sm",children:t}),n(q,{onClick:async()=>{try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),2e3)}catch{V.error(l("status.copyFailed",{label:t}))}},icon:a?n(on,{class:"text-[var(--color-success)]"}):n(El,{}),label:`Copy ${t}`,size:"sm",variant:"ghost",class:"flex-shrink-0"})]}),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 bv({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 oT(e){const t=D.value,a=Ue.value;return R(()=>{t&&eT()},[t]),n(sn,{viewName:l("common.overview"),children:[!nT.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(Aa,{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&&gt.value&&!aT.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(Zc,{class:"w-5 h-5 text-[var(--color-warning)] flex-shrink-0 mt-0.5"}),n("div",{children:[n("div",{class:"font-medium text-[var(--color-warning)]",children:"Insecure WebSocket"}),n("p",{class:"text-sm text-[var(--color-text-secondary)] mt-1",children:["Connected via ",n("code",{class:"bg-[var(--color-bg-secondary)] px-1 rounded",children:"ws://"})," ","instead of ",n("code",{class:"bg-[var(--color-bg-secondary)] px-1 rounded",children:"wss://"}),". Traffic is not encrypted."]})]})]}),n(G,{padding:"md",children:[n("div",{class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[n("div",{class:"flex items-center gap-3",children:[t?n("div",{class:"p-2 rounded-lg bg-[var(--color-success)]/10",children:n(cc,{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(jb,{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(Z,{variant:t?"success":a==="connecting"?"warning":"error",dot:!0,size:"sm",children:l(a==="connected"?"common.healthy":a==="connecting"||a==="authenticating"?"status.connecting":a==="reconnecting"?"status.reconnecting":"status.disconnected")})]})]}),t&&n(P,{variant:"secondary",size:"sm",onClick:()=>ho(),children:"Disconnect"})]}),t&&gt.value&&n("div",{class:"border-t border-[var(--color-border)] pt-4 mt-4 space-y-1",children:[n(gv,{label:"URL",value:gt.value}),rs.connectionId.value&&n(gv,{label:"Connection ID",value:rs.connectionId.value})]})]}),t&&n("div",{class:"grid grid-cols-2 md:grid-cols-3 gap-2 sm:gap-4",children:[n(le,{icon:ge,label:"Uptime",value:tT.value??"—",subtext:ya.value?`Since ${ae(ya.value)}`:void 0,href:"/stats"}),n(le,{icon:ca,label:"Instances",value:kl.value.length,subtext:"Connected clients",href:"/instances"}),n(le,{icon:Pn,label:"Sessions",value:It.value.length,subtext:"Active sessions",href:"/sessions"}),n(le,{icon:Nn,label:"Cron",value:Ja.value?.enabled?"Enabled":"Disabled",subtext:Ja.value?.nextWakeMs?`Next wake: ${rT.value}`:Ja.value?.jobCount?`${Ja.value.jobCount} jobs`:void 0,href:"/cron"}),n(le,{icon:ic,label:"Channels",value:Xr.value.length>0?vv.value:"—",subtext:Xr.value.length>0?`${vv.value}/${Xr.value.length} connected`:"No channels configured",href:"/channels"}),n(le,{icon:Xc,label:"Skills",value:Br.value?.eligible??"—",subtext:Br.value?`${Br.value.eligible}/${Br.value.total} active`:void 0,href:"/skills"})]}),t&&n(G,{title:l("overview.serverInfo"),padding:"md",children:n("div",{class:"divide-y divide-[var(--color-border)]",children:[n(bv,{label:l("common.version"),value:jt.value}),n(bv,{label:l("overview.capabilities"),value:rs.capabilities.value.length>0?l("overview.capabilitiesCount",{count:rs.capabilities.value.length}):null})]})})]})}function Wt({title:e,subtitle:t,actions:a,class:r}){const o=typeof t=="string"?n("p",{class:"text-sm text-[var(--color-text-muted)] mt-1",children:t}):t;return n("div",{class:`space-y-1 ${r??""}`,children:[n("div",{class:"flex items-center justify-between gap-3",children:[n("h1",{class:"text-xl font-semibold text-[var(--color-text-primary)]",children:e}),a&&n("div",{class:"flex items-center gap-2 flex-shrink-0",children:a})]}),o]})}const sT={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 No({icon:e,iconVariant:t="default",title:a,subtitle:r,badges:o,meta:s,actions:i,onClick:c}){const u=n("div",{class:"flex items-start gap-3 w-full",children:[n("div",{class:`p-1.5 rounded-lg flex-shrink-0 ${sT[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:a}),o]}),r&&n("div",{class:"text-xs text-[var(--color-text-muted)] font-mono truncate mb-2",children:r}),s&&s.length>0&&n("div",{class:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-[var(--color-text-muted)]",children:s.map((d,h)=>n("span",{class:"flex items-center gap-1",title:d.title,children:[d.icon&&n(d.icon,{class:"w-3 h-3"}),d.value]},`${h}-${d.value}`))})]}),i&&n("div",{class:"flex-shrink-0",children:i})]});return c?n("button",{type:"button","aria-label":a,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:u}):n("div",{class:"p-3 rounded-lg bg-[var(--color-bg-secondary)] overflow-hidden",children:u})}function lT({job:e,onRun:t,onToggleEnabled:a,isRunning:r}){return n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[n(q,{icon:n(hf,{class:"w-4 h-4"}),label:l("cron.runNow"),size:"sm",variant:"ghost",disabled:r,onClick:o=>{o.stopPropagation(),t(e)}}),n(q,{icon:e.enabled?n(Er,{class:"w-4 h-4"}):n(Lo,{class:"w-4 h-4"}),label:e.enabled?l("common.disable"):l("common.enable"),size:"sm",variant:"ghost",onClick:o=>{o.stopPropagation(),a(e)},class:e.enabled?"text-[var(--color-text-muted)]":"text-[var(--color-success)]"})]})}function iT({job:e,onEdit:t}){const a=Rf(e),r=e.delivery?.mode==="announce";return n(No,{icon:ge,iconVariant:e.enabled?a.variant==="error"?"error":"success":"default",title:e.name,badges:n(H,{children:[r&&n(uf,{class:"w-3.5 h-3.5 text-[var(--color-info)]","aria-label":l("cron.announces")}),n(Z,{variant:a.variant,size:"sm",children:a.label})]}),meta:[{icon:Ro,value:Qs(e.schedule)},{icon:zb,value:If(e)}],onClick:()=>t(e)})}function cT({job:e,onEdit:t,onRun:a,onToggleEnabled:r,isRunning:o}){const s=Rf(e),i=e.delivery?.mode==="announce";return n("tr",{class:"group hover:bg-[var(--color-bg-hover)] cursor-pointer transition-colors",onClick:()=>t(e),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t(e))},tabIndex:0,"aria-label":l("cron.editJob",{name:e.name}),children:[n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-3",children:[n("div",{class:`p-1.5 rounded-lg flex-shrink-0 ${e.enabled?"bg-[var(--color-success)]/10":"bg-[var(--color-bg-tertiary)]"}`,children:n(ge,{class:`w-4 h-4 ${e.enabled?"text-[var(--color-success)]":"text-[var(--color-text-muted)]"}`})}),n("div",{class:"min-w-0 flex-1",children:[n("div",{class:"font-medium truncate flex items-center gap-1.5",title:e.name,children:[e.name,i&&n(uf,{class:"w-3.5 h-3.5 text-[var(--color-info)] flex-shrink-0","aria-label":l("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(Ro,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{class:"truncate",title:Qs(e.schedule),children:Qs(e.schedule)})]})}),n("td",{class:"py-3 px-4",children:n(Z,{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(zb,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:If(e)})]})}),n("td",{class:"py-3 px-4",children:n(Z,{variant:s.variant,size:"sm",children:s.label})}),n("td",{class:"py-3 px-4",children:n(lT,{job:e,onRun:a,onToggleEnabled:r,isRunning:o})})]})}const Ox=["UTC","America/New_York","America/Los_Angeles","Europe/London","Europe/Paris","Europe/Berlin","Europe/Madrid","Africa/Johannesburg","Asia/Dubai","Asia/Kolkata","Asia/Shanghai","Asia/Tokyo","Asia/Singapore","America/Sao_Paulo","America/Mexico_City","Australia/Sydney","Pacific/Auckland"],uT=(()=>{try{if("supportedValuesOf"in Intl&&typeof Intl.supportedValuesOf=="function")return Intl.supportedValuesOf("timeZone")}catch{}return[]})(),Nx=(()=>{try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return e?[e]:[]}catch{return[]}})(),dT=Array.from(new Set([...Nx,...Ox,...uT])),hT=Array.from(new Set([...Nx,...Ox]));function fT(e,t=12){const a=e.trim().toLowerCase();if(!a)return hT.slice(0,t);const r=[],o=[];for(const s of dT){const i=s.toLowerCase();i.startsWith(a)?r.push(s):i.includes(a)&&o.push(s)}return[...r,...o].slice(0,t)}function pT(e){try{return new Intl.DateTimeFormat(void 0,{timeZone:e}).format(0),!0}catch{return!1}}let xv=0;function mT({value:e,onValueChange:t,suggestions:a,onSelectSuggestion:r,minCharsToOpen:o=2,clearable:s=!1,clearAriaLabel:i="Clear",fullWidth:c=!1,...u}){const[d,h]=U(!1),[f,p]=U(-1),v=F(null),w=F(null),C=F("");C.current||(xv+=1,C.current=`autocomplete-input-${xv}-listbox`);const T=e.trim().length>=o,b=T?a:[],g=d&&b.length>0,y=g&&f>=0?`${C.current}-option-${f}`:void 0,E=Q(()=>{h(!1),p(-1)},[]);Ia(v,E,d);const x=Q(I=>{t(I),r?.(I),E()},[E,r,t]),S=I=>{if(I.key==="ArrowDown"){if(!g){b.length>0&&(I.preventDefault(),h(!0),p(0));return}I.preventDefault(),p(A=>Math.min(A+1,b.length-1));return}if(I.key==="ArrowUp"&&g){I.preventDefault(),p(A=>Math.max(A-1,0));return}if(I.key==="Enter"&&g&&f>=0){I.preventDefault(),x(b[f]);return}if(I.key==="Escape"&&d){I.preventDefault(),E();return}I.key==="Tab"&&d&&E()},k=s&&e.trim().length>0;return n("div",{ref:v,class:`relative ${c?"w-full":""}`,children:[n(Y,{...u,ref:w,value:e,onInput:I=>{t(I.target.value),d||h(!0),p(-1)},onFocus:()=>{T&&b.length>0&&h(!0)},onKeyDown:S,autoComplete:"off",role:"combobox","aria-autocomplete":"list","aria-expanded":g,"aria-controls":C.current,"aria-activedescendant":y,rightElement:k?n("button",{type:"button","aria-label":i,class:"rounded-full text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)] focus:ring-offset-0",onMouseDown:I=>I.preventDefault(),onClick:()=>{t(""),p(-1),h(!0),w.current?.focus()},children:n(Er,{class:"w-4 h-4"})}):void 0,fullWidth:c}),g&&n("div",{id:C.current,role:"listbox",class:"absolute z-30 top-full mt-1 left-0 right-0 rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-primary)] shadow-lg overflow-y-auto max-h-56",children:b.map((I,A)=>n("button",{id:`${C.current}-option-${A}`,type:"button",role:"option","aria-selected":A===f,class:`w-full text-left px-3 py-2 text-sm transition-colors ${A===f?"bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)]":"text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-secondary)]"}`,onMouseEnter:()=>p(A),onMouseDown:O=>{O.preventDefault(),x(I)},children:I},I))})]})}function vT({isOpen:e,onToggle:t,collapsedLabel:a,expandedLabel:r,children:o,class:s,buttonClass:i,contentClass:c}){return n("div",{class:s,children:[n("button",{type:"button",class:i||"inline-flex items-center gap-1.5 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors",onClick:()=>t(!e),"aria-expanded":e,children:[e?n(Ne,{class:"w-3.5 h-3.5","aria-hidden":"true"}):n(Ve,{class:"w-3.5 h-3.5","aria-hidden":"true"}),e?r??a:a]}),e&&n("div",{class:c,children:o})]})}function tr({class:e="",fullWidth:t=!1,rows:a=3,error:r=!1,...o}){return n("textarea",{rows:a,class:`
402
402
  px-3 py-2 text-sm rounded-lg resize-y
403
403
  bg-[var(--color-bg-primary)]
404
404
  text-[var(--color-text-primary)]
@@ -409,19 +409,19 @@ ${t.stack}`]})}),n("button",{type:"button",onClick:this.copyError,class:"absolut
409
409
  ${r?"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)]"}
410
410
  ${t?"w-full":""}
411
411
  ${e}
412
- `,...o})}function mT({label:e,selected:t,onClick:a,title:r,size:o="md"}){return n("button",{type:"button",onClick:a,title:r,class:`
412
+ `,...o})}function gT({label:e,selected:t,onClick:a,title:r,size:o="md"}){return n("button",{type:"button",onClick:a,title:r,class:`
413
413
  ${o==="sm"?"px-2.5 py-1 text-xs":"px-3 py-1.5 text-sm"} rounded-lg border transition-colors
414
414
  ${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)]"}
415
- `,children:e})}function yv({options:e,value:t,onChange:a,size:r="md"}){return n("div",{class:"flex flex-wrap gap-2",children:e.map(o=>n(mT,{label:o.label,selected:t===o.value,onClick:()=>a(o.value),title:String(o.value),size:r},o.value))})}const vT=[{value:"cron",label:l("cron.scheduleKind.cron")},{value:"every",label:l("cron.scheduleKind.every")},{value:"at",label:l("cron.scheduleKind.at")}],gT=[{value:"main",label:l("cron.sessionTarget.main")},{value:"isolated",label:l("cron.sessionTarget.isolated")}],bT=[{value:"next-heartbeat",label:l("cron.wakeMode.nextHeartbeat")},{value:"now",label:l("cron.wakeMode.now")}];function xT({editName:e,editDescription:t,editScheduleKind:a,editScheduleExpr:r,editScheduleTz:o,editScheduleStaggerMs:s,editScheduleEveryMs:i,editScheduleAtMs:c,editSessionTarget:u,editWakeMode:d,editDeliveryAnnounce:h,editPayloadText:f,editPayloadMessage:p,editPayloadModel:v,formErrors:w}){const C=w.value,T=X(!1),b=X(!1),g=o.value.trim(),y=dT(g,8),E=k=>{if(u.value==="main"){f.value=k;return}p.value=k},x=u.value==="main"?f.value:p.value,S=u.value==="main"?l("cron.form.systemEventPlaceholder"):l("cron.form.agentMessagePlaceholder");return R(()=>{if(a.value!=="cron"){T.value=!1;return}s.value.trim()&&(T.value=!0)},[a.value,s.value]),n("div",{class:"space-y-4 sm:space-y-5",children:[n(De,{label:l("common.name"),error:C.name,children:n(Y,{value:e.value,onInput:k=>e.value=k.target.value,placeholder:l("cron.form.namePlaceholder"),error:!!C.name,fullWidth:!0})}),n(De,{label:l("cron.form.description"),hint:l("cron.form.descriptionHint"),children:n(Y,{value:t.value,onInput:k=>t.value=k.target.value,placeholder:l("cron.form.descriptionPlaceholder"),fullWidth:!0})}),n(De,{label:l("common.schedule"),error:C.schedule,children:n("div",{class:"space-y-3",children:[n(Ae,{value:a.value,onChange:k=>a.value=k,options:vT}),a.value==="cron"&&n("div",{class:"space-y-3",children:[n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[n(Y,{value:r.value,onInput:k=>r.value=k.target.value,placeholder:l("cron.form.cronPlaceholder"),fullWidth:!0}),n(fT,{value:o.value,onValueChange:k=>o.value=k,suggestions:y,placeholder:l("cron.form.timezonePlaceholder"),"aria-label":l("cron.form.timezone"),minCharsToOpen:0,clearable:!0,clearAriaLabel:l("actions.clear"),fullWidth:!0})]}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:l("cron.form.timezoneHint")}),n(yv,{options:$C.map(({expr:k,label:I})=>({value:k,label:I})),value:r.value,onChange:k=>r.value=k,size:"sm"}),n(pT,{isOpen:T.value,onToggle:k=>T.value=k,collapsedLabel:l("cron.form.showAdvanced"),expandedLabel:l("cron.form.hideAdvanced"),contentClass:"mt-2",children:n(De,{label:l("cron.form.staggerMs"),hint:l("cron.form.staggerMsHint"),children:n(Y,{type:"number",min:0,step:1,value:s.value,onInput:k=>s.value=k.target.value,placeholder:l("cron.form.staggerMsPlaceholder"),fullWidth:!0})})})]}),a.value==="every"&&n("div",{class:"space-y-2",children:[n(yv,{options:LC.map(({ms:k,label:I})=>({value:String(k),label:I})),value:i.value,onChange:k=>i.value=k}),n(Y,{type:"number",value:i.value,onInput:k=>i.value=k.target.value,placeholder:l("cron.form.intervalPlaceholder"),fullWidth:!0})]}),a.value==="at"&&n(Y,{type:"datetime-local",value:AC(Number(c.value)||Date.now()),onInput:k=>{const I=k.target.value;c.value=String(MC(I))},fullWidth:!0})]})}),n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",children:[n(De,{label:l("cron.form.sessionTarget"),hint:l("cron.form.sessionTargetHint"),children:n(Ae,{value:u.value,onChange:k=>{u.value=k},options:gT})}),n(De,{label:l("cron.form.wakeMode"),hint:l("cron.form.wakeModeHint"),children:n(Ae,{value:d.value,onChange:k=>d.value=k,options:bT})})]}),u.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:l("cron.form.announceResults")}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("cron.form.announceResultsHint")})]}),n(Be,{checked:h.value,onChange:k=>h.value=k,label:l("cron.form.announceResults")})]}),n(De,{label:l("cron.form.payload"),labelAction:n(P,{type:"button",size:"sm",variant:"secondary",icon:n(Db,{class:"w-4 h-4"}),onClick:()=>b.value=!0,class:"sm:hidden",children:l("cron.form.expandPayloadEditor")}),error:C.payload,hint:u.value==="main"?l("cron.form.payloadHintMain"):l("cron.form.payloadHintIsolated"),children:u.value==="main"?n(tr,{value:f.value,onInput:k=>f.value=k.target.value,placeholder:l("cron.form.systemEventPlaceholder"),error:!!C.payload,rows:3,fullWidth:!0}):n("div",{class:"space-y-3",children:[n(tr,{value:p.value,onInput:k=>p.value=k.target.value,placeholder:l("cron.form.agentMessagePlaceholder"),error:!!C.payload,rows:3,fullWidth:!0}),n(Y,{value:v.value,onInput:k=>v.value=k.target.value,placeholder:l("cron.form.modelPlaceholder"),fullWidth:!0})]})}),b.value&&n("div",{class:"fixed inset-0 z-[60] sm:hidden bg-[var(--color-bg-surface)] flex flex-col",children:[n("div",{class:"flex items-center justify-between px-4 py-3 border-b border-[var(--color-border)]",children:[n("h4",{class:"text-base font-semibold text-[var(--color-text-primary)]",children:l("cron.form.fullscreenPayloadTitle")}),n(P,{type:"button",size:"sm",variant:"secondary",onClick:()=>b.value=!1,children:l("actions.done")})]}),n("div",{class:"flex-1 p-4 pb-[max(env(safe-area-inset-bottom),1rem)] overflow-y-auto",children:n(tr,{value:x,onInput:k=>E(k.target.value),placeholder:S,error:!!C.payload,rows:12,fullWidth:!0,class:"min-h-[60vh] h-full resize-none"})})]})]})}function Zu({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 yT({mode:e,job:t,runs:a,isLoadingRuns:r,isDeleting:o,isSaving:s,isRunning:i,hasChanges:c,onClose:u,onSave:d,onDelete:h,onRun:f,onSetDeleting:p,editName:v,editDescription:w,editEnabled:C,editScheduleKind:T,editScheduleExpr:b,editScheduleTz:g,editScheduleStaggerMs:y,editScheduleEveryMs:E,editScheduleAtMs:x,editSessionTarget:S,editWakeMode:k,editDeliveryAnnounce:I,editPayloadText:A,editPayloadMessage:O,editPayloadModel:z,formErrors:se}){if(!e)return null;const Fe=e==="edit",tt=t?Lf(t):null;return n(We,{open:!!e,onClose:u,title:Fe&&t?t.name:l("cron.createJob"),size:"xl",footer:o?n(Pf,{message:l("cron.confirmDelete"),onCancel:()=>p(!1),onDelete:h}):n(Px,{isEdit:Fe&&!!t,onDeleteClick:()=>p(!0),onCancel:u,onSave:d,isSaving:s,saveDisabled:!c,saveLabel:l(Fe?"actions.save":"common.create"),extraContent:n("div",{class:"flex items-center justify-between sm:justify-start gap-2",children:[n("span",{class:"text-sm text-[var(--color-text-secondary)]",children:C.value?l("common.enabled"):l("common.disabled")}),n(Be,{checked:C.value,onChange:Re=>C.value=Re})]})}),children:n("div",{class:"space-y-4 sm:space-y-6",children:[Fe&&t&&tt&&n(H,{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(ve,{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(Z,{variant:tt.variant,size:"sm",children:tt.label}),n(Z,{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:Xs(t.schedule)})]})]}),n(P,{size:"sm",variant:"secondary",icon:n(pf,{class:"w-4 h-4"}),onClick:()=>f(t),disabled:i,fullWidth:!0,class:"sm:w-auto",children:l("cron.runNow")})]}),n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(Zu,{value:Rf(t),label:l("common.nextRun")}),n(Zu,{value:IC(t),label:l("cron.lastRun")}),n(Zu,{value:t.state.lastDurationMs?`${Math.round(t.state.lastDurationMs/1e3)}s`:"—",label:l("cron.lastDuration")})]})]}),n(xT,{editName:v,editDescription:w,editScheduleKind:T,editScheduleExpr:b,editScheduleTz:g,editScheduleStaggerMs:y,editScheduleEveryMs:E,editScheduleAtMs:x,editSessionTarget:S,editWakeMode:k,editDeliveryAnnounce:I,editPayloadText:A,editPayloadMessage:O,editPayloadModel:z,formErrors:se}),Fe&&n("div",{children:[n("h4",{class:"text-sm font-medium mb-3",children:l("cron.recentRuns")}),r?n("div",{class:"flex justify-center py-4",children:n(te,{size:"sm"})}):a.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] text-center py-4",children:l("cron.noRuns")}):n("div",{class:"space-y-2 max-h-48 overflow-y-auto",children:a.map(Re=>n("div",{class:"flex items-center gap-3 p-2 rounded-lg bg-[var(--color-bg-secondary)] text-sm",children:[Re.status==="ok"?n(Lo,{class:"w-4 h-4 text-[var(--color-success)]"}):Re.status==="error"?n(Er,{class:"w-4 h-4 text-[var(--color-error)]"}):n(ve,{class:"w-4 h-4 text-[var(--color-warning)]"}),n("span",{class:"flex-1",children:ne(Re.runAtMs)}),Re.durationMs&&n("span",{class:"text-[var(--color-text-muted)]",children:[Math.round(Re.durationMs/1e3),"s"]}),Re.error&&n("span",{class:"text-[var(--color-error)] truncate max-w-[200px]",title:Re.error,children:Re.error})]},Re.runAtMs))})]})]})})}const _a=m([]),Fx=m(null),Vd=m(!1),vr=m(null),zx=m(""),Gd=m("all"),iu=m(null),Ca=m(null),Qs=m([]),Jd=m(!1),Ux=m(!1),Yd=m(!1),Zd=m(!1),gr=m(""),vo=m(""),go=m(!0),Jt=m("cron"),Ta=m(""),Ea=m(""),br=m(""),xr=m(""),yr=m(""),bo=m("next-heartbeat"),An=m("main"),xo=m(!1),yo=m(""),wo=m(""),ko=m(""),cu=m({});function Nf(e){const t=e.trim();if(!t)return;if(!/^\d+$/.test(t))return null;const a=Number(t);return!Number.isSafeInteger(a)||a<0?null:a}function wv(e){return e?.trim()??""}const wT=K(()=>{let e=_a.value;Gd.value==="enabled"?e=e.filter(a=>a.enabled):Gd.value==="disabled"&&(e=e.filter(a=>!a.enabled));const t=zx.value.toLowerCase().trim();return t&&(e=e.filter(a=>{const r=a.name.toLowerCase(),o=(a.description||"").toLowerCase();return r.includes(t)||o.includes(t)})),[...e].sort((a,r)=>{if(a.enabled!==r.enabled)return a.enabled?-1:1;const o=a.state.nextRunAtMs??1/0,s=r.state.nextRunAtMs??1/0;return o-s})}),kT=K(()=>{const e={total:0,enabled:0,disabled:0};for(const t of _a.value)e.total++,t.enabled?e.enabled++:e.disabled++;return e});async function wc(){Vd.value=!0,vr.value=null;const[e,t]=await Promise.allSettled([N("cron.status",{}),N("cron.list",{includeDisabled:!0})]);e.status==="fulfilled"&&(Fx.value=e.value),t.status==="fulfilled"&&(_a.value=t.value.jobs??[]);const a=[];e.status==="rejected"&&a.push(`Status: ${ae(e.reason)}`),t.status==="rejected"&&a.push(`Jobs: ${ae(t.reason)}`),a.length>0&&(vr.value=a.join("; ")),Vd.value=!1}async function ST(e){Jd.value=!0;try{const t=await N("cron.runs",{jobId:e,limit:20});Qs.value=t.entries??[]}catch{Qs.value=[]}finally{Jd.value=!1}}function _T(e){gr.value=e.name,vo.value=e.description??"",go.value=e.enabled,Jt.value=e.schedule.kind,Ta.value="",Ea.value="",br.value="",xr.value="",yr.value="",e.schedule.kind==="cron"?(Ta.value=e.schedule.expr,Ea.value=e.schedule.tz??"",br.value=e.schedule.staggerMs!==void 0?String(e.schedule.staggerMs):""):e.schedule.kind==="every"?xr.value=String(e.schedule.everyMs):e.schedule.kind==="at"&&(yr.value=String(e.schedule.atMs)),bo.value=e.wakeMode,An.value=e.sessionTarget,xo.value=e.delivery?.mode==="announce",e.payload.kind==="systemEvent"?yo.value=e.payload.text:(wo.value=e.payload.message,ko.value=e.payload.model??""),cu.value={}}function CT(){gr.value="",vo.value="",go.value=!0,Jt.value="cron",Ta.value="",Ea.value="",br.value="",xr.value="",yr.value="",bo.value="next-heartbeat",An.value="main",xo.value=!1,yo.value="",wo.value="",ko.value="",cu.value={}}function TT(e,t){e==="edit"&&t?(Ca.value=t,_T(t),ST(t.id)):(Ca.value=null,CT(),Qs.value=[]),iu.value=e}function Ff(){iu.value=null,Ca.value=null,Qs.value=[],Ux.value=!1}function ET(){const e={};if(gr.value.trim()||(e.name=l("cron.validation.nameRequired")),Jt.value==="cron")Ta.value.trim()?RC(Ta.value)?Ea.value.trim()&&!hT(Ea.value.trim())?e.schedule=l("cron.validation.timezoneInvalid"):Nf(br.value)===null&&(e.schedule=l("cron.validation.staggerNonNegative")):e.schedule=l("cron.validation.cronInvalid"):e.schedule=l("cron.validation.cronRequired");else if(Jt.value==="every"){const t=parseInt(xr.value,10);(!t||t<1e3)&&(e.schedule=l("cron.validation.intervalMin"))}else if(Jt.value==="at"){const t=parseInt(yr.value,10);(!t||t<Date.now())&&(e.schedule=l("cron.validation.atFuture"))}return An.value==="main"?yo.value.trim()||(e.payload=l("cron.validation.payloadRequired")):wo.value.trim()||(e.payload=l("cron.validation.payloadRequired")),cu.value=e,Object.keys(e).length===0}function kv(){switch(Jt.value){case"cron":{const e=Nf(br.value),t=Ea.value.trim();return{kind:"cron",expr:Ta.value,...t?{tz:t}:{},...typeof e=="number"?{staggerMs:e}:{}}}case"every":return{kind:"every",everyMs:parseInt(xr.value,10)||6e4};case"at":return{kind:"at",atMs:parseInt(yr.value,10)||Date.now()}}}function Sv(){return An.value==="main"?{kind:"systemEvent",text:yo.value}:{kind:"agentTurn",message:wo.value,...ko.value?{model:ko.value}:{}}}async function AT(){if(ET()){Yd.value=!0;try{if(iu.value==="edit"&&Ca.value){const e={name:gr.value,description:vo.value||void 0,enabled:go.value,schedule:kv(),sessionTarget:An.value,wakeMode:bo.value,payload:Sv(),delivery:{mode:xo.value?"announce":"none"}};await N("cron.update",{jobId:Ca.value.id,patch:e})}else{const e={name:gr.value,description:vo.value||void 0,enabled:go.value,schedule:kv(),sessionTarget:An.value,wakeMode:bo.value,payload:Sv(),delivery:{mode:xo.value?"announce":"none"}};await N("cron.add",{job:e})}await wc(),Ff()}catch(e){vr.value=ae(e)}finally{Yd.value=!1}}}async function MT(){const e=Ca.value;if(e)try{await N("cron.remove",{jobId:e.id}),_a.value=_a.value.filter(t=>t.id!==e.id),Ff()}catch(t){vr.value=ae(t)}}async function IT(e){Zd.value=!0;try{await N("cron.run",{jobId:e.id,mode:"force"}),await wc()}catch(t){vr.value=ae(t)}finally{Zd.value=!1}}async function RT(e){try{await N("cron.update",{jobId:e.id,patch:{enabled:!e.enabled}}),_a.value=_a.value.map(t=>t.id===e.id?{...t,enabled:!t.enabled}:t)}catch(t){vr.value=ae(t)}}function LT(){R(()=>{D.value&&wc()},[D.value]);const e=jc(()=>{const t=Ca.value;if(!t||gr.value!==t.name||vo.value!==(t.description??"")||go.value!==t.enabled||Jt.value!==t.schedule.kind||bo.value!==t.wakeMode||An.value!==t.sessionTarget||xo.value!==(t.delivery?.mode==="announce"))return!0;if(t.schedule.kind==="cron"&&Jt.value==="cron"){if(Ta.value!==t.schedule.expr||wv(Ea.value)!==wv(t.schedule.tz))return!0;const a=Nf(br.value);if(a===null||(a??void 0)!==(t.schedule.staggerMs??void 0))return!0}else if(t.schedule.kind==="every"&&Jt.value==="every"){if(xr.value!==String(t.schedule.everyMs))return!0}else if(t.schedule.kind==="at"&&Jt.value==="at"&&yr.value!==String(t.schedule.atMs))return!0;if(t.payload.kind==="systemEvent"&&An.value==="main"){if(yo.value!==t.payload.text)return!0}else if(t.payload.kind==="agentTurn"&&An.value==="isolated"&&(wo.value!==t.payload.message||ko.value!==(t.payload.model??"")))return!0;return!1});return{state:{cronJobs:_a,cronStatus:Fx,isLoading:Vd,error:vr,searchQuery:zx,statusFilter:Gd},modal:{modalMode:iu,selectedJob:Ca,selectedJobRuns:Qs,isLoadingRuns:Jd,isDeleting:Ux,isSaving:Yd,isRunning:Zd},form:{editName:gr,editDescription:vo,editEnabled:go,editScheduleKind:Jt,editScheduleExpr:Ta,editScheduleTz:Ea,editScheduleStaggerMs:br,editScheduleEveryMs:xr,editScheduleAtMs:yr,editWakeMode:bo,editSessionTarget:An,editDeliveryAnnounce:xo,editPayloadText:yo,editPayloadMessage:wo,editPayloadModel:ko,formErrors:cu},computed:{filteredJobs:wT,jobCounts:kT,hasFormChanges:e},actions:{loadCronJobs:wc,openJobModal:TT,closeModal:Ff,saveOrCreateJob:AT,deleteJob:MT,runJobNow:IT,toggleJobEnabled:RT}}}function $T(e){const{state:t,modal:a,form:r,computed:o,actions:s}=LT(),i=!t.isLoading.value&&t.cronJobs.value.length>0,[c,u]=he("q"),[d,h]=he("filter"),[f,p,v]=he("job",{ready:i});He(c,t.searchQuery,b=>b),He(d,t.statusFilter,b=>b),Mr(t.searchQuery,u),Rn(t.statusFilter,h,"all"),R(()=>{if(i)if(f.value){const b=t.cronJobs.value.find(g=>g.id===f.value);b&&a.selectedJob.value?.id!==b.id&&s.openJobModal("edit",b)}else a.selectedJob.value&&a.modalMode.value==="edit"&&s.closeModal()},[f.value,i]),R(()=>{v.value&&!a.selectedJob.value&&f.value&&p(null)},[a.selectedJob.value,v.value]);const w=(b,g)=>{b==="edit"&&g&&(p(g.id),ru()),s.openJobModal(b,g)},C=()=>{p(null),s.closeModal()},T=o.jobCounts.value;return n(sn,{viewName:l("common.cronJobs"),children:[n(Ht,{title:l("common.cronJobs"),subtitle:l("cron.description"),actions:n(H,{children:[D.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&n("div",{class:"relative hidden sm:block",children:[n(ct,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Y,{type:"text",value:t.searchQuery.value,onInput:b=>t.searchQuery.value=b.target.value,placeholder:l("cron.searchPlaceholder"),"aria-label":l("cron.searchPlaceholder"),class:"pl-10 w-64"})]}),n(P,{icon:n(Sa,{class:"w-4 h-4"}),onClick:()=>w("create"),disabled:!D.value,children:[n("span",{class:"hidden sm:inline",children:l("cron.createJob")}),n("span",{class:"sm:hidden",children:l("actions.new")})]}),n(q,{icon:n(Qe,{class:`w-4 h-4 ${t.isLoading.value?"animate-spin":""}`}),label:l("actions.refresh"),onClick:s.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(ct,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Y,{type:"text",value:t.searchQuery.value,onInput:b=>t.searchQuery.value=b.target.value,placeholder:l("cron.searchPlaceholder"),"aria-label":l("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(le,{icon:ve,label:l("common.total"),value:T.total,active:t.statusFilter.value==="all",onClick:()=>t.statusFilter.value="all"}),n(le,{icon:Lo,label:l("common.enabled"),value:T.enabled,active:t.statusFilter.value==="enabled",onClick:()=>t.statusFilter.value="enabled"}),n(le,{icon:Er,label:l("common.disabled"),value:T.disabled,active:t.statusFilter.value==="disabled",onClick:()=>t.statusFilter.value="disabled"}),n(le,{icon:Pn,label:l("cron.stats.nextWake"),value:t.cronStatus.value?.nextWakeAtMs?ne(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(te,{size:"lg",label:D.value?void 0:l("status.connecting")})}),D.value&&!t.isLoading.value&&o.filteredJobs.value.length>0&&n(H,{children:[n("div",{class:"md:hidden space-y-2",children:o.filteredJobs.value.map(b=>n(sT,{job:b,onEdit:w.bind(null,"edit")},b.id))}),n(G,{padding:"none",class:"hidden md:block",children:n("table",{class:"w-full",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)] text-left text-sm text-[var(--color-text-muted)]",children:[n("th",{class:"py-3 px-4 font-medium",children:l("cron.columns.job")}),n("th",{class:"py-3 px-4 font-medium w-40",children:l("common.schedule")}),n("th",{class:"py-3 px-4 font-medium w-24",children:l("cron.columns.target")}),n("th",{class:"py-3 px-4 font-medium w-32",children:l("common.nextRun")}),n("th",{class:"py-3 px-4 font-medium w-24",children:l("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(b=>n(lT,{job:b,onEdit:w.bind(null,"edit"),onRun:s.runJobNow,onToggleEnabled:s.toggleJobEnabled,isRunning:a.isRunning.value},b.id))})]})})]}),D.value&&!t.isLoading.value&&t.cronJobs.value.length===0&&!t.error.value&&n(G,{children:n("div",{class:"p-16 text-center",children:[n(ve,{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:l("cron.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l("cron.emptyDescription")}),n(P,{icon:n(Sa,{class:"w-4 h-4"}),onClick:()=>w("create"),children:l("cron.createJob")})]})}),D.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&o.filteredJobs.value.length===0&&n(G,{children:n("div",{class:"p-12 text-center",children:[n(ct,{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:l("cron.noResults")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l("common.noResultsHint")}),n(P,{variant:"secondary",size:"sm",onClick:()=>{t.searchQuery.value="",t.statusFilter.value="all"},children:l("common.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?l("cron.count",{count:t.cronJobs.value.length}):l("cron.filteredCount",{filtered:o.filteredJobs.value.length,total:t.cronJobs.value.length})}),n(yT,{mode:a.modalMode.value,job:a.selectedJob.value,runs:a.selectedJobRuns.value,isLoadingRuns:a.isLoadingRuns.value,isDeleting:a.isDeleting.value,isSaving:a.isSaving.value,isRunning:a.isRunning.value,hasChanges:o.hasFormChanges.value,onClose:C,onSave:s.saveOrCreateJob,onDelete:s.deleteJob,onRun:s.runJobNow,onSetDeleting:b=>a.isDeleting.value=b,editName:r.editName,editDescription:r.editDescription,editEnabled:r.editEnabled,editScheduleKind:r.editScheduleKind,editScheduleExpr:r.editScheduleExpr,editScheduleTz:r.editScheduleTz,editScheduleStaggerMs:r.editScheduleStaggerMs,editScheduleEveryMs:r.editScheduleEveryMs,editScheduleAtMs:r.editScheduleAtMs,editSessionTarget:r.editSessionTarget,editWakeMode:r.editWakeMode,editDeliveryAnnounce:r.editDeliveryAnnounce,editPayloadText:r.editPayloadText,editPayloadMessage:r.editPayloadMessage,editPayloadModel:r.editPayloadModel,formErrors:r.formErrors})]})}const DT={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 qn({title:e,children:t,items:a,variant:r="info",class:o}){return n("div",{class:`
415
+ `,children:e})}function yv({options:e,value:t,onChange:a,size:r="md"}){return n("div",{class:"flex flex-wrap gap-2",children:e.map(o=>n(gT,{label:o.label,selected:t===o.value,onClick:()=>a(o.value),title:String(o.value),size:r},o.value))})}const bT=[{value:"cron",label:l("cron.scheduleKind.cron")},{value:"every",label:l("cron.scheduleKind.every")},{value:"at",label:l("cron.scheduleKind.at")}],xT=[{value:"main",label:l("cron.sessionTarget.main")},{value:"isolated",label:l("cron.sessionTarget.isolated")}],yT=[{value:"next-heartbeat",label:l("cron.wakeMode.nextHeartbeat")},{value:"now",label:l("cron.wakeMode.now")}];function wT({editName:e,editDescription:t,editScheduleKind:a,editScheduleExpr:r,editScheduleTz:o,editScheduleStaggerMs:s,editScheduleEveryMs:i,editScheduleAtMs:c,editSessionTarget:u,editWakeMode:d,editDeliveryAnnounce:h,editPayloadText:f,editPayloadMessage:p,editPayloadModel:v,formErrors:w}){const C=w.value,T=X(!1),b=X(!1),g=o.value.trim(),y=fT(g,8),E=k=>{if(u.value==="main"){f.value=k;return}p.value=k},x=u.value==="main"?f.value:p.value,S=u.value==="main"?l("cron.form.systemEventPlaceholder"):l("cron.form.agentMessagePlaceholder");return R(()=>{if(a.value!=="cron"){T.value=!1;return}s.value.trim()&&(T.value=!0)},[a.value,s.value]),n("div",{class:"space-y-4 sm:space-y-5",children:[n(De,{label:l("common.name"),error:C.name,children:n(Y,{value:e.value,onInput:k=>e.value=k.target.value,placeholder:l("cron.form.namePlaceholder"),error:!!C.name,fullWidth:!0})}),n(De,{label:l("cron.form.description"),hint:l("cron.form.descriptionHint"),children:n(Y,{value:t.value,onInput:k=>t.value=k.target.value,placeholder:l("cron.form.descriptionPlaceholder"),fullWidth:!0})}),n(De,{label:l("common.schedule"),error:C.schedule,children:n("div",{class:"space-y-3",children:[n(Me,{value:a.value,onChange:k=>a.value=k,options:bT}),a.value==="cron"&&n("div",{class:"space-y-3",children:[n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[n(Y,{value:r.value,onInput:k=>r.value=k.target.value,placeholder:l("cron.form.cronPlaceholder"),fullWidth:!0}),n(mT,{value:o.value,onValueChange:k=>o.value=k,suggestions:y,placeholder:l("cron.form.timezonePlaceholder"),"aria-label":l("cron.form.timezone"),minCharsToOpen:0,clearable:!0,clearAriaLabel:l("actions.clear"),fullWidth:!0})]}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:l("cron.form.timezoneHint")}),n(yv,{options:PC.map(({expr:k,label:I})=>({value:k,label:I})),value:r.value,onChange:k=>r.value=k,size:"sm"}),n(vT,{isOpen:T.value,onToggle:k=>T.value=k,collapsedLabel:l("cron.form.showAdvanced"),expandedLabel:l("cron.form.hideAdvanced"),contentClass:"mt-2",children:n(De,{label:l("cron.form.staggerMs"),hint:l("cron.form.staggerMsHint"),children:n(Y,{type:"number",min:0,step:1,value:s.value,onInput:k=>s.value=k.target.value,placeholder:l("cron.form.staggerMsPlaceholder"),fullWidth:!0})})})]}),a.value==="every"&&n("div",{class:"space-y-2",children:[n(yv,{options:DC.map(({ms:k,label:I})=>({value:String(k),label:I})),value:i.value,onChange:k=>i.value=k}),n(Y,{type:"number",value:i.value,onInput:k=>i.value=k.target.value,placeholder:l("cron.form.intervalPlaceholder"),fullWidth:!0})]}),a.value==="at"&&n(Y,{type:"datetime-local",value:MC(Number(c.value)||Date.now()),onInput:k=>{const I=k.target.value;c.value=String(IC(I))},fullWidth:!0})]})}),n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",children:[n(De,{label:l("cron.form.sessionTarget"),hint:l("cron.form.sessionTargetHint"),children:n(Me,{value:u.value,onChange:k=>{u.value=k},options:xT})}),n(De,{label:l("cron.form.wakeMode"),hint:l("cron.form.wakeModeHint"),children:n(Me,{value:d.value,onChange:k=>d.value=k,options:yT})})]}),u.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:l("cron.form.announceResults")}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("cron.form.announceResultsHint")})]}),n(Be,{checked:h.value,onChange:k=>h.value=k,label:l("cron.form.announceResults")})]}),n(De,{label:l("cron.form.payload"),labelAction:n(P,{type:"button",size:"sm",variant:"secondary",icon:n(Db,{class:"w-4 h-4"}),onClick:()=>b.value=!0,class:"sm:hidden",children:l("cron.form.expandPayloadEditor")}),error:C.payload,hint:u.value==="main"?l("cron.form.payloadHintMain"):l("cron.form.payloadHintIsolated"),children:u.value==="main"?n(tr,{value:f.value,onInput:k=>f.value=k.target.value,placeholder:l("cron.form.systemEventPlaceholder"),error:!!C.payload,rows:3,fullWidth:!0}):n("div",{class:"space-y-3",children:[n(tr,{value:p.value,onInput:k=>p.value=k.target.value,placeholder:l("cron.form.agentMessagePlaceholder"),error:!!C.payload,rows:3,fullWidth:!0}),n(Y,{value:v.value,onInput:k=>v.value=k.target.value,placeholder:l("cron.form.modelPlaceholder"),fullWidth:!0})]})}),b.value&&n("div",{class:"fixed inset-0 z-[60] sm:hidden bg-[var(--color-bg-surface)] flex flex-col",children:[n("div",{class:"flex items-center justify-between px-4 py-3 border-b border-[var(--color-border)]",children:[n("h4",{class:"text-base font-semibold text-[var(--color-text-primary)]",children:l("cron.form.fullscreenPayloadTitle")}),n(P,{type:"button",size:"sm",variant:"secondary",onClick:()=>b.value=!1,children:l("actions.done")})]}),n("div",{class:"flex-1 p-4 pb-[max(env(safe-area-inset-bottom),1rem)] overflow-y-auto",children:n(tr,{value:x,onInput:k=>E(k.target.value),placeholder:S,error:!!C.payload,rows:12,fullWidth:!0,class:"min-h-[60vh] h-full resize-none"})})]})]})}function Gu({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 kT(e){if(!e.usage)return null;const t=e.usage.input_tokens,a=e.usage.output_tokens;return t==null&&a==null?null:l("cron.runUsage",{input:co(t??0).toLowerCase(),output:co(a??0).toLowerCase()})}function ST({mode:e,job:t,runs:a,isLoadingRuns:r,isDeleting:o,isSaving:s,isRunning:i,hasChanges:c,onClose:u,onSave:d,onDelete:h,onRun:f,onSetDeleting:p,editName:v,editDescription:w,editEnabled:C,editScheduleKind:T,editScheduleExpr:b,editScheduleTz:g,editScheduleStaggerMs:y,editScheduleEveryMs:E,editScheduleAtMs:x,editSessionTarget:S,editWakeMode:k,editDeliveryAnnounce:I,editPayloadText:A,editPayloadMessage:O,editPayloadModel:z,formErrors:se}){if(!e)return null;const Fe=e==="edit",et=t?Rf(t):null;return n(We,{open:!!e,onClose:u,title:Fe&&t?t.name:l("cron.createJob"),size:"xl",footer:o?n(Df,{message:l("cron.confirmDelete"),onCancel:()=>p(!1),onDelete:h}):n(Px,{isEdit:Fe&&!!t,onDeleteClick:()=>p(!0),onCancel:u,onSave:d,isSaving:s,saveDisabled:!c,saveLabel:l(Fe?"actions.save":"common.create"),extraContent:n("div",{class:"flex items-center justify-between sm:justify-start gap-2",children:[n("span",{class:"text-sm text-[var(--color-text-secondary)]",children:C.value?l("common.enabled"):l("common.disabled")}),n(Be,{checked:C.value,onChange:he=>C.value=he})]})}),children:n("div",{class:"space-y-4 sm:space-y-6",children:[Fe&&t&&et&&n(H,{children:[n("div",{class:"flex flex-col sm:flex-row sm:items-center gap-3 p-3 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n("div",{class:"flex items-center gap-3 flex-1 min-w-0",children:[n("div",{class:`p-2 sm:p-3 rounded-xl flex-shrink-0 ${t.enabled?"bg-[var(--color-success)]/10":"bg-[var(--color-bg-tertiary)]"}`,children:n(ge,{class:`w-5 h-5 sm:w-6 sm:h-6 ${t.enabled?"text-[var(--color-success)]":"text-[var(--color-text-muted)]"}`})}),n("div",{class:"min-w-0",children:[n("div",{class:"flex flex-wrap items-center gap-1.5 mb-1",children:[n(Z,{variant:et.variant,size:"sm",children:et.label}),n(Z,{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:Qs(t.schedule)})]})]}),n(P,{size:"sm",variant:"secondary",icon:n(hf,{class:"w-4 h-4"}),onClick:()=>f(t),disabled:i,fullWidth:!0,class:"sm:w-auto",children:l("cron.runNow")})]}),n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(Gu,{value:If(t),label:l("common.nextRun")}),n(Gu,{value:RC(t),label:l("cron.lastRun")}),n(Gu,{value:t.state.lastDurationMs?`${Math.round(t.state.lastDurationMs/1e3)}s`:"—",label:l("cron.lastDuration")})]})]}),n(wT,{editName:v,editDescription:w,editScheduleKind:T,editScheduleExpr:b,editScheduleTz:g,editScheduleStaggerMs:y,editScheduleEveryMs:E,editScheduleAtMs:x,editSessionTarget:S,editWakeMode:k,editDeliveryAnnounce:I,editPayloadText:A,editPayloadMessage:O,editPayloadModel:z,formErrors:se}),Fe&&n("div",{children:[n("h4",{class:"text-sm font-medium mb-3",children:l("cron.recentRuns")}),r?n("div",{class:"flex justify-center py-4",children:n(te,{size:"sm"})}):a.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] text-center py-4",children:l("cron.noRuns")}):n("div",{class:"space-y-2 max-h-48 overflow-y-auto",children:a.map(he=>{const yt=he.deliveryStatus?LC(he.deliveryStatus):null,$t=kT(he);return n("div",{class:"p-2 rounded-lg bg-[var(--color-bg-secondary)] text-sm",children:[n("div",{class:"flex items-center gap-3",children:[he.status==="ok"?n(Lo,{class:"w-4 h-4 text-[var(--color-success)]"}):he.status==="error"?n(Er,{class:"w-4 h-4 text-[var(--color-error)]"}):n(ge,{class:"w-4 h-4 text-[var(--color-warning)]"}),n("span",{class:"flex-1",children:ae(he.runAtMs)}),he.durationMs&&n("span",{class:"text-[var(--color-text-muted)]",children:[Math.round(he.durationMs/1e3),"s"]})]}),(yt||he.model||$t)&&n("div",{class:"mt-1 pl-7 flex flex-wrap items-center gap-2",children:[yt&&n(Z,{variant:yt.variant,size:"sm",children:yt.label}),he.model&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:he.model}),$t&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:$t})]}),he.error&&n("div",{class:"mt-1 pl-7 text-[var(--color-error)] truncate",title:he.error,children:he.error})]},he.runAtMs)})})]})]})})}const _a=m([]),Fx=m(null),Wd=m(!1),vr=m(null),zx=m(""),Kd=m("all"),ou=m(null),Ca=m(null),el=m([]),qd=m(!1),Ux=m(!1),Vd=m(!1),Gd=m(!1),gr=m(""),go=m(""),bo=m(!0),Yt=m("cron"),Ta=m(""),Ea=m(""),br=m(""),xr=m(""),yr=m(""),xo=m("next-heartbeat"),Mn=m("main"),yo=m(!1),wo=m(""),ko=m(""),So=m(""),su=m({});function Of(e){const t=e.trim();if(!t)return;if(!/^\d+$/.test(t))return null;const a=Number(t);return!Number.isSafeInteger(a)||a<0?null:a}function wv(e){return e?.trim()??""}const _T=K(()=>{let e=_a.value;Kd.value==="enabled"?e=e.filter(a=>a.enabled):Kd.value==="disabled"&&(e=e.filter(a=>!a.enabled));const t=zx.value.toLowerCase().trim();return t&&(e=e.filter(a=>{const r=a.name.toLowerCase(),o=(a.description||"").toLowerCase();return r.includes(t)||o.includes(t)})),[...e].sort((a,r)=>{if(a.enabled!==r.enabled)return a.enabled?-1:1;const o=a.state.nextRunAtMs??1/0,s=r.state.nextRunAtMs??1/0;return o-s})}),CT=K(()=>{const e={total:0,enabled:0,disabled:0};for(const t of _a.value)e.total++,t.enabled?e.enabled++:e.disabled++;return e});async function xc(){Wd.value=!0,vr.value=null;const[e,t]=await Promise.allSettled([N("cron.status",{}),N("cron.list",{includeDisabled:!0})]);e.status==="fulfilled"&&(Fx.value=e.value),t.status==="fulfilled"&&(_a.value=t.value.jobs??[]);const a=[];e.status==="rejected"&&a.push(`Status: ${ne(e.reason)}`),t.status==="rejected"&&a.push(`Jobs: ${ne(t.reason)}`),a.length>0&&(vr.value=a.join("; ")),Wd.value=!1}async function TT(e){await ET(e,{limit:20,offset:0})}async function ET(e,t){qd.value=!0;try{const a=await N("cron.runs",{jobId:e,limit:t?.limit,offset:t?.offset,status:t?.status});el.value=a.entries??[]}catch{el.value=[]}finally{qd.value=!1}}function AT(e){gr.value=e.name,go.value=e.description??"",bo.value=e.enabled,Yt.value=e.schedule.kind,Ta.value="",Ea.value="",br.value="",xr.value="",yr.value="",e.schedule.kind==="cron"?(Ta.value=e.schedule.expr,Ea.value=e.schedule.tz??"",br.value=e.schedule.staggerMs!==void 0?String(e.schedule.staggerMs):""):e.schedule.kind==="every"?xr.value=String(e.schedule.everyMs):e.schedule.kind==="at"&&(yr.value=String(Mf(e.schedule)??"")),xo.value=e.wakeMode,Mn.value=e.sessionTarget,yo.value=e.delivery?.mode==="announce",e.payload.kind==="systemEvent"?wo.value=e.payload.text:(ko.value=e.payload.message,So.value=e.payload.model??""),su.value={}}function MT(){gr.value="",go.value="",bo.value=!0,Yt.value="cron",Ta.value="",Ea.value="",br.value="",xr.value="",yr.value="",xo.value="next-heartbeat",Mn.value="main",yo.value=!1,wo.value="",ko.value="",So.value="",su.value={}}function IT(e,t){e==="edit"&&t?(Ca.value=t,AT(t),TT(t.id)):(Ca.value=null,MT(),el.value=[]),ou.value=e}function Nf(){ou.value=null,Ca.value=null,el.value=[],Ux.value=!1}function RT(){const e={};if(gr.value.trim()||(e.name=l("cron.validation.nameRequired")),Yt.value==="cron")Ta.value.trim()?$C(Ta.value)?Ea.value.trim()&&!pT(Ea.value.trim())?e.schedule=l("cron.validation.timezoneInvalid"):Of(br.value)===null&&(e.schedule=l("cron.validation.staggerNonNegative")):e.schedule=l("cron.validation.cronInvalid"):e.schedule=l("cron.validation.cronRequired");else if(Yt.value==="every"){const t=parseInt(xr.value,10);(!t||t<1e3)&&(e.schedule=l("cron.validation.intervalMin"))}else if(Yt.value==="at"){const t=parseInt(yr.value,10);(!t||t<Date.now())&&(e.schedule=l("cron.validation.atFuture"))}return Mn.value==="main"?wo.value.trim()||(e.payload=l("cron.validation.payloadRequired")):ko.value.trim()||(e.payload=l("cron.validation.payloadRequired")),su.value=e,Object.keys(e).length===0}function kv(){switch(Yt.value){case"cron":{const e=Of(br.value),t=Ea.value.trim();return{kind:"cron",expr:Ta.value,...t?{tz:t}:{},...typeof e=="number"?{staggerMs:e}:{}}}case"every":return{kind:"every",everyMs:parseInt(xr.value,10)||6e4};case"at":return{kind:"at",at:new Date(parseInt(yr.value,10)||Date.now()).toISOString()}}}function Sv(){return Mn.value==="main"?{kind:"systemEvent",text:wo.value}:{kind:"agentTurn",message:ko.value,...So.value?{model:So.value}:{}}}async function LT(){if(RT()){Vd.value=!0;try{if(ou.value==="edit"&&Ca.value){const e={name:gr.value,description:go.value||void 0,enabled:bo.value,schedule:kv(),sessionTarget:Mn.value,wakeMode:xo.value,payload:Sv(),delivery:{mode:yo.value?"announce":"none"}};await N("cron.update",{jobId:Ca.value.id,patch:e})}else{const e={name:gr.value,description:go.value||void 0,enabled:bo.value,schedule:kv(),sessionTarget:Mn.value,wakeMode:xo.value,payload:Sv(),delivery:{mode:yo.value?"announce":"none"}};await N("cron.add",{job:e})}await xc(),Nf()}catch(e){vr.value=ne(e)}finally{Vd.value=!1}}}async function $T(){const e=Ca.value;if(e)try{await N("cron.remove",{jobId:e.id}),_a.value=_a.value.filter(t=>t.id!==e.id),Nf()}catch(t){vr.value=ne(t)}}async function DT(e){Gd.value=!0;try{await N("cron.run",{jobId:e.id,mode:"force"}),await xc()}catch(t){vr.value=ne(t)}finally{Gd.value=!1}}async function PT(e){try{await N("cron.update",{jobId:e.id,patch:{enabled:!e.enabled}}),_a.value=_a.value.map(t=>t.id===e.id?{...t,enabled:!t.enabled}:t)}catch(t){vr.value=ne(t)}}function OT(){R(()=>{D.value&&xc()},[D.value]);const e=Fc(()=>{const t=Ca.value;if(!t||gr.value!==t.name||go.value!==(t.description??"")||bo.value!==t.enabled||Yt.value!==t.schedule.kind||xo.value!==t.wakeMode||Mn.value!==t.sessionTarget||yo.value!==(t.delivery?.mode==="announce"))return!0;if(t.schedule.kind==="cron"&&Yt.value==="cron"){if(Ta.value!==t.schedule.expr||wv(Ea.value)!==wv(t.schedule.tz))return!0;const a=Of(br.value);if(a===null||(a??void 0)!==(t.schedule.staggerMs??void 0))return!0}else if(t.schedule.kind==="every"&&Yt.value==="every"){if(xr.value!==String(t.schedule.everyMs))return!0}else if(t.schedule.kind==="at"&&Yt.value==="at"&&yr.value!==String(Mf(t.schedule)??""))return!0;if(t.payload.kind==="systemEvent"&&Mn.value==="main"){if(wo.value!==t.payload.text)return!0}else if(t.payload.kind==="agentTurn"&&Mn.value==="isolated"&&(ko.value!==t.payload.message||So.value!==(t.payload.model??"")))return!0;return!1});return{state:{cronJobs:_a,cronStatus:Fx,isLoading:Wd,error:vr,searchQuery:zx,statusFilter:Kd},modal:{modalMode:ou,selectedJob:Ca,selectedJobRuns:el,isLoadingRuns:qd,isDeleting:Ux,isSaving:Vd,isRunning:Gd},form:{editName:gr,editDescription:go,editEnabled:bo,editScheduleKind:Yt,editScheduleExpr:Ta,editScheduleTz:Ea,editScheduleStaggerMs:br,editScheduleEveryMs:xr,editScheduleAtMs:yr,editWakeMode:xo,editSessionTarget:Mn,editDeliveryAnnounce:yo,editPayloadText:wo,editPayloadMessage:ko,editPayloadModel:So,formErrors:su},computed:{filteredJobs:_T,jobCounts:CT,hasFormChanges:e},actions:{loadCronJobs:xc,openJobModal:IT,closeModal:Nf,saveOrCreateJob:LT,deleteJob:$T,runJobNow:DT,toggleJobEnabled:PT}}}function NT(e){const{state:t,modal:a,form:r,computed:o,actions:s}=OT(),i=!t.isLoading.value&&t.cronJobs.value.length>0,[c,u]=fe("q"),[d,h]=fe("filter"),[f,p,v]=fe("job",{ready:i});He(c,t.searchQuery,b=>b),He(d,t.statusFilter,b=>b),Mr(t.searchQuery,u),Ln(t.statusFilter,h,"all"),R(()=>{if(i)if(f.value){const b=t.cronJobs.value.find(g=>g.id===f.value);b&&a.selectedJob.value?.id!==b.id&&s.openJobModal("edit",b)}else a.selectedJob.value&&a.modalMode.value==="edit"&&s.closeModal()},[f.value,i]),R(()=>{v.value&&!a.selectedJob.value&&f.value&&p(null)},[a.selectedJob.value,v.value]);const w=(b,g)=>{b==="edit"&&g&&(p(g.id),tu()),s.openJobModal(b,g)},C=()=>{p(null),s.closeModal()},T=o.jobCounts.value;return n(sn,{viewName:l("common.cronJobs"),children:[n(Wt,{title:l("common.cronJobs"),subtitle:l("cron.description"),actions:n(H,{children:[D.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&n("div",{class:"relative hidden sm:block",children:[n(it,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Y,{type:"text",value:t.searchQuery.value,onInput:b=>t.searchQuery.value=b.target.value,placeholder:l("cron.searchPlaceholder"),"aria-label":l("cron.searchPlaceholder"),class:"pl-10 w-64"})]}),n(P,{icon:n(Sa,{class:"w-4 h-4"}),onClick:()=>w("create"),disabled:!D.value,children:[n("span",{class:"hidden sm:inline",children:l("cron.createJob")}),n("span",{class:"sm:hidden",children:l("actions.new")})]}),n(q,{icon:n(Xe,{class:`w-4 h-4 ${t.isLoading.value?"animate-spin":""}`}),label:l("actions.refresh"),onClick:s.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(it,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Y,{type:"text",value:t.searchQuery.value,onInput:b=>t.searchQuery.value=b.target.value,placeholder:l("cron.searchPlaceholder"),"aria-label":l("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(le,{icon:ge,label:l("common.total"),value:T.total,active:t.statusFilter.value==="all",onClick:()=>t.statusFilter.value="all"}),n(le,{icon:Lo,label:l("common.enabled"),value:T.enabled,active:t.statusFilter.value==="enabled",onClick:()=>t.statusFilter.value="enabled"}),n(le,{icon:Er,label:l("common.disabled"),value:T.disabled,active:t.statusFilter.value==="disabled",onClick:()=>t.statusFilter.value="disabled"}),n(le,{icon:Nn,label:l("cron.stats.nextWake"),value:t.cronStatus.value?.nextWakeAtMs?ae(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(te,{size:"lg",label:D.value?void 0:l("status.connecting")})}),D.value&&!t.isLoading.value&&o.filteredJobs.value.length>0&&n(H,{children:[n("div",{class:"md:hidden space-y-2",children:o.filteredJobs.value.map(b=>n(iT,{job:b,onEdit:w.bind(null,"edit")},b.id))}),n(G,{padding:"none",class:"hidden md:block",children:n("table",{class:"w-full",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)] text-left text-sm text-[var(--color-text-muted)]",children:[n("th",{class:"py-3 px-4 font-medium",children:l("cron.columns.job")}),n("th",{class:"py-3 px-4 font-medium w-40",children:l("common.schedule")}),n("th",{class:"py-3 px-4 font-medium w-24",children:l("cron.columns.target")}),n("th",{class:"py-3 px-4 font-medium w-32",children:l("common.nextRun")}),n("th",{class:"py-3 px-4 font-medium w-24",children:l("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(b=>n(cT,{job:b,onEdit:w.bind(null,"edit"),onRun:s.runJobNow,onToggleEnabled:s.toggleJobEnabled,isRunning:a.isRunning.value},b.id))})]})})]}),D.value&&!t.isLoading.value&&t.cronJobs.value.length===0&&!t.error.value&&n(G,{children:n("div",{class:"p-16 text-center",children:[n(ge,{class:"w-12 h-12 mx-auto mb-4 text-[var(--color-text-muted)] opacity-50"}),n("h3",{class:"text-lg font-medium mb-2",children:l("cron.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l("cron.emptyDescription")}),n(P,{icon:n(Sa,{class:"w-4 h-4"}),onClick:()=>w("create"),children:l("cron.createJob")})]})}),D.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&o.filteredJobs.value.length===0&&n(G,{children:n("div",{class:"p-12 text-center",children:[n(it,{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:l("cron.noResults")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l("common.noResultsHint")}),n(P,{variant:"secondary",size:"sm",onClick:()=>{t.searchQuery.value="",t.statusFilter.value="all"},children:l("common.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?l("cron.count",{count:t.cronJobs.value.length}):l("cron.filteredCount",{filtered:o.filteredJobs.value.length,total:t.cronJobs.value.length})}),n(ST,{mode:a.modalMode.value,job:a.selectedJob.value,runs:a.selectedJobRuns.value,isLoadingRuns:a.isLoadingRuns.value,isDeleting:a.isDeleting.value,isSaving:a.isSaving.value,isRunning:a.isRunning.value,hasChanges:o.hasFormChanges.value,onClose:C,onSave:s.saveOrCreateJob,onDelete:s.deleteJob,onRun:s.runJobNow,onSetDeleting:b=>a.isDeleting.value=b,editName:r.editName,editDescription:r.editDescription,editEnabled:r.editEnabled,editScheduleKind:r.editScheduleKind,editScheduleExpr:r.editScheduleExpr,editScheduleTz:r.editScheduleTz,editScheduleStaggerMs:r.editScheduleStaggerMs,editScheduleEveryMs:r.editScheduleEveryMs,editScheduleAtMs:r.editScheduleAtMs,editSessionTarget:r.editSessionTarget,editWakeMode:r.editWakeMode,editDeliveryAnnounce:r.editDeliveryAnnounce,editPayloadText:r.editPayloadText,editPayloadMessage:r.editPayloadMessage,editPayloadModel:r.editPayloadModel,formErrors:r.formErrors})]})}const FT={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 Jn({title:e,children:t,items:a,variant:r="info",class:o}){return n("div",{class:`
416
416
  p-3 rounded-lg text-xs
417
- ${DT[r]}
417
+ ${FT[r]}
418
418
  ${o||""}
419
- `,children:[e&&n("p",{class:"font-medium mb-1",children:e}),a?n("ul",{class:"list-disc list-inside space-y-0.5",children:a.map((s,i)=>n("li",{children:s},i))}):t]})}function jx(e){return e.join(".")}function PT(e,t,a){if(t.length===0)return e;const r={...e};let o=r;for(let i=0;i<t.length-1;i++){const c=t[i],u=o[c];u==null||typeof u!="object"?o[c]=typeof t[i+1]=="number"?[]:{}:o[c]=Array.isArray(u)?[...u]:{...u},o=o[c]}const s=t[t.length-1];return a===void 0?delete o[s]:o[s]=a,r}function Hx(e,t){if(!e||t.length===0)return e??null;let a=e;for(const r of t){if(!a)return null;typeof r=="number"?a=a.items:a=a.properties?.[r]}return a??null}function OT(e,t){if(t.length===0)return e;let a=e;for(const r of t){if(a==null)return;a=a[r]}return a}function $l(e){if(!e)return null;if(typeof e.type=="string")return e.type;if(Array.isArray(e.type))return e.type.filter(a=>a!=="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 a=(e.anyOf??e.oneOf??[]).filter(r=>r.type!=="null"&&!(Array.isArray(r.type)&&r.type.includes("null")));if(a.length===1)return $l(a[0])}return null}function NT(e){if(e.default!==void 0)return e.default;if(e.const!==void 0)return e.const;switch($l(e)){case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";case"array":return[];case"object":return{};default:return}}function FT(e,t){const a=jx(e);if(t[a])return t[a];const r=[a.replace(/\.\d+\./g,".*."),a.replace(/\.\d+\./g,"[]."),a.replace(/\[\d+\]/g,"[*]")];for(const o of r)if(t[o])return t[o]}const zT=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 wr(e){return typeof e=="number"?`#${e+1}`:e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").split(" ").map(t=>{const a=t.toLowerCase();return zT.has(a)?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}).join(" ")}function $i(e,t){const a=$l(t);if(e==null)return t.nullable||Array.isArray(t.type)&&t.type.includes("null")||t.default!==void 0,null;switch(a){case"string":if(typeof e!="string")return l("config.validation.mustBeString");if(t.minLength&&e.length<t.minLength)return l("config.validation.minLength",{min:t.minLength});if(t.maxLength&&e.length>t.maxLength)return l("config.validation.maxLength",{max:t.maxLength});if(t.pattern&&!new RegExp(t.pattern).test(e))return l("config.validation.invalidFormat");break;case"number":case"integer":if(typeof e!="number")return l("config.validation.mustBeNumber");if(t.minimum!==void 0&&e<t.minimum)return l("config.validation.minimum",{min:t.minimum});if(t.maximum!==void 0&&e>t.maximum)return l("config.validation.maximum",{max:t.maximum});if(a==="integer"&&!Number.isInteger(e))return l("config.validation.mustBeInteger");break;case"boolean":if(typeof e!="boolean")return l("config.validation.mustBeBoolean");break;case"array":if(!Array.isArray(e))return l("config.validation.mustBeArray");if(t.minItems&&e.length<t.minItems)return l("config.validation.minItems",{min:t.minItems});if(t.maxItems&&e.length>t.maxItems)return l("config.validation.maxItems",{max:t.maxItems});break;case"object":if(typeof e!="object"||Array.isArray(e))return l("config.validation.mustBeObject");break}return t.enum&&!t.enum.includes(e)?l("config.validation.invalidOption"):null}const aa=m(!1),_t=m(null),el=m(!1),zn=m(null),Fr=m({}),tl=m({}),Yt=m({}),Di=m(null),Bx=m(null),Wx=m(!1),UT=m(!0),jT=m(null),Xu=m(""),So=m({}),Pi=K(()=>JSON.stringify(tl.value)!==JSON.stringify(Yt.value)),Xd=K(()=>Pi.value&&!el.value&&Object.keys(So.value).length===0);async function _v(){aa.value=!0,_t.value=null;try{const[e,t]=await Promise.all([N("config.get",{}),N("config.schema",{})]);zn.value=t.schema,Fr.value=t.uiHints,jT.value=t.version,tl.value=e.config,Yt.value=structuredClone(e.config),Di.value=e.hash??null,Bx.value=e.path??null,Wx.value=e.exists,UT.value=e.valid,So.value={}}catch(e){_t.value=ae(e)}finally{aa.value=!1}}function Et(e,t){Yt.value=PT(Yt.value,e,t)}function HT(){Yt.value=structuredClone(tl.value),So.value={}}function Oi(e,t){const a={...So.value};t?a[e]=t:delete a[e],So.value=a}async function BT(){if(!Xd.value)return!1;if(!Di.value&&Wx.value)return _t.value="Missing base hash. Reload and try again.",!1;el.value=!0,_t.value=null;try{const e=Kx(tl.value,Yt.value),t=await N("config.patch",{raw:JSON.stringify(e),baseHash:Di.value});if(t.ok){tl.value=t.config,Yt.value=structuredClone(t.config),Bx.value=t.path;const a=await N("config.get",{});return Di.value=a.hash??null,!0}else return _t.value="Failed to save configuration",!1}catch(e){const t=ae(e);return t.includes("hash")||t.includes("changed")?_t.value="Configuration was modified externally. Please reload.":_t.value=t,!1}finally{el.value=!1}}function Kx(e,t){const a={};for(const r of Object.keys(t)){const o=e[r],s=t[r];JSON.stringify(o)!==JSON.stringify(s)&&(s!==null&&typeof s=="object"&&!Array.isArray(s)&&o!==null&&typeof o=="object"&&!Array.isArray(o)?a[r]=Kx(o,s):a[r]=s)}for(const r of Object.keys(e))r in t||(a[r]=null);return a}function WT(e){return e.properties?Object.values(e.properties).some(t=>!zf(t)):!1}function zf(e){return e.type==="array"&&e.items?.properties?!0:e.type==="object"&&e.properties?Object.keys(e.properties).length>=2:!1}function Qd(e,t,a,r=[],o=0){if(!e.properties)return[];const s=[];for(const[i,c]of Object.entries(e.properties)){const u=[...r,i],h=(a[i]??a[u.join(".")]??{}).label??c.title??wr(i);if(o>0&&!zf(c))continue;const f={key:i,label:h,path:u,schema:c};if(c.type==="object"&&c.properties){const p=t[i]??{};f.children=Qd(c,p,a,u,o+1),f.children.length===0&&delete f.children}if(c.type==="array"&&c.items?.properties){const p=t[i]??[];f.children=p.map((v,w)=>{const C=v,T=C.identity,b=C.id??C.name??C.label??`#${w+1}`,g=T?.emoji??"";return{key:String(w),label:g?`${g} ${b}`:String(b),path:[...u,w],schema:c.items}})}s.push(f)}return s.sort((i,c)=>{const u=a[i.key]?.order??100,d=a[c.key]?.order??100;return u-d}),s}const Uf={gateway:rn,agents:Cb,channels:uc,tools:Hb,commands:B4,session:ca,cron:ve,skills:tu,plugins:mf,logging:an,auth:pm,models:hm,wizard:K4,update:Rt,diagnostics:pa,nodeHost:pr,audio:W4,messages:$n,bindings:Lb,ui:N4,browser:Gt,hooks:q4,web:rn,canvas:Yr,canvasHost:Yr,approvals:eu,notifications:hf,meta:an,env:fm,nodes:pr,broadcast:uc,media:Yr,network:$u,secrets:Xc,memory:ic,memorySearch:ic,storage:fm,tls:pm,remote:$u,reload:Qe,tailscale:$u,sandbox:hm,context:$d,contextPruning:$d,compaction:Pn,heartbeat:pa,defaults:gf},qx=S4;function Vx({item:e,depth:t=0,selectedPath:a,expandedNav:r}){const o=e.path.join("."),s=r.value.has(o),i=a.value.join(".")===o||a.value.join(".").startsWith(o+"."),c=e.children&&e.children.length>0,u=t===0?Uf[e.key]??qx:void 0,d=()=>{a.value=e.path},h=p=>{p.stopPropagation();const v=new Set(r.value);s?v.delete(o):v.add(o),r.value=v},f=a.value.join(".")===o;return n("div",{children:[n("button",{type:"button",class:`w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded-md text-left transition-colors ${f?"bg-[var(--color-accent)] text-white":i?"text-[var(--color-accent)]":"hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)]"} ${t>0?"text-[var(--color-text-secondary)]":"font-medium"}`,style:{paddingLeft:`${t*16+8}px`},onClick:d,children:[c?n("button",{type:"button",class:"p-0.5 -ml-1 hover:bg-[var(--color-bg-primary)]/20 rounded",onClick:h,"aria-label":l(s?"accessibility.collapseSection":"accessibility.expandSection"),children:s?n(Ne,{class:"w-3.5 h-3.5"}):n(Ve,{class:"w-3.5 h-3.5"})}):n("span",{class:"w-4"}),u&&n(u,{class:"w-4 h-4 flex-shrink-0 opacity-70"}),n("span",{class:"truncate",children:e.label})]}),c&&s&&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(Vx,{item:p,depth:t+1,selectedPath:a,expandedNav:r},p.key))]})]})}function Bn({label:e,description:t,error:a,inline:r,children:o}){return r&&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})]}),a&&n("p",{class:"text-xs text-[var(--color-error)] mt-1",children:a})]}):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,a&&n("p",{class:"text-xs text-[var(--color-error)] mt-1",children:a})]})}function KT({value:e,placeholder:t,onChange:a,wide:r}){const[o,s]=U(!1);return n("div",{class:"relative",children:[n(Y,{type:o?"text":"password",value:e,placeholder:t,onInput:i=>a(i.target.value),class:`pr-10 w-full ${r?"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:()=>s(!o),"aria-label":l(o?"config.field.hidePassword":"config.field.showPassword"),children:o?n(Ab,{class:"w-4 h-4"}):n(ff,{class:"w-4 h-4"})})]})}function Gx({value:e,onChange:t}){const[a,r]=U(()=>JSON.stringify(e,null,2)??""),[o,s]=U(null);return n("div",{class:"space-y-1",children:[n(tr,{value:a,onInput:c=>r(c.target.value),onBlur:()=>{try{const c=JSON.parse(a);t(c),s(null)}catch{s(l("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 qT({schema:e,value:t,path:a,hints:r,level:o,label:s,help:i,isDetailView:c=!1,skipNavWorthy:u=!1}){const[d,h]=U(o<2||c),f=e.properties??{},p=Object.keys(f).filter(w=>{if(!u)return!0;const C=f[w];return!zf(C)}),v=t??{};return c&&o===0?p.length===0?n("div",{class:"text-sm text-[var(--color-text-muted)] py-4",children:l("config.noSettingsAtLevel")}):n("div",{class:"space-y-2",children:[i&&n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:i}),p.map(w=>n(Qr,{schema:f[w],value:v[w],path:[...a,w],hints:r,level:o+1,skipNavWorthy:u},w))]}):n("div",{class:"mt-6 first:mt-3",children:[n("div",{class:"md:hidden",children:n("div",{class:"rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] overflow-hidden",children:[n("div",{class:"px-4 py-3 bg-[var(--color-bg-secondary)] border-b border-[var(--color-border)]",children:[n("span",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:s}),i&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-1 leading-relaxed",children:i})]}),n("div",{class:"px-4 py-2",children:p.map(w=>n(Qr,{schema:f[w],value:v[w],path:[...a,w],hints:r,level:o+1,skipNavWorthy:u},w))})]})}),n("div",{class:"hidden md:block",children:[n("button",{type:"button",class:"flex items-center gap-2 py-2 text-left group",onClick:()=>h(!d),"aria-expanded":d,children:[n("span",{class:"text-[var(--color-text-muted)] group-hover:text-[var(--color-text-primary)] transition-colors",children:d?n(Ne,{class:"w-4 h-4"}):n(Ve,{class:"w-4 h-4"})}),n("span",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:s}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",p.length,")"]})]}),d&&n("div",{class:"ml-6 pl-4 border-l border-[var(--color-border)] mt-1",children:[i&&n("p",{class:"text-xs text-[var(--color-text-muted)] pb-2 leading-relaxed",children:i}),p.map(w=>n(Qr,{schema:f[w],value:v[w],path:[...a,w],hints:r,level:o+1,skipNavWorthy:u},w))]})]})]})}function VT({schema:e,value:t,path:a,hints:r,level:o,label:s,help:i}){const[c,u]=U(o<2),d=t??[],h=e.items??{},f=$l(h),p=()=>{const C=NT(h);Et(a,[...d,C])},v=C=>{const T=d.filter((b,g)=>g!==C);Et(a,T)},w=(C,T)=>{const b=[...d],[g]=b.splice(C,1);b.splice(T,0,g),Et(a,b)};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:s}),i&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-1 leading-relaxed",children:i})]}),n(P,{variant:"secondary",size:"sm",icon:Sa,onClick:p,fullWidth:!0,class:"sm:w-auto",children:l("config.field.addItem")})]}),n("div",{class:"space-y-2 w-full",children:[d.map((C,T)=>n("div",{class:"flex items-center gap-1 p-2 rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)]",children:[d.length>1&&n("div",{class:"flex flex-col sm:hidden",children:[n("button",{type:"button",class:"p-2 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] disabled:opacity-30",onClick:()=>T>0&&w(T,T-1),disabled:T===0,"aria-label":l("config.field.moveUp"),children:n(Tl,{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<d.length-1&&w(T,T+1),disabled:T===d.length-1,"aria-label":l("config.field.moveDown"),children:n(Ne,{class:"w-4 h-4"})})]}),d.length>1&&n("div",{class:"hidden sm:block p-1 cursor-grab text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]",title:l("config.field.dragToReorder"),children:n(Mb,{class:"w-4 h-4"})}),n(Y,{type:f==="number"?"number":"text",value:String(C??""),onInput:b=>{const g=b.target.value,y=[...d];y[T]=f==="number"?Number(g):g,Et(a,y)},fullWidth:!0}),n(q,{icon:n(bt,{class:"w-5 h-5 sm:w-4 sm:h-4"}),label:l("config.field.removeItem"),onClick:()=>v(T),size:"md",variant:"ghost",class:"!p-2.5 sm:!p-1.5 flex-shrink-0"})]},T)),d.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:l("common.noItems")})]})]}):n("div",{class:"mt-6 first:mt-3",children:[n("div",{class:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-3",children:[n("button",{type:"button",class:"flex items-center gap-2 group",onClick:()=>u(!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(Ne,{class:"w-4 h-4"}):n(Ve,{class:"w-4 h-4"})}),n("span",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:s}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",d.length,")"]})]}),n(P,{variant:"secondary",size:"sm",icon:Sa,onClick:p,fullWidth:!0,class:"sm:w-auto",children:l("config.field.addItem")})]}),i&&n("p",{class:"text-xs text-[var(--color-text-muted)] mb-3 leading-relaxed",children:i}),c&&n("div",{class:"space-y-3",children:d.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:l("common.noItems")}):d.map((C,T)=>n(GT,{schema:h,value:C,path:[...a,T],parentPath:a,hints:r,level:o+1,index:T,totalItems:d.length,onRemove:()=>v(T),onReorder:w},T))})]})}function GT({schema:e,value:t,path:a,parentPath:r,hints:o,level:s,index:i,totalItems:c,onRemove:u,onReorder:d}){const[h,f]=U(!1),[p,v]=U(!1),[w,C]=U(!1),T=t??{},b=T.id??T.name??T.label??T.displayName??`#${i+1}`,y=T.identity?.emoji??"",E=A=>{v(!0),A.dataTransfer.effectAllowed="move",A.dataTransfer.setData("text/plain",JSON.stringify({path:r.join("."),index:i}))},x=()=>{v(!1)},S=A=>{A.preventDefault(),A.dataTransfer.dropEffect="move",C(!0)},k=()=>{C(!1)},I=A=>{A.preventDefault(),C(!1);try{const O=JSON.parse(A.dataTransfer.getData("text/plain"));O.path===r.join(".")&&O.index!==i&&d(O.index,i)}catch{}};return n(G,{padding:"none",class:`overflow-hidden transition-all ${p?"opacity-50":""} ${w?"ring-2 ring-[var(--color-accent)]":""}`,draggable:c>1,onDragStart:E,onDragEnd:x,onDragOver:S,onDragLeave:k,onDrop:I,children:[n("div",{class:"flex items-center gap-1 sm:gap-2 px-2 sm:px-3 py-2 sm:py-3 select-none",children:[c>1&&n("div",{class:"flex flex-col sm:hidden",children:[n("button",{type:"button",class:"p-3 -m-1 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] active:bg-[var(--color-bg-hover)] rounded disabled:opacity-30",onClick:()=>i>0&&d(i,i-1),disabled:i===0,"aria-label":l("config.field.moveUp"),children:n(Tl,{class:"w-5 h-5"})}),n("button",{type:"button",class:"p-3 -m-1 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] active:bg-[var(--color-bg-hover)] rounded disabled:opacity-30",onClick:()=>i<c-1&&d(i,i+1),disabled:i===c-1,"aria-label":l("config.field.moveDown"),children:n(Ne,{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:l("config.field.dragToReorder"),children:n(Mb,{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(Ne,{class:"w-4 h-4"}):n(Ve,{class:"w-4 h-4"})}),y&&n("span",{children:y}),n("span",{class:"text-sm font-medium",children:String(b)})]}),n(q,{icon:n(bt,{class:"w-5 h-5 sm:w-4 sm:h-4"}),label:l("config.field.removeItem"),onClick:u,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(Qr,{schema:e,value:t,path:a,hints:o,level:s,showLabel:!1,isDetailView:!0})})]})}function JT({schema:e,value:t,path:a,hints:r,level:o,label:s,help:i,showLabel:c}){const d=(e.anyOf??e.oneOf??[]).filter(f=>f.type!=="null"&&!(Array.isArray(f.type)&&f.type.includes("null")));if(d.length===1)return n(Qr,{schema:d[0],value:t,path:a,hints:r,level:o,showLabel:c});const h=d.map(f=>f.const??(f.enum?.length===1?f.enum[0]:void 0)).filter(f=>f!==void 0);if(h.length===d.length&&h.length>0){const f=d.map((p,v)=>({value:String(h[v]),label:p.title??wr(String(h[v]))}));return n(Bn,{label:c!==!1?s:void 0,description:i,inline:c!==!1,children:n(Ae,{value:String(t??""),options:f,onChange:p=>Et(a,p),size:"sm",class:"w-full sm:w-auto sm:inline-block"})})}return n(Bn,{label:c!==!1?s:void 0,description:i,children:n(Gx,{value:t,onChange:f=>Et(a,f)})})}function Qr({schema:e,value:t,path:a,hints:r,level:o=0,showLabel:s=!0,isDetailView:i=!1,skipNavWorthy:c=!1}){const u=$l(e),d=FT(a,r)??{},h=jx(a),f=d.label??e.title??wr(a[a.length-1]??""),p=d.help??e.description,v=So.value[h];if(e.anyOf||e.oneOf)return n(JT,{schema:e,value:t,path:a,hints:r,level:o,label:f,help:p,showLabel:s});switch(u){case"object":return n(qT,{schema:e,value:t,path:a,hints:r,level:o,label:f,help:p,isDetailView:i,skipNavWorthy:c});case"array":return n(VT,{schema:e,value:t,path:a,hints:r,level:o,label:f,help:p});case"boolean":return n(Bn,{error:v,children:n(Be,{checked:!!(t??e.default),onChange:w=>{Et(a,w)},label:s?f:void 0,description:p})});case"number":case"integer":return n(Bn,{label:s?f:void 0,description:p,error:v,inline:!0,children:n(Y,{type:"number",value:t==null?"":String(t),placeholder:d.placeholder,onInput:w=>{const C=w.target.value,T=C===""?void 0:Number(C);Et(a,T),Oi(h,$i(T,e))},min:e.minimum,max:e.maximum,class:"w-full sm:w-24 text-right"})});case"string":return YT({schema:e,value:t,path:a,hint:d,key:h,label:f,help:p,errorMsg:v,showLabel:s});default:return n(Bn,{label:s?f:void 0,description:p,error:v,children:n(Gx,{value:t,onChange:w=>Et(a,w)})})}}function YT({schema:e,value:t,path:a,hint:r,key:o,label:s,help:i,errorMsg:c,showLabel:u}){if(e.enum)return n(Bn,{label:u?s:void 0,description:i,error:c,inline:!0,children:n(Ae,{value:String(t??""),options:e.enum.map(p=>({value:String(p),label:wr(String(p))})),onChange:p=>Et(a,p),size:"sm",class:"w-full sm:w-auto sm:inline-block"})});if(r.sensitive)return n(Bn,{label:u?s:void 0,description:i,error:c,inline:!0,children:n(KT,{value:String(t??""),placeholder:r.placeholder,onChange:p=>{Et(a,p),Oi(o,$i(p,e))},wide:!0})});if((e.maxLength??0)>200)return n(Bn,{label:u?s:void 0,description:i,error:c,children:n(tr,{value:String(t??""),placeholder:r.placeholder,onInput:p=>{const v=p.target.value;Et(a,v),Oi(o,$i(v,e))},rows:4,class:"w-full"})});const d=e.format==="uri"||e.format==="url",h=o.toLowerCase().includes("path")||o.toLowerCase().includes("dir")||o.toLowerCase().includes("file"),f=d||h?"w-full sm:w-72":"w-full sm:w-48";return n(Bn,{label:u?s:void 0,description:i,error:c,inline:!0,children:n(Y,{type:d?"url":"text",value:String(t??""),placeholder:r.placeholder,onInput:p=>{const v=p.target.value;Et(a,v),Oi(o,$i(v,e))},class:f})})}function Cv({selectedPath:e,schema:t,draftConfig:a,uiHints:r,skipNavWorthy:o=!1}){const s=e.value,i=t.value,c=a.value,u=r.value;if(!i||s.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(gf,{class:"w-12 h-12 mx-auto mb-4 opacity-50"}),n("p",{children:l("config.selectSection")})]})});const d=Hx(i,s),h=OT(c,s);if(!d)return n("div",{class:"flex-1 p-6 text-[var(--color-text-muted)]",children:n("p",{children:l("config.schemaNotFound",{path:s.join(" › ")})})});const f=s.map((y,E)=>{const x=s.slice(0,E+1);return u[x.join(".")]?.label??wr(y)}),p=f[f.length-1],v=f.slice(0,-1),w=s.join("."),T=u[w]?.help??d.description,b=String(s[0]),g=Uf[b];return n("div",{class:"flex-1 overflow-y-auto",children:[n("div",{class:"hidden md:block px-4 sm:px-8 pt-4 sm:pt-6 pb-3 sm:pb-4 border-b border-[var(--color-border)] bg-[var(--color-bg-primary)]",children:[v.length>0&&n("div",{class:"text-xs text-[var(--color-text-muted)] mb-1.5",children:v.join(" › ")}),n("div",{class:"flex items-center gap-3",children:[g&&s.length===1&&n(g,{class:"w-6 h-6 text-[var(--color-accent)] opacity-80"}),n("h2",{class:"text-xl font-semibold text-[var(--color-text-primary)]",children:p})]}),T&&n("p",{class:"text-sm text-[var(--color-text-muted)] mt-2 max-w-2xl leading-relaxed",children:T})]}),T&&n("div",{class:"md:hidden px-4 pt-3 pb-2 border-b border-[var(--color-border)] bg-[var(--color-bg-primary)]",children:n("p",{class:"text-sm text-[var(--color-text-muted)] leading-relaxed",children:T})}),n("div",{class:"px-4 sm:px-8 py-4 sm:py-6 max-w-4xl",children:n(Qr,{schema:d,value:h,path:s,hints:u,level:0,showLabel:!1,isDetailView:!0,skipNavWorthy:o})})]})}function ZT({selectedPath:e,uiHints:t,isDirty:a,canSave:r,isSaving:o,onSave:s,onReset:i,onBack:c,showBack:u}){const d=e.value,h=t.value,f=u??d.length>0,p=()=>{if(d.length===0)return l("config.title");const b=d[d.length-1],g=d.join("."),y=h[g];return y?.label?y.label:wr(b)},v=()=>d.length<=1?null:d.slice(0,-1).map((g,y)=>{const E=d.slice(0,y+1);return h[E.join(".")]?.label??wr(g)}).join(" › "),w=()=>{c?c():d.length>0&&(e.value=d.slice(0,-1))},C=p(),T=v();return n("div",{class:"flex items-center gap-2 px-4 py-3 border-b border-[var(--color-border)] bg-[var(--color-bg-surface)]",children:[f&&n(q,{icon:n(Tb,{size:20}),onClick:w,label:l("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:C})]}),n("div",{class:"flex items-center gap-1",children:a&&n(H,{children:[n(q,{icon:n(Qc,{size:18}),onClick:i,label:l("config.reset"),size:"sm",variant:"ghost"}),n(q,{icon:n(vf,{size:18}),onClick:s,disabled:!r,label:l(o?"common.saving":"config.save"),size:"sm",variant:"ghost",class:r?"text-[var(--color-accent)]":""})]})})]})}function XT({items:e,selectedPath:t,isTopLevel:a=!1}){const r=o=>{t.value=o.path};return e.length===0?null:n("div",{class:"divide-y divide-[var(--color-border)]",children:e.map(o=>{const s=a?Uf[o.key]??qx: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:()=>r(o),children:[s&&n("div",{class:"w-8 h-8 rounded-lg bg-[var(--color-accent)]/10 flex items-center justify-center flex-shrink-0",children:n(s,{size:18,class:"text-[var(--color-accent)]"})}),n("span",{class:"flex-1 text-[var(--color-text-primary)] truncate",children:o.label}),n(Ve,{size:18,class:"text-[var(--color-text-muted)] flex-shrink-0"})]},o.key)})})}const Jx="cove:config:expandedNav";function jf(){const t=new URLSearchParams(window.location.search).get("section");return t?t.split(".").map(a=>{const r=Number(a);return Number.isInteger(r)&&r>=0?r:a}):[]}function QT(e){return e.length===0?"":e.join(".")}function eE(){try{const e=localStorage.getItem(Jx);if(e)return new Set(JSON.parse(e))}catch{}return new Set(["gateway","agents","channels"])}const Ce=m(jf()),kc=m(eE()),Pa=m(!1);Ce.subscribe(()=>{Pa.value=!1});let eh=!1;Ce.subscribe(e=>{const t=QT(e),a=new URLSearchParams(window.location.search),r=a.get("section")??"";if(t!==r){eh=!0,t?a.set("section",t):a.delete("section");const o=a.toString(),s=window.location.pathname+(o?`?${o}`:"")+window.location.hash;history.replaceState(null,"",s),eh=!1}if(e.length>1){const o=new Set(kc.value);for(let s=1;s<e.length;s++)o.add(e.slice(0,s).join("."));kc.value=o}});typeof window<"u"&&window.addEventListener("popstate",()=>{eh||(Ce.value=jf())});kc.subscribe(e=>{try{localStorage.setItem(Jx,JSON.stringify([...e]))}catch{}});function Yx(e,t){if(t.length===0)return null;const[a,...r]=t,o=e.find(s=>s.key===String(a));return o?r.length===0?o:o.children?Yx(o.children,r):null:null}function tE(e,t){if(t.length===0)return{items:e,isTopLevel:!0};const a=Yx(e,t);return a?.children&&a.children.length>0?{items:a.children,isTopLevel:!1}:null}function nE(e){R(()=>{const v=jf();v.length>0&&(Ce.value=v)},[]),R(()=>{D.value&&!zn.value&&_v()},[D.value]),R(()=>{if(!zn.value)return;const v=Ce.value,w=window.matchMedia("(max-width: 767px)").matches,T=Qd(zn.value,Yt.value,Fr.value)[0]?.path;if(v.length===0){T&&!w&&(Ce.value=T);return}const b=String(v[0]);zn.value.properties?.[b]||(w?Ce.value=[]:T&&(Ce.value=T))},[zn.value]);const t=async()=>{await BT()?V.success(l("config.saveSuccess")):_t.value&&V.error(_t.value)},a=()=>{HT(),V.success(l("config.reset"))},r=zn.value,o=Yt.value,s=Fr.value,i=r?Qd(r,o,s):[],c=Xu.value.toLowerCase().trim(),u=c?i.filter(v=>{const w=v.label.toLowerCase().includes(c),C=v.children?.some(T=>T.label.toLowerCase().includes(c));return w||C}):i,d=tE(i,Ce.value),h=d!==null&&!Pa.value,f=Hx(r,Ce.value),p=Ce.value.length>0&&d!==null&&d.items.length>0&&f!==null&&WT(f);return n(lu,{viewName:l("config.title"),children:[n("div",{class:"md:hidden flex-1 flex flex-col overflow-hidden",children:[n(ZT,{selectedPath:Ce,uiHints:Fr,isDirty:Pi.value,canSave:Xd.value,isSaving:el.value,onSave:t,onReset:a,showBack:Ce.value.length>0||Pa.value,onBack:()=>{Pa.value?Pa.value=!1:Ce.value.length>0&&(Ce.value=Ce.value.slice(0,-1))}}),_t.value&&n("div",{class:"px-4 pt-4",children:n(qn,{variant:"error",children:_t.value})}),aa.value&&!r&&n("div",{class:"flex-1 flex items-center justify-center",children:n(te,{size:"lg"})}),!aa.value&&r&&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:()=>{Pa.value=!0},children:[d.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(gf,{size:18,class:"text-[var(--color-text-muted)]"})}),n("span",{class:"flex-1 text-[var(--color-text-primary)]",children:l("config.general")}),n(Ve,{size:18,class:"text-[var(--color-text-muted)] flex-shrink-0"})]}),n(XT,{items:d.items,selectedPath:Ce,isTopLevel:d.isTopLevel})]}):n(Cv,{selectedPath:Ce,schema:zn,draftConfig:Yt,uiHints:Fr,skipNavWorthy:Pa.value})})]}),n("div",{class:"hidden md:flex md:flex-1 md:overflow-y-auto p-6",children:n("div",{class:"max-w-5xl mx-auto w-full space-y-6",children:[n(Ht,{title:l("config.title"),subtitle:l("config.description"),actions:n(H,{children:[Pi.value&&n("span",{class:"text-sm text-[var(--color-warning)]",children:l("config.unsavedChanges")}),n(P,{variant:"secondary",size:"sm",icon:Qc,onClick:a,disabled:!Pi.value,children:l("config.reset")}),n(P,{variant:"primary",size:"sm",icon:vf,onClick:t,disabled:!Xd.value,children:el.value?l("common.saving"):l("config.save")}),n(q,{icon:n(Qe,{class:aa.value?"animate-spin":""}),onClick:_v,disabled:aa.value,label:l("actions.refresh")})]})}),_t.value&&n(qn,{variant:"error",children:_t.value}),aa.value&&!r&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!aa.value&&r&&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(Y,{type:"text",placeholder:l("config.searchPlaceholder"),value:Xu.value,onInput:v=>{Xu.value=v.target.value},leftElement:n(ct,{class:"w-4 h-4"}),class:"text-sm"})}),n("div",{class:"flex-1 overflow-y-auto p-2",children:u.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] p-2",children:l(c?"config.noResults":"config.noFields")}):u.map(v=>n(Vx,{item:v,selectedPath:Ce,expandedNav:kc},v.key))})]}),n("div",{class:"flex-1 bg-[var(--color-bg-surface)]",children:n(Cv,{selectedPath:Ce,schema:zn,draftConfig:Yt,uiHints:Fr})})]})]})})]})}function ci({theme:e,isSelected:t,onClick:a,size:r="md"}){const o=e.colors["--color-bg-primary"],s=e.colors["--color-accent"],i=r==="sm"?"w-10 h-10":"w-12 h-12",c=r==="sm"?"w-3 h-3":"w-4 h-4",u=r==="sm"?"w-4 h-4":"w-5 h-5";return n(Do,{content:e.name,placement:"top",delay:200,children:n("button",{type:"button",onClick:a,class:`
419
+ `,children:[e&&n("p",{class:"font-medium mb-1",children:e}),a?n("ul",{class:"list-disc list-inside space-y-0.5",children:a.map((s,i)=>n("li",{children:s},i))}):t]})}function jx(e){return e.join(".")}function zT(e,t,a){if(t.length===0)return e;const r={...e};let o=r;for(let i=0;i<t.length-1;i++){const c=t[i],u=o[c];u==null||typeof u!="object"?o[c]=typeof t[i+1]=="number"?[]:{}:o[c]=Array.isArray(u)?[...u]:{...u},o=o[c]}const s=t[t.length-1];return a===void 0?delete o[s]:o[s]=a,r}function Hx(e,t){if(!e||t.length===0)return e??null;let a=e;for(const r of t){if(!a)return null;typeof r=="number"?a=a.items:a=a.properties?.[r]}return a??null}function UT(e,t){if(t.length===0)return e;let a=e;for(const r of t){if(a==null)return;a=a[r]}return a}function $l(e){if(!e)return null;if(typeof e.type=="string")return e.type;if(Array.isArray(e.type))return e.type.filter(a=>a!=="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 a=(e.anyOf??e.oneOf??[]).filter(r=>r.type!=="null"&&!(Array.isArray(r.type)&&r.type.includes("null")));if(a.length===1)return $l(a[0])}return null}function jT(e){if(e.default!==void 0)return e.default;if(e.const!==void 0)return e.const;switch($l(e)){case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";case"array":return[];case"object":return{};default:return}}function HT(e,t){const a=jx(e);if(t[a])return t[a];const r=[a.replace(/\.\d+\./g,".*."),a.replace(/\.\d+\./g,"[]."),a.replace(/\[\d+\]/g,"[*]")];for(const o of r)if(t[o])return t[o]}const BT=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 wr(e){return typeof e=="number"?`#${e+1}`:e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").split(" ").map(t=>{const a=t.toLowerCase();return BT.has(a)?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}).join(" ")}function Li(e,t){const a=$l(t);if(e==null)return t.nullable||Array.isArray(t.type)&&t.type.includes("null")||t.default!==void 0,null;switch(a){case"string":if(typeof e!="string")return l("config.validation.mustBeString");if(t.minLength&&e.length<t.minLength)return l("config.validation.minLength",{min:t.minLength});if(t.maxLength&&e.length>t.maxLength)return l("config.validation.maxLength",{max:t.maxLength});if(t.pattern&&!new RegExp(t.pattern).test(e))return l("config.validation.invalidFormat");break;case"number":case"integer":if(typeof e!="number")return l("config.validation.mustBeNumber");if(t.minimum!==void 0&&e<t.minimum)return l("config.validation.minimum",{min:t.minimum});if(t.maximum!==void 0&&e>t.maximum)return l("config.validation.maximum",{max:t.maximum});if(a==="integer"&&!Number.isInteger(e))return l("config.validation.mustBeInteger");break;case"boolean":if(typeof e!="boolean")return l("config.validation.mustBeBoolean");break;case"array":if(!Array.isArray(e))return l("config.validation.mustBeArray");if(t.minItems&&e.length<t.minItems)return l("config.validation.minItems",{min:t.minItems});if(t.maxItems&&e.length>t.maxItems)return l("config.validation.maxItems",{max:t.maxItems});break;case"object":if(typeof e!="object"||Array.isArray(e))return l("config.validation.mustBeObject");break}return t.enum&&!t.enum.includes(e)?l("config.validation.invalidOption"):null}const ra=m(!1),Ct=m(null),tl=m(!1),jn=m(null),Fr=m({}),nl=m({}),Zt=m({}),$i=m(null),Bx=m(null),Wx=m(!1),WT=m(!0),KT=m(null),Ju=m(""),_o=m({}),Di=K(()=>JSON.stringify(nl.value)!==JSON.stringify(Zt.value)),Jd=K(()=>Di.value&&!tl.value&&Object.keys(_o.value).length===0);async function _v(){ra.value=!0,Ct.value=null;try{const[e,t]=await Promise.all([N("config.get",{}),N("config.schema",{})]);jn.value=t.schema,Fr.value=t.uiHints,KT.value=t.version,nl.value=e.config,Zt.value=structuredClone(e.config),$i.value=e.hash??null,Bx.value=e.path??null,Wx.value=e.exists,WT.value=e.valid,_o.value={}}catch(e){Ct.value=ne(e)}finally{ra.value=!1}}function At(e,t){Zt.value=zT(Zt.value,e,t)}function qT(){Zt.value=structuredClone(nl.value),_o.value={}}function Pi(e,t){const a={..._o.value};t?a[e]=t:delete a[e],_o.value=a}async function VT(){if(!Jd.value)return!1;if(!$i.value&&Wx.value)return Ct.value="Missing base hash. Reload and try again.",!1;tl.value=!0,Ct.value=null;try{const e=Kx(nl.value,Zt.value),t=await N("config.patch",{raw:JSON.stringify(e),baseHash:$i.value});if(t.ok){nl.value=t.config,Zt.value=structuredClone(t.config),Bx.value=t.path;const a=await N("config.get",{});return $i.value=a.hash??null,!0}else return Ct.value="Failed to save configuration",!1}catch(e){const t=ne(e);return t.includes("hash")||t.includes("changed")?Ct.value="Configuration was modified externally. Please reload.":Ct.value=t,!1}finally{tl.value=!1}}function Kx(e,t){const a={};for(const r of Object.keys(t)){const o=e[r],s=t[r];JSON.stringify(o)!==JSON.stringify(s)&&(s!==null&&typeof s=="object"&&!Array.isArray(s)&&o!==null&&typeof o=="object"&&!Array.isArray(o)?a[r]=Kx(o,s):a[r]=s)}for(const r of Object.keys(e))r in t||(a[r]=null);return a}function GT(e){return e.properties?Object.values(e.properties).some(t=>!Ff(t)):!1}function Ff(e){return e.type==="array"&&e.items?.properties?!0:e.type==="object"&&e.properties?Object.keys(e.properties).length>=2:!1}function Yd(e,t,a,r=[],o=0){if(!e.properties)return[];const s=[];for(const[i,c]of Object.entries(e.properties)){const u=[...r,i],h=(a[i]??a[u.join(".")]??{}).label??c.title??wr(i);if(o>0&&!Ff(c))continue;const f={key:i,label:h,path:u,schema:c};if(c.type==="object"&&c.properties){const p=t[i]??{};f.children=Yd(c,p,a,u,o+1),f.children.length===0&&delete f.children}if(c.type==="array"&&c.items?.properties){const p=t[i]??[];f.children=p.map((v,w)=>{const C=v,T=C.identity,b=C.id??C.name??C.label??`#${w+1}`,g=T?.emoji??"";return{key:String(w),label:g?`${g} ${b}`:String(b),path:[...u,w],schema:c.items}})}s.push(f)}return s.sort((i,c)=>{const u=a[i.key]?.order??100,d=a[c.key]?.order??100;return u-d}),s}const zf={gateway:rn,agents:Cb,channels:ic,tools:Hb,commands:W4,session:ca,cron:ge,skills:Xc,plugins:ff,logging:Dn,auth:fm,models:dm,wizard:q4,update:Lt,diagnostics:pa,nodeHost:pr,audio:K4,messages:Pn,bindings:Lb,ui:F4,browser:En,hooks:V4,web:rn,canvas:Yr,canvasHost:Yr,approvals:Zc,notifications:uf,meta:Dn,env:hm,nodes:pr,broadcast:ic,media:Yr,network:Iu,secrets:Jc,memory:sc,memorySearch:sc,storage:hm,tls:fm,remote:Iu,reload:Xe,tailscale:Iu,sandbox:dm,context:Id,contextPruning:Id,compaction:Nn,heartbeat:pa,defaults:mf},qx=_4;function Vx({item:e,depth:t=0,selectedPath:a,expandedNav:r}){const o=e.path.join("."),s=r.value.has(o),i=a.value.join(".")===o||a.value.join(".").startsWith(o+"."),c=e.children&&e.children.length>0,u=t===0?zf[e.key]??qx:void 0,d=()=>{a.value=e.path},h=p=>{p.stopPropagation();const v=new Set(r.value);s?v.delete(o):v.add(o),r.value=v},f=a.value.join(".")===o;return n("div",{children:[n("button",{type:"button",class:`w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded-md text-left transition-colors ${f?"bg-[var(--color-accent)] text-white":i?"text-[var(--color-accent)]":"hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)]"} ${t>0?"text-[var(--color-text-secondary)]":"font-medium"}`,style:{paddingLeft:`${t*16+8}px`},onClick:d,children:[c?n("button",{type:"button",class:"p-0.5 -ml-1 hover:bg-[var(--color-bg-primary)]/20 rounded",onClick:h,"aria-label":l(s?"accessibility.collapseSection":"accessibility.expandSection"),children:s?n(Ne,{class:"w-3.5 h-3.5"}):n(Ve,{class:"w-3.5 h-3.5"})}):n("span",{class:"w-4"}),u&&n(u,{class:"w-4 h-4 flex-shrink-0 opacity-70"}),n("span",{class:"truncate",children:e.label})]}),c&&s&&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(Vx,{item:p,depth:t+1,selectedPath:a,expandedNav:r},p.key))]})]})}function qn({label:e,description:t,error:a,inline:r,children:o}){return r&&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})]}),a&&n("p",{class:"text-xs text-[var(--color-error)] mt-1",children:a})]}):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,a&&n("p",{class:"text-xs text-[var(--color-error)] mt-1",children:a})]})}function JT({value:e,placeholder:t,onChange:a,wide:r}){const[o,s]=U(!1);return n("div",{class:"relative",children:[n(Y,{type:o?"text":"password",value:e,placeholder:t,onInput:i=>a(i.target.value),class:`pr-10 w-full ${r?"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:()=>s(!o),"aria-label":l(o?"config.field.hidePassword":"config.field.showPassword"),children:o?n(Ab,{class:"w-4 h-4"}):n(df,{class:"w-4 h-4"})})]})}function Gx({value:e,onChange:t}){const[a,r]=U(()=>JSON.stringify(e,null,2)??""),[o,s]=U(null);return n("div",{class:"space-y-1",children:[n(tr,{value:a,onInput:c=>r(c.target.value),onBlur:()=>{try{const c=JSON.parse(a);t(c),s(null)}catch{s(l("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 YT({schema:e,value:t,path:a,hints:r,level:o,label:s,help:i,isDetailView:c=!1,skipNavWorthy:u=!1}){const[d,h]=U(o<2||c),f=e.properties??{},p=Object.keys(f).filter(w=>{if(!u)return!0;const C=f[w];return!Ff(C)}),v=t??{};return c&&o===0?p.length===0?n("div",{class:"text-sm text-[var(--color-text-muted)] py-4",children:l("config.noSettingsAtLevel")}):n("div",{class:"space-y-2",children:[i&&n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:i}),p.map(w=>n(Qr,{schema:f[w],value:v[w],path:[...a,w],hints:r,level:o+1,skipNavWorthy:u},w))]}):n("div",{class:"mt-6 first:mt-3",children:[n("div",{class:"md:hidden",children:n("div",{class:"rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] overflow-hidden",children:[n("div",{class:"px-4 py-3 bg-[var(--color-bg-secondary)] border-b border-[var(--color-border)]",children:[n("span",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:s}),i&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-1 leading-relaxed",children:i})]}),n("div",{class:"px-4 py-2",children:p.map(w=>n(Qr,{schema:f[w],value:v[w],path:[...a,w],hints:r,level:o+1,skipNavWorthy:u},w))})]})}),n("div",{class:"hidden md:block",children:[n("button",{type:"button",class:"flex items-center gap-2 py-2 text-left group",onClick:()=>h(!d),"aria-expanded":d,children:[n("span",{class:"text-[var(--color-text-muted)] group-hover:text-[var(--color-text-primary)] transition-colors",children:d?n(Ne,{class:"w-4 h-4"}):n(Ve,{class:"w-4 h-4"})}),n("span",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:s}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",p.length,")"]})]}),d&&n("div",{class:"ml-6 pl-4 border-l border-[var(--color-border)] mt-1",children:[i&&n("p",{class:"text-xs text-[var(--color-text-muted)] pb-2 leading-relaxed",children:i}),p.map(w=>n(Qr,{schema:f[w],value:v[w],path:[...a,w],hints:r,level:o+1,skipNavWorthy:u},w))]})]})]})}function ZT({schema:e,value:t,path:a,hints:r,level:o,label:s,help:i}){const[c,u]=U(o<2),d=t??[],h=e.items??{},f=$l(h),p=()=>{const C=jT(h);At(a,[...d,C])},v=C=>{const T=d.filter((b,g)=>g!==C);At(a,T)},w=(C,T)=>{const b=[...d],[g]=b.splice(C,1);b.splice(T,0,g),At(a,b)};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:s}),i&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-1 leading-relaxed",children:i})]}),n(P,{variant:"secondary",size:"sm",icon:Sa,onClick:p,fullWidth:!0,class:"sm:w-auto",children:l("config.field.addItem")})]}),n("div",{class:"space-y-2 w-full",children:[d.map((C,T)=>n("div",{class:"flex items-center gap-1 p-2 rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)]",children:[d.length>1&&n("div",{class:"flex flex-col sm:hidden",children:[n("button",{type:"button",class:"p-2 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] disabled:opacity-30",onClick:()=>T>0&&w(T,T-1),disabled:T===0,"aria-label":l("config.field.moveUp"),children:n(Tl,{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<d.length-1&&w(T,T+1),disabled:T===d.length-1,"aria-label":l("config.field.moveDown"),children:n(Ne,{class:"w-4 h-4"})})]}),d.length>1&&n("div",{class:"hidden sm:block p-1 cursor-grab text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]",title:l("config.field.dragToReorder"),children:n(Mb,{class:"w-4 h-4"})}),n(Y,{type:f==="number"?"number":"text",value:String(C??""),onInput:b=>{const g=b.target.value,y=[...d];y[T]=f==="number"?Number(g):g,At(a,y)},fullWidth:!0}),n(q,{icon:n(bt,{class:"w-5 h-5 sm:w-4 sm:h-4"}),label:l("config.field.removeItem"),onClick:()=>v(T),size:"md",variant:"ghost",class:"!p-2.5 sm:!p-1.5 flex-shrink-0"})]},T)),d.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:l("common.noItems")})]})]}):n("div",{class:"mt-6 first:mt-3",children:[n("div",{class:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-3",children:[n("button",{type:"button",class:"flex items-center gap-2 group",onClick:()=>u(!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(Ne,{class:"w-4 h-4"}):n(Ve,{class:"w-4 h-4"})}),n("span",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:s}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",d.length,")"]})]}),n(P,{variant:"secondary",size:"sm",icon:Sa,onClick:p,fullWidth:!0,class:"sm:w-auto",children:l("config.field.addItem")})]}),i&&n("p",{class:"text-xs text-[var(--color-text-muted)] mb-3 leading-relaxed",children:i}),c&&n("div",{class:"space-y-3",children:d.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:l("common.noItems")}):d.map((C,T)=>n(XT,{schema:h,value:C,path:[...a,T],parentPath:a,hints:r,level:o+1,index:T,totalItems:d.length,onRemove:()=>v(T),onReorder:w},T))})]})}function XT({schema:e,value:t,path:a,parentPath:r,hints:o,level:s,index:i,totalItems:c,onRemove:u,onReorder:d}){const[h,f]=U(!1),[p,v]=U(!1),[w,C]=U(!1),T=t??{},b=T.id??T.name??T.label??T.displayName??`#${i+1}`,y=T.identity?.emoji??"",E=A=>{v(!0),A.dataTransfer.effectAllowed="move",A.dataTransfer.setData("text/plain",JSON.stringify({path:r.join("."),index:i}))},x=()=>{v(!1)},S=A=>{A.preventDefault(),A.dataTransfer.dropEffect="move",C(!0)},k=()=>{C(!1)},I=A=>{A.preventDefault(),C(!1);try{const O=JSON.parse(A.dataTransfer.getData("text/plain"));O.path===r.join(".")&&O.index!==i&&d(O.index,i)}catch{}};return n(G,{padding:"none",class:`overflow-hidden transition-all ${p?"opacity-50":""} ${w?"ring-2 ring-[var(--color-accent)]":""}`,draggable:c>1,onDragStart:E,onDragEnd:x,onDragOver:S,onDragLeave:k,onDrop:I,children:[n("div",{class:"flex items-center gap-1 sm:gap-2 px-2 sm:px-3 py-2 sm:py-3 select-none",children:[c>1&&n("div",{class:"flex flex-col sm:hidden",children:[n("button",{type:"button",class:"p-3 -m-1 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] active:bg-[var(--color-bg-hover)] rounded disabled:opacity-30",onClick:()=>i>0&&d(i,i-1),disabled:i===0,"aria-label":l("config.field.moveUp"),children:n(Tl,{class:"w-5 h-5"})}),n("button",{type:"button",class:"p-3 -m-1 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] active:bg-[var(--color-bg-hover)] rounded disabled:opacity-30",onClick:()=>i<c-1&&d(i,i+1),disabled:i===c-1,"aria-label":l("config.field.moveDown"),children:n(Ne,{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:l("config.field.dragToReorder"),children:n(Mb,{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(Ne,{class:"w-4 h-4"}):n(Ve,{class:"w-4 h-4"})}),y&&n("span",{children:y}),n("span",{class:"text-sm font-medium",children:String(b)})]}),n(q,{icon:n(bt,{class:"w-5 h-5 sm:w-4 sm:h-4"}),label:l("config.field.removeItem"),onClick:u,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(Qr,{schema:e,value:t,path:a,hints:o,level:s,showLabel:!1,isDetailView:!0})})]})}function QT({schema:e,value:t,path:a,hints:r,level:o,label:s,help:i,showLabel:c}){const d=(e.anyOf??e.oneOf??[]).filter(f=>f.type!=="null"&&!(Array.isArray(f.type)&&f.type.includes("null")));if(d.length===1)return n(Qr,{schema:d[0],value:t,path:a,hints:r,level:o,showLabel:c});const h=d.map(f=>f.const??(f.enum?.length===1?f.enum[0]:void 0)).filter(f=>f!==void 0);if(h.length===d.length&&h.length>0){const f=d.map((p,v)=>({value:String(h[v]),label:p.title??wr(String(h[v]))}));return n(qn,{label:c!==!1?s:void 0,description:i,inline:c!==!1,children:n(Me,{value:String(t??""),options:f,onChange:p=>At(a,p),size:"sm",class:"w-full sm:w-auto sm:inline-block"})})}return n(qn,{label:c!==!1?s:void 0,description:i,children:n(Gx,{value:t,onChange:f=>At(a,f)})})}function Qr({schema:e,value:t,path:a,hints:r,level:o=0,showLabel:s=!0,isDetailView:i=!1,skipNavWorthy:c=!1}){const u=$l(e),d=HT(a,r)??{},h=jx(a),f=d.label??e.title??wr(a[a.length-1]??""),p=d.help??e.description,v=_o.value[h];if(e.anyOf||e.oneOf)return n(QT,{schema:e,value:t,path:a,hints:r,level:o,label:f,help:p,showLabel:s});switch(u){case"object":return n(YT,{schema:e,value:t,path:a,hints:r,level:o,label:f,help:p,isDetailView:i,skipNavWorthy:c});case"array":return n(ZT,{schema:e,value:t,path:a,hints:r,level:o,label:f,help:p});case"boolean":return n(qn,{error:v,children:n(Be,{checked:!!(t??e.default),onChange:w=>{At(a,w)},label:s?f:void 0,description:p})});case"number":case"integer":return n(qn,{label:s?f:void 0,description:p,error:v,inline:!0,children:n(Y,{type:"number",value:t==null?"":String(t),placeholder:d.placeholder,onInput:w=>{const C=w.target.value,T=C===""?void 0:Number(C);At(a,T),Pi(h,Li(T,e))},min:e.minimum,max:e.maximum,class:"w-full sm:w-24 text-right"})});case"string":return eE({schema:e,value:t,path:a,hint:d,key:h,label:f,help:p,errorMsg:v,showLabel:s});default:return n(qn,{label:s?f:void 0,description:p,error:v,children:n(Gx,{value:t,onChange:w=>At(a,w)})})}}function eE({schema:e,value:t,path:a,hint:r,key:o,label:s,help:i,errorMsg:c,showLabel:u}){if(e.enum)return n(qn,{label:u?s:void 0,description:i,error:c,inline:!0,children:n(Me,{value:String(t??""),options:e.enum.map(p=>({value:String(p),label:wr(String(p))})),onChange:p=>At(a,p),size:"sm",class:"w-full sm:w-auto sm:inline-block"})});if(r.sensitive)return n(qn,{label:u?s:void 0,description:i,error:c,inline:!0,children:n(JT,{value:String(t??""),placeholder:r.placeholder,onChange:p=>{At(a,p),Pi(o,Li(p,e))},wide:!0})});if((e.maxLength??0)>200)return n(qn,{label:u?s:void 0,description:i,error:c,children:n(tr,{value:String(t??""),placeholder:r.placeholder,onInput:p=>{const v=p.target.value;At(a,v),Pi(o,Li(v,e))},rows:4,class:"w-full"})});const d=e.format==="uri"||e.format==="url",h=o.toLowerCase().includes("path")||o.toLowerCase().includes("dir")||o.toLowerCase().includes("file"),f=d||h?"w-full sm:w-72":"w-full sm:w-48";return n(qn,{label:u?s:void 0,description:i,error:c,inline:!0,children:n(Y,{type:d?"url":"text",value:String(t??""),placeholder:r.placeholder,onInput:p=>{const v=p.target.value;At(a,v),Pi(o,Li(v,e))},class:f})})}function Cv({selectedPath:e,schema:t,draftConfig:a,uiHints:r,skipNavWorthy:o=!1}){const s=e.value,i=t.value,c=a.value,u=r.value;if(!i||s.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(mf,{class:"w-12 h-12 mx-auto mb-4 opacity-50"}),n("p",{children:l("config.selectSection")})]})});const d=Hx(i,s),h=UT(c,s);if(!d)return n("div",{class:"flex-1 p-6 text-[var(--color-text-muted)]",children:n("p",{children:l("config.schemaNotFound",{path:s.join(" › ")})})});const f=s.map((y,E)=>{const x=s.slice(0,E+1);return u[x.join(".")]?.label??wr(y)}),p=f[f.length-1],v=f.slice(0,-1),w=s.join("."),T=u[w]?.help??d.description,b=String(s[0]),g=zf[b];return n("div",{class:"flex-1 overflow-y-auto",children:[n("div",{class:"hidden md:block px-4 sm:px-8 pt-4 sm:pt-6 pb-3 sm:pb-4 border-b border-[var(--color-border)] bg-[var(--color-bg-primary)]",children:[v.length>0&&n("div",{class:"text-xs text-[var(--color-text-muted)] mb-1.5",children:v.join(" › ")}),n("div",{class:"flex items-center gap-3",children:[g&&s.length===1&&n(g,{class:"w-6 h-6 text-[var(--color-accent)] opacity-80"}),n("h2",{class:"text-xl font-semibold text-[var(--color-text-primary)]",children:p})]}),T&&n("p",{class:"text-sm text-[var(--color-text-muted)] mt-2 max-w-2xl leading-relaxed",children:T})]}),T&&n("div",{class:"md:hidden px-4 pt-3 pb-2 border-b border-[var(--color-border)] bg-[var(--color-bg-primary)]",children:n("p",{class:"text-sm text-[var(--color-text-muted)] leading-relaxed",children:T})}),n("div",{class:"px-4 sm:px-8 py-4 sm:py-6 max-w-4xl",children:n(Qr,{schema:d,value:h,path:s,hints:u,level:0,showLabel:!1,isDetailView:!0,skipNavWorthy:o})})]})}function tE({selectedPath:e,uiHints:t,isDirty:a,canSave:r,isSaving:o,onSave:s,onReset:i,onBack:c,showBack:u}){const d=e.value,h=t.value,f=u??d.length>0,p=()=>{if(d.length===0)return l("config.title");const b=d[d.length-1],g=d.join("."),y=h[g];return y?.label?y.label:wr(b)},v=()=>d.length<=1?null:d.slice(0,-1).map((g,y)=>{const E=d.slice(0,y+1);return h[E.join(".")]?.label??wr(g)}).join(" › "),w=()=>{c?c():d.length>0&&(e.value=d.slice(0,-1))},C=p(),T=v();return n("div",{class:"flex items-center gap-2 px-4 py-3 border-b border-[var(--color-border)] bg-[var(--color-bg-surface)]",children:[f&&n(q,{icon:n(Tb,{size:20}),onClick:w,label:l("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:C})]}),n("div",{class:"flex items-center gap-1",children:a&&n(H,{children:[n(q,{icon:n(Yc,{size:18}),onClick:i,label:l("config.reset"),size:"sm",variant:"ghost"}),n(q,{icon:n(pf,{size:18}),onClick:s,disabled:!r,label:l(o?"common.saving":"config.save"),size:"sm",variant:"ghost",class:r?"text-[var(--color-accent)]":""})]})})]})}function nE({items:e,selectedPath:t,isTopLevel:a=!1}){const r=o=>{t.value=o.path};return e.length===0?null:n("div",{class:"divide-y divide-[var(--color-border)]",children:e.map(o=>{const s=a?zf[o.key]??qx: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:()=>r(o),children:[s&&n("div",{class:"w-8 h-8 rounded-lg bg-[var(--color-accent)]/10 flex items-center justify-center flex-shrink-0",children:n(s,{size:18,class:"text-[var(--color-accent)]"})}),n("span",{class:"flex-1 text-[var(--color-text-primary)] truncate",children:o.label}),n(Ve,{size:18,class:"text-[var(--color-text-muted)] flex-shrink-0"})]},o.key)})})}const Jx="cove:config:expandedNav";function Uf(){const t=new URLSearchParams(window.location.search).get("section");return t?t.split(".").map(a=>{const r=Number(a);return Number.isInteger(r)&&r>=0?r:a}):[]}function aE(e){return e.length===0?"":e.join(".")}function rE(){try{const e=localStorage.getItem(Jx);if(e)return new Set(JSON.parse(e))}catch{}return new Set(["gateway","agents","channels"])}const Te=m(Uf()),yc=m(rE()),Pa=m(!1);Te.subscribe(()=>{Pa.value=!1});let Zd=!1;Te.subscribe(e=>{const t=aE(e),a=new URLSearchParams(window.location.search),r=a.get("section")??"";if(t!==r){Zd=!0,t?a.set("section",t):a.delete("section");const o=a.toString(),s=window.location.pathname+(o?`?${o}`:"")+window.location.hash;history.replaceState(null,"",s),Zd=!1}if(e.length>1){const o=new Set(yc.value);for(let s=1;s<e.length;s++)o.add(e.slice(0,s).join("."));yc.value=o}});typeof window<"u"&&window.addEventListener("popstate",()=>{Zd||(Te.value=Uf())});yc.subscribe(e=>{try{localStorage.setItem(Jx,JSON.stringify([...e]))}catch{}});function Yx(e,t){if(t.length===0)return null;const[a,...r]=t,o=e.find(s=>s.key===String(a));return o?r.length===0?o:o.children?Yx(o.children,r):null:null}function oE(e,t){if(t.length===0)return{items:e,isTopLevel:!0};const a=Yx(e,t);return a?.children&&a.children.length>0?{items:a.children,isTopLevel:!1}:null}function sE(e){R(()=>{const v=Uf();v.length>0&&(Te.value=v)},[]),R(()=>{D.value&&!jn.value&&_v()},[D.value]),R(()=>{if(!jn.value)return;const v=Te.value,w=window.matchMedia("(max-width: 767px)").matches,T=Yd(jn.value,Zt.value,Fr.value)[0]?.path;if(v.length===0){T&&!w&&(Te.value=T);return}const b=String(v[0]);jn.value.properties?.[b]||(w?Te.value=[]:T&&(Te.value=T))},[jn.value]);const t=async()=>{await VT()?V.success(l("config.saveSuccess")):Ct.value&&V.error(Ct.value)},a=()=>{qT(),V.success(l("config.reset"))},r=jn.value,o=Zt.value,s=Fr.value,i=r?Yd(r,o,s):[],c=Ju.value.toLowerCase().trim(),u=c?i.filter(v=>{const w=v.label.toLowerCase().includes(c),C=v.children?.some(T=>T.label.toLowerCase().includes(c));return w||C}):i,d=oE(i,Te.value),h=d!==null&&!Pa.value,f=Hx(r,Te.value),p=Te.value.length>0&&d!==null&&d.items.length>0&&f!==null&&GT(f);return n(ru,{viewName:l("config.title"),children:[n("div",{class:"md:hidden flex-1 flex flex-col overflow-hidden",children:[n(tE,{selectedPath:Te,uiHints:Fr,isDirty:Di.value,canSave:Jd.value,isSaving:tl.value,onSave:t,onReset:a,showBack:Te.value.length>0||Pa.value,onBack:()=>{Pa.value?Pa.value=!1:Te.value.length>0&&(Te.value=Te.value.slice(0,-1))}}),Ct.value&&n("div",{class:"px-4 pt-4",children:n(Jn,{variant:"error",children:Ct.value})}),ra.value&&!r&&n("div",{class:"flex-1 flex items-center justify-center",children:n(te,{size:"lg"})}),!ra.value&&r&&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:()=>{Pa.value=!0},children:[d.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(mf,{size:18,class:"text-[var(--color-text-muted)]"})}),n("span",{class:"flex-1 text-[var(--color-text-primary)]",children:l("config.general")}),n(Ve,{size:18,class:"text-[var(--color-text-muted)] flex-shrink-0"})]}),n(nE,{items:d.items,selectedPath:Te,isTopLevel:d.isTopLevel})]}):n(Cv,{selectedPath:Te,schema:jn,draftConfig:Zt,uiHints:Fr,skipNavWorthy:Pa.value})})]}),n("div",{class:"hidden md:flex md:flex-1 md:overflow-y-auto p-6",children:n("div",{class:"max-w-5xl mx-auto w-full space-y-6",children:[n(Wt,{title:l("config.title"),subtitle:l("config.description"),actions:n(H,{children:[Di.value&&n("span",{class:"text-sm text-[var(--color-warning)]",children:l("config.unsavedChanges")}),n(P,{variant:"secondary",size:"sm",icon:Yc,onClick:a,disabled:!Di.value,children:l("config.reset")}),n(P,{variant:"primary",size:"sm",icon:pf,onClick:t,disabled:!Jd.value,children:tl.value?l("common.saving"):l("config.save")}),n(q,{icon:n(Xe,{class:ra.value?"animate-spin":""}),onClick:_v,disabled:ra.value,label:l("actions.refresh")})]})}),Ct.value&&n(Jn,{variant:"error",children:Ct.value}),ra.value&&!r&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!ra.value&&r&&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(Y,{type:"text",placeholder:l("config.searchPlaceholder"),value:Ju.value,onInput:v=>{Ju.value=v.target.value},leftElement:n(it,{class:"w-4 h-4"}),class:"text-sm"})}),n("div",{class:"flex-1 overflow-y-auto p-2",children:u.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] p-2",children:l(c?"config.noResults":"config.noFields")}):u.map(v=>n(Vx,{item:v,selectedPath:Te,expandedNav:yc},v.key))})]}),n("div",{class:"flex-1 bg-[var(--color-bg-surface)]",children:n(Cv,{selectedPath:Te,schema:jn,draftConfig:Zt,uiHints:Fr})})]})]})})]})}function ii({theme:e,isSelected:t,onClick:a,size:r="md"}){const o=e.colors["--color-bg-primary"],s=e.colors["--color-accent"],i=r==="sm"?"w-10 h-10":"w-12 h-12",c=r==="sm"?"w-3 h-3":"w-4 h-4",u=r==="sm"?"w-4 h-4":"w-5 h-5";return n(Do,{content:e.name,placement:"top",delay:200,children:n("button",{type:"button",onClick:a,class:`
420
420
  relative ${i} rounded-xl border-2 transition-all
421
421
  hover:scale-105
422
422
  focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)] focus:ring-offset-2
423
423
  ${t?"border-[var(--color-accent)] ring-2 ring-[var(--color-accent)]":"border-[var(--color-border)] hover:border-[var(--color-text-muted)]"}
424
- `,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:s}}),t&&n("span",{class:"absolute inset-0 flex items-center justify-center",children:n(on,{class:`${u} text-[var(--color-accent)]`,strokeWidth:3})})]})})}function ui({icon:e,titleKey:t,selectedThemeName:a}){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:l(t)}),a&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:["— ",a]})]})}function aE(){const e=xd(),t=vt.value,a=t.selected==="system",r=e.filter(h=>h.appearance==="light"),o=e.filter(h=>h.appearance==="dark"),s=t.lightTheme,i=t.darkTheme,c=t.selected!=="system"?t.selected:null,u=h=>{if(h)ms("system");else{const f=window.matchMedia("(prefers-color-scheme: dark)").matches;ms(f?i:s)}},d=(h,f)=>{a?f==="light"?X1(h):Q1(h):ms(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(Gt,{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:l("settings.appearance.useSystemTheme")}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:l("settings.appearance.useSystemThemeDescription")})]})]}),n(Be,{checked:a,onChange:u,size:"sm"})]}),a?n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6",children:[n("div",{children:[n(ui,{icon:n(vm,{class:"w-4 h-4"}),titleKey:"settings.appearance.lightTheme",selectedThemeName:r.find(h=>h.id===s)?.name}),n("div",{class:"flex flex-wrap gap-2",children:r.map(h=>n(ci,{theme:h,isSelected:s===h.id,onClick:()=>d(h.id,"light")},h.id))})]}),n("div",{children:[n(ui,{icon:n(mm,{class:"w-4 h-4"}),titleKey:"settings.appearance.darkTheme",selectedThemeName:o.find(h=>h.id===i)?.name}),n("div",{class:"flex flex-wrap gap-2",children:o.map(h=>n(ci,{theme:h,isSelected:i===h.id,onClick:()=>d(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(ui,{icon:n(vm,{class:"w-4 h-4"}),titleKey:"common.light",selectedThemeName:r.find(h=>h.id===c)?.name}),n("div",{class:"flex flex-wrap gap-2",children:r.map(h=>n(ci,{theme:h,isSelected:c===h.id,onClick:()=>d(h.id,"light")},h.id))})]}),n("div",{children:[n(ui,{icon:n(mm,{class:"w-4 h-4"}),titleKey:"common.dark",selectedThemeName:o.find(h=>h.id===c)?.name}),n("div",{class:"flex flex-wrap gap-2",children:o.map(h=>n(ci,{theme:h,isSelected:c===h.id,onClick:()=>d(h.id,"dark")},h.id))})]})]})]})}function rE(){i1()}function oE(e=!0){Uk(),K2(),uo(),e&&rE(),Oe("/")}const Zx="cove:device-identity",th="cove:device-display-name",_o=m(typeof localStorage<"u"?localStorage.getItem(th):null);function sE(e){e?.trim()?(localStorage.setItem(th,e.trim()),_o.value=e.trim()):(localStorage.removeItem(th),_o.value=null)}function Xx(e){const t=new Uint8Array(e);let a="";for(let r=0;r<t.length;r++)a+=String.fromCharCode(t[r]);return btoa(a).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}async function Qx(e){const t=await crypto.subtle.exportKey("raw",e),a=await crypto.subtle.digest("SHA-256",t),r=new Uint8Array(a);return Array.from(r).map(o=>o.toString(16).padStart(2,"0")).join("")}async function lE(){const e=await crypto.subtle.generateKey("Ed25519",!0,["sign","verify"]),t=await crypto.subtle.exportKey("raw",e.publicKey),a=Xx(t);return{deviceId:await Qx(e.publicKey),publicKeyBase64Url:a,privateKey:e.privateKey,publicKey:e.publicKey}}async function iE(e){const t=await crypto.subtle.exportKey("jwk",e.privateKey),a=await crypto.subtle.exportKey("jwk",e.publicKey),r={version:1,deviceId:e.deviceId,publicKeyBase64Url:e.publicKeyBase64Url,privateKeyJwk:t,publicKeyJwk:a,createdAtMs:Date.now()};localStorage.setItem(Zx,JSON.stringify(r)),M.node.debug("Stored device identity:",e.deviceId.slice(0,16)+"...")}async function cE(){try{const e=localStorage.getItem(Zx);if(!e)return null;const t=JSON.parse(e);if(t?.version!==1)return null;const a=await crypto.subtle.importKey("jwk",t.privateKeyJwk,"Ed25519",!0,["sign"]),r=await crypto.subtle.importKey("jwk",t.publicKeyJwk,"Ed25519",!0,["verify"]);return await Qx(r)!==t.deviceId?(M.node.warn("Device ID mismatch, regenerating identity"),null):(M.node.debug("Loaded device identity:",t.deviceId.slice(0,16)+"..."),{deviceId:t.deviceId,publicKeyBase64Url:t.publicKeyBase64Url,privateKey:a,publicKey:r})}catch(e){return M.node.warn("Failed to load device identity:",e),null}}let Xn=null;async function uu(){return Xn||(Xn=await cE(),Xn)||(M.node.debug("Generating new device identity"),Xn=await lE(),await iE(Xn)),Xn}function uE(e){const t=e.nonce?"v2":"v1",a=e.scopes.join(","),r=e.token??"",o=[t,e.deviceId,e.clientId,e.clientMode,e.role,a,String(e.signedAtMs),r];return t==="v2"&&o.push(e.nonce??""),o.join("|")}async function dE(e,t){const r=new TextEncoder().encode(t),o=await crypto.subtle.sign("Ed25519",e.privateKey,r);return Xx(o)}async function hE(e){const t=await uu(),a=Date.now(),r=e.scopes??[],o=uE({deviceId:t.deviceId,clientId:e.clientId,clientMode:e.clientMode,role:e.role,scopes:r,signedAtMs:a,token:e.token,nonce:e.nonce}),s=await dE(t,o);return{id:t.deviceId,publicKey:t.publicKeyBase64Url,signature:s,signedAt:a,...e.nonce?{nonce:e.nonce}:{}}}async function fE(){return _o.value?_o.value:`Cove Canvas (${(await uu()).deviceId.slice(0,8)})`}function pE(e){return e?e.startsWith("image/"):!1}function Tv(e){if(!e)return!1;const t=e.toLowerCase();return/\.(png|jpg|jpeg|gif|webp|svg|ico|bmp)(\?|$)/.test(t)}function Hf(e,t){let a=e,r=t;if(e.startsWith("data:")){const c=e.match(/^data:([^;]+);base64,(.+)$/);c&&(r=c[1],a=c[2])}let o;try{o=atob(a)}catch{throw new Error("Invalid base64 data")}const s=new Uint8Array(o.length);for(let c=0;c<o.length;c++)s[c]=o.charCodeAt(c);const i=new Blob([s],{type:r});return URL.createObjectURL(i)}const Rr=m(!1),Co=m("unpaired"),Sc=m(null),zr=m(!1),nr=m(null),mE=m(null),ar=m(null),du=m(null),nh=m(!1),Ni=m(null),Fi=m(null),ey=typeof BroadcastChannel<"u"?new BroadcastChannel("cove:canvas"):null;let _c=null,ah=null;function rh(){ey?.postMessage({type:"canvas-content",url:nr.value,base64:_c,mimeType:ah})}ey?.addEventListener("message",e=>{if(e.data.type==="canvas-content"){if(e.data.url)nr.value=e.data.url,ar.value=null;else if(e.data.base64)try{const t=Hf(e.data.base64,e.data.mimeType||"image/png");ar.value=t,du.value=e.data.mimeType,nr.value=null}catch{}}if(e.data.type==="canvas-standalone-status"){const t=nh.value;nh.value=e.data.open,M.node.debug(`Standalone canvas status: ${e.data.open?"open":"closed"}`),e.data.open?(nr.value||_c)&&rh():t&&(M.node.debug("Standalone closed, re-registering node"),Dl())}});function vE(){ar.value&&(URL.revokeObjectURL(ar.value),ar.value=null),du.value=null}function gE(e){const t=/^https?:\/\/(127\.0\.0\.1|localhost)(:\d+)?(\/__openclaw__\/canvas)(\/.*)?/i,a=e.match(t);if(!a)return e;const o=`/_canvas${a[4]||"/"}`;return M.node.debug("Transformed canvas URL to proxy:",e,"->",o),o}function Ev(e){const t=e.url,a=e.imageBase64,r=e.imageMimeType||"image/png";if(vE(),a)try{const o=Hf(a,r);return ar.value=o,du.value=r,nr.value=null,_c=a,ah=r,rh(),{type:"base64",detail:r}}catch(o){return M.node.error("Failed to create blob from base64:",o),null}if(t){const o=gE(t);return nr.value=o,_c=null,ah=null,rh(),{type:"url",detail:o}}return null}let Ee=null,eo=null,ma=null,oh,is;const bE=15e3,Av=1e4,rr=new Map;let ty=0;const xE=3e4;function ny(e,t){return new Promise((a,r)=>{if(!Ee||Ee.readyState!==WebSocket.OPEN){r(new Error("Not connected"));return}const o=String(++ty),s=setTimeout(()=>{const i=rr.get(o);i&&(rr.delete(o),i.reject(new Error("Request timeout")))},xE);rr.set(o,{resolve:a,reject:r,timeout:s}),Ee.send(JSON.stringify({type:"req",id:o,method:e,params:t}))})}function yE(e){try{const t=JSON.parse(e);if(t.type==="res"&&t.id!=null){const a=rr.get(String(t.id));a&&(rr.delete(t.id),clearTimeout(a.timeout),t.ok?a.resolve(t.payload):a.reject(new Error(t.error?.message??"Request failed")));return}if(t.type==="evt"||t.type==="event"){if(t.event==="node.invoke.request"){_E(t.payload);return}wE(t.event,t.payload);return}}catch(t){M.node.error("Failed to parse message:",t)}}function wE(e,t){if(M.node.debug("Event:",e,t),e==="connect.challenge"){const a=t,r=typeof a.nonce=="string"?a.nonce:void 0;M.node.debug("Received connect.challenge with nonce:",r?.slice(0,8)+"..."),kE(r);return}e==="node.pair.resolved"&&(t.status==="approved"?(Co.value="paired",M.node.debug("Pairing approved! Reconnecting..."),Dl()):(Co.value="unpaired",M.node.debug("Pairing rejected")))}async function kE(e){try{const t=await uu(),a=await fE();Sc.value=t.deviceId;const r=await hE({clientId:"node-host",clientMode:"node",role:"node",scopes:[],token:is??null,nonce:e}),o={minProtocol:3,maxProtocol:3,role:"node",client:{id:"node-host",displayName:a,mode:"node",version:"1.0.0",platform:navigator.platform?.toLowerCase().includes("mac")?"macos":"web"},device:r,caps:["canvas"],commands:["canvas.present","canvas.hide","canvas.navigate","canvas.eval","canvas.snapshot"]};is&&(oh==="token"?o.auth={token:is}:oh==="password"&&(o.auth={password:is})),M.node.debug("Sending connect request with device:",r.id.slice(0,16)+"...");const s=await ny("connect",o);M.node.debug("Connect result:",s),Rr.value=!0,Co.value="paired",M.node.info("Node connected as device:",t.deviceId.slice(0,16)+"..."),SE()}catch(t){M.node.error("Connect failed:",t)}}function SE(){ma||(ma=setInterval(async()=>{if(Ee&&Ee.readyState===WebSocket.OPEN)try{await ny("ping",{}),M.node.debug("Keepalive ping successful")}catch{M.node.debug("Keepalive ping failed, reconnecting"),Dl()}},bE))}async function _E(e){const t=e;let a={};if(t.params&&typeof t.params=="object")a=t.params;else if(t.paramsJSON)try{a=JSON.parse(t.paramsJSON)}catch{M.node.error("Failed to parse paramsJSON:",t.paramsJSON)}M.node.debug("Invoke request:",t.command,"params keys:",Object.keys(a));let r={ok:!0},o;try{switch(t.command){case"canvas.present":{const s=Ev(a);zr.value=!1,zr.value=!0,s&&M.node.debug(`Canvas presented: ${s.type==="base64"?`(${s.detail})`:s.detail}`);break}case"canvas.hide":{zr.value=!1,M.node.debug("Canvas hidden");break}case"canvas.navigate":{const s=Ev(a);zr.value=!1,zr.value=!0,s&&M.node.debug(`Canvas navigated: ${s.type==="base64"?`(${s.detail})`:s.detail}`);break}case"canvas.eval":{const s=a.javaScript;if(M.node.debug("canvas.eval requested:",s?.slice(0,50)),!s){o={code:"INVALID_PARAMS",message:"javaScript parameter required"};break}try{r={result:await new Promise((c,u)=>{Ni.value={js:s,resolve:c,reject:d=>u(new Error(d))},setTimeout(()=>{Ni.value?.js===s&&(Ni.value=null,u(new Error("Canvas eval timeout")))},Av)})}}catch(i){o={code:"EVAL_ERROR",message:String(i)}}break}case"canvas.snapshot":{const s=a.maxWidth||800,i=a.quality||.8,u=(a.outputFormat||"jpeg")==="png"?"png":"jpeg";M.node.debug("canvas.snapshot requested:",{maxWidth:s,quality:i,outputFormat:u});try{r={dataUrl:await new Promise((h,f)=>{Fi.value={maxWidth:s,quality:i,outputFormat:u,resolve:h,reject:p=>f(new Error(p))},setTimeout(()=>{Fi.value&&(Fi.value=null,f(new Error("Canvas snapshot timeout")))},Av)})}}catch(d){o={code:"SNAPSHOT_ERROR",message:String(d)}}break}default:o={code:"UNKNOWN_COMMAND",message:`Unknown command: ${t.command}`}}}catch(s){o={code:"ERROR",message:String(s)}}if(Ee&&Ee.readyState===WebSocket.OPEN){const s={type:"req",id:String(++ty),method:"node.invoke.result",params:{id:t.id,nodeId:Sc.value,ok:!o,payload:o?void 0:r,error:o??void 0}};M.node.debug("Sending invoke result for node:",Sc.value?.slice(0,8)),Ee.send(JSON.stringify(s))}}async function Bf(){const e=gt.value,t=Bc(),a=Uh();if(M.node.debug("connectNode called"),!e){M.node.debug("No gateway URL, skipping node connection");return}oh=t?.authMode,is=a??void 0;const r=e.replace(/^http/,"ws");M.node.debug("Connecting to gateway as node"),Ee=new WebSocket(r),Ee.onopen=()=>{M.node.debug("WebSocket connected, waiting for connect.challenge")},Ee.onmessage=o=>{yE(String(o.data))},Ee.onclose=o=>{M.node.debug("WebSocket closed:",o.code,o.reason),Rr.value=!1,Ee=null,ma&&(clearInterval(ma),ma=null),eo||(eo=setTimeout(()=>{eo=null,Bf()},5e3))},Ee.onerror=()=>{M.node.error("WebSocket error")}}function Wf(){M.node.debug("startNodeConnection called"),gt.value?Bf():M.node.debug("No gateway URL, skipping node connection")}function Dl(){M.node.debug("refreshNodeRegistration called - doing full reconnect"),Ee&&(Ee.close(),Ee=null),Rr.value=!1,setTimeout(()=>{Bf()},500)}function Kf(){eo&&(clearTimeout(eo),eo=null),ma&&(clearInterval(ma),ma=null);for(const[e,t]of rr)clearTimeout(t.timeout),t.reject(new Error("Connection closed")),rr.delete(e);Ee&&(Ee.close(),Ee=null),Rr.value=!1}const ay=Object.freeze(Object.defineProperty({__proto__:null,canvasBlobUrl:ar,canvasContent:mE,canvasContentType:du,canvasUrl:nr,canvasVisible:zr,nodeConnected:Rr,nodeId:Sc,nodePairingStatus:Co,pendingCanvasEval:Ni,pendingCanvasSnapshot:Fi,refreshNodeRegistration:Dl,standaloneCanvasOpen:nh,startNodeConnection:Wf,stopNodeConnection:Kf},Symbol.toStringTag,{value:"Module"}));function Qu({titleKey:e,children:t}){return n(G,{children:[n("div",{class:"p-3 sm:p-4 border-b border-[var(--color-border)]",children:n("h2",{class:"text-base sm:text-lg font-semibold text-[var(--color-text-primary)]",children:l(e)})}),n("div",{class:"p-3 sm:p-4",children:t})]})}function ra({labelKey:e,descriptionKey:t,disabled:a,children:r}){return n("div",{class:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-4 ${a?"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:l(e)}),n("p",{class:"text-xs text-[var(--color-text-muted)] mt-0.5",children:l(t)})]}),n("div",{class:"flex-shrink-0",children:r})]})}function ed({label:e,value:t,truncate:a}){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)] ${a?"truncate max-w-full sm:max-w-[200px]":""}`,children:t})]})}function CE(){const[e,t]=U(""),[a,r]=U(""),[o,s]=U(!1);R(()=>{uu().then(d=>{const h=`Cove Canvas (${d.deviceId.slice(0,8)})`;t(h),r(_o.value??h)})},[]);const i=d=>{Xe.value=d,d?Wf():Kf()},c=d=>{r(d),s(!0)},u=()=>{if(!o)return;const d=_o.value;let h;!a.trim()||a.trim()===e?(h=null,r(e)):h=a.trim(),sE(h),s(!1),h!==d&&Rr.value&&Dl()};return n(H,{children:[n(ra,{labelKey:"common.enableCanvas",descriptionKey:"settings.device.enabledDescription",children:n(Be,{checked:Xe.value,onChange:i})}),Xe.value&&n(ra,{labelKey:"settings.device.name",descriptionKey:"settings.device.nameDescription",children:n(Y,{value:a,onChange:d=>c(d.target.value),onBlur:u,class:"w-[200px]"})})]})}function TE(e){const t=xe(()=>px(If(`\`\`\`ts
424
+ `,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:s}}),t&&n("span",{class:"absolute inset-0 flex items-center justify-center",children:n(on,{class:`${u} text-[var(--color-accent)]`,strokeWidth:3})})]})})}function ci({icon:e,titleKey:t,selectedThemeName:a}){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:l(t)}),a&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:["— ",a]})]})}function lE(){const e=vd(),t=vt.value,a=t.selected==="system",r=e.filter(h=>h.appearance==="light"),o=e.filter(h=>h.appearance==="dark"),s=t.lightTheme,i=t.darkTheme,c=t.selected!=="system"?t.selected:null,u=h=>{if(h)ms("system");else{const f=window.matchMedia("(prefers-color-scheme: dark)").matches;ms(f?i:s)}},d=(h,f)=>{a?f==="light"?Q1(h):ew(h):ms(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(En,{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:l("settings.appearance.useSystemTheme")}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:l("settings.appearance.useSystemThemeDescription")})]})]}),n(Be,{checked:a,onChange:u,size:"sm"})]}),a?n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6",children:[n("div",{children:[n(ci,{icon:n(mm,{class:"w-4 h-4"}),titleKey:"settings.appearance.lightTheme",selectedThemeName:r.find(h=>h.id===s)?.name}),n("div",{class:"flex flex-wrap gap-2",children:r.map(h=>n(ii,{theme:h,isSelected:s===h.id,onClick:()=>d(h.id,"light")},h.id))})]}),n("div",{children:[n(ci,{icon:n(pm,{class:"w-4 h-4"}),titleKey:"settings.appearance.darkTheme",selectedThemeName:o.find(h=>h.id===i)?.name}),n("div",{class:"flex flex-wrap gap-2",children:o.map(h=>n(ii,{theme:h,isSelected:i===h.id,onClick:()=>d(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(ci,{icon:n(mm,{class:"w-4 h-4"}),titleKey:"common.light",selectedThemeName:r.find(h=>h.id===c)?.name}),n("div",{class:"flex flex-wrap gap-2",children:r.map(h=>n(ii,{theme:h,isSelected:c===h.id,onClick:()=>d(h.id,"light")},h.id))})]}),n("div",{children:[n(ci,{icon:n(pm,{class:"w-4 h-4"}),titleKey:"common.dark",selectedThemeName:o.find(h=>h.id===c)?.name}),n("div",{class:"flex flex-wrap gap-2",children:o.map(h=>n(ii,{theme:h,isSelected:c===h.id,onClick:()=>d(h.id,"dark")},h.id))})]})]})]})}function iE(){c1()}function cE(e=!0){jk(),q2(),ho(),e&&iE(),Oe("/")}const Zx="cove:device-identity",Xd="cove:device-display-name",Co=m(typeof localStorage<"u"?localStorage.getItem(Xd):null);function uE(e){e?.trim()?(localStorage.setItem(Xd,e.trim()),Co.value=e.trim()):(localStorage.removeItem(Xd),Co.value=null)}function Xx(e){const t=new Uint8Array(e);let a="";for(let r=0;r<t.length;r++)a+=String.fromCharCode(t[r]);return btoa(a).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}async function Qx(e){const t=await crypto.subtle.exportKey("raw",e),a=await crypto.subtle.digest("SHA-256",t),r=new Uint8Array(a);return Array.from(r).map(o=>o.toString(16).padStart(2,"0")).join("")}async function dE(){const e=await crypto.subtle.generateKey("Ed25519",!0,["sign","verify"]),t=await crypto.subtle.exportKey("raw",e.publicKey),a=Xx(t);return{deviceId:await Qx(e.publicKey),publicKeyBase64Url:a,privateKey:e.privateKey,publicKey:e.publicKey}}async function hE(e){const t=await crypto.subtle.exportKey("jwk",e.privateKey),a=await crypto.subtle.exportKey("jwk",e.publicKey),r={version:1,deviceId:e.deviceId,publicKeyBase64Url:e.publicKeyBase64Url,privateKeyJwk:t,publicKeyJwk:a,createdAtMs:Date.now()};localStorage.setItem(Zx,JSON.stringify(r)),M.node.debug("Stored device identity:",e.deviceId.slice(0,16)+"...")}async function fE(){try{const e=localStorage.getItem(Zx);if(!e)return null;const t=JSON.parse(e);if(t?.version!==1)return null;const a=await crypto.subtle.importKey("jwk",t.privateKeyJwk,"Ed25519",!0,["sign"]),r=await crypto.subtle.importKey("jwk",t.publicKeyJwk,"Ed25519",!0,["verify"]);return await Qx(r)!==t.deviceId?(M.node.warn("Device ID mismatch, regenerating identity"),null):(M.node.debug("Loaded device identity:",t.deviceId.slice(0,16)+"..."),{deviceId:t.deviceId,publicKeyBase64Url:t.publicKeyBase64Url,privateKey:a,publicKey:r})}catch(e){return M.node.warn("Failed to load device identity:",e),null}}let Qn=null;async function lu(){return Qn||(Qn=await fE(),Qn)||(M.node.debug("Generating new device identity"),Qn=await dE(),await hE(Qn)),Qn}function pE(e){const t=e.nonce?"v2":"v1",a=e.scopes.join(","),r=e.token??"",o=[t,e.deviceId,e.clientId,e.clientMode,e.role,a,String(e.signedAtMs),r];return t==="v2"&&o.push(e.nonce??""),o.join("|")}async function mE(e,t){const r=new TextEncoder().encode(t),o=await crypto.subtle.sign("Ed25519",e.privateKey,r);return Xx(o)}async function vE(e){const t=await lu(),a=Date.now(),r=e.scopes??[],o=pE({deviceId:t.deviceId,clientId:e.clientId,clientMode:e.clientMode,role:e.role,scopes:r,signedAtMs:a,token:e.token,nonce:e.nonce}),s=await mE(t,o);return{id:t.deviceId,publicKey:t.publicKeyBase64Url,signature:s,signedAt:a,...e.nonce?{nonce:e.nonce}:{}}}async function gE(){return Co.value?Co.value:`Cove Canvas (${(await lu()).deviceId.slice(0,8)})`}function bE(e){return e?e.startsWith("image/"):!1}function Tv(e){if(!e)return!1;const t=e.toLowerCase();return/\.(png|jpg|jpeg|gif|webp|svg|ico|bmp)(\?|$)/.test(t)}function jf(e,t){let a=e,r=t;if(e.startsWith("data:")){const c=e.match(/^data:([^;]+);base64,(.+)$/);c&&(r=c[1],a=c[2])}let o;try{o=atob(a)}catch{throw new Error("Invalid base64 data")}const s=new Uint8Array(o.length);for(let c=0;c<o.length;c++)s[c]=o.charCodeAt(c);const i=new Blob([s],{type:r});return URL.createObjectURL(i)}const Rr=m(!1),To=m("unpaired"),wc=m(null),zr=m(!1),nr=m(null),xE=m(null),ar=m(null),iu=m(null),Qd=m(!1),Oi=m(null),Ni=m(null),ey=typeof BroadcastChannel<"u"?new BroadcastChannel("cove:canvas"):null;let kc=null,eh=null;function th(){ey?.postMessage({type:"canvas-content",url:nr.value,base64:kc,mimeType:eh})}ey?.addEventListener("message",e=>{if(e.data.type==="canvas-content"){if(e.data.url)nr.value=e.data.url,ar.value=null;else if(e.data.base64)try{const t=jf(e.data.base64,e.data.mimeType||"image/png");ar.value=t,iu.value=e.data.mimeType,nr.value=null}catch{}}if(e.data.type==="canvas-standalone-status"){const t=Qd.value;Qd.value=e.data.open,M.node.debug(`Standalone canvas status: ${e.data.open?"open":"closed"}`),e.data.open?(nr.value||kc)&&th():t&&(M.node.debug("Standalone closed, re-registering node"),Dl())}});function yE(){ar.value&&(URL.revokeObjectURL(ar.value),ar.value=null),iu.value=null}function wE(e){const t=/^https?:\/\/(127\.0\.0\.1|localhost)(:\d+)?(\/__openclaw__\/canvas)(\/.*)?/i,a=e.match(t);if(!a)return e;const o=`/_canvas${a[4]||"/"}`;return M.node.debug("Transformed canvas URL to proxy:",e,"->",o),o}function Ev(e){const t=e.url,a=e.imageBase64,r=e.imageMimeType||"image/png";if(yE(),a)try{const o=jf(a,r);return ar.value=o,iu.value=r,nr.value=null,kc=a,eh=r,th(),{type:"base64",detail:r}}catch(o){return M.node.error("Failed to create blob from base64:",o),null}if(t){const o=wE(t);return nr.value=o,kc=null,eh=null,th(),{type:"url",detail:o}}return null}let Ae=null,eo=null,ma=null,nh,is;const kE=15e3,Av=1e4,rr=new Map;let ty=0;const SE=3e4;function ny(e,t){return new Promise((a,r)=>{if(!Ae||Ae.readyState!==WebSocket.OPEN){r(new Error("Not connected"));return}const o=String(++ty),s=setTimeout(()=>{const i=rr.get(o);i&&(rr.delete(o),i.reject(new Error("Request timeout")))},SE);rr.set(o,{resolve:a,reject:r,timeout:s}),Ae.send(JSON.stringify({type:"req",id:o,method:e,params:t}))})}function _E(e){try{const t=JSON.parse(e);if(t.type==="res"&&t.id!=null){const a=rr.get(String(t.id));a&&(rr.delete(t.id),clearTimeout(a.timeout),t.ok?a.resolve(t.payload):a.reject(new Error(t.error?.message??"Request failed")));return}if(t.type==="evt"||t.type==="event"){if(t.event==="node.invoke.request"){AE(t.payload);return}CE(t.event,t.payload);return}}catch(t){M.node.error("Failed to parse message:",t)}}function CE(e,t){if(M.node.debug("Event:",e,t),e==="connect.challenge"){const a=t,r=typeof a.nonce=="string"?a.nonce:void 0;M.node.debug("Received connect.challenge with nonce:",r?.slice(0,8)+"..."),TE(r);return}e==="node.pair.resolved"&&(t.status==="approved"?(To.value="paired",M.node.debug("Pairing approved! Reconnecting..."),Dl()):(To.value="unpaired",M.node.debug("Pairing rejected")))}async function TE(e){try{const t=await lu(),a=await gE();wc.value=t.deviceId;const r=await vE({clientId:"node-host",clientMode:"node",role:"node",scopes:[],token:is??null,nonce:e}),o={minProtocol:3,maxProtocol:3,role:"node",client:{id:"node-host",displayName:a,mode:"node",version:"1.0.0",platform:navigator.platform?.toLowerCase().includes("mac")?"macos":"web"},device:r,caps:["canvas"],commands:["canvas.present","canvas.hide","canvas.navigate","canvas.eval","canvas.snapshot"]};is&&(nh==="token"?o.auth={token:is}:nh==="password"&&(o.auth={password:is})),M.node.debug("Sending connect request with device:",r.id.slice(0,16)+"...");const s=await ny("connect",o);M.node.debug("Connect result:",s),Rr.value=!0,To.value="paired",M.node.info("Node connected as device:",t.deviceId.slice(0,16)+"..."),EE()}catch(t){M.node.error("Connect failed:",t)}}function EE(){ma||(ma=setInterval(async()=>{if(Ae&&Ae.readyState===WebSocket.OPEN)try{await ny("ping",{}),M.node.debug("Keepalive ping successful")}catch{M.node.debug("Keepalive ping failed, reconnecting"),Dl()}},kE))}async function AE(e){const t=e;let a={};if(t.params&&typeof t.params=="object")a=t.params;else if(t.paramsJSON)try{a=JSON.parse(t.paramsJSON)}catch{M.node.error("Failed to parse paramsJSON:",t.paramsJSON)}M.node.debug("Invoke request:",t.command,"params keys:",Object.keys(a));let r={ok:!0},o;try{switch(t.command){case"canvas.present":{const s=Ev(a);zr.value=!1,zr.value=!0,s&&M.node.debug(`Canvas presented: ${s.type==="base64"?`(${s.detail})`:s.detail}`);break}case"canvas.hide":{zr.value=!1,M.node.debug("Canvas hidden");break}case"canvas.navigate":{const s=Ev(a);zr.value=!1,zr.value=!0,s&&M.node.debug(`Canvas navigated: ${s.type==="base64"?`(${s.detail})`:s.detail}`);break}case"canvas.eval":{const s=a.javaScript;if(M.node.debug("canvas.eval requested:",s?.slice(0,50)),!s){o={code:"INVALID_PARAMS",message:"javaScript parameter required"};break}try{r={result:await new Promise((c,u)=>{Oi.value={js:s,resolve:c,reject:d=>u(new Error(d))},setTimeout(()=>{Oi.value?.js===s&&(Oi.value=null,u(new Error("Canvas eval timeout")))},Av)})}}catch(i){o={code:"EVAL_ERROR",message:String(i)}}break}case"canvas.snapshot":{const s=a.maxWidth||800,i=a.quality||.8,u=(a.outputFormat||"jpeg")==="png"?"png":"jpeg";M.node.debug("canvas.snapshot requested:",{maxWidth:s,quality:i,outputFormat:u});try{r={dataUrl:await new Promise((h,f)=>{Ni.value={maxWidth:s,quality:i,outputFormat:u,resolve:h,reject:p=>f(new Error(p))},setTimeout(()=>{Ni.value&&(Ni.value=null,f(new Error("Canvas snapshot timeout")))},Av)})}}catch(d){o={code:"SNAPSHOT_ERROR",message:String(d)}}break}default:o={code:"UNKNOWN_COMMAND",message:`Unknown command: ${t.command}`}}}catch(s){o={code:"ERROR",message:String(s)}}if(Ae&&Ae.readyState===WebSocket.OPEN){const s={type:"req",id:String(++ty),method:"node.invoke.result",params:{id:t.id,nodeId:wc.value,ok:!o,payload:o?void 0:r,error:o??void 0}};M.node.debug("Sending invoke result for node:",wc.value?.slice(0,8)),Ae.send(JSON.stringify(s))}}async function Hf(){const e=gt.value,t=Uc(),a=Fh();if(M.node.debug("connectNode called"),!e){M.node.debug("No gateway URL, skipping node connection");return}nh=t?.authMode,is=a??void 0;const r=e.replace(/^http/,"ws");M.node.debug("Connecting to gateway as node"),Ae=new WebSocket(r),Ae.onopen=()=>{M.node.debug("WebSocket connected, waiting for connect.challenge")},Ae.onmessage=o=>{_E(String(o.data))},Ae.onclose=o=>{M.node.debug("WebSocket closed:",o.code,o.reason),Rr.value=!1,Ae=null,ma&&(clearInterval(ma),ma=null),eo||(eo=setTimeout(()=>{eo=null,Hf()},5e3))},Ae.onerror=()=>{M.node.error("WebSocket error")}}function Bf(){M.node.debug("startNodeConnection called"),gt.value?Hf():M.node.debug("No gateway URL, skipping node connection")}function Dl(){M.node.debug("refreshNodeRegistration called - doing full reconnect"),Ae&&(Ae.close(),Ae=null),Rr.value=!1,setTimeout(()=>{Hf()},500)}function Wf(){eo&&(clearTimeout(eo),eo=null),ma&&(clearInterval(ma),ma=null);for(const[e,t]of rr)clearTimeout(t.timeout),t.reject(new Error("Connection closed")),rr.delete(e);Ae&&(Ae.close(),Ae=null),Rr.value=!1}const ay=Object.freeze(Object.defineProperty({__proto__:null,canvasBlobUrl:ar,canvasContent:xE,canvasContentType:iu,canvasUrl:nr,canvasVisible:zr,nodeConnected:Rr,nodeId:wc,nodePairingStatus:To,pendingCanvasEval:Oi,pendingCanvasSnapshot:Ni,refreshNodeRegistration:Dl,standaloneCanvasOpen:Qd,startNodeConnection:Bf,stopNodeConnection:Wf},Symbol.toStringTag,{value:"Module"}));function Yu({titleKey:e,children:t}){return n(G,{children:[n("div",{class:"p-3 sm:p-4 border-b border-[var(--color-border)]",children:n("h2",{class:"text-base sm:text-lg font-semibold text-[var(--color-text-primary)]",children:l(e)})}),n("div",{class:"p-3 sm:p-4",children:t})]})}function oa({labelKey:e,descriptionKey:t,disabled:a,children:r}){return n("div",{class:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-4 ${a?"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:l(e)}),n("p",{class:"text-xs text-[var(--color-text-muted)] mt-0.5",children:l(t)})]}),n("div",{class:"flex-shrink-0",children:r})]})}function Zu({label:e,value:t,truncate:a}){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)] ${a?"truncate max-w-full sm:max-w-[200px]":""}`,children:t})]})}function ME(){const[e,t]=U(""),[a,r]=U(""),[o,s]=U(!1);R(()=>{lu().then(d=>{const h=`Cove Canvas (${d.deviceId.slice(0,8)})`;t(h),r(Co.value??h)})},[]);const i=d=>{Ze.value=d,d?Bf():Wf()},c=d=>{r(d),s(!0)},u=()=>{if(!o)return;const d=Co.value;let h;!a.trim()||a.trim()===e?(h=null,r(e)):h=a.trim(),uE(h),s(!1),h!==d&&Rr.value&&Dl()};return n(H,{children:[n(oa,{labelKey:"common.enableCanvas",descriptionKey:"settings.device.enabledDescription",children:n(Be,{checked:Ze.value,onChange:i})}),Ze.value&&n(oa,{labelKey:"settings.device.name",descriptionKey:"settings.device.nameDescription",children:n(Y,{value:a,onChange:d=>c(d.target.value),onBlur:u,class:"w-[200px]"})})]})}function IE(e){const t=ye(()=>px(Af(`\`\`\`ts
425
425
  const visible = items
426
426
  ?.filter((x) => x !== null && x >= 0)
427
427
  .map((x) => x ** 2)
@@ -430,19 +430,19 @@ const visible = items
430
430
  if (visible.length >= 2 && visible[0] <= visible[1]) {
431
431
  console.log(visible[0] => visible[1]);
432
432
  }
433
- \`\`\``)),[]);return n(sn,{viewName:l("nav.settings"),children:[n(Ht,{title:l("nav.settings"),subtitle:l("settings.description")}),n(Qu,{titleKey:"settings.appearance.title",children:n("div",{class:"space-y-6",children:[n(aE,{}),n(ra,{labelKey:"settings.appearance.fontSize",descriptionKey:"settings.appearance.fontSizeDescription",children:n(Ae,{value:io.value,onChange:a=>{io.value=a},options:Hg.map(a=>({value:a.value,label:l(a.labelKey)})),size:"sm",width:"180px"})}),n(ra,{labelKey:"settings.appearance.fontFamily",descriptionKey:"settings.appearance.fontFamilyDescription",children:n(Ae,{value:dr.value,onChange:a=>{dr.value=a},options:Bg.map(a=>({value:a.value,label:l(a.labelKey)})),size:"sm",width:"180px"})}),n("div",{class:"space-y-2",children:[n("div",{class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-4",children:[n("div",{class:"flex-1 min-w-0",children:[n("label",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:l("settings.appearance.codeFontFamily")}),n("p",{class:"text-xs text-[var(--color-text-muted)] mt-0.5",children:l("settings.appearance.codeFontFamilyDescription")})]}),n("div",{class:"flex-shrink-0",children:n(Ae,{value:hr.value,onChange:a=>{hr.value=a},options:Wg.map(a=>({value:a.value,label:l(a.labelKey)})),size:"sm",width:"180px"})})]}),n("div",{class:"message-content prose prose-sm max-w-none w-full [&_pre.code-block]:m-0",dangerouslySetInnerHTML:{__html:t}})]})]})}),n(Qu,{titleKey:"settings.appMode.title",children:n("div",{class:"space-y-6",children:[n(ra,{labelKey:"settings.preferences.timeFormat",descriptionKey:"settings.preferences.timeFormatDescription",children:n(Ae,{value:ur.value,onChange:a=>{ur.value=a},options:Kg.map(a=>({value:a.value,label:l(a.labelKey)})),size:"sm",width:"180px"})}),n(ra,{labelKey:"settings.appMode.multiChat",descriptionKey:"settings.appMode.multiChatDescription",children:n(Be,{checked:Ln.value==="multi",onChange:a=>{Ln.value=a?"multi":"single"}})}),yl.value&&n(H,{children:[n(ra,{labelKey:"settings.newChat.useDefaults",descriptionKey:"settings.newChat.useDefaultsDescription",children:n(Be,{checked:ot.value.useDefaults,onChange:a=>{ot.value={...ot.value,useDefaults:a}}})}),n(ra,{labelKey:"common.defaultAgent",descriptionKey:"settings.newChat.defaultAgentDescription",children:n(Ae,{value:ot.value.defaultAgentId,onChange:a=>{ot.value={...ot.value,defaultAgentId:a}},options:Ld.value,size:"sm",width:"180px"})})]}),n(CE,{})]})}),n(Qu,{titleKey:"settings.about.title",children:n("div",{class:"space-y-4",children:[n("div",{class:"space-y-3",children:[n(ed,{label:l("common.cove"),value:`v${b2}`}),zt.value&&n(ed,{label:l("common.gateway"),value:eb(zt.value)}),gt.value&&n(ed,{label:l("common.gatewayUrl"),value:gt.value,truncate:!0})]}),n("div",{class:"border-t border-[var(--color-border)] pt-4 flex flex-wrap justify-end gap-2",children:[n(P,{variant:"secondary",onClick:()=>qg(),children:l("settings.data.resetDefaults")}),n(P,{variant:"secondary",onClick:()=>oE(),children:D.value?l("common.logout"):l("settings.data.clearSavedLogin")})]})]})})]})}const zi=m(null);let EE=0;function AE(){return`json-block-${++EE}`}async function ME(e,t){try{await navigator.clipboard.writeText(e),zi.value=t,setTimeout(()=>{zi.value===t&&(zi.value=null)},2e3)}catch{}}function IE(e){try{const t=en.highlight(e,en.languages.json,"json");return vc(t)}catch{return vc(e)}}function hu({value:e,maxHeight:t="max-h-48",id:a}){const r=a??AE(),o=zi.value===r,s=IE(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:s}}),n(q,{icon:o?n(on,{size:14}):n(El,{size:14}),size:"sm",variant:"ghost",label:l("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:()=>ME(e,r)})]})}const sh=m(null),lh=m(null),ih=m(!1),Xo=m(!1);function di(e){return e==null?"—":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function RE(e){return e==null?"—":`${Math.round(e)}%`}async function Mv(){if(D.value){ih.value=!0;try{const[e,t]=await Promise.all([N("status").catch(()=>null),N("health").catch(()=>null)]);sh.value=e,lh.value=t}catch{}finally{ih.value=!1}}}function hi({label:e,value:t,sub:a}){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}),a&&n("div",{class:"text-xs text-[var(--color-text-muted)] opacity-70",children:a})]})}function LE({name:e,label:t,data:a}){const r=a.linked?"success":a.configured?"warning":"default",o=a.linked?l("debug.linked"):a.configured?l("common.configured"):l("common.off");return n("div",{class:"flex items-center justify-between py-1.5",children:[n("span",{class:"text-sm",children:t||e}),n(Z,{variant:r,size:"sm",children:o})]})}function $E(){const e=D.value,t=sh.value,a=lh.value,r=t?.sessions?.recent?.[0];return R(()=>{e&&!sh.value&&!lh.value&&Mv()},[e]),n(G,{children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(C4,{size:18,class:"text-[var(--color-accent)]"}),n("h2",{class:"font-medium",children:l("debug.snapshots")})]}),n(P,{variant:"ghost",size:"sm",onClick:Mv,disabled:!e,loading:ih.value,icon:n(Qe,{size:14}),children:l("actions.refresh")})]}),!t&&!a?n("p",{class:"text-sm text-[var(--color-text-muted)] text-center py-6",children:l("debug.noData")}):n("div",{class:"space-y-5",children:[r&&n("div",{children:[n("div",{class:"flex items-center gap-2 mb-3",children:[n(pa,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:l("debug.recentSession")}),r.model&&n(Z,{variant:"default",size:"sm",children:r.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(hi,{label:l("common.input"),value:di(r.inputTokens)}),n(hi,{label:l("common.output"),value:di(r.outputTokens)}),n(hi,{label:l("common.total"),value:di(r.totalTokens)}),n(hi,{label:l("debug.used"),value:RE(r.percentUsed),sub:`of ${di(r.contextTokens)}`})]})]}),a&&n("div",{children:[n("div",{class:"flex items-center gap-2 mb-3",children:[n(Rb,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:l("debug.health")}),n(Z,{variant:a.ok?"success":"error",size:"sm",children:a.ok?l("common.healthy"):l("debug.unhealthy")}),a.durationMs!=null&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",jh(a.durationMs),")"]})]}),a.channels&&Object.keys(a.channels).length>0&&n("div",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg divide-y divide-[var(--color-border)]",children:(a.channelOrder??Object.keys(a.channels)).map(o=>{const s=a.channels?.[o];return s?n(LE,{name:o,label:a.channelLabels?.[o],data:s},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(Pn,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:l("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(Z,{variant:o.enabled?"success":"default",size:"sm",children:o.enabled?l("debug.on"):l("common.off")})]})]},o.agentId))})]}),n("button",{type:"button",onClick:()=>{Xo.value=!Xo.value},"aria-expanded":Xo.value,class:"flex items-center gap-1 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors",children:[Xo.value?n(Ne,{size:12}):n(Ve,{size:12}),l("debug.showRawJson")]}),Xo.value&&n(hu,{value:JSON.stringify({status:t,health:a},null,2),id:"snapshots-raw-json"})]})]})}const Ui=m("system-presence"),nl=m("{}"),Ya=m(null),ch=m(!1),Cc=m(null),or=m(!0),Dn=m([]);let ry=0;const oy=K(()=>{const e={};for(const t of Dn.value)t.key.trim()&&(e[t.key.trim()]=t.value);return e});function DE(){if(or.value){const t=oy.value;return Object.keys(t).length>0?t:void 0}const e=nl.value.trim();if(!(!e||e==="{}"))return JSON.parse(e)}function PE(){Dn.value=[...Dn.value,{id:`field_${++ry}`,key:"",value:""}]}function OE(e){Dn.value=Dn.value.filter(t=>t.id!==e)}function Iv(e,t){Dn.value=Dn.value.map(a=>a.id===e?{...a,...t}:a)}function NE(){const e=oy.value;nl.value=Object.keys(e).length>0?JSON.stringify(e,null,2):"{}"}function FE(){try{const e=JSON.parse(nl.value||"{}");typeof e=="object"&&e!==null&&!Array.isArray(e)&&(Dn.value=Object.entries(e).map(([t,a])=>({id:`field_${++ry}`,key:t,value:typeof a=="string"?a:JSON.stringify(a)})))}catch{}}function zE(){or.value?NE():FE(),or.value=!or.value}async function UE(){if(D.value){ch.value=!0,Cc.value=null,Ya.value=null;try{const e=DE(),t=await o2(Ui.value,e);Ya.value={ok:!0,data:t}}catch(e){Cc.value=e instanceof Error?e.message:"RPC call failed",Ya.value={ok:!1,data:null}}finally{ch.value=!1}}}function jE(){const e=D.value;return n(G,{children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(Fb,{size:18,class:"text-[var(--color-warning)]"}),n("h2",{class:"font-medium",children:l("debug.manualRpc")})]}),n(P,{variant:"ghost",size:"sm",onClick:zE,icon:or.value?n(_4,{size:14}):n(z4,{size:14}),children:or.value?l("debug.jsonMode"):l("debug.formMode")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:l("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:l("debug.method")}),n(Y,{id:"rpc-method",value:Ui.value,onInput:t=>{Ui.value=t.target.value},placeholder:"e.g., system-presence, status, health",class:"font-mono",fullWidth:!0})]}),or.value?n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium",children:l("debug.params")}),n(P,{variant:"ghost",size:"sm",onClick:PE,icon:n(Sa,{size:14}),children:l("debug.addParam")})]}),Dn.value.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] py-3 text-center",children:l("debug.noParams")}):n("div",{class:"space-y-2",children:Dn.value.map(t=>n("div",{class:"flex items-center gap-2",children:[n(Y,{value:t.key,onInput:a=>Iv(t.id,{key:a.target.value}),placeholder:"key",class:"font-mono flex-1"}),n(Y,{value:t.value,onInput:a=>Iv(t.id,{value:a.target.value}),placeholder:"value",class:"font-mono flex-1"}),n(q,{icon:n(bt,{size:14}),size:"sm",variant:"ghost",label:l("actions.delete"),onClick:()=>OE(t.id)})]},t.id))})]}):n("div",{children:[n("label",{htmlFor:"rpc-params",class:"block text-sm font-medium mb-1",children:l("debug.paramsJson")}),n(tr,{id:"rpc-params",value:nl.value,onInput:t=>{nl.value=t.target.value},placeholder:"{}",rows:4,class:"font-mono text-sm",fullWidth:!0})]}),n(P,{variant:"secondary",onClick:UE,disabled:!e||!Ui.value.trim(),loading:ch.value,icon:n(pf,{size:14}),children:l("debug.call")}),Cc.value&&n("div",{class:"text-sm text-[var(--color-error)] bg-[var(--color-error)]/10 p-3 rounded-lg",children:Cc.value}),Ya.value&&n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium",children:l("common.result")}),n(Z,{variant:Ya.value.ok?"success":"error",children:Ya.value.ok?l("debug.ok"):l("common.error")})]}),n(hu,{value:Jh(Ya.value.data),maxHeight:"max-h-64",id:"rpc-result"})]})]})]})}const wn=m([]),HE=m(100),ji=m(!1);let BE=0;const Hi=m(null),Oa=m(new Set),vn=m(null),sy=m(0),WE=K(()=>{sy.value;const e=Wh.value;return e==null?"—":Qg(e,{includeMinutesWhenDays:!0})}),KE=K(()=>{switch(Ue.value){case"connected":return"success";case"connecting":case"authenticating":case"reconnecting":return"warning";default:return"error"}});function qE(e,t){if(ji.value)return;const a={id:++BE,timestamp:Date.now(),event:e,payload:t};wn.value=[a,...wn.value].slice(0,HE.value)}function VE(){wn.value=[]}function GE(e){Oo(Oa,e,{pushHistory:!0})}async function JE(e,t){try{await navigator.clipboard.writeText(e),Hi.value=t,setTimeout(()=>{Hi.value===t&&(Hi.value=null)},2e3)}catch{}}function Je({icon:e,label:t,value:a,copyable:r,mono:o}){const s=a??"—",i=`${t}-${s}`,c=Hi.value===i;return n("div",{class:"flex flex-col sm:flex-row sm:items-center justify-between py-2 gap-1 sm:gap-2 border-b border-[var(--color-border)] last:border-0",children:[n("div",{class:"flex items-center gap-2 text-[var(--color-text-muted)]",children:[n(e,{size:16,class:"flex-shrink-0"}),n("span",{class:"text-sm",children:t})]}),n("div",{class:"flex items-center gap-2 pl-6 sm:pl-0",children:[n("span",{class:`${o?"font-mono text-sm":""} break-all`,children:s}),r&&a&&n(q,{icon:c?n(on,{size:14}):n(El,{size:14}),size:"sm",variant:"ghost",label:l("actions.copy"),onClick:()=>JE(a,i),class:"flex-shrink-0"})]})]})}function YE({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:()=>{vn.value=e},"aria-label":l("debug.viewEventDetails",{event:e.event}),children:[n("div",{class:"min-w-0",children:[n(Z,{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(Ve,{size:16,class:"text-[var(--color-text-muted)] flex-shrink-0"})]})}function ZE({entry:e,expanded:t,onToggle:a}){const r=e.payload!=null&&Object.keys(e.payload).length>0,o=Jh(e.payload),s=`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:a,disabled:!r,"aria-expanded":t,"aria-label":`${e.event} event, ${l(r?"debug.clickToExpand":"debug.noPayload")}`,children:[r?t?n(Ne,{size:14,class:"text-[var(--color-text-muted)]"}):n(Ve,{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(Z,{variant:"default",class:"font-mono text-xs",children:e.event})]}),t&&r&&n("div",{class:"px-3 pb-3",children:n(hu,{value:o,id:s})})]})}function XE(e){const t=wn.value.length>0,[a,r,o]=Zs("event",{ready:t});R(()=>{if(t&&a.value.size>0){const c=Array.from(a.value).filter(u=>wn.value.some(d=>d.id===u));if(c.length>0){const u=c.filter(d=>!Oa.value.has(d));u.length>0&&(Oa.value=new Set([...Oa.value,...c]),setTimeout(()=>{const d=document.querySelectorAll(`[data-event-id="${u[0]}"]`);Array.from(d).find(f=>f.offsetParent!==null)?.scrollIntoView({behavior:"smooth",block:"center"})},100))}}},[a.value,t]),R(()=>{o.value&&r(Oa.value)},[Oa.value,o.value]),R(()=>_l(u=>{qE(u.event,u.payload)}),[]),R(()=>{const c=setInterval(()=>{sy.value++},1e3);return()=>clearInterval(c)},[]);const s=D.value,i=Ue.value;return n(sn,{viewName:l("common.debug"),children:[n(Ht,{title:l("common.debug"),subtitle:l("debug.subtitle"),actions:n(Z,{variant:KE.value,children:[s?n(dc,{size:14,class:"mr-1"}):n(jb,{size:14,class:"mr-1"}),i]})}),n("div",{class:"grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-6",children:[n(G,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(dc,{size:18,class:s?"text-[var(--color-success)]":"text-[var(--color-error)]"}),n("h2",{class:"font-medium",children:l("debug.connection")})]}),n("div",{class:"space-y-0",children:[n(Je,{icon:pa,label:l("debug.state"),value:i}),n(Je,{icon:Pn,label:l("common.url"),value:gt.value,copyable:!0,mono:!0}),n(Je,{icon:Xc,label:l("debug.sessionKey"),value:Ye.value,copyable:!0,mono:!0}),n(Je,{icon:Qe,label:l("debug.reconnectAttempts"),value:String(Xt.value)}),n(Je,{icon:ve,label:l("debug.connectedAt"),value:ya.value?ne(ya.value):null})]})]}),n(G,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(pr,{size:18,class:"text-[var(--color-primary)]"}),n("h2",{class:"font-medium",children:l("debug.server")})]}),n("div",{class:"space-y-0",children:[n(Je,{icon:pr,label:l("common.version"),value:zt.value}),n(Je,{icon:Gt,label:l("common.host"),value:Mo.value}),n(Je,{icon:an,label:l("common.commit"),value:wl.value?.slice(0,8),copyable:!0,mono:!0}),n(Je,{icon:ve,label:l("common.uptime"),value:WE.value}),n(Je,{icon:ve,label:l("debug.tickInterval"),value:Ks.value?`${Ks.value}ms`:null})]})]}),n(G,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(cc,{size:18,class:"text-[var(--color-warning)]"}),n("h2",{class:"font-medium",children:l("debug.paths")})]}),n("div",{class:"space-y-0",children:[n(Je,{icon:an,label:l("debug.configPath"),value:vs.value,copyable:!0,mono:!0}),n(Je,{icon:cc,label:l("debug.stateDir"),value:gs.value,copyable:!0,mono:!0})]})]}),n(G,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(Gt,{size:18,class:"text-[var(--color-info)]"}),n("h2",{class:"font-medium",children:l("debug.client")})]}),n("div",{class:"space-y-0",children:[n(Je,{icon:Gt,label:l("debug.appVersion"),value:"2026.2.19"}),n(Je,{icon:Gt,label:l("common.platform"),value:navigator.platform}),n(Je,{icon:Gt,label:l("debug.userAgent"),value:navigator.userAgent.slice(0,60)+"..."}),n(Je,{icon:ca,label:l("debug.presenceCount"),value:String(kl.value.length)})]})]})]}),n("div",{class:"grid grid-cols-1 lg:grid-cols-2 gap-4 sm:gap-6",children:[n($E,{}),n(jE,{})]}),n(G,{children:[n("div",{class:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(pa,{size:18,class:"text-[var(--color-accent)]"}),n("h2",{class:"font-medium",children:l("debug.eventLog")}),n(Z,{variant:"default",children:wn.value.length})]}),n("div",{class:"flex items-center gap-2",children:[n(Be,{checked:!ji.value,onChange:c=>{ji.value=!c},label:ji.value?l("common.paused"):l("debug.recording")}),n(P,{variant:"ghost",size:"sm",onClick:VE,disabled:wn.value.length===0,icon:n(bt,{size:14}),children:n("span",{class:"hidden sm:inline",children:l("common.clear")})})]})]}),wn.value.length===0?n("div",{class:"text-center py-8 text-[var(--color-text-muted)]",children:[n(pa,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:l("debug.noEvents")}),n("p",{class:"text-sm mt-1",children:l("debug.noEventsHint")})]}):n(H,{children:[n("div",{class:"md:hidden space-y-2 max-h-96 overflow-y-auto",children:wn.value.map(c=>n("div",{"data-event-id":c.id,children:n(YE,{entry:c})},c.id))}),n("div",{class:"hidden md:block max-h-96 overflow-y-auto border border-[var(--color-border)] rounded-lg",children:wn.value.map(c=>n("div",{"data-event-id":c.id,children:n(ZE,{entry:c,expanded:Oa.value.has(c.id),onToggle:()=>GE(c.id)})},c.id))})]})]}),n(We,{open:!!vn.value,onClose:()=>{vn.value=null},title:vn.value?.event||"",children:vn.value&&n("div",{class:"space-y-3",children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:new Date(vn.value.timestamp).toLocaleString()}),vn.value.payload!=null&&Object.keys(vn.value.payload).length>0?n(hu,{value:Jh(vn.value.payload),maxHeight:"max-h-[60vh]",id:`mobile-event-${vn.value.id}`}):n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("debug.noPayload")})]})})]})}let ly=0;function iy(){ly=0}function Tc(e,t="",a=!0){const r={};for(const[o,s]of Object.entries(e)){if(a&&/^\d+$/.test(o))continue;const i=t?`${t}.${o}`:o;s!=null&&(Array.isArray(s)?r[i]=JSON.stringify(s):typeof s=="object"?Object.assign(r,Tc(s,i,!1)):typeof s=="string"?r[i]=s:r[i]=JSON.stringify(s))}return r}function QE(e){const t=Object.keys(e).filter(o=>/^\d+$/.test(o)).map(Number).sort((o,s)=>o-s);if(t.length===0)return{message:null,fields:{}};let a=null;const r={};for(const o of t){const s=e[String(o)];if(typeof s=="string"){try{const i=JSON.parse(s);if(typeof i=="object"&&i!==null){Object.assign(r,Tc(i,"",!1));continue}}catch{}a=s}else typeof s=="object"&&s!==null&&Object.assign(r,Tc(s,"",!1))}return{message:a,fields:r}}const Rv=["time","timestamp","ts","level","lvl","pid","hostname","v","msg","message"];function cy(e){if(!e.startsWith("{"))return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Lv(e){const t=++ly;let a,r,o=e,s;if(e.startsWith("{"))try{const i=JSON.parse(e);a=i.time||i.timestamp||i.ts;const u=i._meta?.logLevelName?.toLowerCase()||(i.level||i.lvl||"")?.toLowerCase();["debug","info","warn","warning","error","err"].includes(u)&&(r=u==="warning"?"warn":u==="err"?"error":u);const d=Object.keys(i).some(h=>/^\d+$/.test(h));if(d){const h=QE(i);h.message&&(o=h.message),Object.keys(h.fields).length>0&&(s=h.fields)}if(o===e&&(i.msg||i.message?o=i.msg||i.message:i.error&&typeof i.error=="string"&&(o=i.error)),o===e&&!d){const h=[];for(const[f,p]of Object.entries(i))Rv.includes(f)||(typeof p=="string"?h.push(`${f}=${p}`):p!=null&&h.push(`${f}=${JSON.stringify(p)}`));o=h.length>0?h.join(" "):e}if(!s){const h={};for(const[f,p]of Object.entries(i))!Rv.includes(f)&&!/^\d+$/.test(f)&&f!=="_meta"&&(h[f]=p);Object.keys(h).length>0&&(s=Tc(h))}}catch{}if(!a){const i=e.match(/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z)\s+\[([^\]]+)\]\s*(.*)$/);if(i){a=i[1],o=`[${i[2]}] ${i[3]}`;const c=e.toLowerCase();c.includes("error")||c.includes("err ")||c.includes("✗")?r="error":c.includes("warn")||c.includes("warning")?r="warn":c.includes("debug")?r="debug":r="info"}}if(!a){const i=e.match(/^\[([^\]]+)\]\s*(DEBUG|INFO|WARN|ERROR):?\s*(.*)$/i);i&&(a=i[1],r=i[2].toLowerCase(),o=i[3])}if(!a){const i=e.match(/^(\d{4}-\d{2}-\d{2}T[\d:]+Z)\s+(ERR|INF|WRN|DBG)\s+(.*)$/);if(i){a=i[1];const c=i[2];r=c==="ERR"?"error":c==="WRN"?"warn":c==="DBG"?"debug":"info",o=i[3]}}if(!r&&!a){const i=e.match(/^(DEBUG|INFO|WARN|ERROR):?\s+(.*)$/i);i&&(r=i[1].toLowerCase(),o=i[2])}if(!r){const i=e.toLowerCase();i.includes("error")||i.includes("failed")||i.includes("exception")||i.includes("✗")?r="error":i.includes("warn")||i.includes("deprecated")?r="warn":(i.includes("debug")||i.includes("trace"))&&(r="debug")}return{id:t,raw:e,timestamp:a,level:r,message:o,fields:s}}const uy={debug:y4,info:Al,warn:Aa,error:Zc},dy={debug:"text-[var(--color-text-muted)]",info:"text-[var(--color-info)]",warn:"text-[var(--color-warning)]",error:"text-[var(--color-error)]"};function hy(e){return e?e.split("T")[1]?.slice(0,12)||e.slice(0,12):null}function eA({line:e,expanded:t,onToggle:a}){const r=e.level?uy[e.level]:void 0,o=e.level?dy[e.level]:"text-[var(--color-text-muted)]",s=hy(e.timestamp),i=e.fields&&Object.keys(e.fields).length>0;return n("div",{class:"border-b border-[var(--color-border)]/50 last:border-0",children:[n("button",{type:"button",onClick:a,disabled:!i,"aria-expanded":i?t:void 0,"aria-label":i?l("logs.expandLine",{message:e.message.slice(0,50)}):void 0,class:"w-full text-left py-2 px-3 hover:bg-[var(--color-bg-hover)] flex items-start gap-2 font-mono text-xs disabled:cursor-default",children:[i?n(Ve,{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"}),r&&n(r,{size:14,class:`mt-0.5 flex-shrink-0 ${o}`}),s&&n("span",{class:"text-[var(--color-text-muted)] flex-shrink-0",children:s}),n("span",{class:"flex-1 text-[var(--color-text-primary)] truncate",title:e.message,children:e.message})]}),t&&i&&e.fields&&n("div",{class:"pb-3 px-3 ml-7 space-y-2",children:[e.message&&n("div",{class:"text-xs font-mono",children:[n("span",{class:"text-[var(--color-accent)]",children:"message"}),n("div",{class:"text-[var(--color-text-primary)] mt-1 whitespace-pre-wrap break-all",children:e.message})]}),n("div",{class:"space-y-1 pt-1 border-t border-[var(--color-border)]/30",children:Object.entries(e.fields).map(([c,u])=>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:u})]},c))}),n("details",{class:"pt-1 border-t border-[var(--color-border)]/30",children:[n("summary",{class:"text-xs text-[var(--color-text-muted)] cursor-pointer hover:text-[var(--color-text-secondary)]",children:l("logs.rawLine")}),n("pre",{class:"mt-2 text-xs font-mono text-[var(--color-text-secondary)] bg-[var(--color-bg-primary)] rounded p-2 overflow-x-auto whitespace-pre-wrap break-all",children:cy(e.raw)})]})]})]})}const tA={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)]"}},$v={debug:"common.debug",info:"logs.info",warn:"logs.warnings",error:"common.error"};function fi({level:e,count:t,selected:a,onClick:r}){const o=tA[e];return n("button",{type:"button",onClick:r,"aria-label":l("logs.filterByLevel",{level:l($v[e])}),"aria-pressed":a,class:`px-3 py-1 text-sm rounded-full transition-colors ${a?o.active:o.inactive}`,children:[l($v[e])," (",t,")"]})}function nA({logId:e,lines:t,onClose:a}){const r=e!==null?t.find(o=>o.id===e):null;return n(We,{open:!!r,onClose:a,title:l("logs.logDetails"),children:r&&n("div",{class:"space-y-4",children:[n("div",{class:"flex items-center gap-2",children:[r.level&&n(Z,{variant:r.level==="error"?"error":r.level==="warn"?"warning":"default",children:r.level}),r.timestamp&&n("span",{class:"text-sm text-[var(--color-text-muted)] font-mono",children:r.timestamp})]}),n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:l("logs.message")}),n("p",{class:"text-sm text-[var(--color-text-primary)] whitespace-pre-wrap break-words",children:r.message})]}),r.fields&&Object.keys(r.fields).length>0&&n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-2",children:l("logs.fields")}),n("div",{class:"space-y-2 bg-[var(--color-bg-tertiary)] rounded-lg p-3",children:Object.entries(r.fields).map(([o,s])=>n("div",{class:"text-xs font-mono",children:[n("span",{class:"text-[var(--color-accent)]",children:o}),n("span",{class:"text-[var(--color-text-muted)] mx-1",children:"="}),n("span",{class:"text-[var(--color-text-secondary)] break-all",children:s})]},o))})]}),n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:l("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:cy(r.raw)})]})]})})}function aA({line:e,onSelect:t}){const a=e.level?uy[e.level]:Al,r=e.level?dy[e.level]:"text-[var(--color-text-muted)]",o=e.fields&&Object.keys(e.fields).length>0,s=hy(e.timestamp);return n("button",{type:"button",class:"w-full flex items-start gap-3 p-3 text-left bg-[var(--color-bg-secondary)] rounded-lg hover:bg-[var(--color-bg-hover)] transition-colors",onClick:()=>t(e.id),"aria-label":l("logs.viewLogDetails"),children:[n(a,{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:[s&&n("span",{class:"text-xs text-[var(--color-text-muted)] font-mono",children:s}),o&&n(Z,{variant:"default",class:"text-xs",children:[Object.keys(e.fields).length," ",l("logs.fields")]})]})]}),n(Ve,{size:16,class:"text-[var(--color-text-muted)] flex-shrink-0 mt-0.5"})]})}function fy(e){const{ready:t,expandedParam:a,expandedState:r,expandedInitialized:o,setExpandedParam:s,isValid:i,getItemSelector:c,onMobileOpenFirst:u,isMobile:d=()=>window.matchMedia("(max-width: 767px)").matches,scrollOnMobile:h=!0,scrollDelayMs:f=100}=e;R(()=>{if(!t||a.value.size===0)return;const p=Array.from(a.value).filter(C=>i?i(C):!0),v=p.filter(C=>!r.value.has(C));if(v.length===0)return;r.value=new Set([...r.value,...p]);const w=d();w&&u&&u(v[0]),(!w||h)&&setTimeout(()=>{const C=c(v[0]),T=document.querySelectorAll(C);Array.from(T).find(g=>g.offsetParent!==null)?.scrollIntoView({behavior:"smooth",block:"center"})},f)},[a.value,t]),R(()=>{o.value&&s(r.value)},[r.value,o.value])}const Ze=m([]),uh=m(0),dh=m(""),Za=m(!1),Ec=m(null),va=m(!0),al=m(""),Ot=m(new Set),kr=m(new Set),py=m(typeof window<"u"?window.matchMedia("(max-width: 767px)").matches:!1),rA=K(()=>{if(!py.value||kr.value.size===0)return null;const e=Array.from(kr.value);return e[e.length-1]??null});async function qf(e=!1){if(D.value){Za.value=!0,Ec.value=null;try{const t=await N("logs.tail",{cursor:e?void 0:uh.value||void 0,limit:500,maxBytes:25e4});if(t)if(dh.value=t.file,uh.value=t.cursor,t.reset||e)iy(),Ze.value=t.lines.map(Lv);else{const a=t.lines.map(Lv);a.length>0&&(Ze.value=[...Ze.value,...a].slice(-2e3))}}catch(t){Ec.value=t instanceof Error?t.message:l("logs.fetchError")}finally{Za.value=!1}}}function Dv(){Ze.value=[],uh.value=0,iy()}function Pv(){const e=Ze.value.map(o=>o.raw).join(`
434
- `),t=new Blob([e],{type:"text/plain"}),a=URL.createObjectURL(t),r=document.createElement("a");r.href=a,r.download=`openclaw-logs-${new Date().toISOString().slice(0,10)}.log`,r.click(),URL.revokeObjectURL(a)}function pi(e){Oo(Ot,e)}function oA(){Ot.value=new Set}function sA(e){ru(),kr.value=new Set([e])}function lA(){kr.value=new Set}const Ov=K(()=>{let e=Ze.value;const t=Ot.value;t.size>0&&(e=e.filter(r=>r.level&&t.has(r.level)));const a=al.value.toLowerCase().trim();return a&&(e=e.filter(r=>r.raw.toLowerCase().includes(a))),e}),iA=K(()=>{const e={debug:0,info:0,warn:0,error:0};for(const t of Ze.value)t.level&&t.level in e&&e[t.level]++;return e});function cA(){const e=!Za.value&&Ze.value.length>0,[t,a]=he("q"),[r,o]=Zs("level"),[s,i]=he("live"),[c,u,d]=Zs("log",{ready:e,parse:h=>parseInt(h,10)});He(t,al,h=>h),R(()=>{r.value.size>0&&(Ot.value=r.value),s.value==="0"&&(va.value=!1)},[]),Mr(al,a),R(()=>{o(Ot.value)},[Ot.value]),R(()=>{i(va.value?null:"0")},[va.value]),fy({ready:e,expandedParam:c,expandedState:kr,expandedInitialized:d,setExpandedParam:u,isValid:h=>Ze.value.some(f=>f.id===h),getItemSelector:h=>`[data-log-id="${h}"]`})}function uA(){R(()=>{const e=()=>{py.value=window.matchMedia("(max-width: 767px)").matches};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[])}function dA(){R(()=>{D.value&&qf(!0)},[D.value])}function hA(){R(()=>{if(!va.value||!D.value)return;const e=setInterval(()=>{qf()},2e3);return()=>clearInterval(e)},[va.value,D.value])}function fA(e){const t=F(null),a=F(null),r=F(!0),o=F(!0);cA(),uA(),dA(),hA(),R(()=>{r.current&&t.current&&(t.current.scrollTop=t.current.scrollHeight),o.current&&a.current&&(a.current.scrollTop=a.current.scrollHeight)},[Ov.value.length]);const s=()=>{if(!t.current)return;const{scrollTop:d,scrollHeight:h,clientHeight:f}=t.current;r.current=h-d-f<50},i=()=>{if(!a.current)return;const{scrollTop:d,scrollHeight:h,clientHeight:f}=a.current;o.current=h-d-f<50},c=Ov.value,u=iA.value;return n(lu,{viewName:l("common.logs"),children:n("div",{class:"flex-1 flex flex-col overflow-hidden p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto w-full flex flex-col flex-1 min-h-0 space-y-4 sm:space-y-6",children:[n(Ht,{title:l("common.logs"),subtitle:l("logs.description"),actions:n("div",{class:"flex items-center gap-2",children:[n(Be,{checked:va.value,onChange:d=>va.value=d,label:va.value?l("logs.live"):l("common.paused")}),n(q,{icon:n(Qe,{size:16,class:Za.value?"animate-spin":""}),onClick:()=>{qf(!0)},disabled:Za.value,label:l("actions.refresh")})]})}),n(Y,{type:"text",value:al.value,onInput:d=>al.value=d.target.value,placeholder:l("logs.searchPlaceholder"),"aria-label":l("logs.searchPlaceholder"),leftElement:n(ct,{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":l("logs.filterByLevel",{level:""}),children:[n("button",{type:"button",onClick:oA,"aria-pressed":Ot.value.size===0,class:`px-3 py-1 text-sm rounded-full transition-colors whitespace-nowrap ${Ot.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:[l("common.all")," (",Ze.value.length,")"]}),n(fi,{level:"debug",count:u.debug,selected:Ot.value.has("debug"),onClick:()=>pi("debug")}),n(fi,{level:"info",count:u.info,selected:Ot.value.has("info"),onClick:()=>pi("info")}),n(fi,{level:"warn",count:u.warn,selected:Ot.value.has("warn"),onClick:()=>pi("warn")}),n(fi,{level:"error",count:u.error,selected:Ot.value.has("error"),onClick:()=>pi("error")})]}),n("div",{class:"flex items-center gap-2",children:[dh.value&&n("span",{class:"hidden sm:flex text-xs text-[var(--color-text-muted)] items-center gap-1",children:[n(an,{size:12}),dh.value.split("/").pop()]}),n("div",{class:"hidden sm:flex items-center gap-2",children:[n(P,{variant:"ghost",size:"sm",onClick:Pv,icon:n(Rt,{size:14}),children:l("common.download")}),n(P,{variant:"ghost",size:"sm",onClick:Dv,disabled:Ze.value.length===0,icon:n(bt,{size:14}),children:l("common.clear")})]}),n("div",{class:"flex sm:hidden items-center gap-1",children:[n(q,{icon:n(Rt,{size:16}),onClick:Pv,label:l("common.download"),size:"sm"}),n(q,{icon:n(bt,{size:16}),onClick:Dv,disabled:Ze.value.length===0,label:l("common.clear"),size:"sm"})]})]})]}),Ec.value&&n("div",{class:"p-4 rounded-lg bg-[var(--color-error)]/10 text-[var(--color-error)] text-sm",role:"alert",children:Ec.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:[Za.value&&Ze.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!Za.value&&Ze.value.length===0&&n("div",{class:"text-center py-12 text-[var(--color-text-muted)]",children:[n(an,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:l("logs.noLogs")}),n("p",{class:"text-sm mt-1",children:l("logs.noLogsHint")})]}),Ze.value.length>0&&c.length===0&&n("div",{class:"text-center py-12 text-[var(--color-text-muted)]",children:[n(ct,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:l("logs.noMatches")})]}),c.length>0&&n(H,{children:[n("div",{ref:a,class:"md:hidden flex-1 overflow-y-auto p-3 space-y-2",onScroll:i,role:"log","aria-live":"polite",children:c.map(d=>n("div",{"data-log-id":d.id,children:n(aA,{line:d,onSelect:sA})},d.id))}),n("div",{ref:t,class:"hidden md:flex md:flex-col flex-1 overflow-y-auto",onScroll:s,role:"log","aria-live":"polite",children:c.map(d=>n("div",{"data-log-id":d.id,children:n(eA,{line:d,expanded:kr.value.has(d.id),onToggle:()=>{Oo(kr,d.id,{pushHistory:!0})}})},d.id))})]})]}),n(nA,{logId:rA.value,lines:Ze.value,onClose:lA})]})})})}function Vf(e){return e.role?e.role:e.roles&&e.roles.length>0?e.roles[0]:"unknown"}function my(e){return!!(e.role==="node"||e.roles?.includes("node"))}function vy(e){return!!(e.role==="operator"||e.roles?.includes("operator"))}function Gf(e){switch(e){case"operator":return"info";case"node":return"success";default:return"default"}}function gy(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 Sr(e){return e.length<=20?e:`${e.slice(0,10)}...${e.slice(-6)}`}function pA({device:e,onSelect:t}){const a=Vf(e),r=e.tokens?.length??0,o=e.platform?.includes("ios")||e.platform?.includes("android")?po:Gt;return n(No,{icon:o,iconVariant:a==="operator"?"info":"success",title:e.displayName||Sr(e.deviceId),subtitle:e.platform||void 0,badges:n(Z,{variant:Gf(a),children:a}),meta:[...r>0?[{icon:Xc,value:`${r}`}]:[],{icon:ve,value:ne(e.approvedAtMs,{relative:!0})}],onClick:()=>t(e)})}function mi({label:e,children:t}){return n("div",{children:[n("span",{class:"text-[var(--color-text-muted)]",children:[e,":"]})," ",t]})}function mA({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?l("devices.tokenRevoked"):l("devices.tokenActive")})]}),n("div",{class:"flex gap-1",children:n(q,{icon:n(Qc,{class:"w-4 h-4"}),label:l("devices.rotateToken"),onClick:t,size:"sm"})})]})}function by({device:e,bare:t=!1,onOpenTokenModal:a,onRemoveDevice:r}){const o=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(mi,{label:l("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(mi,{label:l("devices.clientId"),children:e.clientId}),e.scopes&&e.scopes.length>0&&n(mi,{label:l("devices.scopes"),children:n("span",{class:"text-xs",children:e.scopes.join(", ")})}),n(mi,{label:l("common.approved"),children:ne(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(eu,{class:"w-4 h-4"}),l("devices.tokens")]}),o.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("devices.noTokens")}):n("div",{class:"space-y-2",children:o.map(i=>n(mA,{token:i,onRotate:()=>a?.(e)},i.role))})]})]}),r&&n("div",{class:"mt-4 pt-4 border-t border-[var(--color-border)]",children:n(P,{variant:"danger",size:"sm",icon:n(bt,{class:"w-4 h-4"}),onClick:()=>r(e),children:l("devices.removeDevice")})})]})}function vA({device:e,isExpanded:t,onToggleExpand:a,onOpenTokenModal:r,onRemoveDevice:o}){const s=Vf(e),i=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:a,"aria-expanded":t,"aria-label":l("devices.toggleDetails",{name:e.displayName||Sr(e.deviceId)}),children:[n("span",{class:"text-[var(--color-text-muted)]",children:t?n(Ne,{class:"w-4 h-4"}):n(Ve,{class:"w-4 h-4"})}),n("span",{class:"text-xl w-8 text-center flex-shrink-0",children:gy(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||Sr(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(Z,{variant:Gf(s),children:s}),i>0&&n("div",{class:"flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(Xc,{class:"w-4 h-4"}),n("span",{children:i})]}),n("div",{class:"hidden md:flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(ve,{class:"w-4 h-4"}),n("span",{children:ne(e.approvedAtMs)})]})]}),t&&n(by,{device:e,onOpenTokenModal:r,onRemoveDevice:o})]})}const Xa=m([]),Jf=m([]),ja=m(!1),ks=m(null),cs=m(""),Dt=m("all"),Na=m(new Set),sr=m(null),gn=m(null),to=m(null),hh=m(!1),fh=m(!1),gA=[{value:"all",label:()=>l("devices.filters.allRoles")},{value:"operator",label:()=>l("common.operators")},{value:"node",label:()=>l("common.nodes")}],bA=K(()=>{const e=Xa.value,t=e.filter(vy).length,a=e.filter(my).length,r=Jf.value.length;return{total:e.length,operators:t,nodes:a,pending:r}}),xA=K(()=>{let e=Xa.value;Dt.value==="operator"?e=e.filter(vy):Dt.value==="node"&&(e=e.filter(my));const t=cs.value.toLowerCase().trim();return t&&(e=e.filter(a=>a.deviceId.toLowerCase().includes(t)||a.displayName?.toLowerCase().includes(t)||a.platform?.toLowerCase().includes(t)||a.remoteIp?.toLowerCase().includes(t))),e});async function _r(){ja.value=!0,ks.value=null;try{const e=await N("device.pair.list",{});Xa.value=e.paired,Jf.value=e.pending}catch(e){ks.value=ae(e)}finally{ja.value=!1}}async function yA(e){try{await N("device.pair.approve",{requestId:e}),V.success(l("devices.approveSuccess")),await _r()}catch(t){V.error(ae(t))}}async function wA(e){try{await N("device.pair.reject",{requestId:e}),V.success(l("devices.rejectSuccess")),await _r()}catch(t){V.error(ae(t))}}async function kA(e,t){hh.value=!0;try{const a=await N("device.token.rotate",{deviceId:e.deviceId,role:t});V.success(l("devices.tokenRotated")),await navigator.clipboard.writeText(a.token),V.success(l("devices.tokenCopied")),sr.value=null,await _r()}catch(a){V.error(ae(a))}finally{hh.value=!1}}async function SA(e,t){try{await N("device.token.revoke",{deviceId:e.deviceId,role:t}),V.success(l("devices.tokenRevoked")),sr.value=null,await _r()}catch(a){V.error(ae(a))}}async function _A(e){fh.value=!0;try{await N("device.pair.remove",{deviceId:e.deviceId}),V.success(l("devices.removeSuccess")),to.value=null,gn.value=null,await _r()}catch(t){V.error(ae(t))}finally{fh.value=!1}}function CA(e){Oo(Na,e,{pushHistory:!0})}function TA({request:e}){const t=Vf(e);return n(G,{class:"border-[var(--color-warning)] border-2",children:n("div",{class:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4",children:[n("div",{class:"flex items-center gap-3",children:[n("span",{class:"text-2xl",children:gy(e.platform)}),n("div",{children:[n("div",{class:"flex items-center gap-2 flex-wrap",children:[n("h3",{class:"font-medium",children:e.displayName||Sr(e.deviceId)}),n(Z,{variant:Gf(t),children:t}),e.isRepair&&n(Z,{variant:"warning",children:l("devices.repair")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:[e.platform,e.remoteIp&&` • ${e.remoteIp}`," • ",ne(e.ts)]})]})]}),n("div",{class:"flex gap-2 self-end sm:self-start",children:[n(P,{variant:"primary",size:"sm",icon:on,onClick:()=>yA(e.requestId),children:l("devices.approve")}),n(P,{variant:"danger",size:"sm",icon:Ma,onClick:()=>wA(e.requestId),children:l("devices.reject")})]})]})})}function EA({token:e,device:t,disabled:a}){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:[l("devices.tokenCreated"),": ",ne(e.createdAtMs),e.rotatedAtMs&&n(H,{children:[" ","• ",l("devices.tokenRotatedAt"),": ",ne(e.rotatedAtMs)]})]})]}),n("div",{class:"flex gap-2",children:[n(P,{variant:"secondary",size:"sm",icon:Qc,onClick:()=>kA(t,e.role),disabled:a,children:l("devices.rotate")}),n(P,{variant:"danger",size:"sm",icon:bt,onClick:()=>SA(t,e.role),children:l("devices.revoke")})]})]})}function AA(){const e=sr.value;if(!e)return null;const t=e.tokens??[];return n(We,{open:!0,onClose:()=>{sr.value=null},title:l("devices.tokenManagement"),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("devices.tokenManagementDesc",{name:e.displayName||Sr(e.deviceId)})}),t.length===0?n("p",{class:"text-sm",children:l("devices.noTokens")}):n("div",{class:"space-y-3",children:t.map(a=>n(EA,{token:a,device:e,disabled:hh.value},a.role))})]}),n("div",{class:"mt-6 flex justify-end",children:n(P,{variant:"secondary",onClick:()=>{sr.value=null},children:l("actions.close")})})]})}function MA(){const e=to.value;return e?n(We,{open:!0,onClose:()=>{to.value=null},title:l("devices.removeDevice"),children:[n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:l("devices.removeWarning")}),n(Pf,{message:l("devices.removeConfirm",{name:e.displayName||Sr(e.deviceId)}),onCancel:()=>{to.value=null},onDelete:()=>_A(e),isDeleting:fh.value})]}):null}function IA(){return n("div",{class:"text-center py-12",children:[n(po,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:l("devices.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l("devices.emptyDescription")})]})}function RA(e){const t=!ja.value&&Xa.value.length>0,[a,r]=he("q"),[o,s]=he("role"),[i,c,u]=Zs("device",{ready:t});He(a,cs,p=>p),He(o,Dt,p=>p),Mr(cs,r),Rn(Dt,s,"all"),R(()=>{if(t&&i.value.size>0){const p=Array.from(i.value).filter(v=>!Na.value.has(v));p.length>0&&(Na.value=new Set([...Na.value,...i.value]),setTimeout(()=>{const v=document.querySelectorAll(`[data-device-id="${p[0]}"]`),w=Array.from(v).find(C=>C.offsetParent!==null);w&&w.scrollIntoView({behavior:"smooth",block:"center"})},100))}},[i.value,t]),R(()=>{u.value&&c(Na.value)},[Na.value,u.value]),R(()=>{D.value&&_r()},[D.value]);const d=xA.value,h=bA.value,f=Jf.value;return n(sn,{viewName:l("common.devices"),children:[n(Ht,{title:l("common.devices"),subtitle:l("devices.description"),actions:n(q,{icon:n(Qe,{class:ja.value?"animate-spin":""}),onClick:_r,disabled:ja.value,label:l("actions.refresh")})}),ks.value&&n(qn,{variant:"error",children:ks.value}),ja.value&&Xa.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!ja.value&&!ks.value&&n(H,{children:[n("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-4",children:[n(le,{icon:po,label:l("common.total"),value:h.total,active:Dt.value==="all",onClick:()=>{Dt.value="all"}}),n(le,{icon:rn,label:l("common.operators"),value:h.operators,active:Dt.value==="operator",onClick:()=>{Dt.value="operator"}}),n(le,{icon:Gt,label:l("common.nodes"),value:h.nodes,active:Dt.value==="node",onClick:()=>{Dt.value="node"}}),n(le,{icon:ve,label:l("common.pending"),value:h.pending,highlight:h.pending>0})]}),f.length>0&&n("div",{class:"space-y-3","data-tour":"pending-requests",children:[n("h2",{class:"text-lg font-semibold",children:l("devices.pendingRequests")}),f.map(p=>n(TA,{request:p},p.requestId))]}),Xa.value.length>0&&n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-3",children:[n(Y,{type:"text",placeholder:l("devices.searchPlaceholder"),value:cs.value,onInput:p=>{cs.value=p.target.value},leftElement:n(ct,{class:"w-4 h-4"}),class:"flex-1"}),n(Ae,{value:Dt.value,onChange:p=>{Dt.value=p},options:gA.map(p=>({value:p.value,label:p.label()})),size:"sm",align:"right","aria-label":l("devices.filters.allRoles")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:d.length!==h.total?l("devices.filteredCount",{filtered:d.length,total:h.total}):l("devices.count",{count:h.total})})]}),Xa.value.length>0?d.length===0?n(G,{padding:"none",children:n("div",{class:"text-center py-8 text-[var(--color-text-muted)]",children:l("devices.noResults")})}):n(H,{children:[n("div",{class:"md:hidden space-y-2",children:d.map(p=>n("div",{"data-device-id":p.deviceId,children:n(pA,{device:p,onSelect:v=>{gn.value=v}})},p.deviceId))}),n(G,{padding:"none",class:"hidden md:block overflow-hidden",children:d.map(p=>n("div",{"data-device-id":p.deviceId,children:n(vA,{device:p,isExpanded:Na.value.has(p.deviceId),onToggleExpand:()=>CA(p.deviceId),onOpenTokenModal:v=>{sr.value=v},onRemoveDevice:v=>{to.value=v}})},p.deviceId))})]}):n(IA,{})]}),n(We,{open:!!gn.value,onClose:()=>{gn.value=null},title:gn.value?.displayName||(gn.value?Sr(gn.value.deviceId):""),children:gn.value&&n(by,{device:gn.value,bare:!0,onOpenTokenModal:p=>{gn.value=null,sr.value=p},onRemoveDevice:p=>{to.value=p}})}),n(AA,{}),n(MA,{})]})}function Yf({items:e,activeId:t,onChange:a}){return n("div",{class:"flex border-b border-[var(--color-border)] overflow-x-auto scrollbar-hide -mx-4 px-4 sm:mx-0 sm:px-0",role:"tablist",children:e.map(r=>{const o=r.id===t;return n("button",{type:"button",role:"tab","aria-selected":o,onClick:()=>a(r.id),class:`relative flex items-center gap-1.5 sm:gap-2 px-3 sm:px-4 py-3 text-sm font-medium transition-colors whitespace-nowrap flex-shrink-0 ${o?"text-[var(--color-accent)]":"text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)]"}`,children:[r.icon,r.label,o&&n("span",{class:"absolute bottom-0 left-0 right-0 h-0.5 bg-[var(--color-accent)] rounded-full"})]},r.id)})})}function fu(e){return e.disabled?"disabled":e.blockedByAllowlist?"blocked":e.eligible?"eligible":"missing-reqs"}function LA(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 $A(e){const t=[],{missing:a}=e;return a.bins.length>0&&t.push(`bins: ${a.bins.join(", ")}`),a.anyBins.length>0&&t.push(`needs one of: ${a.anyBins.join(", ")}`),a.env.length>0&&t.push(`env: ${a.env.join(", ")}`),a.config.length>0&&t.push(`config: ${a.config.join(", ")}`),a.os.length>0&&t.push(`os: ${a.os.join(", ")}`),t}const Zf="https://clawhub.ai/api/v1";async function xy(e){const t=new URLSearchParams;e?.limit&&t.set("limit",String(e.limit)),e?.cursor&&t.set("cursor",e.cursor),e?.sort&&t.set("sort",e.sort);const a=`${Zf}/skills${t.toString()?`?${t}`:""}`,r=await fetch(a);if(!r.ok)throw new Error(`ClawHub API error: ${r.status}`);return r.json()}async function DA(e,t){const a=new URLSearchParams({q:e});a.set("limit",String(t.limit));const r=`${Zf}/search?${a}`,o=await fetch(r);if(!o.ok)throw new Error(`ClawHub API error: ${o.status}`);return{items:((await o.json()).results||[]).map(c=>({slug:c.slug,displayName:c.displayName,summary:c.summary,tags:{latest:c.version},stats:{comments:0,downloads:0,stars:0,versions:0},createdAt:c.updatedAt,updatedAt:c.updatedAt,latestVersion:{version:c.version,createdAt:c.updatedAt,changelog:""}}))}}async function PA(e){const t=`${Zf}/skills/${encodeURIComponent(e)}`,a=await fetch(t);if(a.status===404)return null;if(!a.ok)throw new Error(`ClawHub API error: ${a.status}`);const r=await a.json();return{...r.skill,latestVersion:r.latestVersion,owner:r.owner}}const kt=m([]),Xf=m([]),kn=m(!1),Bi=m(!1),Ss=m(null),xn=m(""),Ur=m("downloads"),no=m(void 0),Wn=m(null),_s=m(!1),OA=[{value:"downloads",label:()=>l("skills.clawhub.sortPopular")},{value:"trending",label:()=>l("skills.clawhub.sortTrending")},{value:"stars",label:()=>l("skills.clawhub.sortStars")},{value:"recent",label:()=>l("skills.clawhub.sortRecent")}];async function yy(){if(!Bi.value){Bi.value=!0;try{const e=await xy({limit:6,sort:"trending"});Xf.value=e.items}catch{}finally{Bi.value=!1}}}async function Wi(e=!1){if(!kn.value){kn.value=!0,Ss.value=null;try{const t=e?no.value:void 0;if(xn.value){const a=await DA(xn.value,{limit:20});kt.value=a.items,no.value=void 0;const r=await Promise.all(a.items.map(async o=>{try{return await PA(o.slug)||o}catch{return o}}));kt.value=r}else{const a=await xy({limit:20,cursor:t,sort:Ur.value});e?kt.value=[...kt.value,...a.items]:kt.value=a.items,no.value=a.nextCursor}}catch(t){Ss.value=ae(t)}finally{kn.value=!1}}}function NA(){yy(),Wi()}async function FA(e){_s.value=!0;try{V.error(l("skills.clawhub.notYetSupported",{slug:e.slug})),Wn.value=null}catch(t){V.error(ae(t))}finally{_s.value=!1}}function ph(e){Wn.value=e,ru()}function zA(){const e=Xf.value;return Bi.value&&e.length===0?n("div",{class:"flex items-center justify-center py-8",children:n(te,{size:"md"})}):e.length===0?null:n("section",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-2",children:[n(T4,{class:"w-5 h-5 text-orange-500"}),n("h2",{class:"font-semibold",children:l("skills.clawhub.trending")})]}),n("div",{class:"flex gap-3 overflow-x-auto pb-2 scrollbar-hide -mx-4 px-4 sm:mx-0 sm:px-0",children:e.map(t=>n(UA,{skill:t},t.slug))})]})}function UA({skill:e}){const t=e.tags?.latest||e.latestVersion?.version||"?";return n("button",{type:"button",onClick:()=>ph(e),style:{outline:"none"},class:"flex-shrink-0 w-56 p-3 rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-secondary)] hover:border-[var(--color-border-hover)] hover:bg-[var(--color-bg-hover)] transition-colors text-left group cursor-pointer",children:[n("div",{class:"flex items-center gap-2 mb-1",children:[n("span",{class:"font-medium truncate flex-1",children:e.displayName}),n(Z,{variant:"default",class:"flex-shrink-0 text-xs",children:t})]}),n("p",{class:"text-xs text-[var(--color-text-muted)] line-clamp-2 mb-2 min-h-[2.5em]",children:e.summary||l("skills.clawhub.noDescription")}),n("div",{class:"flex items-center gap-3 text-xs text-[var(--color-text-muted)]",children:[n("span",{class:"flex items-center gap-1",children:[n(Rt,{class:"w-3 h-3"}),Qf(e.stats.downloads)]}),n("span",{class:"flex items-center gap-1",children:[n(xf,{class:"w-3 h-3"}),e.stats.stars]}),n(Ve,{class:"w-3 h-3 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"})]})]})}function jA({skill:e}){const t=e.tags?.latest||e.latestVersion?.version||"?";return n(G,{class:"hover:border-[var(--color-border-hover)] transition-colors",children:n("div",{class:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4",children:[n("button",{type:"button",onClick:()=>ph(e),style:{outline:"none"},class:"flex-1 min-w-0 text-left cursor-pointer",children:[n("div",{class:"flex items-center gap-2 mb-1 flex-wrap",children:[n("h3",{class:"font-semibold truncate",children:e.displayName}),n(Z,{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||l("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(Rt,{class:"w-3 h-3"}),Qf(e.stats.downloads)]}),n("span",{class:"flex items-center gap-1",children:[n(xf,{class:"w-3 h-3"}),e.stats.stars]}),n("span",{class:"flex items-center gap-1",children:[n(Ro,{class:"w-3 h-3"}),ne(e.updatedAt)]})]})]}),n(P,{variant:"secondary",size:"sm",icon:n(Rt,{class:"w-4 h-4"}),onClick:()=>ph(e),class:"self-start sm:flex-shrink-0",children:l("skills.clawhub.install")})]})})}function HA(){const e=Wn.value;if(!e)return null;const t=e.tags?.latest||e.latestVersion?.version||"?",a=e.latestVersion?.changelog,r=n("div",{class:"flex items-center justify-between gap-3",children:[n(P,{variant:"secondary",icon:n($o,{class:"w-4 h-4"}),onClick:()=>window.open(`https://clawhub.ai/skills/${e.slug}`,"_blank"),children:"ClawHub"}),n("div",{class:"flex gap-3",children:[n(P,{variant:"secondary",onClick:()=>{Wn.value=null},disabled:_s.value,children:l("actions.cancel")}),n(P,{variant:"primary",icon:n(Rt,{class:"w-4 h-4"}),onClick:()=>FA(e),disabled:_s.value,children:_s.value?l("skills.clawhub.installing"):l("skills.clawhub.install")})]})]});return n(We,{open:!0,onClose:()=>{Wn.value=null},title:e.displayName,footer:r,size:"lg",children:n("div",{class:"space-y-5",children:[e.summary&&n("p",{class:"text-[var(--color-text-muted)]",children:e.summary}),n("div",{class:"flex items-center gap-4 flex-wrap text-sm",children:[n("span",{class:"flex items-center gap-1.5",children:[n(xf,{class:"w-4 h-4 text-yellow-500"}),n("span",{class:"font-medium",children:e.stats.stars})]}),n("span",{class:"flex items-center gap-1.5 text-[var(--color-text-muted)]",children:[n(Rt,{class:"w-4 h-4"}),Qf(e.stats.downloads)]}),e.stats.installsCurrent!==void 0&&n("span",{class:"flex items-center gap-1.5 text-[var(--color-text-muted)]",children:[n(k4,{class:"w-4 h-4"}),e.stats.installsCurrent," ",l("skills.clawhub.installs")]}),e.stats.comments>0&&n("span",{class:"flex items-center gap-1.5 text-[var(--color-text-muted)]",children:[n(Pb,{class:"w-4 h-4"}),e.stats.comments]})]}),e.owner&&n("div",{class:"flex items-center gap-2",children:[n("span",{class:"text-sm text-[var(--color-text-muted)]",children:l("skills.clawhub.by")}),e.owner.image?n("img",{src:e.owner.image,alt:e.owner.displayName,class:"w-5 h-5 rounded-full"}):n(Ub,{class:"w-5 h-5 text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:["@",e.owner.handle]})]}),n("div",{class:"flex items-center gap-4 flex-wrap text-sm text-[var(--color-text-muted)]",children:[n(Z,{variant:"default",children:t}),n("span",{class:"flex items-center gap-1.5",children:[n(Ro,{class:"w-4 h-4"}),l("skills.clawhub.updated")," ",ne(e.updatedAt)]})]}),a&&n("div",{children:[n("h4",{class:"text-sm font-medium mb-2",children:l("skills.clawhub.changelog")}),n("div",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg text-xs max-h-32 overflow-y-auto whitespace-pre-wrap font-mono",children:a})]})]})})}function BA(){return n("div",{class:"text-center py-12",children:[n(rn,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:l("skills.clawhub.noResults")}),n("p",{class:"text-[var(--color-text-muted)]",children:l("skills.clawhub.tryDifferentSearch")})]})}function Qf(e){return e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:String(e)}function WA(){const[e,t]=he("hub_q"),[a,r]=he("hub_sort"),[o,s]=he("hub_skill");He(e,xn,d=>d),He(a,Ur,d=>d),Mr(xn,t),Rn(Ur,r,"downloads"),R(()=>{if(o.value&&kt.value.length>0){const d=kt.value.find(h=>h.slug===o.value);d&&!Wn.value&&(Wn.value=d)}},[o.value,kt.value]),R(()=>{s(Wn.value?.slug??null)},[Wn.value]),R(()=>{yy()},[]),R(()=>{xn.value||(no.value=void 0,Wi())},[Ur.value]);const i=F(null);R(()=>(i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{no.value=void 0,Wi()},300),()=>{i.current&&clearTimeout(i.current)}),[xn.value]);const c=!!no.value,u=Xf.value.length>0;return n("div",{class:"space-y-6",children:[u&&n(zA,{}),n("div",{class:"flex items-center justify-between gap-2 sm:gap-3",children:[n("div",{class:"min-w-0 w-full max-w-md",children:n(Y,{type:"text",placeholder:l("skills.clawhub.searchPlaceholder"),value:xn.value,onInput:d=>{xn.value=d.target.value},leftElement:kn.value?n(te,{size:"sm"}):n(ct,{class:"w-4 h-4"}),fullWidth:!0,rightElement:xn.value?n("button",{type:"button",onClick:()=>{xn.value=""},class:"p-1 hover:bg-[var(--color-bg-hover)] rounded-full transition-colors","aria-label":l("actions.clear"),children:n(Ma,{class:"w-4 h-4"})}):void 0})}),n(Ae,{value:Ur.value,onChange:d=>{Ur.value=d},options:OA.map(d=>({value:d.value,label:d.label()})),size:"sm",align:"right","aria-label":l("skills.clawhub.sortLabel")})]}),Ss.value&&n(qn,{variant:"error",children:Ss.value}),kn.value&&kt.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),kt.value.length>0&&n("div",{class:"grid gap-3",children:kt.value.map(d=>n(jA,{skill:d},d.slug))}),!kn.value&&!Ss.value&&kt.value.length===0&&n(BA,{}),c&&!kn.value&&n("div",{class:"flex justify-center",children:n(P,{variant:"secondary",onClick:()=>Wi(!0),children:l("actions.showMore")})}),kn.value&&kt.value.length>0&&n("div",{class:"flex justify-center py-4",children:n(te,{size:"md"})}),n(HA,{})]})}const vi=m(!1);function KA({skill:e,onClose:t,onSuccess:a}){if(!e)return null;const r=async o=>{vi.value=!0;try{const s=await N("skills.install",{name:e.name,installId:o,timeoutMs:6e4});s.ok?(V.success(l("skills.installSuccess",{name:e.name})),t(),a()):V.error(s.message||l("skills.installFailed"))}catch(s){V.error(ae(s))}finally{vi.value=!1}};return n(We,{open:!0,onClose:t,title:l("skills.installTitle",{name:e.name}),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("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:()=>r(o.id),disabled:vi.value,children:[n(Rt,{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:[l("skills.providesBins"),": ",o.bins.join(", ")]})]}),vi.value&&n(te,{size:"sm"})]},o.id))})]}),n("div",{class:"mt-6 flex justify-end",children:n(P,{variant:"secondary",onClick:t,children:l("actions.cancel")})})]})}function Nv({label:e,children:t}){return n("div",{children:[n("span",{class:"text-[var(--color-text-muted)]",children:[e,":"]})," ",t]})}function wy({skill:e,onInstall:t,bare:a=!1}){const r=$A(e),o=e.install.length>0&&LA(e);return n("div",{class:a?"":"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(Nv,{label:l("skills.skillKey"),children:n("code",{class:"text-xs bg-[var(--color-bg-primary)] px-1 py-0.5 rounded",children:e.skillKey})}),n(Nv,{label:l("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:[l("skills.homepage"),n($o,{class:"w-3 h-3"})]})})]}),n("div",{class:"space-y-2",children:[r.length>0&&n("div",{children:[n("span",{class:"text-[var(--color-warning)] font-medium",children:[l("skills.missingRequirements"),":"]}),n("ul",{class:"list-disc list-inside text-xs mt-1 space-y-0.5",children:r.map(i=>n("li",{children:i},i))})]}),e.blockedByAllowlist&&n("div",{class:"flex items-center gap-2 text-[var(--color-error)]",children:[n(U4,{class:"w-4 h-4"}),n("span",{children:l("skills.blockedByAllowlist")})]}),o&&n("div",{class:"pt-2",children:n(P,{variant:"secondary",size:"sm",icon:Rt,onClick:()=>t(e),children:l("skills.installDeps")})}),e.primaryEnv&&n("div",{class:"text-xs text-[var(--color-text-muted)]",children:[l("skills.primaryEnv"),": ",n("code",{children:e.primaryEnv})]})]})]})]})}const qA={"openclaw-bundled":Nb,"openclaw-managed":E4,"openclaw-workspace":cc,"openclaw-extra":cc},VA={"openclaw-bundled":"skills.source.bundled","openclaw-managed":"skills.source.managed","openclaw-workspace":"common.workspace","openclaw-extra":"skills.source.extra"};function ky(e){const t={eligible:{variant:"success",key:"common.eligible"},disabled:{variant:"default",key:"common.disabled"},"missing-reqs":{variant:"warning",key:"common.missingReqs"},blocked:{variant:"error",key:"skills.status.blocked"}},{variant:a,key:r}=t[e];return{variant:a,label:l(r)}}function Sy(e){return qA[e]||mf}function _y(e){const t=VA[e];return t?l(t):e}function GA({skill:e,onToggleExpand:t,onToggleEnabled:a}){const r=fu(e),o=ky(r),s=Sy(e.source);return n(No,{icon:()=>n("span",{class:"text-lg",children:e.emoji||"🔧"}),iconVariant:r==="eligible"?"success":r==="missing-reqs"?"warning":"default",title:e.name,subtitle:e.description,badges:n(H,{children:[n(Z,{variant:o.variant,size:"sm",children:o.label}),e.always&&n("span",{class:"text-xs text-[var(--color-text-muted)]",title:l("common.alwaysActive"),children:"⚡"})]}),meta:[{icon:s,value:_y(e.source)}],actions:n("div",{onClick:i=>i.stopPropagation(),onKeyDown:i=>i.stopPropagation(),role:"presentation",children:n(Be,{checked:!e.disabled,onChange:a,size:"sm","aria-label":e.disabled?l("common.enable"):l("common.disable")})}),onClick:t})}function JA({skill:e,isExpanded:t,onToggleExpand:a,onToggleEnabled:r,onInstall:o}){const s=fu(e),i=ky(s),c=Sy(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:a,"aria-expanded":t,children:[n("span",{class:"text-[var(--color-text-muted)]",children:t?n(Ne,{class:"w-4 h-4"}):n(Ve,{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:l("common.alwaysActive"),children:"⚡"})]}),n("div",{class:"text-sm text-[var(--color-text-muted)] truncate",title:e.description,children:e.description})]}),n("div",{class:"hidden md:flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(c,{class:"w-4 h-4"}),n("span",{children:_y(e.source)})]}),n("div",{class:"w-24 flex justify-end",children:n(Z,{variant:i.variant,children:i.label})}),n("div",{onClick:u=>u.stopPropagation(),onKeyDown:u=>u.stopPropagation(),role:"presentation",children:n(Be,{checked:!e.disabled,onChange:r,size:"sm","aria-label":e.disabled?l("common.enable"):l("common.disable")})})]}),t&&n(wy,{skill:e,onInstall:o})]})}const YA=[{value:"all",label:()=>l("skills.filters.allSources")},{value:"openclaw-bundled",label:()=>l("skills.source.bundled")},{value:"openclaw-workspace",label:()=>l("common.workspace")},{value:"openclaw-managed",label:()=>l("skills.source.managed")},{value:"openclaw-extra",label:()=>l("skills.source.extra")}],Qo=m("installed"),Kn=m([]),mh=m(""),Cy=m(""),Ha=m(!1),Cs=m(null),Ba=m(""),oa=m("all"),pt=m("all"),Fa=m(new Set),gi=m(null),fn=m(null),ZA=K(()=>{const e=Kn.value;let t=0,a=0,r=0;for(const o of e){const s=fu(o);s==="eligible"?t++:s==="disabled"?a++:s==="missing-reqs"&&r++}return{total:e.length,eligible:t,disabled:a,missingReqs:r}}),XA=K(()=>{let e=Kn.value;const t=Ba.value.toLowerCase().trim();return t&&(e=e.filter(a=>a.name.toLowerCase().includes(t)||a.description.toLowerCase().includes(t)||a.skillKey.toLowerCase().includes(t))),oa.value!=="all"&&(e=e.filter(a=>a.source===oa.value)),pt.value!=="all"&&(e=e.filter(a=>fu(a)===pt.value)),e});async function td(){Ha.value=!0,Cs.value=null;try{const e=await N("skills.status",{});Kn.value=e.skills,mh.value=e.workspaceDir,Cy.value=e.managedSkillsDir}catch(e){Cs.value=ae(e)}finally{Ha.value=!1}}async function Fv(e){const t=e.disabled;try{await N("skills.update",{skillKey:e.skillKey,enabled:t}),Kn.value=Kn.value.map(a=>a.skillKey===e.skillKey?{...a,disabled:!t}:a),V.success(t?l("skills.enabledSuccess",{name:e.name}):l("skills.disabledSuccess",{name:e.name}))}catch(a){V.error(ae(a))}}function QA(e,t=!0){Oo(Fa,e,{pushHistory:t})}function e6(){Ba.value="",oa.value="all",pt.value="all"}const t6=[{id:"installed",label:"Installed",icon:n(Nb,{class:"w-4 h-4"})},{id:"clawhub",label:"ClawHub",icon:n(rn,{class:"w-4 h-4"})}];function n6({hasFilters:e}){return n("div",{class:"text-center py-12",children:[n(ct,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:l(e?"skills.noResults":"skills.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l(e?"common.noResultsHint":"skills.emptyDescription")}),e&&n(P,{type:"button",variant:"ghost",size:"sm",onClick:e6,children:l("common.clearFilters")})]})}function a6(e){const t=!Ha.value&&Kn.value.length>0,[a,r]=he("tab"),[o,s]=he("q"),[i,c]=he("source"),[u,d]=he("status"),[h,f,p]=Zs("skill",{ready:t});R(()=>{D.value&&Qo.value==="installed"&&td()},[D.value]),He(a,Qo,b=>b),He(o,Ba,b=>b),He(i,oa,b=>b),He(u,pt,b=>b),Rn(Qo,r,"installed"),Mr(Ba,s),Rn(oa,c,"all"),Rn(pt,d,"all"),fy({ready:t,expandedParam:h,expandedState:Fa,expandedInitialized:p,setExpandedParam:f,isValid:b=>Kn.value.some(g=>g.skillKey===b),getItemSelector:b=>`[data-skill-key="${b}"]`,onMobileOpenFirst:b=>{const g=Kn.value.find(y=>y.skillKey===b);g&&(fn.value=g)},isMobile:()=>window.innerWidth<768,scrollOnMobile:!1});const v=XA.value,w=ZA.value,C=Qo.value,T=!!Ba.value||oa.value!=="all"||pt.value!=="all";return n(sn,{viewName:l("common.skills"),children:[n(Ht,{title:l("common.skills"),subtitle:l("skills.description"),actions:n(q,{icon:n(Qe,{class:(C==="installed"?Ha.value:kn.value)?"animate-spin":""}),onClick:C==="installed"?td:NA,disabled:C==="installed"?Ha.value:kn.value,label:l("actions.refresh")})}),n(Yf,{items:t6.map(b=>({...b,label:b.label})),activeId:C,onChange:b=>Qo.value=b}),C==="clawhub"&&n(WA,{}),C==="installed"&&n(H,{children:[Cs.value&&n(qn,{variant:"error",children:Cs.value}),Ha.value&&Kn.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!Ha.value&&!Cs.value&&n(H,{children:[n("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-4",children:[n(le,{icon:mf,label:l("common.total"),value:w.total,active:pt.value==="all",onClick:()=>{pt.value="all"}}),n(le,{icon:Lo,label:l("common.eligible"),value:w.eligible,active:pt.value==="eligible",onClick:()=>{pt.value="eligible"}}),n(le,{icon:Er,label:l("common.disabled"),value:w.disabled,active:pt.value==="disabled",onClick:()=>{pt.value="disabled"}}),n(le,{icon:Aa,label:l("common.missingReqs"),value:w.missingReqs,active:pt.value==="missing-reqs",highlight:w.missingReqs>0,onClick:()=>{pt.value="missing-reqs"}})]}),n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-3",children:[n(Y,{type:"text",placeholder:l("common.searchSkills"),value:Ba.value,onInput:b=>{Ba.value=b.target.value},leftElement:n(ct,{class:"w-4 h-4"}),class:"flex-1"}),n(Ae,{value:oa.value,onChange:b=>{oa.value=b},options:YA.map(b=>({value:b.value,label:b.label()})),size:"sm",align:"right","aria-label":l("skills.filters.allSources")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:v.length!==w.total?l("skills.filteredCount",{filtered:v.length,total:w.total}):l("skills.count",{count:w.total})})]}),v.length===0?n(G,{padding:"none",children:n(n6,{hasFilters:T})}):n(H,{children:[n("div",{class:"md:hidden space-y-2",children:v.map(b=>n("div",{"data-skill-key":b.skillKey,children:n(GA,{skill:b,onToggleExpand:()=>{Fa.value.has(b.skillKey)||Oo(Fa,b.skillKey,{pushHistory:!0}),fn.value=b},onToggleEnabled:()=>Fv(b)})},b.skillKey))}),n(G,{padding:"none",class:"hidden md:block overflow-hidden",children:v.map(b=>n("div",{"data-skill-key":b.skillKey,children:n(JA,{skill:b,isExpanded:Fa.value.has(b.skillKey),onToggleExpand:()=>QA(b.skillKey),onToggleEnabled:()=>Fv(b),onInstall:g=>{gi.value=g}})},b.skillKey))})]}),mh.value&&n("div",{class:"text-xs text-[var(--color-text-muted)] space-y-1",children:[n("div",{children:[l("common.workspace"),": ",n("code",{children:mh.value})]}),n("div",{children:[l("skills.managedDir"),": ",n("code",{children:Cy.value})]})]})]})]}),n(We,{open:!!fn.value,onClose:()=>{if(fn.value){const b=new Set(Fa.value);b.delete(fn.value.skillKey),Fa.value=b}fn.value=null},title:fn.value?.name||"",children:fn.value&&n(wy,{skill:fn.value,onInstall:b=>{fn.value=null,gi.value=b},bare:!0})}),n(KA,{skill:gi.value,onClose:()=>{gi.value=null},onSuccess:td})]})}function r6(e){return e.identity?.name||e.name||e.id}function o6(e){const t=r6(e),a=e.identity?.emoji;return a?`${a}  ${t}`:t}const Cr=m([]),Ty=m("main"),Me=m("main"),Sn=m("overview"),pu=m([]),Mn=m(""),Wr=m(!1),Ac=m(null),mu=m(!1),Mc=m(!1),rl=m(""),ol=m(""),sl=m(""),ll=m(""),bi=m(!1),Ts=m(!1),Es=m(""),As=m(""),il=m(""),Ms=m(!1),Is=m(!1),Rs=m(""),Ic=m(!1),Ls=m(!1),s6=K(()=>{const e=new Set;return Cr.value.filter(t=>{const a=t.workspace||o6(t);return e.has(a)?!1:(e.add(a),!0)})}),Fo=K(()=>Cr.value.find(e=>e.id===Me.value)??null);async function Pl(){try{const e=await N("agents.list",{});Cr.value=e.agents,Ty.value=e.defaultId,e.agents.find(t=>t.id===Me.value)||(Me.value=e.defaultId||e.agents[0]?.id||"main")}catch{Cr.value=[{id:"main",name:"Main"}]}}async function zo(){Wr.value=!0,Ac.value=null;try{const e=await N("agents.files.list",{agentId:Me.value});pu.value=e.files,Mn.value=e.workspace}catch(e){Ac.value=ae(e),V.error(l("agents.files.loadError"))}finally{Wr.value=!1}}const Ey=["full","coding","messaging","minimal"],Ut=m(null),vh=m(!1),gh=m(!1),Ol=m(!1),Ft=m({});function Ay(e){return Ey.includes(e)}function nd(e){return e&&Ay(e)?e:"full"}function zv(e){if(e)return typeof e=="string"?e:e.primary}function ep(e){const t=Ut.value;if(!t)return;const a=t.agents?.list?.find(o=>o.id===e),r=zv(a?.model);return r||zv(t.agents?.defaults?.model)}function Uv(e){const t=Ft.value,a=t.profile??"full",r=t.alsoAllow??[];return(t.deny??[]).includes(e)?!1:r.includes(e)||a==="full"?!0:a==="minimal"?["read","memory_search","memory_get"].includes(e):a==="coding"?["read","write","edit","exec","process","web_search","web_fetch"].includes(e):a==="messaging"?["read","message","sessions_list","sessions_send"].includes(e):!1}function l6(e){Ft.value={...Ft.value,profile:e},Ol.value=!0}function i6(e,t){const a={...Ft.value},r=new Set(a.alsoAllow??[]),o=new Set(a.deny??[]);t?(o.delete(e),(a.profile??"full")!=="full"&&r.add(e)):(r.delete(e),o.add(e)),Ft.value={...a,alsoAllow:[...r],deny:[...o]},Ol.value=!0}async function c6(){if(Ut.value){gh.value=!0;try{const e={...Ut.value},t=[...e.agents?.list??[]],a=t.findIndex(o=>o.id===Me.value),r={profile:Ft.value.profile,alsoAllow:Ft.value.alsoAllow?.length?Ft.value.alsoAllow:void 0,deny:Ft.value.deny?.length?Ft.value.deny:void 0};a>=0?t[a]={...t[a],tools:r}:t.push({id:Me.value,tools:r}),e.agents={...e.agents,list:t},await N("config.apply",{config:e}),Ut.value=e,Ol.value=!1,V.success(l("actions.saved"))}catch(e){V.error(ae(e))}finally{gh.value=!1}}}const To=m([]),Rc=m(!1),ao=m(""),bh=m(!1),Lr=m(!1),My=m(null),Zt=m(null);function u6(e){My.value=e,Zt.value=e?[...e]:null,Lr.value=!1}async function tp(){Rc.value=!0;try{const e=await N("skills.status",{});To.value=e.skills}catch(e){V.error(ae(e))}finally{Rc.value=!1}}function d6(e){const t=Zt.value;if(t===null){const a=To.value.filter(r=>!r.disabled&&r.eligible).map(r=>r.name);Zt.value=a.filter(r=>r!==e)}else t.includes(e)?Zt.value=t.filter(a=>a!==e):Zt.value=[...t,e];Lr.value=!0}function h6(){Zt.value=null,Lr.value=!0}function f6(){Zt.value=[],Lr.value=!0}function p6(){const e=To.value.filter(t=>!t.disabled&&t.eligible).map(t=>t.name);Zt.value=e,Lr.value=!0}async function m6(){if(Ut.value){bh.value=!0;try{const e={...Ut.value},t=[...e.agents?.list??[]],a=t.findIndex(o=>o.id===Me.value),r=Zt.value;a>=0?(t[a]={...t[a],skills:r??void 0},r===null&&delete t[a].skills):r!==null&&t.push({id:Me.value,skills:r}),e.agents={...e.agents,list:t},await N("config.apply",{config:e}),Ut.value=e,My.value=Zt.value,Lr.value=!1,V.success(l("actions.saved"))}catch(e){V.error(ae(e))}finally{bh.value=!1}}}async function tn(){vh.value=!0;try{const t=(await N("config.get",{})).config,a={...t,tools:t.tools?{...t.tools,profile:nd(t.tools.profile)}:void 0,agents:t.agents?{...t.agents,list:t.agents.list?.map(o=>({...o,tools:o.tools?{...o.tools,profile:nd(o.tools.profile)}:void 0}))}:void 0};Ut.value=a;const r=a.agents?.list?.find(o=>o.id===Me.value);Ft.value={profile:nd(r?.tools?.profile??a.tools?.profile),alsoAllow:r?.tools?.alsoAllow??[],deny:r?.tools?.deny??[]},Ol.value=!1,u6(r?.skills??null)}catch(e){V.error(ae(e))}finally{vh.value=!1}}async function jv(){const e=Fo.value;e&&(Ut.value||await tn(),rl.value=e.identity?.name||e.name||"",ol.value=e.identity?.avatar||"",sl.value=Mn.value||"",ll.value=ep(e.id)||"",mu.value=!0)}function v6(){mu.value=!1,rl.value="",ol.value="",sl.value="",ll.value=""}async function g6(){const e=Fo.value;if(e){Mc.value=!0;try{const t={agentId:e.id},a=rl.value.trim(),r=e.identity?.name||e.name||"";a&&a!==r&&(t.name=a);const o=ol.value.trim(),s=e.identity?.avatar||"";o!==s&&(t.avatar=o);const i=sl.value.trim(),c=Mn.value||"";i&&i!==c&&(t.workspace=i);const u=ll.value.trim(),d=ep(e.id)||"";u&&u!==d&&(t.model=u),(t.name||t.avatar!==void 0||t.workspace||t.model)&&(await N("agents.update",t),await Pl(),await zo(),V.success(l("actions.saved"))),mu.value=!1}catch(t){V.error(ae(t))}finally{Mc.value=!1}}}function b6(){Es.value="",As.value="",il.value="",Ts.value=!0}async function x6(){const e=Es.value.trim(),t=As.value.trim();if(!e||!t){V.error(l("agents.create.requiredFields"));return}Ms.value=!0;try{const a={name:e,workspace:t};il.value.trim()&&(a.emoji=il.value.trim());const r=await N("agents.create",a);r.ok&&(await Pl(),Me.value=r.agentId,await zo(),await tn(),V.success(l("agents.create.success")),Ts.value=!1)}catch(a){V.error(ae(a))}finally{Ms.value=!1}}function Hv(){Rs.value="",Ic.value=!1,Is.value=!0}async function y6(){const e=Fo.value;if(e){if(Rs.value!==e.id){V.error(l("agents.delete.confirmMismatch"));return}Ls.value=!0;try{await N("agents.delete",{agentId:e.id,deleteFiles:Ic.value}),await Pl();const t=Cr.value;t.length>0?Me.value=t[0].id:Me.value="main",await zo(),await tn(),V.success(l("agents.delete.success")),Is.value=!1}catch(t){V.error(ae(t))}finally{Ls.value=!1}}}async function w6(){await Pl(),await zo(),Sn.value==="tools"?await tn():Sn.value==="skills"&&(await tn(),await tp())}function Iy(e){Me.value=e,zo(),(Sn.value==="tools"||Sn.value==="skills")&&tn()}function k6(e){Sn.value=e,e==="overview"&&!Ut.value||e==="tools"&&!Ut.value?tn():e==="skills"&&(To.value.length===0&&tp(),Ut.value||tn())}function Bv(e){Oe(`/agents/edit/${encodeURIComponent(e)}?agent=${Me.value}`)}const es=m({}),S6={sm:"w-7 h-7 text-base",md:"w-8 h-8 text-lg",lg:"w-16 h-16 text-3xl"},_6={sm:"w-7 h-7",md:"w-8 h-8",lg:"w-16 h-16"};function C6(e){const t=gt.value;return t?`${t.replace(/^ws/,"http")}/avatar/${encodeURIComponent(e)}`:null}function xh({agentId:e,emoji:t="🤖",size:a="md",class:r=""}){const o=C6(e),s=es.value[e],i=S6[a],c=_6[a],u=()=>{es.value={...es.value,[e]:!0}},d=()=>{es.value={...es.value,[e]:!1}};return n("div",{class:`flex-shrink-0 relative ${r}`,children:[o&&n("img",{src:o,alt:"",class:`${c} rounded-xl object-cover border border-[var(--color-border)] ${s?"":"hidden"}`,onLoad:u,onError:d}),!s&&n("div",{class:`${i} rounded-xl bg-[var(--color-bg-tertiary)] flex items-center justify-center border border-[var(--color-border)]`,children:t})]})}function T6(){const e=Fo.value,t=s6.value,a=bi.value;if(!e)return null;const r=e.identity?.emoji||"🤖",o=e.identity?.name||e.name||e.id;return n("div",{class:"relative",children:[n("button",{type:"button",onClick:()=>bi.value=!a,class:"flex items-center gap-2 sm:gap-3 px-2 sm:px-3 py-2 rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-surface)] hover:bg-[var(--color-bg-hover)] transition-colors max-w-[180px] sm:max-w-none sm:min-w-[180px]","aria-expanded":a,"aria-haspopup":"listbox",children:[n(xh,{agentId:e.id,emoji:r,size:"md"}),n("span",{class:"flex-1 text-left font-medium truncate",children:o}),n(Ne,{class:`w-4 h-4 text-[var(--color-text-muted)] transition-transform ${a?"rotate-180":""}`})]}),a&&n(H,{children:[n("button",{type:"button",class:"fixed inset-0 z-10 cursor-default",onClick:()=>bi.value=!1,"aria-label":"Close menu"}),n("div",{class:"absolute top-full left-0 mt-1 w-full min-w-[220px] py-1 rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-surface)] shadow-lg z-20",role:"listbox",children:t.map(s=>{const i=s.identity?.emoji||"🤖",c=s.identity?.name||s.name||s.id,u=s.id===Me.value;return n("button",{type:"button",role:"option","aria-selected":u,onClick:()=>{Iy(s.id),bi.value=!1},class:`w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-[var(--color-bg-hover)] transition-colors ${u?"bg-[var(--color-bg-tertiary)]":""}`,children:[n(xh,{agentId:s.id,emoji:i,size:"sm"}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"font-medium truncate",children:c}),c!==s.id&&n("div",{class:"text-xs text-[var(--color-text-muted)] truncate",children:s.id})]}),u&&n(on,{class:"w-4 h-4 text-[var(--color-accent)] flex-shrink-0"})]},s.id)})})]})]})}function np({onClick:e,saving:t}){return n(P,{type:"button",onClick:e,variant:"primary",size:"sm",disabled:t,children:l(t?"common.saving":"actions.save")})}function E6(){const e=Fo.value;if(!e)return null;const t=e.id===Ty.value,a=e.identity?.name||e.name||e.id,r=e.identity?.emoji||"🤖",o=mu.value,s=ep(e.id);return n("div",{class:"space-y-4",children:n(G,{children:n("div",{class:"p-4",children:o?n("div",{class:"space-y-4",children:[n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n("div",{children:[n("label",{htmlFor:"edit-name",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:l("common.name")}),n(Y,{id:"edit-name",type:"text",value:rl.value,onInput:i=>rl.value=i.target.value,placeholder:l("agents.overview.namePlaceholder"),class:"mt-1",fullWidth:!0})]}),n("div",{children:[n("label",{htmlFor:"edit-avatar",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:l("agents.overview.avatar")}),n(Y,{id:"edit-avatar",type:"text",value:ol.value,onInput:i=>ol.value=i.target.value,placeholder:l("agents.overview.avatarPlaceholder"),class:"mt-1",fullWidth:!0})]})]}),n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n("div",{children:[n("label",{htmlFor:"edit-workspace",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:l("common.workspace")}),n(Y,{id:"edit-workspace",type:"text",value:sl.value,onInput:i=>sl.value=i.target.value,placeholder:l("agents.overview.workspacePlaceholder"),class:"mt-1 font-mono text-sm",fullWidth:!0})]}),n("div",{children:[n("label",{htmlFor:"edit-model",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:l("common.model")}),n(Y,{id:"edit-model",type:"text",value:ll.value,onInput:i=>ll.value=i.target.value,placeholder:l("agents.overview.modelPlaceholder"),class:"mt-1 font-mono text-sm",fullWidth:!0})]})]}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:l("agents.overview.editHint")}),n("div",{class:"flex gap-2",children:[n(np,{onClick:g6,saving:Mc.value}),n("button",{type:"button",onClick:v6,disabled:Mc.value,class:"px-3 py-1.5 text-sm font-medium text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)] rounded-lg",children:l("actions.cancel")})]})]}):n("div",{class:"flex flex-col sm:flex-row sm:items-center gap-4",children:[n("div",{class:"flex items-center gap-3 sm:gap-4",children:[n(xh,{agentId:e.id,emoji:r,size:"lg"}),n("div",{class:"flex-1 min-w-0 sm:hidden",children:n("div",{class:"flex items-center gap-2 flex-wrap",children:[n("h3",{class:"text-lg font-semibold truncate max-w-[150px]",children:a}),n("span",{class:"text-xl flex-shrink-0",title:l("agents.overview.identityEmoji"),children:r}),t&&n(Z,{variant:"info",size:"sm",children:l("common.defaultAgent")})]})}),n("div",{class:"flex items-center gap-1 sm:hidden ml-auto",children:[n(q,{icon:n(fo,{class:"w-4 h-4"}),label:l("common.edit"),onClick:jv,variant:"ghost"}),Me.value!=="main"&&n(q,{icon:n(bt,{class:"w-4 h-4"}),label:l("actions.delete"),onClick:Hv,variant:"ghost",class:"text-[var(--color-error)] hover:bg-[var(--color-error)]/10"})]})]}),n("div",{class:"hidden sm:block flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("h3",{class:"text-lg font-semibold truncate",children:a}),n("span",{class:"text-xl",title:l("agents.overview.identityEmoji"),children:r}),t&&n(Z,{variant:"info",size:"sm",children:l("common.defaultAgent")})]}),n("div",{class:"flex items-center gap-3 mt-1 text-sm text-[var(--color-text-muted)]",children:[n("span",{class:"font-mono truncate",title:Mn.value,children:Mn.value||"—"}),s&&n(H,{children:[n("span",{children:"•"}),n("span",{class:"truncate",title:s,children:s})]})]})]}),n("div",{class:"sm:hidden text-sm text-[var(--color-text-muted)] space-y-1",children:[n("div",{class:"font-mono truncate",title:Mn.value,children:Mn.value||"—"}),s&&n("div",{class:"truncate",title:s,children:s})]}),n("div",{class:"hidden sm:flex items-center gap-1",children:[n(q,{icon:n(fo,{class:"w-4 h-4"}),label:l("common.edit"),onClick:jv,variant:"ghost"}),Me.value!=="main"&&n(q,{icon:n(bt,{class:"w-4 h-4"}),label:l("actions.delete"),onClick:Hv,variant:"ghost",class:"text-[var(--color-error)] hover:bg-[var(--color-error)]/10"})]})]})})})})}const jr={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]+$/},A6=new RegExp(`(\\s+|${jr.punctuation.source}+)`),M6=6,I6=3,R6=[{pattern:/[äöüßẞ]/i,averageCharsPerToken:3},{pattern:/[éèêëàâîïôûùüÿçœæáíóúñ]/i,averageCharsPerToken:3},{pattern:/[ąćęłńóśźżěščřžýůúďťň]/i,averageCharsPerToken:3.5}];function Ry(e,t={}){if(!e)return 0;const{defaultCharsPerToken:a=M6,languageConfigs:r=R6}=t,o=e.split(A6).filter(Boolean);let s=0;for(const i of o)s+=L6(i,r,a);return s}function L6(e,t,a){if(jr.whitespace.test(e))return 0;if(jr.cjk.test(e))return $6(e);if(jr.numeric.test(e)||e.length<=I6)return 1;if(jr.punctuation.test(e))return e.length>1?Math.ceil(e.length/2):1;if(jr.alphanumeric.test(e)){const o=Wv(e,t)??a;return Math.ceil(e.length/o)}const r=Wv(e,t)??a;return Math.ceil(e.length/r)}function Wv(e,t){for(const a of t)if(a.pattern.test(e))return a.averageCharsPerToken}function $6(e){return Array.from(e).length}function Lc(e){return e.toLowerCase()==="memory.md"?"MEMORY.md":e}const Ly={"AGENTS.md":{icon:"📋",description:"agents.files.meta.agents"},"SOUL.md":{icon:"🎭",description:"agents.files.meta.soul"},"TOOLS.md":{icon:"🛠️",description:"agents.files.meta.tools"},"IDENTITY.md":{icon:"🪪",description:"agents.files.meta.identity"},"USER.md":{icon:"👤",description:"agents.files.meta.user"},"HEARTBEAT.md":{icon:"💓",description:"agents.files.meta.heartbeat"},"BOOTSTRAP.md":{icon:"🚀",description:"agents.files.meta.bootstrap"},"MEMORY.md":{icon:"🧠",description:"agents.files.meta.memory"}},Kv=["AGENTS.md","SOUL.md","TOOLS.md","IDENTITY.md","USER.md","HEARTBEAT.md","MEMORY.md","BOOTSTRAP.md"],D6=["BOOTSTRAP.md"];function $y(e){return e.missing?0:e.content?Ry(e.content):e.size!=null?Math.round(e.size/4):0}const qv=K(()=>pu.value.reduce((e,t)=>e+$y(t),0));function P6({file:e}){const t=Lc(e.name),a=Ly[t]??{icon:"📄",description:"agents.files.meta.unknown"},r=D6.includes(t),o=e.missing&&!r,s=$y(e);return n(G,{padding:"md",class:"hover:bg-[var(--color-bg-hover)] transition-colors cursor-pointer",onClick:()=>Bv(e.name),children:n("div",{class:"flex items-center gap-4",children:[n("div",{class:"text-2xl flex-shrink-0","aria-hidden":"true",children:a.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(Z,{variant:"warning",size:"sm",children:[n(Aa,{class:"w-3 h-3 mr-1"}),l("agents.files.missing")]})]}),n("p",{class:"text-sm text-[var(--color-text-muted)] truncate",children:l(a.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&&Ws(e.size),s>0&&` · ${ec(s)} tokens`,e.updatedAtMs&&` · ${Qi(e.updatedAtMs)}`]})]}),!e.missing&&n("div",{class:"hidden sm:flex items-center gap-4 text-sm text-[var(--color-text-muted)] tabular-nums",children:[n("span",{class:"w-16 text-right",children:e.size!=null&&Ws(e.size)}),n("span",{class:"w-24 text-right",children:s>0&&`${ec(s)} tokens`}),n("span",{class:"w-12 text-right",children:e.updatedAtMs&&Qi(e.updatedAtMs)})]}),n(q,{icon:e.missing?n(Sa,{class:"w-4 h-4"}):n(fo,{class:"w-4 h-4"}),label:e.missing?l("common.create"):l("common.edit"),onClick:i=>{i.stopPropagation(),Bv(e.name)},variant:"ghost"})]})})}function O6(){const e=[...pu.value].sort((t,a)=>{const r=Lc(t.name),o=Lc(a.name),s=Kv.indexOf(r),i=Kv.indexOf(o);return(s===-1?999:s)-(i===-1?999:i)});return n("div",{class:"space-y-4",children:[n("div",{class:"space-y-2",children:e.map(t=>n(P6,{file:t},t.name))}),qv.value>0&&n("div",{class:"flex justify-center",children:n(Z,{variant:"default",size:"md",children:l("agents.files.totalTokens",{count:ec(qv.value)})})}),n(qn,{title:l("agents.files.memoryHint.title"),children:n("ul",{class:"list-disc list-inside space-y-1 text-sm",children:[n("li",{children:l("agents.files.memoryHint.line1")}),n("li",{children:l("agents.files.memoryHint.line2")})]})})]})}const N6={full:"agents.tools.profiles.full",coding:"agents.tools.profiles.coding",messaging:"agents.tools.profiles.messaging",minimal:"agents.tools.profiles.minimal"},ad=[{id:"fs",labelKey:"common.files",tools:[{id:"read",label:"read",descriptionKey:"agents.tools.toolDescriptions.read"},{id:"write",label:"write",descriptionKey:"agents.tools.toolDescriptions.write"},{id:"edit",label:"edit",descriptionKey:"agents.tools.toolDescriptions.edit"}]},{id:"runtime",labelKey:"agents.tools.sections.runtime",tools:[{id:"exec",label:"exec",descriptionKey:"agents.tools.toolDescriptions.exec"},{id:"process",label:"process",descriptionKey:"agents.tools.toolDescriptions.process"}]},{id:"web",labelKey:"agents.tools.sections.web",tools:[{id:"web_search",label:"web_search",descriptionKey:"agents.tools.toolDescriptions.webSearch"},{id:"web_fetch",label:"web_fetch",descriptionKey:"agents.tools.toolDescriptions.webFetch"},{id:"browser",label:"browser",descriptionKey:"agents.tools.toolDescriptions.browser"}]},{id:"memory",labelKey:"agents.tools.sections.memory",tools:[{id:"memory_search",label:"memory_search",descriptionKey:"agents.tools.toolDescriptions.memorySearch"},{id:"memory_get",label:"memory_get",descriptionKey:"agents.tools.toolDescriptions.memoryGet"}]},{id:"sessions",labelKey:"common.sessions",tools:[{id:"sessions_list",label:"sessions_list",descriptionKey:"agents.tools.toolDescriptions.sessionsList"},{id:"sessions_send",label:"sessions_send",descriptionKey:"agents.tools.toolDescriptions.sessionsSend"},{id:"sessions_spawn",label:"sessions_spawn",descriptionKey:"agents.tools.toolDescriptions.sessionsSpawn"}]},{id:"automation",labelKey:"agents.tools.sections.automation",tools:[{id:"message",label:"message",descriptionKey:"agents.tools.toolDescriptions.message"},{id:"cron",label:"cron",descriptionKey:"agents.tools.toolDescriptions.cron"},{id:"gateway",label:"gateway",descriptionKey:"agents.tools.toolDescriptions.gateway"},{id:"nodes",label:"nodes",descriptionKey:"agents.tools.toolDescriptions.nodes"}]}];function F6(){if(vh.value)return n("div",{class:"flex justify-center py-12",children:n(te,{size:"lg"})});const e=Ft.value.profile??"full",t=ad.flatMap(r=>r.tools).filter(r=>Uv(r.id)).length,a=ad.flatMap(r=>r.tools).length;return n("div",{class:"space-y-4",children:[n(G,{children:[n("div",{class:"p-4 border-b border-[var(--color-border)] flex items-center justify-between",children:[n("div",{children:[n("h3",{class:"text-base font-semibold",children:l("common.tools")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("agents.tools.enabled",{count:`${t}/${a}`})})]}),Ol.value&&n(np,{onClick:c6,saving:gh.value})]}),n("div",{class:"p-4",children:[n("span",{class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:l("agents.tools.profile")}),n(Ae,{value:e,options:Ey.map(r=>({value:r,label:l(N6[r])})),onChange:r=>{Ay(r)&&l6(r)},class:"mt-2 w-full","aria-label":l("agents.tools.profile")})]})]}),ad.map(r=>n(G,{children:[n("div",{class:"p-4 border-b border-[var(--color-border)]",children:n("h4",{class:"text-sm font-semibold",children:l(r.labelKey)})}),n("div",{class:"divide-y divide-[var(--color-border)]",children:r.tools.map(o=>{const s=Uv(o.id);return n("div",{class:"p-4 flex items-center justify-between gap-4 hover:bg-[var(--color-bg-hover)]",children:[n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("code",{class:"text-sm font-medium",children:o.label}),s?n(Lo,{class:"w-4 h-4 text-[var(--color-success)]"}):n(Er,{class:"w-4 h-4 text-[var(--color-text-muted)]"})]}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:l(o.descriptionKey)})]}),n(Be,{checked:s,onChange:i=>i6(o.id,i)})]},o.id)})})]},r.id))]})}function z6(){const e=To.value.filter(u=>!u.disabled&&u.eligible),t=Zt.value,a=t!==null,r=new Set(t??[]),o=ao.value.toLowerCase().trim(),s=o?e.filter(u=>u.name.toLowerCase().includes(o)||u.description.toLowerCase().includes(o)||u.skillKey.toLowerCase().includes(o)):e,i=a?t.length:e.length;function c(u){return a?r.has(u):!0}return Rc.value&&To.value.length===0?n("div",{class:"flex justify-center py-12",children:n(te,{size:"lg"})}):n("div",{class:"space-y-4",children:[n(G,{children:n("div",{class:"p-4",children:[n("div",{class:"flex items-center justify-between gap-4",children:[n("div",{children:[n("h3",{class:"text-base font-semibold",children:l("agents.skills.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:a?l("agents.skills.usingAllowlist",{allowed:i,total:e.length}):l("agents.skills.usingAll",{count:e.length})})]}),n("div",{class:"flex items-center gap-2",children:[Lr.value&&n(np,{onClick:m6,saving:bh.value}),n(q,{icon:n(Qe,{class:Rc.value?"animate-spin":""}),label:l("actions.refresh"),onClick:()=>{tp(),tn()},variant:"ghost"})]})]}),n("div",{class:"mt-4 flex flex-wrap gap-2",children:[n("button",{type:"button",onClick:h6,disabled:!a,class:`px-3 py-1.5 text-sm rounded-lg border transition-colors ${a?"border-[var(--color-border)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]":"bg-[var(--color-accent)]/10 border-[var(--color-accent)] text-[var(--color-accent)]"}`,children:l("agents.skills.useAll")}),n("button",{type:"button",onClick:p6,class:"px-3 py-1.5 text-sm rounded-lg border border-[var(--color-border)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]",children:l("agents.skills.selectAll")}),n("button",{type:"button",onClick:f6,class:"px-3 py-1.5 text-sm rounded-lg border border-[var(--color-border)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]",children:l("agents.skills.selectNone")})]}),n("div",{class:"mt-4 relative",children:[n(ct,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Y,{id:"skills-search",type:"text",value:ao.value,onInput:u=>ao.value=u.target.value,placeholder:l("common.searchSkills"),class:"pl-9",fullWidth:!0,"aria-label":l("common.searchSkills")})]})]})}),s.length===0?n(G,{children:n("div",{class:"p-8 text-center text-[var(--color-text-muted)]",children:l(o?"agents.skills.noSearchResults":"agents.skills.noSkills")})}):n(G,{padding:"none",children:s.map(u=>{const d=c(u.name);return n("div",{class:"flex items-center gap-3 px-4 py-3 border-b border-[var(--color-border)] last:border-b-0 hover:bg-[var(--color-bg-tertiary)]",children:[n("span",{class:"text-xl w-8 text-center flex-shrink-0",children:u.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:u.name}),u.always&&n("span",{class:"text-xs text-[var(--color-text-muted)]",title:l("common.alwaysActive"),children:"⚡"})]}),n("p",{class:"text-xs text-[var(--color-text-muted)] truncate",children:u.description})]}),n("a",{href:`/skills?skill=${encodeURIComponent(u.skillKey)}`,onClick:h=>{h.preventDefault(),Oe(`/skills?skill=${encodeURIComponent(u.skillKey)}`)},class:"text-xs text-[var(--color-accent)] hover:underline flex-shrink-0",children:l("agents.skills.details")}),n(Be,{checked:d,onChange:()=>d6(u.name)})]},u.skillKey)})}),n(qn,{children:[n("strong",{children:l("agents.skills.useAll")})," ",l("agents.skills.useAllHint"),n("br",{}),n("strong",{children:l("agents.skills.selectSpecific")})," ",l("agents.skills.selectSpecificHint"),n("br",{}),l("agents.skills.globalHint")," ",n("a",{href:"/skills",class:"text-[var(--color-accent)] hover:underline",children:l("common.skills")})," ",l("agents.skills.page"),"."]})]})}function U6(){return n(We,{open:Ts.value,onClose:()=>Ts.value=!1,title:l("common.createAgent"),children:n("div",{class:"space-y-4",children:[n("div",{children:[n("label",{htmlFor:"create-name",class:"text-sm font-medium",children:l("common.name")}),n(Y,{id:"create-name",type:"text",value:Es.value,onInput:e=>Es.value=e.target.value,placeholder:l("agents.create.namePlaceholder"),class:"mt-1",fullWidth:!0}),n("p",{class:"mt-1 text-xs text-[var(--color-text-muted)]",children:l("agents.create.nameHint")})]}),n("div",{children:[n("label",{htmlFor:"create-workspace",class:"text-sm font-medium",children:l("common.workspace")}),n(Y,{id:"create-workspace",type:"text",value:As.value,onInput:e=>As.value=e.target.value,placeholder:l("agents.create.workspacePlaceholder"),class:"mt-1 font-mono text-sm",fullWidth:!0})]}),n("div",{children:[n("label",{htmlFor:"create-emoji",class:"text-sm font-medium",children:l("agents.create.emoji")}),n(Y,{id:"create-emoji",type:"text",value:il.value,onInput:e=>il.value=e.target.value,placeholder:l("agents.create.emojiPlaceholder"),class:"mt-1",fullWidth:!0})]}),n("div",{class:"flex justify-end gap-2 pt-2",children:[n(P,{variant:"ghost",onClick:()=>Ts.value=!1,disabled:Ms.value,children:l("actions.cancel")}),n(P,{variant:"primary",onClick:x6,disabled:Ms.value||!Es.value.trim()||!As.value.trim(),children:Ms.value?l("actions.creating"):l("common.createAgent")})]})]})})}function j6(){const e=Fo.value;return n(We,{open:Is.value,onClose:()=>Is.value=!1,title:l("common.deleteAgent"),children:n("div",{class:"space-y-4",children:[n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 border border-[var(--color-error)]/20",children:n("div",{class:"flex items-start gap-3",children:[n(Aa,{class:"w-6 h-6 text-[var(--color-error)] flex-shrink-0 mt-0.5"}),n("div",{children:[n("h4",{class:"font-semibold text-[var(--color-error)]",children:l("agents.delete.warning")}),n("p",{class:"mt-1 text-sm text-[var(--color-text-secondary)]",children:l("agents.delete.warningDescription")})]})]})}),n("div",{class:"text-sm",children:[n("p",{class:"font-medium mb-2",children:l("agents.delete.willDelete")}),n("ul",{class:"list-disc list-inside space-y-1 text-[var(--color-text-secondary)]",children:[n("li",{children:l("agents.delete.willDeleteConfig")}),n("li",{children:l("agents.delete.willDeleteBindings")}),n("li",{children:l("agents.delete.willDeleteSessions")})]})]}),n("div",{class:"p-3 rounded-lg border border-[var(--color-border)]",children:n(nx,{checked:Ic.value,onChange:t=>Ic.value=t,label:l("agents.delete.includeFiles"),description:l("agents.delete.includeFilesDescription",{path:Mn.value}),class:"text-[var(--color-error)]"})}),n("div",{children:[n("label",{htmlFor:"delete-confirm",class:"text-sm font-medium",children:l("agents.delete.confirmPrompt",{id:e?.id||"agent"})}),n(Y,{id:"delete-confirm",type:"text",value:Rs.value,onInput:t=>Rs.value=t.target.value,placeholder:e?.id||"agent",class:"mt-1 font-mono",fullWidth:!0})]}),n("div",{class:"flex justify-end gap-2 pt-2",children:[n(P,{variant:"ghost",onClick:()=>Is.value=!1,disabled:Ls.value,children:l("actions.cancel")}),n(P,{variant:"danger",onClick:y6,disabled:Ls.value||Rs.value!==e?.id,children:Ls.value?l("actions.deleting"):l("common.deleteAgent")})]})]})})}const H6=[{id:"overview",label:"common.overview",icon:n(Ub,{class:"w-4 h-4"})},{id:"files",label:"common.files",icon:n(an,{class:"w-4 h-4"})},{id:"tools",label:"common.tools",icon:n(Hb,{class:"w-4 h-4"})},{id:"skills",label:"common.skills",icon:n(tu,{class:"w-4 h-4"})}];function B6(e){const t=!Wr.value&&Cr.value.length>0,[a,r]=he("agent"),[o,s]=he("tab"),[i,c]=he("q");He(a,Me,d=>d),He(o,Sn,d=>d),He(i,ao,d=>d),Rn(Me,r,"main"),Rn(Sn,s,"overview"),R(()=>{Sn.value==="skills"?c(ao.value||null):i.value&&c(null)},[ao.value,Sn.value]),R(()=>{if(t&&a.value){const d=Cr.value.find(h=>h.id===a.value);d&&Me.value!==d.id&&Iy(d.id)}},[a.value,t]),R(()=>{D.value&&Pl().then(()=>{zo(),tn()})},[D.value]);const u=Sn.value;return n(sn,{viewName:l("common.agents"),children:[n(Ht,{title:l("common.agents"),subtitle:l("agents.description"),actions:n("div",{class:"flex items-center gap-3",children:[n(T6,{}),n(q,{icon:n(Sa,{class:"w-4 h-4"}),label:l("common.createAgent"),onClick:b6,disabled:!D.value,variant:"ghost"}),n(q,{icon:n(Qe,{class:`w-4 h-4 ${Wr.value?"animate-spin":""}`}),label:l("actions.refresh"),onClick:w6,disabled:Wr.value||!D.value,variant:"ghost"})]})}),n(Yf,{items:H6.map(d=>({...d,label:l(d.label)})),activeId:u,onChange:d=>k6(d)}),Ac.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Ac.value}),Wr.value&&pu.value.length===0?n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg"})}):n(H,{children:[u==="overview"&&n(E6,{}),u==="files"&&n(O6,{}),u==="tools"&&n(F6,{}),u==="skills"&&n(z6,{})]}),Mn.value&&n("p",{class:"text-xs text-[var(--color-text-muted)] text-center",children:Mn.value}),n(U6,{}),n(j6,{})]})}const Ct=m(null),Dy=m("main"),vu=m(""),Tt=m(""),Un=m("view"),yh=m(!1),$s=m(!1),$c=m(null),us=K(()=>Tt.value!==vu.value),W6=K(()=>{const e=Ct.value?.name??"",t=Lc(e);return Ly[t]??{icon:"📄",description:"agents.files.meta.unknown"}});function K6(){return new URLSearchParams(window.location.search).get("agent")||"main"}async function q6(e,t){yh.value=!0,$c.value=null,Dy.value=t;try{const a=await N("agents.files.get",{agentId:t,name:e});Ct.value=a.file;const r=a.file.content??"";vu.value=r,Tt.value=r,Un.value=a.file.missing||!r?"edit":"view"}catch(a){$c.value=a instanceof Error?a.message:l("agents.files.loadFileError"),V.error(l("agents.files.loadFileError"))}finally{yh.value=!1}}async function Vv(){if(Ct.value){$s.value=!0;try{await N("agents.files.set",{agentId:Dy.value,name:Ct.value.name,content:Tt.value}),vu.value=Tt.value,Ct.value={...Ct.value,missing:!1,content:Tt.value,size:new Blob([Tt.value]).size,updatedAtMs:Date.now()},V.success(l("agents.files.saved"))}catch{V.error(l("agents.files.saveError"))}finally{$s.value=!1}}}function V6(){us.value&&!window.confirm(l("agents.files.unsavedWarning"))||(Ct.value=null,vu.value="",Tt.value="",Un.value="view",Oe("/agents"))}function Gv({active:e,onClick:t,icon:a,label:r,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:[a,r,o&&n("span",{class:"w-1.5 h-1.5 rounded-full bg-[var(--color-warning)]"})]})}function G6({filename:e}){const t=e?decodeURIComponent(e):"";return R(()=>{if(D.value&&t){const a=K6();q6(t,a)}},[D.value,t]),R(()=>{function a(r){(r.metaKey||r.ctrlKey)&&r.key==="s"&&(r.preventDefault(),Un.value==="edit"&&us.value&&!$s.value&&Vv())}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[]),n(lu,{viewName:t||l("common.agents"),children:n("div",{class:"flex-1 flex flex-col overflow-hidden",children:[n("div",{class:"flex items-center justify-between gap-4 px-4 sm:px-6 py-3 border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[n("div",{class:"flex items-center gap-3 min-w-0",children:[n(q,{icon:n(Jc,{class:"w-4 h-4"}),label:l("agents.files.backToList"),onClick:V6,variant:"ghost"}),n("div",{class:"flex items-center gap-2 min-w-0",children:[n("span",{class:"text-xl","aria-hidden":"true",children:W6.value.icon}),n("h1",{class:"font-semibold truncate",children:e}),us.value&&n(Z,{variant:"warning",size:"sm",children:l("agents.files.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&&Ws(Ct.value.size),Tt.value&&n(H,{children:[" • ",ec(Ry(Tt.value))," tokens"]}),Ct.value.updatedAtMs&&n(H,{children:[" • ",Qi(Ct.value.updatedAtMs)]})]}),Un.value==="edit"&&n(P,{variant:"primary",size:"sm",icon:n(vf,{class:"w-4 h-4"}),onClick:Vv,disabled:!us.value||$s.value,children:$s.value?l("common.saving"):l("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(Gv,{active:Un.value==="view",onClick:()=>Un.value="view",icon:n(ff,{class:"w-4 h-4"}),label:l("agents.files.view")}),n(Gv,{active:Un.value==="edit",onClick:()=>Un.value="edit",icon:n(fo,{class:"w-4 h-4"}),label:l("common.edit"),indicator:us.value})]}),n("div",{class:"flex-1 overflow-y-auto",children:[$c.value&&n("div",{class:"m-4 p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:$c.value}),yh.value?n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg"})}):Un.value==="view"?n("div",{class:"p-4 sm:p-6 max-w-4xl mx-auto",children:Tt.value?n(Ll,{content:Tt.value}):n("p",{class:"text-[var(--color-text-muted)] italic",children:l("agents.files.emptyFile")})}):n("div",{class:"p-4 sm:p-6 h-full",children:n(tr,{value:Tt.value,onInput:a=>Tt.value=a.target.value,placeholder:l("agents.files.editPlaceholder"),class:"font-mono text-sm h-full min-h-[400px] resize-none",fullWidth:!0})})]})]})})}function J6(e){const t=Math.floor(e/1e3),a=Math.floor(t/60),r=Math.floor(a/60),o=Math.floor(r/24);if(o>0){const s=r%24;return`${o}d ${s}h`}if(r>0){const s=a%60;return`${r}h ${s}m`}return a>0?`${a}m`:`${t}s`}function lt(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 cl(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 Y6({healthData:e}){const t=Wh.value;return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-accent)]/10",children:n(pr,{class:"w-5 h-5 text-[var(--color-accent)]"})}),n("div",{children:[n("h3",{class:"font-semibold",children:l("common.gateway")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:Mo.value||l("usage.gateway.unknown")})]}),zt.value&&n(Z,{variant:"default",size:"sm",class:"ml-auto",children:eb(zt.value)})]}),n("div",{class:"grid grid-cols-2 gap-4",children:[n("div",{class:"flex items-center gap-2",children:[n(ve,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:l("common.uptime")}),n("div",{class:"font-medium",children:t!=null?J6(t):"-"})]})]}),n("div",{class:"flex items-center gap-2",children:[n(pa,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:l("common.sessions")}),n("div",{class:"font-medium",children:e?.sessions?.count??"-"})]})]})]}),(vs.value||gs.value)&&n("div",{class:"mt-4 pt-4 border-t border-[var(--color-border)] space-y-2",children:[vs.value&&n("div",{class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)]",children:[n(an,{class:"w-3.5 h-3.5"}),n("span",{class:"truncate font-mono",children:vs.value})]}),gs.value&&n("div",{class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)]",children:[n(A4,{class:"w-3.5 h-3.5"}),n("span",{class:"truncate font-mono",children:gs.value})]})]})]})}function Z6({usage:e,isLoading:t}){if(!e)return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-success)]/10",children:n(Pd,{class:"w-5 h-5 text-[var(--color-success)]"})}),n("h3",{class:"font-semibold",children:l("usage.summary.title")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l(t?"common.loading":"usage.summary.unavailable")})]});const a=e.totals;return n(G,{padding:"md",children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-3",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-success)]/10",children:n(Pd,{class:"w-5 h-5 text-[var(--color-success)]"})}),n("div",{children:[n("h3",{class:"font-semibold",children:l("usage.summary.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("usage.summary.period",{days:e.days})})]})]}),a.totalCost>0&&n("div",{class:"text-right",children:[n("div",{class:"text-2xl font-bold text-[var(--color-success)]",children:cl(a.totalCost)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("common.totalCost")})]})]}),n("div",{class:"grid grid-cols-3 gap-4",children:[n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:l("common.input")}),n("div",{class:"font-medium",children:lt(a.input)})]}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:l("common.output")}),n("div",{class:"font-medium",children:lt(a.output)})]}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:l("common.total")}),n("div",{class:"font-medium",children:lt(a.totalTokens)})]})]}),(a.cacheRead>0||a.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:l("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:l("usage.summary.cacheRead")}),n("div",{class:"font-medium",children:lt(a.cacheRead)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("usage.summary.cacheWrite")}),n("div",{class:"font-medium",children:lt(a.cacheWrite)})]})]})]})]})}function X6({usage:e}){if(!e||e.daily.length===0)return null;const t=e.daily.slice(-14),a=Math.max(...t.map(r=>r.totalTokens),1);return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(Ro,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:l("usage.daily.title")})]}),n("div",{class:"space-y-2",children:t.map(r=>{const o=r.totalTokens/a*100,i=new Date(r.date).toLocaleDateString(void 0,{month:"short",day:"numeric"});return n("div",{class:"flex items-center gap-3",children:[n("div",{class:"w-20 text-xs text-[var(--color-text-muted)] truncate",children:i}),n("div",{class:"flex-1 h-4 bg-[var(--color-bg-tertiary)] rounded-full overflow-hidden",children:n("div",{class:"h-full bg-[var(--color-accent)] rounded-full transition-all",style:{width:`${Math.max(o,1)}%`}})}),n("div",{class:"w-16 text-xs text-right font-mono",children:lt(r.totalTokens)})]},r.date)})})]})}function Q6({healthData:e}){return!e?.agents||e.agents.length===0?null:n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-warning)]/10",children:n(ic,{class:"w-5 h-5 text-[var(--color-warning)]"})}),n("h3",{class:"font-semibold",children:l("common.agents")})]}),n("div",{class:"space-y-3",children:e.agents.map(t=>n("div",{class:"flex items-center justify-between py-2 px-3 bg-[var(--color-bg-secondary)] rounded-lg",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:"font-medium",children:t.name||t.agentId}),t.isDefault&&n(Z,{variant:"success",size:"sm",children:l("common.default")})]}),n("div",{class:"flex items-center gap-4 text-sm text-[var(--color-text-muted)]",children:[n("span",{children:[t.sessions.count," ",l("usage.agents.sessions")]}),t.heartbeat.enabled&&n("span",{class:"flex items-center gap-1",children:[n(Pn,{class:"w-3.5 h-3.5"}),t.heartbeat.every]})]})]},t.agentId))})]})}const Ki=m(null),qi=m(null),lr=m(R1()),ua=m(null),Ds=m(!1),Dc=m(!1),Vi=m(!1),Pc=m(null),Py=[7,14,30,90],sa=m(30),Kr=m("recent"),ts=m(!0),Lt=m(0),Qn=5,wh=m("overview"),ul=m(null),dl=m([]),Ps=m(!1),Os=m(!1);async function eM(){Ds.value=!0,Pc.value=null;try{const e=await N("health",{probe:!1});Ki.value=e}catch(e){Pc.value=ae(e),V.error(l("usage.loadError"))}finally{Ds.value=!1}}async function Oy(e=30){Dc.value=!0,sa.value=e;try{const t=await N("usage.cost",{days:e});qi.value=t}catch(t){M.usage.warn("Failed to load usage cost summary",{days:e,err:t})}finally{Dc.value=!1}tM(e)}async function tM(e=30){if(!Vi.value){Vi.value=!0;try{const t=new Date,a=new Date;a.setDate(a.getDate()-e);const r=await N("sessions.usage",{startDate:a.toISOString().split("T")[0],endDate:t.toISOString().split("T")[0],limit:100,includeContextWeight:!0});lr.value=r,r&&L1(r)}catch(t){M.usage.warn("Failed to load sessions usage",{days:e,err:t}),lr.value||(lr.value=null)}finally{Vi.value=!1}}}async function Ny(){await Promise.all([eM(),Oy(sa.value)])}async function nM(e){if(!Ps.value){Ps.value=!0,ul.value=null;try{const t=await N("sessions.usage.timeseries",{key:e});ul.value=t}catch(t){M.usage.warn("Failed to load session usage timeseries",{key:e,err:t})}finally{Ps.value=!1}}}async function aM(e){if(!Os.value){Os.value=!0,dl.value=[];try{const t=await N("sessions.usage.logs",{key:e,limit:100});dl.value=t?.logs??[]}catch(t){M.usage.warn("Failed to load session usage logs",{key:e,err:t})}finally{Os.value=!1}}}function rM(){ua.value=null,wh.value="overview",ul.value=null,dl.value=[]}function oM(){const e=lr.value!==null&&lr.value.sessions.length>0,[t,a,r]=he("session",{ready:e}),[o,s]=he("days"),[i,c]=he("sort");R(()=>{if(!o.value)return;const u=parseInt(o.value,10);Py.includes(u)&&sa.value!==u&&(sa.value=u)},[o.value]),He(i,Kr,u=>u),R(()=>{s(sa.value===30?null:String(sa.value))},[sa.value]),Rn(Kr,c,"recent"),R(()=>{if(!e||!t.value)return;const u=lr.value?.sessions.find(d=>d.key===t.value);u&&ua.value?.key!==u.key&&(ua.value=u)},[t.value,e]),R(()=>{r.value&&a(ua.value?.key??null)},[ua.value,r.value])}function sM(){R(()=>{D.value&&Ny()},[D.value])}function lM(){const e=lr.value,t=ua.value,a=Vi.value;if(!e&&a)return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(ca,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:l("common.sessions")}),n(te,{size:"sm"})]}),n("div",{class:"space-y-3",children:[1,2,3].map(d=>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"})]})]},d))})]});if(!e||e.sessions.length===0)return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(ca,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:l("common.sessions")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("usage.sessions.noData")})]});const r=[...e.sessions].sort((d,h)=>{const f=Kr.value,p=ts.value;let v=0;return f==="cost"?v=(d.usage.totalCost||0)-(h.usage.totalCost||0):f==="tokens"?v=(d.usage.totalTokens||0)-(h.usage.totalTokens||0):f==="recent"&&(v=(d.updatedAt||0)-(h.updatedAt||0)),p?-v:v}),o=r.slice(Lt.value*Qn,(Lt.value+1)*Qn),s=d=>{Kr.value===d?ts.value=!ts.value:(Kr.value=d,ts.value=!0),Lt.value=0},i=({col:d})=>Kr.value!==d?null:ts.value?n(Ne,{class:"w-3 h-3 inline ml-1"}):n(Tl,{class:"w-3 h-3 inline ml-1"}),c=d=>{ua.value=t?.key===d.key?null:d},u=()=>r.length>Qn?n("div",{class:"mt-4 flex items-center justify-between",children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:l("usage.sessions.showing",{from:Lt.value*Qn+1,to:Math.min((Lt.value+1)*Qn,r.length),total:r.length})}),n("div",{class:"flex items-center gap-1",children:[n(q,{icon:n(Tb,{class:"w-4 h-4"}),label:l("actions.previous"),onClick:()=>{Lt.value=Math.max(0,Lt.value-1)},disabled:Lt.value===0,variant:"ghost",size:"sm"}),n("span",{class:"px-2 text-sm text-[var(--color-text-muted)]",children:[Lt.value+1," / ",Math.ceil(r.length/Qn)]}),n(q,{icon:n(Ve,{class:"w-4 h-4"}),label:l("actions.next"),onClick:()=>{Lt.value=Math.min(Math.ceil(r.length/Qn)-1,Lt.value+1)},disabled:Lt.value>=Math.ceil(r.length/Qn)-1,variant:"ghost",size:"sm"})]})]}):null;return n(H,{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(ca,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:l("common.sessions")}),a&&n(te,{size:"sm"})]}),o.map(d=>n(No,{icon:$n,iconVariant:t?.key===d.key?"info":"default",title:d.label||d.key,subtitle:d.model||void 0,meta:[{icon:Pn,value:lt(d.usage.totalTokens)},{icon:Pd,value:cl(d.usage.totalCost)},...d.updatedAt?[{icon:ve,value:ne(new Date(d.updatedAt),{relative:!0})}]:[]],onClick:()=>c(d)},d.key)),n(u,{})]}),n(G,{padding:"md",class:"hidden md:block",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(ca,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:l("common.sessions")}),a&&n(te,{size:"sm"})]}),n("div",{class:"overflow-x-auto",children:n("table",{class:"w-full text-sm",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)]",children:[n("th",{class:"text-left py-2 px-2 font-medium text-[var(--color-text-muted)]",children:l("common.session")}),n("th",{class:"text-left py-2 px-2 font-medium text-[var(--color-text-muted)]",children:l("common.model")}),n("th",{class:"text-right py-2 px-2 font-medium",children:n("button",{type:"button",class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] cursor-pointer",onClick:()=>s("tokens"),children:[l("common.tokens"),n(i,{col:"tokens"})]})}),n("th",{class:"text-right py-2 px-2 font-medium",children:n("button",{type:"button",class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] cursor-pointer",onClick:()=>s("cost"),children:[l("usage.sessions.cost"),n(i,{col:"cost"})]})}),n("th",{class:"text-right py-2 px-2 font-medium",children:n("button",{type:"button",class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] cursor-pointer",onClick:()=>s("recent"),children:[l("common.lastActive"),n(i,{col:"recent"})]})})]})}),n("tbody",{children:o.map(d=>{const h=t?.key===d.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(d),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),c(d))},tabIndex:0,"aria-label":l("usage.sessions.viewDetails",{name:d.label||d.key}),children:[n("td",{class:"py-2 px-2 truncate max-w-[200px]",title:d.key,children:d.label||d.key}),n("td",{class:"py-2 px-2 text-[var(--color-text-muted)] truncate max-w-[120px]",title:d.model||void 0,children:d.model||"-"}),n("td",{class:"py-2 px-2 text-right font-mono",children:lt(d.usage.totalTokens)}),n("td",{class:"py-2 px-2 text-right font-mono",children:cl(d.usage.totalCost)}),n("td",{class:"py-2 px-2 text-right text-[var(--color-text-muted)]",children:d.updatedAt?ne(new Date(d.updatedAt),{relative:!0}):"-"})]},d.key)})})]})}),n(u,{})]})]})}function iM(){const e=ua.value,t=wh.value;R(()=>{e&&(t==="timeline"&&!ul.value&&!Ps.value?nM(e.key):t==="messages"&&dl.value.length===0&&!Os.value&&aM(e.key))},[e,t]);const a=[{id:"overview",label:l("common.overview")},{id:"timeline",label:l("usage.detail.tabs.timeline")},{id:"messages",label:l("usage.detail.tabs.messages")}],r=o=>{(o==="overview"||o==="timeline"||o==="messages")&&(wh.value=o)};return n(We,{open:!!e,onClose:rM,title:l("common.sessionDetails"),children:e&&n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)] truncate -mt-2",children:e.label||e.key}),n(Yf,{items:a,activeId:t,onChange:r}),n("div",{role:"tabpanel",children:[t==="overview"&&n(cM,{session:e}),t==="timeline"&&n(uM,{}),t==="messages"&&n(dM,{})]})]})})}function cM({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:l("common.input")}),n("div",{class:"font-medium",children:lt(e.usage.input)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("common.output")}),n("div",{class:"font-medium",children:lt(e.usage.output)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("usage.summary.cacheRead")}),n("div",{class:"font-medium",children:lt(e.usage.cacheRead)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("common.totalCost")}),n("div",{class:"font-medium text-[var(--color-success)]",children:cl(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:l("usage.detail.contextWeight")}),n("div",{class:"space-y-2",children:[t.systemPrompt!=null&&t.systemPrompt>0&&n(ns,{label:l("usage.detail.system"),value:t.systemPrompt,total:t.total,color:"var(--color-accent)"}),t.skills!=null&&t.skills>0&&n(ns,{label:l("common.skills"),value:t.skills,total:t.total,color:"var(--color-success)"}),t.tools!=null&&t.tools>0&&n(ns,{label:l("common.tools"),value:t.tools,total:t.total,color:"var(--color-warning)"}),t.files!=null&&t.files>0&&n(ns,{label:l("common.files"),value:t.files,total:t.total,color:"var(--color-info)"}),t.other!=null&&t.other>0&&n(ns,{label:l("usage.detail.other"),value:t.other,total:t.total,color:"var(--color-text-muted)"})]})]})]})}function uM(){const e=ul.value;if(Ps.value)return n("div",{class:"flex justify-center py-8",children:n(te,{size:"md"})});if(!e||e.points.length===0)return n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center",children:l("usage.detail.noTimeline")});const a=e.points,r=Math.max(...a.map(w=>w.cumulativeTokens)),o=Math.max(...a.map(w=>w.cumulativeCost)),s=400,i=120,c={top:10,right:10,bottom:20,left:40},u=s-c.left-c.right,d=i-c.top-c.bottom,h=w=>c.left+w/(a.length-1)*u,f=w=>c.top+d-w/(r||1)*d,p=a.map((w,C)=>`${C===0?"M":"L"} ${h(C)} ${f(w.cumulativeTokens)}`).join(" "),v=`${p} L ${h(a.length-1)} ${c.top+d} L ${c.left} ${c.top+d} 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:l("usage.detail.cumulativeTokens")}),n("span",{children:[lt(r)," max"]})]}),n("svg",{viewBox:`0 0 ${s} ${i}`,class:"w-full h-auto",children:[[0,.25,.5,.75,1].map(w=>n("line",{x1:c.left,y1:c.top+d*(1-w),x2:s-c.right,y2:c.top+d*(1-w),stroke:"var(--color-border)","stroke-dasharray":"2,2"},w)),n("path",{d:v,fill:"var(--color-accent)",opacity:"0.2"}),n("path",{d:p,fill:"none",stroke:"var(--color-accent)","stroke-width":"2"}),n("text",{x:c.left,y:i-2,"font-size":"10",fill:"var(--color-text-muted)","text-anchor":"start",children:ne(new Date(a[0].timestamp),{relative:!1})}),n("text",{x:s-c.right,y:i-2,"font-size":"10",fill:"var(--color-text-muted)","text-anchor":"end",children:ne(new Date(a[a.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:a.length}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("usage.detail.requests")})]}),n("div",{class:"text-center",children:[n("div",{class:"text-lg font-semibold",children:lt(r)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("usage.detail.totalTokens")})]}),n("div",{class:"text-center",children:[n("div",{class:"text-lg font-semibold text-[var(--color-success)]",children:cl(o)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("common.totalCost")})]})]})]})}function dM(){const e=dl.value;if(Os.value)return n("div",{class:"flex justify-center py-8",children:n(te,{size:"md"})});if(e.length===0)return n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center",children:l("usage.detail.noMessages")});const a={user:"info",assistant:"success",tool:"warning",toolResult:"default"},r={user:l("usage.detail.role.user"),assistant:l("common.assistant"),tool:l("usage.detail.role.tool"),toolResult:l("common.result")};return n("div",{class:"space-y-2 max-h-[300px] overflow-y-auto",children:e.map((o,s)=>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(Z,{variant:a[o.role],children:r[o.role]}),o.tokens!=null&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:l("usage.detail.tokenCount",{count:lt(o.tokens)})})]}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:ne(new Date(o.timestamp),{relative:!0})})]}),n("p",{class:"text-sm text-[var(--color-text-secondary)] line-clamp-2",children:o.content})]},s))})}function ns({label:e,value:t,total:a,color:r}){const o=Math.round(t/a*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:r}})}),n("div",{class:"w-16 text-xs text-right",children:[lt(t)," (",o,"%)"]})]})}function hM(e){return oM(),sM(),n(sn,{viewName:l("common.usage"),children:[n(Ht,{title:l("common.usage"),subtitle:l("usage.description"),actions:n(q,{icon:n(Qe,{class:`w-4 h-4 ${Ds.value?"animate-spin":""}`}),label:l("actions.refresh"),onClick:()=>{Ny()},disabled:Ds.value||!D.value,variant:"ghost"})}),Pc.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Pc.value}),Ds.value&&!Ki.value||!D.value?n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:D.value?void 0:l("status.connecting")})}):n("div",{class:"grid gap-6 md:grid-cols-2",children:[n(Y6,{healthData:Ki.value}),n(Z6,{usage:qi.value,isLoading:Dc.value}),n("div",{class:"md:col-span-2",children:n(X6,{usage:qi.value})}),n("div",{class:"md:col-span-2 min-w-0",children:n(lM,{})}),n("div",{class:"md:col-span-2",children:n(Q6,{healthData:Ki.value})})]}),qi.value&&n("div",{class:"flex justify-center gap-2",children:Py.map(t=>n(P,{variant:sa.value===t?"primary":"ghost",size:"sm",onClick:()=>{Oy(t)},disabled:Dc.value,children:[t,"d"]},t))}),n(iM,{})]})}const fM="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",pM=[{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"}],mM="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",vM="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",gM=[{cx:7.5,cy:12,r:1.5},{cx:12,cy:12,r:1.5},{cx:16.5,cy:12,r:1.5}],bM={telegram:{path:ju.path,hex:ju.hex,title:ju.title},discord:{path:Ei.path,hex:Ei.hex,title:Ei.title},signal:{path:Uu.path,hex:Uu.hex,title:Uu.title},whatsapp:{path:Hu.path,hex:Hu.hex,title:Hu.title},googlechat:{path:Nu.path,hex:Nu.hex,title:Nu.title},matrix:{path:zu.path,hex:zu.hex,title:zu.title},mastodon:{path:Fu.path,hex:Fu.hex,title:Fu.title},imessage:{path:fM,hex:"34C759",title:"iMessage"},nostr:{path:mM,hex:"8B5CF6",title:"Nostr"}};function xM({channelId:e,size:t=20,class:a,colored:r=!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:a,"aria-label":"Slack",children:[n("title",{children:"Slack"}),pM.map((c,u)=>n("path",{fill:r?c.color:"currentColor",d:c.path},u))]});if(o==="bluebubbles"){const c=r?"#2196F3":"currentColor";return n("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,class:a,"aria-label":"BlueBubbles",children:[n("title",{children:"BlueBubbles"}),n("path",{fill:"none",stroke:c,"stroke-width":"2",d:vM}),gM.map((u,d)=>n("circle",{cx:u.cx,cy:u.cy,r:u.r,fill:c},d))]})}if(o==="webchat")return n(rn,{class:a,style:{width:t,height:t,color:r?"#6366f1":"currentColor"}});const s=bM[o];if(!s)return n(rn,{class:a,style:{width:t,height:t}});const i=r?`#${s.hex}`:"currentColor";return n("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,class:a,"aria-label":s.title,children:[n("title",{children:s.title}),n("path",{fill:i,d:s.path})]})}function yM(e){return e.length===0?"not-configured":e.some(s=>s.lastError)?"error":e.some(s=>s.connected)?"connected":e.some(s=>s.enabled!==!1)?e.some(s=>s.configured)?"configured":"not-configured":"disabled"}function wM(e){return e.channelOrder.map(t=>{const a=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:a,defaultAccountId:e.channelDefaultAccountId[t]||"default",status:yM(a)}})}function Fy(e){return e.accounts.reduce((t,a)=>{const r=a.lastInboundAt??0,o=a.lastOutboundAt??0;return Math.max(t,r,o)},0)}const Wa=m([]),yn=m(!1),Ns=m(!1),Fs=m(null),_n=m(null),Oc=m(!1);function kM(e){switch(e){case"connected":return{variant:"success",label:l("channels.status.connected")};case"configured":return{variant:"warning",label:l("common.configured")};case"not-configured":return{variant:"default",label:l("channels.status.notConfigured")};case"disabled":return{variant:"default",label:l("common.disabled")};case"error":return{variant:"error",label:l("common.error")}}}async function Gi(e=!1){e?Ns.value=!0:yn.value=!0,Fs.value=null;try{const t=await N("channels.status",{probe:e,timeoutMs:e?15e3:1e4});Wa.value=wM(t)}catch(t){Fs.value=ae(t)}finally{yn.value=!1,Ns.value=!1}}async function SM(){if(_n.value){Oc.value=!0;try{await N("common.logout",{channel:_n.value.channel,accountId:_n.value.accountId}),V.success(l("channels.logoutSuccess",{channel:_n.value.label})),_n.value=null,Gi()}catch(e){V.error(ae(e))}finally{Oc.value=!1}}}const _M=K(()=>{const e=Wa.value,t=Date.now()-1440*60*1e3;return{total:e.length,active:e.filter(a=>Fy(a)>t).length,errors:e.filter(a=>a.status==="error").length}});function CM({account:e,channelId:t,channelLabel:a}){const r=e.connected===!0,o=!!e.lastError,s=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)]":r?"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}),s&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["@",s.replace(/^@/,"")]})]}),o&&n("div",{class:"text-xs text-[var(--color-error)] truncate",children:e.lastError})]})]}),n(q,{icon:n(D4,{class:"w-3.5 h-3.5"}),label:l("common.logout"),onClick:()=>{_n.value={channel:t,accountId:e.accountId,label:`${a} (${e.name||e.accountId})`}},variant:"ghost",size:"sm"})]})}function TM({channel:e}){const t=kM(e.status),a=Fy(e);return n(G,{padding:"md",children:[n("div",{class:"flex items-start gap-3 mb-4",children:[n(xM,{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(Z,{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:[a>0&&n("span",{class:"flex items-center gap-1",children:[n(ve,{class:"w-3.5 h-3.5"}),ne(a,{relative:!0})]}),n("button",{type:"button",onClick:()=>Oe(`/config#channels.${e.id}`),class:"flex items-center gap-1 hover:text-[var(--color-accent)] transition-colors",children:[n(bf,{class:"w-3.5 h-3.5"}),l("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:[l("common.docs"),n($o,{class:"w-3 h-3"})]})]})]})]}),e.accounts.length>0&&n("div",{class:"space-y-2",children:e.accounts.map(r=>n(CM,{account:r,channelId:e.id,channelLabel:e.label},r.accountId))})]})}function EM(){return _n.value?n(We,{open:!0,onClose:()=>{_n.value=null},title:l("channels.logoutTitle"),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-[var(--color-text-secondary)]",children:l("channels.logoutConfirm",{channel:_n.value.label})}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("channels.logoutWarning")})]}),n("div",{class:"flex justify-end gap-3 mt-6",children:[n(P,{variant:"ghost",onClick:()=>{_n.value=null},disabled:Oc.value,children:l("actions.cancel")}),n(P,{variant:"danger",onClick:SM,loading:Oc.value,children:l("common.logout")})]})]}):null}function AM(e){R(()=>{D.value&&Gi()},[D.value]);const t=_M.value;return n(sn,{viewName:l("common.channels"),children:[n(Ht,{title:l("common.channels"),subtitle:l("channels.description"),actions:n(H,{children:[n(P,{variant:"secondary",size:"sm",onClick:()=>Gi(!0),disabled:Ns.value||yn.value||!D.value,icon:n(pa,{class:`w-4 h-4 ${Ns.value?"animate-pulse":""}`}),children:Ns.value?l("channels.probing"):l("channels.probe")}),n(q,{icon:n(Qe,{class:`w-4 h-4 ${yn.value?"animate-spin":""}`}),label:l("actions.refresh"),onClick:()=>Gi(),disabled:yn.value||!D.value,variant:"ghost"})]})}),D.value&&!yn.value&&n("div",{class:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-4",children:[n(le,{icon:$n,label:l("common.total"),value:t.total}),n(le,{icon:Pn,label:l("channels.stats.active"),value:t.active}),n(le,{icon:Zc,label:l("channels.stats.errors"),value:t.errors,highlight:t.errors>0})]}),Fs.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Fs.value}),(yn.value||!D.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:D.value?void 0:l("status.connecting")})}),D.value&&!yn.value&&Wa.value.length>0&&n("div",{class:"grid gap-4 sm:grid-cols-2",children:Wa.value.map(a=>n(TM,{channel:a},a.id))}),D.value&&!yn.value&&Wa.value.length===0&&!Fs.value&&n(G,{children:n("div",{class:"p-16 text-center",children:[n($n,{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:l("channels.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l("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:[l("channels.learnMore"),n($o,{class:"w-4 h-4"})]})]})}),D.value&&!yn.value&&Wa.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:l("channels.count",{count:Wa.value.length})}),n(EM,{})]})}const bn=m([]),jn=m(!1),zs=m(null);function zy(e){const t=e.mode?.toLowerCase()??"",a=e.deviceFamily?.toLowerCase()??"";return t==="gateway"?pr:a.includes("iphone")||a.includes("android")?po:a.includes("mac")||a.includes("windows")||a.includes("linux")?Gt:rn}function MM(e){return e===void 0?"—":e<60?l("instances.idleSeconds",{count:e}):e<3600?l("instances.idleMinutes",{count:Math.floor(e/60)}):l("instances.idleHours",{count:Math.floor(e/3600)})}function Uy(e){return e?e==="gateway"?"success":e==="webchat"||e==="chat"?"warning":"default":"default"}async function rd(){jn.value=!0,zs.value=null;try{const e=await N("system-presence",{});bn.value=e??[]}catch(e){zs.value=ae(e)}finally{jn.value=!1}}function IM({roles:e,scopes:t}){const a=[...e??[],...t??[]];return a.length===0?null:n("div",{class:"flex flex-wrap items-center gap-1 mt-1",children:a.map(r=>n(Z,{variant:"default",size:"sm",children:r},r))})}function RM({presence:e}){const t=zy(e),a=e.mode==="gateway";return n(No,{icon:t,iconVariant:a?"success":"default",title:e.host||e.instanceId||"Unknown",subtitle:e.ip,badges:e.mode?n(Z,{variant:Uy(e.mode),size:"sm",children:e.mode}):null,meta:[{icon:ve,value:ne(e.ts,{relative:!0})},...e.platform?[{value:e.platform}]:[]]})}function LM({presence:e}){const t=zy(e),a=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 ${a?"bg-[var(--color-success)]/10":"bg-[var(--color-bg-tertiary)]"}`,children:n(t,{class:`w-4 h-4 ${a?"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(IM,{roles:e.roles,scopes:e.scopes})]})]})}),n("td",{class:"py-3 px-4",children:e.mode?n(Z,{variant:Uy(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(ve,{class:"w-3.5 h-3.5"}),n("span",{children:ne(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:MM(e.lastInputSeconds)})]})}function $M(e){R(()=>{D.value&&rd()},[D.value]);const t=bn.value.filter(r=>r.mode==="gateway").length,a=bn.value.filter(r=>r.mode!=="gateway").length;return n(sn,{viewName:l("common.instances"),children:[n(Ht,{title:l("common.instances"),subtitle:l("instances.description"),actions:n(q,{icon:n(Qe,{class:`w-4 h-4 ${jn.value?"animate-spin":""}`}),label:l("actions.refresh"),onClick:rd,disabled:jn.value||!D.value,variant:"ghost"})}),D.value&&!jn.value&&n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(le,{icon:rn,label:l("common.total"),value:bn.value.length}),n(le,{icon:pr,label:l("instances.stats.gateways"),value:t}),n(le,{icon:Gt,label:l("instances.stats.clients"),value:a})]}),zs.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:zs.value}),(jn.value||!D.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:D.value?void 0:l("status.connecting")})}),D.value&&!jn.value&&bn.value.length>0&&n(H,{children:[n("div",{class:"md:hidden space-y-2",children:bn.value.map((r,o)=>n(RM,{presence:r},r.instanceId||r.host||o))}),n(G,{padding:"none",class:"hidden md:block",children:n("table",{class:"w-full",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)] text-left text-sm text-[var(--color-text-muted)]",children:[n("th",{class:"py-3 px-4 font-medium",children:l("instances.columns.instance")}),n("th",{class:"py-3 px-4 font-medium w-24",children:l("instances.columns.mode")}),n("th",{class:"py-3 px-4 font-medium w-40",children:l("common.platform")}),n("th",{class:"py-3 px-4 font-medium w-28",children:l("instances.columns.lastSeen")}),n("th",{class:"py-3 px-4 font-medium w-20 hidden lg:table-cell",children:l("instances.columns.idle")})]})}),n("tbody",{class:"divide-y divide-[var(--color-border)]",children:bn.value.map((r,o)=>n(LM,{presence:r},r.instanceId||r.host||o))})]})})]}),D.value&&!jn.value&&bn.value.length===0&&!zs.value&&n(G,{children:n("div",{class:"p-16 text-center",children:[n(rn,{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:l("instances.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l("instances.emptyDescription")}),n(P,{variant:"secondary",onClick:rd,children:l("actions.refresh")})]})}),D.value&&!jn.value&&bn.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:l("instances.count",{count:bn.value.length})})]})}const Jv={main:{icon:tu,color:"success",badgeVariant:"success"},channel:{icon:uc,color:"info",badgeVariant:"info"},cron:{icon:Ro,color:"warning",badgeVariant:"warning"},isolated:{icon:ca,color:"text-muted",badgeVariant:"default"}};function da(e){return Jv[e]??Jv.isolated}function jy(e){return l(`sessions.admin.kinds.${e}`)}const Pe=m([]),yt=m(!1),ga=m(null),la=m(""),at=m("all"),ba=m(null),ro=m(!1),kh=m(!1),oo=m(null),Nc=m(""),hl=m(""),fl=m("inherit"),pl=m("inherit"),ml=m("inherit");function ap(e){return(e.totalTokens??0).toLocaleString()}function Hy(e){const t=e.totalTokens??0,a=e.contextTokens??2e5;return a===0?"0%":`${Math.round(t/a*100)}%`}function By(e){return e.displayName||e.label||e.key.split(":").pop()||e.key}const Ka=K(()=>{let e=Pe.value;at.value!=="all"&&(e=e.filter(a=>er(a)===at.value));const t=la.value.toLowerCase().trim();return t&&(e=e.filter(a=>{const r=(a.label||a.displayName||"").toLowerCase(),o=a.key.toLowerCase(),s=(a.model||"").toLowerCase(),i=(a.channel||"").toLowerCase();return r.includes(t)||o.includes(t)||s.includes(t)||i.includes(t)})),[...e].sort((a,r)=>{const o=er(a)==="main",s=er(r)==="main";return o&&!s?-1:s&&!o?1:(r.updatedAt??0)-(a.updatedAt??0)})}),DM=K(()=>{const e={total:0,main:0,channel:0,cron:0,isolated:0};for(const t of Pe.value)e.total++,e[er(t)]++;return e});async function Wy(){yt.value=!0,ga.value=null;try{const e=await N("sessions.list",{limit:200});Pe.value=e.sessions??[]}catch(e){ga.value=ae(e)}finally{yt.value=!1}}function so(e){ba.value=e,hl.value=e.label??"",fl.value=e.thinking??"inherit",pl.value=e.verbose??"inherit",ml.value=e.reasoning??"inherit"}function Us(){ba.value=null,ro.value=!1}async function PM(){const e=ba.value;if(e){kh.value=!0;try{const t={};hl.value!==(e.label??"")&&(t.label=hl.value||void 0),fl.value!==(e.thinking??"inherit")&&(t.thinking=fl.value),pl.value!==(e.verbose??"inherit")&&(t.verbose=pl.value),ml.value!==(e.reasoning??"inherit")&&(t.reasoning=ml.value),Object.keys(t).length>0&&(await N("sessions.patch",{key:e.key,...t}),Pe.value=Pe.value.map(a=>a.key===e.key?{...a,...t}:a)),Us()}catch(t){ga.value=ae(t)}finally{kh.value=!1}}}async function OM(){const e=ba.value;if(e)try{await N("sessions.delete",{key:e.key}),Pe.value=Pe.value.filter(t=>t.key!==e.key),Us()}catch(t){ga.value=ae(t)}}function Ky(e){Oe(`/chat/${encodeURIComponent(e)}`)}function NM(e,t){t.stopPropagation(),oo.value=e.key,Nc.value=e.label??""}async function Yv(){const e=oo.value;if(!e)return;const t=Nc.value.trim(),a=Pe.value.find(r=>r.key===e);if(!a||t===(a.label??"")){oo.value=null;return}try{await N("sessions.patch",{key:e,label:t||void 0}),Pe.value=Pe.value.map(r=>r.key===e?{...r,label:t||void 0}:r)}catch(r){ga.value=ae(r)}finally{oo.value=null}}function FM(){oo.value=null}function zM(){const[e,t]=he("q"),[a,r]=he("kind"),o=!yt.value&&Pe.value.length>0,[s,i,c]=he("session",{ready:o});He(e,la,u=>u),He(a,at,u=>u),Mr(la,t),Rn(at,r,"all"),R(()=>{if(o&&s.value){const u=Pe.value.find(d=>d.key===s.value);u&&ba.value?.key!==u.key&&so(u)}},[s.value,o]),R(()=>{c.value&&i(ba.value?.key??null)},[ba.value,c.value])}function UM(){R(()=>{D.value&&Wy()},[D.value])}function jM({kind:e,size:t="sm"}){const a=da(e),r=a.icon,o=t==="md"?"w-6 h-6":"w-4 h-4",s=a.color==="text-muted"?"text-[var(--color-text-muted)]":`text-[var(--color-${a.color})]`;return n(r,{class:`${o} ${s}`})}function qy({kind:e,size:t="sm"}){const a=da(e),r=t==="md"?"p-3":"p-1.5",o=a.color==="text-muted"?"bg-[var(--color-bg-tertiary)]":`bg-[var(--color-${a.color})]/10`;return n("div",{class:`${r} rounded-lg flex-shrink-0 ${o}`,children:n(jM,{kind:e,size:t})})}function Vy({session:e,onDelete:t}){return n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[yl.value&&n(q,{icon:n($n,{class:"w-4 h-4"}),label:l("sessions.admin.openInChat"),size:"sm",variant:"ghost",onClick:a=>{a.stopPropagation(),Ky(e.key)}}),n(q,{icon:n(bt,{class:"w-4 h-4"}),label:l("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 HM({session:e}){const t=er(e),a=da(t),r=By(e);return n(No,{icon:a.icon,iconVariant:t==="main"?"success":t==="channel"?"info":t==="cron"?"warning":"default",title:r,subtitle:e.key,badges:n(Z,{variant:a.badgeVariant,size:"sm",children:jy(t)}),meta:[{icon:ve,value:e.updatedAt?ne(e.updatedAt,{relative:!0}):"—"},{icon:Ib,value:ap(e)}],actions:n(Vy,{session:e,onDelete:o=>{o.stopPropagation(),so(e),ro.value=!0}}),onClick:()=>so(e)})}function BM({session:e}){const t=er(e),a=By(e),r=oo.value===e.key;return n("tr",{class:"group hover:bg-[var(--color-bg-hover)] cursor-pointer transition-colors",onClick:()=>!r&&so(e),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&!r&&(o.preventDefault(),so(e))},tabIndex:r?-1:0,children:[n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-3",children:[n(qy,{kind:t}),n("div",{class:"min-w-0 flex-1",children:[r?n("div",{class:"flex items-center gap-2",role:"group",onClick:o=>o.stopPropagation(),onKeyDown:o=>o.stopPropagation(),children:n(Y,{type:"text",value:Nc.value,onInput:o=>Nc.value=o.target.value,onKeyDown:o=>{o.key==="Enter"&&Yv(),o.key==="Escape"&&FM()},onBlur:()=>{Yv()},placeholder:l("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:a,children:a}),n(q,{icon:n(fo,{class:"w-3 h-3"}),label:l("sessions.admin.editLabel"),size:"sm",variant:"ghost",onClick:o=>NM(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(ic,{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(ve,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:e.updatedAt?ne(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(Ib,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:ap(e)}),n("span",{class:"text-xs opacity-60",children:["(",Hy(e),")"]})]})}),n("td",{class:"py-3 px-4",children:n(Vy,{session:e,onDelete:o=>{o.stopPropagation(),so(e),ro.value=!0}})})]})}function WM(){return n(H,{children:[n("div",{class:"md:hidden space-y-2",children:Ka.value.map(e=>n(HM,{session:e},e.key))}),n(G,{padding:"none",class:"hidden md:block",children:n("table",{class:"w-full",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)] text-left text-sm text-[var(--color-text-muted)]",children:[n("th",{class:"py-3 px-4 font-medium",children:l("common.session")}),n("th",{class:"py-3 px-4 font-medium w-32",children:l("common.model")}),n("th",{class:"py-3 px-4 font-medium w-36",children:l("common.lastActive")}),n("th",{class:"py-3 px-4 font-medium w-32 hidden lg:table-cell",children:l("common.tokens")}),n("th",{class:"py-3 px-4 font-medium w-12"})]})}),n("tbody",{class:"divide-y divide-[var(--color-border)]",children:Ka.value.map(e=>n(BM,{session:e},e.key))})]})})]})}const od=[{value:"inherit",label:l("sessions.admin.levels.inherit")},{value:"off",label:l("common.off")},{value:"low",label:l("sessions.admin.levels.low")},{value:"medium",label:l("common.medium")},{value:"high",label:l("sessions.admin.levels.high")}];function KM(){const e=ba.value;if(!e)return null;const t=er(e),a=da(t);return n(We,{open:!!e,onClose:Us,title:e.label||e.displayName||l("common.sessionDetails"),size:"xl",footer:ro.value?n(Pf,{message:l("common.deleteThisSession"),onCancel:()=>ro.value=!1,onDelete:()=>{OM()}}):n(Px,{isEdit:!0,onDeleteClick:()=>ro.value=!0,onCancel:Us,onSave:()=>{PM()},isSaving:kh.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(qy,{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(Z,{variant:a.badgeVariant,size:"sm",children:jy(t)}),e.channel&&n(Z,{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:ap(e)}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:l("common.tokens")})]}),n("div",{class:"text-center p-2 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n("div",{class:"text-lg sm:text-xl font-bold",children:Hy(e)}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:l("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?ne(e.updatedAt,{relative:!0}):"—"}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:l("common.lastActive")})]})]}),n("div",{class:"space-y-4 sm:space-y-5",children:[n(De,{label:l("sessions.admin.label"),hint:l("sessions.admin.labelHelp"),children:n(Y,{value:hl.value,onInput:r=>hl.value=r.target.value,placeholder:l("sessions.admin.labelPlaceholder"),fullWidth:!0})}),n(De,{label:l("sessions.admin.overrides"),children:n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(De,{label:l("common.thinking"),class:"space-y-1",children:n(Ae,{value:fl.value,onChange:r=>fl.value=r,options:od})}),n(De,{label:l("sessions.admin.verbose"),class:"space-y-1",children:n(Ae,{value:pl.value,onChange:r=>pl.value=r,options:od})}),n(De,{label:l("sessions.admin.reasoning"),class:"space-y-1",children:n(Ae,{value:ml.value,onChange:r=>ml.value=r,options:od})})]})})]}),yl.value&&n(P,{variant:"secondary",fullWidth:!0,icon:n($n,{class:"w-4 h-4"}),onClick:()=>{Us(),Ky(e.key)},children:l("sessions.admin.openInChat")})]})})}function qM(e){zM(),UM();const t=DM.value;return n(sn,{viewName:l("common.sessions"),children:[n(Ht,{title:l("common.sessions"),subtitle:l("sessions.admin.description"),actions:n(H,{children:[D.value&&!yt.value&&Pe.value.length>0&&n("div",{class:"relative hidden sm:block",children:[n(ct,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Y,{type:"text",value:la.value,onInput:a=>la.value=a.target.value,placeholder:l("sessions.admin.searchPlaceholder"),class:"pl-10 w-48 lg:w-64"})]}),n(q,{icon:n(Qe,{class:`w-4 h-4 ${yt.value?"animate-spin":""}`}),label:l("actions.refresh"),onClick:()=>{Wy()},disabled:yt.value||!D.value,variant:"ghost"})]})}),D.value&&!yt.value&&Pe.value.length>0&&n("div",{class:"relative md:hidden",children:[n(ct,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Y,{type:"text",value:la.value,onInput:a=>la.value=a.target.value,placeholder:l("sessions.admin.searchPlaceholder"),class:"pl-10",fullWidth:!0})]}),D.value&&!yt.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(le,{icon:$n,label:l("common.total"),value:t.total,active:at.value==="all",onClick:()=>at.value="all"}),n(le,{icon:da("main").icon,label:l("common.main"),value:t.main,active:at.value==="main",onClick:()=>at.value="main"}),n(le,{icon:da("channel").icon,label:l("common.channel"),value:t.channel,active:at.value==="channel",onClick:()=>at.value="channel"}),n(le,{icon:da("cron").icon,label:l("sessions.admin.kinds.cron"),value:t.cron,active:at.value==="cron",onClick:()=>at.value="cron"}),n(le,{icon:da("isolated").icon,label:l("common.isolated"),value:t.isolated,active:at.value==="isolated",onClick:()=>at.value="isolated"})]}),ga.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:ga.value}),(yt.value||!D.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:D.value?void 0:l("status.connecting")})}),D.value&&!yt.value&&Ka.value.length>0&&n(WM,{}),D.value&&!yt.value&&Pe.value.length===0&&!ga.value&&n(G,{children:n("div",{class:"p-16 text-center",children:[n($n,{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:l("sessions.admin.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)]",children:l("sessions.admin.emptyDescription")})]})}),D.value&&!yt.value&&Pe.value.length>0&&Ka.value.length===0&&n(G,{children:n("div",{class:"p-12 text-center",children:[n(ct,{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:l("sessions.admin.noResults")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l("common.noResultsHint")}),n(P,{variant:"secondary",size:"sm",onClick:()=>{la.value="",at.value="all"},children:l("common.clearFilters")})]})}),D.value&&!yt.value&&Ka.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:Ka.value.length===Pe.value.length?l("sessions.admin.count",{count:Pe.value.length}):l("sessions.admin.filteredCount",{filtered:Ka.value.length,total:Pe.value.length})}),n(KM,{})]})}const Sh=m(null),ds=m(null),_h=m(null),VM=m(null),Gy=typeof BroadcastChannel<"u"?new BroadcastChannel("cove:canvas"):null;Gy?.addEventListener("message",e=>{if(e.data.type==="canvas-content"){if(e.data.url)Sh.value=e.data.url,ds.value=null,_h.value=null;else if(e.data.base64)try{ds.value&&URL.revokeObjectURL(ds.value);const t=Hf(e.data.base64,e.data.mimeType||"image/png");ds.value=t,_h.value=e.data.mimeType,Sh.value=null}catch{}}});function Zv(e){Gy?.postMessage({type:"canvas-standalone-status",open:e})}function GM({url:e,blobUrl:t,contentType:a,content:r,iframeRef:o,imgRef:s,largeEmptyState:i=!1}){return t?pE(a)||Tv(e)?n("div",{class:"w-full h-full flex items-center justify-center bg-[var(--color-bg-tertiary)] p-4 overflow-auto",children:n("img",{ref:s,src:t,alt:l("canvas.imageAlt"),class:"max-w-full max-h-full object-contain rounded-lg shadow-lg",crossOrigin:"anonymous"})}):n("div",{class:"w-full h-full overflow-hidden",children:n("iframe",{ref:o,src:t,class:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",title:l("canvas.iframeTitle")})}):e?Tv(e)?n("div",{class:"w-full h-full flex items-center justify-center bg-[var(--color-bg-tertiary)] p-4 overflow-auto",children:n("img",{ref:s,src:e,alt:l("canvas.imageAlt"),class:"max-w-full max-h-full object-contain rounded-lg shadow-lg",crossOrigin:"anonymous"})}):n("div",{class:"w-full h-full overflow-hidden",children:n("iframe",{ref:o,src:e,class:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",title:l("canvas.iframeTitle")})}):r?n("div",{class:"w-full h-full p-4 overflow-auto bg-[var(--color-bg-tertiary)]",dangerouslySetInnerHTML:{__html:r}}):i?n("div",{class:"flex flex-col items-center justify-center h-full gap-4 text-[var(--color-text-muted)] px-6 text-center bg-[var(--color-bg-primary)]",children:[n("div",{class:"text-6xl",children:"🖼️"}),n("p",{class:"text-lg",children:l("canvas.noContent")}),n("p",{class:"text-sm opacity-70",children:l("canvas.noContentHint")})]}):n("div",{class:"flex flex-col items-center justify-center h-full gap-3 text-[var(--color-text-muted)] px-6 text-center",children:[n("p",{class:"text-sm",children:l("canvas.noContent")}),n("p",{class:"text-xs opacity-70",children:l("canvas.noContentHint")})]})}function JM(){return R(()=>{Zv(!0);const e=()=>Zv(!1);return window.addEventListener("beforeunload",e),()=>{e(),window.removeEventListener("beforeunload",e)}},[]),n("div",{class:"w-screen h-screen overflow-hidden bg-[var(--color-bg-primary)]",children:n(GM,{url:Sh.value,blobUrl:ds.value,contentType:_h.value,content:VM.value,largeEmptyState:!0})})}const YM={sm:"text-xs",md:"text-sm",lg:"text-base"};function rp({children:e,size:t="sm",muted:a=!0,icon:r,iconRight:o,class:s,...i}){return n("button",{type:"button",class:`
433
+ \`\`\``)),[]);return n(sn,{viewName:l("nav.settings"),children:[n(Wt,{title:l("nav.settings"),subtitle:l("settings.description")}),n(Yu,{titleKey:"settings.appearance.title",children:n("div",{class:"space-y-6",children:[n(lE,{}),n(oa,{labelKey:"settings.appearance.fontSize",descriptionKey:"settings.appearance.fontSizeDescription",children:n(Me,{value:io.value,onChange:a=>{io.value=a},options:Hg.map(a=>({value:a.value,label:l(a.labelKey)})),size:"sm",width:"180px"})}),n(oa,{labelKey:"settings.appearance.fontFamily",descriptionKey:"settings.appearance.fontFamilyDescription",children:n(Me,{value:dr.value,onChange:a=>{dr.value=a},options:Bg.map(a=>({value:a.value,label:l(a.labelKey)})),size:"sm",width:"180px"})}),n("div",{class:"space-y-2",children:[n("div",{class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-4",children:[n("div",{class:"flex-1 min-w-0",children:[n("label",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:l("settings.appearance.codeFontFamily")}),n("p",{class:"text-xs text-[var(--color-text-muted)] mt-0.5",children:l("settings.appearance.codeFontFamilyDescription")})]}),n("div",{class:"flex-shrink-0",children:n(Me,{value:hr.value,onChange:a=>{hr.value=a},options:Wg.map(a=>({value:a.value,label:l(a.labelKey)})),size:"sm",width:"180px"})})]}),n("div",{class:"message-content prose prose-sm max-w-none w-full [&_pre.code-block]:m-0",dangerouslySetInnerHTML:{__html:t}})]})]})}),n(Yu,{titleKey:"settings.appMode.title",children:n("div",{class:"space-y-6",children:[n(oa,{labelKey:"settings.preferences.timeFormat",descriptionKey:"settings.preferences.timeFormatDescription",children:n(Me,{value:ur.value,onChange:a=>{ur.value=a},options:Kg.map(a=>({value:a.value,label:l(a.labelKey)})),size:"sm",width:"180px"})}),n(oa,{labelKey:"settings.appMode.multiChat",descriptionKey:"settings.appMode.multiChatDescription",children:n(Be,{checked:$n.value==="multi",onChange:a=>{$n.value=a?"multi":"single"}})}),wl.value&&n(H,{children:[n(oa,{labelKey:"settings.newChat.useDefaults",descriptionKey:"settings.newChat.useDefaultsDescription",children:n(Be,{checked:rt.value.useDefaults,onChange:a=>{rt.value={...rt.value,useDefaults:a}}})}),n(oa,{labelKey:"common.defaultAgent",descriptionKey:"settings.newChat.defaultAgentDescription",children:n(Me,{value:rt.value.defaultAgentId,onChange:a=>{rt.value={...rt.value,defaultAgentId:a}},options:Md.value,size:"sm",width:"180px"})})]}),n(ME,{})]})}),n(Yu,{titleKey:"settings.about.title",children:n("div",{class:"space-y-4",children:[n("div",{class:"space-y-3",children:[n(Zu,{label:l("common.cove"),value:`v${x2}`}),jt.value&&n(Zu,{label:l("common.gateway"),value:eb(jt.value)}),gt.value&&n(Zu,{label:l("common.gatewayUrl"),value:gt.value,truncate:!0})]}),n("div",{class:"border-t border-[var(--color-border)] pt-4 flex flex-wrap justify-end gap-2",children:[n(P,{variant:"secondary",onClick:()=>qg(),children:l("settings.data.resetDefaults")}),n(P,{variant:"secondary",onClick:()=>cE(),children:D.value?l("common.logout"):l("settings.data.clearSavedLogin")})]})]})})]})}const Fi=m(null);let RE=0;function LE(){return`json-block-${++RE}`}async function $E(e,t){try{await navigator.clipboard.writeText(e),Fi.value=t,setTimeout(()=>{Fi.value===t&&(Fi.value=null)},2e3)}catch{}}function DE(e){try{const t=tn.highlight(e,tn.languages.json,"json");return pc(t)}catch{return pc(e)}}function cu({value:e,maxHeight:t="max-h-48",id:a}){const r=a??LE(),o=Fi.value===r,s=DE(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:s}}),n(q,{icon:o?n(on,{size:14}):n(El,{size:14}),size:"sm",variant:"ghost",label:l("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:()=>$E(e,r)})]})}const ah=m(null),rh=m(null),oh=m(!1),Xo=m(!1);function ui(e){return e==null?"—":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function PE(e){return e==null?"—":`${Math.round(e)}%`}async function Mv(){if(D.value){oh.value=!0;try{const[e,t]=await Promise.all([N("status").catch(()=>null),N("health").catch(()=>null)]);ah.value=e,rh.value=t}catch{}finally{oh.value=!1}}}function di({label:e,value:t,sub:a}){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}),a&&n("div",{class:"text-xs text-[var(--color-text-muted)] opacity-70",children:a})]})}function OE({name:e,label:t,data:a}){const r=a.linked?"success":a.configured?"warning":"default",o=a.linked?l("debug.linked"):a.configured?l("common.configured"):l("common.off");return n("div",{class:"flex items-center justify-between py-1.5",children:[n("span",{class:"text-sm",children:t||e}),n(Z,{variant:r,size:"sm",children:o})]})}function NE(){const e=D.value,t=ah.value,a=rh.value,r=t?.sessions?.recent?.[0];return R(()=>{e&&!ah.value&&!rh.value&&Mv()},[e]),n(G,{children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(T4,{size:18,class:"text-[var(--color-accent)]"}),n("h2",{class:"font-medium",children:l("debug.snapshots")})]}),n(P,{variant:"ghost",size:"sm",onClick:Mv,disabled:!e,loading:oh.value,icon:n(Xe,{size:14}),children:l("actions.refresh")})]}),!t&&!a?n("p",{class:"text-sm text-[var(--color-text-muted)] text-center py-6",children:l("debug.noData")}):n("div",{class:"space-y-5",children:[r&&n("div",{children:[n("div",{class:"flex items-center gap-2 mb-3",children:[n(pa,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:l("debug.recentSession")}),r.model&&n(Z,{variant:"default",size:"sm",children:r.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(di,{label:l("common.input"),value:ui(r.inputTokens)}),n(di,{label:l("common.output"),value:ui(r.outputTokens)}),n(di,{label:l("common.total"),value:ui(r.totalTokens)}),n(di,{label:l("debug.used"),value:PE(r.percentUsed),sub:`of ${ui(r.contextTokens)}`})]})]}),a&&n("div",{children:[n("div",{class:"flex items-center gap-2 mb-3",children:[n(Rb,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:l("debug.health")}),n(Z,{variant:a.ok?"success":"error",size:"sm",children:a.ok?l("common.healthy"):l("debug.unhealthy")}),a.durationMs!=null&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",zh(a.durationMs),")"]})]}),a.channels&&Object.keys(a.channels).length>0&&n("div",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg divide-y divide-[var(--color-border)]",children:(a.channelOrder??Object.keys(a.channels)).map(o=>{const s=a.channels?.[o];return s?n(OE,{name:o,label:a.channelLabels?.[o],data:s},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(Nn,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:l("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(Z,{variant:o.enabled?"success":"default",size:"sm",children:o.enabled?l("debug.on"):l("common.off")})]})]},o.agentId))})]}),n("button",{type:"button",onClick:()=>{Xo.value=!Xo.value},"aria-expanded":Xo.value,class:"flex items-center gap-1 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors",children:[Xo.value?n(Ne,{size:12}):n(Ve,{size:12}),l("debug.showRawJson")]}),Xo.value&&n(cu,{value:JSON.stringify({status:t,health:a},null,2),id:"snapshots-raw-json"})]})]})}const zi=m("system-presence"),al=m("{}"),Ya=m(null),sh=m(!1),Sc=m(null),or=m(!0),On=m([]);let ry=0;const oy=K(()=>{const e={};for(const t of On.value)t.key.trim()&&(e[t.key.trim()]=t.value);return e});function FE(){if(or.value){const t=oy.value;return Object.keys(t).length>0?t:void 0}const e=al.value.trim();if(!(!e||e==="{}"))return JSON.parse(e)}function zE(){On.value=[...On.value,{id:`field_${++ry}`,key:"",value:""}]}function UE(e){On.value=On.value.filter(t=>t.id!==e)}function Iv(e,t){On.value=On.value.map(a=>a.id===e?{...a,...t}:a)}function jE(){const e=oy.value;al.value=Object.keys(e).length>0?JSON.stringify(e,null,2):"{}"}function HE(){try{const e=JSON.parse(al.value||"{}");typeof e=="object"&&e!==null&&!Array.isArray(e)&&(On.value=Object.entries(e).map(([t,a])=>({id:`field_${++ry}`,key:t,value:typeof a=="string"?a:JSON.stringify(a)})))}catch{}}function BE(){or.value?jE():HE(),or.value=!or.value}async function WE(){if(D.value){sh.value=!0,Sc.value=null,Ya.value=null;try{const e=FE(),t=await s2(zi.value,e);Ya.value={ok:!0,data:t}}catch(e){Sc.value=e instanceof Error?e.message:"RPC call failed",Ya.value={ok:!1,data:null}}finally{sh.value=!1}}}function KE(){const e=D.value;return n(G,{children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(Fb,{size:18,class:"text-[var(--color-warning)]"}),n("h2",{class:"font-medium",children:l("debug.manualRpc")})]}),n(P,{variant:"ghost",size:"sm",onClick:BE,icon:or.value?n(C4,{size:14}):n(U4,{size:14}),children:or.value?l("debug.jsonMode"):l("debug.formMode")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:l("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:l("debug.method")}),n(Y,{id:"rpc-method",value:zi.value,onInput:t=>{zi.value=t.target.value},placeholder:"e.g., system-presence, status, health",class:"font-mono",fullWidth:!0})]}),or.value?n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium",children:l("debug.params")}),n(P,{variant:"ghost",size:"sm",onClick:zE,icon:n(Sa,{size:14}),children:l("debug.addParam")})]}),On.value.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] py-3 text-center",children:l("debug.noParams")}):n("div",{class:"space-y-2",children:On.value.map(t=>n("div",{class:"flex items-center gap-2",children:[n(Y,{value:t.key,onInput:a=>Iv(t.id,{key:a.target.value}),placeholder:"key",class:"font-mono flex-1"}),n(Y,{value:t.value,onInput:a=>Iv(t.id,{value:a.target.value}),placeholder:"value",class:"font-mono flex-1"}),n(q,{icon:n(bt,{size:14}),size:"sm",variant:"ghost",label:l("actions.delete"),onClick:()=>UE(t.id)})]},t.id))})]}):n("div",{children:[n("label",{htmlFor:"rpc-params",class:"block text-sm font-medium mb-1",children:l("debug.paramsJson")}),n(tr,{id:"rpc-params",value:al.value,onInput:t=>{al.value=t.target.value},placeholder:"{}",rows:4,class:"font-mono text-sm",fullWidth:!0})]}),n(P,{variant:"secondary",onClick:WE,disabled:!e||!zi.value.trim(),loading:sh.value,icon:n(hf,{size:14}),children:l("debug.call")}),Sc.value&&n("div",{class:"text-sm text-[var(--color-error)] bg-[var(--color-error)]/10 p-3 rounded-lg",children:Sc.value}),Ya.value&&n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium",children:l("common.result")}),n(Z,{variant:Ya.value.ok?"success":"error",children:Ya.value.ok?l("debug.ok"):l("common.error")})]}),n(cu,{value:Vh(Ya.value.data),maxHeight:"max-h-64",id:"rpc-result"})]})]})]})}const wn=m([]),qE=m(100),Ui=m(!1);let VE=0;const ji=m(null),Oa=m(new Set),vn=m(null),sy=m(0),GE=K(()=>{sy.value;const e=Hh.value;return e==null?"—":Qg(e,{includeMinutesWhenDays:!0})}),JE=K(()=>{switch(Ue.value){case"connected":return"success";case"connecting":case"authenticating":case"reconnecting":return"warning";default:return"error"}});function YE(e,t){if(Ui.value)return;const a={id:++VE,timestamp:Date.now(),event:e,payload:t};wn.value=[a,...wn.value].slice(0,qE.value)}function ZE(){wn.value=[]}function XE(e){Oo(Oa,e,{pushHistory:!0})}async function QE(e,t){try{await navigator.clipboard.writeText(e),ji.value=t,setTimeout(()=>{ji.value===t&&(ji.value=null)},2e3)}catch{}}function ft({icon:e,label:t,value:a,copyable:r,mono:o}){const s=a??"—",i=`${t}-${s}`,c=ji.value===i;return n("div",{class:"flex flex-col sm:flex-row sm:items-center justify-between py-2 gap-1 sm:gap-2 border-b border-[var(--color-border)] last:border-0",children:[n("div",{class:"flex items-center gap-2 text-[var(--color-text-muted)]",children:[n(e,{size:16,class:"flex-shrink-0"}),n("span",{class:"text-sm",children:t})]}),n("div",{class:"flex items-center gap-2 pl-6 sm:pl-0",children:[n("span",{class:`${o?"font-mono text-sm":""} break-all`,children:s}),r&&a&&n(q,{icon:c?n(on,{size:14}):n(El,{size:14}),size:"sm",variant:"ghost",label:l("actions.copy"),onClick:()=>QE(a,i),class:"flex-shrink-0"})]})]})}function eA({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:()=>{vn.value=e},"aria-label":l("debug.viewEventDetails",{event:e.event}),children:[n("div",{class:"min-w-0",children:[n(Z,{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(Ve,{size:16,class:"text-[var(--color-text-muted)] flex-shrink-0"})]})}function tA({entry:e,expanded:t,onToggle:a}){const r=e.payload!=null&&Object.keys(e.payload).length>0,o=Vh(e.payload),s=`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:a,disabled:!r,"aria-expanded":t,"aria-label":`${e.event} event, ${l(r?"debug.clickToExpand":"debug.noPayload")}`,children:[r?t?n(Ne,{size:14,class:"text-[var(--color-text-muted)]"}):n(Ve,{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(Z,{variant:"default",class:"font-mono text-xs",children:e.event})]}),t&&r&&n("div",{class:"px-3 pb-3",children:n(cu,{value:o,id:s})})]})}function nA(e){const t=wn.value.length>0,[a,r,o]=Xs("event",{ready:t});R(()=>{if(t&&a.value.size>0){const c=Array.from(a.value).filter(u=>wn.value.some(d=>d.id===u));if(c.length>0){const u=c.filter(d=>!Oa.value.has(d));u.length>0&&(Oa.value=new Set([...Oa.value,...c]),setTimeout(()=>{const d=document.querySelectorAll(`[data-event-id="${u[0]}"]`);Array.from(d).find(f=>f.offsetParent!==null)?.scrollIntoView({behavior:"smooth",block:"center"})},100))}}},[a.value,t]),R(()=>{o.value&&r(Oa.value)},[Oa.value,o.value]),R(()=>_l(u=>{YE(u.event,u.payload)}),[]),R(()=>{const c=setInterval(()=>{sy.value++},1e3);return()=>clearInterval(c)},[]);const s=D.value,i=Ue.value;return n(sn,{viewName:l("common.debug"),children:[n(Wt,{title:l("common.debug"),subtitle:l("debug.subtitle"),actions:n(Z,{variant:JE.value,children:[s?n(cc,{size:14,class:"mr-1"}):n(jb,{size:14,class:"mr-1"}),i]})}),n("div",{class:"grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-6",children:[n(G,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(cc,{size:18,class:s?"text-[var(--color-success)]":"text-[var(--color-error)]"}),n("h2",{class:"font-medium",children:l("debug.connection")})]}),n("div",{class:"space-y-0",children:[n(ft,{icon:pa,label:l("debug.state"),value:i}),n(ft,{icon:Nn,label:l("common.url"),value:gt.value,copyable:!0,mono:!0}),n(ft,{icon:Jc,label:l("debug.sessionKey"),value:Je.value,copyable:!0,mono:!0}),n(ft,{icon:Xe,label:l("debug.reconnectAttempts"),value:String(Qt.value)}),n(ft,{icon:ge,label:l("debug.connectedAt"),value:ya.value?ae(ya.value):null})]})]}),n(G,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(pr,{size:18,class:"text-[var(--color-primary)]"}),n("h2",{class:"font-medium",children:l("debug.server")})]}),n("div",{class:"space-y-0",children:[n(ft,{icon:pr,label:l("common.version"),value:jt.value}),n(ft,{icon:ge,label:l("common.uptime"),value:GE.value}),n(ft,{icon:ge,label:l("debug.tickInterval"),value:qs.value?`${qs.value}ms`:null})]})]}),n(G,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(lc,{size:18,class:"text-[var(--color-warning)]"}),n("h2",{class:"font-medium",children:l("debug.paths")})]}),n("div",{class:"space-y-0",children:[n(ft,{icon:Dn,label:l("debug.configPath"),value:vs.value,copyable:!0,mono:!0}),n(ft,{icon:lc,label:l("debug.stateDir"),value:gs.value,copyable:!0,mono:!0})]})]}),n(G,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(En,{size:18,class:"text-[var(--color-info)]"}),n("h2",{class:"font-medium",children:l("debug.client")})]}),n("div",{class:"space-y-0",children:[n(ft,{icon:En,label:l("debug.appVersion"),value:"2026.3.2"}),n(ft,{icon:En,label:l("common.platform"),value:navigator.platform}),n(ft,{icon:En,label:l("debug.userAgent"),value:navigator.userAgent.slice(0,60)+"..."}),n(ft,{icon:ca,label:l("debug.presenceCount"),value:String(kl.value.length)})]})]})]}),n("div",{class:"grid grid-cols-1 lg:grid-cols-2 gap-4 sm:gap-6",children:[n(NE,{}),n(KE,{})]}),n(G,{children:[n("div",{class:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(pa,{size:18,class:"text-[var(--color-accent)]"}),n("h2",{class:"font-medium",children:l("debug.eventLog")}),n(Z,{variant:"default",children:wn.value.length})]}),n("div",{class:"flex items-center gap-2",children:[n(Be,{checked:!Ui.value,onChange:c=>{Ui.value=!c},label:Ui.value?l("common.paused"):l("debug.recording")}),n(P,{variant:"ghost",size:"sm",onClick:ZE,disabled:wn.value.length===0,icon:n(bt,{size:14}),children:n("span",{class:"hidden sm:inline",children:l("common.clear")})})]})]}),wn.value.length===0?n("div",{class:"text-center py-8 text-[var(--color-text-muted)]",children:[n(pa,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:l("debug.noEvents")}),n("p",{class:"text-sm mt-1",children:l("debug.noEventsHint")})]}):n(H,{children:[n("div",{class:"md:hidden space-y-2 max-h-96 overflow-y-auto",children:wn.value.map(c=>n("div",{"data-event-id":c.id,children:n(eA,{entry:c})},c.id))}),n("div",{class:"hidden md:block max-h-96 overflow-y-auto border border-[var(--color-border)] rounded-lg",children:wn.value.map(c=>n("div",{"data-event-id":c.id,children:n(tA,{entry:c,expanded:Oa.value.has(c.id),onToggle:()=>XE(c.id)})},c.id))})]})]}),n(We,{open:!!vn.value,onClose:()=>{vn.value=null},title:vn.value?.event||"",children:vn.value&&n("div",{class:"space-y-3",children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:new Date(vn.value.timestamp).toLocaleString()}),vn.value.payload!=null&&Object.keys(vn.value.payload).length>0?n(cu,{value:Vh(vn.value.payload),maxHeight:"max-h-[60vh]",id:`mobile-event-${vn.value.id}`}):n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("debug.noPayload")})]})})]})}let ly=0;function iy(){ly=0}function _c(e,t="",a=!0){const r={};for(const[o,s]of Object.entries(e)){if(a&&/^\d+$/.test(o))continue;const i=t?`${t}.${o}`:o;s!=null&&(Array.isArray(s)?r[i]=JSON.stringify(s):typeof s=="object"?Object.assign(r,_c(s,i,!1)):typeof s=="string"?r[i]=s:r[i]=JSON.stringify(s))}return r}function aA(e){const t=Object.keys(e).filter(o=>/^\d+$/.test(o)).map(Number).sort((o,s)=>o-s);if(t.length===0)return{message:null,fields:{}};let a=null;const r={};for(const o of t){const s=e[String(o)];if(typeof s=="string"){try{const i=JSON.parse(s);if(typeof i=="object"&&i!==null){Object.assign(r,_c(i,"",!1));continue}}catch{}a=s}else typeof s=="object"&&s!==null&&Object.assign(r,_c(s,"",!1))}return{message:a,fields:r}}const Rv=["time","timestamp","ts","level","lvl","pid","hostname","v","msg","message"];function cy(e){if(!e.startsWith("{"))return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Lv(e){const t=++ly;let a,r,o=e,s;if(e.startsWith("{"))try{const i=JSON.parse(e);a=i.time||i.timestamp||i.ts;const u=i._meta?.logLevelName?.toLowerCase()||(i.level||i.lvl||"")?.toLowerCase();["debug","info","warn","warning","error","err"].includes(u)&&(r=u==="warning"?"warn":u==="err"?"error":u);const d=Object.keys(i).some(h=>/^\d+$/.test(h));if(d){const h=aA(i);h.message&&(o=h.message),Object.keys(h.fields).length>0&&(s=h.fields)}if(o===e&&(i.msg||i.message?o=i.msg||i.message:i.error&&typeof i.error=="string"&&(o=i.error)),o===e&&!d){const h=[];for(const[f,p]of Object.entries(i))Rv.includes(f)||(typeof p=="string"?h.push(`${f}=${p}`):p!=null&&h.push(`${f}=${JSON.stringify(p)}`));o=h.length>0?h.join(" "):e}if(!s){const h={};for(const[f,p]of Object.entries(i))!Rv.includes(f)&&!/^\d+$/.test(f)&&f!=="_meta"&&(h[f]=p);Object.keys(h).length>0&&(s=_c(h))}}catch{}if(!a){const i=e.match(/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z)\s+\[([^\]]+)\]\s*(.*)$/);if(i){a=i[1],o=`[${i[2]}] ${i[3]}`;const c=e.toLowerCase();c.includes("error")||c.includes("err ")||c.includes("✗")?r="error":c.includes("warn")||c.includes("warning")?r="warn":c.includes("debug")?r="debug":r="info"}}if(!a){const i=e.match(/^\[([^\]]+)\]\s*(DEBUG|INFO|WARN|ERROR):?\s*(.*)$/i);i&&(a=i[1],r=i[2].toLowerCase(),o=i[3])}if(!a){const i=e.match(/^(\d{4}-\d{2}-\d{2}T[\d:]+Z)\s+(ERR|INF|WRN|DBG)\s+(.*)$/);if(i){a=i[1];const c=i[2];r=c==="ERR"?"error":c==="WRN"?"warn":c==="DBG"?"debug":"info",o=i[3]}}if(!r&&!a){const i=e.match(/^(DEBUG|INFO|WARN|ERROR):?\s+(.*)$/i);i&&(r=i[1].toLowerCase(),o=i[2])}if(!r){const i=e.toLowerCase();i.includes("error")||i.includes("failed")||i.includes("exception")||i.includes("✗")?r="error":i.includes("warn")||i.includes("deprecated")?r="warn":(i.includes("debug")||i.includes("trace"))&&(r="debug")}return{id:t,raw:e,timestamp:a,level:r,message:o,fields:s}}const uy={debug:w4,info:Al,warn:Aa,error:Gc},dy={debug:"text-[var(--color-text-muted)]",info:"text-[var(--color-info)]",warn:"text-[var(--color-warning)]",error:"text-[var(--color-error)]"};function hy(e){return e?e.split("T")[1]?.slice(0,12)||e.slice(0,12):null}function rA({line:e,expanded:t,onToggle:a}){const r=e.level?uy[e.level]:void 0,o=e.level?dy[e.level]:"text-[var(--color-text-muted)]",s=hy(e.timestamp),i=e.fields&&Object.keys(e.fields).length>0;return n("div",{class:"border-b border-[var(--color-border)]/50 last:border-0",children:[n("button",{type:"button",onClick:a,disabled:!i,"aria-expanded":i?t:void 0,"aria-label":i?l("logs.expandLine",{message:e.message.slice(0,50)}):void 0,class:"w-full text-left py-2 px-3 hover:bg-[var(--color-bg-hover)] flex items-start gap-2 font-mono text-xs disabled:cursor-default",children:[i?n(Ve,{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"}),r&&n(r,{size:14,class:`mt-0.5 flex-shrink-0 ${o}`}),s&&n("span",{class:"text-[var(--color-text-muted)] flex-shrink-0",children:s}),n("span",{class:"flex-1 text-[var(--color-text-primary)] truncate",title:e.message,children:e.message})]}),t&&i&&e.fields&&n("div",{class:"pb-3 px-3 ml-7 space-y-2",children:[e.message&&n("div",{class:"text-xs font-mono",children:[n("span",{class:"text-[var(--color-accent)]",children:"message"}),n("div",{class:"text-[var(--color-text-primary)] mt-1 whitespace-pre-wrap break-all",children:e.message})]}),n("div",{class:"space-y-1 pt-1 border-t border-[var(--color-border)]/30",children:Object.entries(e.fields).map(([c,u])=>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:u})]},c))}),n("details",{class:"pt-1 border-t border-[var(--color-border)]/30",children:[n("summary",{class:"text-xs text-[var(--color-text-muted)] cursor-pointer hover:text-[var(--color-text-secondary)]",children:l("logs.rawLine")}),n("pre",{class:"mt-2 text-xs font-mono text-[var(--color-text-secondary)] bg-[var(--color-bg-primary)] rounded p-2 overflow-x-auto whitespace-pre-wrap break-all",children:cy(e.raw)})]})]})]})}const oA={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)]"}},$v={debug:"common.debug",info:"logs.info",warn:"logs.warnings",error:"common.error"};function hi({level:e,count:t,selected:a,onClick:r}){const o=oA[e];return n("button",{type:"button",onClick:r,"aria-label":l("logs.filterByLevel",{level:l($v[e])}),"aria-pressed":a,class:`px-3 py-1 text-sm rounded-full transition-colors ${a?o.active:o.inactive}`,children:[l($v[e])," (",t,")"]})}function sA({logId:e,lines:t,onClose:a}){const r=e!==null?t.find(o=>o.id===e):null;return n(We,{open:!!r,onClose:a,title:l("logs.logDetails"),children:r&&n("div",{class:"space-y-4",children:[n("div",{class:"flex items-center gap-2",children:[r.level&&n(Z,{variant:r.level==="error"?"error":r.level==="warn"?"warning":"default",children:r.level}),r.timestamp&&n("span",{class:"text-sm text-[var(--color-text-muted)] font-mono",children:r.timestamp})]}),n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:l("logs.message")}),n("p",{class:"text-sm text-[var(--color-text-primary)] whitespace-pre-wrap break-words",children:r.message})]}),r.fields&&Object.keys(r.fields).length>0&&n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-2",children:l("logs.fields")}),n("div",{class:"space-y-2 bg-[var(--color-bg-tertiary)] rounded-lg p-3",children:Object.entries(r.fields).map(([o,s])=>n("div",{class:"text-xs font-mono",children:[n("span",{class:"text-[var(--color-accent)]",children:o}),n("span",{class:"text-[var(--color-text-muted)] mx-1",children:"="}),n("span",{class:"text-[var(--color-text-secondary)] break-all",children:s})]},o))})]}),n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:l("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:cy(r.raw)})]})]})})}function lA({line:e,onSelect:t}){const a=e.level?uy[e.level]:Al,r=e.level?dy[e.level]:"text-[var(--color-text-muted)]",o=e.fields&&Object.keys(e.fields).length>0,s=hy(e.timestamp);return n("button",{type:"button",class:"w-full flex items-start gap-3 p-3 text-left bg-[var(--color-bg-secondary)] rounded-lg hover:bg-[var(--color-bg-hover)] transition-colors",onClick:()=>t(e.id),"aria-label":l("logs.viewLogDetails"),children:[n(a,{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:[s&&n("span",{class:"text-xs text-[var(--color-text-muted)] font-mono",children:s}),o&&n(Z,{variant:"default",class:"text-xs",children:[Object.keys(e.fields).length," ",l("logs.fields")]})]})]}),n(Ve,{size:16,class:"text-[var(--color-text-muted)] flex-shrink-0 mt-0.5"})]})}function fy(e){const{ready:t,expandedParam:a,expandedState:r,expandedInitialized:o,setExpandedParam:s,isValid:i,getItemSelector:c,onMobileOpenFirst:u,isMobile:d=()=>window.matchMedia("(max-width: 767px)").matches,scrollOnMobile:h=!0,scrollDelayMs:f=100}=e;R(()=>{if(!t||a.value.size===0)return;const p=Array.from(a.value).filter(C=>i?i(C):!0),v=p.filter(C=>!r.value.has(C));if(v.length===0)return;r.value=new Set([...r.value,...p]);const w=d();w&&u&&u(v[0]),(!w||h)&&setTimeout(()=>{const C=c(v[0]),T=document.querySelectorAll(C);Array.from(T).find(g=>g.offsetParent!==null)?.scrollIntoView({behavior:"smooth",block:"center"})},f)},[a.value,t]),R(()=>{o.value&&s(r.value)},[r.value,o.value])}const Ye=m([]),lh=m(0),ih=m(""),Za=m(!1),Cc=m(null),va=m(!0),rl=m(""),Ft=m(new Set),kr=m(new Set),py=m(typeof window<"u"?window.matchMedia("(max-width: 767px)").matches:!1),iA=K(()=>{if(!py.value||kr.value.size===0)return null;const e=Array.from(kr.value);return e[e.length-1]??null});async function Kf(e=!1){if(D.value){Za.value=!0,Cc.value=null;try{const t=await N("logs.tail",{cursor:e?void 0:lh.value||void 0,limit:500,maxBytes:25e4});if(t)if(ih.value=t.file,lh.value=t.cursor,t.reset||e)iy(),Ye.value=t.lines.map(Lv);else{const a=t.lines.map(Lv);a.length>0&&(Ye.value=[...Ye.value,...a].slice(-2e3))}}catch(t){Cc.value=t instanceof Error?t.message:l("logs.fetchError")}finally{Za.value=!1}}}function Dv(){Ye.value=[],lh.value=0,iy()}function Pv(){const e=Ye.value.map(o=>o.raw).join(`
434
+ `),t=new Blob([e],{type:"text/plain"}),a=URL.createObjectURL(t),r=document.createElement("a");r.href=a,r.download=`openclaw-logs-${new Date().toISOString().slice(0,10)}.log`,r.click(),URL.revokeObjectURL(a)}function fi(e){Oo(Ft,e)}function cA(){Ft.value=new Set}function uA(e){tu(),kr.value=new Set([e])}function dA(){kr.value=new Set}const Ov=K(()=>{let e=Ye.value;const t=Ft.value;t.size>0&&(e=e.filter(r=>r.level&&t.has(r.level)));const a=rl.value.toLowerCase().trim();return a&&(e=e.filter(r=>r.raw.toLowerCase().includes(a))),e}),hA=K(()=>{const e={debug:0,info:0,warn:0,error:0};for(const t of Ye.value)t.level&&t.level in e&&e[t.level]++;return e});function fA(){const e=!Za.value&&Ye.value.length>0,[t,a]=fe("q"),[r,o]=Xs("level"),[s,i]=fe("live"),[c,u,d]=Xs("log",{ready:e,parse:h=>parseInt(h,10)});He(t,rl,h=>h),R(()=>{r.value.size>0&&(Ft.value=r.value),s.value==="0"&&(va.value=!1)},[]),Mr(rl,a),R(()=>{o(Ft.value)},[Ft.value]),R(()=>{i(va.value?null:"0")},[va.value]),fy({ready:e,expandedParam:c,expandedState:kr,expandedInitialized:d,setExpandedParam:u,isValid:h=>Ye.value.some(f=>f.id===h),getItemSelector:h=>`[data-log-id="${h}"]`})}function pA(){R(()=>{const e=()=>{py.value=window.matchMedia("(max-width: 767px)").matches};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[])}function mA(){R(()=>{D.value&&Kf(!0)},[D.value])}function vA(){R(()=>{if(!va.value||!D.value)return;const e=setInterval(()=>{Kf()},2e3);return()=>clearInterval(e)},[va.value,D.value])}function gA(e){const t=F(null),a=F(null),r=F(!0),o=F(!0);fA(),pA(),mA(),vA(),R(()=>{r.current&&t.current&&(t.current.scrollTop=t.current.scrollHeight),o.current&&a.current&&(a.current.scrollTop=a.current.scrollHeight)},[Ov.value.length]);const s=()=>{if(!t.current)return;const{scrollTop:d,scrollHeight:h,clientHeight:f}=t.current;r.current=h-d-f<50},i=()=>{if(!a.current)return;const{scrollTop:d,scrollHeight:h,clientHeight:f}=a.current;o.current=h-d-f<50},c=Ov.value,u=hA.value;return n(ru,{viewName:l("common.logs"),children:n("div",{class:"flex-1 flex flex-col overflow-hidden p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto w-full flex flex-col flex-1 min-h-0 space-y-4 sm:space-y-6",children:[n(Wt,{title:l("common.logs"),subtitle:l("logs.description"),actions:n("div",{class:"flex items-center gap-2",children:[n(Be,{checked:va.value,onChange:d=>va.value=d,label:va.value?l("logs.live"):l("common.paused")}),n(q,{icon:n(Xe,{size:16,class:Za.value?"animate-spin":""}),onClick:()=>{Kf(!0)},disabled:Za.value,label:l("actions.refresh")})]})}),n(Y,{type:"text",value:rl.value,onInput:d=>rl.value=d.target.value,placeholder:l("logs.searchPlaceholder"),"aria-label":l("logs.searchPlaceholder"),leftElement:n(it,{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":l("logs.filterByLevel",{level:""}),children:[n("button",{type:"button",onClick:cA,"aria-pressed":Ft.value.size===0,class:`px-3 py-1 text-sm rounded-full transition-colors whitespace-nowrap ${Ft.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:[l("common.all")," (",Ye.value.length,")"]}),n(hi,{level:"debug",count:u.debug,selected:Ft.value.has("debug"),onClick:()=>fi("debug")}),n(hi,{level:"info",count:u.info,selected:Ft.value.has("info"),onClick:()=>fi("info")}),n(hi,{level:"warn",count:u.warn,selected:Ft.value.has("warn"),onClick:()=>fi("warn")}),n(hi,{level:"error",count:u.error,selected:Ft.value.has("error"),onClick:()=>fi("error")})]}),n("div",{class:"flex items-center gap-2",children:[ih.value&&n("span",{class:"hidden sm:flex text-xs text-[var(--color-text-muted)] items-center gap-1",children:[n(Dn,{size:12}),ih.value.split("/").pop()]}),n("div",{class:"hidden sm:flex items-center gap-2",children:[n(P,{variant:"ghost",size:"sm",onClick:Pv,icon:n(Lt,{size:14}),children:l("common.download")}),n(P,{variant:"ghost",size:"sm",onClick:Dv,disabled:Ye.value.length===0,icon:n(bt,{size:14}),children:l("common.clear")})]}),n("div",{class:"flex sm:hidden items-center gap-1",children:[n(q,{icon:n(Lt,{size:16}),onClick:Pv,label:l("common.download"),size:"sm"}),n(q,{icon:n(bt,{size:16}),onClick:Dv,disabled:Ye.value.length===0,label:l("common.clear"),size:"sm"})]})]})]}),Cc.value&&n("div",{class:"p-4 rounded-lg bg-[var(--color-error)]/10 text-[var(--color-error)] text-sm",role:"alert",children:Cc.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:[Za.value&&Ye.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!Za.value&&Ye.value.length===0&&n("div",{class:"text-center py-12 text-[var(--color-text-muted)]",children:[n(Dn,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:l("logs.noLogs")}),n("p",{class:"text-sm mt-1",children:l("logs.noLogsHint")})]}),Ye.value.length>0&&c.length===0&&n("div",{class:"text-center py-12 text-[var(--color-text-muted)]",children:[n(it,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:l("logs.noMatches")})]}),c.length>0&&n(H,{children:[n("div",{ref:a,class:"md:hidden flex-1 overflow-y-auto p-3 space-y-2",onScroll:i,role:"log","aria-live":"polite",children:c.map(d=>n("div",{"data-log-id":d.id,children:n(lA,{line:d,onSelect:uA})},d.id))}),n("div",{ref:t,class:"hidden md:flex md:flex-col flex-1 overflow-y-auto",onScroll:s,role:"log","aria-live":"polite",children:c.map(d=>n("div",{"data-log-id":d.id,children:n(rA,{line:d,expanded:kr.value.has(d.id),onToggle:()=>{Oo(kr,d.id,{pushHistory:!0})}})},d.id))})]})]}),n(sA,{logId:iA.value,lines:Ye.value,onClose:dA})]})})})}function qf(e){return e.role?e.role:e.roles&&e.roles.length>0?e.roles[0]:"unknown"}function my(e){return!!(e.role==="node"||e.roles?.includes("node"))}function vy(e){return!!(e.role==="operator"||e.roles?.includes("operator"))}function Vf(e){switch(e){case"operator":return"info";case"node":return"success";default:return"default"}}function gy(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 Sr(e){return e.length<=20?e:`${e.slice(0,10)}...${e.slice(-6)}`}function bA({device:e,onSelect:t}){const a=qf(e),r=e.tokens?.length??0,o=e.platform?.includes("ios")||e.platform?.includes("android")?mo:En;return n(No,{icon:o,iconVariant:a==="operator"?"info":"success",title:e.displayName||Sr(e.deviceId),subtitle:e.platform||void 0,badges:n(Z,{variant:Vf(a),children:a}),meta:[...r>0?[{icon:Jc,value:`${r}`}]:[],{icon:ge,value:ae(e.approvedAtMs,{relative:!0})}],onClick:()=>t(e)})}function pi({label:e,children:t}){return n("div",{children:[n("span",{class:"text-[var(--color-text-muted)]",children:[e,":"]})," ",t]})}function xA({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?l("devices.tokenRevoked"):l("devices.tokenActive")})]}),n("div",{class:"flex gap-1",children:n(q,{icon:n(Yc,{class:"w-4 h-4"}),label:l("devices.rotateToken"),onClick:t,size:"sm"})})]})}function by({device:e,bare:t=!1,onOpenTokenModal:a,onRemoveDevice:r}){const o=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(pi,{label:l("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(pi,{label:l("devices.clientId"),children:e.clientId}),e.scopes&&e.scopes.length>0&&n(pi,{label:l("devices.scopes"),children:n("span",{class:"text-xs",children:e.scopes.join(", ")})}),n(pi,{label:l("common.approved"),children:ae(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(Zc,{class:"w-4 h-4"}),l("devices.tokens")]}),o.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("devices.noTokens")}):n("div",{class:"space-y-2",children:o.map(i=>n(xA,{token:i,onRotate:()=>a?.(e)},i.role))})]})]}),r&&n("div",{class:"mt-4 pt-4 border-t border-[var(--color-border)]",children:n(P,{variant:"danger",size:"sm",icon:n(bt,{class:"w-4 h-4"}),onClick:()=>r(e),children:l("devices.removeDevice")})})]})}function yA({device:e,isExpanded:t,onToggleExpand:a,onOpenTokenModal:r,onRemoveDevice:o}){const s=qf(e),i=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:a,"aria-expanded":t,"aria-label":l("devices.toggleDetails",{name:e.displayName||Sr(e.deviceId)}),children:[n("span",{class:"text-[var(--color-text-muted)]",children:t?n(Ne,{class:"w-4 h-4"}):n(Ve,{class:"w-4 h-4"})}),n("span",{class:"text-xl w-8 text-center flex-shrink-0",children:gy(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||Sr(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(Z,{variant:Vf(s),children:s}),i>0&&n("div",{class:"flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(Jc,{class:"w-4 h-4"}),n("span",{children:i})]}),n("div",{class:"hidden md:flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(ge,{class:"w-4 h-4"}),n("span",{children:ae(e.approvedAtMs)})]})]}),t&&n(by,{device:e,onOpenTokenModal:r,onRemoveDevice:o})]})}const Xa=m([]),Gf=m([]),ja=m(!1),ks=m(null),cs=m(""),Ot=m("all"),Na=m(new Set),sr=m(null),gn=m(null),to=m(null),ch=m(!1),uh=m(!1),wA=[{value:"all",label:()=>l("devices.filters.allRoles")},{value:"operator",label:()=>l("common.operators")},{value:"node",label:()=>l("common.nodes")}],kA=K(()=>{const e=Xa.value,t=e.filter(vy).length,a=e.filter(my).length,r=Gf.value.length;return{total:e.length,operators:t,nodes:a,pending:r}}),SA=K(()=>{let e=Xa.value;Ot.value==="operator"?e=e.filter(vy):Ot.value==="node"&&(e=e.filter(my));const t=cs.value.toLowerCase().trim();return t&&(e=e.filter(a=>a.deviceId.toLowerCase().includes(t)||a.displayName?.toLowerCase().includes(t)||a.platform?.toLowerCase().includes(t)||a.remoteIp?.toLowerCase().includes(t))),e});async function _r(){ja.value=!0,ks.value=null;try{const e=await N("device.pair.list",{});Xa.value=e.paired,Gf.value=e.pending}catch(e){ks.value=ne(e)}finally{ja.value=!1}}async function _A(e){try{await N("device.pair.approve",{requestId:e}),V.success(l("devices.approveSuccess")),await _r()}catch(t){V.error(ne(t))}}async function CA(e){try{await N("device.pair.reject",{requestId:e}),V.success(l("devices.rejectSuccess")),await _r()}catch(t){V.error(ne(t))}}async function TA(e,t){ch.value=!0;try{const a=await N("device.token.rotate",{deviceId:e.deviceId,role:t});V.success(l("devices.tokenRotated")),await navigator.clipboard.writeText(a.token),V.success(l("devices.tokenCopied")),sr.value=null,await _r()}catch(a){V.error(ne(a))}finally{ch.value=!1}}async function EA(e,t){try{await N("device.token.revoke",{deviceId:e.deviceId,role:t}),V.success(l("devices.tokenRevoked")),sr.value=null,await _r()}catch(a){V.error(ne(a))}}async function AA(e){uh.value=!0;try{await N("device.pair.remove",{deviceId:e.deviceId}),V.success(l("devices.removeSuccess")),to.value=null,gn.value=null,await _r()}catch(t){V.error(ne(t))}finally{uh.value=!1}}function MA(e){Oo(Na,e,{pushHistory:!0})}function IA({request:e}){const t=qf(e);return n(G,{class:"border-[var(--color-warning)] border-2",children:n("div",{class:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4",children:[n("div",{class:"flex items-center gap-3",children:[n("span",{class:"text-2xl",children:gy(e.platform)}),n("div",{children:[n("div",{class:"flex items-center gap-2 flex-wrap",children:[n("h3",{class:"font-medium",children:e.displayName||Sr(e.deviceId)}),n(Z,{variant:Vf(t),children:t}),e.isRepair&&n(Z,{variant:"warning",children:l("devices.repair")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:[e.platform,e.remoteIp&&` • ${e.remoteIp}`," • ",ae(e.ts)]})]})]}),n("div",{class:"flex gap-2 self-end sm:self-start",children:[n(P,{variant:"primary",size:"sm",icon:on,onClick:()=>_A(e.requestId),children:l("devices.approve")}),n(P,{variant:"danger",size:"sm",icon:Ma,onClick:()=>CA(e.requestId),children:l("devices.reject")})]})]})})}function RA({token:e,device:t,disabled:a}){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:[l("devices.tokenCreated"),": ",ae(e.createdAtMs),e.rotatedAtMs&&n(H,{children:[" ","• ",l("devices.tokenRotatedAt"),": ",ae(e.rotatedAtMs)]})]})]}),n("div",{class:"flex gap-2",children:[n(P,{variant:"secondary",size:"sm",icon:Yc,onClick:()=>TA(t,e.role),disabled:a,children:l("devices.rotate")}),n(P,{variant:"danger",size:"sm",icon:bt,onClick:()=>EA(t,e.role),children:l("devices.revoke")})]})]})}function LA(){const e=sr.value;if(!e)return null;const t=e.tokens??[];return n(We,{open:!0,onClose:()=>{sr.value=null},title:l("devices.tokenManagement"),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("devices.tokenManagementDesc",{name:e.displayName||Sr(e.deviceId)})}),t.length===0?n("p",{class:"text-sm",children:l("devices.noTokens")}):n("div",{class:"space-y-3",children:t.map(a=>n(RA,{token:a,device:e,disabled:ch.value},a.role))})]}),n("div",{class:"mt-6 flex justify-end",children:n(P,{variant:"secondary",onClick:()=>{sr.value=null},children:l("actions.close")})})]})}function $A(){const e=to.value;return e?n(We,{open:!0,onClose:()=>{to.value=null},title:l("devices.removeDevice"),children:[n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:l("devices.removeWarning")}),n(Df,{message:l("devices.removeConfirm",{name:e.displayName||Sr(e.deviceId)}),onCancel:()=>{to.value=null},onDelete:()=>AA(e),isDeleting:uh.value})]}):null}function DA(){return n("div",{class:"text-center py-12",children:[n(mo,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:l("devices.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l("devices.emptyDescription")})]})}function PA(e){const t=!ja.value&&Xa.value.length>0,[a,r]=fe("q"),[o,s]=fe("role"),[i,c,u]=Xs("device",{ready:t});He(a,cs,p=>p),He(o,Ot,p=>p),Mr(cs,r),Ln(Ot,s,"all"),R(()=>{if(t&&i.value.size>0){const p=Array.from(i.value).filter(v=>!Na.value.has(v));p.length>0&&(Na.value=new Set([...Na.value,...i.value]),setTimeout(()=>{const v=document.querySelectorAll(`[data-device-id="${p[0]}"]`),w=Array.from(v).find(C=>C.offsetParent!==null);w&&w.scrollIntoView({behavior:"smooth",block:"center"})},100))}},[i.value,t]),R(()=>{u.value&&c(Na.value)},[Na.value,u.value]),R(()=>{D.value&&_r()},[D.value]);const d=SA.value,h=kA.value,f=Gf.value;return n(sn,{viewName:l("common.devices"),children:[n(Wt,{title:l("common.devices"),subtitle:l("devices.description"),actions:n(q,{icon:n(Xe,{class:ja.value?"animate-spin":""}),onClick:_r,disabled:ja.value,label:l("actions.refresh")})}),ks.value&&n(Jn,{variant:"error",children:ks.value}),ja.value&&Xa.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!ja.value&&!ks.value&&n(H,{children:[n("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-4",children:[n(le,{icon:mo,label:l("common.total"),value:h.total,active:Ot.value==="all",onClick:()=>{Ot.value="all"}}),n(le,{icon:rn,label:l("common.operators"),value:h.operators,active:Ot.value==="operator",onClick:()=>{Ot.value="operator"}}),n(le,{icon:En,label:l("common.nodes"),value:h.nodes,active:Ot.value==="node",onClick:()=>{Ot.value="node"}}),n(le,{icon:ge,label:l("common.pending"),value:h.pending,highlight:h.pending>0})]}),f.length>0&&n("div",{class:"space-y-3","data-tour":"pending-requests",children:[n("h2",{class:"text-lg font-semibold",children:l("devices.pendingRequests")}),f.map(p=>n(IA,{request:p},p.requestId))]}),Xa.value.length>0&&n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-3",children:[n(Y,{type:"text",placeholder:l("devices.searchPlaceholder"),value:cs.value,onInput:p=>{cs.value=p.target.value},leftElement:n(it,{class:"w-4 h-4"}),class:"flex-1"}),n(Me,{value:Ot.value,onChange:p=>{Ot.value=p},options:wA.map(p=>({value:p.value,label:p.label()})),size:"sm",align:"right","aria-label":l("devices.filters.allRoles")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:d.length!==h.total?l("devices.filteredCount",{filtered:d.length,total:h.total}):l("devices.count",{count:h.total})})]}),Xa.value.length>0?d.length===0?n(G,{padding:"none",children:n("div",{class:"text-center py-8 text-[var(--color-text-muted)]",children:l("devices.noResults")})}):n(H,{children:[n("div",{class:"md:hidden space-y-2",children:d.map(p=>n("div",{"data-device-id":p.deviceId,children:n(bA,{device:p,onSelect:v=>{gn.value=v}})},p.deviceId))}),n(G,{padding:"none",class:"hidden md:block overflow-hidden",children:d.map(p=>n("div",{"data-device-id":p.deviceId,children:n(yA,{device:p,isExpanded:Na.value.has(p.deviceId),onToggleExpand:()=>MA(p.deviceId),onOpenTokenModal:v=>{sr.value=v},onRemoveDevice:v=>{to.value=v}})},p.deviceId))})]}):n(DA,{})]}),n(We,{open:!!gn.value,onClose:()=>{gn.value=null},title:gn.value?.displayName||(gn.value?Sr(gn.value.deviceId):""),children:gn.value&&n(by,{device:gn.value,bare:!0,onOpenTokenModal:p=>{gn.value=null,sr.value=p},onRemoveDevice:p=>{to.value=p}})}),n(LA,{}),n($A,{})]})}function Jf({items:e,activeId:t,onChange:a}){return n("div",{class:"flex border-b border-[var(--color-border)] overflow-x-auto scrollbar-hide -mx-4 px-4 sm:mx-0 sm:px-0",role:"tablist",children:e.map(r=>{const o=r.id===t;return n("button",{type:"button",role:"tab","aria-selected":o,onClick:()=>a(r.id),class:`relative flex items-center gap-1.5 sm:gap-2 px-3 sm:px-4 py-3 text-sm font-medium transition-colors whitespace-nowrap flex-shrink-0 ${o?"text-[var(--color-accent)]":"text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)]"}`,children:[r.icon,r.label,o&&n("span",{class:"absolute bottom-0 left-0 right-0 h-0.5 bg-[var(--color-accent)] rounded-full"})]},r.id)})})}function uu(e){return e.disabled?"disabled":e.blockedByAllowlist?"blocked":e.eligible?"eligible":"missing-reqs"}function OA(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 NA(e){const t=[],{missing:a}=e;return a.bins.length>0&&t.push(`bins: ${a.bins.join(", ")}`),a.anyBins.length>0&&t.push(`needs one of: ${a.anyBins.join(", ")}`),a.env.length>0&&t.push(`env: ${a.env.join(", ")}`),a.config.length>0&&t.push(`config: ${a.config.join(", ")}`),a.os.length>0&&t.push(`os: ${a.os.join(", ")}`),t}const Yf="https://clawhub.ai/api/v1";async function xy(e){const t=new URLSearchParams;e?.limit&&t.set("limit",String(e.limit)),e?.cursor&&t.set("cursor",e.cursor),e?.sort&&t.set("sort",e.sort);const a=`${Yf}/skills${t.toString()?`?${t}`:""}`,r=await fetch(a);if(!r.ok)throw new Error(`ClawHub API error: ${r.status}`);return r.json()}async function FA(e,t){const a=new URLSearchParams({q:e});a.set("limit",String(t.limit));const r=`${Yf}/search?${a}`,o=await fetch(r);if(!o.ok)throw new Error(`ClawHub API error: ${o.status}`);return{items:((await o.json()).results||[]).map(c=>({slug:c.slug,displayName:c.displayName,summary:c.summary,tags:{latest:c.version},stats:{comments:0,downloads:0,stars:0,versions:0},createdAt:c.updatedAt,updatedAt:c.updatedAt,latestVersion:{version:c.version,createdAt:c.updatedAt,changelog:""}}))}}async function zA(e){const t=`${Yf}/skills/${encodeURIComponent(e)}`,a=await fetch(t);if(a.status===404)return null;if(!a.ok)throw new Error(`ClawHub API error: ${a.status}`);const r=await a.json();return{...r.skill,latestVersion:r.latestVersion,owner:r.owner}}const St=m([]),Zf=m([]),kn=m(!1),Hi=m(!1),Ss=m(null),xn=m(""),Ur=m("downloads"),no=m(void 0),Vn=m(null),_s=m(!1),UA=[{value:"downloads",label:()=>l("skills.clawhub.sortPopular")},{value:"trending",label:()=>l("skills.clawhub.sortTrending")},{value:"stars",label:()=>l("skills.clawhub.sortStars")},{value:"recent",label:()=>l("skills.clawhub.sortRecent")}];async function yy(){if(!Hi.value){Hi.value=!0;try{const e=await xy({limit:6,sort:"trending"});Zf.value=e.items}catch{}finally{Hi.value=!1}}}async function Bi(e=!1){if(!kn.value){kn.value=!0,Ss.value=null;try{const t=e?no.value:void 0;if(xn.value){const a=await FA(xn.value,{limit:20});St.value=a.items,no.value=void 0;const r=await Promise.all(a.items.map(async o=>{try{return await zA(o.slug)||o}catch{return o}}));St.value=r}else{const a=await xy({limit:20,cursor:t,sort:Ur.value});e?St.value=[...St.value,...a.items]:St.value=a.items,no.value=a.nextCursor}}catch(t){Ss.value=ne(t)}finally{kn.value=!1}}}function jA(){yy(),Bi()}async function HA(e){_s.value=!0;try{V.error(l("skills.clawhub.notYetSupported",{slug:e.slug})),Vn.value=null}catch(t){V.error(ne(t))}finally{_s.value=!1}}function dh(e){Vn.value=e,tu()}function BA(){const e=Zf.value;return Hi.value&&e.length===0?n("div",{class:"flex items-center justify-center py-8",children:n(te,{size:"md"})}):e.length===0?null:n("section",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-2",children:[n(E4,{class:"w-5 h-5 text-orange-500"}),n("h2",{class:"font-semibold",children:l("skills.clawhub.trending")})]}),n("div",{class:"flex gap-3 overflow-x-auto pb-2 scrollbar-hide -mx-4 px-4 sm:mx-0 sm:px-0",children:e.map(t=>n(WA,{skill:t},t.slug))})]})}function WA({skill:e}){const t=e.tags?.latest||e.latestVersion?.version||"?";return n("button",{type:"button",onClick:()=>dh(e),style:{outline:"none"},class:"flex-shrink-0 w-56 p-3 rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-secondary)] hover:border-[var(--color-border-hover)] hover:bg-[var(--color-bg-hover)] transition-colors text-left group cursor-pointer",children:[n("div",{class:"flex items-center gap-2 mb-1",children:[n("span",{class:"font-medium truncate flex-1",children:e.displayName}),n(Z,{variant:"default",class:"flex-shrink-0 text-xs",children:t})]}),n("p",{class:"text-xs text-[var(--color-text-muted)] line-clamp-2 mb-2 min-h-[2.5em]",children:e.summary||l("skills.clawhub.noDescription")}),n("div",{class:"flex items-center gap-3 text-xs text-[var(--color-text-muted)]",children:[n("span",{class:"flex items-center gap-1",children:[n(Lt,{class:"w-3 h-3"}),Xf(e.stats.downloads)]}),n("span",{class:"flex items-center gap-1",children:[n(gf,{class:"w-3 h-3"}),e.stats.stars]}),n(Ve,{class:"w-3 h-3 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"})]})]})}function KA({skill:e}){const t=e.tags?.latest||e.latestVersion?.version||"?";return n(G,{class:"hover:border-[var(--color-border-hover)] transition-colors",children:n("div",{class:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4",children:[n("button",{type:"button",onClick:()=>dh(e),style:{outline:"none"},class:"flex-1 min-w-0 text-left cursor-pointer",children:[n("div",{class:"flex items-center gap-2 mb-1 flex-wrap",children:[n("h3",{class:"font-semibold truncate",children:e.displayName}),n(Z,{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||l("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(Lt,{class:"w-3 h-3"}),Xf(e.stats.downloads)]}),n("span",{class:"flex items-center gap-1",children:[n(gf,{class:"w-3 h-3"}),e.stats.stars]}),n("span",{class:"flex items-center gap-1",children:[n(Ro,{class:"w-3 h-3"}),ae(e.updatedAt)]})]})]}),n(P,{variant:"secondary",size:"sm",icon:n(Lt,{class:"w-4 h-4"}),onClick:()=>dh(e),class:"self-start sm:flex-shrink-0",children:l("skills.clawhub.install")})]})})}function qA(){const e=Vn.value;if(!e)return null;const t=e.tags?.latest||e.latestVersion?.version||"?",a=e.latestVersion?.changelog,r=n("div",{class:"flex items-center justify-between gap-3",children:[n(P,{variant:"secondary",icon:n($o,{class:"w-4 h-4"}),onClick:()=>window.open(`https://clawhub.ai/skills/${e.slug}`,"_blank"),children:"ClawHub"}),n("div",{class:"flex gap-3",children:[n(P,{variant:"secondary",onClick:()=>{Vn.value=null},disabled:_s.value,children:l("actions.cancel")}),n(P,{variant:"primary",icon:n(Lt,{class:"w-4 h-4"}),onClick:()=>HA(e),disabled:_s.value,children:_s.value?l("skills.clawhub.installing"):l("skills.clawhub.install")})]})]});return n(We,{open:!0,onClose:()=>{Vn.value=null},title:e.displayName,footer:r,size:"lg",children:n("div",{class:"space-y-5",children:[e.summary&&n("p",{class:"text-[var(--color-text-muted)]",children:e.summary}),n("div",{class:"flex items-center gap-4 flex-wrap text-sm",children:[n("span",{class:"flex items-center gap-1.5",children:[n(gf,{class:"w-4 h-4 text-yellow-500"}),n("span",{class:"font-medium",children:e.stats.stars})]}),n("span",{class:"flex items-center gap-1.5 text-[var(--color-text-muted)]",children:[n(Lt,{class:"w-4 h-4"}),Xf(e.stats.downloads)]}),e.stats.installsCurrent!==void 0&&n("span",{class:"flex items-center gap-1.5 text-[var(--color-text-muted)]",children:[n(S4,{class:"w-4 h-4"}),e.stats.installsCurrent," ",l("skills.clawhub.installs")]}),e.stats.comments>0&&n("span",{class:"flex items-center gap-1.5 text-[var(--color-text-muted)]",children:[n(Pb,{class:"w-4 h-4"}),e.stats.comments]})]}),e.owner&&n("div",{class:"flex items-center gap-2",children:[n("span",{class:"text-sm text-[var(--color-text-muted)]",children:l("skills.clawhub.by")}),e.owner.image?n("img",{src:e.owner.image,alt:e.owner.displayName,class:"w-5 h-5 rounded-full"}):n(Ub,{class:"w-5 h-5 text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:["@",e.owner.handle]})]}),n("div",{class:"flex items-center gap-4 flex-wrap text-sm text-[var(--color-text-muted)]",children:[n(Z,{variant:"default",children:t}),n("span",{class:"flex items-center gap-1.5",children:[n(Ro,{class:"w-4 h-4"}),l("skills.clawhub.updated")," ",ae(e.updatedAt)]})]}),a&&n("div",{children:[n("h4",{class:"text-sm font-medium mb-2",children:l("skills.clawhub.changelog")}),n("div",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg text-xs max-h-32 overflow-y-auto whitespace-pre-wrap font-mono",children:a})]})]})})}function VA(){return n("div",{class:"text-center py-12",children:[n(rn,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:l("skills.clawhub.noResults")}),n("p",{class:"text-[var(--color-text-muted)]",children:l("skills.clawhub.tryDifferentSearch")})]})}function Xf(e){return e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:String(e)}function GA(){const[e,t]=fe("hub_q"),[a,r]=fe("hub_sort"),[o,s]=fe("hub_skill");He(e,xn,d=>d),He(a,Ur,d=>d),Mr(xn,t),Ln(Ur,r,"downloads"),R(()=>{if(o.value&&St.value.length>0){const d=St.value.find(h=>h.slug===o.value);d&&!Vn.value&&(Vn.value=d)}},[o.value,St.value]),R(()=>{s(Vn.value?.slug??null)},[Vn.value]),R(()=>{yy()},[]),R(()=>{xn.value||(no.value=void 0,Bi())},[Ur.value]);const i=F(null);R(()=>(i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{no.value=void 0,Bi()},300),()=>{i.current&&clearTimeout(i.current)}),[xn.value]);const c=!!no.value,u=Zf.value.length>0;return n("div",{class:"space-y-6",children:[u&&n(BA,{}),n("div",{class:"flex items-center justify-between gap-2 sm:gap-3",children:[n("div",{class:"min-w-0 w-full max-w-md",children:n(Y,{type:"text",placeholder:l("skills.clawhub.searchPlaceholder"),value:xn.value,onInput:d=>{xn.value=d.target.value},leftElement:kn.value?n(te,{size:"sm"}):n(it,{class:"w-4 h-4"}),fullWidth:!0,rightElement:xn.value?n("button",{type:"button",onClick:()=>{xn.value=""},class:"p-1 hover:bg-[var(--color-bg-hover)] rounded-full transition-colors","aria-label":l("actions.clear"),children:n(Ma,{class:"w-4 h-4"})}):void 0})}),n(Me,{value:Ur.value,onChange:d=>{Ur.value=d},options:UA.map(d=>({value:d.value,label:d.label()})),size:"sm",align:"right","aria-label":l("skills.clawhub.sortLabel")})]}),Ss.value&&n(Jn,{variant:"error",children:Ss.value}),kn.value&&St.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),St.value.length>0&&n("div",{class:"grid gap-3",children:St.value.map(d=>n(KA,{skill:d},d.slug))}),!kn.value&&!Ss.value&&St.value.length===0&&n(VA,{}),c&&!kn.value&&n("div",{class:"flex justify-center",children:n(P,{variant:"secondary",onClick:()=>Bi(!0),children:l("actions.showMore")})}),kn.value&&St.value.length>0&&n("div",{class:"flex justify-center py-4",children:n(te,{size:"md"})}),n(qA,{})]})}const mi=m(!1);function JA({skill:e,onClose:t,onSuccess:a}){if(!e)return null;const r=async o=>{mi.value=!0;try{const s=await N("skills.install",{name:e.name,installId:o,timeoutMs:6e4});s.ok?(V.success(l("skills.installSuccess",{name:e.name})),t(),a()):V.error(s.message||l("skills.installFailed"))}catch(s){V.error(ne(s))}finally{mi.value=!1}};return n(We,{open:!0,onClose:t,title:l("skills.installTitle",{name:e.name}),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("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:()=>r(o.id),disabled:mi.value,children:[n(Lt,{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:[l("skills.providesBins"),": ",o.bins.join(", ")]})]}),mi.value&&n(te,{size:"sm"})]},o.id))})]}),n("div",{class:"mt-6 flex justify-end",children:n(P,{variant:"secondary",onClick:t,children:l("actions.cancel")})})]})}function Nv({label:e,children:t}){return n("div",{children:[n("span",{class:"text-[var(--color-text-muted)]",children:[e,":"]})," ",t]})}function wy({skill:e,onInstall:t,bare:a=!1}){const r=NA(e),o=e.install.length>0&&OA(e);return n("div",{class:a?"":"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(Nv,{label:l("skills.skillKey"),children:n("code",{class:"text-xs bg-[var(--color-bg-primary)] px-1 py-0.5 rounded",children:e.skillKey})}),n(Nv,{label:l("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:[l("skills.homepage"),n($o,{class:"w-3 h-3"})]})})]}),n("div",{class:"space-y-2",children:[r.length>0&&n("div",{children:[n("span",{class:"text-[var(--color-warning)] font-medium",children:[l("skills.missingRequirements"),":"]}),n("ul",{class:"list-disc list-inside text-xs mt-1 space-y-0.5",children:r.map(i=>n("li",{children:i},i))})]}),e.blockedByAllowlist&&n("div",{class:"flex items-center gap-2 text-[var(--color-error)]",children:[n(j4,{class:"w-4 h-4"}),n("span",{children:l("skills.blockedByAllowlist")})]}),o&&n("div",{class:"pt-2",children:n(P,{variant:"secondary",size:"sm",icon:Lt,onClick:()=>t(e),children:l("skills.installDeps")})}),e.primaryEnv&&n("div",{class:"text-xs text-[var(--color-text-muted)]",children:[l("skills.primaryEnv"),": ",n("code",{children:e.primaryEnv})]})]})]})]})}const YA={"openclaw-bundled":Nb,"openclaw-managed":A4,"openclaw-workspace":lc,"openclaw-extra":lc},ZA={"openclaw-bundled":"skills.source.bundled","openclaw-managed":"skills.source.managed","openclaw-workspace":"common.workspace","openclaw-extra":"skills.source.extra"};function ky(e){const t={eligible:{variant:"success",key:"common.eligible"},disabled:{variant:"default",key:"common.disabled"},"missing-reqs":{variant:"warning",key:"common.missingReqs"},blocked:{variant:"error",key:"skills.status.blocked"}},{variant:a,key:r}=t[e];return{variant:a,label:l(r)}}function Sy(e){return YA[e]||ff}function _y(e){const t=ZA[e];return t?l(t):e}function XA({skill:e,onToggleExpand:t,onToggleEnabled:a}){const r=uu(e),o=ky(r),s=Sy(e.source);return n(No,{icon:()=>n("span",{class:"text-lg",children:e.emoji||"🔧"}),iconVariant:r==="eligible"?"success":r==="missing-reqs"?"warning":"default",title:e.name,subtitle:e.description,badges:n(H,{children:[n(Z,{variant:o.variant,size:"sm",children:o.label}),e.always&&n("span",{class:"text-xs text-[var(--color-text-muted)]",title:l("common.alwaysActive"),children:"⚡"})]}),meta:[{icon:s,value:_y(e.source)}],actions:n("div",{onClick:i=>i.stopPropagation(),onKeyDown:i=>i.stopPropagation(),role:"presentation",children:n(Be,{checked:!e.disabled,onChange:a,size:"sm","aria-label":e.disabled?l("common.enable"):l("common.disable")})}),onClick:t})}function QA({skill:e,isExpanded:t,onToggleExpand:a,onToggleEnabled:r,onInstall:o}){const s=uu(e),i=ky(s),c=Sy(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:a,"aria-expanded":t,children:[n("span",{class:"text-[var(--color-text-muted)]",children:t?n(Ne,{class:"w-4 h-4"}):n(Ve,{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:l("common.alwaysActive"),children:"⚡"})]}),n("div",{class:"text-sm text-[var(--color-text-muted)] truncate",title:e.description,children:e.description})]}),n("div",{class:"hidden md:flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(c,{class:"w-4 h-4"}),n("span",{children:_y(e.source)})]}),n("div",{class:"w-24 flex justify-end",children:n(Z,{variant:i.variant,children:i.label})}),n("div",{onClick:u=>u.stopPropagation(),onKeyDown:u=>u.stopPropagation(),role:"presentation",children:n(Be,{checked:!e.disabled,onChange:r,size:"sm","aria-label":e.disabled?l("common.enable"):l("common.disable")})})]}),t&&n(wy,{skill:e,onInstall:o})]})}const e6=[{value:"all",label:()=>l("skills.filters.allSources")},{value:"openclaw-bundled",label:()=>l("skills.source.bundled")},{value:"openclaw-workspace",label:()=>l("common.workspace")},{value:"openclaw-managed",label:()=>l("skills.source.managed")},{value:"openclaw-extra",label:()=>l("skills.source.extra")}],Qo=m("installed"),Gn=m([]),hh=m(""),Cy=m(""),Ha=m(!1),Cs=m(null),Ba=m(""),sa=m("all"),pt=m("all"),Fa=m(new Set),vi=m(null),fn=m(null),t6=K(()=>{const e=Gn.value;let t=0,a=0,r=0;for(const o of e){const s=uu(o);s==="eligible"?t++:s==="disabled"?a++:s==="missing-reqs"&&r++}return{total:e.length,eligible:t,disabled:a,missingReqs:r}}),n6=K(()=>{let e=Gn.value;const t=Ba.value.toLowerCase().trim();return t&&(e=e.filter(a=>a.name.toLowerCase().includes(t)||a.description.toLowerCase().includes(t)||a.skillKey.toLowerCase().includes(t))),sa.value!=="all"&&(e=e.filter(a=>a.source===sa.value)),pt.value!=="all"&&(e=e.filter(a=>uu(a)===pt.value)),e});async function Xu(){Ha.value=!0,Cs.value=null;try{const e=await N("skills.status",{});Gn.value=e.skills,hh.value=e.workspaceDir,Cy.value=e.managedSkillsDir}catch(e){Cs.value=ne(e)}finally{Ha.value=!1}}async function Fv(e){const t=e.disabled;try{await N("skills.update",{skillKey:e.skillKey,enabled:t}),Gn.value=Gn.value.map(a=>a.skillKey===e.skillKey?{...a,disabled:!t}:a),V.success(t?l("skills.enabledSuccess",{name:e.name}):l("skills.disabledSuccess",{name:e.name}))}catch(a){V.error(ne(a))}}function a6(e,t=!0){Oo(Fa,e,{pushHistory:t})}function r6(){Ba.value="",sa.value="all",pt.value="all"}const o6=[{id:"installed",label:"Installed",icon:n(Nb,{class:"w-4 h-4"})},{id:"clawhub",label:"ClawHub",icon:n(rn,{class:"w-4 h-4"})}];function s6({hasFilters:e}){return n("div",{class:"text-center py-12",children:[n(it,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:l(e?"skills.noResults":"skills.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l(e?"common.noResultsHint":"skills.emptyDescription")}),e&&n(P,{type:"button",variant:"ghost",size:"sm",onClick:r6,children:l("common.clearFilters")})]})}function l6(e){const t=!Ha.value&&Gn.value.length>0,[a,r]=fe("tab"),[o,s]=fe("q"),[i,c]=fe("source"),[u,d]=fe("status"),[h,f,p]=Xs("skill",{ready:t});R(()=>{D.value&&Qo.value==="installed"&&Xu()},[D.value]),He(a,Qo,b=>b),He(o,Ba,b=>b),He(i,sa,b=>b),He(u,pt,b=>b),Ln(Qo,r,"installed"),Mr(Ba,s),Ln(sa,c,"all"),Ln(pt,d,"all"),fy({ready:t,expandedParam:h,expandedState:Fa,expandedInitialized:p,setExpandedParam:f,isValid:b=>Gn.value.some(g=>g.skillKey===b),getItemSelector:b=>`[data-skill-key="${b}"]`,onMobileOpenFirst:b=>{const g=Gn.value.find(y=>y.skillKey===b);g&&(fn.value=g)},isMobile:()=>window.innerWidth<768,scrollOnMobile:!1});const v=n6.value,w=t6.value,C=Qo.value,T=!!Ba.value||sa.value!=="all"||pt.value!=="all";return n(sn,{viewName:l("common.skills"),children:[n(Wt,{title:l("common.skills"),subtitle:l("skills.description"),actions:n(q,{icon:n(Xe,{class:(C==="installed"?Ha.value:kn.value)?"animate-spin":""}),onClick:C==="installed"?Xu:jA,disabled:C==="installed"?Ha.value:kn.value,label:l("actions.refresh")})}),n(Jf,{items:o6.map(b=>({...b,label:b.label})),activeId:C,onChange:b=>Qo.value=b}),C==="clawhub"&&n(GA,{}),C==="installed"&&n(H,{children:[Cs.value&&n(Jn,{variant:"error",children:Cs.value}),Ha.value&&Gn.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!Ha.value&&!Cs.value&&n(H,{children:[n("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-4",children:[n(le,{icon:ff,label:l("common.total"),value:w.total,active:pt.value==="all",onClick:()=>{pt.value="all"}}),n(le,{icon:Lo,label:l("common.eligible"),value:w.eligible,active:pt.value==="eligible",onClick:()=>{pt.value="eligible"}}),n(le,{icon:Er,label:l("common.disabled"),value:w.disabled,active:pt.value==="disabled",onClick:()=>{pt.value="disabled"}}),n(le,{icon:Aa,label:l("common.missingReqs"),value:w.missingReqs,active:pt.value==="missing-reqs",highlight:w.missingReqs>0,onClick:()=>{pt.value="missing-reqs"}})]}),n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-3",children:[n(Y,{type:"text",placeholder:l("common.searchSkills"),value:Ba.value,onInput:b=>{Ba.value=b.target.value},leftElement:n(it,{class:"w-4 h-4"}),class:"flex-1"}),n(Me,{value:sa.value,onChange:b=>{sa.value=b},options:e6.map(b=>({value:b.value,label:b.label()})),size:"sm",align:"right","aria-label":l("skills.filters.allSources")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:v.length!==w.total?l("skills.filteredCount",{filtered:v.length,total:w.total}):l("skills.count",{count:w.total})})]}),v.length===0?n(G,{padding:"none",children:n(s6,{hasFilters:T})}):n(H,{children:[n("div",{class:"md:hidden space-y-2",children:v.map(b=>n("div",{"data-skill-key":b.skillKey,children:n(XA,{skill:b,onToggleExpand:()=>{Fa.value.has(b.skillKey)||Oo(Fa,b.skillKey,{pushHistory:!0}),fn.value=b},onToggleEnabled:()=>Fv(b)})},b.skillKey))}),n(G,{padding:"none",class:"hidden md:block overflow-hidden",children:v.map(b=>n("div",{"data-skill-key":b.skillKey,children:n(QA,{skill:b,isExpanded:Fa.value.has(b.skillKey),onToggleExpand:()=>a6(b.skillKey),onToggleEnabled:()=>Fv(b),onInstall:g=>{vi.value=g}})},b.skillKey))})]}),hh.value&&n("div",{class:"text-xs text-[var(--color-text-muted)] space-y-1",children:[n("div",{children:[l("common.workspace"),": ",n("code",{children:hh.value})]}),n("div",{children:[l("skills.managedDir"),": ",n("code",{children:Cy.value})]})]})]})]}),n(We,{open:!!fn.value,onClose:()=>{if(fn.value){const b=new Set(Fa.value);b.delete(fn.value.skillKey),Fa.value=b}fn.value=null},title:fn.value?.name||"",children:fn.value&&n(wy,{skill:fn.value,onInstall:b=>{fn.value=null,vi.value=b},bare:!0})}),n(JA,{skill:vi.value,onClose:()=>{vi.value=null},onSuccess:Xu})]})}function i6(e){return e.identity?.name||e.name||e.id}function c6(e){const t=i6(e),a=e.identity?.emoji;return a?`${a}  ${t}`:t}const Cr=m([]),Ty=m("main"),Ie=m("main"),Sn=m("overview"),du=m([]),In=m(""),Wr=m(!1),Tc=m(null),hu=m(!1),Ec=m(!1),ol=m(""),sl=m(""),ll=m(""),il=m(""),gi=m(!1),Ts=m(!1),Es=m(""),As=m(""),cl=m(""),Ms=m(!1),Is=m(!1),Rs=m(""),Ac=m(!1),Ls=m(!1),u6=K(()=>{const e=new Set;return Cr.value.filter(t=>{const a=t.workspace||c6(t);return e.has(a)?!1:(e.add(a),!0)})}),Fo=K(()=>Cr.value.find(e=>e.id===Ie.value)??null);async function Pl(){try{const e=await N("agents.list",{});Cr.value=e.agents,Ty.value=e.defaultId,e.agents.find(t=>t.id===Ie.value)||(Ie.value=e.defaultId||e.agents[0]?.id||"main")}catch{Cr.value=[{id:"main",name:"Main"}]}}async function zo(){Wr.value=!0,Tc.value=null;try{const e=await N("agents.files.list",{agentId:Ie.value});du.value=e.files,In.value=e.workspace}catch(e){Tc.value=ne(e),V.error(l("agents.files.loadError"))}finally{Wr.value=!1}}const Ey=["full","coding","messaging","minimal"],Ht=m(null),fh=m(!1),ph=m(!1),Ol=m(!1),Ut=m({});function Ay(e){return Ey.includes(e)}function Qu(e){return e&&Ay(e)?e:"full"}function zv(e){if(e)return typeof e=="string"?e:e.primary}function Qf(e){const t=Ht.value;if(!t)return;const a=t.agents?.list?.find(o=>o.id===e),r=zv(a?.model);return r||zv(t.agents?.defaults?.model)}function Uv(e){const t=Ut.value,a=t.profile??"full",r=t.alsoAllow??[];return(t.deny??[]).includes(e)?!1:r.includes(e)||a==="full"?!0:a==="minimal"?["read","memory_search","memory_get"].includes(e):a==="coding"?["read","write","edit","exec","process","web_search","web_fetch"].includes(e):a==="messaging"?["read","message","sessions_list","sessions_send"].includes(e):!1}function d6(e){Ut.value={...Ut.value,profile:e},Ol.value=!0}function h6(e,t){const a={...Ut.value},r=new Set(a.alsoAllow??[]),o=new Set(a.deny??[]);t?(o.delete(e),(a.profile??"full")!=="full"&&r.add(e)):(r.delete(e),o.add(e)),Ut.value={...a,alsoAllow:[...r],deny:[...o]},Ol.value=!0}async function f6(){if(Ht.value){ph.value=!0;try{const e={...Ht.value},t=[...e.agents?.list??[]],a=t.findIndex(o=>o.id===Ie.value),r={profile:Ut.value.profile,alsoAllow:Ut.value.alsoAllow?.length?Ut.value.alsoAllow:void 0,deny:Ut.value.deny?.length?Ut.value.deny:void 0};a>=0?t[a]={...t[a],tools:r}:t.push({id:Ie.value,tools:r}),e.agents={...e.agents,list:t},await N("config.apply",{config:e}),Ht.value=e,Ol.value=!1,V.success(l("actions.saved"))}catch(e){V.error(ne(e))}finally{ph.value=!1}}}const Eo=m([]),Mc=m(!1),ao=m(""),mh=m(!1),Lr=m(!1),My=m(null),Xt=m(null);function p6(e){My.value=e,Xt.value=e?[...e]:null,Lr.value=!1}async function ep(){Mc.value=!0;try{const e=await N("skills.status",{});Eo.value=e.skills}catch(e){V.error(ne(e))}finally{Mc.value=!1}}function m6(e){const t=Xt.value;if(t===null){const a=Eo.value.filter(r=>!r.disabled&&r.eligible).map(r=>r.name);Xt.value=a.filter(r=>r!==e)}else t.includes(e)?Xt.value=t.filter(a=>a!==e):Xt.value=[...t,e];Lr.value=!0}function v6(){Xt.value=null,Lr.value=!0}function g6(){Xt.value=[],Lr.value=!0}function b6(){const e=Eo.value.filter(t=>!t.disabled&&t.eligible).map(t=>t.name);Xt.value=e,Lr.value=!0}async function x6(){if(Ht.value){mh.value=!0;try{const e={...Ht.value},t=[...e.agents?.list??[]],a=t.findIndex(o=>o.id===Ie.value),r=Xt.value;a>=0?(t[a]={...t[a],skills:r??void 0},r===null&&delete t[a].skills):r!==null&&t.push({id:Ie.value,skills:r}),e.agents={...e.agents,list:t},await N("config.apply",{config:e}),Ht.value=e,My.value=Xt.value,Lr.value=!1,V.success(l("actions.saved"))}catch(e){V.error(ne(e))}finally{mh.value=!1}}}async function nn(){fh.value=!0;try{const t=(await N("config.get",{})).config,a={...t,tools:t.tools?{...t.tools,profile:Qu(t.tools.profile)}:void 0,agents:t.agents?{...t.agents,list:t.agents.list?.map(o=>({...o,tools:o.tools?{...o.tools,profile:Qu(o.tools.profile)}:void 0}))}:void 0};Ht.value=a;const r=a.agents?.list?.find(o=>o.id===Ie.value);Ut.value={profile:Qu(r?.tools?.profile??a.tools?.profile),alsoAllow:r?.tools?.alsoAllow??[],deny:r?.tools?.deny??[]},Ol.value=!1,p6(r?.skills??null)}catch(e){V.error(ne(e))}finally{fh.value=!1}}async function jv(){const e=Fo.value;e&&(Ht.value||await nn(),ol.value=e.identity?.name||e.name||"",sl.value=e.identity?.avatar||"",ll.value=In.value||"",il.value=Qf(e.id)||"",hu.value=!0)}function y6(){hu.value=!1,ol.value="",sl.value="",ll.value="",il.value=""}async function w6(){const e=Fo.value;if(e){Ec.value=!0;try{const t={agentId:e.id},a=ol.value.trim(),r=e.identity?.name||e.name||"";a&&a!==r&&(t.name=a);const o=sl.value.trim(),s=e.identity?.avatar||"";o!==s&&(t.avatar=o);const i=ll.value.trim(),c=In.value||"";i&&i!==c&&(t.workspace=i);const u=il.value.trim(),d=Qf(e.id)||"";u&&u!==d&&(t.model=u),(t.name||t.avatar!==void 0||t.workspace||t.model)&&(await N("agents.update",t),await Pl(),await zo(),V.success(l("actions.saved"))),hu.value=!1}catch(t){V.error(ne(t))}finally{Ec.value=!1}}}function k6(){Es.value="",As.value="",cl.value="",Ts.value=!0}async function S6(){const e=Es.value.trim(),t=As.value.trim();if(!e||!t){V.error(l("agents.create.requiredFields"));return}Ms.value=!0;try{const a={name:e,workspace:t};cl.value.trim()&&(a.emoji=cl.value.trim());const r=await N("agents.create",a);r.ok&&(await Pl(),Ie.value=r.agentId,await zo(),await nn(),V.success(l("agents.create.success")),Ts.value=!1)}catch(a){V.error(ne(a))}finally{Ms.value=!1}}function Hv(){Rs.value="",Ac.value=!1,Is.value=!0}async function _6(){const e=Fo.value;if(e){if(Rs.value!==e.id){V.error(l("agents.delete.confirmMismatch"));return}Ls.value=!0;try{await N("agents.delete",{agentId:e.id,deleteFiles:Ac.value}),await Pl();const t=Cr.value;t.length>0?Ie.value=t[0].id:Ie.value="main",await zo(),await nn(),V.success(l("agents.delete.success")),Is.value=!1}catch(t){V.error(ne(t))}finally{Ls.value=!1}}}async function C6(){await Pl(),await zo(),Sn.value==="tools"?await nn():Sn.value==="skills"&&(await nn(),await ep())}function Iy(e){Ie.value=e,zo(),(Sn.value==="tools"||Sn.value==="skills")&&nn()}function T6(e){Sn.value=e,e==="overview"&&!Ht.value||e==="tools"&&!Ht.value?nn():e==="skills"&&(Eo.value.length===0&&ep(),Ht.value||nn())}function Bv(e){Oe(`/agents/edit/${encodeURIComponent(e)}?agent=${Ie.value}`)}const es=m({}),E6={sm:"w-7 h-7 text-base",md:"w-8 h-8 text-lg",lg:"w-16 h-16 text-3xl"},A6={sm:"w-7 h-7",md:"w-8 h-8",lg:"w-16 h-16"};function M6(e){const t=gt.value;return t?`${t.replace(/^ws/,"http")}/avatar/${encodeURIComponent(e)}`:null}function vh({agentId:e,emoji:t="🤖",size:a="md",class:r=""}){const o=M6(e),s=es.value[e],i=E6[a],c=A6[a],u=()=>{es.value={...es.value,[e]:!0}},d=()=>{es.value={...es.value,[e]:!1}};return n("div",{class:`flex-shrink-0 relative ${r}`,children:[o&&n("img",{src:o,alt:"",class:`${c} rounded-xl object-cover border border-[var(--color-border)] ${s?"":"hidden"}`,onLoad:u,onError:d}),!s&&n("div",{class:`${i} rounded-xl bg-[var(--color-bg-tertiary)] flex items-center justify-center border border-[var(--color-border)]`,children:t})]})}function I6(){const e=Fo.value,t=u6.value,a=gi.value;if(!e)return null;const r=e.identity?.emoji||"🤖",o=e.identity?.name||e.name||e.id;return n("div",{class:"relative",children:[n("button",{type:"button",onClick:()=>gi.value=!a,class:"flex items-center gap-2 sm:gap-3 px-2 sm:px-3 py-2 rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-surface)] hover:bg-[var(--color-bg-hover)] transition-colors max-w-[180px] sm:max-w-none sm:min-w-[180px]","aria-expanded":a,"aria-haspopup":"listbox",children:[n(vh,{agentId:e.id,emoji:r,size:"md"}),n("span",{class:"flex-1 text-left font-medium truncate",children:o}),n(Ne,{class:`w-4 h-4 text-[var(--color-text-muted)] transition-transform ${a?"rotate-180":""}`})]}),a&&n(H,{children:[n("button",{type:"button",class:"fixed inset-0 z-10 cursor-default",onClick:()=>gi.value=!1,"aria-label":"Close menu"}),n("div",{class:"absolute top-full left-0 mt-1 w-full min-w-[220px] py-1 rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-surface)] shadow-lg z-20",role:"listbox",children:t.map(s=>{const i=s.identity?.emoji||"🤖",c=s.identity?.name||s.name||s.id,u=s.id===Ie.value;return n("button",{type:"button",role:"option","aria-selected":u,onClick:()=>{Iy(s.id),gi.value=!1},class:`w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-[var(--color-bg-hover)] transition-colors ${u?"bg-[var(--color-bg-tertiary)]":""}`,children:[n(vh,{agentId:s.id,emoji:i,size:"sm"}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"font-medium truncate",children:c}),c!==s.id&&n("div",{class:"text-xs text-[var(--color-text-muted)] truncate",children:s.id})]}),u&&n(on,{class:"w-4 h-4 text-[var(--color-accent)] flex-shrink-0"})]},s.id)})})]})]})}function tp({onClick:e,saving:t}){return n(P,{type:"button",onClick:e,variant:"primary",size:"sm",disabled:t,children:l(t?"common.saving":"actions.save")})}function R6(){const e=Fo.value;if(!e)return null;const t=e.id===Ty.value,a=e.identity?.name||e.name||e.id,r=e.identity?.emoji||"🤖",o=hu.value,s=Qf(e.id);return n("div",{class:"space-y-4",children:n(G,{children:n("div",{class:"p-4",children:o?n("div",{class:"space-y-4",children:[n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n("div",{children:[n("label",{htmlFor:"edit-name",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:l("common.name")}),n(Y,{id:"edit-name",type:"text",value:ol.value,onInput:i=>ol.value=i.target.value,placeholder:l("agents.overview.namePlaceholder"),class:"mt-1",fullWidth:!0})]}),n("div",{children:[n("label",{htmlFor:"edit-avatar",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:l("agents.overview.avatar")}),n(Y,{id:"edit-avatar",type:"text",value:sl.value,onInput:i=>sl.value=i.target.value,placeholder:l("agents.overview.avatarPlaceholder"),class:"mt-1",fullWidth:!0})]})]}),n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n("div",{children:[n("label",{htmlFor:"edit-workspace",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:l("common.workspace")}),n(Y,{id:"edit-workspace",type:"text",value:ll.value,onInput:i=>ll.value=i.target.value,placeholder:l("agents.overview.workspacePlaceholder"),class:"mt-1 font-mono text-sm",fullWidth:!0})]}),n("div",{children:[n("label",{htmlFor:"edit-model",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:l("common.model")}),n(Y,{id:"edit-model",type:"text",value:il.value,onInput:i=>il.value=i.target.value,placeholder:l("agents.overview.modelPlaceholder"),class:"mt-1 font-mono text-sm",fullWidth:!0})]})]}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:l("agents.overview.editHint")}),n("div",{class:"flex gap-2",children:[n(tp,{onClick:w6,saving:Ec.value}),n("button",{type:"button",onClick:y6,disabled:Ec.value,class:"px-3 py-1.5 text-sm font-medium text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)] rounded-lg",children:l("actions.cancel")})]})]}):n("div",{class:"flex flex-col sm:flex-row sm:items-center gap-4",children:[n("div",{class:"flex items-center gap-3 sm:gap-4",children:[n(vh,{agentId:e.id,emoji:r,size:"lg"}),n("div",{class:"flex-1 min-w-0 sm:hidden",children:n("div",{class:"flex items-center gap-2 flex-wrap",children:[n("h3",{class:"text-lg font-semibold truncate max-w-[150px]",children:a}),n("span",{class:"text-xl flex-shrink-0",title:l("agents.overview.identityEmoji"),children:r}),t&&n(Z,{variant:"info",size:"sm",children:l("common.defaultAgent")})]})}),n("div",{class:"flex items-center gap-1 sm:hidden ml-auto",children:[n(q,{icon:n(po,{class:"w-4 h-4"}),label:l("common.edit"),onClick:jv,variant:"ghost"}),Ie.value!=="main"&&n(q,{icon:n(bt,{class:"w-4 h-4"}),label:l("actions.delete"),onClick:Hv,variant:"ghost",class:"text-[var(--color-error)] hover:bg-[var(--color-error)]/10"})]})]}),n("div",{class:"hidden sm:block flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("h3",{class:"text-lg font-semibold truncate",children:a}),n("span",{class:"text-xl",title:l("agents.overview.identityEmoji"),children:r}),t&&n(Z,{variant:"info",size:"sm",children:l("common.defaultAgent")})]}),n("div",{class:"flex items-center gap-3 mt-1 text-sm text-[var(--color-text-muted)]",children:[n("span",{class:"font-mono truncate",title:In.value,children:In.value||"—"}),s&&n(H,{children:[n("span",{children:"•"}),n("span",{class:"truncate",title:s,children:s})]})]})]}),n("div",{class:"sm:hidden text-sm text-[var(--color-text-muted)] space-y-1",children:[n("div",{class:"font-mono truncate",title:In.value,children:In.value||"—"}),s&&n("div",{class:"truncate",title:s,children:s})]}),n("div",{class:"hidden sm:flex items-center gap-1",children:[n(q,{icon:n(po,{class:"w-4 h-4"}),label:l("common.edit"),onClick:jv,variant:"ghost"}),Ie.value!=="main"&&n(q,{icon:n(bt,{class:"w-4 h-4"}),label:l("actions.delete"),onClick:Hv,variant:"ghost",class:"text-[var(--color-error)] hover:bg-[var(--color-error)]/10"})]})]})})})})}const jr={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]+$/},L6=new RegExp(`(\\s+|${jr.punctuation.source}+)`),$6=6,D6=3,P6=[{pattern:/[äöüßẞ]/i,averageCharsPerToken:3},{pattern:/[éèêëàâîïôûùüÿçœæáíóúñ]/i,averageCharsPerToken:3},{pattern:/[ąćęłńóśźżěščřžýůúďťň]/i,averageCharsPerToken:3.5}];function Ry(e,t={}){if(!e)return 0;const{defaultCharsPerToken:a=$6,languageConfigs:r=P6}=t,o=e.split(L6).filter(Boolean);let s=0;for(const i of o)s+=O6(i,r,a);return s}function O6(e,t,a){if(jr.whitespace.test(e))return 0;if(jr.cjk.test(e))return N6(e);if(jr.numeric.test(e)||e.length<=D6)return 1;if(jr.punctuation.test(e))return e.length>1?Math.ceil(e.length/2):1;if(jr.alphanumeric.test(e)){const o=Wv(e,t)??a;return Math.ceil(e.length/o)}const r=Wv(e,t)??a;return Math.ceil(e.length/r)}function Wv(e,t){for(const a of t)if(a.pattern.test(e))return a.averageCharsPerToken}function N6(e){return Array.from(e).length}function Ic(e){return e.toLowerCase()==="memory.md"?"MEMORY.md":e}const Ly={"AGENTS.md":{icon:"📋",description:"agents.files.meta.agents"},"SOUL.md":{icon:"🎭",description:"agents.files.meta.soul"},"TOOLS.md":{icon:"🛠️",description:"agents.files.meta.tools"},"IDENTITY.md":{icon:"🪪",description:"agents.files.meta.identity"},"USER.md":{icon:"👤",description:"agents.files.meta.user"},"HEARTBEAT.md":{icon:"💓",description:"agents.files.meta.heartbeat"},"BOOTSTRAP.md":{icon:"🚀",description:"agents.files.meta.bootstrap"},"MEMORY.md":{icon:"🧠",description:"agents.files.meta.memory"}},Kv=["AGENTS.md","SOUL.md","TOOLS.md","IDENTITY.md","USER.md","HEARTBEAT.md","MEMORY.md","BOOTSTRAP.md"],F6=["BOOTSTRAP.md"];function $y(e){return e.missing?0:e.content?Ry(e.content):e.size!=null?Math.round(e.size/4):0}const qv=K(()=>du.value.reduce((e,t)=>e+$y(t),0));function z6({file:e}){const t=Ic(e.name),a=Ly[t]??{icon:"📄",description:"agents.files.meta.unknown"},r=F6.includes(t),o=e.missing&&!r,s=$y(e);return n(G,{padding:"md",class:"hover:bg-[var(--color-bg-hover)] transition-colors cursor-pointer",onClick:()=>Bv(e.name),children:n("div",{class:"flex items-center gap-4",children:[n("div",{class:"text-2xl flex-shrink-0","aria-hidden":"true",children:a.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(Z,{variant:"warning",size:"sm",children:[n(Aa,{class:"w-3 h-3 mr-1"}),l("agents.files.missing")]})]}),n("p",{class:"text-sm text-[var(--color-text-muted)] truncate",children:l(a.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&&Ks(e.size),s>0&&` · ${co(s)} tokens`,e.updatedAtMs&&` · ${Xi(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&&Ks(e.size)}),n("span",{class:"w-24 text-right",children:s>0&&`${co(s)} tokens`}),n("span",{class:"w-12 text-right",children:e.updatedAtMs&&Xi(e.updatedAtMs)})]}),n(q,{icon:e.missing?n(Sa,{class:"w-4 h-4"}):n(po,{class:"w-4 h-4"}),label:e.missing?l("common.create"):l("common.edit"),onClick:i=>{i.stopPropagation(),Bv(e.name)},variant:"ghost"})]})})}function U6(){const e=[...du.value].sort((t,a)=>{const r=Ic(t.name),o=Ic(a.name),s=Kv.indexOf(r),i=Kv.indexOf(o);return(s===-1?999:s)-(i===-1?999:i)});return n("div",{class:"space-y-4",children:[n("div",{class:"space-y-2",children:e.map(t=>n(z6,{file:t},t.name))}),qv.value>0&&n("div",{class:"flex justify-center",children:n(Z,{variant:"default",size:"md",children:l("agents.files.totalTokens",{count:co(qv.value)})})}),n(Jn,{title:l("agents.files.memoryHint.title"),children:n("ul",{class:"list-disc list-inside space-y-1 text-sm",children:[n("li",{children:l("agents.files.memoryHint.line1")}),n("li",{children:l("agents.files.memoryHint.line2")})]})})]})}const j6={full:"agents.tools.profiles.full",coding:"agents.tools.profiles.coding",messaging:"agents.tools.profiles.messaging",minimal:"agents.tools.profiles.minimal"},ed=[{id:"fs",labelKey:"common.files",tools:[{id:"read",label:"read",descriptionKey:"agents.tools.toolDescriptions.read"},{id:"write",label:"write",descriptionKey:"agents.tools.toolDescriptions.write"},{id:"edit",label:"edit",descriptionKey:"agents.tools.toolDescriptions.edit"}]},{id:"runtime",labelKey:"agents.tools.sections.runtime",tools:[{id:"exec",label:"exec",descriptionKey:"agents.tools.toolDescriptions.exec"},{id:"process",label:"process",descriptionKey:"agents.tools.toolDescriptions.process"}]},{id:"web",labelKey:"agents.tools.sections.web",tools:[{id:"web_search",label:"web_search",descriptionKey:"agents.tools.toolDescriptions.webSearch"},{id:"web_fetch",label:"web_fetch",descriptionKey:"agents.tools.toolDescriptions.webFetch"},{id:"browser",label:"browser",descriptionKey:"agents.tools.toolDescriptions.browser"}]},{id:"memory",labelKey:"agents.tools.sections.memory",tools:[{id:"memory_search",label:"memory_search",descriptionKey:"agents.tools.toolDescriptions.memorySearch"},{id:"memory_get",label:"memory_get",descriptionKey:"agents.tools.toolDescriptions.memoryGet"}]},{id:"sessions",labelKey:"common.sessions",tools:[{id:"sessions_list",label:"sessions_list",descriptionKey:"agents.tools.toolDescriptions.sessionsList"},{id:"sessions_send",label:"sessions_send",descriptionKey:"agents.tools.toolDescriptions.sessionsSend"},{id:"sessions_spawn",label:"sessions_spawn",descriptionKey:"agents.tools.toolDescriptions.sessionsSpawn"}]},{id:"automation",labelKey:"agents.tools.sections.automation",tools:[{id:"message",label:"message",descriptionKey:"agents.tools.toolDescriptions.message"},{id:"cron",label:"cron",descriptionKey:"agents.tools.toolDescriptions.cron"},{id:"gateway",label:"gateway",descriptionKey:"agents.tools.toolDescriptions.gateway"},{id:"nodes",label:"nodes",descriptionKey:"agents.tools.toolDescriptions.nodes"}]}];function H6(){if(fh.value)return n("div",{class:"flex justify-center py-12",children:n(te,{size:"lg"})});const e=Ut.value.profile??"full",t=ed.flatMap(r=>r.tools).filter(r=>Uv(r.id)).length,a=ed.flatMap(r=>r.tools).length;return n("div",{class:"space-y-4",children:[n(G,{children:[n("div",{class:"p-4 border-b border-[var(--color-border)] flex items-center justify-between",children:[n("div",{children:[n("h3",{class:"text-base font-semibold",children:l("common.tools")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("agents.tools.enabled",{count:`${t}/${a}`})})]}),Ol.value&&n(tp,{onClick:f6,saving:ph.value})]}),n("div",{class:"p-4",children:[n("span",{class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:l("agents.tools.profile")}),n(Me,{value:e,options:Ey.map(r=>({value:r,label:l(j6[r])})),onChange:r=>{Ay(r)&&d6(r)},class:"mt-2 w-full","aria-label":l("agents.tools.profile")})]})]}),ed.map(r=>n(G,{children:[n("div",{class:"p-4 border-b border-[var(--color-border)]",children:n("h4",{class:"text-sm font-semibold",children:l(r.labelKey)})}),n("div",{class:"divide-y divide-[var(--color-border)]",children:r.tools.map(o=>{const s=Uv(o.id);return n("div",{class:"p-4 flex items-center justify-between gap-4 hover:bg-[var(--color-bg-hover)]",children:[n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("code",{class:"text-sm font-medium",children:o.label}),s?n(Lo,{class:"w-4 h-4 text-[var(--color-success)]"}):n(Er,{class:"w-4 h-4 text-[var(--color-text-muted)]"})]}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:l(o.descriptionKey)})]}),n(Be,{checked:s,onChange:i=>h6(o.id,i)})]},o.id)})})]},r.id))]})}function B6(){const e=Eo.value.filter(u=>!u.disabled&&u.eligible),t=Xt.value,a=t!==null,r=new Set(t??[]),o=ao.value.toLowerCase().trim(),s=o?e.filter(u=>u.name.toLowerCase().includes(o)||u.description.toLowerCase().includes(o)||u.skillKey.toLowerCase().includes(o)):e,i=a?t.length:e.length;function c(u){return a?r.has(u):!0}return Mc.value&&Eo.value.length===0?n("div",{class:"flex justify-center py-12",children:n(te,{size:"lg"})}):n("div",{class:"space-y-4",children:[n(G,{children:n("div",{class:"p-4",children:[n("div",{class:"flex items-center justify-between gap-4",children:[n("div",{children:[n("h3",{class:"text-base font-semibold",children:l("agents.skills.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:a?l("agents.skills.usingAllowlist",{allowed:i,total:e.length}):l("agents.skills.usingAll",{count:e.length})})]}),n("div",{class:"flex items-center gap-2",children:[Lr.value&&n(tp,{onClick:x6,saving:mh.value}),n(q,{icon:n(Xe,{class:Mc.value?"animate-spin":""}),label:l("actions.refresh"),onClick:()=>{ep(),nn()},variant:"ghost"})]})]}),n("div",{class:"mt-4 flex flex-wrap gap-2",children:[n("button",{type:"button",onClick:v6,disabled:!a,class:`px-3 py-1.5 text-sm rounded-lg border transition-colors ${a?"border-[var(--color-border)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]":"bg-[var(--color-accent)]/10 border-[var(--color-accent)] text-[var(--color-accent)]"}`,children:l("agents.skills.useAll")}),n("button",{type:"button",onClick:b6,class:"px-3 py-1.5 text-sm rounded-lg border border-[var(--color-border)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]",children:l("agents.skills.selectAll")}),n("button",{type:"button",onClick:g6,class:"px-3 py-1.5 text-sm rounded-lg border border-[var(--color-border)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]",children:l("agents.skills.selectNone")})]}),n("div",{class:"mt-4 relative",children:[n(it,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Y,{id:"skills-search",type:"text",value:ao.value,onInput:u=>ao.value=u.target.value,placeholder:l("common.searchSkills"),class:"pl-9",fullWidth:!0,"aria-label":l("common.searchSkills")})]})]})}),s.length===0?n(G,{children:n("div",{class:"p-8 text-center text-[var(--color-text-muted)]",children:l(o?"agents.skills.noSearchResults":"agents.skills.noSkills")})}):n(G,{padding:"none",children:s.map(u=>{const d=c(u.name);return n("div",{class:"flex items-center gap-3 px-4 py-3 border-b border-[var(--color-border)] last:border-b-0 hover:bg-[var(--color-bg-tertiary)]",children:[n("span",{class:"text-xl w-8 text-center flex-shrink-0",children:u.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:u.name}),u.always&&n("span",{class:"text-xs text-[var(--color-text-muted)]",title:l("common.alwaysActive"),children:"⚡"})]}),n("p",{class:"text-xs text-[var(--color-text-muted)] truncate",children:u.description})]}),n("a",{href:`/skills?skill=${encodeURIComponent(u.skillKey)}`,onClick:h=>{h.preventDefault(),Oe(`/skills?skill=${encodeURIComponent(u.skillKey)}`)},class:"text-xs text-[var(--color-accent)] hover:underline flex-shrink-0",children:l("agents.skills.details")}),n(Be,{checked:d,onChange:()=>m6(u.name)})]},u.skillKey)})}),n(Jn,{children:[n("strong",{children:l("agents.skills.useAll")})," ",l("agents.skills.useAllHint"),n("br",{}),n("strong",{children:l("agents.skills.selectSpecific")})," ",l("agents.skills.selectSpecificHint"),n("br",{}),l("agents.skills.globalHint")," ",n("a",{href:"/skills",class:"text-[var(--color-accent)] hover:underline",children:l("common.skills")})," ",l("agents.skills.page"),"."]})]})}function W6(){return n(We,{open:Ts.value,onClose:()=>Ts.value=!1,title:l("common.createAgent"),children:n("div",{class:"space-y-4",children:[n("div",{children:[n("label",{htmlFor:"create-name",class:"text-sm font-medium",children:l("common.name")}),n(Y,{id:"create-name",type:"text",value:Es.value,onInput:e=>Es.value=e.target.value,placeholder:l("agents.create.namePlaceholder"),class:"mt-1",fullWidth:!0}),n("p",{class:"mt-1 text-xs text-[var(--color-text-muted)]",children:l("agents.create.nameHint")})]}),n("div",{children:[n("label",{htmlFor:"create-workspace",class:"text-sm font-medium",children:l("common.workspace")}),n(Y,{id:"create-workspace",type:"text",value:As.value,onInput:e=>As.value=e.target.value,placeholder:l("agents.create.workspacePlaceholder"),class:"mt-1 font-mono text-sm",fullWidth:!0})]}),n("div",{children:[n("label",{htmlFor:"create-emoji",class:"text-sm font-medium",children:l("agents.create.emoji")}),n(Y,{id:"create-emoji",type:"text",value:cl.value,onInput:e=>cl.value=e.target.value,placeholder:l("agents.create.emojiPlaceholder"),class:"mt-1",fullWidth:!0})]}),n("div",{class:"flex justify-end gap-2 pt-2",children:[n(P,{variant:"ghost",onClick:()=>Ts.value=!1,disabled:Ms.value,children:l("actions.cancel")}),n(P,{variant:"primary",onClick:S6,disabled:Ms.value||!Es.value.trim()||!As.value.trim(),children:Ms.value?l("actions.creating"):l("common.createAgent")})]})]})})}function K6(){const e=Fo.value;return n(We,{open:Is.value,onClose:()=>Is.value=!1,title:l("common.deleteAgent"),children:n("div",{class:"space-y-4",children:[n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 border border-[var(--color-error)]/20",children:n("div",{class:"flex items-start gap-3",children:[n(Aa,{class:"w-6 h-6 text-[var(--color-error)] flex-shrink-0 mt-0.5"}),n("div",{children:[n("h4",{class:"font-semibold text-[var(--color-error)]",children:l("agents.delete.warning")}),n("p",{class:"mt-1 text-sm text-[var(--color-text-secondary)]",children:l("agents.delete.warningDescription")})]})]})}),n("div",{class:"text-sm",children:[n("p",{class:"font-medium mb-2",children:l("agents.delete.willDelete")}),n("ul",{class:"list-disc list-inside space-y-1 text-[var(--color-text-secondary)]",children:[n("li",{children:l("agents.delete.willDeleteConfig")}),n("li",{children:l("agents.delete.willDeleteBindings")}),n("li",{children:l("agents.delete.willDeleteSessions")})]})]}),n("div",{class:"p-3 rounded-lg border border-[var(--color-border)]",children:n(nx,{checked:Ac.value,onChange:t=>Ac.value=t,label:l("agents.delete.includeFiles"),description:l("agents.delete.includeFilesDescription",{path:In.value}),class:"text-[var(--color-error)]"})}),n("div",{children:[n("label",{htmlFor:"delete-confirm",class:"text-sm font-medium",children:l("agents.delete.confirmPrompt",{id:e?.id||"agent"})}),n(Y,{id:"delete-confirm",type:"text",value:Rs.value,onInput:t=>Rs.value=t.target.value,placeholder:e?.id||"agent",class:"mt-1 font-mono",fullWidth:!0})]}),n("div",{class:"flex justify-end gap-2 pt-2",children:[n(P,{variant:"ghost",onClick:()=>Is.value=!1,disabled:Ls.value,children:l("actions.cancel")}),n(P,{variant:"danger",onClick:_6,disabled:Ls.value||Rs.value!==e?.id,children:Ls.value?l("actions.deleting"):l("common.deleteAgent")})]})]})})}const q6=[{id:"overview",label:"common.overview",icon:n(Ub,{class:"w-4 h-4"})},{id:"files",label:"common.files",icon:n(Dn,{class:"w-4 h-4"})},{id:"tools",label:"common.tools",icon:n(Hb,{class:"w-4 h-4"})},{id:"skills",label:"common.skills",icon:n(Xc,{class:"w-4 h-4"})}];function V6(e){const t=!Wr.value&&Cr.value.length>0,[a,r]=fe("agent"),[o,s]=fe("tab"),[i,c]=fe("q");He(a,Ie,d=>d),He(o,Sn,d=>d),He(i,ao,d=>d),Ln(Ie,r,"main"),Ln(Sn,s,"overview"),R(()=>{Sn.value==="skills"?c(ao.value||null):i.value&&c(null)},[ao.value,Sn.value]),R(()=>{if(t&&a.value){const d=Cr.value.find(h=>h.id===a.value);d&&Ie.value!==d.id&&Iy(d.id)}},[a.value,t]),R(()=>{D.value&&Pl().then(()=>{zo(),nn()})},[D.value]);const u=Sn.value;return n(sn,{viewName:l("common.agents"),children:[n(Wt,{title:l("common.agents"),subtitle:l("agents.description"),actions:n("div",{class:"flex items-center gap-3",children:[n(I6,{}),n(q,{icon:n(Sa,{class:"w-4 h-4"}),label:l("common.createAgent"),onClick:k6,disabled:!D.value,variant:"ghost"}),n(q,{icon:n(Xe,{class:`w-4 h-4 ${Wr.value?"animate-spin":""}`}),label:l("actions.refresh"),onClick:C6,disabled:Wr.value||!D.value,variant:"ghost"})]})}),n(Jf,{items:q6.map(d=>({...d,label:l(d.label)})),activeId:u,onChange:d=>T6(d)}),Tc.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Tc.value}),Wr.value&&du.value.length===0?n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg"})}):n(H,{children:[u==="overview"&&n(R6,{}),u==="files"&&n(U6,{}),u==="tools"&&n(H6,{}),u==="skills"&&n(B6,{})]}),In.value&&n("p",{class:"text-xs text-[var(--color-text-muted)] text-center",children:In.value}),n(W6,{}),n(K6,{})]})}const Tt=m(null),Dy=m("main"),fu=m(""),Et=m(""),Hn=m("view"),gh=m(!1),$s=m(!1),Rc=m(null),us=K(()=>Et.value!==fu.value),G6=K(()=>{const e=Tt.value?.name??"",t=Ic(e);return Ly[t]??{icon:"📄",description:"agents.files.meta.unknown"}});function J6(){return new URLSearchParams(window.location.search).get("agent")||"main"}async function Y6(e,t){gh.value=!0,Rc.value=null,Dy.value=t;try{const a=await N("agents.files.get",{agentId:t,name:e});Tt.value=a.file;const r=a.file.content??"";fu.value=r,Et.value=r,Hn.value=a.file.missing||!r?"edit":"view"}catch(a){Rc.value=a instanceof Error?a.message:l("agents.files.loadFileError"),V.error(l("agents.files.loadFileError"))}finally{gh.value=!1}}async function Vv(){if(Tt.value){$s.value=!0;try{await N("agents.files.set",{agentId:Dy.value,name:Tt.value.name,content:Et.value}),fu.value=Et.value,Tt.value={...Tt.value,missing:!1,content:Et.value,size:new Blob([Et.value]).size,updatedAtMs:Date.now()},V.success(l("agents.files.saved"))}catch{V.error(l("agents.files.saveError"))}finally{$s.value=!1}}}function Z6(){us.value&&!window.confirm(l("agents.files.unsavedWarning"))||(Tt.value=null,fu.value="",Et.value="",Hn.value="view",Oe("/agents"))}function Gv({active:e,onClick:t,icon:a,label:r,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:[a,r,o&&n("span",{class:"w-1.5 h-1.5 rounded-full bg-[var(--color-warning)]"})]})}function X6({filename:e}){const t=e?decodeURIComponent(e):"";return R(()=>{if(D.value&&t){const a=J6();Y6(t,a)}},[D.value,t]),R(()=>{function a(r){(r.metaKey||r.ctrlKey)&&r.key==="s"&&(r.preventDefault(),Hn.value==="edit"&&us.value&&!$s.value&&Vv())}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[]),n(ru,{viewName:t||l("common.agents"),children:n("div",{class:"flex-1 flex flex-col overflow-hidden",children:[n("div",{class:"flex items-center justify-between gap-4 px-4 sm:px-6 py-3 border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[n("div",{class:"flex items-center gap-3 min-w-0",children:[n(q,{icon:n(qc,{class:"w-4 h-4"}),label:l("agents.files.backToList"),onClick:Z6,variant:"ghost"}),n("div",{class:"flex items-center gap-2 min-w-0",children:[n("span",{class:"text-xl","aria-hidden":"true",children:G6.value.icon}),n("h1",{class:"font-semibold truncate",children:e}),us.value&&n(Z,{variant:"warning",size:"sm",children:l("agents.files.unsaved")})]})]}),n("div",{class:"flex items-center gap-2",children:[Tt.value&&!Tt.value.missing&&n("span",{class:"hidden sm:block text-sm text-[var(--color-text-muted)]",children:[Tt.value.size!=null&&Ks(Tt.value.size),Et.value&&n(H,{children:[" • ",co(Ry(Et.value))," tokens"]}),Tt.value.updatedAtMs&&n(H,{children:[" • ",Xi(Tt.value.updatedAtMs)]})]}),Hn.value==="edit"&&n(P,{variant:"primary",size:"sm",icon:n(pf,{class:"w-4 h-4"}),onClick:Vv,disabled:!us.value||$s.value,children:$s.value?l("common.saving"):l("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(Gv,{active:Hn.value==="view",onClick:()=>Hn.value="view",icon:n(df,{class:"w-4 h-4"}),label:l("agents.files.view")}),n(Gv,{active:Hn.value==="edit",onClick:()=>Hn.value="edit",icon:n(po,{class:"w-4 h-4"}),label:l("common.edit"),indicator:us.value})]}),n("div",{class:"flex-1 overflow-y-auto",children:[Rc.value&&n("div",{class:"m-4 p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Rc.value}),gh.value?n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg"})}):Hn.value==="view"?n("div",{class:"p-4 sm:p-6 max-w-4xl mx-auto",children:Et.value?n(Ll,{content:Et.value}):n("p",{class:"text-[var(--color-text-muted)] italic",children:l("agents.files.emptyFile")})}):n("div",{class:"p-4 sm:p-6 h-full",children:n(tr,{value:Et.value,onInput:a=>Et.value=a.target.value,placeholder:l("agents.files.editPlaceholder"),class:"font-mono text-sm h-full min-h-[400px] resize-none",fullWidth:!0})})]})]})})}function Q6(e){const t=Math.floor(e/1e3),a=Math.floor(t/60),r=Math.floor(a/60),o=Math.floor(r/24);if(o>0){const s=r%24;return`${o}d ${s}h`}if(r>0){const s=a%60;return`${r}h ${s}m`}return a>0?`${a}m`:`${t}s`}function st(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 ul(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 eM({healthData:e}){const t=Hh.value;return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-accent)]/10",children:n(pr,{class:"w-5 h-5 text-[var(--color-accent)]"})}),n("h3",{class:"font-semibold",children:l("common.gateway")}),jt.value&&n(Z,{variant:"default",size:"sm",class:"ml-auto",children:eb(jt.value)})]}),n("div",{class:"grid grid-cols-2 gap-4",children:[n("div",{class:"flex items-center gap-2",children:[n(ge,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:l("common.uptime")}),n("div",{class:"font-medium",children:t!=null?Q6(t):"-"})]})]}),n("div",{class:"flex items-center gap-2",children:[n(pa,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:l("common.sessions")}),n("div",{class:"font-medium",children:e?.sessions?.count??"-"})]})]})]}),(vs.value||gs.value)&&n("div",{class:"mt-4 pt-4 border-t border-[var(--color-border)] space-y-2",children:[vs.value&&n("div",{class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)]",children:[n(Dn,{class:"w-3.5 h-3.5"}),n("span",{class:"truncate font-mono",children:vs.value})]}),gs.value&&n("div",{class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)]",children:[n(M4,{class:"w-3.5 h-3.5"}),n("span",{class:"truncate font-mono",children:gs.value})]})]})]})}function tM({usage:e,isLoading:t}){if(!e)return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-success)]/10",children:n(Ld,{class:"w-5 h-5 text-[var(--color-success)]"})}),n("h3",{class:"font-semibold",children:l("usage.summary.title")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l(t?"common.loading":"usage.summary.unavailable")})]});const a=e.totals;return n(G,{padding:"md",children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-3",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-success)]/10",children:n(Ld,{class:"w-5 h-5 text-[var(--color-success)]"})}),n("div",{children:[n("h3",{class:"font-semibold",children:l("usage.summary.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("usage.summary.period",{days:e.days})})]})]}),a.totalCost>0&&n("div",{class:"text-right",children:[n("div",{class:"text-2xl font-bold text-[var(--color-success)]",children:ul(a.totalCost)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("common.totalCost")})]})]}),n("div",{class:"grid grid-cols-3 gap-4",children:[n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:l("common.input")}),n("div",{class:"font-medium",children:st(a.input)})]}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:l("common.output")}),n("div",{class:"font-medium",children:st(a.output)})]}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:l("common.total")}),n("div",{class:"font-medium",children:st(a.totalTokens)})]})]}),(a.cacheRead>0||a.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:l("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:l("usage.summary.cacheRead")}),n("div",{class:"font-medium",children:st(a.cacheRead)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("usage.summary.cacheWrite")}),n("div",{class:"font-medium",children:st(a.cacheWrite)})]})]})]})]})}function nM({usage:e}){if(!e||e.daily.length===0)return null;const t=e.daily.slice(-14),a=Math.max(...t.map(r=>r.totalTokens),1);return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(Ro,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:l("usage.daily.title")})]}),n("div",{class:"space-y-2",children:t.map(r=>{const o=r.totalTokens/a*100,i=new Date(r.date).toLocaleDateString(void 0,{month:"short",day:"numeric"});return n("div",{class:"flex items-center gap-3",children:[n("div",{class:"w-20 text-xs text-[var(--color-text-muted)] truncate",children:i}),n("div",{class:"flex-1 h-4 bg-[var(--color-bg-tertiary)] rounded-full overflow-hidden",children:n("div",{class:"h-full bg-[var(--color-accent)] rounded-full transition-all",style:{width:`${Math.max(o,1)}%`}})}),n("div",{class:"w-16 text-xs text-right font-mono",children:st(r.totalTokens)})]},r.date)})})]})}function aM({healthData:e}){return!e?.agents||e.agents.length===0?null:n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-warning)]/10",children:n(sc,{class:"w-5 h-5 text-[var(--color-warning)]"})}),n("h3",{class:"font-semibold",children:l("common.agents")})]}),n("div",{class:"space-y-3",children:e.agents.map(t=>n("div",{class:"flex items-center justify-between py-2 px-3 bg-[var(--color-bg-secondary)] rounded-lg",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:"font-medium",children:t.name||t.agentId}),t.isDefault&&n(Z,{variant:"success",size:"sm",children:l("common.default")})]}),n("div",{class:"flex items-center gap-4 text-sm text-[var(--color-text-muted)]",children:[n("span",{children:[t.sessions.count," ",l("usage.agents.sessions")]}),t.heartbeat.enabled&&n("span",{class:"flex items-center gap-1",children:[n(Nn,{class:"w-3.5 h-3.5"}),t.heartbeat.every]})]})]},t.agentId))})]})}const Wi=m(null),Ki=m(null),lr=m(L1()),ua=m(null),Ds=m(!1),Ps=m(!1),qi=m(!1),Lc=m(null),Py=[7,14,30,90],Kn=m(30),bh=m("gateway"),Kr=m("recent"),ts=m(!0),Dt=m(0),ea=5,xh=m("overview"),dl=m(null),hl=m([]),Os=m(!1),Ns=m(!1);function rM(){const e=-new Date().getTimezoneOffset(),t=e>=0?"+":"-",a=Math.abs(e),r=Math.floor(a/60),o=a%60;return`UTC${t}${r}${o===0?"":`:${String(o).padStart(2,"0")}`}`}async function oM(){Ds.value=!0,Lc.value=null;try{const e=await N("health",{probe:!1});Wi.value=e}catch(e){Lc.value=ne(e),V.error(l("usage.loadError"))}finally{Ds.value=!1}}async function Oy(e=30){Ps.value=!0,Kn.value=e;try{const t=await N("usage.cost",{days:e});Ki.value=t}catch(t){M.usage.warn("Failed to load usage cost summary",{days:e,err:t})}finally{Ps.value=!1}Ny(e)}async function Ny(e=30){if(!qi.value){qi.value=!0;try{const t=new Date,a=new Date;a.setDate(a.getDate()-e);const r=bh.value,o=r==="specific"?rM():void 0,s=await N("sessions.usage",{startDate:a.toISOString().split("T")[0],endDate:t.toISOString().split("T")[0],limit:100,includeContextWeight:!0,mode:r,...o?{utcOffset:o}:{}});lr.value=s,s&&$1(s)}catch(t){M.usage.warn("Failed to load sessions usage",{days:e,err:t}),lr.value||(lr.value=null)}finally{qi.value=!1}}}async function Fy(){await Promise.all([oM(),Oy(Kn.value)])}async function sM(e){if(!Os.value){Os.value=!0,dl.value=null;try{const t=await N("sessions.usage.timeseries",{key:e});dl.value=t}catch(t){M.usage.warn("Failed to load session usage timeseries",{key:e,err:t})}finally{Os.value=!1}}}async function lM(e){if(!Ns.value){Ns.value=!0,hl.value=[];try{const t=await N("sessions.usage.logs",{key:e,limit:100});hl.value=t?.logs??[]}catch(t){M.usage.warn("Failed to load session usage logs",{key:e,err:t})}finally{Ns.value=!1}}}function iM(){ua.value=null,xh.value="overview",dl.value=null,hl.value=[]}function cM(){const e=lr.value!==null&&lr.value.sessions.length>0,[t,a,r]=fe("session",{ready:e}),[o,s]=fe("days"),[i,c]=fe("sort");R(()=>{if(!o.value)return;const u=parseInt(o.value,10);Py.includes(u)&&Kn.value!==u&&(Kn.value=u)},[o.value]),He(i,Kr,u=>u),R(()=>{s(Kn.value===30?null:String(Kn.value))},[Kn.value]),Ln(Kr,c,"recent"),R(()=>{if(!e||!t.value)return;const u=lr.value?.sessions.find(d=>d.key===t.value);u&&ua.value?.key!==u.key&&(ua.value=u)},[t.value,e]),R(()=>{r.value&&a(ua.value?.key??null)},[ua.value,r.value])}function uM(){R(()=>{D.value&&Fy()},[D.value])}function dM(){const e=lr.value,t=ua.value,a=qi.value;if(!e&&a)return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(ca,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:l("common.sessions")}),n(te,{size:"sm"})]}),n("div",{class:"space-y-3",children:[1,2,3].map(d=>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"})]})]},d))})]});if(!e||e.sessions.length===0)return n(G,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(ca,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:l("common.sessions")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("usage.sessions.noData")})]});const r=[...e.sessions].sort((d,h)=>{const f=Kr.value,p=ts.value;let v=0;return f==="cost"?v=(d.usage.totalCost||0)-(h.usage.totalCost||0):f==="tokens"?v=(d.usage.totalTokens||0)-(h.usage.totalTokens||0):f==="recent"&&(v=(d.updatedAt||0)-(h.updatedAt||0)),p?-v:v}),o=r.slice(Dt.value*ea,(Dt.value+1)*ea),s=d=>{Kr.value===d?ts.value=!ts.value:(Kr.value=d,ts.value=!0),Dt.value=0},i=({col:d})=>Kr.value!==d?null:ts.value?n(Ne,{class:"w-3 h-3 inline ml-1"}):n(Tl,{class:"w-3 h-3 inline ml-1"}),c=d=>{ua.value=t?.key===d.key?null:d},u=()=>r.length>ea?n("div",{class:"mt-4 flex items-center justify-between",children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:l("usage.sessions.showing",{from:Dt.value*ea+1,to:Math.min((Dt.value+1)*ea,r.length),total:r.length})}),n("div",{class:"flex items-center gap-1",children:[n(q,{icon:n(Tb,{class:"w-4 h-4"}),label:l("actions.previous"),onClick:()=>{Dt.value=Math.max(0,Dt.value-1)},disabled:Dt.value===0,variant:"ghost",size:"sm"}),n("span",{class:"px-2 text-sm text-[var(--color-text-muted)]",children:[Dt.value+1," / ",Math.ceil(r.length/ea)]}),n(q,{icon:n(Ve,{class:"w-4 h-4"}),label:l("actions.next"),onClick:()=>{Dt.value=Math.min(Math.ceil(r.length/ea)-1,Dt.value+1)},disabled:Dt.value>=Math.ceil(r.length/ea)-1,variant:"ghost",size:"sm"})]})]}):null;return n(H,{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(ca,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:l("common.sessions")}),a&&n(te,{size:"sm"})]}),o.map(d=>n(No,{icon:Pn,iconVariant:t?.key===d.key?"info":"default",title:d.label||d.key,subtitle:d.model||void 0,meta:[{icon:Nn,value:st(d.usage.totalTokens)},{icon:Ld,value:ul(d.usage.totalCost)},...d.updatedAt?[{icon:ge,value:ae(new Date(d.updatedAt),{relative:!0})}]:[]],onClick:()=>c(d)},d.key)),n(u,{})]}),n(G,{padding:"md",class:"hidden md:block",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(ca,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:l("common.sessions")}),a&&n(te,{size:"sm"})]}),n("div",{class:"overflow-x-auto",children:n("table",{class:"w-full text-sm",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)]",children:[n("th",{class:"text-left py-2 px-2 font-medium text-[var(--color-text-muted)]",children:l("common.session")}),n("th",{class:"text-left py-2 px-2 font-medium text-[var(--color-text-muted)]",children:l("common.model")}),n("th",{class:"text-right py-2 px-2 font-medium",children:n("button",{type:"button",class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] cursor-pointer",onClick:()=>s("tokens"),children:[l("common.tokens"),n(i,{col:"tokens"})]})}),n("th",{class:"text-right py-2 px-2 font-medium",children:n("button",{type:"button",class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] cursor-pointer",onClick:()=>s("cost"),children:[l("usage.sessions.cost"),n(i,{col:"cost"})]})}),n("th",{class:"text-right py-2 px-2 font-medium",children:n("button",{type:"button",class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] cursor-pointer",onClick:()=>s("recent"),children:[l("common.lastActive"),n(i,{col:"recent"})]})})]})}),n("tbody",{children:o.map(d=>{const h=t?.key===d.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(d),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),c(d))},tabIndex:0,"aria-label":l("usage.sessions.viewDetails",{name:d.label||d.key}),children:[n("td",{class:"py-2 px-2 truncate max-w-[200px]",title:d.key,children:d.label||d.key}),n("td",{class:"py-2 px-2 text-[var(--color-text-muted)] truncate max-w-[120px]",title:d.model||void 0,children:d.model||"-"}),n("td",{class:"py-2 px-2 text-right font-mono",children:st(d.usage.totalTokens)}),n("td",{class:"py-2 px-2 text-right font-mono",children:ul(d.usage.totalCost)}),n("td",{class:"py-2 px-2 text-right text-[var(--color-text-muted)]",children:d.updatedAt?ae(new Date(d.updatedAt),{relative:!0}):"-"})]},d.key)})})]})}),n(u,{})]})]})}function hM(){const e=ua.value,t=xh.value;R(()=>{e&&(t==="timeline"&&!dl.value&&!Os.value?sM(e.key):t==="messages"&&hl.value.length===0&&!Ns.value&&lM(e.key))},[e,t]);const a=[{id:"overview",label:l("common.overview")},{id:"timeline",label:l("usage.detail.tabs.timeline")},{id:"messages",label:l("usage.detail.tabs.messages")}],r=o=>{(o==="overview"||o==="timeline"||o==="messages")&&(xh.value=o)};return n(We,{open:!!e,onClose:iM,title:l("common.sessionDetails"),children:e&&n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)] truncate -mt-2",children:e.label||e.key}),n(Jf,{items:a,activeId:t,onChange:r}),n("div",{role:"tabpanel",children:[t==="overview"&&n(fM,{session:e}),t==="timeline"&&n(pM,{}),t==="messages"&&n(mM,{})]})]})})}function fM({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:l("common.input")}),n("div",{class:"font-medium",children:st(e.usage.input)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("common.output")}),n("div",{class:"font-medium",children:st(e.usage.output)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("usage.summary.cacheRead")}),n("div",{class:"font-medium",children:st(e.usage.cacheRead)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("common.totalCost")}),n("div",{class:"font-medium text-[var(--color-success)]",children:ul(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:l("usage.detail.contextWeight")}),n("div",{class:"space-y-2",children:[t.systemPrompt!=null&&t.systemPrompt>0&&n(ns,{label:l("usage.detail.system"),value:t.systemPrompt,total:t.total,color:"var(--color-accent)"}),t.skills!=null&&t.skills>0&&n(ns,{label:l("common.skills"),value:t.skills,total:t.total,color:"var(--color-success)"}),t.tools!=null&&t.tools>0&&n(ns,{label:l("common.tools"),value:t.tools,total:t.total,color:"var(--color-warning)"}),t.files!=null&&t.files>0&&n(ns,{label:l("common.files"),value:t.files,total:t.total,color:"var(--color-info)"}),t.other!=null&&t.other>0&&n(ns,{label:l("usage.detail.other"),value:t.other,total:t.total,color:"var(--color-text-muted)"})]})]})]})}function pM(){const e=dl.value;if(Os.value)return n("div",{class:"flex justify-center py-8",children:n(te,{size:"md"})});if(!e||e.points.length===0)return n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center",children:l("usage.detail.noTimeline")});const a=e.points,r=Math.max(...a.map(w=>w.cumulativeTokens)),o=Math.max(...a.map(w=>w.cumulativeCost)),s=400,i=120,c={top:10,right:10,bottom:20,left:40},u=s-c.left-c.right,d=i-c.top-c.bottom,h=w=>c.left+w/(a.length-1)*u,f=w=>c.top+d-w/(r||1)*d,p=a.map((w,C)=>`${C===0?"M":"L"} ${h(C)} ${f(w.cumulativeTokens)}`).join(" "),v=`${p} L ${h(a.length-1)} ${c.top+d} L ${c.left} ${c.top+d} 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:l("usage.detail.cumulativeTokens")}),n("span",{children:[st(r)," max"]})]}),n("svg",{viewBox:`0 0 ${s} ${i}`,class:"w-full h-auto",children:[[0,.25,.5,.75,1].map(w=>n("line",{x1:c.left,y1:c.top+d*(1-w),x2:s-c.right,y2:c.top+d*(1-w),stroke:"var(--color-border)","stroke-dasharray":"2,2"},w)),n("path",{d:v,fill:"var(--color-accent)",opacity:"0.2"}),n("path",{d:p,fill:"none",stroke:"var(--color-accent)","stroke-width":"2"}),n("text",{x:c.left,y:i-2,"font-size":"10",fill:"var(--color-text-muted)","text-anchor":"start",children:ae(new Date(a[0].timestamp),{relative:!1})}),n("text",{x:s-c.right,y:i-2,"font-size":"10",fill:"var(--color-text-muted)","text-anchor":"end",children:ae(new Date(a[a.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:a.length}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("usage.detail.requests")})]}),n("div",{class:"text-center",children:[n("div",{class:"text-lg font-semibold",children:st(r)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("usage.detail.totalTokens")})]}),n("div",{class:"text-center",children:[n("div",{class:"text-lg font-semibold text-[var(--color-success)]",children:ul(o)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:l("common.totalCost")})]})]})]})}function mM(){const e=hl.value;if(Ns.value)return n("div",{class:"flex justify-center py-8",children:n(te,{size:"md"})});if(e.length===0)return n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center",children:l("usage.detail.noMessages")});const a={user:"info",assistant:"success",tool:"warning",toolResult:"default"},r={user:l("usage.detail.role.user"),assistant:l("common.assistant"),tool:l("usage.detail.role.tool"),toolResult:l("common.result")};return n("div",{class:"space-y-2 max-h-[300px] overflow-y-auto",children:e.map((o,s)=>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(Z,{variant:a[o.role],children:r[o.role]}),o.tokens!=null&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:l("usage.detail.tokenCount",{count:st(o.tokens)})})]}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:ae(new Date(o.timestamp),{relative:!0})})]}),n("p",{class:"text-sm text-[var(--color-text-secondary)] line-clamp-2",children:o.content})]},s))})}function ns({label:e,value:t,total:a,color:r}){const o=Math.round(t/a*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:r}})}),n("div",{class:"w-16 text-xs text-right",children:[st(t)," (",o,"%)"]})]})}const vM=[{mode:"gateway",label:l("usage.timezone.gateway")},{mode:"specific",label:l("usage.timezone.local")},{mode:"utc",label:l("usage.timezone.utc")}];function gM(e){return cM(),uM(),n(sn,{viewName:l("common.usage"),children:[n(Wt,{title:l("common.usage"),subtitle:l("usage.description"),actions:n(q,{icon:n(Xe,{class:`w-4 h-4 ${Ds.value?"animate-spin":""}`}),label:l("actions.refresh"),onClick:()=>{Fy()},disabled:Ds.value||!D.value,variant:"ghost"})}),Lc.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Lc.value}),Ds.value&&!Wi.value||!D.value?n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:D.value?void 0:l("status.connecting")})}):n("div",{class:"grid gap-6 md:grid-cols-2",children:[n(eM,{healthData:Wi.value}),n(tM,{usage:Ki.value,isLoading:Ps.value}),n("div",{class:"md:col-span-2",children:n(nM,{usage:Ki.value})}),n("div",{class:"md:col-span-2 min-w-0",children:n(dM,{})}),n("div",{class:"md:col-span-2",children:n(aM,{healthData:Wi.value})})]}),Ki.value&&n("div",{class:"flex flex-wrap items-center justify-center gap-2",children:[n("div",{class:"flex gap-2",children:Py.map(t=>n(P,{variant:Kn.value===t?"primary":"ghost",size:"sm",onClick:()=>{Oy(t)},disabled:Ps.value,children:[t,"d"]},t))}),n("div",{class:"flex gap-1",role:"group","aria-label":"Timezone",children:vM.map(({mode:t,label:a})=>n(P,{variant:bh.value===t?"primary":"ghost",size:"sm",onClick:()=>{bh.value=t,Ny(Kn.value)},disabled:Ps.value,children:a},t))})]}),n(hM,{})]})}const bM="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",xM=[{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"}],yM="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",wM="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",kM=[{cx:7.5,cy:12,r:1.5},{cx:12,cy:12,r:1.5},{cx:16.5,cy:12,r:1.5}],SM={telegram:{path:Fu.path,hex:Fu.hex,title:Fu.title},discord:{path:Ti.path,hex:Ti.hex,title:Ti.title},signal:{path:Nu.path,hex:Nu.hex,title:Nu.title},whatsapp:{path:zu.path,hex:zu.hex,title:zu.title},googlechat:{path:Du.path,hex:Du.hex,title:Du.title},matrix:{path:Ou.path,hex:Ou.hex,title:Ou.title},mastodon:{path:Pu.path,hex:Pu.hex,title:Pu.title},imessage:{path:bM,hex:"34C759",title:"iMessage"},nostr:{path:yM,hex:"8B5CF6",title:"Nostr"}};function _M({channelId:e,size:t=20,class:a,colored:r=!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:a,"aria-label":"Slack",children:[n("title",{children:"Slack"}),xM.map((c,u)=>n("path",{fill:r?c.color:"currentColor",d:c.path},u))]});if(o==="bluebubbles"){const c=r?"#2196F3":"currentColor";return n("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,class:a,"aria-label":"BlueBubbles",children:[n("title",{children:"BlueBubbles"}),n("path",{fill:"none",stroke:c,"stroke-width":"2",d:wM}),kM.map((u,d)=>n("circle",{cx:u.cx,cy:u.cy,r:u.r,fill:c},d))]})}if(o==="webchat")return n(rn,{class:a,style:{width:t,height:t,color:r?"#6366f1":"currentColor"}});const s=SM[o];if(!s)return n(rn,{class:a,style:{width:t,height:t}});const i=r?`#${s.hex}`:"currentColor";return n("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,class:a,"aria-label":s.title,children:[n("title",{children:s.title}),n("path",{fill:i,d:s.path})]})}function CM(e){return e.length===0?"not-configured":e.some(s=>s.lastError)?"error":e.some(s=>s.connected)?"connected":e.some(s=>s.enabled!==!1)?e.some(s=>s.configured)?"configured":"not-configured":"disabled"}function TM(e){return e.channelOrder.map(t=>{const a=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:a,defaultAccountId:e.channelDefaultAccountId[t]||"default",status:CM(a)}})}function zy(e){return e.accounts.reduce((t,a)=>{const r=a.lastInboundAt??0,o=a.lastOutboundAt??0;return Math.max(t,r,o)},0)}const Wa=m([]),yn=m(!1),Fs=m(!1),zs=m(null),_n=m(null),$c=m(!1);function EM(e){switch(e){case"connected":return{variant:"success",label:l("channels.status.connected")};case"configured":return{variant:"warning",label:l("common.configured")};case"not-configured":return{variant:"default",label:l("channels.status.notConfigured")};case"disabled":return{variant:"default",label:l("common.disabled")};case"error":return{variant:"error",label:l("common.error")}}}async function Vi(e=!1){e?Fs.value=!0:yn.value=!0,zs.value=null;try{const t=await N("channels.status",{probe:e,timeoutMs:e?15e3:1e4});Wa.value=TM(t)}catch(t){zs.value=ne(t)}finally{yn.value=!1,Fs.value=!1}}async function AM(){if(_n.value){$c.value=!0;try{await N("common.logout",{channel:_n.value.channel,accountId:_n.value.accountId}),V.success(l("channels.logoutSuccess",{channel:_n.value.label})),_n.value=null,Vi()}catch(e){V.error(ne(e))}finally{$c.value=!1}}}const MM=K(()=>{const e=Wa.value,t=Date.now()-1440*60*1e3;return{total:e.length,active:e.filter(a=>zy(a)>t).length,errors:e.filter(a=>a.status==="error").length}});function IM({account:e,channelId:t,channelLabel:a}){const r=e.connected===!0,o=!!e.lastError,s=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)]":r?"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}),s&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["@",s.replace(/^@/,"")]})]}),o&&n("div",{class:"text-xs text-[var(--color-error)] truncate",children:e.lastError})]})]}),n(q,{icon:n(P4,{class:"w-3.5 h-3.5"}),label:l("common.logout"),onClick:()=>{_n.value={channel:t,accountId:e.accountId,label:`${a} (${e.name||e.accountId})`}},variant:"ghost",size:"sm"})]})}function RM({channel:e}){const t=EM(e.status),a=zy(e);return n(G,{padding:"md",children:[n("div",{class:"flex items-start gap-3 mb-4",children:[n(_M,{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(Z,{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:[a>0&&n("span",{class:"flex items-center gap-1",children:[n(ge,{class:"w-3.5 h-3.5"}),ae(a,{relative:!0})]}),n("button",{type:"button",onClick:()=>Oe(`/config#channels.${e.id}`),class:"flex items-center gap-1 hover:text-[var(--color-accent)] transition-colors",children:[n(vf,{class:"w-3.5 h-3.5"}),l("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:[l("common.docs"),n($o,{class:"w-3 h-3"})]})]})]})]}),e.accounts.length>0&&n("div",{class:"space-y-2",children:e.accounts.map(r=>n(IM,{account:r,channelId:e.id,channelLabel:e.label},r.accountId))})]})}function LM(){return _n.value?n(We,{open:!0,onClose:()=>{_n.value=null},title:l("channels.logoutTitle"),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-[var(--color-text-secondary)]",children:l("channels.logoutConfirm",{channel:_n.value.label})}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:l("channels.logoutWarning")})]}),n("div",{class:"flex justify-end gap-3 mt-6",children:[n(P,{variant:"ghost",onClick:()=>{_n.value=null},disabled:$c.value,children:l("actions.cancel")}),n(P,{variant:"danger",onClick:AM,loading:$c.value,children:l("common.logout")})]})]}):null}function $M(e){R(()=>{D.value&&Vi()},[D.value]);const t=MM.value;return n(sn,{viewName:l("common.channels"),children:[n(Wt,{title:l("common.channels"),subtitle:l("channels.description"),actions:n(H,{children:[n(P,{variant:"secondary",size:"sm",onClick:()=>Vi(!0),disabled:Fs.value||yn.value||!D.value,icon:n(pa,{class:`w-4 h-4 ${Fs.value?"animate-pulse":""}`}),children:Fs.value?l("channels.probing"):l("channels.probe")}),n(q,{icon:n(Xe,{class:`w-4 h-4 ${yn.value?"animate-spin":""}`}),label:l("actions.refresh"),onClick:()=>Vi(),disabled:yn.value||!D.value,variant:"ghost"})]})}),D.value&&!yn.value&&n("div",{class:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-4",children:[n(le,{icon:Pn,label:l("common.total"),value:t.total}),n(le,{icon:Nn,label:l("channels.stats.active"),value:t.active}),n(le,{icon:Gc,label:l("channels.stats.errors"),value:t.errors,highlight:t.errors>0})]}),zs.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:zs.value}),(yn.value||!D.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:D.value?void 0:l("status.connecting")})}),D.value&&!yn.value&&Wa.value.length>0&&n("div",{class:"grid gap-4 sm:grid-cols-2",children:Wa.value.map(a=>n(RM,{channel:a},a.id))}),D.value&&!yn.value&&Wa.value.length===0&&!zs.value&&n(G,{children:n("div",{class:"p-16 text-center",children:[n(Pn,{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:l("channels.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l("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:[l("channels.learnMore"),n($o,{class:"w-4 h-4"})]})]})}),D.value&&!yn.value&&Wa.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:l("channels.count",{count:Wa.value.length})}),n(LM,{})]})}const bn=m([]),Bn=m(!1),Us=m(null);function Uy(e){const t=e.mode?.toLowerCase()??"",a=e.deviceFamily?.toLowerCase()??"";return t==="gateway"?pr:a.includes("iphone")||a.includes("android")?mo:a.includes("mac")||a.includes("windows")||a.includes("linux")?En:rn}function DM(e){return e===void 0?"—":e<60?l("instances.idleSeconds",{count:e}):e<3600?l("instances.idleMinutes",{count:Math.floor(e/60)}):l("instances.idleHours",{count:Math.floor(e/3600)})}function jy(e){return e?e==="gateway"?"success":e==="webchat"||e==="chat"?"warning":"default":"default"}async function td(){Bn.value=!0,Us.value=null;try{const e=await N("system-presence",{});bn.value=e??[]}catch(e){Us.value=ne(e)}finally{Bn.value=!1}}function PM({roles:e,scopes:t}){const a=[...e??[],...t??[]];return a.length===0?null:n("div",{class:"flex flex-wrap items-center gap-1 mt-1",children:a.map(r=>n(Z,{variant:"default",size:"sm",children:r},r))})}function OM({presence:e}){const t=Uy(e),a=e.mode==="gateway";return n(No,{icon:t,iconVariant:a?"success":"default",title:e.host||e.instanceId||"Unknown",subtitle:e.ip,badges:e.mode?n(Z,{variant:jy(e.mode),size:"sm",children:e.mode}):null,meta:[{icon:ge,value:ae(e.ts,{relative:!0})},...e.platform?[{value:e.platform}]:[]]})}function NM({presence:e}){const t=Uy(e),a=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 ${a?"bg-[var(--color-success)]/10":"bg-[var(--color-bg-tertiary)]"}`,children:n(t,{class:`w-4 h-4 ${a?"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(PM,{roles:e.roles,scopes:e.scopes})]})]})}),n("td",{class:"py-3 px-4",children:e.mode?n(Z,{variant:jy(e.mode),size:"sm",children:e.mode}):n("span",{class:"text-[var(--color-text-muted)]",children:"—"})}),n("td",{class:"py-3 px-4",children:[n("div",{class:"text-sm",children:e.platform||"—"}),e.version&&n("div",{class:"text-xs text-[var(--color-text-muted)]",children:["v",e.version]})]}),n("td",{class:"py-3 px-4 whitespace-nowrap",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(ge,{class:"w-3.5 h-3.5"}),n("span",{children:ae(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:DM(e.lastInputSeconds)})]})}function FM(e){R(()=>{D.value&&td()},[D.value]);const t=bn.value.filter(r=>r.mode==="gateway").length,a=bn.value.filter(r=>r.mode!=="gateway").length;return n(sn,{viewName:l("common.instances"),children:[n(Wt,{title:l("common.instances"),subtitle:l("instances.description"),actions:n(q,{icon:n(Xe,{class:`w-4 h-4 ${Bn.value?"animate-spin":""}`}),label:l("actions.refresh"),onClick:td,disabled:Bn.value||!D.value,variant:"ghost"})}),D.value&&!Bn.value&&n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(le,{icon:rn,label:l("common.total"),value:bn.value.length}),n(le,{icon:pr,label:l("instances.stats.gateways"),value:t}),n(le,{icon:En,label:l("instances.stats.clients"),value:a})]}),Us.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Us.value}),(Bn.value||!D.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:D.value?void 0:l("status.connecting")})}),D.value&&!Bn.value&&bn.value.length>0&&n(H,{children:[n("div",{class:"md:hidden space-y-2",children:bn.value.map((r,o)=>n(OM,{presence:r},r.instanceId||r.host||o))}),n(G,{padding:"none",class:"hidden md:block",children:n("table",{class:"w-full",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)] text-left text-sm text-[var(--color-text-muted)]",children:[n("th",{class:"py-3 px-4 font-medium",children:l("instances.columns.instance")}),n("th",{class:"py-3 px-4 font-medium w-24",children:l("instances.columns.mode")}),n("th",{class:"py-3 px-4 font-medium w-40",children:l("common.platform")}),n("th",{class:"py-3 px-4 font-medium w-28",children:l("instances.columns.lastSeen")}),n("th",{class:"py-3 px-4 font-medium w-20 hidden lg:table-cell",children:l("instances.columns.idle")})]})}),n("tbody",{class:"divide-y divide-[var(--color-border)]",children:bn.value.map((r,o)=>n(NM,{presence:r},r.instanceId||r.host||o))})]})})]}),D.value&&!Bn.value&&bn.value.length===0&&!Us.value&&n(G,{children:n("div",{class:"p-16 text-center",children:[n(rn,{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:l("instances.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l("instances.emptyDescription")}),n(P,{variant:"secondary",onClick:td,children:l("actions.refresh")})]})}),D.value&&!Bn.value&&bn.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:l("instances.count",{count:bn.value.length})})]})}const Jv={main:{icon:Xc,color:"success",badgeVariant:"success"},channel:{icon:ic,color:"info",badgeVariant:"info"},cron:{icon:Ro,color:"warning",badgeVariant:"warning"},isolated:{icon:ca,color:"text-muted",badgeVariant:"default"}};function da(e){return Jv[e]??Jv.isolated}function Hy(e){return l(`sessions.admin.kinds.${e}`)}const Pe=m([]),wt=m(!1),ga=m(null),la=m(""),nt=m("all"),ba=m(null),ro=m(!1),yh=m(!1),oo=m(null),Dc=m(""),fl=m(""),pl=m("inherit"),ml=m("inherit"),vl=m("inherit");function np(e){return(e.totalTokens??0).toLocaleString()}function By(e){const t=e.totalTokens??0,a=e.contextTokens??2e5;return a===0?"0%":`${Math.round(t/a*100)}%`}function Wy(e){return e.displayName||e.label||e.key.split(":").pop()||e.key}const Ka=K(()=>{let e=Pe.value;nt.value!=="all"&&(e=e.filter(a=>er(a)===nt.value));const t=la.value.toLowerCase().trim();return t&&(e=e.filter(a=>{const r=(a.label||a.displayName||"").toLowerCase(),o=a.key.toLowerCase(),s=(a.model||"").toLowerCase(),i=(a.channel||"").toLowerCase();return r.includes(t)||o.includes(t)||s.includes(t)||i.includes(t)})),[...e].sort((a,r)=>{const o=er(a)==="main",s=er(r)==="main";return o&&!s?-1:s&&!o?1:(r.updatedAt??0)-(a.updatedAt??0)})}),zM=K(()=>{const e={total:0,main:0,channel:0,cron:0,isolated:0};for(const t of Pe.value)e.total++,e[er(t)]++;return e});async function Ky(){wt.value=!0,ga.value=null;try{const e=await N("sessions.list",{limit:200});Pe.value=e.sessions??[]}catch(e){ga.value=ne(e)}finally{wt.value=!1}}function so(e){ba.value=e,fl.value=e.label??"",pl.value=e.thinking??"inherit",ml.value=e.verbose??"inherit",vl.value=e.reasoning??"inherit"}function js(){ba.value=null,ro.value=!1}async function UM(){const e=ba.value;if(e){yh.value=!0;try{const t={};fl.value!==(e.label??"")&&(t.label=fl.value||void 0),pl.value!==(e.thinking??"inherit")&&(t.thinking=pl.value),ml.value!==(e.verbose??"inherit")&&(t.verbose=ml.value),vl.value!==(e.reasoning??"inherit")&&(t.reasoning=vl.value),Object.keys(t).length>0&&(await N("sessions.patch",{key:e.key,...t}),Pe.value=Pe.value.map(a=>a.key===e.key?{...a,...t}:a)),js()}catch(t){ga.value=ne(t)}finally{yh.value=!1}}}async function jM(){const e=ba.value;if(e)try{await N("sessions.delete",{key:e.key}),Pe.value=Pe.value.filter(t=>t.key!==e.key),js()}catch(t){ga.value=ne(t)}}function qy(e){Oe(`/chat/${encodeURIComponent(e)}`)}function HM(e,t){t.stopPropagation(),oo.value=e.key,Dc.value=e.label??""}async function Yv(){const e=oo.value;if(!e)return;const t=Dc.value.trim(),a=Pe.value.find(r=>r.key===e);if(!a||t===(a.label??"")){oo.value=null;return}try{await N("sessions.patch",{key:e,label:t||void 0}),Pe.value=Pe.value.map(r=>r.key===e?{...r,label:t||void 0}:r)}catch(r){ga.value=ne(r)}finally{oo.value=null}}function BM(){oo.value=null}function WM(){const[e,t]=fe("q"),[a,r]=fe("kind"),o=!wt.value&&Pe.value.length>0,[s,i,c]=fe("session",{ready:o});He(e,la,u=>u),He(a,nt,u=>u),Mr(la,t),Ln(nt,r,"all"),R(()=>{if(o&&s.value){const u=Pe.value.find(d=>d.key===s.value);u&&ba.value?.key!==u.key&&so(u)}},[s.value,o]),R(()=>{c.value&&i(ba.value?.key??null)},[ba.value,c.value])}function KM(){R(()=>{D.value&&Ky()},[D.value])}function qM({kind:e,size:t="sm"}){const a=da(e),r=a.icon,o=t==="md"?"w-6 h-6":"w-4 h-4",s=a.color==="text-muted"?"text-[var(--color-text-muted)]":`text-[var(--color-${a.color})]`;return n(r,{class:`${o} ${s}`})}function Vy({kind:e,size:t="sm"}){const a=da(e),r=t==="md"?"p-3":"p-1.5",o=a.color==="text-muted"?"bg-[var(--color-bg-tertiary)]":`bg-[var(--color-${a.color})]/10`;return n("div",{class:`${r} rounded-lg flex-shrink-0 ${o}`,children:n(qM,{kind:e,size:t})})}function Gy({session:e,onDelete:t}){return n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[wl.value&&n(q,{icon:n(Pn,{class:"w-4 h-4"}),label:l("sessions.admin.openInChat"),size:"sm",variant:"ghost",onClick:a=>{a.stopPropagation(),qy(e.key)}}),n(q,{icon:n(bt,{class:"w-4 h-4"}),label:l("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 VM({session:e}){const t=er(e),a=da(t),r=Wy(e);return n(No,{icon:a.icon,iconVariant:t==="main"?"success":t==="channel"?"info":t==="cron"?"warning":"default",title:r,subtitle:e.key,badges:n(Z,{variant:a.badgeVariant,size:"sm",children:Hy(t)}),meta:[{icon:ge,value:e.updatedAt?ae(e.updatedAt,{relative:!0}):"—"},{icon:Ib,value:np(e)}],actions:n(Gy,{session:e,onDelete:o=>{o.stopPropagation(),so(e),ro.value=!0}}),onClick:()=>so(e)})}function GM({session:e}){const t=er(e),a=Wy(e),r=oo.value===e.key;return n("tr",{class:"group hover:bg-[var(--color-bg-hover)] cursor-pointer transition-colors",onClick:()=>!r&&so(e),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&!r&&(o.preventDefault(),so(e))},tabIndex:r?-1:0,children:[n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-3",children:[n(Vy,{kind:t}),n("div",{class:"min-w-0 flex-1",children:[r?n("div",{class:"flex items-center gap-2",role:"group",onClick:o=>o.stopPropagation(),onKeyDown:o=>o.stopPropagation(),children:n(Y,{type:"text",value:Dc.value,onInput:o=>Dc.value=o.target.value,onKeyDown:o=>{o.key==="Enter"&&Yv(),o.key==="Escape"&&BM()},onBlur:()=>{Yv()},placeholder:l("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:a,children:a}),n(q,{icon:n(po,{class:"w-3 h-3"}),label:l("sessions.admin.editLabel"),size:"sm",variant:"ghost",onClick:o=>HM(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(sc,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{class:"truncate max-w-[120px]",title:e.model||"Default",children:e.model?e.model.split("/").pop():"Default"})]})}),n("td",{class:"py-3 px-4 whitespace-nowrap",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(ge,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:e.updatedAt?ae(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(Ib,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:np(e)}),n("span",{class:"text-xs opacity-60",children:["(",By(e),")"]})]})}),n("td",{class:"py-3 px-4",children:n(Gy,{session:e,onDelete:o=>{o.stopPropagation(),so(e),ro.value=!0}})})]})}function JM(){return n(H,{children:[n("div",{class:"md:hidden space-y-2",children:Ka.value.map(e=>n(VM,{session:e},e.key))}),n(G,{padding:"none",class:"hidden md:block",children:n("table",{class:"w-full",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)] text-left text-sm text-[var(--color-text-muted)]",children:[n("th",{class:"py-3 px-4 font-medium",children:l("common.session")}),n("th",{class:"py-3 px-4 font-medium w-32",children:l("common.model")}),n("th",{class:"py-3 px-4 font-medium w-36",children:l("common.lastActive")}),n("th",{class:"py-3 px-4 font-medium w-32 hidden lg:table-cell",children:l("common.tokens")}),n("th",{class:"py-3 px-4 font-medium w-12"})]})}),n("tbody",{class:"divide-y divide-[var(--color-border)]",children:Ka.value.map(e=>n(GM,{session:e},e.key))})]})})]})}const nd=[{value:"inherit",label:l("sessions.admin.levels.inherit")},{value:"off",label:l("common.off")},{value:"low",label:l("sessions.admin.levels.low")},{value:"medium",label:l("common.medium")},{value:"high",label:l("sessions.admin.levels.high")}];function YM(){const e=ba.value;if(!e)return null;const t=er(e),a=da(t);return n(We,{open:!!e,onClose:js,title:e.label||e.displayName||l("common.sessionDetails"),size:"xl",footer:ro.value?n(Df,{message:l("common.deleteThisSession"),onCancel:()=>ro.value=!1,onDelete:()=>{jM()}}):n(Px,{isEdit:!0,onDeleteClick:()=>ro.value=!0,onCancel:js,onSave:()=>{UM()},isSaving:yh.value}),children:n("div",{class:"space-y-4 sm:space-y-6",children:[n("div",{class:"flex items-start gap-3 p-3 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n(Vy,{kind:t,size:"md"}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex flex-wrap items-center gap-1.5 sm:gap-2 mb-1",children:[n(Z,{variant:a.badgeVariant,size:"sm",children:Hy(t)}),e.channel&&n(Z,{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:np(e)}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:l("common.tokens")})]}),n("div",{class:"text-center p-2 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n("div",{class:"text-lg sm:text-xl font-bold",children:By(e)}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:l("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?ae(e.updatedAt,{relative:!0}):"—"}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:l("common.lastActive")})]})]}),n("div",{class:"space-y-4 sm:space-y-5",children:[n(De,{label:l("sessions.admin.label"),hint:l("sessions.admin.labelHelp"),children:n(Y,{value:fl.value,onInput:r=>fl.value=r.target.value,placeholder:l("sessions.admin.labelPlaceholder"),fullWidth:!0})}),n(De,{label:l("sessions.admin.overrides"),children:n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(De,{label:l("common.thinking"),class:"space-y-1",children:n(Me,{value:pl.value,onChange:r=>pl.value=r,options:nd})}),n(De,{label:l("sessions.admin.verbose"),class:"space-y-1",children:n(Me,{value:ml.value,onChange:r=>ml.value=r,options:nd})}),n(De,{label:l("sessions.admin.reasoning"),class:"space-y-1",children:n(Me,{value:vl.value,onChange:r=>vl.value=r,options:nd})})]})})]}),wl.value&&n(P,{variant:"secondary",fullWidth:!0,icon:n(Pn,{class:"w-4 h-4"}),onClick:()=>{js(),qy(e.key)},children:l("sessions.admin.openInChat")})]})})}function ZM(e){WM(),KM();const t=zM.value;return n(sn,{viewName:l("common.sessions"),children:[n(Wt,{title:l("common.sessions"),subtitle:l("sessions.admin.description"),actions:n(H,{children:[D.value&&!wt.value&&Pe.value.length>0&&n("div",{class:"relative hidden sm:block",children:[n(it,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Y,{type:"text",value:la.value,onInput:a=>la.value=a.target.value,placeholder:l("sessions.admin.searchPlaceholder"),class:"pl-10 w-48 lg:w-64"})]}),n(q,{icon:n(Xe,{class:`w-4 h-4 ${wt.value?"animate-spin":""}`}),label:l("actions.refresh"),onClick:()=>{Ky()},disabled:wt.value||!D.value,variant:"ghost"})]})}),D.value&&!wt.value&&Pe.value.length>0&&n("div",{class:"relative md:hidden",children:[n(it,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(Y,{type:"text",value:la.value,onInput:a=>la.value=a.target.value,placeholder:l("sessions.admin.searchPlaceholder"),class:"pl-10",fullWidth:!0})]}),D.value&&!wt.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(le,{icon:Pn,label:l("common.total"),value:t.total,active:nt.value==="all",onClick:()=>nt.value="all"}),n(le,{icon:da("main").icon,label:l("common.main"),value:t.main,active:nt.value==="main",onClick:()=>nt.value="main"}),n(le,{icon:da("channel").icon,label:l("common.channel"),value:t.channel,active:nt.value==="channel",onClick:()=>nt.value="channel"}),n(le,{icon:da("cron").icon,label:l("sessions.admin.kinds.cron"),value:t.cron,active:nt.value==="cron",onClick:()=>nt.value="cron"}),n(le,{icon:da("isolated").icon,label:l("common.isolated"),value:t.isolated,active:nt.value==="isolated",onClick:()=>nt.value="isolated"})]}),ga.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:ga.value}),(wt.value||!D.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:D.value?void 0:l("status.connecting")})}),D.value&&!wt.value&&Ka.value.length>0&&n(JM,{}),D.value&&!wt.value&&Pe.value.length===0&&!ga.value&&n(G,{children:n("div",{class:"p-16 text-center",children:[n(Pn,{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:l("sessions.admin.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)]",children:l("sessions.admin.emptyDescription")})]})}),D.value&&!wt.value&&Pe.value.length>0&&Ka.value.length===0&&n(G,{children:n("div",{class:"p-12 text-center",children:[n(it,{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:l("sessions.admin.noResults")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:l("common.noResultsHint")}),n(P,{variant:"secondary",size:"sm",onClick:()=>{la.value="",nt.value="all"},children:l("common.clearFilters")})]})}),D.value&&!wt.value&&Ka.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:Ka.value.length===Pe.value.length?l("sessions.admin.count",{count:Pe.value.length}):l("sessions.admin.filteredCount",{filtered:Ka.value.length,total:Pe.value.length})}),n(YM,{})]})}const wh=m(null),ds=m(null),kh=m(null),XM=m(null),Jy=typeof BroadcastChannel<"u"?new BroadcastChannel("cove:canvas"):null;Jy?.addEventListener("message",e=>{if(e.data.type==="canvas-content"){if(e.data.url)wh.value=e.data.url,ds.value=null,kh.value=null;else if(e.data.base64)try{ds.value&&URL.revokeObjectURL(ds.value);const t=jf(e.data.base64,e.data.mimeType||"image/png");ds.value=t,kh.value=e.data.mimeType,wh.value=null}catch{}}});function Zv(e){Jy?.postMessage({type:"canvas-standalone-status",open:e})}function QM({url:e,blobUrl:t,contentType:a,content:r,iframeRef:o,imgRef:s,largeEmptyState:i=!1}){return t?bE(a)||Tv(e)?n("div",{class:"w-full h-full flex items-center justify-center bg-[var(--color-bg-tertiary)] p-4 overflow-auto",children:n("img",{ref:s,src:t,alt:l("canvas.imageAlt"),class:"max-w-full max-h-full object-contain rounded-lg shadow-lg",crossOrigin:"anonymous"})}):n("div",{class:"w-full h-full overflow-hidden",children:n("iframe",{ref:o,src:t,class:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",title:l("canvas.iframeTitle")})}):e?Tv(e)?n("div",{class:"w-full h-full flex items-center justify-center bg-[var(--color-bg-tertiary)] p-4 overflow-auto",children:n("img",{ref:s,src:e,alt:l("canvas.imageAlt"),class:"max-w-full max-h-full object-contain rounded-lg shadow-lg",crossOrigin:"anonymous"})}):n("div",{class:"w-full h-full overflow-hidden",children:n("iframe",{ref:o,src:e,class:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",title:l("canvas.iframeTitle")})}):r?n("div",{class:"w-full h-full p-4 overflow-auto bg-[var(--color-bg-tertiary)]",dangerouslySetInnerHTML:{__html:r}}):i?n("div",{class:"flex flex-col items-center justify-center h-full gap-4 text-[var(--color-text-muted)] px-6 text-center bg-[var(--color-bg-primary)]",children:[n("div",{class:"text-6xl",children:"🖼️"}),n("p",{class:"text-lg",children:l("canvas.noContent")}),n("p",{class:"text-sm opacity-70",children:l("canvas.noContentHint")})]}):n("div",{class:"flex flex-col items-center justify-center h-full gap-3 text-[var(--color-text-muted)] px-6 text-center",children:[n("p",{class:"text-sm",children:l("canvas.noContent")}),n("p",{class:"text-xs opacity-70",children:l("canvas.noContentHint")})]})}function eI(){return R(()=>{Zv(!0);const e=()=>Zv(!1);return window.addEventListener("beforeunload",e),()=>{e(),window.removeEventListener("beforeunload",e)}},[]),n("div",{class:"w-screen h-screen overflow-hidden bg-[var(--color-bg-primary)]",children:n(QM,{url:wh.value,blobUrl:ds.value,contentType:kh.value,content:XM.value,largeEmptyState:!0})})}const tI={sm:"text-xs",md:"text-sm",lg:"text-base"};function ap({children:e,size:t="sm",muted:a=!0,icon:r,iconRight:o,class:s,...i}){return n("button",{type:"button",class:`
435
435
  inline-flex items-center gap-1
436
- ${YM[t]}
436
+ ${tI[t]}
437
437
  ${a?"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]":"text-[var(--color-accent)] hover:text-[var(--color-accent-hover)]"}
438
438
  transition-colors
439
439
  disabled:opacity-50 disabled:cursor-not-allowed
440
440
  ${s||""}
441
- `,...i,children:[r&&n("span",{class:"flex-shrink-0",children:r}),e,o&&n("span",{class:"flex-shrink-0",children:o})]})}const ZM={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)]"},XM={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"}},QM={success:Lo,error:Er,warning:Aa,info:Al};function Xv({variant:e,size:t="lg",class:a}){const{container:r,icon:o}=XM[t],s=QM[e];return n("div",{class:`
441
+ `,...i,children:[r&&n("span",{class:"flex-shrink-0",children:r}),e,o&&n("span",{class:"flex-shrink-0",children:o})]})}const nI={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)]"},aI={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"}},rI={success:Lo,error:Er,warning:Aa,info:Al};function Xv({variant:e,size:t="lg",class:a}){const{container:r,icon:o}=aI[t],s=rI[e];return n("div",{class:`
442
442
  ${r}
443
443
  rounded-full
444
444
  flex items-center justify-center
445
- ${ZM[e]}
445
+ ${nI[e]}
446
446
  ${a||""}
447
- `,children:n(s,{class:o})})}function Jy({onBack:e,onNext:t,nextLabel:a,backLabel:r,nextDisabled:o=!1,nextLoading:s=!1,class:i}){return n("div",{class:`flex gap-3 mt-6 ${i||""}`,children:[e&&n(P,{variant:"ghost",onClick:e,icon:n(Jc,{class:"w-4 h-4"}),children:r||l("actions.back")}),n(P,{variant:"primary",onClick:t,disabled:o,loading:s,class:e?"flex-1":"w-full",iconRight:n(Yc,{class:"w-4 h-4"}),children:a||l("actions.continue")})]})}function eI({steps:e,current:t,class:a}){const r=e.indexOf(t);return n("div",{class:`flex justify-center gap-2 ${a||""}`,children:e.map((o,s)=>n("div",{class:`h-1.5 rounded-full transition-all duration-300 ${s<=r?"w-8 bg-[var(--color-accent)]":"w-4 bg-[var(--color-border)]"}`},o))})}function tI({onComplete:e,onSkip:t}){const a=X("welcome"),r=X(""),o=X("token"),s=X(""),i=X(!0),c=X(!1),u=X(!1),d=X(null),h=X(!1),f=X(!1),p=X(!0),v=X("single"),w=jc(()=>{const k=r.value.trim();if(!k||!k.startsWith("ws://")&&!k.startsWith("wss://"))return!1;try{return new URL(k),!0}catch{return!1}}),C=F(!1);Rh(()=>{C.current||(C.current=!0,Xe.value=!0)},[]),vd(()=>{const k=r.value;if(f.value=!1,h.value=!1,!w.value)return;const I=new AbortController,A=setTimeout(async()=>{if(I.signal.aborted||r.peek()!==k)return;h.value=!0,d.value=null;const O=await Kp(k,I.signal);!I.signal.aborted&&r.peek()===k&&(h.value=!1,O.ok?(f.value=!0,d.value=null):O.error!=="Aborted"&&(f.value=!1,d.value=O.error||l("onboarding.probeError")))},600);return()=>{clearTimeout(A),I.abort()}});const T=()=>r.value.trim()?w.value?(d.value=null,!0):(d.value=l("onboarding.urlError"),!1):(d.value=l("errors.required"),!1),b=async()=>{c.value=!0,u.value=!1;try{await Sl({url:r.value,token:o.value==="token"?s.value:void 0,password:o.value==="password"?s.value:void 0,autoReconnect:!0}),Fh({url:r.value,authMode:o.value,rememberMe:i.value,credential:s.value}),Np(),await Wc(),await of(),ho("main"),await rf("main"),lf(),cf(),u.value=!0}catch(k){M.auth.error("Connect failed:",k),u.value=!1}finally{c.value=!1}},g=()=>{uo(),u.value=!1,a.value="auth"},y=async()=>{if(!T())return;if(f.value){a.value="auth";return}if(h.value)return;h.value=!0,d.value=null;const k=await Kp(r.value);h.value=!1,k.ok?(f.value=!0,setTimeout(()=>{a.value="auth",f.value=!1},500)):d.value=k.error||l("onboarding.probeError")},E=()=>{a.value==="welcome"?a.value="url":a.value==="url"?y():a.value==="auth"&&(a.value="connect",b())},x=()=>{a.value==="url"?a.value="welcome":a.value==="auth"?a.value="url":a.value==="connect"&&!u.value&&(a.value="auth")},S=()=>{Np(),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(eI,{steps:["welcome","url","auth","connect"],current:a.value,class:"mb-4 sm:mb-8"}),a.value==="welcome"&&n(nI,{onNext:E,onSkip:S}),a.value==="url"&&n(aI,{url:r.value,onUrlChange:k=>{r.value=k,d.value=null,f.value=!1},error:d.value,canProceed:w.value,probing:h.value,probeSuccess:f.value,onNext:E,onBack:x,onSkip:S}),a.value==="auth"&&n(rI,{authMode:o.value,onAuthModeChange:k=>o.value=k,credential:s.value,onCredentialChange:k=>s.value=k,rememberMe:i.value,onRememberMeChange:k=>i.value=k,onNext:E,onBack:x}),a.value==="connect"&&n(oI,{connecting:c.value,connected:u.value,error:ia.value,showTour:p.value,onShowTourChange:k=>p.value=k,selectedMode:v.value,onModeChange:k=>{v.value=k,Ln.value=k},onRetry:g,onContinue:()=>{u1(p.value),Ln.value=v.value,e()}})]})})}function nI({onNext:e,onSkip:t}){return n("div",{class:"text-center",children:[n(au,{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:l("onboarding.welcome")}),n("p",{class:"text-sm sm:text-base text-[var(--color-text-muted)] mb-4 sm:mb-8",children:l("onboarding.welcomeSubtitle")}),n("div",{class:"grid gap-2 sm:gap-4 mb-4 sm:mb-8 text-left",children:[n(sd,{icon:n(Pn,{class:"w-5 h-5"}),title:l("onboarding.feature1Title"),description:l("onboarding.feature1Desc")}),n(sd,{icon:n(eu,{class:"w-5 h-5"}),title:l("onboarding.feature2Title"),description:l("onboarding.feature2Desc")}),n(sd,{icon:n(rn,{class:"w-5 h-5"}),title:l("onboarding.feature3Title"),description:l("onboarding.feature3Desc")})]}),n("div",{class:"space-y-3",children:[n(P,{variant:"primary",onClick:e,fullWidth:!0,iconRight:n(Yc,{class:"w-4 h-4"}),children:l("onboarding.getStarted")}),n(rp,{onClick:t,children:l("onboarding.skipToLogin")})]})]})}function sd({icon:e,title:t,description:a}){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:a})]})]})}function aI({url:e,onUrlChange:t,error:a,canProceed:r,probing:o,probeSuccess:s,onNext:i,onBack:c,onSkip:u}){const d=f=>{f.key==="Enter"&&s&&i()},h=()=>{if(o)return n(te,{size:"sm"});if(s)return n(on,{class:"w-4 h-4 text-[var(--color-success)]"});if(a&&r)return n(Do,{content:a,placement:"left",children:n("span",{class:"cursor-help",children:n(Zc,{class:"w-4 h-4 text-[var(--color-error)]"})})})};return n(G,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:l("common.connectToGateway")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-3 sm:mb-6",children:l("onboarding.urlSubtitle")}),n(De,{label:l("common.gatewayUrl"),htmlFor:"gateway-url",children:n(Y,{id:"gateway-url",type:"url",value:e,onInput:f=>t(f.target.value),onKeyDown:d,placeholder:l("auth.gatewayUrlPlaceholder"),rightElement:h(),autoCorrect:"off",autoCapitalize:"off",spellcheck:!1,fullWidth:!0})}),n(qn,{title:l("onboarding.troubleshootTitle"),items:[l("onboarding.troubleshoot1"),l("onboarding.troubleshoot2"),l("onboarding.troubleshoot3")],class:"mt-3 sm:mt-4 text-xs sm:text-sm"}),n(Jy,{onBack:c,onNext:i,nextDisabled:!s}),n("div",{class:"text-center mt-4",children:n(rp,{onClick:u,disabled:o,children:l("onboarding.skipToLogin")})})]})}function rI({authMode:e,onAuthModeChange:t,credential:a,onCredentialChange:r,rememberMe:o,onRememberMeChange:s,onNext:i,onBack:c}){const u=h=>{h.key==="Enter"&&i()},d=[{value:"token",label:l("common.token")},{value:"password",label:l("common.password")}];return n(G,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:l("onboarding.authTitle")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-3 sm:mb-6",children:l("onboarding.authSubtitle")}),n("div",{class:"space-y-3 sm:space-y-4",children:[n(De,{label:l("onboarding.authMethod"),children:n(Ae,{value:e,onChange:h=>t(h),options:d,"aria-label":l("onboarding.authMethod"),class:"w-full"})}),n(De,{label:l(e==="token"?"common.token":"common.password"),htmlFor:"credential",children:n(Of,{id:"credential",value:a,onInput:h=>r(h.target.value),onKeyDown:u,placeholder:l(e==="token"?"auth.tokenPlaceholder":"auth.passwordPlaceholder"),fullWidth:!0})}),n(Be,{checked:o,onChange:s,label:l("auth.rememberMe"),description:l("onboarding.rememberMeDesc"),size:"sm"})]}),n(Jy,{onBack:c,onNext:i,nextLabel:l("actions.connect")})]})}function oI({connecting:e,connected:t,error:a,showTour:r,onShowTourChange:o,selectedMode:s,onModeChange:i,onRetry:c,onContinue:u}){return n(G,{variant:"elevated",padding:"md",class:"text-center",children:[e&&n(H,{children:[n(te,{size:"md",class:"mx-auto mb-3 sm:mb-4"}),n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:l("common.connecting")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:l("onboarding.connectingDesc")})]}),!e&&t&&n(H,{children:[n(Xv,{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:l("onboarding.success")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-4 sm:mb-6",children:l("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:l("onboarding.modeTitle")}),n("div",{class:"grid grid-cols-2 gap-2 sm:gap-3",children:[n("button",{type:"button",onClick:()=>i("single"),class:`p-2 sm:p-4 rounded-lg border-2 text-left transition-colors ${s==="single"?"border-[var(--color-accent)] bg-[var(--color-accent)]/10":"border-[var(--color-border)] hover:border-[var(--color-accent)]/50"}`,children:[n($n,{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:l("onboarding.modeSingle")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1 hidden sm:block",children:l("onboarding.modeSingleDesc")})]}),n("button",{type:"button",onClick:()=>i("multi"),class:`p-2 sm:p-4 rounded-lg border-2 text-left transition-colors ${s==="multi"?"border-[var(--color-accent)] bg-[var(--color-accent)]/10":"border-[var(--color-border)] hover:border-[var(--color-accent)]/50"}`,children:[n(L4,{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:l("onboarding.modeMulti")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1 hidden sm:block",children:l("onboarding.modeMultiDesc")})]})]})]}),n("div",{class:"mb-4 sm:mb-6",children:n("button",{type:"button",onClick:()=>{const d=!Xe.value;Xe.value=d,d?Wf():Kf()},class:`w-full p-3 sm:p-4 rounded-lg border-2 text-left transition-colors flex items-start gap-3 ${Xe.value?"border-[var(--color-accent)] bg-[var(--color-accent)]/10":"border-[var(--color-border)] hover:border-[var(--color-accent)]/50"}`,children:[n(Ob,{class:"w-5 h-5 flex-shrink-0 text-[var(--color-accent)]"}),n("div",{class:"flex-1",children:[n("div",{class:"text-xs sm:text-sm font-medium",children:l("common.enableCanvas")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1",children:l("onboarding.canvasDesc")})]}),n("div",{class:`w-4 h-4 rounded-full border-2 flex-shrink-0 flex items-center justify-center ${Xe.value?"border-[var(--color-accent)] bg-[var(--color-accent)]":"border-[var(--color-border)]"}`,children:Xe.value&&n(on,{class:"w-3 h-3 text-white"})})]})}),n("div",{class:"mb-4 sm:mb-6",children:n(Be,{checked:r,onChange:o,label:l("onboarding.showFeatureTour"),size:"sm"})}),n(P,{variant:"primary",onClick:u,fullWidth:!0,iconRight:n(Yc,{class:"w-4 h-4"}),children:l(r?"actions.continue":"onboarding.startChatting")})]}),!e&&!t&&a&&n(H,{children:[n(Xv,{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:l("onboarding.failed")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-error)] mb-3 sm:mb-4",children:a}),n(qn,{title:l("onboarding.failedHints"),items:[l("onboarding.hint1"),l("onboarding.hint2"),l("onboarding.hint3"),l("onboarding.hint4")],class:"text-left mb-4 sm:mb-6 text-xs sm:text-sm"}),n(P,{variant:"primary",onClick:c,fullWidth:!0,icon:n(Jc,{class:"w-4 h-4"}),children:l("common.tryAgain")})]})]})}const sI=150,lI=300,iI=50,$t=16,xi=8,cI=8;function uI({steps:e,onComplete:t,spotlightPadding:a=cI}){const r=X(0),o=X(0),s=X(null),i=F(null),c=X(null),u=X(!1),d=e[o.value],h=e[r.value],f=r.value===0,p=r.value===e.length-1,v=F(null),w=F(""),C=F(""),T=Q(async()=>{if(!h)return;v.current&&(v.current.style.zIndex=w.current,v.current.style.position=C.current,v.current=null),await new Promise(k=>setTimeout(k,sI)),o.value=r.peek(),h.beforeShow&&await h.beforeShow(),await new Promise(k=>setTimeout(k,iI));const x=document.querySelectorAll(h.target);let S=null;for(const k of x)if(k instanceof HTMLElement&&k.offsetParent!==null){S=k;break}if(S){S.scrollIntoView({behavior:"smooth",block:"center"}),await new Promise(I=>setTimeout(I,lI)),w.current=S.style.zIndex,C.current=S.style.position,v.current=S,(!S.style.position||S.style.position==="static")&&(S.style.position="relative"),S.style.zIndex="10000";const k=S.getBoundingClientRect();s.value=k}else s.value=null;u.value=!1},[h]);vd(()=>{r.value,u.value=!0,T()}),vd(()=>{const x=s.value;if(!x||!i.current)return;const k=i.current.getBoundingClientRect(),I={width:window.innerWidth,height:window.innerHeight};let A=h?.placement||"bottom",O=0,z=0;const se={bottom:{top:x.bottom+a+xi+$t,left:x.left+x.width/2-k.width/2,fits:x.bottom+a+k.height+$t<I.height},top:{top:x.top-a-k.height-xi-$t,left:x.left+x.width/2-k.width/2,fits:x.top-a-k.height-$t>0},right:{top:x.top+x.height/2-k.height/2,left:x.right+a+xi+$t,fits:x.right+a+k.width+$t<I.width},left:{top:x.top+x.height/2-k.height/2,left:x.left-a-k.width-xi-$t,fits:x.left-a-k.width-$t>0}},Fe=A==="top"?["top","bottom","right","left"]:A==="left"?["left","right","bottom","top"]:A==="right"?["right","left","bottom","top"]:["bottom","top","right","left"];for(const Gn of Fe)if(se[Gn].fits){A=Gn;break}const tt=se[A];O=tt.top,z=tt.left,z=Math.max($t,Math.min(z,I.width-k.width-$t)),O=Math.max($t,Math.min(O,I.height-k.height-$t));const Re=A==="bottom"?"top":A==="top"?"bottom":A==="left"?"right":"left";c.value={top:O,left:z,arrowPosition:Re}}),R(()=>{const x=()=>T();return window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[T]),R(()=>()=>{v.current&&(v.current.style.zIndex=w.current,v.current.style.position=C.current)},[]),R(()=>{if(!h?.autoAdvanceWhen)return;const x=setInterval(()=>{h.autoAdvanceWhen?.()&&(p?t():r.value++)},500);return()=>clearInterval(x)},[h,p,t]),R(()=>{const x=S=>{S.key==="Escape"?t():S.key==="ArrowRight"||S.key==="Enter"?p?t():r.value++:S.key==="ArrowLeft"&&!f&&r.value--};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[f,p,t]);const b=()=>{p?t():r.value++},g=()=>{f||r.value--},y=s.value,E=c.value;return nu(n("div",{class:"fixed inset-0 z-[9999] pointer-events-none",children:[n("svg",{class:"absolute inset-0 w-full h-full pointer-events-none",children:[n("defs",{children:n("mask",{id:"spotlight-mask",children:[n("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"}),y&&n("rect",{x:y.left-a,y:y.top-a,width:y.width+a*2,height:y.height+a*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)"})]}),y&&n("div",{class:"absolute border-2 border-[var(--color-accent)] rounded-lg pointer-events-none",style:{top:y.top-a,left:y.left-a,width:y.width+a*2,height:y.height+a*2}}),n("div",{ref:i,class:"absolute z-10 bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-xl shadow-lg p-4 max-w-sm transition-opacity duration-150",style:{top:E?.top??-9999,left:E?.left??-9999,opacity:E&&!u.value?1:0,pointerEvents:E&&!u.value?"auto":"none"},children:[E&&n("div",{class:`absolute w-3 h-3 bg-[var(--color-bg-surface)] border-[var(--color-border)] transform rotate-45 ${E.arrowPosition==="top"?"-top-1.5 left-1/2 -translate-x-1/2 border-l border-t":E.arrowPosition==="bottom"?"-bottom-1.5 left-1/2 -translate-x-1/2 border-r border-b":E.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:d?.title}),n("p",{class:"text-sm text-[var(--color-text-secondary)] mb-4",children:d?.content}),n("div",{class:"flex items-center justify-between gap-2",children:[n(rp,{onClick:t,icon:n(Ma,{class:"w-3 h-3"}),children:l("tour.skipTour")}),n("div",{class:"flex gap-2",children:[!f&&n(P,{variant:"ghost",size:"sm",onClick:g,icon:n(Jc,{class:"w-3 h-3"}),children:l("actions.back")}),n(P,{variant:"primary",size:"sm",onClick:b,iconRight:n(Yc,{class:"w-3 h-3"}),children:l(p?"actions.done":"actions.next")})]})]})]}),n("div",{class:"absolute inset-0",role:"presentation",onClick:x=>{if(y){const S=x.clientX,k=x.clientY;S>=y.left-a&&S<=y.right+a&&k>=y.top-a&&k<=y.bottom+a||(x.preventDefault(),x.stopPropagation())}},onKeyDown:()=>{},style:{pointerEvents:"auto"}})]}),document.body)}function dI(){return[{target:"[data-tour='sessions']",title:l("tour.steps.sessions.title"),content:l("tour.steps.sessions.content"),placement:"right"}]}function Qv(){return[{target:"[data-tour='chat-input']",title:l("tour.steps.chatInput.title"),content:l("tour.steps.chatInput.content"),placement:"top"},{target:"[data-tour='model-picker']",title:l("tour.steps.modelPicker.title"),content:l("tour.steps.modelPicker.content"),placement:"top"},{target:"[data-tour='settings']",title:l("common.settings"),content:l("tour.steps.settings.content"),placement:"bottom"}]}function hI(){return{target:"[data-tour='pending-requests']",title:l("tour.steps.canvasPairing.title"),content:l("tour.steps.canvasPairing.content"),placement:"bottom",beforeShow:async()=>{Oe("/devices"),await new Promise(e=>setTimeout(e,500))},autoAdvanceWhen:()=>Co.value==="paired"}}function eg(){return{target:"[data-tour='canvas']",title:l("common.canvas"),content:l("tour.steps.canvasButton.content"),placement:"bottom",beforeShow:async()=>{Oe("/");for(let e=0;e<20;e++)if(await new Promise(t=>setTimeout(t,100)),document.querySelector("[data-tour='canvas']"))return}}}function fI(e){const t=e==="multi"?[...dI(),...Qv()]:Qv();return Xe.value?Co.value==="paired"&&Rr.value?[...t,eg()]:[...t,hI(),eg()]:t}async function tg(){try{return(await N("cron.list",{})).jobs||[]}catch{return[]}}const pI=[{id:"chat.abort",label:l("commandPalette.commands.chat.abort"),category:"chat",icon:"⏹",shortcut:"⌘.",action:()=>{const e=rt.value;e&&gb(e)},keywords:["stop","cancel","halt"]},{id:"chat.clear",label:l("commandPalette.commands.chat.clear"),category:"chat",icon:"🗑",action:()=>{qc()},keywords:["delete","reset","empty"]},{id:"chat.search",label:l("commandPalette.commands.chat.search"),category:"chat",icon:"🔍",shortcut:"⌘F",action:()=>{mt.value=!0,Tn.value=""},keywords:["find","filter"]},{id:"chat.export",label:l("commandPalette.commands.chat.export"),category:"chat",icon:"📄",action:()=>{const e=je.value;if(e.length===0)return;const t=["# Chat Export","",`Exported: ${new Date().toLocaleString()}`,"","---",""];for(const i of e){const c=i.role==="user"?"**You**":"**Assistant**";t.push(c),t.push(""),t.push(i.content||""),t.push(""),t.push("---"),t.push("")}const a=t.join(`
448
- `),r=new Blob([a],{type:"text/markdown"}),o=URL.createObjectURL(r),s=document.createElement("a");s.href=o,s.download=`chat-${new Date().toISOString().slice(0,10)}.md`,s.click(),URL.revokeObjectURL(o)},keywords:["download","save","markdown"]},{id:"chat.copy-last",label:l("commandPalette.commands.chat.copyLast"),category:"chat",icon:"📋",action:async()=>{const t=[...je.value].reverse().find(a=>a.role==="assistant");t?.content&&await navigator.clipboard.writeText(t.content)},keywords:["clipboard"]}],mI=[{id:"session.switch",label:l("commandPalette.commands.session.switch"),category:"session",icon:"🔄",hasSubmenu:!0,getSubmenuItems:()=>{const e=In.value;return Mt.value.map(t=>({id:t.key,label:t.label||t.key,isActive:t.key===e,description:t.model,action:()=>{ho(t.key),Oe(`/chat/${encodeURIComponent(t.key)}`)}}))},isAvailable:()=>!Bs.value&&Mt.value.length>1,keywords:["change","select"]},{id:"session.delete",label:l("commandPalette.commands.session.delete"),category:"session",icon:"🗑",action:async()=>{const e=rt.value;if(e&&confirm(l("common.deleteThisSession")))try{await N("sessions.delete",{key:e})}catch{}},isAvailable:()=>!Bs.value,keywords:["remove"]},{id:"session.copy-key",label:l("commandPalette.commands.session.copyKey"),category:"session",icon:"🔑",action:async()=>{const e=rt.value;e&&await navigator.clipboard.writeText(e)},keywords:["clipboard"]}],vI=[{id:"model.change",label:l("commandPalette.commands.model.change"),category:"model",icon:"🤖",hasSubmenu:!0,getSubmenuItems:()=>ka.value.map(e=>({id:e.id,label:e.name||e.id,description:e.provider,action:async()=>{const t=rt.value;if(t)try{await N("sessions.patch",{key:t,model:e.id})}catch{}}})),keywords:["switch","select","ai"]}],gI=[{id:"cron.run",label:l("commandPalette.commands.cron.run"),category:"cron",icon:"▶️",hasSubmenu:!0,getSubmenuItems:async()=>{const e=await tg();return e.length===0?[{id:"none",label:l("common.noItems"),action:()=>{}}]:e.map(t=>({id:t.id,label:t.name||t.id,description:t.enabled?l("common.enabled"):l("common.disabled"),action:async()=>{try{await N("cron.run",{jobId:t.id})}catch{}}}))},isAvailable:()=>D.value,keywords:["trigger","execute","schedule"]},{id:"cron.toggle",label:l("commandPalette.commands.cron.toggle"),category:"cron",icon:"⏯",hasSubmenu:!0,getSubmenuItems:async()=>{const e=await tg();return e.length===0?[{id:"none",label:l("common.noItems"),action:()=>{}}]:e.map(t=>({id:t.id,label:`${t.name||t.id}: ${t.enabled?"ON":"OFF"}`,isActive:t.enabled,action:async()=>{try{await N("cron.update",{jobId:t.id,patch:{enabled:!t.enabled}})}catch{}}}))},isAvailable:()=>D.value,keywords:["enable","disable","schedule"]}],bI=[{id:"gateway.restart",label:l("commandPalette.commands.gateway.restart"),category:"gateway",icon:"🔄",action:async()=>{if(confirm(l("commandPalette.confirm.restartGateway")))try{await N("gateway.restart",{})}catch{}},isAvailable:()=>D.value,keywords:["reboot","reload","refresh"]}],xI=[{id:"settings.theme",label:l("commandPalette.commands.settings.theme"),category:"settings",icon:"🎨",hasSubmenu:!0,getValue:()=>{const e=vt.value;return e.selected==="system"?l("commandPalette.commands.settings.systemTheme"):xd().find(r=>r.id===e.selected)?.name||e.selected},getSubmenuItems:()=>{const e=vt.value.selected,t=xd(),a=[{id:"system",label:l("commandPalette.commands.settings.systemTheme"),isActive:e==="system",action:()=>ms("system")}];for(const r of t)a.push({id:r.id,label:r.name,description:r.appearance==="dark"?l("common.dark"):l("common.light"),isActive:e===r.id,action:()=>ms(r.id)});return a},keywords:["dark","light","appearance","color","dracula","monokai","nord","catppuccin","gruvbox","solarized"]}],yI=[...pI,...mI,...vI,...gI,...bI,...xI];function wI(){return yI.filter(e=>e.isAvailable?e.isAvailable():!0)}function Ch(e){return l(`commandPalette.categories.${e}`)}const kI=["chat","session","model","cron","gateway","settings"],Hn=m(!1),Yy="cove:command-palette:recent",SI=5;function Zy(){try{const e=localStorage.getItem(Yy);return e?JSON.parse(e):[]}catch{return[]}}function ng(e){const t=Zy().filter(a=>a!==e);t.unshift(e),localStorage.setItem(Yy,JSON.stringify(t.slice(0,SI)))}function ld(e,t){const a=e.toLowerCase(),r=t.toLowerCase();if(r===a)return 100;if(r.startsWith(a))return 90;if(r.includes(a))return 70;let o=0,s=0;for(let i=0;i<r.length&&s<a.length;i++)r[i]===a[s]&&(o+=10,s++);return s===a.length?o:0}function _I(e,t){if(!t)return 0;let a=ld(t,e.label);if(e.keywords)for(const o of e.keywords){const s=ld(t,o);s>a&&(a=s)}const r=ld(t,Ch(e.category));return r>a&&(a=r),a}function Xy(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 CI(){const[e,t]=U(""),[a,r]=U(0),[o,s]=U(null),[i,c]=U(!1),u=F(null),d=F(null),h=Hn.value,f=wI(),p=Zy(),v=xe(()=>{if(e)return f.map(x=>({cmd:x,score:_I(x,e)})).filter(({score:x})=>x>0).sort((x,S)=>S.score-x.score).map(({cmd:x})=>x);{const x=p.map(k=>f.find(I=>I.id===k)).filter(k=>k!==void 0),S=f.filter(k=>!p.includes(k.id));return[...x,...S]}},[f,p,e]),w=xe(()=>e?null:TI(v,p),[v,p,e]),C=xe(()=>{if(!o)return[];if(!e)return o.items;const x=e.toLowerCase();return o.items.filter(S=>S.label.toLowerCase().includes(x)||(S.description?.toLowerCase().includes(x)??!1))},[o,e]),T=o?C:v,b=xe(()=>{if(o&&C[a])return`cmd-sub-${C[a].id}`;if(v[a])return`cmd-${v[a].id}`},[o,C,v,a]);R(()=>{r(0)},[e,o]),R(()=>{h&&(t(""),r(0),s(null),setTimeout(()=>u.current?.focus(),0))},[h]),R(()=>{const x=S=>{if(Hn.value){if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),o?(s(null),t(""),r(0)):Hn.value=!1;return}if(S.key==="ArrowDown"){S.preventDefault(),r(k=>Math.min(k+1,T.length-1));return}if(S.key==="ArrowUp"){S.preventDefault(),r(k=>Math.max(k-1,0));return}if(S.key==="Enter"){if(S.preventDefault(),o){const k=C[a];k&&y(k)}else{const k=v[a];k&&g(k)}return}S.key==="Backspace"&&e===""&&o&&(s(null),r(0))}};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[o,C,v,a,e,T.length]),R(()=>{const x=d.current;if(!x)return;const S=x.querySelector("[aria-selected='true']");S&&S.scrollIntoView({block:"nearest"})},[a]);const g=async x=>{if(x.hasSubmenu&&x.getSubmenuItems){c(!0);try{const S=await x.getSubmenuItems();s({command:x,items:S}),r(0),t("")}finally{c(!1)}}else x.action&&(ng(x.id),Hn.value=!1,await x.action())},y=async x=>{Hn.value=!1,o&&ng(o.command.id),await x.action()};return h?n("div",{class:"fixed inset-0 z-50 flex items-start justify-center pt-[12vh] sm:pt-[15vh] animate-fade-in",onClick:()=>{Hn.value=!1},onKeyDown:x=>{x.key==="Escape"&&(Hn.value=!1)},role:"dialog","aria-modal":"true","aria-label":l("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",role:"dialog","aria-modal":"true","aria-label":"Command palette",onClick:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation(),children:[n("div",{class:"p-3 border-b border-[var(--color-border)]",children:n("div",{class:"flex items-center gap-3 px-4 py-2.5 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)] shadow-soft-sm transition-all duration-200",children:[n("span",{class:"text-[var(--color-text-muted)]","aria-hidden":"true",children:o?"→":"⌘"}),n("input",{ref:u,type:"text",value:e,onInput:x=>t(x.target.value),placeholder:o?`${o.command.label}...`:l("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":b}),i&&n("span",{class:"text-[var(--color-text-muted)] text-sm",children:l("common.loading")})]})}),n("div",{ref:d,id:"command-list",class:"max-h-[60vh] overflow-y-auto p-2",role:"listbox","aria-label":o?o.command.label:l("commandPalette.placeholder"),children:o?n("div",{children:C.length===0?n("div",{class:"px-3 py-8 text-center text-[var(--color-text-muted)]",children:l(e?"commandPalette.noMatches":"common.noItems")}):C.map((x,S)=>n("button",{id:`cmd-sub-${x.id}`,role:"option","aria-selected":S===a,onClick:()=>y(x),class:Xy(S===a),children:[n("span",{class:`flex-1 ${x.isActive?"text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)]"}`,children:x.label}),x.description&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:x.description}),x.isActive&&n("span",{class:"text-[var(--color-accent)]","aria-hidden":"true",children:"✓"})]},x.id))}):e?n("div",{children:v.length===0?n("div",{class:"px-3 py-8 text-center text-[var(--color-text-muted)]",children:l("commandPalette.noCommands")}):v.map((x,S)=>n(ag,{command:x,isSelected:S===a,onClick:()=>g(x)},x.id))}):n("div",{children:w&&w.map(x=>n("div",{class:"mb-2",children:[n("div",{class:"px-3 py-1 text-xs font-medium text-[var(--color-text-muted)] uppercase tracking-wider",children:x.label}),x.commands.map(S=>{const k=v.indexOf(S);return n(ag,{command:S,isSelected:k===a,onClick:()=>g(S)},S.id)})]},x.category))})}),n("div",{class:"flex items-center gap-4 px-4 py-2 border-t border-[var(--color-border)] bg-[var(--color-bg-secondary)] text-xs text-[var(--color-text-muted)]",children:[n("span",{children:l("commandPalette.hints.navigate")}),n("span",{children:l("commandPalette.hints.select")}),n("span",{children:l(o?"commandPalette.hints.back":"commandPalette.hints.close")})]})]})]}):null}function ag({command:e,isSelected:t,onClick:a}){const r=e.getValue?.();return n("button",{id:`cmd-${e.id}`,role:"option","aria-selected":t,onClick:a,class:Xy(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}),r&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:r}),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 TI(e,t){const a=[],r=e.filter(s=>t.includes(s.id));r.length>0&&a.push({category:"recent",label:Ch("recent"),commands:r});const o=e.filter(s=>!t.includes(s.id));for(const s of kI){const i=o.filter(c=>c.category===s);i.length>0&&a.push({category:s,label:Ch(s),commands:i})}return a}function EI(){R(()=>{const e=t=>{t.key==="k"&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),t.stopPropagation(),Hn.value=!Hn.value)};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[])}const rg=m(null);function AI(){R(()=>{Te(()=>import("./CanvasPanel-9jVF_oa3.js"),[]).then(t=>{rg.value=t.CanvasPanel})},[]);const e=rg.value;return e?n(e,{}):null}q1();const Th=Bc(),MI=m(!!(Th?.url&&Th.rememberMe)),og=m(!1),yi=m(!c1()&&!Th?.url),id=m(!1),wi=m(null);function II(){R(()=>{ew(),qw(),DI().finally(()=>{og.value=!0})},[]),EI();const e=()=>{yi.value=!1,d1()&&setTimeout(()=>{wi.value=fI(Ln.value),id.value=!0},500)},t=()=>{yi.value=!1},a=()=>{id.value=!1,wi.value=null},r=Ue.value==="reconnecting",o=!yi.value&&!r&&(og.value?!D.value:!MI.value);if(window.location.pathname==="/canvas")return n(Tm,{children:n(Rm,{onError:c=>V.error(`Error: ${c.message}`),children:n(JM,{})})});let i;return yi.value?i=n(tI,{onComplete:e,onSkip:t}):o?i=n(Y5,{}):i=n($I,{}),n(Tm,{children:[n(Rm,{onError:c=>{V.error(`Error: ${c.message}`)},children:n(T_,{children:i})}),n(L_,{position:"top-right"}),n(CI,{}),n(AI,{}),id.value&&wi.value&&n(uI,{steps:wi.value,onComplete:a})]})}function RI(e){try{return new URL(e,window.location.origin).pathname.replace(/\/+$/,"")||"/"}catch{return(e.split(/[?#]/)[0]||"/").replace(/\/+$/,"")||"/"}}function LI(e){const t=RI(e.url||window.location.pathname);t==="/settings"&&!Qt.value.startsWith("/settings")&&(_b.value=Qt.value),Qt.value=t}function $I(){return n(Og,{onChange:LI,children:[n(li,{path:"/"}),n(li,{path:"/chat"}),n(li,{path:"/chat/:sessionKey"}),n(aT,{path:"/overview"}),n(hM,{path:"/usage"}),n(AM,{path:"/channels"}),n($M,{path:"/instances"}),n(qM,{path:"/sessions"}),n($T,{path:"/cron"}),n(a6,{path:"/skills"}),n(B6,{path:"/agents"}),n(G6,{path:"/agents/edit/:filename"}),n(RA,{path:"/devices"}),n(TE,{path:"/settings"}),n(nE,{path:"/config"}),n(XE,{path:"/debug"}),n(fA,{path:"/logs"}),n(li,{default:!0})]})}async function DI(){const e=Bc();if(!e?.url||!e.rememberMe)return;const t=Uh();if(t)try{await Sl({url:e.url,token:e.authMode==="token"?t:void 0,password:e.authMode==="password"?t:void 0,autoReconnect:!0}),await Wc(),await Sb(),await of(),ho("main"),await rf("main"),lf(),cf(),j_(),t4(),Te(async()=>{const{canvasNodeEnabled:a}=await Promise.resolve().then(()=>Bw);return{canvasNodeEnabled:a}},void 0).then(({canvasNodeEnabled:a})=>{a.value&&Te(()=>Promise.resolve().then(()=>ay),void 0).then(r=>r.startNodeConnection())})}catch{zh("")}}fd(n(II,{}),document.querySelector("#app"));export{F as A,PI as B,GM as C,jI as D,$o as E,Db as F,H as G,C_ as H,q as I,nh as J,m as K,HI as L,NI as M,Ma as X,Nd as a,Zr as b,L as c,Hr as d,fc as e,FI as f,OI as g,WI as h,lx as i,zI as j,UI as k,U as l,zr as m,Ni as n,Fi as o,Od as p,Q as q,Js as r,nr as s,ar as t,du as u,mE as v,n as w,l as x,R as y,BI as z};
447
+ `,children:n(s,{class:o})})}function Yy({onBack:e,onNext:t,nextLabel:a,backLabel:r,nextDisabled:o=!1,nextLoading:s=!1,class:i}){return n("div",{class:`flex gap-3 mt-6 ${i||""}`,children:[e&&n(P,{variant:"ghost",onClick:e,icon:n(qc,{class:"w-4 h-4"}),children:r||l("actions.back")}),n(P,{variant:"primary",onClick:t,disabled:o,loading:s,class:e?"flex-1":"w-full",iconRight:n(Vc,{class:"w-4 h-4"}),children:a||l("actions.continue")})]})}function oI({steps:e,current:t,class:a}){const r=e.indexOf(t);return n("div",{class:`flex justify-center gap-2 ${a||""}`,children:e.map((o,s)=>n("div",{class:`h-1.5 rounded-full transition-all duration-300 ${s<=r?"w-8 bg-[var(--color-accent)]":"w-4 bg-[var(--color-border)]"}`},o))})}function sI({onComplete:e,onSkip:t}){const a=X("welcome"),r=X(""),o=X("token"),s=X(""),i=X(!0),c=X(!1),u=X(!1),d=X(null),h=X(!1),f=X(!1),p=X(!0),v=X("single"),w=Fc(()=>{const k=r.value.trim();if(!k||!k.startsWith("ws://")&&!k.startsWith("wss://"))return!1;try{return new URL(k),!0}catch{return!1}}),C=F(!1);Mh(()=>{C.current||(C.current=!0,Ze.value=!0)},[]),fd(()=>{const k=r.value;if(f.value=!1,h.value=!1,!w.value)return;const I=new AbortController,A=setTimeout(async()=>{if(I.signal.aborted||r.peek()!==k)return;h.value=!0,d.value=null;const O=await Wp(k,I.signal);!I.signal.aborted&&r.peek()===k&&(h.value=!1,O.ok?(f.value=!0,d.value=null):O.error!=="Aborted"&&(f.value=!1,d.value=O.error||l("onboarding.probeError")))},600);return()=>{clearTimeout(A),I.abort()}});const T=()=>r.value.trim()?w.value?(d.value=null,!0):(d.value=l("onboarding.urlError"),!1):(d.value=l("errors.required"),!1),b=async()=>{c.value=!0,u.value=!1;try{await Sl({url:r.value,token:o.value==="token"?s.value:void 0,password:o.value==="password"?s.value:void 0,autoReconnect:!0}),Oh({url:r.value,authMode:o.value,rememberMe:i.value,credential:s.value}),Op(),await jc(),await af(),fo("main"),await nf("main"),of(),sf(),u.value=!0}catch(k){M.auth.error("Connect failed:",k),u.value=!1}finally{c.value=!1}},g=()=>{ho(),u.value=!1,a.value="auth"},y=async()=>{if(!T())return;if(f.value){a.value="auth";return}if(h.value)return;h.value=!0,d.value=null;const k=await Wp(r.value);h.value=!1,k.ok?(f.value=!0,setTimeout(()=>{a.value="auth",f.value=!1},500)):d.value=k.error||l("onboarding.probeError")},E=()=>{a.value==="welcome"?a.value="url":a.value==="url"?y():a.value==="auth"&&(a.value="connect",b())},x=()=>{a.value==="url"?a.value="welcome":a.value==="auth"?a.value="url":a.value==="connect"&&!u.value&&(a.value="auth")},S=()=>{Op(),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(oI,{steps:["welcome","url","auth","connect"],current:a.value,class:"mb-4 sm:mb-8"}),a.value==="welcome"&&n(lI,{onNext:E,onSkip:S}),a.value==="url"&&n(iI,{url:r.value,onUrlChange:k=>{r.value=k,d.value=null,f.value=!1},error:d.value,canProceed:w.value,probing:h.value,probeSuccess:f.value,onNext:E,onBack:x,onSkip:S}),a.value==="auth"&&n(cI,{authMode:o.value,onAuthModeChange:k=>o.value=k,credential:s.value,onCredentialChange:k=>s.value=k,rememberMe:i.value,onRememberMeChange:k=>i.value=k,onNext:E,onBack:x}),a.value==="connect"&&n(uI,{connecting:c.value,connected:u.value,error:ia.value,showTour:p.value,onShowTourChange:k=>p.value=k,selectedMode:v.value,onModeChange:k=>{v.value=k,$n.value=k},onRetry:g,onContinue:()=>{d1(p.value),$n.value=v.value,e()}})]})})}function lI({onNext:e,onSkip:t}){return n("div",{class:"text-center",children:[n(eu,{size:"lg",class:"mx-auto mb-2 sm:mb-4 w-12 h-12 sm:w-16 sm:h-16"}),n("h1",{class:"text-xl sm:text-2xl font-bold mb-1 sm:mb-2",children:l("onboarding.welcome")}),n("p",{class:"text-sm sm:text-base text-[var(--color-text-muted)] mb-4 sm:mb-8",children:l("onboarding.welcomeSubtitle")}),n("div",{class:"grid gap-2 sm:gap-4 mb-4 sm:mb-8 text-left",children:[n(ad,{icon:n(Nn,{class:"w-5 h-5"}),title:l("onboarding.feature1Title"),description:l("onboarding.feature1Desc")}),n(ad,{icon:n(Zc,{class:"w-5 h-5"}),title:l("onboarding.feature2Title"),description:l("onboarding.feature2Desc")}),n(ad,{icon:n(rn,{class:"w-5 h-5"}),title:l("onboarding.feature3Title"),description:l("onboarding.feature3Desc")})]}),n("div",{class:"space-y-3",children:[n(P,{variant:"primary",onClick:e,fullWidth:!0,iconRight:n(Vc,{class:"w-4 h-4"}),children:l("onboarding.getStarted")}),n(ap,{onClick:t,children:l("onboarding.skipToLogin")})]})]})}function ad({icon:e,title:t,description:a}){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:a})]})]})}function iI({url:e,onUrlChange:t,error:a,canProceed:r,probing:o,probeSuccess:s,onNext:i,onBack:c,onSkip:u}){const d=f=>{f.key==="Enter"&&s&&i()},h=()=>{if(o)return n(te,{size:"sm"});if(s)return n(on,{class:"w-4 h-4 text-[var(--color-success)]"});if(a&&r)return n(Do,{content:a,placement:"left",children:n("span",{class:"cursor-help",children:n(Gc,{class:"w-4 h-4 text-[var(--color-error)]"})})})};return n(G,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:l("common.connectToGateway")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-3 sm:mb-6",children:l("onboarding.urlSubtitle")}),n(De,{label:l("common.gatewayUrl"),htmlFor:"gateway-url",children:n(Y,{id:"gateway-url",type:"url",value:e,onInput:f=>t(f.target.value),onKeyDown:d,placeholder:l("auth.gatewayUrlPlaceholder"),rightElement:h(),autoCorrect:"off",autoCapitalize:"off",spellcheck:!1,fullWidth:!0})}),n(Jn,{title:l("onboarding.troubleshootTitle"),items:[l("onboarding.troubleshoot1"),l("onboarding.troubleshoot2"),l("onboarding.troubleshoot3")],class:"mt-3 sm:mt-4 text-xs sm:text-sm"}),n(Yy,{onBack:c,onNext:i,nextDisabled:!s}),n("div",{class:"text-center mt-4",children:n(ap,{onClick:u,disabled:o,children:l("onboarding.skipToLogin")})})]})}function cI({authMode:e,onAuthModeChange:t,credential:a,onCredentialChange:r,rememberMe:o,onRememberMeChange:s,onNext:i,onBack:c}){const u=h=>{h.key==="Enter"&&i()},d=[{value:"token",label:l("common.token")},{value:"password",label:l("common.password")}];return n(G,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:l("onboarding.authTitle")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-3 sm:mb-6",children:l("onboarding.authSubtitle")}),n("div",{class:"space-y-3 sm:space-y-4",children:[n(De,{label:l("onboarding.authMethod"),children:n(Me,{value:e,onChange:h=>t(h),options:d,"aria-label":l("onboarding.authMethod"),class:"w-full"})}),n(De,{label:l(e==="token"?"common.token":"common.password"),htmlFor:"credential",children:n(Pf,{id:"credential",value:a,onInput:h=>r(h.target.value),onKeyDown:u,placeholder:l(e==="token"?"auth.tokenPlaceholder":"auth.passwordPlaceholder"),fullWidth:!0})}),n(Be,{checked:o,onChange:s,label:l("auth.rememberMe"),description:l("onboarding.rememberMeDesc"),size:"sm"})]}),n(Yy,{onBack:c,onNext:i,nextLabel:l("actions.connect")})]})}function uI({connecting:e,connected:t,error:a,showTour:r,onShowTourChange:o,selectedMode:s,onModeChange:i,onRetry:c,onContinue:u}){return n(G,{variant:"elevated",padding:"md",class:"text-center",children:[e&&n(H,{children:[n(te,{size:"md",class:"mx-auto mb-3 sm:mb-4"}),n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:l("common.connecting")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:l("onboarding.connectingDesc")})]}),!e&&t&&n(H,{children:[n(Xv,{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:l("onboarding.success")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-4 sm:mb-6",children:l("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:l("onboarding.modeTitle")}),n("div",{class:"grid grid-cols-2 gap-2 sm:gap-3",children:[n("button",{type:"button",onClick:()=>i("single"),class:`p-2 sm:p-4 rounded-lg border-2 text-left transition-colors ${s==="single"?"border-[var(--color-accent)] bg-[var(--color-accent)]/10":"border-[var(--color-border)] hover:border-[var(--color-accent)]/50"}`,children:[n(Pn,{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:l("onboarding.modeSingle")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1 hidden sm:block",children:l("onboarding.modeSingleDesc")})]}),n("button",{type:"button",onClick:()=>i("multi"),class:`p-2 sm:p-4 rounded-lg border-2 text-left transition-colors ${s==="multi"?"border-[var(--color-accent)] bg-[var(--color-accent)]/10":"border-[var(--color-border)] hover:border-[var(--color-accent)]/50"}`,children:[n($4,{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:l("onboarding.modeMulti")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1 hidden sm:block",children:l("onboarding.modeMultiDesc")})]})]})]}),n("div",{class:"mb-4 sm:mb-6",children:n("button",{type:"button",onClick:()=>{const d=!Ze.value;Ze.value=d,d?Bf():Wf()},class:`w-full p-3 sm:p-4 rounded-lg border-2 text-left transition-colors flex items-start gap-3 ${Ze.value?"border-[var(--color-accent)] bg-[var(--color-accent)]/10":"border-[var(--color-border)] hover:border-[var(--color-accent)]/50"}`,children:[n(Ob,{class:"w-5 h-5 flex-shrink-0 text-[var(--color-accent)]"}),n("div",{class:"flex-1",children:[n("div",{class:"text-xs sm:text-sm font-medium",children:l("common.enableCanvas")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1",children:l("onboarding.canvasDesc")})]}),n("div",{class:`w-4 h-4 rounded-full border-2 flex-shrink-0 flex items-center justify-center ${Ze.value?"border-[var(--color-accent)] bg-[var(--color-accent)]":"border-[var(--color-border)]"}`,children:Ze.value&&n(on,{class:"w-3 h-3 text-white"})})]})}),n("div",{class:"mb-4 sm:mb-6",children:n(Be,{checked:r,onChange:o,label:l("onboarding.showFeatureTour"),size:"sm"})}),n(P,{variant:"primary",onClick:u,fullWidth:!0,iconRight:n(Vc,{class:"w-4 h-4"}),children:l(r?"actions.continue":"onboarding.startChatting")})]}),!e&&!t&&a&&n(H,{children:[n(Xv,{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:l("onboarding.failed")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-error)] mb-3 sm:mb-4",children:a}),n(Jn,{title:l("onboarding.failedHints"),items:[l("onboarding.hint1"),l("onboarding.hint2"),l("onboarding.hint3"),l("onboarding.hint4")],class:"text-left mb-4 sm:mb-6 text-xs sm:text-sm"}),n(P,{variant:"primary",onClick:c,fullWidth:!0,icon:n(qc,{class:"w-4 h-4"}),children:l("common.tryAgain")})]})]})}const dI=150,hI=300,fI=50,Pt=16,bi=8,pI=8;function mI({steps:e,onComplete:t,spotlightPadding:a=pI}){const r=X(0),o=X(0),s=X(null),i=F(null),c=X(null),u=X(!1),d=e[o.value],h=e[r.value],f=r.value===0,p=r.value===e.length-1,v=F(null),w=F(""),C=F(""),T=Q(async()=>{if(!h)return;v.current&&(v.current.style.zIndex=w.current,v.current.style.position=C.current,v.current=null),await new Promise(k=>setTimeout(k,dI)),o.value=r.peek(),h.beforeShow&&await h.beforeShow(),await new Promise(k=>setTimeout(k,fI));const x=document.querySelectorAll(h.target);let S=null;for(const k of x)if(k instanceof HTMLElement&&k.offsetParent!==null){S=k;break}if(S){S.scrollIntoView({behavior:"smooth",block:"center"}),await new Promise(I=>setTimeout(I,hI)),w.current=S.style.zIndex,C.current=S.style.position,v.current=S,(!S.style.position||S.style.position==="static")&&(S.style.position="relative"),S.style.zIndex="10000";const k=S.getBoundingClientRect();s.value=k}else s.value=null;u.value=!1},[h]);fd(()=>{r.value,u.value=!0,T()}),fd(()=>{const x=s.value;if(!x||!i.current)return;const k=i.current.getBoundingClientRect(),I={width:window.innerWidth,height:window.innerHeight};let A=h?.placement||"bottom",O=0,z=0;const se={bottom:{top:x.bottom+a+bi+Pt,left:x.left+x.width/2-k.width/2,fits:x.bottom+a+k.height+Pt<I.height},top:{top:x.top-a-k.height-bi-Pt,left:x.left+x.width/2-k.width/2,fits:x.top-a-k.height-Pt>0},right:{top:x.top+x.height/2-k.height/2,left:x.right+a+bi+Pt,fits:x.right+a+k.width+Pt<I.width},left:{top:x.top+x.height/2-k.height/2,left:x.left-a-k.width-bi-Pt,fits:x.left-a-k.width-Pt>0}},Fe=A==="top"?["top","bottom","right","left"]:A==="left"?["left","right","bottom","top"]:A==="right"?["right","left","bottom","top"]:["bottom","top","right","left"];for(const yt of Fe)if(se[yt].fits){A=yt;break}const et=se[A];O=et.top,z=et.left,z=Math.max(Pt,Math.min(z,I.width-k.width-Pt)),O=Math.max(Pt,Math.min(O,I.height-k.height-Pt));const he=A==="bottom"?"top":A==="top"?"bottom":A==="left"?"right":"left";c.value={top:O,left:z,arrowPosition:he}}),R(()=>{const x=()=>T();return window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[T]),R(()=>()=>{v.current&&(v.current.style.zIndex=w.current,v.current.style.position=C.current)},[]),R(()=>{if(!h?.autoAdvanceWhen)return;const x=setInterval(()=>{h.autoAdvanceWhen?.()&&(p?t():r.value++)},500);return()=>clearInterval(x)},[h,p,t]),R(()=>{const x=S=>{S.key==="Escape"?t():S.key==="ArrowRight"||S.key==="Enter"?p?t():r.value++:S.key==="ArrowLeft"&&!f&&r.value--};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[f,p,t]);const b=()=>{p?t():r.value++},g=()=>{f||r.value--},y=s.value,E=c.value;return Qc(n("div",{class:"fixed inset-0 z-[9999] pointer-events-none",children:[n("svg",{class:"absolute inset-0 w-full h-full pointer-events-none",children:[n("defs",{children:n("mask",{id:"spotlight-mask",children:[n("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"}),y&&n("rect",{x:y.left-a,y:y.top-a,width:y.width+a*2,height:y.height+a*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)"})]}),y&&n("div",{class:"absolute border-2 border-[var(--color-accent)] rounded-lg pointer-events-none",style:{top:y.top-a,left:y.left-a,width:y.width+a*2,height:y.height+a*2}}),n("div",{ref:i,class:"absolute z-10 bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-xl shadow-lg p-4 max-w-sm transition-opacity duration-150",style:{top:E?.top??-9999,left:E?.left??-9999,opacity:E&&!u.value?1:0,pointerEvents:E&&!u.value?"auto":"none"},children:[E&&n("div",{class:`absolute w-3 h-3 bg-[var(--color-bg-surface)] border-[var(--color-border)] transform rotate-45 ${E.arrowPosition==="top"?"-top-1.5 left-1/2 -translate-x-1/2 border-l border-t":E.arrowPosition==="bottom"?"-bottom-1.5 left-1/2 -translate-x-1/2 border-r border-b":E.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:d?.title}),n("p",{class:"text-sm text-[var(--color-text-secondary)] mb-4",children:d?.content}),n("div",{class:"flex items-center justify-between gap-2",children:[n(ap,{onClick:t,icon:n(Ma,{class:"w-3 h-3"}),children:l("tour.skipTour")}),n("div",{class:"flex gap-2",children:[!f&&n(P,{variant:"ghost",size:"sm",onClick:g,icon:n(qc,{class:"w-3 h-3"}),children:l("actions.back")}),n(P,{variant:"primary",size:"sm",onClick:b,iconRight:n(Vc,{class:"w-3 h-3"}),children:l(p?"actions.done":"actions.next")})]})]})]}),n("div",{class:"absolute inset-0",role:"presentation",onClick:x=>{if(y){const S=x.clientX,k=x.clientY;S>=y.left-a&&S<=y.right+a&&k>=y.top-a&&k<=y.bottom+a||(x.preventDefault(),x.stopPropagation())}},onKeyDown:()=>{},style:{pointerEvents:"auto"}})]}),document.body)}function vI(){return[{target:"[data-tour='sessions']",title:l("tour.steps.sessions.title"),content:l("tour.steps.sessions.content"),placement:"right"}]}function Qv(){return[{target:"[data-tour='chat-input']",title:l("tour.steps.chatInput.title"),content:l("tour.steps.chatInput.content"),placement:"top"},{target:"[data-tour='model-picker']",title:l("tour.steps.modelPicker.title"),content:l("tour.steps.modelPicker.content"),placement:"top"},{target:"[data-tour='settings']",title:l("common.settings"),content:l("tour.steps.settings.content"),placement:"bottom"}]}function gI(){return{target:"[data-tour='pending-requests']",title:l("tour.steps.canvasPairing.title"),content:l("tour.steps.canvasPairing.content"),placement:"bottom",beforeShow:async()=>{Oe("/devices"),await new Promise(e=>setTimeout(e,500))},autoAdvanceWhen:()=>To.value==="paired"}}function eg(){return{target:"[data-tour='canvas']",title:l("common.canvas"),content:l("tour.steps.canvasButton.content"),placement:"bottom",beforeShow:async()=>{Oe("/");for(let e=0;e<20;e++)if(await new Promise(t=>setTimeout(t,100)),document.querySelector("[data-tour='canvas']"))return}}}function bI(e){const t=e==="multi"?[...vI(),...Qv()]:Qv();return Ze.value?To.value==="paired"&&Rr.value?[...t,eg()]:[...t,gI(),eg()]:t}async function tg(){try{return(await N("cron.list",{})).jobs||[]}catch{return[]}}const xI=[{id:"chat.abort",label:l("commandPalette.commands.chat.abort"),category:"chat",icon:"⏹",shortcut:"⌘.",action:()=>{const e=at.value;e&&gb(e)},keywords:["stop","cancel","halt"]},{id:"chat.clear",label:l("commandPalette.commands.chat.clear"),category:"chat",icon:"🗑",action:()=>{Bc()},keywords:["delete","reset","empty"]},{id:"chat.search",label:l("commandPalette.commands.chat.search"),category:"chat",icon:"🔍",shortcut:"⌘F",action:()=>{mt.value=!0,Tn.value=""},keywords:["find","filter"]},{id:"chat.export",label:l("commandPalette.commands.chat.export"),category:"chat",icon:"📄",action:()=>{const e=je.value;if(e.length===0)return;const t=["# Chat Export","",`Exported: ${new Date().toLocaleString()}`,"","---",""];for(const i of e){const c=i.role==="user"?"**You**":"**Assistant**";t.push(c),t.push(""),t.push(i.content||""),t.push(""),t.push("---"),t.push("")}const a=t.join(`
448
+ `),r=new Blob([a],{type:"text/markdown"}),o=URL.createObjectURL(r),s=document.createElement("a");s.href=o,s.download=`chat-${new Date().toISOString().slice(0,10)}.md`,s.click(),URL.revokeObjectURL(o)},keywords:["download","save","markdown"]},{id:"chat.copy-last",label:l("commandPalette.commands.chat.copyLast"),category:"chat",icon:"📋",action:async()=>{const t=[...je.value].reverse().find(a=>a.role==="assistant");t?.content&&await navigator.clipboard.writeText(t.content)},keywords:["clipboard"]}],yI=[{id:"session.switch",label:l("commandPalette.commands.session.switch"),category:"session",icon:"🔄",hasSubmenu:!0,getSubmenuItems:()=>{const e=Rn.value;return It.value.map(t=>({id:t.key,label:t.label||t.key,isActive:t.key===e,description:t.model,action:()=>{fo(t.key),Oe(`/chat/${encodeURIComponent(t.key)}`)}}))},isAvailable:()=>!Ws.value&&It.value.length>1,keywords:["change","select"]},{id:"session.delete",label:l("commandPalette.commands.session.delete"),category:"session",icon:"🗑",action:async()=>{const e=at.value;if(e&&confirm(l("common.deleteThisSession")))try{await N("sessions.delete",{key:e})}catch{}},isAvailable:()=>!Ws.value,keywords:["remove"]},{id:"session.copy-key",label:l("commandPalette.commands.session.copyKey"),category:"session",icon:"🔑",action:async()=>{const e=at.value;e&&await navigator.clipboard.writeText(e)},keywords:["clipboard"]}],wI=[{id:"model.change",label:l("commandPalette.commands.model.change"),category:"model",icon:"🤖",hasSubmenu:!0,getSubmenuItems:()=>ka.value.map(e=>({id:e.id,label:e.name||e.id,description:e.provider,action:async()=>{const t=at.value;if(t)try{await N("sessions.patch",{key:t,model:e.id})}catch{}}})),keywords:["switch","select","ai"]}],kI=[{id:"cron.run",label:l("commandPalette.commands.cron.run"),category:"cron",icon:"▶️",hasSubmenu:!0,getSubmenuItems:async()=>{const e=await tg();return e.length===0?[{id:"none",label:l("common.noItems"),action:()=>{}}]:e.map(t=>({id:t.id,label:t.name||t.id,description:t.enabled?l("common.enabled"):l("common.disabled"),action:async()=>{try{await N("cron.run",{jobId:t.id})}catch{}}}))},isAvailable:()=>D.value,keywords:["trigger","execute","schedule"]},{id:"cron.toggle",label:l("commandPalette.commands.cron.toggle"),category:"cron",icon:"⏯",hasSubmenu:!0,getSubmenuItems:async()=>{const e=await tg();return e.length===0?[{id:"none",label:l("common.noItems"),action:()=>{}}]:e.map(t=>({id:t.id,label:`${t.name||t.id}: ${t.enabled?"ON":"OFF"}`,isActive:t.enabled,action:async()=>{try{await N("cron.update",{jobId:t.id,patch:{enabled:!t.enabled}})}catch{}}}))},isAvailable:()=>D.value,keywords:["enable","disable","schedule"]}],SI=[{id:"gateway.restart",label:l("commandPalette.commands.gateway.restart"),category:"gateway",icon:"🔄",action:async()=>{if(confirm(l("commandPalette.confirm.restartGateway")))try{await N("gateway.restart",{})}catch{}},isAvailable:()=>D.value,keywords:["reboot","reload","refresh"]}],_I=[{id:"settings.theme",label:l("commandPalette.commands.settings.theme"),category:"settings",icon:"🎨",hasSubmenu:!0,getValue:()=>{const e=vt.value;return e.selected==="system"?l("commandPalette.commands.settings.systemTheme"):vd().find(r=>r.id===e.selected)?.name||e.selected},getSubmenuItems:()=>{const e=vt.value.selected,t=vd(),a=[{id:"system",label:l("commandPalette.commands.settings.systemTheme"),isActive:e==="system",action:()=>ms("system")}];for(const r of t)a.push({id:r.id,label:r.name,description:r.appearance==="dark"?l("common.dark"):l("common.light"),isActive:e===r.id,action:()=>ms(r.id)});return a},keywords:["dark","light","appearance","color","dracula","monokai","nord","catppuccin","gruvbox","solarized"]}],CI=[...xI,...yI,...wI,...kI,...SI,..._I];function TI(){return CI.filter(e=>e.isAvailable?e.isAvailable():!0)}function Sh(e){return l(`commandPalette.categories.${e}`)}const EI=["chat","session","model","cron","gateway","settings"],Wn=m(!1),Zy="cove:command-palette:recent",AI=5;function Xy(){try{const e=localStorage.getItem(Zy);return e?JSON.parse(e):[]}catch{return[]}}function ng(e){const t=Xy().filter(a=>a!==e);t.unshift(e),localStorage.setItem(Zy,JSON.stringify(t.slice(0,AI)))}function rd(e,t){const a=e.toLowerCase(),r=t.toLowerCase();if(r===a)return 100;if(r.startsWith(a))return 90;if(r.includes(a))return 70;let o=0,s=0;for(let i=0;i<r.length&&s<a.length;i++)r[i]===a[s]&&(o+=10,s++);return s===a.length?o:0}function MI(e,t){if(!t)return 0;let a=rd(t,e.label);if(e.keywords)for(const o of e.keywords){const s=rd(t,o);s>a&&(a=s)}const r=rd(t,Sh(e.category));return r>a&&(a=r),a}function Qy(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 II(){const[e,t]=U(""),[a,r]=U(0),[o,s]=U(null),[i,c]=U(!1),u=F(null),d=F(null),h=Wn.value,f=TI(),p=Xy(),v=ye(()=>{if(e)return f.map(x=>({cmd:x,score:MI(x,e)})).filter(({score:x})=>x>0).sort((x,S)=>S.score-x.score).map(({cmd:x})=>x);{const x=p.map(k=>f.find(I=>I.id===k)).filter(k=>k!==void 0),S=f.filter(k=>!p.includes(k.id));return[...x,...S]}},[f,p,e]),w=ye(()=>e?null:RI(v,p),[v,p,e]),C=ye(()=>{if(!o)return[];if(!e)return o.items;const x=e.toLowerCase();return o.items.filter(S=>S.label.toLowerCase().includes(x)||(S.description?.toLowerCase().includes(x)??!1))},[o,e]),T=o?C:v,b=ye(()=>{if(o&&C[a])return`cmd-sub-${C[a].id}`;if(v[a])return`cmd-${v[a].id}`},[o,C,v,a]);R(()=>{r(0)},[e,o]),R(()=>{h&&(t(""),r(0),s(null),setTimeout(()=>u.current?.focus(),0))},[h]),R(()=>{const x=S=>{if(Wn.value){if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),o?(s(null),t(""),r(0)):Wn.value=!1;return}if(S.key==="ArrowDown"){S.preventDefault(),r(k=>Math.min(k+1,T.length-1));return}if(S.key==="ArrowUp"){S.preventDefault(),r(k=>Math.max(k-1,0));return}if(S.key==="Enter"){if(S.preventDefault(),o){const k=C[a];k&&y(k)}else{const k=v[a];k&&g(k)}return}S.key==="Backspace"&&e===""&&o&&(s(null),r(0))}};return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[o,C,v,a,e,T.length]),R(()=>{const x=d.current;if(!x)return;const S=x.querySelector("[aria-selected='true']");S&&S.scrollIntoView({block:"nearest"})},[a]);const g=async x=>{if(x.hasSubmenu&&x.getSubmenuItems){c(!0);try{const S=await x.getSubmenuItems();s({command:x,items:S}),r(0),t("")}finally{c(!1)}}else x.action&&(ng(x.id),Wn.value=!1,await x.action())},y=async x=>{Wn.value=!1,o&&ng(o.command.id),await x.action()};return h?n("div",{class:"fixed inset-0 z-50 flex items-start justify-center pt-[12vh] sm:pt-[15vh] animate-fade-in",onClick:()=>{Wn.value=!1},onKeyDown:x=>{x.key==="Escape"&&(Wn.value=!1)},role:"dialog","aria-modal":"true","aria-label":l("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",role:"dialog","aria-modal":"true","aria-label":"Command palette",onClick:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation(),children:[n("div",{class:"p-3 border-b border-[var(--color-border)]",children:n("div",{class:"flex items-center gap-3 px-4 py-2.5 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)] shadow-soft-sm transition-all duration-200",children:[n("span",{class:"text-[var(--color-text-muted)]","aria-hidden":"true",children:o?"→":"⌘"}),n("input",{ref:u,type:"text",value:e,onInput:x=>t(x.target.value),placeholder:o?`${o.command.label}...`:l("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":b}),i&&n("span",{class:"text-[var(--color-text-muted)] text-sm",children:l("common.loading")})]})}),n("div",{ref:d,id:"command-list",class:"max-h-[60vh] overflow-y-auto p-2",role:"listbox","aria-label":o?o.command.label:l("commandPalette.placeholder"),children:o?n("div",{children:C.length===0?n("div",{class:"px-3 py-8 text-center text-[var(--color-text-muted)]",children:l(e?"commandPalette.noMatches":"common.noItems")}):C.map((x,S)=>n("button",{id:`cmd-sub-${x.id}`,role:"option","aria-selected":S===a,onClick:()=>y(x),class:Qy(S===a),children:[n("span",{class:`flex-1 ${x.isActive?"text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)]"}`,children:x.label}),x.description&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:x.description}),x.isActive&&n("span",{class:"text-[var(--color-accent)]","aria-hidden":"true",children:"✓"})]},x.id))}):e?n("div",{children:v.length===0?n("div",{class:"px-3 py-8 text-center text-[var(--color-text-muted)]",children:l("commandPalette.noCommands")}):v.map((x,S)=>n(ag,{command:x,isSelected:S===a,onClick:()=>g(x)},x.id))}):n("div",{children:w&&w.map(x=>n("div",{class:"mb-2",children:[n("div",{class:"px-3 py-1 text-xs font-medium text-[var(--color-text-muted)] uppercase tracking-wider",children:x.label}),x.commands.map(S=>{const k=v.indexOf(S);return n(ag,{command:S,isSelected:k===a,onClick:()=>g(S)},S.id)})]},x.category))})}),n("div",{class:"flex items-center gap-4 px-4 py-2 border-t border-[var(--color-border)] bg-[var(--color-bg-secondary)] text-xs text-[var(--color-text-muted)]",children:[n("span",{children:l("commandPalette.hints.navigate")}),n("span",{children:l("commandPalette.hints.select")}),n("span",{children:l(o?"commandPalette.hints.back":"commandPalette.hints.close")})]})]})]}):null}function ag({command:e,isSelected:t,onClick:a}){const r=e.getValue?.();return n("button",{id:`cmd-${e.id}`,role:"option","aria-selected":t,onClick:a,class:Qy(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}),r&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:r}),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 RI(e,t){const a=[],r=e.filter(s=>t.includes(s.id));r.length>0&&a.push({category:"recent",label:Sh("recent"),commands:r});const o=e.filter(s=>!t.includes(s.id));for(const s of EI){const i=o.filter(c=>c.category===s);i.length>0&&a.push({category:s,label:Sh(s),commands:i})}return a}function LI(){R(()=>{const e=t=>{t.key==="k"&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),t.stopPropagation(),Wn.value=!Wn.value)};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[])}const rg=m(null);function $I(){R(()=>{Ee(()=>import("./CanvasPanel-OVecKK-K.js"),[]).then(t=>{rg.value=t.CanvasPanel})},[]);const e=rg.value;return e?n(e,{}):null}V1();const _h=Uc(),DI=m(!!(_h?.url&&_h.rememberMe)),og=m(!1),xi=m(!u1()&&!_h?.url),od=m(!1),yi=m(null);function PI(){R(()=>{tw(),Vw(),zI().finally(()=>{og.value=!0})},[]),LI();const e=()=>{xi.value=!1,h1()&&setTimeout(()=>{yi.value=bI($n.value),od.value=!0},500)},t=()=>{xi.value=!1},a=()=>{od.value=!1,yi.value=null},r=Ue.value==="reconnecting",o=!xi.value&&!r&&(og.value?!D.value:!DI.value);if(window.location.pathname==="/canvas")return n(Cm,{children:n(Im,{onError:c=>V.error(`Error: ${c.message}`),children:n(eI,{})})});let i;return xi.value?i=n(sI,{onComplete:e,onSkip:t}):o?i=n(X5,{}):i=n(FI,{}),n(Cm,{children:[n(Im,{onError:c=>{V.error(`Error: ${c.message}`)},children:n(E_,{children:i})}),n($_,{position:"top-right"}),n(II,{}),n($I,{}),od.value&&yi.value&&n(mI,{steps:yi.value,onComplete:a})]})}function OI(e){try{return new URL(e,window.location.origin).pathname.replace(/\/+$/,"")||"/"}catch{return(e.split(/[?#]/)[0]||"/").replace(/\/+$/,"")||"/"}}function NI(e){const t=OI(e.url||window.location.pathname);t==="/settings"&&!en.value.startsWith("/settings")&&(_b.value=en.value),en.value=t}function FI(){return n(Og,{onChange:NI,children:[n(li,{path:"/"}),n(li,{path:"/chat"}),n(li,{path:"/chat/:sessionKey"}),n(oT,{path:"/overview"}),n(gM,{path:"/usage"}),n($M,{path:"/channels"}),n(FM,{path:"/instances"}),n(ZM,{path:"/sessions"}),n(NT,{path:"/cron"}),n(l6,{path:"/skills"}),n(V6,{path:"/agents"}),n(X6,{path:"/agents/edit/:filename"}),n(PA,{path:"/devices"}),n(IE,{path:"/settings"}),n(sE,{path:"/config"}),n(nA,{path:"/debug"}),n(gA,{path:"/logs"}),n(li,{default:!0})]})}async function zI(){const e=Uc();if(!e?.url||!e.rememberMe)return;const t=Fh();if(t)try{await Sl({url:e.url,token:e.authMode==="token"?t:void 0,password:e.authMode==="password"?t:void 0,autoReconnect:!0}),await jc(),await Sb(),await af(),fo("main"),await nf("main"),of(),sf(),H_(),n4(),Ee(async()=>{const{canvasNodeEnabled:a}=await Promise.resolve().then(()=>Ww);return{canvasNodeEnabled:a}},void 0).then(({canvasNodeEnabled:a})=>{a.value&&Ee(()=>Promise.resolve().then(()=>ay),void 0).then(r=>r.startNodeConnection())})}catch{Nh("")}}ud(n(PI,{}),document.querySelector("#app"));export{F as A,UI as B,QM as C,qI as D,$o as E,Db as F,H as G,T_ as H,q as I,Qd as J,m as K,VI as L,HI as M,Ma as X,Dd as a,Zr as b,L as c,Hr as d,dc as e,BI as f,jI as g,JI as h,lx as i,WI as j,KI as k,U as l,zr as m,Oi as n,Ni as o,$d as p,Q as q,Ys as r,nr as s,ar as t,iu as u,xE as v,n as w,l as x,R as y,GI as z};