adonisjs-server-stats 1.17.0 → 1.18.0

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.
Files changed (66) hide show
  1. package/README.md +11 -6
  2. package/dist/core/core/define-config-helpers.d.ts +1 -0
  3. package/dist/core/core/types-diagnostics.d.ts +2 -0
  4. package/dist/core/debug/types.d.ts +2 -0
  5. package/dist/core/types.d.ts +31 -3
  6. package/dist/react/{CacheSection-C-X2Tnca.js → CacheSection-B-lSIN8Q.js} +1 -1
  7. package/dist/react/{CacheTab-D55mfmeE.js → CacheTab-BN0QgPXz.js} +1 -1
  8. package/dist/react/{ConfigSection-C-HGnZfd.js → ConfigSection-u_TSfb9f.js} +1 -1
  9. package/dist/react/{ConfigTab-CNnsOXBh.js → ConfigTab-au26s-ON.js} +1 -1
  10. package/dist/react/{CustomPaneTab-D-267UVd.js → CustomPaneTab-qvMnh8ss.js} +1 -1
  11. package/dist/react/{EmailsSection-Bqw4DI4r.js → EmailsSection-HfEMeRex.js} +1 -1
  12. package/dist/react/{EmailsTab-CkHOhj2F.js → EmailsTab-BWwq-CxB.js} +1 -1
  13. package/dist/react/{EventsSection-CMeyjzVC.js → EventsSection-CA9b15dJ.js} +1 -1
  14. package/dist/react/{EventsTab-DgS2v1HX.js → EventsTab-CgSdHbKU.js} +1 -1
  15. package/dist/react/{InternalsContent-C9lIA92C.js → InternalsContent-CI7HvBtH.js} +51 -47
  16. package/dist/react/{InternalsSection-lOv_UcSV.js → InternalsSection-IEeWXJqP.js} +1 -1
  17. package/dist/react/{InternalsTab-BygoSorC.js → InternalsTab-CoVLHQbF.js} +1 -1
  18. package/dist/react/{JobsSection-oWH6pbrG.js → JobsSection-DgsS_VwU.js} +1 -1
  19. package/dist/react/{JobsTab-zdxX_as-.js → JobsTab-CzwLSRUC.js} +1 -1
  20. package/dist/react/{LogEntryRow-Cn8Ee_X0.js → LogEntryRow-VCCzwD1H.js} +1 -1
  21. package/dist/react/{LogsSection-XmiI2MMs.js → LogsSection-BujNn_cO.js} +2 -2
  22. package/dist/react/{LogsTab-ixusY4v7.js → LogsTab-BtD1h7DM.js} +2 -2
  23. package/dist/react/{OverviewSection-CvhObTLP.js → OverviewSection-B28em0gQ.js} +1 -1
  24. package/dist/react/{QueriesSection-BvledwBI.js → QueriesSection-B0tFn_Dc.js} +1 -1
  25. package/dist/react/{QueriesTab-smQQJvJa.js → QueriesTab-DJY7aavR.js} +1 -1
  26. package/dist/react/{RequestsSection-DKuYpViv.js → RequestsSection-DPmYM7tq.js} +2 -2
  27. package/dist/react/{RoutesSection-5RNVurQ6.js → RoutesSection-Ck-RcFVS.js} +1 -1
  28. package/dist/react/{RoutesTab-CpXNO-Rx.js → RoutesTab-Ch3PDLzo.js} +1 -1
  29. package/dist/react/{SplitPaneWrapper-DQvJnsuk.js → SplitPaneWrapper-BZ6VrBr-.js} +1 -1
  30. package/dist/react/{TimelineTab-LHQHHKkO.js → TimelineTab-_byxh2mJ.js} +2 -2
  31. package/dist/react/{index-LlFvooUN.js → index-De7nsWBN.js} +2 -2
  32. package/dist/react/index.js +1 -1
  33. package/dist/src/dashboard/dashboard_store.js +4 -12
  34. package/dist/src/dashboard/knex_factory.js +8 -0
  35. package/dist/src/dashboard/migrator.d.ts +7 -2
  36. package/dist/src/dashboard/migrator.js +140 -6
  37. package/dist/src/dashboard/migrator_tables.js +4 -0
  38. package/dist/src/dashboard/storage_stats.d.ts +5 -0
  39. package/dist/src/dashboard/storage_stats.js +15 -1
  40. package/dist/src/debug/types.d.ts +2 -0
  41. package/dist/src/define_config.js +2 -0
  42. package/dist/src/edge/client/dashboard.js +2 -2
  43. package/dist/src/edge/client/debug-panel-deferred.js +1 -1
  44. package/dist/src/edge/client-vue/dashboard.js +3 -3
  45. package/dist/src/edge/client-vue/debug-panel-deferred.js +2 -2
  46. package/dist/src/provider/dashboard_setup.js +14 -0
  47. package/dist/src/provider/diagnostics.d.ts +2 -0
  48. package/dist/src/provider/diagnostics.js +1 -0
  49. package/dist/src/provider/server_stats_provider.d.ts +1 -0
  50. package/dist/src/stubs/config.stub +4 -0
  51. package/dist/src/types.d.ts +31 -3
  52. package/dist/vue/{CacheSection-Bm0goqX6.js → CacheSection-z2TQRez9.js} +1 -1
  53. package/dist/vue/{ConfigSection-BrYslIMN.js → ConfigSection-CFEaig69.js} +1 -1
  54. package/dist/vue/{EmailsSection-B8N5vaWA.js → EmailsSection-CYohBo62.js} +1 -1
  55. package/dist/vue/{EventsSection-D2Y_xt0m.js → EventsSection-B_TuVrGj.js} +1 -1
  56. package/dist/vue/{InternalsSection-jhTCuK3j.js → InternalsSection-B1P2kNT-.js} +92 -84
  57. package/dist/vue/{InternalsTab-Z3c82glB.js → InternalsTab-CRI-IFTo.js} +155 -147
  58. package/dist/vue/{JobsSection-cEKqELLC.js → JobsSection-AjkEzyiv.js} +1 -1
  59. package/dist/vue/{LogsSection-C3H2c0S3.js → LogsSection-DZD0CCDi.js} +1 -1
  60. package/dist/vue/{OverviewSection-I2swuHDa.js → OverviewSection-BEc4Gktf.js} +1 -1
  61. package/dist/vue/{QueriesSection-CF1IE3SN.js → QueriesSection-BMImGXTn.js} +1 -1
  62. package/dist/vue/{RequestsSection-CuwgXzmU.js → RequestsSection-DOI2MUFX.js} +1 -1
  63. package/dist/vue/{RoutesSection-BhJCF7Rn.js → RoutesSection-C1sxt-AW.js} +1 -1
  64. package/dist/vue/{index-DUsImuIN.js → index-BfPAAjL5.js} +2 -2
  65. package/dist/vue/index.js +1 -1
  66. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- (function(){"use strict";var _e,P,at,ne,it,lt,ot,ct,Oe,Ie,je,dt,ye={},be=[],Rs=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,he=Array.isArray;function Z(e,s){for(var n in s)e[n]=s[n];return e}function Be(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function we(e,s,n){var r,l,a,i={};for(a in s)a=="key"?r=s[a]:a=="ref"?l=s[a]:i[a]=s[a];if(arguments.length>2&&(i.children=arguments.length>3?_e.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)i[a]===void 0&&(i[a]=e.defaultProps[a]);return xe(e,i,r,l,null)}function xe(e,s,n,r,l){var a={type:e,props:s,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:l??++at,__i:-1,__u:0};return l==null&&P.vnode!=null&&P.vnode(a),a}function M(e){return e.children}function X(e,s){this.props=e,this.context=s}function oe(e,s){if(s==null)return e.__?oe(e.__,e.__i+1):null;for(var n;s<e.__k.length;s++)if((n=e.__k[s])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?oe(e):null}function Ms(e){if(e.__P&&e.__d){var s=e.__v,n=s.__e,r=[],l=[],a=Z({},s);a.__v=s.__v+1,P.vnode&&P.vnode(a),He(e.__P,a,s,e.__n,e.__P.namespaceURI,32&s.__u?[n]:null,r,n??oe(s),!!(32&s.__u),l),a.__v=s.__v,a.__.__k[a.__i]=a,vt(r,a,l),s.__e=s.__=null,a.__e!=n&&ht(a)}}function ht(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(s){if(s!=null&&s.__e!=null)return e.__e=e.__c.base=s.__e}),ht(e)}function Ue(e){(!e.__d&&(e.__d=!0)&&ne.push(e)&&!Ne.__r++||it!=P.debounceRendering)&&((it=P.debounceRendering)||lt)(Ne)}function Ne(){for(var e,s=1;ne.length;)ne.length>s&&ne.sort(ot),e=ne.shift(),s=ne.length,Ms(e);Ne.__r=0}function ut(e,s,n,r,l,a,i,o,d,h,u){var c,m,p,v,g,_,y,S=r&&r.__k||be,f=s.length;for(d=Fs(n,s,S,d,f),c=0;c<f;c++)(p=n.__k[c])!=null&&(m=p.__i!=-1&&S[p.__i]||ye,p.__i=c,_=He(e,p,m,l,a,i,o,d,h,u),v=p.__e,p.ref&&m.ref!=p.ref&&(m.ref&&Ve(m.ref,null,p),u.push(p.ref,p.__c||v,p)),g==null&&v!=null&&(g=v),(y=!!(4&p.__u))||m.__k===p.__k?d=pt(p,d,e,y):typeof p.type=="function"&&_!==void 0?d=_:v&&(d=v.nextSibling),p.__u&=-7);return n.__e=g,d}function Fs(e,s,n,r,l){var a,i,o,d,h,u=n.length,c=u,m=0;for(e.__k=new Array(l),a=0;a<l;a++)(i=s[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[a]=xe(null,i,null,null,null):he(i)?i=e.__k[a]=xe(M,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[a]=xe(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[a]=i,d=a+m,i.__=e,i.__b=e.__b+1,o=null,(h=i.__i=qs(i,n,d,c))!=-1&&(c--,(o=n[h])&&(o.__u|=2)),o==null||o.__v==null?(h==-1&&(l>u?m--:l<u&&m++),typeof i.type!="function"&&(i.__u|=4)):h!=d&&(h==d-1?m--:h==d+1?m++:(h>d?m--:m++,i.__u|=4))):e.__k[a]=null;if(c)for(a=0;a<u;a++)(o=n[a])!=null&&(2&o.__u)==0&&(o.__e==r&&(r=oe(o)),_t(o,o));return r}function pt(e,s,n,r){var l,a;if(typeof e.type=="function"){for(l=e.__k,a=0;l&&a<l.length;a++)l[a]&&(l[a].__=e,s=pt(l[a],s,n,r));return s}e.__e!=s&&(r&&(s&&e.type&&!s.parentNode&&(s=oe(e)),n.insertBefore(e.__e,s||null)),s=e.__e);do s=s&&s.nextSibling;while(s!=null&&s.nodeType==8);return s}function ke(e,s){return s=s||[],e==null||typeof e=="boolean"||(he(e)?e.some(function(n){ke(n,s)}):s.push(e)),s}function qs(e,s,n,r){var l,a,i,o=e.key,d=e.type,h=s[n],u=h!=null&&(2&h.__u)==0;if(h===null&&o==null||u&&o==h.key&&d==h.type)return n;if(r>(u?1:0)){for(l=n-1,a=n+1;l>=0||a<s.length;)if((h=s[i=l>=0?l--:a++])!=null&&(2&h.__u)==0&&o==h.key&&d==h.type)return i}return-1}function ft(e,s,n){s[0]=="-"?e.setProperty(s,n??""):e[s]=n==null?"":typeof n!="number"||Rs.test(s)?n:n+"px"}function Se(e,s,n,r,l){var a,i;e:if(s=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(s in r)n&&s in n||ft(e.style,s,"");if(n)for(s in n)r&&n[s]==r[s]||ft(e.style,s,n[s])}else if(s[0]=="o"&&s[1]=="n")a=s!=(s=s.replace(ct,"$1")),i=s.toLowerCase(),s=i in e||s=="onFocusOut"||s=="onFocusIn"?i.slice(2):s.slice(2),e.l||(e.l={}),e.l[s+a]=n,n?r?n.u=r.u:(n.u=Oe,e.addEventListener(s,a?je:Ie,a)):e.removeEventListener(s,a?je:Ie,a);else{if(l=="http://www.w3.org/2000/svg")s=s.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(s!="width"&&s!="height"&&s!="href"&&s!="list"&&s!="form"&&s!="tabIndex"&&s!="download"&&s!="rowSpan"&&s!="colSpan"&&s!="role"&&s!="popover"&&s in e)try{e[s]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&s[4]!="-"?e.removeAttribute(s):e.setAttribute(s,s=="popover"&&n==1?"":n))}}function mt(e){return function(s){if(this.l){var n=this.l[s.type+e];if(s.t==null)s.t=Oe++;else if(s.t<n.u)return;return n(P.event?P.event(s):s)}}}function He(e,s,n,r,l,a,i,o,d,h){var u,c,m,p,v,g,_,y,S,f,x,w,b,E,N,$=s.type;if(s.constructor!==void 0)return null;128&n.__u&&(d=!!(32&n.__u),a=[o=s.__e=n.__e]),(u=P.__b)&&u(s);e:if(typeof $=="function")try{if(y=s.props,S="prototype"in $&&$.prototype.render,f=(u=$.contextType)&&r[u.__c],x=u?f?f.props.value:u.__:r,n.__c?_=(c=s.__c=n.__c).__=c.__E:(S?s.__c=c=new $(y,x):(s.__c=c=new X(y,x),c.constructor=$,c.render=Is),f&&f.sub(c),c.state||(c.state={}),c.__n=r,m=c.__d=!0,c.__h=[],c._sb=[]),S&&c.__s==null&&(c.__s=c.state),S&&$.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=Z({},c.__s)),Z(c.__s,$.getDerivedStateFromProps(y,c.__s))),p=c.props,v=c.state,c.__v=s,m)S&&$.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),S&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(S&&$.getDerivedStateFromProps==null&&y!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(y,x),s.__v==n.__v||!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(y,c.__s,x)===!1){s.__v!=n.__v&&(c.props=y,c.state=c.__s,c.__d=!1),s.__e=n.__e,s.__k=n.__k,s.__k.some(function(T){T&&(T.__=s)}),be.push.apply(c.__h,c._sb),c._sb=[],c.__h.length&&i.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(y,c.__s,x),S&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,v,g)})}if(c.context=x,c.props=y,c.__P=e,c.__e=!1,w=P.__r,b=0,S)c.state=c.__s,c.__d=!1,w&&w(s),u=c.render(c.props,c.state,c.context),be.push.apply(c.__h,c._sb),c._sb=[];else do c.__d=!1,w&&w(s),u=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++b<25);c.state=c.__s,c.getChildContext!=null&&(r=Z(Z({},r),c.getChildContext())),S&&!m&&c.getSnapshotBeforeUpdate!=null&&(g=c.getSnapshotBeforeUpdate(p,v)),E=u!=null&&u.type===M&&u.key==null?gt(u.props.children):u,o=ut(e,he(E)?E:[E],s,n,r,l,a,i,o,d,h),c.base=s.__e,s.__u&=-161,c.__h.length&&i.push(c),_&&(c.__E=c.__=null)}catch(T){if(s.__v=null,d||a!=null)if(T.then){for(s.__u|=d?160:128;o&&o.nodeType==8&&o.nextSibling;)o=o.nextSibling;a[a.indexOf(o)]=null,s.__e=o}else{for(N=a.length;N--;)Be(a[N]);ze(s)}else s.__e=n.__e,s.__k=n.__k,T.then||ze(s);P.__e(T,s,n)}else a==null&&s.__v==n.__v?(s.__k=n.__k,s.__e=n.__e):o=s.__e=Os(n.__e,s,n,r,l,a,i,d,h);return(u=P.diffed)&&u(s),128&s.__u?void 0:o}function ze(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ze))}function vt(e,s,n){for(var r=0;r<n.length;r++)Ve(n[r],n[++r],n[++r]);P.__c&&P.__c(s,e),e.some(function(l){try{e=l.__h,l.__h=[],e.some(function(a){a.call(l)})}catch(a){P.__e(a,l.__v)}})}function gt(e){return typeof e!="object"||e==null||e.__b>0?e:he(e)?e.map(gt):Z({},e)}function Os(e,s,n,r,l,a,i,o,d){var h,u,c,m,p,v,g,_=n.props||ye,y=s.props,S=s.type;if(S=="svg"?l="http://www.w3.org/2000/svg":S=="math"?l="http://www.w3.org/1998/Math/MathML":l||(l="http://www.w3.org/1999/xhtml"),a!=null){for(h=0;h<a.length;h++)if((p=a[h])&&"setAttribute"in p==!!S&&(S?p.localName==S:p.nodeType==3)){e=p,a[h]=null;break}}if(e==null){if(S==null)return document.createTextNode(y);e=document.createElementNS(l,S,y.is&&y),o&&(P.__m&&P.__m(s,a),o=!1),a=null}if(S==null)_===y||o&&e.data==y||(e.data=y);else{if(a=a&&_e.call(e.childNodes),!o&&a!=null)for(_={},h=0;h<e.attributes.length;h++)_[(p=e.attributes[h]).name]=p.value;for(h in _)p=_[h],h=="dangerouslySetInnerHTML"?c=p:h=="children"||h in y||h=="value"&&"defaultValue"in y||h=="checked"&&"defaultChecked"in y||Se(e,h,null,p,l);for(h in y)p=y[h],h=="children"?m=p:h=="dangerouslySetInnerHTML"?u=p:h=="value"?v=p:h=="checked"?g=p:o&&typeof p!="function"||_[h]===p||Se(e,h,p,_[h],l);if(u)o||c&&(u.__html==c.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),s.__k=[];else if(c&&(e.innerHTML=""),ut(s.type=="template"?e.content:e,he(m)?m:[m],s,n,r,S=="foreignObject"?"http://www.w3.org/1999/xhtml":l,a,i,a?a[0]:n.__k&&oe(n,0),o,d),a!=null)for(h=a.length;h--;)Be(a[h]);o||(h="value",S=="progress"&&v==null?e.removeAttribute("value"):v!=null&&(v!==e[h]||S=="progress"&&!v||S=="option"&&v!=_[h])&&Se(e,h,v,_[h],l),h="checked",g!=null&&g!=e[h]&&Se(e,h,g,_[h],l))}return e}function Ve(e,s,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&s==null||(e.__u=e(s))}else e.current=s}catch(l){P.__e(l,n)}}function _t(e,s,n){var r,l;if(P.unmount&&P.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Ve(r,null,s)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){P.__e(a,s)}r.base=r.__P=null}if(r=e.__k)for(l=0;l<r.length;l++)r[l]&&_t(r[l],s,n||typeof e.type!="function");n||Be(e.__e),e.__c=e.__=e.__e=void 0}function Is(e,s,n){return this.constructor(e,n)}function js(e,s,n){var r,l,a,i;s==document&&(s=document.documentElement),P.__&&P.__(e,s),l=(r=!1)?null:s.__k,a=[],i=[],He(s,e=s.__k=we(M,null,[e]),l||ye,ye,s.namespaceURI,l?null:s.firstChild?_e.call(s.childNodes):null,a,l?l.__e:s.firstChild,r,i),vt(a,e,i)}function Bs(e){function s(n){var r,l;return this.getChildContext||(r=new Set,(l={})[s.__c]=this,this.getChildContext=function(){return l},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(a){this.props.value!=a.value&&r.forEach(function(i){i.__e=!0,Ue(i)})},this.sub=function(a){r.add(a);var i=a.componentWillUnmount;a.componentWillUnmount=function(){r&&r.delete(a),i&&i.call(a)}}),n.children}return s.__c="__cC"+dt++,s.__=e,s.Provider=s.__l=(s.Consumer=function(n,r){return n.children(r)}).contextType=s,s}_e=be.slice,P={__e:function(e,s,n,r){for(var l,a,i;s=s.__;)if((l=s.__c)&&!l.__)try{if((a=l.constructor)&&a.getDerivedStateFromError!=null&&(l.setState(a.getDerivedStateFromError(e)),i=l.__d),l.componentDidCatch!=null&&(l.componentDidCatch(e,r||{}),i=l.__d),i)return l.__E=l}catch(o){e=o}throw e}},at=0,X.prototype.setState=function(e,s){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Z({},this.state),typeof e=="function"&&(e=e(Z({},n),this.props)),e&&Z(n,e),e!=null&&this.__v&&(s&&this._sb.push(s),Ue(this))},X.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ue(this))},X.prototype.render=M,ne=[],lt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ot=function(e,s){return e.__v.__b-s.__v.__b},Ne.__r=0,ct=/(PointerCapture)$|Capture$/i,Oe=0,Ie=mt(!1),je=mt(!0),dt=0;var Us=0;function t(e,s,n,r,l,a){s||(s={});var i,o,d=s;if("ref"in d)for(o in d={},s)o=="ref"?i=s[o]:d[o]=s[o];var h={type:e,props:d,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Us,__i:-1,__u:0,__source:l,__self:a};if(typeof e=="function"&&(i=e.defaultProps))for(o in i)d[o]===void 0&&(d[o]=i[o]);return P.vnode&&P.vnode(h),h}var re,F,We,yt,ue=0,bt=[],B=P,wt=B.__b,xt=B.__r,Nt=B.diffed,kt=B.__c,St=B.unmount,$t=B.__;function pe(e,s){B.__h&&B.__h(F,e,ue||s),ue=0;var n=F.__H||(F.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function k(e){return ue=1,Hs(Tt,e)}function Hs(e,s,n){var r=pe(re++,2);if(r.t=e,!r.__c&&(r.__=[n?n(s):Tt(void 0,s),function(o){var d=r.__N?r.__N[0]:r.__[0],h=r.t(d,o);d!==h&&(r.__N=[h,r.__[1]],r.__c.setState({}))}],r.__c=F,!F.__f)){var l=function(o,d,h){if(!r.__c.__H)return!0;var u=r.__c.__H.__.filter(function(m){return m.__c});if(u.every(function(m){return!m.__N}))return!a||a.call(this,o,d,h);var c=r.__c.props!==o;return u.some(function(m){if(m.__N){var p=m.__[0];m.__=m.__N,m.__N=void 0,p!==m.__[0]&&(c=!0)}}),a&&a.call(this,o,d,h)||c};F.__f=!0;var a=F.shouldComponentUpdate,i=F.componentWillUpdate;F.componentWillUpdate=function(o,d,h){if(this.__e){var u=a;a=void 0,l(o,d,h),a=u}i&&i.call(this,o,d,h)},F.shouldComponentUpdate=l}return r.__N||r.__}function U(e,s){var n=pe(re++,3);!B.__s&&Et(n.__H,s)&&(n.__=e,n.u=s,F.__H.__h.push(n))}function O(e){return ue=5,z(function(){return{current:e}},[])}function z(e,s){var n=pe(re++,7);return Et(n.__H,s)&&(n.__=e(),n.__H=s,n.__h=e),n.__}function L(e,s){return ue=8,z(function(){return e},s)}function zs(e){var s=F.context[e.__c],n=pe(re++,9);return n.c=e,s?(n.__==null&&(n.__=!0,s.sub(F)),s.props.value):e.__}function Vs(){var e=pe(re++,11);if(!e.__){for(var s=F.__v;s!==null&&!s.__m&&s.__!==null;)s=s.__;var n=s.__m||(s.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Ws(){for(var e;e=bt.shift();){var s=e.__H;if(e.__P&&s)try{s.__h.some($e),s.__h.some(Ke),s.__h=[]}catch(n){s.__h=[],B.__e(n,e.__v)}}}B.__b=function(e){F=null,wt&&wt(e)},B.__=function(e,s){e&&s.__k&&s.__k.__m&&(e.__m=s.__k.__m),$t&&$t(e,s)},B.__r=function(e){xt&&xt(e),re=0;var s=(F=e.__c).__H;s&&(We===F?(s.__h=[],F.__h=[],s.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(s.__h.some($e),s.__h.some(Ke),s.__h=[],re=0)),We=F},B.diffed=function(e){Nt&&Nt(e);var s=e.__c;s&&s.__H&&(s.__H.__h.length&&(bt.push(s)!==1&&yt===B.requestAnimationFrame||((yt=B.requestAnimationFrame)||Ks)(Ws)),s.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),We=F=null},B.__c=function(e,s){s.some(function(n){try{n.__h.some($e),n.__h=n.__h.filter(function(r){return!r.__||Ke(r)})}catch(r){s.some(function(l){l.__h&&(l.__h=[])}),s=[],B.__e(r,n.__v)}}),kt&&kt(e,s)},B.unmount=function(e){St&&St(e);var s,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{$e(r)}catch(l){s=l}}),n.__H=void 0,s&&B.__e(s,n.__v))};var Ct=typeof requestAnimationFrame=="function";function Ks(e){var s,n=function(){clearTimeout(r),Ct&&cancelAnimationFrame(s),setTimeout(e)},r=setTimeout(n,35);Ct&&(s=requestAnimationFrame(n))}function $e(e){var s=F,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),F=s}function Ke(e){var s=F;e.__c=e.__(),F=s}function Et(e,s){return!e||e.length!==s.length||s.some(function(n,r){return n!==e[r]})}function Tt(e,s){return typeof s=="function"?s(e):s}function Qs(e,s){for(var n in s)e[n]=s[n];return e}function Lt(e,s){for(var n in e)if(n!=="__source"&&!(n in s))return!0;for(var r in s)if(r!=="__source"&&e[r]!==s[r])return!0;return!1}function At(e,s){this.props=e,this.context=s}(At.prototype=new X).isPureReactComponent=!0,At.prototype.shouldComponentUpdate=function(e,s){return Lt(this.props,e)||Lt(this.state,s)};var Pt=P.__b;P.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Pt&&Pt(e)};var Js=P.__e;P.__e=function(e,s,n,r){if(e.then){for(var l,a=s;a=a.__;)if((l=a.__c)&&l.__c)return s.__e==null&&(s.__e=n.__e,s.__k=n.__k),l.__c(e,s)}Js(e,s,n,r)};var Dt=P.unmount;function Rt(e,s,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Qs({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=s),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Rt(r,s,n)})),e}function Mt(e,s,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Mt(r,s,n)}),e.__c&&e.__c.__P===s&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Ce(){this.__u=0,this.o=null,this.__b=null}function Ft(e){if(!e.__)return null;var s=e.__.__c;return s&&s.__a&&s.__a(e)}function G(e){var s,n,r,l=null;function a(i){if(s||(s=e()).then(function(o){o&&(l=o.default||o),r=!0},function(o){n=o,r=!0}),n)throw n;if(!r)throw s;return l?we(l,i):null}return a.displayName="Lazy",a.__f=!0,a}function Ee(){this.i=null,this.l=null}P.unmount=function(e){var s=e.__c;s&&(s.__z=!0),s&&s.__R&&s.__R(),s&&32&e.__u&&(e.type=null),Dt&&Dt(e)},(Ce.prototype=new X).__c=function(e,s){var n=s.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var l=Ft(r.__v),a=!1,i=function(){a||r.__z||(a=!0,n.__R=null,l?l(d):d())};n.__R=i;var o=n.__P;n.__P=null;var d=function(){if(!--r.__u){if(r.state.__a){var h=r.state.__a;r.__v.__k[0]=Mt(h,h.__c.__P,h.__c.__O)}var u;for(r.setState({__a:r.__b=null});u=r.o.pop();)u.__P=o,u.forceUpdate()}};r.__u++||32&s.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(i,i)},Ce.prototype.componentWillUnmount=function(){this.o=[]},Ce.prototype.render=function(e,s){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Rt(this.__b,n,r.__O=r.__P)}this.__b=null}var l=s.__a&&we(M,null,e.fallback);return l&&(l.__u&=-33),[we(M,null,s.__a?null:e.children),l]};var qt=function(e,s,n){if(++n[1]===n[0]&&e.l.delete(s),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Ee.prototype=new X).__a=function(e){var s=this,n=Ft(s.__v),r=s.l.get(e);return r[0]++,function(l){var a=function(){s.props.revealOrder?(r.push(l),qt(s,e,r)):l()};n?n(a):a()}},Ee.prototype.render=function(e){this.i=null,this.l=new Map;var s=ke(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&s.reverse();for(var n=s.length;n--;)this.l.set(s[n],this.i=[1,0,this.i]);return e.children},Ee.prototype.componentDidUpdate=Ee.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(s,n){qt(e,n,s)})};var Gs=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Ys=/^(?: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]/,Zs=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Xs=/[A-Z0-9]/g,en=typeof document<"u",tn=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};X.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(X.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(s){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:s})}})});var Ot=P.event;function sn(){}function nn(){return this.cancelBubble}function rn(){return this.defaultPrevented}P.event=function(e){return Ot&&(e=Ot(e)),e.persist=sn,e.isPropagationStopped=nn,e.isDefaultPrevented=rn,e.nativeEvent=e};var an={enumerable:!1,configurable:!0,get:function(){return this.class}},It=P.vnode;P.vnode=function(e){typeof e.type=="string"&&(function(s){var n=s.props,r=s.type,l={},a=r.indexOf("-")===-1;for(var i in n){var o=n[i];if(!(i==="value"&&"defaultValue"in n&&o==null||en&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var d=i.toLowerCase();i==="defaultValue"&&"value"in n&&n.value==null?i="value":i==="download"&&o===!0?o="":d==="translate"&&o==="no"?o=!1:d[0]==="o"&&d[1]==="n"?d==="ondoubleclick"?i="ondblclick":d!=="onchange"||r!=="input"&&r!=="textarea"||tn(n.type)?d==="onfocus"?i="onfocusin":d==="onblur"?i="onfocusout":Zs.test(i)&&(i=d):d=i="oninput":a&&Ys.test(i)?i=i.replace(Xs,"-$&").toLowerCase():o===null&&(o=void 0),d==="oninput"&&l[i=d]&&(i="oninputCapture"),l[i]=o}}r=="select"&&l.multiple&&Array.isArray(l.value)&&(l.value=ke(n.children).forEach(function(h){h.props.selected=l.value.indexOf(h.props.value)!=-1})),r=="select"&&l.defaultValue!=null&&(l.value=ke(n.children).forEach(function(h){h.props.selected=l.multiple?l.defaultValue.indexOf(h.props.value)!=-1:l.defaultValue==h.props.value})),n.class&&!n.className?(l.class=n.class,Object.defineProperty(l,"className",an)):n.className&&(l.class=l.className=n.className),s.props=l})(e),e.$$typeof=Gs,It&&It(e)};var jt=P.__r;P.__r=function(e){jt&&jt(e),e.__c};var Bt=P.diffed;P.diffed=function(e){Bt&&Bt(e);var s=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in s&&s.value!==n.value&&(n.value=s.value==null?"":s.value)};var Ut={Fragment:M};const H={queries:{viewBox:"0 0 24 24",elements:['<ellipse cx="12" cy="5" rx="9" ry="3"/>','<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>','<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>']},events:{viewBox:"0 0 24 24",elements:['<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>']},emails:{viewBox:"0 0 24 24",elements:['<path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/>','<polyline points="22,6 12,13 2,6"/>']},routes:{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="10"/>','<line x1="2" y1="12" x2="22" y2="12"/>','<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>']},logs:{viewBox:"0 0 24 24",elements:['<line x1="8" y1="6" x2="21" y2="6"/>','<line x1="8" y1="12" x2="21" y2="12"/>','<line x1="8" y1="18" x2="21" y2="18"/>','<line x1="3" y1="6" x2="3.01" y2="6"/>','<line x1="3" y1="12" x2="3.01" y2="12"/>','<line x1="3" y1="18" x2="3.01" y2="18"/>']},timeline:{viewBox:"0 0 24 24",elements:['<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>']},cache:{viewBox:"0 0 24 24",elements:['<rect x="2" y="2" width="20" height="8" rx="2" ry="2"/>','<rect x="2" y="14" width="20" height="8" rx="2" ry="2"/>','<line x1="6" y1="6" x2="6.01" y2="6"/>','<line x1="6" y1="18" x2="6.01" y2="18"/>']},jobs:{viewBox:"0 0 24 24",elements:['<rect x="2" y="7" width="20" height="14" rx="2" ry="2"/>','<path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"/>']},config:{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="3"/>','<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>']},internals:{viewBox:"0 0 24 24",elements:['<rect x="4" y="4" width="16" height="16" rx="2"/>','<rect x="9" y="9" width="6" height="6"/>','<line x1="9" y1="1" x2="9" y2="4"/>','<line x1="15" y1="1" x2="15" y2="4"/>','<line x1="9" y1="20" x2="9" y2="23"/>','<line x1="15" y1="20" x2="15" y2="23"/>','<line x1="20" y1="9" x2="23" y2="9"/>','<line x1="20" y1="14" x2="23" y2="14"/>','<line x1="1" y1="9" x2="4" y2="9"/>','<line x1="1" y1="14" x2="4" y2="14"/>']},overview:{viewBox:"0 0 24 24",elements:['<rect x="3" y="3" width="7" height="7"/>','<rect x="14" y="3" width="7" height="7"/>','<rect x="14" y="14" width="7" height="7"/>','<rect x="3" y="14" width="7" height="7"/>']},requests:{viewBox:"0 0 24 24",elements:['<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>']},"dashboard-timeline":{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="10"/>','<polyline points="12 6 12 12 16 14"/>']},"custom-pane":{viewBox:"0 0 24 24",elements:['<rect x="3" y="3" width="18" height="18" rx="2"/>','<path d="M9 3v18"/>']},wrench:{viewBox:"0 0 24 24",elements:['<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/>']},"external-link":{viewBox:"0 0 24 24",elements:['<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>','<polyline points="15 3 21 3 21 9"/>','<line x1="10" y1="14" x2="21" y2="3"/>']},sun:{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="5"/>','<line x1="12" y1="1" x2="12" y2="3"/>','<line x1="12" y1="21" x2="12" y2="23"/>','<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>','<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>','<line x1="1" y1="12" x2="3" y2="12"/>','<line x1="21" y1="12" x2="23" y2="12"/>','<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>','<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>']},moon:{viewBox:"0 0 24 24",elements:['<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>']},search:{viewBox:"0 0 24 24",elements:['<circle cx="11" cy="11" r="8"/>','<line x1="21" y1="21" x2="16.65" y2="16.65"/>']},eye:{viewBox:"0 0 24 24",elements:['<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>','<circle cx="12" cy="12" r="3"/>']},"eye-off":{viewBox:"0 0 24 24",elements:['<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"/>','<path d="M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"/>','<line x1="1" y1="1" x2="23" y2="23"/>','<path d="M14.12 14.12a3 3 0 1 1-4.24-4.24"/>']},"chevron-right":{viewBox:"0 0 24 24",elements:['<path d="M9 18l6-6-6-6"/>']},"chevron-left":{viewBox:"0 0 24 24",elements:['<path d="M15 18l-6-6 6-6"/>']},"open-external":{viewBox:"0 0 16 16",elements:['<path d="M6 3H3v10h10v-3M9 1h6v6M7 9L15 1"/>']}};function ln(e,s){const n=e||(typeof window<"u"?window.location.origin:"");if(!s)return{baseUrl:n};const r={headers:{Authorization:`Bearer ${s}`}};return{baseUrl:n,beforeSubscribe(l){return r},beforeUnsubscribe(l){return r}}}async function on(){if(typeof window<"u"&&window.Transmit&&typeof window.Transmit=="function")return window.Transmit;try{const e=await import("@adonisjs/transmit-client");return e.Transmit??e.default??null}catch{return null}}function cn(e){let s=null,n=null,r=!1;return{subscribe:async()=>{try{const i=await on();if(!i)throw new Error("Transmit client not available (neither window.Transmit nor @adonisjs/transmit-client)");if(r)return;s=new i(ln(e.baseUrl,e.authToken)),n=s.subscription(e.channelName),n.onMessage(o=>{r||e.onMessage(o)}),await n.create()}catch(i){e.onError?.(i)}},unsubscribe:async()=>{r=!0;try{await n?.delete(),n=null,s=null}catch{}}}}function dn(e){let s=!1;const n=cn({baseUrl:e.baseUrl,channelName:e.channelName,authToken:e.authToken,onMessage:e.onMessage,onError:r=>{s=!0,e.onError?.(r),e.onDisconnect?.()}});return n.subscribe().then(()=>{s||e.onConnect?.()}).catch(r=>{e.onError?.(r),e.onDisconnect?.()}),{unsubscribe:()=>{n.unsubscribe().catch(()=>{})}}}class Qe extends Error{status;constructor(s=403){super(`Unauthorized (HTTP ${s})`),this.name="UnauthorizedError",this.status=s}}class hn extends Error{status;body;constructor(s,n){super(`API error (HTTP ${s})`),this.name="ApiError",this.status=s,this.body=n}}class Je{baseUrl;authToken;constructor(s){this.baseUrl=s.baseUrl.replace(/\/+$/,""),this.authToken=s.authToken}async fetch(s,n){const l={...{Accept:"application/json",...this.authToken?{Authorization:`Bearer ${this.authToken}`}:{}},...n?.headers},a=await globalThis.fetch(`${this.baseUrl}${s}`,{...n,headers:l,credentials:this.authToken?"omit":"same-origin"});if(n?.signal?.aborted)throw new DOMException("The operation was aborted.","AbortError");if(a.status===401||a.status===403)throw new Qe(a.status);if(!a.ok){const i=await a.text().catch(()=>"");throw new hn(a.status,i)}return a.json()}async get(s,n){const r=n?`${s}?${n}`:s;return this.fetch(r)}async post(s,n){const r={method:"POST",...n!==void 0?{body:JSON.stringify(n),headers:{"Content-Type":"application/json"}}:{}};return this.fetch(s,r)}async delete(s){return this.fetch(s,{method:"DELETE"})}}const un=5e3,Ht=1e4,zt=100,pn=500,fn={overview:"/overview",requests:"/requests",queries:"/queries",events:"/events",routes:"/routes",logs:"/logs",emails:"/emails",timeline:"/traces",cache:"/cache",jobs:"/jobs",config:"/config"};function mn(e){return fn[e]||`/${e}`}class vn{constructor(s,n){this.client=s,this.basePath=n}async fetchSection(s,n,r){const l=mn(s),a=n?`${this.basePath}${l}?${n}`:`${this.basePath}${l}`;return this.client.fetch(a,r)}async fetchChart(s){return this.client.fetch(`${this.basePath}/overview/chart?range=${s}`)}async fetchGroupedQueries(){return this.client.fetch(`${this.basePath}/queries/grouped`)}async explainQuery(s){return this.client.fetch(`${this.basePath}/queries/${s}/explain`)}async retryJob(s){return this.client.fetch(`${this.basePath}/jobs/${s}/retry`,{method:"POST"})}async fetchCacheKey(s,n){return this.client.fetch(`${this.basePath}/cache/${encodeURIComponent(s)}`,n)}async deleteCacheKey(s){return this.client.fetch(`${this.basePath}/cache/${encodeURIComponent(s)}`,{method:"DELETE"})}async fetchEmailPreview(s,n){return this.client.fetch(`${this.basePath}/emails/${s}/preview`,n)}}function gn(e){if(!e||typeof e!="object")return!1;const s=e;return s.data!==void 0&&s.meta!==void 0}function _n(e,s){return s.aborted?!0:e instanceof DOMException&&e.name==="AbortError"}const yn=[{key:"page",param:"page",isNumeric:!0},{key:"perPage",param:"perPage",isNumeric:!0},{key:"search",param:"search"},{key:"sort",param:"sort"},{key:"sortDir",param:"direction"},{key:"timeRange",param:"range"}];function bn(e){const s=new URLSearchParams,n=e;for(const{key:r,param:l,isNumeric:a}of yn){const i=n[r];(a?i!=null:i)&&s.set(l,String(i))}if(e.filters)for(const[r,l]of Object.entries(e.filters))l&&s.set(r,l);return s.toString()}function wn(e,s,n=2){if(s<=1)return[1];const r=[],l=Math.max(2,e-n),a=Math.min(s-1,e+n);r.push(1),l>2&&r.push("...");for(let i=l;i<=a;i++)r.push(i);return a<s-1&&r.push("..."),s>1&&r.push(s),r}class xn{client;api;callbacks;endpoint;perPage;section;page=1;search;sort;sortDir;filters;timeRange;timer=null;fetchId=0;explicitFetchPending=!1;hasFetched=!1;stopped=!1;abortController=null;constructor(s){this.client=new Je({baseUrl:s.baseUrl,authToken:s.authToken}),this.api=new vn(this.client,s.endpoint),this.endpoint=s.endpoint,this.section=s.section,this.perPage=s.perPage,this.callbacks=s.callbacks}start(){this.stopped=!1,this.fetch(!1),this.startRefreshTimer()}stop(){this.stopped=!0,this.stopRefreshTimer(),this.abortController?.abort(),this.abortController=null}async fetch(s=!0){if(this.shouldSkipFetch(s))return;const{controller:n,myFetchId:r}=this.prepareFetch(s);try{const l=await this.executeFetch(n);if(this.isStaleResponse(r))return;this.applyFetchResult(l)}catch(l){if(this.shouldIgnoreError(l,n.signal,r))return;this.handleFetchError(l,s)}finally{s||(this.explicitFetchPending=!1)}}setSection(s){this.section!==s&&(this.section=s,this.page=1,this.search=void 0,this.sort=void 0,this.sortDir=void 0,this.filters=void 0,this.hasFetched=!1,this.callbacks.onData(null),this.callbacks.onPagination(null),this.callbacks.onLoading(!0),this.callbacks.onError(null),this.fetch(!1),this.startRefreshTimer())}setPage(s){this.page=s,this.fetch(!1)}setSearch(s){this.search=s||void 0,this.page=1,this.fetch(!1)}setFilter(s,n){this.filters||(this.filters={}),this.filters[s]=String(n),this.page=1,this.fetch(!1)}setSort(s,n){this.sort===s&&!n?this.sortDir=this.sortDir==="asc"?"desc":"asc":(this.sort=s,this.sortDir=n||"desc"),this.fetch(!1)}setTimeRange(s){this.timeRange=s,this.fetch(!1)}async mutate(s,n="post",r){const l=`${this.endpoint}/${s}`;try{const a=n==="post"?await this.client.post(l,r):await this.client.delete(l);return await this.fetch(!0),a}catch(a){throw a instanceof Error?a:new Error(String(a))}}configure(s){s.page!==void 0&&(this.page=s.page),s.perPage!==void 0&&(this.perPage=s.perPage),this.search=s.search,this.sort=s.sort,this.sortDir=s.sortDir,this.filters=s.filters,this.timeRange=s.timeRange}hasData(){return this.hasFetched}handleRefreshSignal(){this.hasFetched&&this.fetch(!0)}getApi(){return this.api}getClient(){return this.client}shouldSkipFetch(s){return s&&this.explicitFetchPending?!0:!this.section}prepareFetch(s){this.abortController?.abort();const n=new AbortController;this.abortController=n;const r=++this.fetchId;return s||(this.callbacks.onLoading(!0),this.explicitFetchPending=!0),{controller:n,myFetchId:r}}async executeFetch(s){const n=this.buildCurrentQueryString();return this.api.fetchSection(this.section,n||void 0,{signal:s.signal})}isStaleResponse(s){return s!==this.fetchId||this.stopped}shouldIgnoreError(s,n,r){return _n(s,n)?!0:this.isStaleResponse(r)}buildCurrentQueryString(){const s=this.sort?this.sort.replace(/[A-Z]/g,r=>"_"+r.toLowerCase()):void 0,n=this.filters;return bn({page:this.page,perPage:this.perPage,search:this.search,sort:s,sortDir:this.sort?this.sortDir:void 0,filters:n&&Object.keys(n).length>0?n:void 0,timeRange:this.section.startsWith("overview")?this.timeRange:void 0})}applyFetchResult(s){gn(s)?(this.callbacks.onData(s.data),this.callbacks.onPagination(s.meta)):(this.callbacks.onData(s),this.callbacks.onPagination(null)),this.callbacks.onError(null),this.callbacks.onLoading(!1),this.hasFetched=!0}handleFetchError(s,n){if(s instanceof Qe){this.callbacks.onError(s),this.callbacks.onLoading(!1),this.stopRefreshTimer(),this.callbacks.onUnauthorized();return}n||(this.callbacks.onError(s instanceof Error?s:new Error(String(s))),this.callbacks.onLoading(!1))}startRefreshTimer(){this.stopRefreshTimer();const s=this.section==="overview"?un:Ht;this.timer=setInterval(()=>this.fetch(!0),s)}stopRefreshTimer(){this.timer&&(clearInterval(this.timer),this.timer=null)}}function Nn(e,s){return new xn({baseUrl:s.baseUrl,endpoint:s.dashboardEndpoint,authToken:s.authToken,section:e,perPage:s.perPage,callbacks:{onData:n=>s.setData(n),onPagination:n=>s.setMeta(n),onLoading:n=>s.setIsLoading(n),onError:n=>s.setError(n),onUnauthorized:()=>{}}})}function kn(e,s){e.ctrl.configure(s);const n=e.prevSection!==e.section;return n||!e.hasFetched?(n?e.ctrl.setSection(e.section):e.ctrl.start(),!0):(e.ctrl.start(),e.hasFetched)}function Sn(){const[e,s]=k(null),[n,r]=k(null),[l,a]=k(!0),[i,o]=k(null);return{data:e,setData:s,meta:n,setMeta:r,isLoading:l,setIsLoading:a,error:i,setError:o}}function $n(e){const s=L(()=>{e.current?.fetch(!0)},[e]),n=L(async(l,a="post",i)=>{const o=e.current;if(!o)throw new Error("Dashboard controller not initialized");return o.mutate(l,a,i)},[e]),r=L(()=>{const l=e.current;if(!l)throw new Error("Dashboard controller not initialized");return l.getApi()},[e]);return{refresh:s,mutate:n,getApi:r}}function Cn(e,s,n,r){e.current||(e.current=Nn(s,{...n,setData:l=>r.setData(l),setMeta:r.setMeta,setIsLoading:r.setIsLoading,setError:r.setError}))}function En(e){return{baseUrl:e.baseUrl??"",dashboardEndpoint:e.dashboardEndpoint??"/__stats/api",authToken:e.authToken,page:e.page??1,perPage:e.perPage??50,search:e.search,sort:e.sort,sortDir:e.sortDir,filters:e.filters,timeRange:e.timeRange,refreshKey:e.refreshKey}}function J(e,s={}){const n=En(s),r=Sn(),l=O(null),a=O(e),i=O(!1);Cn(l,e,n,r),U(()=>{const d=a.current;return a.current=e,i.current=kn({ctrl:l.current,section:e,prevSection:d,hasFetched:i.current},n),()=>{l.current.stop()}},[e,n.page,n.perPage,n.search,n.sort,n.sortDir,n.filters,n.timeRange,n.refreshKey]);const o=$n(l);return{data:r.data,meta:r.meta,isLoading:r.isLoading,error:r.error,...o}}const Tn=["tracing","process","system","http","db","redis","queues","cache","app","log","emails","dashboard"],Vt="/admin/api/debug",Wt={tracing:!1,process:!1,system:!1,http:!1,db:!1,redis:!1,queues:!1,cache:!1,app:!1,log:!1,emails:!1,dashboard:!1,customPanes:[]};function Ln(e){const s={customPanes:e.customPanes??[]},n=e.features;for(const r of Tn)s[r]=n?.[r]??!1;return s}async function An(e,s=Vt){const n=`${s.replace(/\/+$/,"")}/config`;return e.fetch(n)}async function Pn(e){const{baseUrl:s="",debugEndpoint:n=Vt,authToken:r}=e,l=new Je({baseUrl:s,authToken:r});try{const a=await An(l,n);return Ln(a)}catch{return Wt}}function Dn(e={}){const{baseUrl:s="",debugEndpoint:n="/admin/api/debug",authToken:r}=e,[l,a]=k(Wt),[i,o]=k(!0),[d,h]=k(null),u=O(!1);return U(()=>{if(u.current)return;u.current=!0;let c=!1;return(async()=>{try{const p=await Pn({baseUrl:s,debugEndpoint:n,authToken:r});c||(a(p),o(!1))}catch(p){c||(h(p instanceof Error?p:new Error(String(p))),o(!1))}})(),()=>{c=!0,u.current=!1}},[s,n,r]),{features:l,isLoading:i,error:d}}const Te="ss-dash-theme",Ge="ss-theme-change";function Le(){if(typeof window>"u")return"light";const e=localStorage.getItem(Te);return e==="dark"||e==="light"?e:window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function Rn(e){typeof window>"u"||(localStorage.setItem(Te,e),window.dispatchEvent(new CustomEvent(Ge,{detail:e})))}function Mn(){const s=Le()==="dark"?"light":"dark";return Rn(s),s}function Kt(e){if(typeof window>"u")return()=>{};const s=a=>{const i=a.detail;(i==="dark"||i==="light")&&e(i)},n=a=>{if(a.key===Te){const i=a.newValue;e(i==="dark"||i==="light"?i:Le())}},r=window.matchMedia("(prefers-color-scheme: dark)"),l=a=>{localStorage.getItem(Te)||e(a.matches?"dark":"light")};return window.addEventListener(Ge,s),window.addEventListener("storage",n),r.addEventListener("change",l),()=>{window.removeEventListener(Ge,s),window.removeEventListener("storage",n),r.removeEventListener("change",l)}}function Fn(){const[e,s]=k(()=>Le());U(()=>Kt(l=>{s(l)}),[]);const n=L(()=>{const r=Mn();return s(r),r},[]);return{theme:e,toggleTheme:n}}function qn({theme:e,onToggle:s,className:n="",classPrefix:r="ss-dash"}){const l=e==="dark";return t("button",{type:"button",className:`${r==="ss-dbg"?"ss-dbg-theme-toggle":"ss-dash-theme-btn"} ${n}`,onClick:s,title:l?"Switch to light theme":"Switch to dark theme","aria-label":l?"Switch to light theme":"Switch to dark theme",children:l?t("svg",{width:"16",height:"16",viewBox:H.sun.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:H.sun.elements.join("")}}):t("svg",{width:"16",height:"16",viewBox:H.moon.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:H.moon.elements.join("")}})})}const Qt=Bs(void 0),On=["overview","requests","queries","events","routes","logs","emails","cache","jobs","config","internals"],In=G(()=>Promise.resolve().then(()=>Sr)),jn=G(()=>Promise.resolve().then(()=>Vr)),Bn=G(()=>Promise.resolve().then(()=>aa)),Un=G(()=>Promise.resolve().then(()=>ia)),Hn=G(()=>Promise.resolve().then(()=>la)),zn=G(()=>Promise.resolve().then(()=>oa)),Vn=G(()=>Promise.resolve().then(()=>da)),Wn=G(()=>Promise.resolve().then(()=>ua)),Kn=G(()=>Promise.resolve().then(()=>_a)),Qn=G(()=>Promise.resolve().then(()=>$a)),Jn=G(()=>Promise.resolve().then(()=>ja));function Gn(e){const{baseUrl:s="",dashboardEndpoint:n="/__stats/api",debugEndpoint:r,authToken:l,backUrl:a="/",channelName:i="server-stats/dashboard"}=e,{features:o}=Dn({baseUrl:s,debugEndpoint:r,authToken:l}),{theme:d,toggleTheme:h}=Fn(),[u,c]=k("overview"),m=O(u);m.current=u;const[p,v]=k(()=>typeof window>"u"?!1:localStorage.getItem("ss-dash-sidebar")==="collapsed"),[g,_]=k(!1),[y,S]=k(0),f=O(0);U(()=>{if(!i)return;const C=dn({baseUrl:s,channelName:i,authToken:l,onMessage:()=>{f.current+=1,S(f.current)},onConnect:()=>_(!0),onDisconnect:()=>_(!1),onError:()=>_(!1)});return()=>C.unsubscribe()},[s,i,l]);const x=o.customPanes||[],w=L(C=>{const q=C.replace("#","").split("?")[0];return q&&[...On,...x.map(K=>K.id)].includes(q)?q:"overview"},[x]);U(()=>{if(typeof window>"u")return;const C=w(window.location.hash);(C!=="overview"||window.location.hash)&&c(C)},[w]),U(()=>{const C=()=>{const q=w(window.location.hash);q!==m.current&&c(q)};return window.addEventListener("hashchange",C),()=>window.removeEventListener("hashchange",C)},[w]),U(()=>{typeof window>"u"||(window.location.hash=u)},[u]);const b=L(()=>{v(C=>{const q=!C;return localStorage.setItem("ss-dash-sidebar",q?"collapsed":"expanded"),q})},[]),E=z(()=>[{id:"overview",label:"Overview",visible:!0},{id:"requests",label:"Requests",visible:!0},{id:"queries",label:"Queries",visible:!0},{id:"events",label:"Events",visible:!0},{id:"routes",label:"Routes",visible:!0},{id:"logs",label:"Logs",visible:!0},{id:"emails",label:"Emails",visible:!0},{id:"cache",label:"Cache",visible:o.cache},{id:"jobs",label:"Jobs",visible:o.queues},{id:"config",label:"Config",visible:!0},{id:"internals",label:"Internals",visible:!0}],[o]),N=z(()=>E.filter(C=>C.visible),[E]),$=z(()=>({baseUrl:s,dashboardEndpoint:n,authToken:l,refreshKey:y}),[s,n,l,y]),{data:T,isLoading:j}=J("overview",$),Q=z(()=>({data:T,isLoading:j}),[T,j]),V=z(()=>{if(!T)return{};const C={};if(T.totalRequests>0&&(C.requests={count:T.totalRequests}),T.queryStats?.total>0&&(C.queries={count:T.queryStats.total}),T.logLevelBreakdown){const q=T.logLevelBreakdown,A=q.error+q.warn+q.info+q.debug;A>0&&(C.logs={count:A})}return C},[T]),W=L(()=>{const C={overview:t(In,{options:$}),requests:t(jn,{options:$}),queries:t(Bn,{options:$}),events:t(Un,{options:$}),routes:t(Hn,{options:$}),logs:t(zn,{options:$}),emails:t(Vn,{options:$}),cache:t(Wn,{options:$}),jobs:t(Kn,{options:$}),config:t(Qn,{options:$}),internals:t(Jn,{options:$,debugEndpoint:r})};return t("div",{className:"ss-dash-pane ss-dash-active",id:`ss-dash-pane-${u}`,children:t("div",{className:"ss-dash-pane-inner",children:t(Ce,{fallback:t("div",{className:"ss-dash-empty",children:"Loading..."}),children:t(Qt.Provider,{value:Q,children:C[u]||t("div",{className:"ss-dash-empty",children:"Unknown section"})})})})})},[u,$,Q]);return t("div",{className:"ss-dash","data-theme":d,id:"ss-dash",children:[t("div",{className:"ss-dash-header",children:[t("div",{className:"ss-dash-header-left",children:[t("span",{className:"ss-dash-logo",children:"Server Stats"}),t("span",{className:"ss-dash-logo-sub",children:"Dashboard"})]}),t("div",{className:"ss-dash-header-center",children:[t("span",{className:`ss-dash-live-dot ${g?"ss-dash-connected":""}`,id:"ss-dash-live-dot"}),t("span",{className:`ss-dash-live-label ${g?"ss-dash-connected":""}`,id:"ss-dash-live-label",children:g?"Live":"Polling"})]}),t("div",{className:"ss-dash-header-right",children:[t(qn,{theme:d,onToggle:h}),a&&t("a",{href:a,className:"ss-dash-back-link",title:"Back to app",children:"← App"})]})]}),t("div",{className:"ss-dash-body",children:[t("div",{className:`ss-dash-sidebar ${p?"ss-dash-collapsed":""}`,id:"ss-dash-sidebar",children:[t("nav",{className:"ss-dash-nav",role:"tablist",children:[N.map(C=>{const q=V[C.id];return t("button",{type:"button",role:"tab","aria-selected":u===C.id,className:`ss-dash-nav-item ${u===C.id?"ss-dash-active":""}`,"data-ss-section":C.id,onClick:()=>{C.id!==u&&c(C.id)},title:p?C.label:void 0,children:[t("span",{className:"ss-dash-nav-icon",children:t("svg",{width:"20",height:"20",viewBox:(H[C.id]||H.config).viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:(H[C.id]||H.config).elements.join("")}})}),t("span",{className:"ss-dash-nav-label",children:C.label}),q&&q.count>0&&t("span",{className:`ss-dash-nav-badge${q.variant?" "+q.variant:""}`,children:q.count})]},C.id)}),x.length>0&&t("div",{className:"ss-dash-nav-sep"}),x.map(C=>t("button",{type:"button",role:"tab","aria-selected":u===C.id,className:`ss-dash-nav-item ${u===C.id?"ss-dash-active":""}`,onClick:()=>c(C.id),title:p?C.label:void 0,children:[t("span",{className:"ss-dash-nav-icon",children:t("svg",{width:"20",height:"20",viewBox:H["custom-pane"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:H["custom-pane"].elements.join("")}})}),t("span",{className:"ss-dash-nav-label",children:C.label})]},C.id))]}),t("button",{type:"button",className:"ss-dash-sidebar-toggle",id:"ss-dash-sidebar-toggle",onClick:b,title:p?"Expand sidebar":"Collapse sidebar",children:p?t("svg",{width:"16",height:"16",viewBox:H["chevron-right"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"1.5",dangerouslySetInnerHTML:{__html:H["chevron-right"].elements.join("")}}):t("svg",{width:"16",height:"16",viewBox:H["chevron-left"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"1.5",dangerouslySetInnerHTML:{__html:H["chevron-left"].elements.join("")}})})]}),t("div",{className:"ss-dash-main",children:W()})]})]})}function Yn(e){const s=document.getElementById(e);return s?JSON.parse(s.textContent||"{}"):{}}function Zn(){function e(s){document.documentElement.setAttribute("data-theme",s)}e(Le()),Kt(e)}const ce=Yn("ss-dash-config");Zn();const Jt=document.getElementById("ss-dash");Jt&&js(t(Gn,{baseUrl:ce.baseUrl,dashboardEndpoint:ce.dashboardEndpoint,debugEndpoint:ce.debugEndpoint,authToken:ce.authToken,backUrl:ce.backUrl,channelName:ce.channelName}),Jt);function I(e,...s){for(const n of s){const r=e[n];if(r!=null)return r}}function Ae(e){return I(e,"createdAt","created_at","timestamp")}function Xn(e){return I(e,"timestamp","createdAt","processedAt","created_at")}function er(e){return I(e,"statusCode","status_code")}function tr(e){return I(e,"total_duration","totalDuration","duration")??0}function sr(e){return I(e,"span_count","spanCount")??0}function nr(e){return I(e,"warning_count","warningCount")??0}function Gt(e){return I(e,"from_addr","from")??""}function Yt(e){return I(e,"to_addr","to")??""}function rr(e){return I(e,"cc","cc_addr")??""}function ar(e){return I(e,"attachment_count","attachmentCount")??0}function Zt(e){return I(e,"event_name","eventName","event")??""}function Xt(e){return I(e,"method","sql_method")??""}function Pe(e){return I(e,"sqlNormalized","normalizedSql","sql_normalized","sql")??""}function ae(e,s,n){const r=e[s];return r!=null&&r!==0?Number(r):Number(e[n])||0}function ir(e){return'"'+(e.length>40?e.slice(0,40)+"...":e)+'"'}function lr(e,s,n){if(e.length===0)return"[]";const r=e.slice(0,3).map(i=>n(i,30)),l=e.length>3?", ..."+e.length+" items":"",a="["+r.join(", ")+l+"]";return a.length>s?"["+e.length+" items]":a}function or(e,s,n){const r=Object.keys(e);if(r.length===0)return"{}";const l=[];for(let d=0;d<Math.min(r.length,4);d++)l.push(r[d]+": "+n(e[r[d]],30));const a=r.length>4?", ...+"+(r.length-4):"",i="{ "+l.join(", ")+a+" }";return i.length<=s?i:"{ "+(r.slice(0,6).join(", ")+(r.length>6?", ...":""))+" }"}function cr(e){if(!e&&e!==0)return"-";const s=Math.floor(e),n=Math.floor(s/86400),r=Math.floor(s%86400/3600),l=Math.floor(s%3600/60);return n>0?`${n}d ${r}h`:r>0?`${r}h ${l}m`:l>0?`${l}m ${s%60}s`:`${s}s`}function te(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:e>=1?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`}function es(e){return/([+-]\d{2}:?\d{2}|Z)\s*$/.test(e)?e:e+"Z"}function dr(e){if(!e)return"-";const s=typeof e=="string"?new Date(es(e)):new Date(e);return Number.isNaN(s.getTime())?"-":s.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})+"."+String(s.getMilliseconds()).padStart(3,"0")}function Ye(e){if(!e)return"-";const s=typeof e=="string"?new Date(es(e)).getTime():e,n=Math.floor((Date.now()-s)/1e3);return n<0?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function hr(e){return e>pn?"very-slow":e>zt?"slow":"normal"}function fe(e,s="ss-dash"){const n=hr(e);return n==="very-slow"?`${s}-very-slow`:n==="slow"?`${s}-slow`:""}function Ze(e,s=100){return e===null?"null":e===void 0?"-":typeof e=="string"?ir(e):typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?lr(e,s,Ze):typeof e=="object"?or(e,s,Ze):String(e)}function ur(e){return e<0?"no expiry":e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function pr(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function ie({ts:e,className:s,style:n}){return e?t("span",{className:s,style:n,title:dr(e),children:Ye(e)}):t("span",{className:s,style:n,children:"-"})}const fr={color:"#34d399",fillOpacityTop:.25,fillOpacityBottom:.02,strokeWidth:1.5,width:120,height:32,padding:2};function mr(e){return{...fr,...e}}let vr=0;function gr(){return`ss-grad-${vr++}`}function _r(e){if(e.length===0)return null;let s=e[0],n=e[0],r=e[0];for(let l=1;l<e.length;l++){const a=e[l];a<s&&(s=a),a>n&&(n=a),r+=a}return{min:s,max:n,avg:r/e.length}}function yr(e,s){if(e.length<2)return null;const n=mr(s),r=_r(e),l=r.max-r.min||1,a=n.width-n.padding*2,i=n.height-n.padding*2,o=n.padding,d=e.length,h=Array.from({length:d});for(let g=0;g<d;g++){const _=o+g/(d-1)*a,y=o+i-(e[g]-r.min)/l*i;h[g]=`${_.toFixed(1)},${y.toFixed(1)}`}const u=h.join(" "),c=(o+a).toFixed(1),m=(o+i).toFixed(1),p=o.toFixed(1),v=`M${h[0]} `+h.slice(1).map(g=>`L${g}`).join(" ")+` L${c},${m} L${p},${m} Z`;return{points:u,areaPath:v,gradientId:gr(),options:n,stats:r}}function De({data:e,color:s="#34d399",width:n=120,height:r=32,className:l=""}){const a=z(()=>yr(e,{width:n,height:r}),[e,n,r]),i=z(()=>"ss-grad-"+Math.random().toString(36).slice(2,8),[]),o={"--ss-accent":s};if(!a)return t("div",{className:`ss-dash-sparkline ${l}`,style:o,children:t("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:t("text",{x:n/2,y:r/2+3,textAnchor:"middle",fill:"#737373",fontSize:"9",children:["collecting","…"]})})});const d=s||"var(--ss-accent)";return t("div",{className:`ss-dash-sparkline ${l}`,style:o,children:t("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:[t("defs",{children:t("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:d,stopOpacity:"0.25"}),t("stop",{offset:"100%",stopColor:d,stopOpacity:"0.02"})]})}),t("path",{d:a.areaPath,fill:`url(#${i})`}),t("path",{className:"ss-dash-sparkline-line",d:"M"+a.points.replace(/ /g," L"),fill:"none",stroke:d,strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round"})]})})}const br=[{value:"5m",label:"5m"},{value:"15m",label:"15m"},{value:"30m",label:"30m"},{value:"1h",label:"1h"},{value:"6h",label:"6h"},{value:"24h",label:"24h"},{value:"7d",label:"7d"}];function wr({value:e,onChange:s,className:n=""}){return t("div",{className:`ss-dash-btn-group ${n}`,children:br.map(r=>t("button",{type:"button",className:`ss-dash-btn ${e===r.value?"ss-dash-active":""}`,onClick:()=>s(r.value),children:r.label},r.value))})}function xr(e,s){if(e<=0)return[0];const n=e/s,r=Math.pow(10,Math.floor(Math.log10(n))),l=n/r;let a;l<=1?a=r:l<=2?a=2*r:l<=5?a=5*r:a=10*r;const i=[];for(let o=a;o<=e+a*.5;o+=a)i.push(Math.round(o));return i.length===0&&i.push(Math.ceil(e)),i}function ts(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"})}catch{return""}}function ss(e){if(e.length===0)return"";if(e.length===1)return`M${e[0].x},${e[0].y}`;let s=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let n=0;n<e.length-1;n++){const r=e[n],l=e[n+1],a=(r.x+l.x)/2;s+=` C${a.toFixed(1)},${r.y.toFixed(1)} ${a.toFixed(1)},${l.y.toFixed(1)} ${l.x.toFixed(1)},${l.y.toFixed(1)}`}return s}function Nr({chartPoints:e}){const s={top:12,right:12,bottom:28,left:38},n=220,r=Vs(),l=`ss-cg-total-${r}`,a=`ss-cg-error-${r}`,i=O(null),[o,d]=k(0);U(()=>{const R=i.current;if(!R)return;d(R.clientWidth);const D=new ResizeObserver(le=>{for(const nt of le)d(nt.contentRect.width)});return D.observe(R),()=>D.disconnect()},[]);const h=o||600,u=h-s.left-s.right,c=n-s.top-s.bottom,m=s.top+c,p=e.map(R=>ae(R,"requestCount","request_count")||R.total||0),v=e.map(R=>ae(R,"errorCount","error_count")),g=Math.max(...p,1),_=Math.ceil(g*1.1),y=v.some(R=>R>0),S=xr(_,4),f=S.length>0?S[S.length-1]:_,x=R=>s.left+R/Math.max(e.length-1,1)*u,w=R=>s.top+c-R/(f||1)*c,b=e.map((R,D)=>({x:x(D),y:w(p[D])})),E=e.map((R,D)=>({x:x(D),y:w(v[D])})),N=ss(b),$=y?ss(E):"",T=b.length>1?`${N} L${b[b.length-1].x.toFixed(1)},${m} L${b[0].x.toFixed(1)},${m} Z`:"",j=y&&E.length>1?`${$} L${E[E.length-1].x.toFixed(1)},${m} L${E[0].x.toFixed(1)},${m} Z`:"",Q=Math.min(10,e.length),V=Math.max(1,Math.ceil(e.length/Q)),[W,C]=k({visible:!1,x:0,idx:-1}),q=L(R=>{const D=b[R].x;C({visible:!0,x:D,idx:R})},[b]),A=L(()=>{C({visible:!1,x:0,idx:-1})},[]),K=120,ge=W.visible?Math.max(K/2,Math.min(W.x,h-K/2)):0;return t("div",{ref:i,style:{position:"relative"},children:[t("svg",{viewBox:`0 0 ${h} ${n}`,className:"ss-dash-chart-svg",children:[t("defs",{children:[t("linearGradient",{id:l,x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:"var(--ss-accent)",stopOpacity:.3}),t("stop",{offset:"100%",stopColor:"var(--ss-accent)",stopOpacity:.02})]}),t("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:"var(--ss-red-fg)",stopOpacity:.35}),t("stop",{offset:"100%",stopColor:"var(--ss-red-fg)",stopOpacity:.02})]})]}),S.map(R=>{const D=w(R);return t("g",{children:[t("line",{x1:s.left,y1:D,x2:h-s.right,y2:D,stroke:"var(--ss-border-faint)",strokeWidth:.5,strokeDasharray:"3,3"}),t("text",{x:s.left-6,y:D,textAnchor:"end",fill:"var(--ss-dim)",fontSize:9,dominantBaseline:"middle",children:R})]},`ytick-${R}`)}),T&&t("path",{d:T,fill:`url(#${l})`}),N&&t("path",{d:N,fill:"none",stroke:"var(--ss-accent)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),j&&t("path",{d:j,fill:`url(#${a})`}),$&&t("path",{d:$,fill:"none",stroke:"var(--ss-red-fg)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:"4,2"}),e.map((R,D)=>{const le=p[D],nt=v[D],rt=b[D].x,Ba=b[D].y,As=u/(e.length||1),Ps=W.visible&&W.idx===D,Ds=W.visible&&W.idx!==D;return t("g",{children:[t("rect",{x:rt-As/2,y:s.top,width:As,height:c,fill:"transparent",className:"ss-dash-chart-hover-zone","data-idx":D,onMouseEnter:()=>q(D),onMouseLeave:A}),le>0&&t("circle",{cx:rt,cy:Ba,r:Ps?4:2.5,fill:"var(--ss-accent)",stroke:"var(--ss-surface)",strokeWidth:1,className:"ss-dash-chart-dot","data-idx":D,opacity:Ds?.3:1}),nt>0&&t("circle",{cx:rt,cy:E[D].y,r:Ps?3.5:2,fill:"var(--ss-red-fg)",stroke:"var(--ss-surface)",strokeWidth:1,className:"ss-dash-chart-dot ss-dash-chart-dot-err","data-idx":D,opacity:Ds?.3:1})]},D)}),e.map((R,D)=>{if(D%V!==0&&D!==e.length-1)return null;const le=ts(R.bucket);return le?t("text",{x:x(D),y:n-6,textAnchor:"middle",fill:"var(--ss-dim)",fontSize:9,children:le},`xlabel-${D}`):null})]}),W.visible&&W.idx>=0&&t("div",{className:"ss-dash-chart-tooltip",style:{left:ge,top:s.top-4,transform:"translate(-50%, -100%)"},children:[t("div",{children:ts(e[W.idx].bucket)}),t("div",{children:["Requests: ",p[W.idx]]}),v[W.idx]>0&&t("div",{style:{color:"var(--ss-red-fg)"},children:["Errors: ",v[W.idx]]})]})]})}function ns({options:e={}}){const s=zs(Qt);return s?t(rs,{options:e,overview:s.data,isLoading:s.isLoading}):t(kr,{options:e})}function kr({options:e}){const{data:s,isLoading:n}=J("overview",e);return t(rs,{options:e,overview:s,isLoading:n})}function rs({options:e,overview:s,isLoading:n}){const[r,l]=k("1h"),{data:a}=J("overview/chart",{...e,timeRange:r});if(n&&!s)return t("div",{className:"ss-dash-empty",children:"Loading overview..."});const i=s||{avgResponseTime:0,p95ResponseTime:0,requestsPerMinute:0,errorRate:0,totalRequests:0,slowestEndpoints:[],queryStats:{total:0,avgDuration:0,perRequest:0},recentErrors:[],topEvents:[],emailActivity:{sent:0,queued:0,failed:0},logLevelBreakdown:{error:0,warn:0,info:0,debug:0},cacheStats:null,jobQueueStatus:null,statusDistribution:{"2xx":0,"3xx":0,"4xx":0,"5xx":0},slowestQueries:[]},o=i,d=ae(o,"avgResponseTime","avg_response_time"),h=ae(o,"p95ResponseTime","p95_response_time"),u=ae(o,"requestsPerMinute","requests_per_minute"),c=ae(o,"errorRate","error_rate"),p=ae(o,"totalRequests","total_requests")>0,v=a?.buckets||[],g=i.sparklines?.avgResponseTime??v.map(f=>f.avgDuration??0),_=i.sparklines?.p95ResponseTime??v.map(f=>f.p95Duration??0),y=i.sparklines?.requestsPerMinute??v.map(f=>f.requestCount??0),S=i.sparklines?.errorRate??v.map(f=>f.errorCount??0);return t("div",{className:"ss-dash-overview",children:[t("div",{className:"ss-dash-cards",children:[t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"Avg Response Time"}),t("div",{className:`ss-dash-card-value ${p?d>500?"ss-dash-red":d>200?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:p?te(d):"-"}),t("div",{className:"ss-dash-sparkline",children:t(De,{data:g,color:"#34d399",width:160,height:40})})]}),t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"P95 Response Time"}),t("div",{className:`ss-dash-card-value ${p?h>500?"ss-dash-red":h>200?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:p?te(h):"-"}),t("div",{className:"ss-dash-sparkline",children:t(De,{data:_,color:"#60a5fa",width:160,height:40})})]}),t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"Requests / min"}),t("div",{className:`ss-dash-card-value ${p?"ss-dash-accent":"ss-dash-dim"}`,children:p?u.toFixed(1):"-"}),t("div",{className:"ss-dash-sparkline",children:t(De,{data:y,color:"#34d399",width:160,height:40})})]}),t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"Error Rate"}),t("div",{className:`ss-dash-card-value ${p?c>5?"ss-dash-red":c>1?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:p?`${c.toFixed(1)}%`:"-"}),t("div",{className:"ss-dash-sparkline",children:t(De,{data:S,color:"#f87171",width:160,height:40})})]})]}),t("div",{className:"ss-dash-chart-container",children:[t("div",{className:"ss-dash-chart-header",children:[t("span",{className:"ss-dash-chart-title",children:"Request Volume"}),t(wr,{value:r,onChange:l})]}),t("div",{className:"ss-dash-chart",id:"ss-dash-chart-area",children:v.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"120px"},children:"No data for this range"}):t(Nr,{chartPoints:v})}),t("div",{className:"ss-dash-chart-legend",id:"ss-dash-chart-legend",children:[t("span",{className:"ss-dash-chart-legend-item",children:[t("span",{className:"ss-dash-legend-dot",style:{background:"var(--ss-accent)"}}),"Requests"]}),v.some(f=>(f.errorCount??0)>0)&&t("span",{className:"ss-dash-chart-legend-item",children:[t("span",{className:"ss-dash-legend-dot",style:{background:"var(--ss-red-fg)"}}),"Errors"]})]})]}),t("div",{className:"ss-dash-secondary-cards",children:[t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#requests",className:"ss-dash-widget-link",children:"Slowest Endpoints"})}),i.slowestEndpoints.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No data yet"}):t("ul",{className:"ss-dash-secondary-list",children:i.slowestEndpoints.slice(0,5).map((f,x)=>{const w=f.url||f.pattern||"-";return t("li",{children:t("a",{href:`#requests?url=${encodeURIComponent(w)}`,className:"ss-dash-widget-row-link",children:[t("span",{title:w,children:w}),t("span",{className:`ss-dash-secondary-list-value ss-dash-duration ${fe(f.avgDuration)}`,children:te(f.avgDuration)})]})},x)})})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#queries",className:"ss-dash-widget-link",children:"Query Stats"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:[t("span",{children:"Total Queries"}),t("span",{className:"ss-dash-secondary-list-value",children:i.queryStats.total})]}),t("li",{children:[t("span",{children:"Avg Duration"}),t("span",{className:"ss-dash-secondary-list-value",children:te(i.queryStats.avgDuration)})]}),t("li",{children:[t("span",{children:"Queries / Request"}),t("span",{className:"ss-dash-secondary-list-value",children:i.queryStats.perRequest.toFixed(1)})]})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#logs?level=error",className:"ss-dash-widget-link",children:"Recent Errors"})}),i.recentErrors.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No recent errors"}):t("ul",{className:"ss-dash-secondary-list",children:i.recentErrors.map((f,x)=>t("li",{children:t("a",{href:`#logs?id=${f.id??""}`,className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},title:f.message,children:f.message}),f.timestamp&&t(ie,{ts:f.timestamp,className:"ss-dash-secondary-list-value",style:{color:"var(--ss-dim)"}})]})},x))})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#events",className:"ss-dash-widget-link",children:"Top Events"})}),i.topEvents.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No events yet"}):t("ul",{className:"ss-dash-secondary-list",children:i.topEvents.slice(0,5).map((f,x)=>{const w=Zt(f);return t("li",{children:t("a",{href:`#events?event_name=${encodeURIComponent(w)}`,className:"ss-dash-widget-row-link",children:[t("span",{children:w}),t("span",{className:"ss-dash-secondary-list-value",children:f.count})]})},x)})})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#emails",className:"ss-dash-widget-link",children:"Email Activity"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#emails?status=sent",className:"ss-dash-widget-row-link",children:[t("span",{children:"Sent"}),t("span",{className:"ss-dash-secondary-list-value",children:i.emailActivity.sent})]})}),t("li",{children:t("a",{href:"#emails?status=queued",className:"ss-dash-widget-row-link",children:[t("span",{children:"Queued"}),t("span",{className:"ss-dash-secondary-list-value",children:i.emailActivity.queued})]})}),t("li",{children:t("a",{href:"#emails?status=failed",className:"ss-dash-widget-row-link",children:[t("span",{children:"Failed"}),t("span",{className:"ss-dash-secondary-list-value",style:i.emailActivity.failed>0?{color:"var(--ss-red-fg)"}:void 0,children:i.emailActivity.failed})]})})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#logs",className:"ss-dash-widget-link",children:"Log Levels"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#logs?level=error",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},children:"Error"}),t("span",{className:"ss-dash-secondary-list-value",children:i.logLevelBreakdown.error})]})}),t("li",{children:t("a",{href:"#logs?level=warn",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-amber-fg)"},children:"Warn"}),t("span",{className:"ss-dash-secondary-list-value",children:i.logLevelBreakdown.warn})]})}),t("li",{children:t("a",{href:"#logs?level=info",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-green-fg)"},children:"Info"}),t("span",{className:"ss-dash-secondary-list-value",children:i.logLevelBreakdown.info})]})}),t("li",{children:t("a",{href:"#logs?level=debug",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-dim)"},children:"Debug"}),t("span",{className:"ss-dash-secondary-list-value",children:i.logLevelBreakdown.debug})]})})]})]}),i.cacheStats&&i.cacheStats.available&&t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#cache",className:"ss-dash-widget-link",children:"Cache"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#cache",className:"ss-dash-widget-row-link",children:[t("span",{children:"Keys"}),t("span",{className:"ss-dash-secondary-list-value",children:i.cacheStats.totalKeys})]})}),t("li",{children:t("a",{href:"#cache",className:"ss-dash-widget-row-link",children:[t("span",{children:"Hit Rate"}),t("span",{className:"ss-dash-secondary-list-value",children:[i.cacheStats.hitRate.toFixed(1),"%"]})]})}),t("li",{children:t("a",{href:"#cache",className:"ss-dash-widget-row-link",children:[t("span",{children:"Memory"}),t("span",{className:"ss-dash-secondary-list-value",children:i.cacheStats.memoryUsedHuman})]})})]})]}),i.jobQueueStatus&&i.jobQueueStatus.available&&t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#jobs",className:"ss-dash-widget-link",children:"Job Queue"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#jobs?status=active",className:"ss-dash-widget-row-link",children:[t("span",{children:"Active"}),t("span",{className:"ss-dash-secondary-list-value",children:i.jobQueueStatus.active})]})}),t("li",{children:t("a",{href:"#jobs?status=waiting",className:"ss-dash-widget-row-link",children:[t("span",{children:"Waiting"}),t("span",{className:"ss-dash-secondary-list-value",children:i.jobQueueStatus.waiting})]})}),t("li",{children:t("a",{href:"#jobs?status=failed",className:"ss-dash-widget-row-link",children:[t("span",{children:"Failed"}),t("span",{className:"ss-dash-secondary-list-value",style:i.jobQueueStatus.failed>0?{color:"var(--ss-red-fg)"}:void 0,children:i.jobQueueStatus.failed})]})}),t("li",{children:t("a",{href:"#jobs?status=completed",className:"ss-dash-widget-row-link",children:[t("span",{children:"Completed"}),t("span",{className:"ss-dash-secondary-list-value",children:i.jobQueueStatus.completed})]})})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#requests",className:"ss-dash-widget-link",children:"Response Status"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#requests?status=2xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-green-fg)"},children:"2xx"}),t("span",{className:"ss-dash-secondary-list-value",children:i.statusDistribution["2xx"]})]})}),t("li",{children:t("a",{href:"#requests?status=3xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-blue-fg)"},children:"3xx"}),t("span",{className:"ss-dash-secondary-list-value",children:i.statusDistribution["3xx"]})]})}),t("li",{children:t("a",{href:"#requests?status=4xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-amber-fg)"},children:"4xx"}),t("span",{className:"ss-dash-secondary-list-value",children:i.statusDistribution["4xx"]})]})}),t("li",{children:t("a",{href:"#requests?status=5xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},children:"5xx"}),t("span",{className:"ss-dash-secondary-list-value",children:i.statusDistribution["5xx"]})]})})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#queries",className:"ss-dash-widget-link",children:"Slowest Queries"})}),i.slowestQueries.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No query data yet"}):t("ul",{className:"ss-dash-secondary-list",children:i.slowestQueries.slice(0,5).map((f,x)=>{const w=Pe(f)||"-";return t("li",{children:t("a",{href:`#queries?pattern=${encodeURIComponent(w)}`,className:"ss-dash-widget-row-link",children:[t("span",{title:w,children:w}),t("span",{className:`ss-dash-secondary-list-value ss-dash-duration ${fe(f.avgDuration)}`,children:te(f.avgDuration)})]})},x)})})]})]})]})}const Sr=Object.freeze(Object.defineProperty({__proto__:null,OverviewSection:ns,default:ns},Symbol.toStringTag,{value:"Module"}));function $r(e){if(!e)return[];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function Cr(e){if(!e)return[];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function Xe(e,s,n,r=0){return e[s]??e[n]??r}function Er(e){return{method:e.method||"",url:e.url||"",statusCode:Xe(e,"status_code","statusCode"),totalDuration:Xe(e,"total_duration","totalDuration")||e.duration||0,spanCount:Xe(e,"span_count","spanCount"),spans:$r(e.spans),warnings:Cr(e.warnings),logs:e.logs||[],httpRequestId:e.httpRequestId||e.http_request_id||void 0}}function as(e="",s){const n=O(null);return U(()=>{n.current=null},[e,s]),L(()=>(n.current||(n.current=new Je({baseUrl:e,authToken:s})),n.current),[e,s])}function Tr({color:e="muted",children:s,className:n="",classPrefix:r="ss-dash"}){return t("span",{className:`${r}-badge ${r}-badge-${e} ${n}`,children:s})}function et({method:e,className:s="",classPrefix:n="ss-dash"}){return t("span",{className:`${n}-method ${n}-method-${e.toLowerCase()} ${s}`,children:e})}function is({code:e,className:s="",classPrefix:n="ss-dash"}){let r=`${n}-status-2xx`;return e>=500?r=`${n}-status-5xx`:e>=400?r=`${n}-status-4xx`:e>=300&&(r=`${n}-status-3xx`),t("span",{className:`${n}-status ${r} ${s}`,children:e})}function Lr(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return null}return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}function ls(e){const s={};for(const[n,r]of Object.entries(e))qr.has(n)||(s[n]=r);return Object.keys(s).length>0?s:null}const Ar=["all","error","warn","info","debug"];function Pr(e){return(e.levelName||e.level_name||(typeof e.level=="string"?e.level:"")||"info").toLowerCase()}function Dr(e){return e.msg||e.message||JSON.stringify(e)}function Rr(e){return e.createdAt||e.created_at||e.time||e.timestamp||0}function Mr(e){const s=e.data||{};return e.requestId||e.request_id||e["x-request-id"]||s.requestId||s.request_id||s["x-request-id"]||""}function Fr(e,s="ss-dbg-log-level"){switch(e){case"error":case"fatal":return`${s}-error`;case"warn":return`${s}-warn`;case"info":return`${s}-info`;case"debug":return`${s}-debug`;case"trace":return`${s}-trace`;default:return`${s}-info`}}const qr=new Set(["level","time","pid","hostname","msg","message","v","name","levelName","level_name","timestamp","createdAt","created_at","requestId","request_id","x-request-id","id","data"]);function Or(e){if(e.data){const s=Lr(e.data);if(s){const n=ls(s);if(n)return n}}return ls(e)}function Re({data:e,maxPreviewLength:s=100,className:n="",classPrefix:r="ss-dash",defaultExpanded:l=!1}){const[a,i]=k(l),o=z(()=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},[e]),d=z(()=>typeof o=="object"&&o!==null?Ze(o,s):String(o??"-"),[o,s]),h=z(()=>typeof o=="object"&&o!==null?JSON.stringify(o,null,2):String(o),[o]),u=L(()=>{i(m=>!m)},[]),c=L(async()=>{try{await navigator.clipboard.writeText(h)}catch{}},[h]);return!e&&e!==0&&e!==!1?t("span",{className:`ss-dim ${r}-c-dim`,children:"-"}):t("div",{className:`${r}-data-cell ${n}`,children:[!a&&t("span",{className:`${r}-data-preview`,onClick:u,role:"button",tabIndex:0,onKeyDown:m=>m.key==="Enter"&&u(),children:d}),a&&t("div",{className:`${r}-data-full`,onClick:u,children:[t("button",{className:`${r}-copy-btn`,onClick:m=>{m.stopPropagation(),c()},title:"Copy to clipboard",type:"button",children:"Copy"}),t("pre",{children:h})]})]})}function os({log:e,index:s,expanded:n,onToggleExpand:r,onReqIdClick:l}){const a=Pr(e),i=Dr(e),o=Rr(e),d=Mr(e),h=Or(e);return t(Ut.Fragment,{children:[t("div",{className:`ss-log-entry${h?" ss-log-entry-expandable":""}`,onClick:()=>h&&r(s),children:[t("span",{className:`ss-log-level ${Fr(a,"ss-log-level")}`,children:a.toUpperCase()}),t(ie,{ts:o,className:"ss-log-time"}),d?t("span",{className:"ss-log-reqid",title:d,onClick:l?u=>{u.stopPropagation(),l(d)}:void 0,role:l?"button":void 0,tabIndex:l?0:void 0,onKeyDown:l?u=>{u.key==="Enter"&&(u.stopPropagation(),l(d))}:void 0,children:d.slice(0,8)}):t("span",{className:"ss-log-reqid-empty",children:"--"}),h?t("span",{className:`ss-log-expand-icon${n?" ss-log-expand-icon-open":""}`,children:"▶"}):t("span",{style:{width:14}}),t("span",{className:"ss-log-msg",children:i})]}),n&&h&&t("div",{className:"ss-log-detail",children:t(Re,{data:h,classPrefix:"ss-dbg",defaultExpanded:!0})})]})}function Ir({logs:e,onReqIdClick:s}){const[n,r]=k(null);return e.length===0?null:t("div",{children:[t("div",{className:"ss-related-logs-title",children:["Related Logs",t("span",{className:"ss-related-logs-count",children:["(",e.length,")"]})]}),t("div",{style:{overflow:"auto"},children:e.map((l,a)=>t(os,{log:l,index:a,expanded:n===a,onToggleExpand:i=>r(n===i?null:i),onReqIdClick:s},l.id||a))})]})}function jr(e){const{container:s,handle:n,topPane:r,bottomPane:l,storageKey:a,minHeight:i=60}=e;if(a){const d=localStorage.getItem(a);if(d){const h=parseFloat(d);h>0&&h<1&&(r.style.flex=`${h}`,l.style.flex=`${1-h}`)}}function o(d){d.preventDefault(),n.setPointerCapture(d.pointerId);const u=s.getBoundingClientRect().height,c=d.clientY,m=r.getBoundingClientRect().height;function p(g){const _=g.clientY-c;let y=m+_;const S=u-i-n.offsetHeight;y=Math.max(i,Math.min(y,S));const f=y/(u-n.offsetHeight);r.style.flex=`${f}`,l.style.flex=`${1-f}`}function v(){if(n.removeEventListener("pointermove",p),n.removeEventListener("pointerup",v),a){const g=s.getBoundingClientRect().height-n.offsetHeight;if(g>0){const _=r.getBoundingClientRect().height/g;localStorage.setItem(a,String(_))}}}n.addEventListener("pointermove",p),n.addEventListener("pointerup",v)}return n.addEventListener("pointerdown",o),()=>{n.removeEventListener("pointerdown",o)}}function Br({children:e,storageKey:s}){const n=O(null),r=O(null),l=O(null),a=O(null);return U(()=>{if(n.current&&r.current&&l.current&&a.current)return jr({container:n.current,handle:r.current,topPane:l.current,bottomPane:a.current,storageKey:s})},[s]),t("div",{ref:n,className:"ss-split-container",children:[t("div",{ref:l,className:"ss-split-top",children:e[0]}),t("div",{ref:r,className:"ss-split-handle"}),t("div",{ref:a,className:"ss-split-bottom",children:e[1]})]})}const Ur="ss-col-resize",cs="ss-resizing";function ds(e){const s=Array.from(e.querySelectorAll("thead th"));if(s.length===0)return()=>{};const n=[];let r=!1;function l(){if(!r){r=!0;for(const a of s)a.style.width=a.offsetWidth+"px";e.style.tableLayout="fixed"}}for(const a of s){let i=function(d){d.preventDefault(),d.stopPropagation(),l();const h=d.clientX,u=a.offsetWidth;o.classList.add(cs),o.setPointerCapture(d.pointerId);function c(p){const v=p.clientX-h,g=Math.max(30,u+v);a.style.width=g+"px"}function m(){o.classList.remove(cs),o.removeEventListener("pointermove",c),o.removeEventListener("pointerup",m)}o.addEventListener("pointermove",c),o.addEventListener("pointerup",m)};if(!a.textContent?.trim())continue;const o=document.createElement("div");o.className=Ur,a.appendChild(o),o.addEventListener("pointerdown",i),n.push(()=>{o.removeEventListener("pointerdown",i),o.remove()})}return()=>{for(const a of n)a()}}function Hr(e=[]){const s=O(null),n=O(null);return U(()=>(s.current&&(n.current?.(),n.current=ds(s.current)),()=>{n.current?.(),n.current=null}),e),L(l=>{n.current?.(),n.current=null,s.current=l,l&&(n.current=ds(l))},[])}function se({columns:e,data:s,keyField:n="id",sort:r,sortDir:l,onSort:a,onRowClick:i,rowClassName:o,emptyMessage:d="No data",className:h="",renderAfterRow:u}){const c=L(p=>{a&&a(p)},[a]),m=Hr([s,e]);return s.length===0?t("div",{className:"ss-dash-empty",children:d}):t("table",{ref:m,className:`ss-dash-table ${h}`,children:[t("colgroup",{children:e.map(p=>t("col",{style:p.width?{width:p.width}:void 0},p.key))}),t("thead",{children:t("tr",{children:e.map(p=>t("th",{onClick:p.sortable?()=>c(p.key):void 0,className:p.sortable?"ss-dash-sortable":"",children:[p.label,r===p.key&&t("span",{className:"ss-dash-sort-arrow",children:l==="asc"?" ▲":" ▼"})]},p.key))})}),t("tbody",{children:s.map((p,v)=>{const g=o?typeof o=="function"?o(p):o:"",_=i?"ss-dash-clickable":"";return t(Ut.Fragment,{children:[t("tr",{onClick:i?()=>i(p):void 0,className:`${_} ${g}`.trim(),children:e.map(y=>t("td",{children:y.render?y.render(p[y.key],p):p[y.key]??"-"},y.key))}),u?u(p,v):null]},p[n]??v)})})]})}function ee({search:e,onSearchChange:s,placeholder:n="Search...",summary:r,children:l,className:a=""}){const i=L(()=>{s("")},[s]);return t("div",{className:`ss-dbg-filter-bar ${a}`,children:[r!=null&&t("span",{className:"ss-dbg-summary",children:r}),t("div",{className:"ss-dbg-search-wrapper",children:[t("svg",{className:"ss-dbg-search-icon",width:"14",height:"14",viewBox:H.search.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:H.search.elements.join("")}}),t("input",{type:"text",className:"ss-dbg-search",placeholder:n,value:e,onChange:o=>s(o.target.value)}),e&&t("button",{type:"button",className:"ss-dbg-search-clear",onClick:i,children:"×"})]}),l&&t("div",{className:"ss-dbg-filter-controls",children:l})]})}function de({page:e,lastPage:s,total:n,onPageChange:r,className:l=""}){const a=z(()=>wn(e,s),[e,s]),i=L(()=>{e>1&&r(e-1)},[e,r]),o=L(()=>{e<s&&r(e+1)},[e,s,r]);return s<=1?null:t("div",{className:`ss-dash-pagination ${l}`,children:[t("span",{className:"ss-dash-page-info",children:["Page ",e," of ",s," (",n," total)"]}),t("div",{className:"ss-dash-pagination-controls",children:[t("button",{type:"button",className:"ss-dash-page-btn",onClick:i,disabled:e<=1,children:"« Prev"}),a.map((d,h)=>d==="..."?t("span",{className:"ss-dash-page-ellipsis",children:"..."},`ellipsis-${h}`):t("button",{type:"button",className:`ss-dash-page-btn ${d===e?"ss-dash-active":""}`,onClick:()=>r(d),children:d},d)),t("button",{type:"button",className:"ss-dash-page-btn",onClick:o,disabled:e>=s,children:"Next »"})]})]})}const hs={request:"#1e3a5f",middleware:"rgba(30, 58, 95, 0.7)",db:"#6d28d9",view:"#0e7490",mail:"#059669",event:"#b45309",custom:"var(--ss-dim)"},zr={request:"Request",middleware:"Middleware",db:"DB",mail:"Mail",event:"Event",view:"View",custom:"Custom"};function us({spans:e,totalDuration:s,className:n="",warnings:r}){const l=e||[],a=z(()=>[...l].sort((o,d)=>o.startOffset-d.startOffset),[l]),i=z(()=>{const o={};for(const d of a)o[d.id]=d.parentId?(o[d.parentId]||0)+1:0;return o},[a]);return l.length===0?t("div",{className:"ss-dash-empty",children:"No spans recorded"}):t("div",{className:`ss-dash-tl-waterfall ${n}`,children:[t("div",{className:"ss-dash-tl-legend",children:Object.entries(zr).map(([o,d])=>t("div",{className:"ss-dash-tl-legend-item",children:[t("span",{className:"ss-dash-tl-legend-dot",style:{background:hs[o]||hs.custom}}),t("span",{children:d})]},o))}),a.map(o=>{const d=s>0?o.startOffset/s*100:0,h=s>0?Math.max(o.duration/s*100,.5):1,u=i[o.id]||0,c=o.label.length>50?o.label.slice(0,50)+"...":o.label,m=o.category==="db"?"DB":o.category,p=o.category==="db"?"purple":o.category==="mail"?"green":o.category==="event"?"amber":o.category==="view"?"blue":"muted",v=o.metadata?Object.entries(o.metadata).filter(([,_])=>_!=null).map(([_,y])=>`${_}=${y}`).join(", "):"",g=v?`${o.label} (${o.duration.toFixed(2)}ms)
2
- ${v}`:`${o.label} (${o.duration.toFixed(2)}ms)`;return t("div",{className:"ss-dash-tl-row",children:[t("div",{className:"ss-dash-tl-label",title:g,style:{paddingLeft:8+u*16+"px"},children:[t("span",{className:`ss-dash-badge ss-dash-badge-${p}`,style:{fontSize:"9px",marginRight:"4px"},children:m}),c]}),t("div",{className:"ss-dash-tl-track",children:t("div",{className:`ss-dash-tl-bar ss-dash-tl-bar-${o.category||"custom"}`,style:{left:`${d}%`,width:`${h}%`},title:g})}),t("span",{className:"ss-dash-tl-dur",children:[o.duration.toFixed(2),"ms"]})]},o.id)}),r&&r.length>0&&t("div",{className:"ss-dash-tl-warnings",children:[t("div",{className:"ss-dash-tl-warnings-title",children:["Warnings (",r.length,")"]}),r.map((o,d)=>t("div",{className:"ss-dash-tl-warning",children:o},d))]})]})}function ps({options:e={}}){const[s,n]=k(1),[r,l]=k(""),[a,i]=k("createdAt"),[o,d]=k("desc"),[h,u]=k(null),[c,m]=k(!1),p=O(null);U(()=>n(1),[r]);const{data:v,meta:g,isLoading:_,error:y}=J("requests",{...e,page:s,search:r,sort:a,sortDir:o}),S=as(e.baseUrl||"",e.authToken),f=L(b=>{const E=b.id;m(!0),p.current?.abort();const N=new AbortController;p.current=N;const $=e.dashboardEndpoint||"/__stats/api";S().fetch(`${$}/requests/${E}`,{signal:N.signal}).then(T=>{if(N.signal.aborted)return;const j=T,Q=j.trace;if(Q){const V={...j,...Q,logs:j.logs};u(V)}else u(T);m(!1)}).catch(()=>{N.signal.aborted||m(!1)})},[S,e.dashboardEndpoint]);U(()=>()=>p.current?.abort(),[]);const x=L(b=>{a===b?d(E=>E==="asc"?"desc":"asc"):(i(b),d("desc"))},[a]),w=v||[];if(h){const b=Er(h),E=b.logs.length>0;return t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:[t("button",{type:"button",className:"ss-dash-btn",onClick:()=>u(null),children:"← Back to Requests"}),t(et,{method:b.method}),t("span",{style:{color:"var(--ss-text)"},children:b.url}),t(is,{code:b.statusCode}),t("span",{className:"ss-dash-tl-meta",children:[b.totalDuration.toFixed(1),"ms · ",b.spanCount," spans"]})]}),E?t(Br,{storageKey:"ss-requests-split",children:[t(us,{spans:b.spans,totalDuration:b.totalDuration,warnings:b.warnings}),t(Ir,{logs:b.logs})]}):t(us,{spans:b.spans,totalDuration:b.totalDuration,warnings:b.warnings})]})}return c?t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:t("button",{type:"button",className:"ss-dash-btn",onClick:()=>m(!1),children:"← Back to Requests"})}),t("div",{className:"ss-dash-empty",children:"Loading request detail..."})]}):t("div",{children:[t(ee,{search:r,onSearchChange:l,placeholder:"Filter requests...",summary:`${g?.total??0} requests`}),y&&t("div",{className:"ss-dash-empty",children:"Failed to load requests"}),_&&!v?t("div",{className:"ss-dash-empty",children:"Loading requests..."}):t(M,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:b=>t("span",{style:{color:"var(--ss-dim)"},children:b})},{key:"method",label:"Method",width:"70px",sortable:!0,render:b=>t(et,{method:b})},{key:"url",label:"URL",sortable:!0,render:b=>t("span",{style:{color:"var(--ss-text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:b,children:b})},{key:"statusCode",label:"Status",width:"60px",sortable:!0,render:(b,E)=>{const N=er(E);return t(is,{code:N})}},{key:"duration",label:"Duration",width:"80px",sortable:!0,render:(b,E)=>{const N=tr(E);return t("span",{className:`ss-dash-duration ${fe(N)}`,children:[N.toFixed(1),"ms"]})}},{key:"spanCount",label:"Spans",width:"50px",render:(b,E)=>{const N=sr(E);return t("span",{style:{color:"var(--ss-muted)",textAlign:"center"},children:N})}},{key:"warningCount",label:"⚠",width:"40px",render:(b,E)=>{const N=nr(E);return N>0?t("span",{style:{color:"var(--ss-amber-fg)",textAlign:"center",display:"block"},children:N}):t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:"-"})}},{key:"createdAt",label:"Time",width:"80px",sortable:!0,render:(b,E)=>{const N=Ae(E)??"";return t(ie,{ts:N,className:"ss-dash-event-time"})}}],data:w,sort:a,sortDir:o,onSort:x,onRowClick:f,emptyMessage:"No requests recorded yet"})}),g&&t(de,{page:g.page,lastPage:g.lastPage,total:g.total,onPageChange:n})]})]})}const Vr=Object.freeze(Object.defineProperty({__proto__:null,RequestsSection:ps,default:ps},Symbol.toStringTag,{value:"Module"}));function Wr(e,s){let n=0,r=0;for(const d of e){const h=I(d,"duration")??0;r+=h,h>zt&&n++}const l=fs(e);let a=0;for(const d of l.values())d>1&&(a+=d);const i=e.length>0?r/e.length:0,o=s?.total??e.length;return{slowCount:n,dupCount:a,avgDuration:i,totalCount:o}}function fs(e){const s=new Map;for(const n of e){const l=Pe(n);s.set(l,(s.get(l)||0)+1)}return s}class Kr{state;constructor(s="list"){this.state={viewMode:s,sort:{key:s==="list"?"createdAt":"count",dir:"desc"},expandedIds:new Set,explainData:new Map,search:""}}setViewMode(s){return this.state.viewMode=s,this.state.sort={key:s==="list"?"createdAt":"count",dir:"desc"},this.state.expandedIds=new Set,this.state.explainData=new Map,this.state}toggleSort(s){return this.state.sort.key===s?this.state.sort={key:s,dir:this.state.sort.dir==="asc"?"desc":"asc"}:this.state.sort={key:s,dir:"desc"},this.state}toggleExpand(s){return this.state.expandedIds.has(s)?this.state.expandedIds.delete(s):this.state.expandedIds.add(s),this.state}isExpanded(s){return this.state.expandedIds.has(s)}setSearch(s){return this.state.search=s,this.state}startExplain(s){this.state.explainData.set(s,{loading:!0})}completeExplain(s,n){this.state.explainData.set(s,{loading:!1,result:n})}failExplain(s,n){this.state.explainData.set(s,{loading:!1,error:n})}clearExplain(){this.state.explainData=new Map}getExplainState(s){return this.state.explainData.get(s)}}function Qr(e){const s=[];if(e["Startup Cost"]!==null&&e["Startup Cost"]!==void 0&&s.push(`cost=${e["Startup Cost"]}..${e["Total Cost"]}`),e["Plan Rows"]!==null&&e["Plan Rows"]!==void 0&&s.push(`rows=${e["Plan Rows"]}`),e["Plan Width"]!==null&&e["Plan Width"]!==void 0&&s.push(`width=${e["Plan Width"]}`),e.Filter&&s.push(`filter: ${e.Filter}`),e["Index Cond"]&&s.push(`cond: ${e["Index Cond"]}`),e["Hash Cond"]&&s.push(`hash: ${e["Hash Cond"]}`),e["Join Type"]&&s.push(`join: ${e["Join Type"]}`),e["Sort Key"]){const n=Array.isArray(e["Sort Key"])?e["Sort Key"].join(", "):e["Sort Key"];s.push(`sort: ${n}`)}return s}function ms(e,s=0){if(!e)return[];const r=[{depth:s,nodeType:e["Node Type"]||"Unknown",relationName:e["Relation Name"]||"",alias:e.Alias&&e.Alias!==e["Relation Name"]?e.Alias:"",indexName:e["Index Name"]||"",metrics:Qr(e),isRoot:s===0}],l=e.Plans||[];for(const a of l)r.push(...ms(a,s+1));return r}function Jr(e){return!e||typeof e!="object"?!1:"Plan"in e}function Gr(e){if(!e||e.length===0)return[];const s=e[0];return!s||typeof s!="object"?[]:Object.keys(s)}function Yr(e){return e==null?"-":String(e)}function Zr(e){const s=e?.showExplain??!0,n=[{key:"id",label:"#",width:"40px",type:"index"},{key:"sql",label:"SQL",type:"sql"},{key:"duration",label:"Duration",width:"70px",sortable:!0,type:"duration"},{key:"method",label:"Method",width:"60px",type:"method"},{key:"model",label:"Model",width:"90px",type:"model"},{key:"connection",label:"Connection",width:"80px",type:"connection"},{key:"createdAt",label:"Time",width:"90px",sortable:!0,type:"time"}];return s&&n.push({key:"id",label:"",width:"70px",type:"explain"}),n}function Xr(){return[{key:"sqlNormalized",label:"Pattern",type:"sql"},{key:"count",label:"Count",width:"60px",sortable:!0},{key:"avgDuration",label:"Avg",width:"70px",sortable:!0,type:"duration"},{key:"minDuration",label:"Min",width:"70px",type:"duration"},{key:"maxDuration",label:"Max",width:"70px",type:"duration"},{key:"totalDuration",label:"Total",width:"70px",sortable:!0,type:"duration"},{key:"percentOfTotal",label:"% Time",width:"60px"}]}function ea({node:e,depth:s=0}){if(!e)return null;const n=z(()=>ms(e,s),[e,s]);return t(M,{children:n.map((r,l)=>t("div",{className:"ss-dash-explain-node",style:{marginLeft:`${r.depth*20}px`},children:[t("div",{className:"ss-dash-explain-node-header",children:[t("span",{className:"ss-dash-explain-node-type",children:r.nodeType}),r.relationName&&t(M,{children:[" on ",t("strong",{children:r.relationName})]}),r.alias&&` (${r.alias})`,r.indexName&&t(M,{children:[" using ",t("em",{children:r.indexName})]})]}),r.metrics.length>0&&t("div",{className:"ss-dash-explain-metrics",children:r.metrics.join(" · ")})]},l))})}function ta({plan:e}){if(!e||!Array.isArray(e)||e.length===0)return t("div",{className:"ss-dash-explain-result",children:"No plan data returned"});const s=e[0];if(Jr(s))return t("div",{className:"ss-dash-explain-result",children:t(ea,{node:s.Plan,depth:0})});if(typeof s=="object"&&s!==null){const n=Gr(e);return t("div",{className:"ss-dash-explain-result",children:t("table",{children:[t("thead",{children:t("tr",{children:n.map(r=>t("th",{children:r},r))})}),t("tbody",{children:e.map((r,l)=>{const a=r;return t("tr",{children:n.map(i=>t("td",{children:Yr(a[i])},i))},l)})})]})})}return t("div",{className:"ss-dash-explain-result",children:"No plan data returned"})}const vs=t("span",{className:"ss-empty-hint",children:["Queries require ",t("code",{children:"debug: true"})," on your Lucid connections in"," ",t("code",{children:"config/database.ts"})]});function sa({mode:e,controllerState:s,queries:n,meta:r,isLoading:l,onSearchChange:a,onSort:i,onToggleExpand:o,onViewModeChange:d,onPageChange:h,onExplain:u,onCloseExplain:c,summary:m,filterBarChildren:p}){const{viewMode:v,sort:g,expandedIds:_,explainData:y,search:S}=s,f=!!u,x=e==="dashboard"&&!!r,w=e==="dashboard"&&!!d,b=z(()=>fs(n),[n]);if(w&&v==="grouped")return E();return N();function E(){const T=Xr().map(j=>na(j,_,o));return t("div",{children:[t(ee,{search:S,onSearchChange:a,placeholder:"Filter queries...",summary:m,children:p}),l&&n.length===0?t("div",{className:"ss-dash-empty",children:"Loading queries..."}):t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:T,data:n,keyField:"sqlNormalized",sort:g.key,sortDir:g.dir,onSort:i,emptyMessage:t(M,{children:["No queries recorded",vs]})})})]})}function N(){const $=Zr({showExplain:f}),T=$.map(V=>ra(V,_,b,y,o,u)),j=$.length,Q=f?V=>{const W=V.id,C=y.get(W);return!C||C.loading?null:t("tr",{className:"ss-dash-explain-row",children:t("td",{colSpan:j,className:"ss-dash-explain",children:t("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[t("div",{style:{flex:1},children:C.error?t("div",{className:"ss-dash-explain-result ss-dash-explain-error",children:[t("strong",{children:"Error:"})," ",C.error,C.result?.message&&t(M,{children:[t("br",{}),C.result.message]})]}):C.result?t(ta,{plan:C.result.plan||C.result.rows||[]}):null}),t("button",{type:"button",className:"ss-dash-explain-btn",onClick:()=>c?.(),style:{marginLeft:"8px",flexShrink:0},children:"Close"})]})})})}:void 0;return t("div",{children:[t(ee,{search:S,onSearchChange:a,placeholder:"Filter queries...",summary:m,children:p}),l&&n.length===0?t("div",{className:"ss-dash-empty",children:"Loading queries..."}):t(M,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:T,data:n,sort:g.key,sortDir:g.dir,onSort:i,emptyMessage:t(M,{children:["No queries captured",vs]}),renderAfterRow:Q})}),x&&r&&t(de,{page:r.page,lastPage:r.lastPage,total:r.total,onPageChange:h})]})]})}}function na(e,s,n){const r={key:e.key,label:e.label,width:e.width,sortable:e.sortable};switch(e.type){case"sql":r.render=(l,a)=>{const i=l||"",o=(a.count||0)>=3;return t(M,{children:[t("span",{className:`ss-dash-sql ${s.has(i)?"ss-dash-expanded":""}`,title:"Click to expand",onClick:d=>{d.stopPropagation(),n(i)},role:"button",tabIndex:0,onKeyDown:d=>d.key==="Enter"&&n(i),children:i}),o&&t(M,{children:[" ",t("span",{className:"ss-dash-dup",children:"DUP"})]})]})};break;case"duration":r.render=l=>{const a=l||0,i=e.key==="avgDuration"||e.key==="maxDuration";return t("span",{className:`ss-dash-duration ${i?fe(a):""}`,children:e.key==="totalDuration"?a.toFixed(1)+"ms":a.toFixed(2)+"ms"})};break;default:e.key==="count"?r.render=l=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:l||0}):e.key==="percentOfTotal"&&(r.render=l=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:(l||0).toFixed(1)+"%"}));break}return r}function ra(e,s,n,r,l,a){const i={key:e.key,label:e.label,width:e.width,sortable:e.sortable};switch(e.type){case"index":i.render=o=>t("span",{style:{color:"var(--ss-dim)"},children:o});break;case"sql":i.render=(o,d)=>{const h=d.sql||d.sql_text||"",u=d.id;return t("div",{children:[t("span",{className:`ss-dash-sql ${s.has(u)?"ss-dash-expanded":""}`,title:"Click to expand",onClick:c=>{c.stopPropagation(),l(u)},role:"button",tabIndex:0,onKeyDown:c=>c.key==="Enter"&&l(u),children:h}),(n.get(Pe(d))??0)>1&&t("span",{className:"ss-dash-dup",children:["×",n.get(Pe(d))]})]})};break;case"duration":i.render=o=>{const d=o||0;return t("span",{className:`ss-dash-duration ${fe(d)}`,children:d.toFixed(2)+"ms"})};break;case"method":i.render=(o,d)=>{const h=Xt(d);return t("span",{className:`ss-dash-method ss-dash-method-${h.toLowerCase()}`,children:h})};break;case"model":i.render=o=>t("span",{style:{color:"var(--ss-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:o,children:o||"-"});break;case"connection":i.render=o=>t("span",{style:{color:"var(--ss-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o||"-"});break;case"time":i.render=(o,d)=>{const h=o||(Ae(d)??"");return t(ie,{ts:h,className:"ss-dash-event-time"})};break;case"explain":i.render=(o,d)=>{if(Xt(d)!=="select")return null;const u=d.id,c=r.get(u),m=c&&!c.loading&&c.result&&!c.error,p=c?.loading;return t("button",{type:"button",className:`ss-dash-explain-btn${m?" ss-dash-explain-btn-active":""}`,onClick:v=>{v.stopPropagation(),a?.(u)},disabled:!!p,children:p?"...":"EXPLAIN"})};break}return i}function gs({options:e={}}){const[s,n]=k(1),r=O(new Kr("list")),[l,a]=k(r.current.state),i=L(()=>{a({...r.current.state})},[]),{viewMode:o,sort:d,search:h}=l,u=L(N=>{N!==r.current.state.viewMode&&(r.current.setViewMode(N),n(1),i())},[i]),c=L(N=>{r.current.setSearch(N),i()},[i]);U(()=>n(1),[h]);const m=o==="grouped"?"queries/grouped":"queries",{data:p,meta:v,isLoading:g,getApi:_}=J(m,{...e,page:s,search:h,sort:d.key,sortDir:d.dir}),y=L(N=>{r.current.toggleSort(N),i()},[i]),S=L(N=>{r.current.toggleExpand(N),i()},[i]),f=L(async N=>{const $=r.current.getExplainState(N);if($&&!$.loading){r.current.clearExplain(),i();return}r.current.startExplain(N),i();try{const T=await _().explainQuery(N);if(T&&T.error){const j=T.message?`${T.error}: ${T.message}`:T.error;r.current.failExplain(N,j)}else r.current.completeExplain(N,{plan:T?.plan||void 0,rows:T?.rows||void 0})}catch(T){console.warn("[ss] Query explain failed:",T);let j=T instanceof Error?T.message:String(T);const Q=T?.body;if(Q)try{const V=JSON.parse(Q);V.message?j=V.error?`${V.error}: ${V.message}`:V.message:V.error&&(j=V.error)}catch{}r.current.failExplain(N,j)}i()},[_,i]),x=L(()=>{r.current.clearExplain(),i()},[i]),w=o==="grouped"?p?.groups||[]:p||[],b=z(()=>o!=="grouped"?w:w.map(N=>{const $={...N};return $.sqlNormalized??=I(N,"sql_normalized","pattern")??void 0,$.count??=I(N,"total_count"),$.avgDuration??=I(N,"avg_duration"),$.maxDuration??=I(N,"max_duration"),$.minDuration??=I(N,"min_duration"),$.totalDuration??=I(N,"total_duration"),$.percentOfTotal??=I(N,"pct_time"),$}),[w,o]),E=z(()=>{if(o==="grouped")return`${b.length} query patterns`;const N=Wr(b,v??void 0),$=[`${N.totalCount} queries`];return N.slowCount>0&&$.push(`${N.slowCount} slow`),N.dupCount>0&&$.push(`${N.dupCount} dup`),$.push(`avg ${(N.avgDuration||0).toFixed(1)}ms`),$.join(", ")},[o,b,v]);return t(sa,{mode:"dashboard",controllerState:l,queries:b,meta:v,isLoading:g&&!p,onSearchChange:c,onSort:y,onToggleExpand:S,onViewModeChange:u,onPageChange:n,onExplain:f,onCloseExplain:x,summary:E,filterBarChildren:t("div",{className:"ss-dash-btn-group",children:[t("button",{type:"button",className:`ss-dash-btn ${o==="list"?"ss-dash-active":""}`,onClick:()=>u("list"),children:"List"}),t("button",{type:"button",className:`ss-dash-btn ${o==="grouped"?"ss-dash-active":""}`,onClick:()=>u("grouped"),children:"Grouped"})]})})}const aa=Object.freeze(Object.defineProperty({__proto__:null,QueriesSection:gs,default:gs},Symbol.toStringTag,{value:"Module"}));function _s({options:e={}}){const[s,n]=k(1),[r,l]=k(""),{data:a,meta:i,isLoading:o}=J("events",{...e,page:s,search:r}),d=a||[];return U(()=>n(1),[r]),t("div",{children:[t(ee,{search:r,onSearchChange:l,placeholder:"Filter events...",summary:`${i?.total??0} events`}),o&&!a?t("div",{className:"ss-dash-empty",children:"Loading events..."}):t(M,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:h=>t("span",{style:{color:"var(--ss-dim)"},children:h})},{key:"eventName",label:"Event",render:(h,u)=>{const c=Zt(u);return t("span",{className:"ss-dash-event-name",title:c,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:c})}},{key:"data",label:"Data",render:h=>t(Re,{data:h,maxPreviewLength:80,className:"ss-dash-event-data"})},{key:"createdAt",label:"Time",width:"80px",render:(h,u)=>{const c=Ae(u);return t(ie,{ts:c,className:"ss-dash-event-time"})}}],data:d,emptyMessage:"No events recorded yet"})}),i&&t(de,{page:i.page,lastPage:i.lastPage,total:i.total,onPageChange:n})]})]})}const ia=Object.freeze(Object.defineProperty({__proto__:null,EventsSection:_s,default:_s},Symbol.toStringTag,{value:"Module"}));function ys({options:e={}}){const[s,n]=k(""),{data:r,isLoading:l,error:a}=J("routes",{...e,search:s}),i=r,o=Array.isArray(i)?i:i&&Array.isArray(i.routes)?i.routes:i&&Array.isArray(i.data)?i.data:[],d={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};return t("div",{children:[t(ee,{search:s,onSearchChange:n,placeholder:"Filter routes...",summary:`${o.length} routes`}),a?t("div",{className:"ss-dash-empty",children:"Failed to load routes"}):l&&!r?t("div",{className:"ss-dash-empty",children:"Loading routes..."}):t(M,{children:t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"method",label:"Method",width:"70px",render:h=>t(et,{method:h})},{key:"pattern",label:"Pattern",render:h=>t("span",{style:{color:"var(--ss-text)",...d},title:h,children:h})},{key:"name",label:"Name",width:"120px",render:h=>t("span",{style:{color:"var(--ss-muted)",...d},title:h||"-",children:h||"-"})},{key:"handler",label:"Handler",render:h=>t("span",{style:{color:"var(--ss-sql-color)",...d},title:h,children:h})},{key:"middleware",label:"Middleware",render:h=>{const u=h?.length?h.join(", "):"-";return t("span",{style:{color:"var(--ss-dim)",fontSize:"10px",...d},title:u,children:u})}}],data:o,keyField:"pattern",emptyMessage:"No routes available"})})})]})}const la=Object.freeze(Object.defineProperty({__proto__:null,RoutesSection:ys,default:ys},Symbol.toStringTag,{value:"Module"}));function bs({options:e={}}){const[s,n]=k(1),[r,l]=k(""),[a,i]=k("all"),[o,d]=k(""),[h,u]=k(""),[c,m]=k([]),[p,v]=k("level"),[g,_]=k("equals"),[y,S]=k(""),[f,x]=k(null),w={};a!=="all"&&(w.level=a),o&&(w.request_id=o),c.forEach((A,K)=>{w[`filter_field_${K}`]=A.field,w[`filter_op_${K}`]=A.operator,w[`filter_value_${K}`]=A.value});const{data:b,meta:E,isLoading:N}=J("logs",{...e,page:s,search:r,filters:w}),$=b||[],T=L(A=>{d(A),u(A),n(1)},[]),j=L(()=>{const A=h.trim();d(A),n(1)},[h]),Q=L(()=>{d(""),u(""),n(1)},[]),V=L(()=>{i("all"),n(1)},[]),W=L(()=>{const A=y.trim();A&&(m(K=>[...K,{field:p,operator:g,value:A}]),S(""))},[p,g,y]),C=L(A=>{m(K=>K.filter((ge,R)=>R!==A))},[]),q=a!=="all"||o!==""||c.length>0;return t("div",{children:[t(ee,{search:r,onSearchChange:l,placeholder:"Search logs...",summary:`${E?.total??0} logs`,children:t("div",{className:"ss-dash-log-filters",children:[Ar.map(A=>t("button",{type:"button",className:`ss-dash-log-filter ${a===A?"ss-dash-active":""}`,onClick:()=>{i(A),n(1)},children:A},A)),t("input",{type:"text",className:"ss-dash-filter-input ss-dash-reqid-input",placeholder:"Filter by request ID...",value:h,onChange:A=>u(A.target.value),onKeyDown:A=>A.key==="Enter"&&j()}),(h||o)&&t("button",{type:"button",className:"ss-dash-btn ss-dash-reqid-clear",onClick:()=>{Q()},children:"Clear"})]})}),t("div",{className:"ss-dash-structured-search",children:[t("select",{className:"ss-dash-filter-select",value:p,onChange:A=>v(A.target.value),children:[t("option",{value:"level",children:"level"}),t("option",{value:"message",children:"message"}),t("option",{value:"request_id",children:"request_id"}),t("option",{value:"userId",children:"userId"}),t("option",{value:"email",children:"email"}),t("option",{value:"path",children:"path"})]}),t("select",{className:"ss-dash-filter-select",value:g,onChange:A=>_(A.target.value),children:[t("option",{value:"equals",children:"equals"}),t("option",{value:"contains",children:"contains"}),t("option",{value:"starts_with",children:"starts with"})]}),t("input",{className:"ss-dash-filter-input",placeholder:"Value...",value:y,onChange:A=>S(A.target.value),onKeyDown:A=>A.key==="Enter"&&W()}),t("button",{type:"button",className:"ss-dash-btn",onClick:W,children:"Add"})]}),q&&t("div",{className:"ss-dash-filter-chips",children:[a!=="all"&&t("span",{className:"ss-dash-filter-chip",children:["level: ",a,t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:V,children:"×"})]}),o&&t("span",{className:"ss-dash-filter-chip",children:["requestId: ",o.slice(0,8),"...",t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:Q,children:"×"})]}),c.map((A,K)=>t("span",{className:"ss-dash-filter-chip",children:[A.field," ",A.operator,' "',A.value,'"',t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:()=>C(K),children:"×"})]},K))]}),N&&!b?t("div",{className:"ss-dash-empty",children:"Loading logs..."}):$.length===0?t("div",{className:"ss-dash-empty",children:["No log entries",o?` matching request ${o}`:a!=="all"?` for ${a}`:""]}):t("div",{className:"ss-dash-log-entries",children:$.map((A,K)=>t(os,{log:A,index:K,expanded:f===K,onToggleExpand:ge=>x(f===ge?null:ge),onReqIdClick:T},A.id||K))}),E&&t(de,{page:E.page,lastPage:E.lastPage,total:E.total,onPageChange:n})]})}const oa=Object.freeze(Object.defineProperty({__proto__:null,LogsSection:bs,default:bs},Symbol.toStringTag,{value:"Module"}));function ca({email:e,previewHtml:s,isLoading:n=!1,onClose:r,className:l}){return t("div",{className:l||"ss-email-preview",children:[t("div",{className:"ss-email-preview-header",children:[t("div",{className:"ss-email-preview-meta",children:e&&t(M,{children:[e.subject!=null&&t("div",{children:[t("strong",{children:"Subject:"})," ",e.subject]}),e.from!=null&&t("div",{children:[t("strong",{children:"From:"})," ",e.from]}),e.to!=null&&t("div",{children:[t("strong",{children:"To:"})," ",e.to]}),e.cc&&t("div",{children:[t("strong",{children:"CC:"})," ",e.cc]}),e.status&&t("div",{children:[t("strong",{children:"Status:"})," ",t("span",{className:`ss-email-status ss-email-status-${e.status}`,children:e.status})]}),e.mailer&&t("div",{children:[t("strong",{children:"Mailer:"})," ",e.mailer]})]})}),t("button",{className:"ss-dbg-btn-clear",onClick:r,type:"button",children:"×"})]}),n?t("div",{className:"ss-empty",children:"Loading preview..."}):s?t("iframe",{className:"ss-email-iframe",srcDoc:s,title:"Email preview",sandbox:""}):t("div",{style:{padding:"12px",whiteSpace:"pre-wrap"},children:e?.text||"No content"})]})}function ws({options:e={}}){const[s,n]=k(1),[r,l]=k(""),[a,i]=k(null),[o,d]=k(null),h=O(null),{data:u,meta:c,isLoading:m}=J("emails",{...e,page:s,search:r}),p=u||[];U(()=>n(1),[r]);const v=L(async g=>{if(h.current?.abort(),g.html){h.current=null,i(g.id),d(g.html);return}const _=new AbortController;h.current=_;try{const{baseUrl:y="",dashboardEndpoint:S="/__stats/api",authToken:f}=e,x=`${y}${S}/emails/${g.id}/preview`,w={Accept:"text/html"};f&&(w.Authorization=`Bearer ${f}`);const E=await(await fetch(x,{headers:w,credentials:"same-origin",signal:_.signal})).text();if(h.current!==_)return;i(g.id),d(E)}catch(y){if(y instanceof Error&&y.name==="AbortError")return}},[e]);if(U(()=>()=>h.current?.abort(),[]),a&&o){const g=p.find(y=>y.id===a),_=g?{subject:g.subject,from:Gt(g),to:Yt(g),cc:rr(g)||null,status:g.status,mailer:g.mailer}:null;return t(ca,{email:_,previewHtml:o,onClose:()=>{i(null),d(null)},className:"ss-dash-email-preview"})}return t("div",{children:[t(ee,{search:r,onSearchChange:l,placeholder:"Filter emails...",summary:`${c?.total??0} emails`}),m&&!u?t("div",{className:"ss-dash-empty",children:"Loading emails..."}):t(M,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:g=>t("span",{style:{color:"var(--ss-dim)"},children:g})},{key:"from",label:"From",width:"150px",render:(g,_)=>{const y=Gt(_);return t("span",{title:y,style:{color:"var(--ss-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:y})}},{key:"to",label:"To",width:"150px",render:(g,_)=>{const y=Yt(_);return t("span",{title:y,style:{color:"var(--ss-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:y})}},{key:"subject",label:"Subject",render:g=>{const _=g||"";return t("span",{title:_,style:{color:"var(--ss-sql-color)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:_})}},{key:"status",label:"Status",width:"80px",render:g=>{const _=g||"";return t("span",{className:`ss-dash-badge ss-dash-email-status-${_}`,children:_})}},{key:"attachmentCount",label:"ATT",width:"40px",render:(g,_)=>{const y=ar(_);return y>0?t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:y}):t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:"-"})}},{key:"mailer",label:"Mailer",width:"70px",render:g=>{const _=g||"";return t("span",{title:_,style:{color:"var(--ss-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:_})}},{key:"createdAt",label:"Time",width:"80px",render:(g,_)=>{const y=Ae(_);return t(ie,{ts:y,className:"ss-dash-event-time",style:{whiteSpace:"nowrap"}})}}],data:p,onRowClick:v,rowClassName:"ss-dash-email-row",emptyMessage:"No emails captured yet"})}),c&&t(de,{page:c.page,lastPage:c.lastPage,total:c.total,onPageChange:n})]})]})}const da=Object.freeze(Object.defineProperty({__proto__:null,EmailsSection:ws,default:ws},Symbol.toStringTag,{value:"Module"}));function ha({hitRate:e,hits:s,misses:n,keys:r}){return t("div",{className:"ss-cache-stats",children:[t("div",{className:"ss-cache-stat",children:[t("span",{className:"ss-cache-stat-label",children:"Hit Rate:"}),t("span",{className:"ss-cache-stat-value",children:[e.toFixed(1),"%"]})]}),t("div",{className:"ss-cache-stat",children:[t("span",{className:"ss-cache-stat-label",children:"Hits:"}),t("span",{className:"ss-cache-stat-value",children:s})]}),t("div",{className:"ss-cache-stat",children:[t("span",{className:"ss-cache-stat-label",children:"Misses:"}),t("span",{className:"ss-cache-stat-value",children:n})]}),t("div",{className:"ss-cache-stat",children:[t("span",{className:"ss-cache-stat-label",children:"Keys:"}),t("span",{className:"ss-cache-stat-value",children:r})]})]})}function xs({options:e={}}){const[s,n]=k(""),[r,l]=k(null),[a,i]=k(null),[o,d]=k(!1),[h,u]=k(null),c=O(null),{data:m,isLoading:p,mutate:v,getApi:g}=J("cache",{...e,search:s}),_=m,y=L(async f=>{if(confirm(`Delete cache key "${f}"?`))try{await v(`cache/${encodeURIComponent(f)}`,"delete"),r===f&&(l(null),i(null),u(null))}catch{}},[v,r]),S=L(async f=>{if(c.current?.abort(),r===f){c.current=null,l(null),i(null),u(null);return}l(f),i(null),u(null),d(!0);const x=new AbortController;c.current=x;try{const b=await g().fetchCacheKey(f,{signal:x.signal});if(c.current!==x)return;i(b.value!==void 0?b.value:b.data!==void 0?b.data:b),u(null)}catch(w){if(w instanceof Error&&w.name==="AbortError"||c.current!==x)return;i(null),u("Failed to fetch key value")}finally{c.current===x&&d(!1)}},[r,g]);return U(()=>()=>c.current?.abort(),[]),t("div",{children:[_?.available&&_?.stats&&t(ha,{hitRate:_.stats.hitRate??0,hits:_.stats.hits??0,misses:_.stats.misses??0,keys:_.stats.totalKeys||_.stats.keyCount||_.keys?.length||0}),t(ee,{search:s,onSearchChange:n,placeholder:"Filter cache keys...",summary:`${(_?.keys||_?.data||[]).length} keys`}),p&&!m?t("div",{className:"ss-dash-empty",children:"Loading cache..."}):!_||!_.available?t("div",{className:"ss-dash-empty",children:"Cache inspector not available"}):t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"key",label:"Key",render:f=>t("span",{title:f,style:{color:"var(--ss-sql-color)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:f})},{key:"type",label:"Type",width:"70px",render:f=>t("span",{style:{color:"var(--ss-muted)"},children:f})},{key:"size",label:"Size",width:"60px",render:f=>f!=null&&f>0?pr(f):"-"},{key:"ttl",label:"TTL",width:"70px",render:f=>f>0?ur(f):"-"},{key:"_actions",label:"",width:"60px",render:(f,x)=>t("button",{type:"button",className:"ss-dash-retry-btn",onClick:w=>{w.stopPropagation(),y(x.key)},children:"Delete"})}],data:_.keys||_.data||[],keyField:"key",onRowClick:f=>S(f.key),emptyMessage:"No cache keys found"})}),r&&t("div",{className:"ss-dash-cache-detail",children:[t("h4",{children:["Key: ",r]}),o?t("div",{className:"ss-dash-empty",children:"Loading value..."}):h?t("div",{className:"ss-dash-empty",style:{color:"var(--ss-red-fg)"},children:h}):t(Re,{data:a})]})]})}const ua=Object.freeze(Object.defineProperty({__proto__:null,CacheSection:xs,default:xs},Symbol.toStringTag,{value:"Module"})),pa=["all","active","waiting","delayed","completed","failed"];function fa(e){switch(e){case"active":return"blue";case"waiting":return"amber";case"delayed":return"purple";case"completed":return"green";case"failed":return"red";default:return"muted"}}function ma(e){if(!e)return[];if(Array.isArray(e))return e;const s=e;return s.jobs||s.data||[]}function va(e){if(!e||Array.isArray(e))return null;const s=e;return s.stats||s.overview||null}function ga({stats:e,classPrefix:s="ss"}){if(!e)return null;const n=s;return t("div",{className:`${n}-job-stats`,children:[t("div",{className:`${n}-job-stat`,children:[t("span",{className:`${n}-job-stat-label`,children:"Active:"}),t("span",{className:`${n}-job-stat-value`,children:e.active??0})]}),t("div",{className:`${n}-job-stat`,children:[t("span",{className:`${n}-job-stat-label`,children:"Waiting:"}),t("span",{className:`${n}-job-stat-value`,children:e.waiting??0})]}),t("div",{className:`${n}-job-stat`,children:[t("span",{className:`${n}-job-stat-label`,children:"Delayed:"}),t("span",{className:`${n}-job-stat-value`,children:e.delayed??0})]}),t("div",{className:`${n}-job-stat`,children:[t("span",{className:`${n}-job-stat-label`,children:"Completed:"}),t("span",{className:`${n}-job-stat-value`,children:e.completed??0})]}),t("div",{className:`${n}-job-stat`,children:[t("span",{className:`${n}-job-stat-label`,children:"Failed:"}),t("span",{className:`${n}-job-stat-value ${n}-c-red`,children:e.failed??0})]})]})}function Ns({options:e={}}){const[s,n]=k(1),[r,l]=k(""),[a,i]=k("all"),[o,d]=k({}),h={};a!=="all"&&(h.status=a);const{data:u,meta:c,isLoading:m,error:p,refresh:v,mutate:g}=J("jobs",{...e,page:s,search:r,filters:h}),_=ma(u),y=va(u),S=L(async f=>{d(x=>({...x,[f]:"pending"}));try{await g(`jobs/${f}/retry`),d(x=>({...x,[f]:"success"})),setTimeout(()=>{d(x=>{const w={...x};return delete w[f],w}),v()},1e3)}catch{d(x=>{const w={...x};return delete w[f],w})}},[g,v]);return t("div",{children:[t(ga,{stats:y,classPrefix:"ss-dash"}),t(ee,{search:r,onSearchChange:l,placeholder:"Filter jobs...",summary:`${c?.total??_.length} jobs`,children:t("div",{className:"ss-dash-btn-group",children:pa.map(f=>t("button",{type:"button",className:`ss-dash-btn ${a===f?"ss-dash-active":""}`,onClick:()=>{i(f),n(1)},children:f.charAt(0).toUpperCase()+f.slice(1)},f))})}),m&&!u?t("div",{className:"ss-dash-empty",children:"Loading jobs..."}):p?t("div",{className:"ss-dash-empty",children:"Jobs/Queue not available"}):t(M,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"ID",width:"40px",render:f=>t("span",{style:{color:"var(--ss-dim)"},children:f})},{key:"name",label:"Name",render:f=>t("span",{style:{color:"var(--ss-text)"},title:f,children:f})},{key:"status",label:"Status",width:"90px",render:f=>t(Tr,{color:fa(f),children:f})},{key:"payload",label:"Payload",render:(f,x)=>t(Re,{data:f||x?.data,maxPreviewLength:60})},{key:"attempts",label:"Tries",width:"50px",render:(f,x)=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:f||x.attemptsMade||0})},{key:"duration",label:"Duration",width:"75px",render:f=>t("span",{className:"ss-dash-duration",children:f!==null?te(f):"-"})},{key:"timestamp",label:"Time",width:"70px",render:(f,x)=>{const w=f||Xn(x);return t(ie,{ts:w,className:"ss-dash-event-time",style:{whiteSpace:"nowrap"}})}},{key:"_actions",label:"",width:"50px",render:(f,x)=>{const w=x.id,b=o[w];return x.status!=="failed"?null:t("button",{type:"button",className:"ss-dash-retry-btn",disabled:b==="pending"||b==="success",onClick:E=>{E.stopPropagation(),S(w)},children:b==="pending"?"...":b==="success"?"OK":"Retry"})}}],data:_,emptyMessage:"No jobs found"})}),c&&t(de,{page:c.page,lastPage:c.lastPage,total:c.total,onPageChange:n})]})]})}const _a=Object.freeze(Object.defineProperty({__proto__:null,JobsSection:Ns,default:Ns},Symbol.toStringTag,{value:"Module"}));function Y(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.__redacted===!0}function Me(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)&&!Y(e)}function tt(e,s=""){if(!Me(e))return[{path:s,value:e}];const n=[];for(const r of Object.keys(e)){const l=s?`${s}.${r}`:r,a=e[r];Me(a)?n.push(...tt(a,l)):n.push({path:l,value:a})}return n}function st(e){return e==null?{text:"null",color:"var(--ss-dim)"}:typeof e=="boolean"?{text:String(e),color:e?"var(--ss-green-fg)":"var(--ss-red-fg)"}:typeof e=="number"?{text:String(e),color:"var(--ss-amber-fg)"}:Array.isArray(e)?{text:`[${e.map(n=>n==null?"null":typeof n=="object"?JSON.stringify(n):String(n)).join(", ")}]`,color:"var(--ss-purple-fg)"}:typeof e=="object"?{text:JSON.stringify(e),color:"var(--ss-dim)"}:{text:String(e)}}function ks(e){if(e==null||typeof e!="object"||Array.isArray(e)||Y(e))return 1;let s=0;for(const n of Object.keys(e))s+=ks(e[n]);return s}function ya(e){if(!Me(e))return[];const s=[];for(const n of Object.keys(e))Me(e[n])&&s.push(n);return s}function Fe(e,s,n){s&&navigator.clipboard.writeText(e).then(()=>{const r=s.textContent;s.textContent="✓",s.classList.add(`${n}-copy-row-ok`),setTimeout(()=>{s.textContent=r,s.classList.remove(`${n}-copy-row-ok`)},1200)}).catch(()=>{})}function qe({redacted:e,p:s}){return t("span",{className:`${s}-config-redacted`,style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:t("span",{children:e.display})})}function ba({env:e,search:s,p:n}){const r=O(new Map),l=s.toLowerCase(),a=Object.entries(e).filter(([i,o])=>{if(!l)return!0;const d=Y(o)?o.display:o==null?"":String(o);return i.toLowerCase().includes(l)||d.toLowerCase().includes(l)});return t("div",{className:`${n}-config-table-wrap`,children:t("table",{className:`${n}-table ${n}-config-env-table`,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Variable"}),t("th",{children:"Value"}),t("th",{style:{width:36}})]})}),t("tbody",{children:[a.map(([i,o])=>{const d=Y(o),h=d?o.display:o==null?"null":String(o),u=`${i}=${h}`;return t("tr",{children:[t("td",{className:`${n}-env-key`,children:t("span",{className:`${n}-config-key`,children:i})}),t("td",{className:`${n}-env-val`,children:d?t(qe,{redacted:o,p:n}):t("span",{className:`${n}-config-val`,children:h})}),t("td",{children:!d&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:c=>{r.current.set(i,c)},onClick:c=>{c.stopPropagation(),Fe(u,r.current.get(i)??null,n)},children:"⎘"})})]},i)}),a.length===0&&t("tr",{children:t("td",{colSpan:3,style:{textAlign:"center",color:"var(--ss-dim)"},children:"No matching variables"})})]})]})})}function wa({source:e,search:s,p:n}){const r=O(new Map),l=s.toLowerCase(),a=tt(e,""),i=a.filter(o=>{const d=Y(o.value)?o.value.display:o.value===null||o.value===void 0?"":String(o.value);return o.path.toLowerCase().includes(l)||d.toLowerCase().includes(l)});return t("div",{className:`${n}-config-table-wrap`,children:[t("table",{className:`${n}-table`,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Path"}),t("th",{children:"Value"}),t("th",{style:{width:36}})]})}),t("tbody",{children:[i.map(o=>{const d=Y(o.value),h=d?null:st(o.value),u=d?o.value.display:h.text,c=`${o.path}: ${u}`;return t("tr",{children:[t("td",{children:t("span",{className:`${n}-config-key`,style:{whiteSpace:"nowrap"},children:o.path})}),t("td",{children:d?t(qe,{redacted:o.value,p:n}):t("span",{className:`${n}-config-val`,style:{wordBreak:"break-all",color:h.color},children:h.text})}),t("td",{children:!d&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:m=>{r.current.set(o.path,m)},onClick:m=>{m.stopPropagation(),Fe(c,r.current.get(o.path)??null,n)},children:"⎘"})})]},o.path)}),i.length===0&&t("tr",{children:t("td",{colSpan:3,style:{textAlign:"center",color:"var(--ss-dim)"},children:"No matching entries"})})]})]}),t("div",{style:{padding:"4px 16px",fontSize:"10px",color:"var(--ss-muted)"},children:[i.length," of ",a.length," entries"]})]})}function xa({obj:e,prefix:s,p:n}){const r=O(new Map),l=tt(e,s);return t("table",{className:`${n}-table ${n}-config-inner-table`,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"35%"},children:"Key"}),t("th",{children:"Value"}),t("th",{style:{width:36}})]})}),t("tbody",{children:l.map(a=>{const i=a.path.indexOf(s+".")===0?a.path.slice(s.length+1):a.path,o=Y(a.value),d=o?null:st(a.value),h=o?a.value.display:d.text,u=`${a.path}: ${h}`;return t("tr",{children:[t("td",{title:i,children:t("span",{className:`${n}-config-key`,children:i})}),t("td",{title:h,children:o?t(qe,{redacted:a.value,p:n}):t("span",{className:`${n}-config-val`,style:{color:d.color},children:d.text})}),t("td",{children:!o&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:c=>{r.current.set(a.path,c)},onClick:c=>{c.stopPropagation(),Fe(u,r.current.get(a.path)??null,n)},children:"⎘"})})]},a.path)})})]})}function Na({value:e,p:s}){if(e==null)return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-dim)"},children:"null"});if(Y(e))return t(qe,{redacted:e,p:s});if(typeof e=="boolean")return t("span",{className:`${s}-config-val`,style:{color:e?"var(--ss-green-fg)":"var(--ss-red-fg)"},children:String(e)});if(typeof e=="number")return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-amber-fg)"},children:String(e)});if(Array.isArray(e)){const n=e.map(r=>r==null?"null":typeof r=="object"?JSON.stringify(r):String(r));return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-purple-fg)"},children:["[",n.join(", "),"]"]})}return typeof e=="object"?t("span",{className:`${s}-config-val`,style:{color:"var(--ss-dim)"},children:JSON.stringify(e)}):t("span",{className:`${s}-config-val`,children:String(e)})}function ka({obj:e,expandedPaths:s,onToggle:n,p:r}){if(e==null||typeof e!="object"||Array.isArray(e)||Y(e))return null;const l=Object.keys(e),a=O(new Map);return t("div",{className:`${r}-config-sections`,children:l.map(i=>{const o=e[i],d=o!==null&&typeof o=="object"&&!Array.isArray(o)&&!Y(o),h=s.has(i),u=Y(o);return t("div",{className:`${r}-config-section`,children:[t("div",{className:`${r}-config-section-header${d?"":` ${r}-config-leaf`}`,onClick:d?()=>n(i):void 0,style:{cursor:d?"pointer":"default"},children:[d?t("span",{className:`${r}-config-toggle`,children:h?"▼":"▶"}):t("span",{className:`${r}-config-toggle`,style:{visibility:"hidden"},children:"•"}),t("span",{className:`${r}-config-key`,children:i}),d?t("span",{className:`${r}-config-count`,children:[ks(o)," entries"]}):t(M,{children:[t("span",{className:`${r}-config-val`,style:{marginLeft:"8px"},children:t(Na,{value:o,p:r})}),!u&&t("button",{type:"button",className:`${r}-copy-row-btn`,style:{marginLeft:"4px"},title:"Copy",ref:c=>{a.current.set(i,c)},onClick:c=>{c.stopPropagation();const m=st(o);Fe(`${i}: ${m.text}`,a.current.get(i)??null,r)},children:"⎘"})]})]}),d&&h&&t("div",{className:`${r}-config-section-body`,children:t(xa,{obj:o,prefix:i,p:r})})]},i)})})}function Sa({data:e,isLoading:s,classPrefix:n}){const r=n,[l,a]=k(""),[i,o]=k(""),[d,h]=k("app"),[u,c]=k(new Set),[m,p]=k("Copy JSON");U(()=>{const f=setTimeout(()=>o(l),200);return()=>clearTimeout(f)},[l]);const v=e,g=L(f=>{c(x=>{const w=new Set(x);return w.has(f)?w.delete(f):w.add(f),w})},[]),_=L(()=>{if(!v)return;const f=d==="app"?v.app:v.env;if(!f)return;const x=ya(f);c(new Set(x))},[v,d]),y=L(()=>{c(new Set)},[]),S=L(async()=>{if(v)try{const f=d==="app"?v.app:v.env;await navigator.clipboard.writeText(JSON.stringify(f,null,2)),p("Copied!"),setTimeout(()=>p("Copy JSON"),1500)}catch{}},[v,d]);return t("div",{children:[t("div",{className:`${r}-config-toolbar`,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px"},children:[t("button",{type:"button",className:`${r}-config-tab${d==="app"?` ${r}-active`:""}`,onClick:()=>h("app"),children:"App Config"}),t("button",{type:"button",className:`${r}-config-tab${d==="env"?` ${r}-active`:""}`,onClick:()=>h("env"),children:"Env"}),t("div",{style:{position:"relative",flex:1},children:[t("input",{type:"text",className:`${r}-search`,placeholder:"Search keys and values...",value:l,onChange:f=>a(f.target.value),style:{width:"100%"}}),l&&t("button",{type:"button",onClick:()=>a(""),style:{position:"absolute",right:"6px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"14px",color:"var(--ss-dim)",padding:"0 2px",lineHeight:1},children:"×"})]}),d==="app"&&!i&&t(M,{children:[t("button",{type:"button",className:`${r}-btn`,onClick:_,children:"Expand All"}),t("button",{type:"button",className:`${r}-btn`,onClick:y,children:"Collapse All"})]}),t("button",{type:"button",className:`${r}-btn`,onClick:S,children:m})]}),s&&!e?t("div",{className:`${r}-empty`,children:"Loading config..."}):v?d==="env"?t(ba,{env:v.env??{},search:i,p:r}):i?t(wa,{source:v.app??{},search:i,p:r}):t("div",{className:`${r}-config-table-wrap`,children:t(ka,{obj:v.app,expandedPaths:u,onToggle:g,p:r})}):t("div",{className:`${r}-empty`,children:"Config not available"})]})}function Ss({options:e={}}){const{data:s,isLoading:n}=J("config",e);return t(Sa,{data:s,isLoading:n,classPrefix:"ss-dash"})}const $a=Object.freeze(Object.defineProperty({__proto__:null,ConfigSection:Ss,default:Ss},Symbol.toStringTag,{value:"Module"}));function Ca(e={}){const{baseUrl:s="",debugEndpoint:n="/admin/api/debug",authToken:r,refreshInterval:l=3e3}=e,[a,i]=k(null),[o,d]=k(!0),[h,u]=k(null),c=O(null),m=as(s,r),p=L(async()=>{try{const g=await m().get(`${n}/diagnostics`);i(g),u(null),d(!1)}catch(v){if(v instanceof Qe){u(v),d(!1),c.current&&(clearInterval(c.current),c.current=null);return}u(v instanceof Error?v:new Error(String(v))),d(!1)}},[n,m]);return U(()=>(d(!0),u(null),p(),c.current=setInterval(p,l),()=>{c.current&&(clearInterval(c.current),c.current=null)}),[p,l]),{data:a,isLoading:o,error:h}}const Ea=["password","secret","token","key","credential","auth"];function $s(e){const s=e.toLowerCase();return Ea.some(n=>s.includes(n))}function Cs(e){if(e==null)return"-";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.join(", ")||"-";try{return JSON.stringify(e)}catch{return String(e)}}const Ta={collectionInterval:"Stats Collection",dashboardBroadcast:"Dashboard Broadcast",debugBroadcast:"Debug Broadcast",persistFlush:"Persist Flush",retentionCleanup:"Retention Cleanup"};function La(e){return Ta[e]||e}const Aa={prometheus:"Prometheus",pinoHook:"Pino Log Hook",edgePlugin:"Edge Plugin",cacheInspector:"Cache Inspector",queueInspector:"Queue Inspector"};function Pa(e){return Aa[e]||e}const Da=["healthy","active","connected","available","ready"],Ra=["errored","unavailable"];function Ma(e){return Da.includes(e)?"ok":Ra.includes(e)?"err":""}function me({status:e,prefix:s}){const n=Ma(e);let r=`${s}-dot`;return n==="ok"?r+=` ${s}-dot-ok`:n==="err"&&(r+=` ${s}-dot-err`),t("span",{className:r})}const Es=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:H.eye.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:H.eye.elements.join("")}}),Ts=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:H["eye-off"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:H["eye-off"].elements.join("")}});function Fa({value:e}){const[s,n]=k(!1);return t("span",{children:[s?e:"••••••••"," ",t("button",{type:"button",onClick:()=>n(r=>!r),style:{background:"none",border:"1px solid var(--ss-border)",borderRadius:3,padding:"0 4px",fontSize:"10px",color:"var(--ss-dim)",cursor:"pointer",verticalAlign:"middle"},children:s?t(Ts,{}):t(Es,{})})]})}function qa({current:e,max:s,prefix:n}){const r=s>0?Math.min(100,Math.round(e/s*100)):0,l=r>=100;return t("div",{className:`${n}-bar`,children:[t("div",{className:`${n}-bar-track`,children:t("div",{className:`${n}-bar-fill${l?` ${n}-bar-fill-warn`:""}`,style:{width:`${r}%`}})}),t("span",{className:`${n}-bar-pct${l?` ${n}-bar-pct-warn`:""}`,children:[r,"%"]})]})}function Oa({config:e,prefix:s}){const n=Object.entries(e);return n.length===0?t("span",{className:`${s}-c-dim`,children:"-"}):t("span",{className:`${s}-c-muted`,children:n.map(([r,l],a)=>t("span",{children:[a>0&&", ",t("span",{className:`${s}-c-dim`,children:r}),"=",$s(r)&&typeof l=="string"?t(Fa,{value:l}):t("span",{children:Cs(l)})]},r))})}function ve({label:e,value:s,prefix:n}){return t("div",{className:`${n}-info-card`,children:[t("span",{className:`${n}-info-card-label`,children:e}),t("span",{className:`${n}-info-card-value`,children:s})]})}function Ia({data:e,tableClassName:s,classPrefix:n}){const r=n||"ss-dash",[l,a]=k(new Set),i=L(u=>{a(c=>{const m=new Set(c);return m.has(u)?m.delete(u):m.add(u),m})},[]),o=L((u,c)=>{if(c==null)return t("span",{className:`${r}-c-dim`,children:"null"});if(typeof c=="boolean")return t("span",{className:c?`${r}-c-green`:`${r}-c-red`,children:String(c)});if(Array.isArray(c))return t("span",{children:c.join(", ")||"-"});const m=Cs(c);if($s(u)){const p=l.has(u);return t("span",{children:[p?m:"••••••••"," ",t("button",{type:"button",onClick:()=>i(u),style:{background:"none",border:"1px solid var(--ss-border)",borderRadius:3,padding:"0 4px",fontSize:"10px",color:"var(--ss-dim)",cursor:"pointer",verticalAlign:"middle"},children:p?t(Ts,{}):t(Es,{})})]})}return t("span",{children:m})},[l,i,r]),h=e.collectors?.some(u=>u.name==="db_pool"||u.name==="app")&&Array.isArray(e.lucidDebugConnections)&&e.lucidDebugConnections.length===0;return t("div",{children:[h&&t("div",{style:{background:"var(--ss-amber-bg)",color:"var(--ss-amber-fg)",padding:"8px 12px",borderRadius:"6px",fontSize:"12px",marginBottom:"12px",lineHeight:1.5},children:[t("strong",{children:"Query capture disabled"})," — no Lucid connections have"," ",t("code",{style:{fontSize:"11px"},children:"debug: true"}),". Add it to your database connection in ",t("code",{style:{fontSize:"11px"},children:"config/database.ts"})," to see queries in the Queries panel."]}),t("h3",{className:`${r}-internals-title`,children:"Package Info"}),t("div",{className:`${r}-info-cards`,children:[t(ve,{label:"Version",value:e.package.version||"-",prefix:r}),t(ve,{label:"Node.js",value:e.package.nodeVersion||"-",prefix:r}),t(ve,{label:"AdonisJS",value:e.package.adonisVersion||"-",prefix:r}),t(ve,{label:"Uptime",value:cr(e.package.uptime),prefix:r}),t(ve,{label:"Renderer",value:e.devToolbar?.renderer||"preact",prefix:r})]}),e.collectors.length>0&&t(M,{children:[t("h3",{className:`${r}-internals-title`,children:"Collectors"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Collector"}),t("th",{children:"Status"}),t("th",{children:"Last Error"}),t("th",{children:"Config"})]})}),t("tbody",{children:e.collectors.map(u=>t("tr",{children:[t("td",{children:[t("code",{children:u.name}),u.label&&u.label!==u.name&&t("span",{className:`${r}-c-dim`,children:[" ",u.label]})]}),t("td",{children:[t(me,{status:u.status,prefix:r}),u.status]}),t("td",{className:u.lastError?`${r}-c-red`:`${r}-c-dim`,children:u.lastError?t(M,{children:[u.lastError,u.lastErrorAt&&t("span",{className:`${r}-c-dim`,style:{fontSize:"10px"},children:Ye(u.lastErrorAt)})]}):"-"}),t("td",{children:t(Oa,{config:u.config,prefix:r})})]},u.name))})]})]}),t("h3",{className:`${r}-internals-title`,children:"Buffers"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Buffer"}),t("th",{children:"Usage"}),t("th",{children:"Fill %"})]})}),t("tbody",{children:Object.entries(e.buffers).map(([u,c])=>t("tr",{children:[t("td",{style:{textTransform:"capitalize"},children:u}),t("td",{children:[c.current.toLocaleString()," / ",c.max.toLocaleString()]}),t("td",{children:t(qa,{current:c.current,max:c.max,prefix:r})})]},u))})]}),t("h3",{className:`${r}-internals-title`,children:"Timers"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Timer"}),t("th",{children:"Status"}),t("th",{children:"Interval"})]})}),t("tbody",{children:Object.entries(e.timers).map(([u,c])=>t("tr",{children:[t("td",{children:La(u)}),t("td",{children:[t(me,{status:c.active?"active":"inactive",prefix:r}),t("span",{className:c.active?`${r}-c-green`:`${r}-c-dim`,children:c.active?"active":"inactive"})]}),t("td",{children:c.active?c.intervalMs?te(c.intervalMs):c.debounceMs?`${te(c.debounceMs)} (debounce)`:"-":t("span",{className:`${r}-c-dim`,children:"—"})})]},u))})]}),t("h3",{className:`${r}-internals-title`,children:"Integrations"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Integration"}),t("th",{children:"Status"}),t("th",{children:"Details"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"Transmit (SSE)"}),t("td",{children:[t(me,{status:e.transmit.available?"connected":"inactive",prefix:r}),e.transmit.available?"connected":"unavailable"]}),t("td",{style:{fontSize:"11px"},children:e.transmit.channels.length>0?`Channels: ${e.transmit.channels.join(", ")}`:"-"})]}),Object.entries(e.integrations).map(([u,c])=>{const m=c.active??c.available??!1,p=c.active?"active":c.available?"available":"unavailable";let v=c.mode?`Mode: ${c.mode}`:"-";return u==="edgePlugin"&&c.active?v="@serverStats() tag registered":u==="cacheInspector"&&c.available?v="Redis dependency detected":u==="queueInspector"&&c.available&&(v="Queue dependency detected"),t("tr",{children:[t("td",{children:Pa(u)}),t("td",{children:[t(me,{status:m?"active":"inactive",prefix:r}),p]}),t("td",{className:`${r}-c-dim`,style:{fontSize:"11px"},children:v})]},u)})]})]}),e.storage&&t(M,{children:[t("h3",{className:`${r}-internals-title`,children:"Storage (SQLite)"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"200px"},children:"Metric"}),t("th",{children:"Value"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"Status"}),t("td",{children:[t(me,{status:e.storage.ready?"ready":"inactive",prefix:r}),e.storage.ready?"ready":"not ready"]})]}),t("tr",{children:[t("td",{children:"DB Path"}),t("td",{children:t("code",{children:e.storage.dbPath})})]}),t("tr",{children:[t("td",{children:"File Size"}),t("td",{children:[e.storage.fileSizeMb.toFixed(1)," MB"]})]}),t("tr",{children:[t("td",{children:"WAL Size"}),t("td",{children:[e.storage.walSizeMb.toFixed(1)," MB"]})]}),t("tr",{children:[t("td",{children:"Retention"}),t("td",{children:[e.storage.retentionDays," days"]})]}),t("tr",{children:[t("td",{children:"Last Cleanup"}),t("td",{children:e.storage.lastCleanupAt?Ye(e.storage.lastCleanupAt):"-"})]})]})]}),e.storage.tables.length>0&&t("table",{className:s,style:{marginTop:8},children:[t("thead",{children:t("tr",{children:[t("th",{children:"Table"}),t("th",{children:"Rows"})]})}),t("tbody",{children:e.storage.tables.map(u=>t("tr",{children:[t("td",{children:t("code",{children:u.name})}),t("td",{children:u.rowCount.toLocaleString()})]},u.name))})]})]}),t("h3",{className:`${r}-internals-title`,children:"Resolved Config"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"200px"},children:"Setting"}),t("th",{children:"Value"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"intervalMs"}),t("td",{children:e.config.intervalMs})]}),t("tr",{children:[t("td",{children:"transport"}),t("td",{children:e.config.transport})]}),t("tr",{children:[t("td",{children:"channelName"}),t("td",{children:e.config.channelName})]}),t("tr",{children:[t("td",{children:"endpoint"}),t("td",{children:e.config.endpoint===!1?"false":e.config.endpoint})]}),t("tr",{children:[t("td",{children:"skipInTest"}),t("td",{children:o("skipInTest",e.config.skipInTest)})]}),t("tr",{children:[t("td",{children:"onStats callback"}),t("td",{children:e.config.hasOnStatsCallback?"defined":"not defined"})]}),t("tr",{children:[t("td",{children:"shouldShow callback"}),t("td",{children:e.config.hasShouldShowCallback?"defined":"not defined"})]})]})]}),t("h4",{className:`${r}-internals-title`,children:"DevToolbar"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"200px"},children:"Setting"}),t("th",{children:"Value"})]})}),t("tbody",{children:Object.entries(e.devToolbar).map(([u,c])=>t("tr",{children:[t("td",{children:u==="customPaneCount"?"customPanes":u}),t("td",{children:u==="customPaneCount"?`${c} registered`:o(u,c)})]},u))})]})]})}function Ls({options:e={},debugEndpoint:s="/admin/api/debug"}){const{data:n,isLoading:r,error:l}=Ca({baseUrl:e.baseUrl,debugEndpoint:s,authToken:e.authToken,refreshInterval:Ht});return r&&!n?t("div",{className:"ss-dash-empty",children:"Loading diagnostics..."}):l?t("div",{className:"ss-dash-empty",children:["Error: ",l.message]}):n?t(Ia,{data:n,tableClassName:"ss-dash-table",classPrefix:"ss-dash"}):t("div",{className:"ss-dash-empty",children:"Diagnostics not available"})}const ja=Object.freeze(Object.defineProperty({__proto__:null,InternalsSection:Ls,default:Ls},Symbol.toStringTag,{value:"Module"}))})();
1
+ (function(){"use strict";var _e,P,at,ne,it,lt,ot,ct,Oe,Ie,je,dt,ye={},be=[],Ms=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,he=Array.isArray;function Z(e,s){for(var n in s)e[n]=s[n];return e}function Be(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function we(e,s,n){var r,l,a,i={};for(a in s)a=="key"?r=s[a]:a=="ref"?l=s[a]:i[a]=s[a];if(arguments.length>2&&(i.children=arguments.length>3?_e.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)i[a]===void 0&&(i[a]=e.defaultProps[a]);return xe(e,i,r,l,null)}function xe(e,s,n,r,l){var a={type:e,props:s,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:l??++at,__i:-1,__u:0};return l==null&&P.vnode!=null&&P.vnode(a),a}function R(e){return e.children}function X(e,s){this.props=e,this.context=s}function oe(e,s){if(s==null)return e.__?oe(e.__,e.__i+1):null;for(var n;s<e.__k.length;s++)if((n=e.__k[s])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?oe(e):null}function Rs(e){if(e.__P&&e.__d){var s=e.__v,n=s.__e,r=[],l=[],a=Z({},s);a.__v=s.__v+1,P.vnode&&P.vnode(a),He(e.__P,a,s,e.__n,e.__P.namespaceURI,32&s.__u?[n]:null,r,n??oe(s),!!(32&s.__u),l),a.__v=s.__v,a.__.__k[a.__i]=a,vt(r,a,l),s.__e=s.__=null,a.__e!=n&&ht(a)}}function ht(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(s){if(s!=null&&s.__e!=null)return e.__e=e.__c.base=s.__e}),ht(e)}function Ue(e){(!e.__d&&(e.__d=!0)&&ne.push(e)&&!Ne.__r++||it!=P.debounceRendering)&&((it=P.debounceRendering)||lt)(Ne)}function Ne(){for(var e,s=1;ne.length;)ne.length>s&&ne.sort(ot),e=ne.shift(),s=ne.length,Rs(e);Ne.__r=0}function ut(e,s,n,r,l,a,i,o,d,h,u){var c,m,p,v,g,_,y,S=r&&r.__k||be,f=s.length;for(d=Fs(n,s,S,d,f),c=0;c<f;c++)(p=n.__k[c])!=null&&(m=p.__i!=-1&&S[p.__i]||ye,p.__i=c,_=He(e,p,m,l,a,i,o,d,h,u),v=p.__e,p.ref&&m.ref!=p.ref&&(m.ref&&Ve(m.ref,null,p),u.push(p.ref,p.__c||v,p)),g==null&&v!=null&&(g=v),(y=!!(4&p.__u))||m.__k===p.__k?d=pt(p,d,e,y):typeof p.type=="function"&&_!==void 0?d=_:v&&(d=v.nextSibling),p.__u&=-7);return n.__e=g,d}function Fs(e,s,n,r,l){var a,i,o,d,h,u=n.length,c=u,m=0;for(e.__k=new Array(l),a=0;a<l;a++)(i=s[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[a]=xe(null,i,null,null,null):he(i)?i=e.__k[a]=xe(R,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[a]=xe(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[a]=i,d=a+m,i.__=e,i.__b=e.__b+1,o=null,(h=i.__i=qs(i,n,d,c))!=-1&&(c--,(o=n[h])&&(o.__u|=2)),o==null||o.__v==null?(h==-1&&(l>u?m--:l<u&&m++),typeof i.type!="function"&&(i.__u|=4)):h!=d&&(h==d-1?m--:h==d+1?m++:(h>d?m--:m++,i.__u|=4))):e.__k[a]=null;if(c)for(a=0;a<u;a++)(o=n[a])!=null&&(2&o.__u)==0&&(o.__e==r&&(r=oe(o)),_t(o,o));return r}function pt(e,s,n,r){var l,a;if(typeof e.type=="function"){for(l=e.__k,a=0;l&&a<l.length;a++)l[a]&&(l[a].__=e,s=pt(l[a],s,n,r));return s}e.__e!=s&&(r&&(s&&e.type&&!s.parentNode&&(s=oe(e)),n.insertBefore(e.__e,s||null)),s=e.__e);do s=s&&s.nextSibling;while(s!=null&&s.nodeType==8);return s}function ke(e,s){return s=s||[],e==null||typeof e=="boolean"||(he(e)?e.some(function(n){ke(n,s)}):s.push(e)),s}function qs(e,s,n,r){var l,a,i,o=e.key,d=e.type,h=s[n],u=h!=null&&(2&h.__u)==0;if(h===null&&o==null||u&&o==h.key&&d==h.type)return n;if(r>(u?1:0)){for(l=n-1,a=n+1;l>=0||a<s.length;)if((h=s[i=l>=0?l--:a++])!=null&&(2&h.__u)==0&&o==h.key&&d==h.type)return i}return-1}function ft(e,s,n){s[0]=="-"?e.setProperty(s,n??""):e[s]=n==null?"":typeof n!="number"||Ms.test(s)?n:n+"px"}function Se(e,s,n,r,l){var a,i;e:if(s=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(s in r)n&&s in n||ft(e.style,s,"");if(n)for(s in n)r&&n[s]==r[s]||ft(e.style,s,n[s])}else if(s[0]=="o"&&s[1]=="n")a=s!=(s=s.replace(ct,"$1")),i=s.toLowerCase(),s=i in e||s=="onFocusOut"||s=="onFocusIn"?i.slice(2):s.slice(2),e.l||(e.l={}),e.l[s+a]=n,n?r?n.u=r.u:(n.u=Oe,e.addEventListener(s,a?je:Ie,a)):e.removeEventListener(s,a?je:Ie,a);else{if(l=="http://www.w3.org/2000/svg")s=s.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(s!="width"&&s!="height"&&s!="href"&&s!="list"&&s!="form"&&s!="tabIndex"&&s!="download"&&s!="rowSpan"&&s!="colSpan"&&s!="role"&&s!="popover"&&s in e)try{e[s]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&s[4]!="-"?e.removeAttribute(s):e.setAttribute(s,s=="popover"&&n==1?"":n))}}function mt(e){return function(s){if(this.l){var n=this.l[s.type+e];if(s.t==null)s.t=Oe++;else if(s.t<n.u)return;return n(P.event?P.event(s):s)}}}function He(e,s,n,r,l,a,i,o,d,h){var u,c,m,p,v,g,_,y,S,f,x,w,b,E,N,$=s.type;if(s.constructor!==void 0)return null;128&n.__u&&(d=!!(32&n.__u),a=[o=s.__e=n.__e]),(u=P.__b)&&u(s);e:if(typeof $=="function")try{if(y=s.props,S="prototype"in $&&$.prototype.render,f=(u=$.contextType)&&r[u.__c],x=u?f?f.props.value:u.__:r,n.__c?_=(c=s.__c=n.__c).__=c.__E:(S?s.__c=c=new $(y,x):(s.__c=c=new X(y,x),c.constructor=$,c.render=Is),f&&f.sub(c),c.state||(c.state={}),c.__n=r,m=c.__d=!0,c.__h=[],c._sb=[]),S&&c.__s==null&&(c.__s=c.state),S&&$.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=Z({},c.__s)),Z(c.__s,$.getDerivedStateFromProps(y,c.__s))),p=c.props,v=c.state,c.__v=s,m)S&&$.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),S&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(S&&$.getDerivedStateFromProps==null&&y!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(y,x),s.__v==n.__v||!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(y,c.__s,x)===!1){s.__v!=n.__v&&(c.props=y,c.state=c.__s,c.__d=!1),s.__e=n.__e,s.__k=n.__k,s.__k.some(function(T){T&&(T.__=s)}),be.push.apply(c.__h,c._sb),c._sb=[],c.__h.length&&i.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(y,c.__s,x),S&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,v,g)})}if(c.context=x,c.props=y,c.__P=e,c.__e=!1,w=P.__r,b=0,S)c.state=c.__s,c.__d=!1,w&&w(s),u=c.render(c.props,c.state,c.context),be.push.apply(c.__h,c._sb),c._sb=[];else do c.__d=!1,w&&w(s),u=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++b<25);c.state=c.__s,c.getChildContext!=null&&(r=Z(Z({},r),c.getChildContext())),S&&!m&&c.getSnapshotBeforeUpdate!=null&&(g=c.getSnapshotBeforeUpdate(p,v)),E=u!=null&&u.type===R&&u.key==null?gt(u.props.children):u,o=ut(e,he(E)?E:[E],s,n,r,l,a,i,o,d,h),c.base=s.__e,s.__u&=-161,c.__h.length&&i.push(c),_&&(c.__E=c.__=null)}catch(T){if(s.__v=null,d||a!=null)if(T.then){for(s.__u|=d?160:128;o&&o.nodeType==8&&o.nextSibling;)o=o.nextSibling;a[a.indexOf(o)]=null,s.__e=o}else{for(N=a.length;N--;)Be(a[N]);ze(s)}else s.__e=n.__e,s.__k=n.__k,T.then||ze(s);P.__e(T,s,n)}else a==null&&s.__v==n.__v?(s.__k=n.__k,s.__e=n.__e):o=s.__e=Os(n.__e,s,n,r,l,a,i,d,h);return(u=P.diffed)&&u(s),128&s.__u?void 0:o}function ze(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ze))}function vt(e,s,n){for(var r=0;r<n.length;r++)Ve(n[r],n[++r],n[++r]);P.__c&&P.__c(s,e),e.some(function(l){try{e=l.__h,l.__h=[],e.some(function(a){a.call(l)})}catch(a){P.__e(a,l.__v)}})}function gt(e){return typeof e!="object"||e==null||e.__b>0?e:he(e)?e.map(gt):Z({},e)}function Os(e,s,n,r,l,a,i,o,d){var h,u,c,m,p,v,g,_=n.props||ye,y=s.props,S=s.type;if(S=="svg"?l="http://www.w3.org/2000/svg":S=="math"?l="http://www.w3.org/1998/Math/MathML":l||(l="http://www.w3.org/1999/xhtml"),a!=null){for(h=0;h<a.length;h++)if((p=a[h])&&"setAttribute"in p==!!S&&(S?p.localName==S:p.nodeType==3)){e=p,a[h]=null;break}}if(e==null){if(S==null)return document.createTextNode(y);e=document.createElementNS(l,S,y.is&&y),o&&(P.__m&&P.__m(s,a),o=!1),a=null}if(S==null)_===y||o&&e.data==y||(e.data=y);else{if(a=a&&_e.call(e.childNodes),!o&&a!=null)for(_={},h=0;h<e.attributes.length;h++)_[(p=e.attributes[h]).name]=p.value;for(h in _)p=_[h],h=="dangerouslySetInnerHTML"?c=p:h=="children"||h in y||h=="value"&&"defaultValue"in y||h=="checked"&&"defaultChecked"in y||Se(e,h,null,p,l);for(h in y)p=y[h],h=="children"?m=p:h=="dangerouslySetInnerHTML"?u=p:h=="value"?v=p:h=="checked"?g=p:o&&typeof p!="function"||_[h]===p||Se(e,h,p,_[h],l);if(u)o||c&&(u.__html==c.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),s.__k=[];else if(c&&(e.innerHTML=""),ut(s.type=="template"?e.content:e,he(m)?m:[m],s,n,r,S=="foreignObject"?"http://www.w3.org/1999/xhtml":l,a,i,a?a[0]:n.__k&&oe(n,0),o,d),a!=null)for(h=a.length;h--;)Be(a[h]);o||(h="value",S=="progress"&&v==null?e.removeAttribute("value"):v!=null&&(v!==e[h]||S=="progress"&&!v||S=="option"&&v!=_[h])&&Se(e,h,v,_[h],l),h="checked",g!=null&&g!=e[h]&&Se(e,h,g,_[h],l))}return e}function Ve(e,s,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&s==null||(e.__u=e(s))}else e.current=s}catch(l){P.__e(l,n)}}function _t(e,s,n){var r,l;if(P.unmount&&P.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Ve(r,null,s)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){P.__e(a,s)}r.base=r.__P=null}if(r=e.__k)for(l=0;l<r.length;l++)r[l]&&_t(r[l],s,n||typeof e.type!="function");n||Be(e.__e),e.__c=e.__=e.__e=void 0}function Is(e,s,n){return this.constructor(e,n)}function js(e,s,n){var r,l,a,i;s==document&&(s=document.documentElement),P.__&&P.__(e,s),l=(r=!1)?null:s.__k,a=[],i=[],He(s,e=s.__k=we(R,null,[e]),l||ye,ye,s.namespaceURI,l?null:s.firstChild?_e.call(s.childNodes):null,a,l?l.__e:s.firstChild,r,i),vt(a,e,i)}function Bs(e){function s(n){var r,l;return this.getChildContext||(r=new Set,(l={})[s.__c]=this,this.getChildContext=function(){return l},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(a){this.props.value!=a.value&&r.forEach(function(i){i.__e=!0,Ue(i)})},this.sub=function(a){r.add(a);var i=a.componentWillUnmount;a.componentWillUnmount=function(){r&&r.delete(a),i&&i.call(a)}}),n.children}return s.__c="__cC"+dt++,s.__=e,s.Provider=s.__l=(s.Consumer=function(n,r){return n.children(r)}).contextType=s,s}_e=be.slice,P={__e:function(e,s,n,r){for(var l,a,i;s=s.__;)if((l=s.__c)&&!l.__)try{if((a=l.constructor)&&a.getDerivedStateFromError!=null&&(l.setState(a.getDerivedStateFromError(e)),i=l.__d),l.componentDidCatch!=null&&(l.componentDidCatch(e,r||{}),i=l.__d),i)return l.__E=l}catch(o){e=o}throw e}},at=0,X.prototype.setState=function(e,s){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Z({},this.state),typeof e=="function"&&(e=e(Z({},n),this.props)),e&&Z(n,e),e!=null&&this.__v&&(s&&this._sb.push(s),Ue(this))},X.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ue(this))},X.prototype.render=R,ne=[],lt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ot=function(e,s){return e.__v.__b-s.__v.__b},Ne.__r=0,ct=/(PointerCapture)$|Capture$/i,Oe=0,Ie=mt(!1),je=mt(!0),dt=0;var Us=0;function t(e,s,n,r,l,a){s||(s={});var i,o,d=s;if("ref"in d)for(o in d={},s)o=="ref"?i=s[o]:d[o]=s[o];var h={type:e,props:d,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Us,__i:-1,__u:0,__source:l,__self:a};if(typeof e=="function"&&(i=e.defaultProps))for(o in i)d[o]===void 0&&(d[o]=i[o]);return P.vnode&&P.vnode(h),h}var re,F,We,yt,ue=0,bt=[],B=P,wt=B.__b,xt=B.__r,Nt=B.diffed,kt=B.__c,St=B.unmount,$t=B.__;function pe(e,s){B.__h&&B.__h(F,e,ue||s),ue=0;var n=F.__H||(F.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function k(e){return ue=1,Hs(Tt,e)}function Hs(e,s,n){var r=pe(re++,2);if(r.t=e,!r.__c&&(r.__=[n?n(s):Tt(void 0,s),function(o){var d=r.__N?r.__N[0]:r.__[0],h=r.t(d,o);d!==h&&(r.__N=[h,r.__[1]],r.__c.setState({}))}],r.__c=F,!F.__f)){var l=function(o,d,h){if(!r.__c.__H)return!0;var u=r.__c.__H.__.filter(function(m){return m.__c});if(u.every(function(m){return!m.__N}))return!a||a.call(this,o,d,h);var c=r.__c.props!==o;return u.some(function(m){if(m.__N){var p=m.__[0];m.__=m.__N,m.__N=void 0,p!==m.__[0]&&(c=!0)}}),a&&a.call(this,o,d,h)||c};F.__f=!0;var a=F.shouldComponentUpdate,i=F.componentWillUpdate;F.componentWillUpdate=function(o,d,h){if(this.__e){var u=a;a=void 0,l(o,d,h),a=u}i&&i.call(this,o,d,h)},F.shouldComponentUpdate=l}return r.__N||r.__}function U(e,s){var n=pe(re++,3);!B.__s&&Et(n.__H,s)&&(n.__=e,n.u=s,F.__H.__h.push(n))}function O(e){return ue=5,z(function(){return{current:e}},[])}function z(e,s){var n=pe(re++,7);return Et(n.__H,s)&&(n.__=e(),n.__H=s,n.__h=e),n.__}function L(e,s){return ue=8,z(function(){return e},s)}function zs(e){var s=F.context[e.__c],n=pe(re++,9);return n.c=e,s?(n.__==null&&(n.__=!0,s.sub(F)),s.props.value):e.__}function Vs(){var e=pe(re++,11);if(!e.__){for(var s=F.__v;s!==null&&!s.__m&&s.__!==null;)s=s.__;var n=s.__m||(s.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Ws(){for(var e;e=bt.shift();){var s=e.__H;if(e.__P&&s)try{s.__h.some($e),s.__h.some(Ke),s.__h=[]}catch(n){s.__h=[],B.__e(n,e.__v)}}}B.__b=function(e){F=null,wt&&wt(e)},B.__=function(e,s){e&&s.__k&&s.__k.__m&&(e.__m=s.__k.__m),$t&&$t(e,s)},B.__r=function(e){xt&&xt(e),re=0;var s=(F=e.__c).__H;s&&(We===F?(s.__h=[],F.__h=[],s.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(s.__h.some($e),s.__h.some(Ke),s.__h=[],re=0)),We=F},B.diffed=function(e){Nt&&Nt(e);var s=e.__c;s&&s.__H&&(s.__H.__h.length&&(bt.push(s)!==1&&yt===B.requestAnimationFrame||((yt=B.requestAnimationFrame)||Ks)(Ws)),s.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),We=F=null},B.__c=function(e,s){s.some(function(n){try{n.__h.some($e),n.__h=n.__h.filter(function(r){return!r.__||Ke(r)})}catch(r){s.some(function(l){l.__h&&(l.__h=[])}),s=[],B.__e(r,n.__v)}}),kt&&kt(e,s)},B.unmount=function(e){St&&St(e);var s,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{$e(r)}catch(l){s=l}}),n.__H=void 0,s&&B.__e(s,n.__v))};var Ct=typeof requestAnimationFrame=="function";function Ks(e){var s,n=function(){clearTimeout(r),Ct&&cancelAnimationFrame(s),setTimeout(e)},r=setTimeout(n,35);Ct&&(s=requestAnimationFrame(n))}function $e(e){var s=F,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),F=s}function Ke(e){var s=F;e.__c=e.__(),F=s}function Et(e,s){return!e||e.length!==s.length||s.some(function(n,r){return n!==e[r]})}function Tt(e,s){return typeof s=="function"?s(e):s}function Qs(e,s){for(var n in s)e[n]=s[n];return e}function Lt(e,s){for(var n in e)if(n!=="__source"&&!(n in s))return!0;for(var r in s)if(r!=="__source"&&e[r]!==s[r])return!0;return!1}function At(e,s){this.props=e,this.context=s}(At.prototype=new X).isPureReactComponent=!0,At.prototype.shouldComponentUpdate=function(e,s){return Lt(this.props,e)||Lt(this.state,s)};var Pt=P.__b;P.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Pt&&Pt(e)};var Js=P.__e;P.__e=function(e,s,n,r){if(e.then){for(var l,a=s;a=a.__;)if((l=a.__c)&&l.__c)return s.__e==null&&(s.__e=n.__e,s.__k=n.__k),l.__c(e,s)}Js(e,s,n,r)};var Dt=P.unmount;function Mt(e,s,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Qs({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=s),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Mt(r,s,n)})),e}function Rt(e,s,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Rt(r,s,n)}),e.__c&&e.__c.__P===s&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Ce(){this.__u=0,this.o=null,this.__b=null}function Ft(e){if(!e.__)return null;var s=e.__.__c;return s&&s.__a&&s.__a(e)}function G(e){var s,n,r,l=null;function a(i){if(s||(s=e()).then(function(o){o&&(l=o.default||o),r=!0},function(o){n=o,r=!0}),n)throw n;if(!r)throw s;return l?we(l,i):null}return a.displayName="Lazy",a.__f=!0,a}function Ee(){this.i=null,this.l=null}P.unmount=function(e){var s=e.__c;s&&(s.__z=!0),s&&s.__R&&s.__R(),s&&32&e.__u&&(e.type=null),Dt&&Dt(e)},(Ce.prototype=new X).__c=function(e,s){var n=s.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var l=Ft(r.__v),a=!1,i=function(){a||r.__z||(a=!0,n.__R=null,l?l(d):d())};n.__R=i;var o=n.__P;n.__P=null;var d=function(){if(!--r.__u){if(r.state.__a){var h=r.state.__a;r.__v.__k[0]=Rt(h,h.__c.__P,h.__c.__O)}var u;for(r.setState({__a:r.__b=null});u=r.o.pop();)u.__P=o,u.forceUpdate()}};r.__u++||32&s.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(i,i)},Ce.prototype.componentWillUnmount=function(){this.o=[]},Ce.prototype.render=function(e,s){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Mt(this.__b,n,r.__O=r.__P)}this.__b=null}var l=s.__a&&we(R,null,e.fallback);return l&&(l.__u&=-33),[we(R,null,s.__a?null:e.children),l]};var qt=function(e,s,n){if(++n[1]===n[0]&&e.l.delete(s),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Ee.prototype=new X).__a=function(e){var s=this,n=Ft(s.__v),r=s.l.get(e);return r[0]++,function(l){var a=function(){s.props.revealOrder?(r.push(l),qt(s,e,r)):l()};n?n(a):a()}},Ee.prototype.render=function(e){this.i=null,this.l=new Map;var s=ke(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&s.reverse();for(var n=s.length;n--;)this.l.set(s[n],this.i=[1,0,this.i]);return e.children},Ee.prototype.componentDidUpdate=Ee.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(s,n){qt(e,n,s)})};var Gs=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Ys=/^(?: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]/,Zs=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Xs=/[A-Z0-9]/g,en=typeof document<"u",tn=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};X.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(X.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(s){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:s})}})});var Ot=P.event;function sn(){}function nn(){return this.cancelBubble}function rn(){return this.defaultPrevented}P.event=function(e){return Ot&&(e=Ot(e)),e.persist=sn,e.isPropagationStopped=nn,e.isDefaultPrevented=rn,e.nativeEvent=e};var an={enumerable:!1,configurable:!0,get:function(){return this.class}},It=P.vnode;P.vnode=function(e){typeof e.type=="string"&&(function(s){var n=s.props,r=s.type,l={},a=r.indexOf("-")===-1;for(var i in n){var o=n[i];if(!(i==="value"&&"defaultValue"in n&&o==null||en&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var d=i.toLowerCase();i==="defaultValue"&&"value"in n&&n.value==null?i="value":i==="download"&&o===!0?o="":d==="translate"&&o==="no"?o=!1:d[0]==="o"&&d[1]==="n"?d==="ondoubleclick"?i="ondblclick":d!=="onchange"||r!=="input"&&r!=="textarea"||tn(n.type)?d==="onfocus"?i="onfocusin":d==="onblur"?i="onfocusout":Zs.test(i)&&(i=d):d=i="oninput":a&&Ys.test(i)?i=i.replace(Xs,"-$&").toLowerCase():o===null&&(o=void 0),d==="oninput"&&l[i=d]&&(i="oninputCapture"),l[i]=o}}r=="select"&&l.multiple&&Array.isArray(l.value)&&(l.value=ke(n.children).forEach(function(h){h.props.selected=l.value.indexOf(h.props.value)!=-1})),r=="select"&&l.defaultValue!=null&&(l.value=ke(n.children).forEach(function(h){h.props.selected=l.multiple?l.defaultValue.indexOf(h.props.value)!=-1:l.defaultValue==h.props.value})),n.class&&!n.className?(l.class=n.class,Object.defineProperty(l,"className",an)):n.className&&(l.class=l.className=n.className),s.props=l})(e),e.$$typeof=Gs,It&&It(e)};var jt=P.__r;P.__r=function(e){jt&&jt(e),e.__c};var Bt=P.diffed;P.diffed=function(e){Bt&&Bt(e);var s=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in s&&s.value!==n.value&&(n.value=s.value==null?"":s.value)};var Ut={Fragment:R};const H={queries:{viewBox:"0 0 24 24",elements:['<ellipse cx="12" cy="5" rx="9" ry="3"/>','<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>','<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>']},events:{viewBox:"0 0 24 24",elements:['<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>']},emails:{viewBox:"0 0 24 24",elements:['<path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/>','<polyline points="22,6 12,13 2,6"/>']},routes:{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="10"/>','<line x1="2" y1="12" x2="22" y2="12"/>','<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>']},logs:{viewBox:"0 0 24 24",elements:['<line x1="8" y1="6" x2="21" y2="6"/>','<line x1="8" y1="12" x2="21" y2="12"/>','<line x1="8" y1="18" x2="21" y2="18"/>','<line x1="3" y1="6" x2="3.01" y2="6"/>','<line x1="3" y1="12" x2="3.01" y2="12"/>','<line x1="3" y1="18" x2="3.01" y2="18"/>']},timeline:{viewBox:"0 0 24 24",elements:['<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>']},cache:{viewBox:"0 0 24 24",elements:['<rect x="2" y="2" width="20" height="8" rx="2" ry="2"/>','<rect x="2" y="14" width="20" height="8" rx="2" ry="2"/>','<line x1="6" y1="6" x2="6.01" y2="6"/>','<line x1="6" y1="18" x2="6.01" y2="18"/>']},jobs:{viewBox:"0 0 24 24",elements:['<rect x="2" y="7" width="20" height="14" rx="2" ry="2"/>','<path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"/>']},config:{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="3"/>','<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>']},internals:{viewBox:"0 0 24 24",elements:['<rect x="4" y="4" width="16" height="16" rx="2"/>','<rect x="9" y="9" width="6" height="6"/>','<line x1="9" y1="1" x2="9" y2="4"/>','<line x1="15" y1="1" x2="15" y2="4"/>','<line x1="9" y1="20" x2="9" y2="23"/>','<line x1="15" y1="20" x2="15" y2="23"/>','<line x1="20" y1="9" x2="23" y2="9"/>','<line x1="20" y1="14" x2="23" y2="14"/>','<line x1="1" y1="9" x2="4" y2="9"/>','<line x1="1" y1="14" x2="4" y2="14"/>']},overview:{viewBox:"0 0 24 24",elements:['<rect x="3" y="3" width="7" height="7"/>','<rect x="14" y="3" width="7" height="7"/>','<rect x="14" y="14" width="7" height="7"/>','<rect x="3" y="14" width="7" height="7"/>']},requests:{viewBox:"0 0 24 24",elements:['<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>']},"dashboard-timeline":{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="10"/>','<polyline points="12 6 12 12 16 14"/>']},"custom-pane":{viewBox:"0 0 24 24",elements:['<rect x="3" y="3" width="18" height="18" rx="2"/>','<path d="M9 3v18"/>']},wrench:{viewBox:"0 0 24 24",elements:['<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/>']},"external-link":{viewBox:"0 0 24 24",elements:['<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>','<polyline points="15 3 21 3 21 9"/>','<line x1="10" y1="14" x2="21" y2="3"/>']},sun:{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="5"/>','<line x1="12" y1="1" x2="12" y2="3"/>','<line x1="12" y1="21" x2="12" y2="23"/>','<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>','<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>','<line x1="1" y1="12" x2="3" y2="12"/>','<line x1="21" y1="12" x2="23" y2="12"/>','<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>','<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>']},moon:{viewBox:"0 0 24 24",elements:['<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>']},search:{viewBox:"0 0 24 24",elements:['<circle cx="11" cy="11" r="8"/>','<line x1="21" y1="21" x2="16.65" y2="16.65"/>']},eye:{viewBox:"0 0 24 24",elements:['<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>','<circle cx="12" cy="12" r="3"/>']},"eye-off":{viewBox:"0 0 24 24",elements:['<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"/>','<path d="M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"/>','<line x1="1" y1="1" x2="23" y2="23"/>','<path d="M14.12 14.12a3 3 0 1 1-4.24-4.24"/>']},"chevron-right":{viewBox:"0 0 24 24",elements:['<path d="M9 18l6-6-6-6"/>']},"chevron-left":{viewBox:"0 0 24 24",elements:['<path d="M15 18l-6-6 6-6"/>']},"open-external":{viewBox:"0 0 16 16",elements:['<path d="M6 3H3v10h10v-3M9 1h6v6M7 9L15 1"/>']}};function ln(e,s){const n=e||(typeof window<"u"?window.location.origin:"");if(!s)return{baseUrl:n};const r={headers:{Authorization:`Bearer ${s}`}};return{baseUrl:n,beforeSubscribe(l){return r},beforeUnsubscribe(l){return r}}}async function on(){if(typeof window<"u"&&window.Transmit&&typeof window.Transmit=="function")return window.Transmit;try{const e=await import("@adonisjs/transmit-client");return e.Transmit??e.default??null}catch{return null}}function cn(e){let s=null,n=null,r=!1;return{subscribe:async()=>{try{const i=await on();if(!i)throw new Error("Transmit client not available (neither window.Transmit nor @adonisjs/transmit-client)");if(r)return;s=new i(ln(e.baseUrl,e.authToken)),n=s.subscription(e.channelName),n.onMessage(o=>{r||e.onMessage(o)}),await n.create()}catch(i){e.onError?.(i)}},unsubscribe:async()=>{r=!0;try{await n?.delete(),n=null,s=null}catch{}}}}function dn(e){let s=!1;const n=cn({baseUrl:e.baseUrl,channelName:e.channelName,authToken:e.authToken,onMessage:e.onMessage,onError:r=>{s=!0,e.onError?.(r),e.onDisconnect?.()}});return n.subscribe().then(()=>{s||e.onConnect?.()}).catch(r=>{e.onError?.(r),e.onDisconnect?.()}),{unsubscribe:()=>{n.unsubscribe().catch(()=>{})}}}class Qe extends Error{status;constructor(s=403){super(`Unauthorized (HTTP ${s})`),this.name="UnauthorizedError",this.status=s}}class hn extends Error{status;body;constructor(s,n){super(`API error (HTTP ${s})`),this.name="ApiError",this.status=s,this.body=n}}class Je{baseUrl;authToken;constructor(s){this.baseUrl=s.baseUrl.replace(/\/+$/,""),this.authToken=s.authToken}async fetch(s,n){const l={...{Accept:"application/json",...this.authToken?{Authorization:`Bearer ${this.authToken}`}:{}},...n?.headers},a=await globalThis.fetch(`${this.baseUrl}${s}`,{...n,headers:l,credentials:this.authToken?"omit":"same-origin"});if(n?.signal?.aborted)throw new DOMException("The operation was aborted.","AbortError");if(a.status===401||a.status===403)throw new Qe(a.status);if(!a.ok){const i=await a.text().catch(()=>"");throw new hn(a.status,i)}return a.json()}async get(s,n){const r=n?`${s}?${n}`:s;return this.fetch(r)}async post(s,n){const r={method:"POST",...n!==void 0?{body:JSON.stringify(n),headers:{"Content-Type":"application/json"}}:{}};return this.fetch(s,r)}async delete(s){return this.fetch(s,{method:"DELETE"})}}const un=5e3,Ht=1e4,zt=100,pn=500,fn={overview:"/overview",requests:"/requests",queries:"/queries",events:"/events",routes:"/routes",logs:"/logs",emails:"/emails",timeline:"/traces",cache:"/cache",jobs:"/jobs",config:"/config"};function mn(e){return fn[e]||`/${e}`}class vn{constructor(s,n){this.client=s,this.basePath=n}async fetchSection(s,n,r){const l=mn(s),a=n?`${this.basePath}${l}?${n}`:`${this.basePath}${l}`;return this.client.fetch(a,r)}async fetchChart(s){return this.client.fetch(`${this.basePath}/overview/chart?range=${s}`)}async fetchGroupedQueries(){return this.client.fetch(`${this.basePath}/queries/grouped`)}async explainQuery(s){return this.client.fetch(`${this.basePath}/queries/${s}/explain`)}async retryJob(s){return this.client.fetch(`${this.basePath}/jobs/${s}/retry`,{method:"POST"})}async fetchCacheKey(s,n){return this.client.fetch(`${this.basePath}/cache/${encodeURIComponent(s)}`,n)}async deleteCacheKey(s){return this.client.fetch(`${this.basePath}/cache/${encodeURIComponent(s)}`,{method:"DELETE"})}async fetchEmailPreview(s,n){return this.client.fetch(`${this.basePath}/emails/${s}/preview`,n)}}function gn(e){if(!e||typeof e!="object")return!1;const s=e;return s.data!==void 0&&s.meta!==void 0}function _n(e,s){return s.aborted?!0:e instanceof DOMException&&e.name==="AbortError"}const yn=[{key:"page",param:"page",isNumeric:!0},{key:"perPage",param:"perPage",isNumeric:!0},{key:"search",param:"search"},{key:"sort",param:"sort"},{key:"sortDir",param:"direction"},{key:"timeRange",param:"range"}];function bn(e){const s=new URLSearchParams,n=e;for(const{key:r,param:l,isNumeric:a}of yn){const i=n[r];(a?i!=null:i)&&s.set(l,String(i))}if(e.filters)for(const[r,l]of Object.entries(e.filters))l&&s.set(r,l);return s.toString()}function wn(e,s,n=2){if(s<=1)return[1];const r=[],l=Math.max(2,e-n),a=Math.min(s-1,e+n);r.push(1),l>2&&r.push("...");for(let i=l;i<=a;i++)r.push(i);return a<s-1&&r.push("..."),s>1&&r.push(s),r}class xn{client;api;callbacks;endpoint;perPage;section;page=1;search;sort;sortDir;filters;timeRange;timer=null;fetchId=0;explicitFetchPending=!1;hasFetched=!1;stopped=!1;abortController=null;constructor(s){this.client=new Je({baseUrl:s.baseUrl,authToken:s.authToken}),this.api=new vn(this.client,s.endpoint),this.endpoint=s.endpoint,this.section=s.section,this.perPage=s.perPage,this.callbacks=s.callbacks}start(){this.stopped=!1,this.fetch(!1),this.startRefreshTimer()}stop(){this.stopped=!0,this.stopRefreshTimer(),this.abortController?.abort(),this.abortController=null}async fetch(s=!0){if(this.shouldSkipFetch(s))return;const{controller:n,myFetchId:r}=this.prepareFetch(s);try{const l=await this.executeFetch(n);if(this.isStaleResponse(r))return;this.applyFetchResult(l)}catch(l){if(this.shouldIgnoreError(l,n.signal,r))return;this.handleFetchError(l,s)}finally{s||(this.explicitFetchPending=!1)}}setSection(s){this.section!==s&&(this.section=s,this.page=1,this.search=void 0,this.sort=void 0,this.sortDir=void 0,this.filters=void 0,this.hasFetched=!1,this.callbacks.onData(null),this.callbacks.onPagination(null),this.callbacks.onLoading(!0),this.callbacks.onError(null),this.fetch(!1),this.startRefreshTimer())}setPage(s){this.page=s,this.fetch(!1)}setSearch(s){this.search=s||void 0,this.page=1,this.fetch(!1)}setFilter(s,n){this.filters||(this.filters={}),this.filters[s]=String(n),this.page=1,this.fetch(!1)}setSort(s,n){this.sort===s&&!n?this.sortDir=this.sortDir==="asc"?"desc":"asc":(this.sort=s,this.sortDir=n||"desc"),this.fetch(!1)}setTimeRange(s){this.timeRange=s,this.fetch(!1)}async mutate(s,n="post",r){const l=`${this.endpoint}/${s}`;try{const a=n==="post"?await this.client.post(l,r):await this.client.delete(l);return await this.fetch(!0),a}catch(a){throw a instanceof Error?a:new Error(String(a))}}configure(s){s.page!==void 0&&(this.page=s.page),s.perPage!==void 0&&(this.perPage=s.perPage),this.search=s.search,this.sort=s.sort,this.sortDir=s.sortDir,this.filters=s.filters,this.timeRange=s.timeRange}hasData(){return this.hasFetched}handleRefreshSignal(){this.hasFetched&&this.fetch(!0)}getApi(){return this.api}getClient(){return this.client}shouldSkipFetch(s){return s&&this.explicitFetchPending?!0:!this.section}prepareFetch(s){this.abortController?.abort();const n=new AbortController;this.abortController=n;const r=++this.fetchId;return s||(this.callbacks.onLoading(!0),this.explicitFetchPending=!0),{controller:n,myFetchId:r}}async executeFetch(s){const n=this.buildCurrentQueryString();return this.api.fetchSection(this.section,n||void 0,{signal:s.signal})}isStaleResponse(s){return s!==this.fetchId||this.stopped}shouldIgnoreError(s,n,r){return _n(s,n)?!0:this.isStaleResponse(r)}buildCurrentQueryString(){const s=this.sort?this.sort.replace(/[A-Z]/g,r=>"_"+r.toLowerCase()):void 0,n=this.filters;return bn({page:this.page,perPage:this.perPage,search:this.search,sort:s,sortDir:this.sort?this.sortDir:void 0,filters:n&&Object.keys(n).length>0?n:void 0,timeRange:this.section.startsWith("overview")?this.timeRange:void 0})}applyFetchResult(s){gn(s)?(this.callbacks.onData(s.data),this.callbacks.onPagination(s.meta)):(this.callbacks.onData(s),this.callbacks.onPagination(null)),this.callbacks.onError(null),this.callbacks.onLoading(!1),this.hasFetched=!0}handleFetchError(s,n){if(s instanceof Qe){this.callbacks.onError(s),this.callbacks.onLoading(!1),this.stopRefreshTimer(),this.callbacks.onUnauthorized();return}n||(this.callbacks.onError(s instanceof Error?s:new Error(String(s))),this.callbacks.onLoading(!1))}startRefreshTimer(){this.stopRefreshTimer();const s=this.section==="overview"?un:Ht;this.timer=setInterval(()=>this.fetch(!0),s)}stopRefreshTimer(){this.timer&&(clearInterval(this.timer),this.timer=null)}}function Nn(e,s){return new xn({baseUrl:s.baseUrl,endpoint:s.dashboardEndpoint,authToken:s.authToken,section:e,perPage:s.perPage,callbacks:{onData:n=>s.setData(n),onPagination:n=>s.setMeta(n),onLoading:n=>s.setIsLoading(n),onError:n=>s.setError(n),onUnauthorized:()=>{}}})}function kn(e,s){e.ctrl.configure(s);const n=e.prevSection!==e.section;return n||!e.hasFetched?(n?e.ctrl.setSection(e.section):e.ctrl.start(),!0):(e.ctrl.start(),e.hasFetched)}function Sn(){const[e,s]=k(null),[n,r]=k(null),[l,a]=k(!0),[i,o]=k(null);return{data:e,setData:s,meta:n,setMeta:r,isLoading:l,setIsLoading:a,error:i,setError:o}}function $n(e){const s=L(()=>{e.current?.fetch(!0)},[e]),n=L(async(l,a="post",i)=>{const o=e.current;if(!o)throw new Error("Dashboard controller not initialized");return o.mutate(l,a,i)},[e]),r=L(()=>{const l=e.current;if(!l)throw new Error("Dashboard controller not initialized");return l.getApi()},[e]);return{refresh:s,mutate:n,getApi:r}}function Cn(e,s,n,r){e.current||(e.current=Nn(s,{...n,setData:l=>r.setData(l),setMeta:r.setMeta,setIsLoading:r.setIsLoading,setError:r.setError}))}function En(e){return{baseUrl:e.baseUrl??"",dashboardEndpoint:e.dashboardEndpoint??"/__stats/api",authToken:e.authToken,page:e.page??1,perPage:e.perPage??50,search:e.search,sort:e.sort,sortDir:e.sortDir,filters:e.filters,timeRange:e.timeRange,refreshKey:e.refreshKey}}function J(e,s={}){const n=En(s),r=Sn(),l=O(null),a=O(e),i=O(!1);Cn(l,e,n,r),U(()=>{const d=a.current;return a.current=e,i.current=kn({ctrl:l.current,section:e,prevSection:d,hasFetched:i.current},n),()=>{l.current.stop()}},[e,n.page,n.perPage,n.search,n.sort,n.sortDir,n.filters,n.timeRange,n.refreshKey]);const o=$n(l);return{data:r.data,meta:r.meta,isLoading:r.isLoading,error:r.error,...o}}const Tn=["tracing","process","system","http","db","redis","queues","cache","app","log","emails","dashboard"],Vt="/admin/api/debug",Wt={tracing:!1,process:!1,system:!1,http:!1,db:!1,redis:!1,queues:!1,cache:!1,app:!1,log:!1,emails:!1,dashboard:!1,customPanes:[]};function Ln(e){const s={customPanes:e.customPanes??[]},n=e.features;for(const r of Tn)s[r]=n?.[r]??!1;return s}async function An(e,s=Vt){const n=`${s.replace(/\/+$/,"")}/config`;return e.fetch(n)}async function Pn(e){const{baseUrl:s="",debugEndpoint:n=Vt,authToken:r}=e,l=new Je({baseUrl:s,authToken:r});try{const a=await An(l,n);return Ln(a)}catch{return Wt}}function Dn(e={}){const{baseUrl:s="",debugEndpoint:n="/admin/api/debug",authToken:r}=e,[l,a]=k(Wt),[i,o]=k(!0),[d,h]=k(null),u=O(!1);return U(()=>{if(u.current)return;u.current=!0;let c=!1;return(async()=>{try{const p=await Pn({baseUrl:s,debugEndpoint:n,authToken:r});c||(a(p),o(!1))}catch(p){c||(h(p instanceof Error?p:new Error(String(p))),o(!1))}})(),()=>{c=!0,u.current=!1}},[s,n,r]),{features:l,isLoading:i,error:d}}const Te="ss-dash-theme",Ge="ss-theme-change";function Le(){if(typeof window>"u")return"light";const e=localStorage.getItem(Te);return e==="dark"||e==="light"?e:window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function Mn(e){typeof window>"u"||(localStorage.setItem(Te,e),window.dispatchEvent(new CustomEvent(Ge,{detail:e})))}function Rn(){const s=Le()==="dark"?"light":"dark";return Mn(s),s}function Kt(e){if(typeof window>"u")return()=>{};const s=a=>{const i=a.detail;(i==="dark"||i==="light")&&e(i)},n=a=>{if(a.key===Te){const i=a.newValue;e(i==="dark"||i==="light"?i:Le())}},r=window.matchMedia("(prefers-color-scheme: dark)"),l=a=>{localStorage.getItem(Te)||e(a.matches?"dark":"light")};return window.addEventListener(Ge,s),window.addEventListener("storage",n),r.addEventListener("change",l),()=>{window.removeEventListener(Ge,s),window.removeEventListener("storage",n),r.removeEventListener("change",l)}}function Fn(){const[e,s]=k(()=>Le());U(()=>Kt(l=>{s(l)}),[]);const n=L(()=>{const r=Rn();return s(r),r},[]);return{theme:e,toggleTheme:n}}function qn({theme:e,onToggle:s,className:n="",classPrefix:r="ss-dash"}){const l=e==="dark";return t("button",{type:"button",className:`${r==="ss-dbg"?"ss-dbg-theme-toggle":"ss-dash-theme-btn"} ${n}`,onClick:s,title:l?"Switch to light theme":"Switch to dark theme","aria-label":l?"Switch to light theme":"Switch to dark theme",children:l?t("svg",{width:"16",height:"16",viewBox:H.sun.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:H.sun.elements.join("")}}):t("svg",{width:"16",height:"16",viewBox:H.moon.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:H.moon.elements.join("")}})})}const Qt=Bs(void 0),On=["overview","requests","queries","events","routes","logs","emails","cache","jobs","config","internals"],In=G(()=>Promise.resolve().then(()=>Sr)),jn=G(()=>Promise.resolve().then(()=>Vr)),Bn=G(()=>Promise.resolve().then(()=>aa)),Un=G(()=>Promise.resolve().then(()=>ia)),Hn=G(()=>Promise.resolve().then(()=>la)),zn=G(()=>Promise.resolve().then(()=>oa)),Vn=G(()=>Promise.resolve().then(()=>da)),Wn=G(()=>Promise.resolve().then(()=>ua)),Kn=G(()=>Promise.resolve().then(()=>_a)),Qn=G(()=>Promise.resolve().then(()=>$a)),Jn=G(()=>Promise.resolve().then(()=>ja));function Gn(e){const{baseUrl:s="",dashboardEndpoint:n="/__stats/api",debugEndpoint:r,authToken:l,backUrl:a="/",channelName:i="server-stats/dashboard"}=e,{features:o}=Dn({baseUrl:s,debugEndpoint:r,authToken:l}),{theme:d,toggleTheme:h}=Fn(),[u,c]=k("overview"),m=O(u);m.current=u;const[p,v]=k(()=>typeof window>"u"?!1:localStorage.getItem("ss-dash-sidebar")==="collapsed"),[g,_]=k(!1),[y,S]=k(0),f=O(0);U(()=>{if(!i)return;const C=dn({baseUrl:s,channelName:i,authToken:l,onMessage:()=>{f.current+=1,S(f.current)},onConnect:()=>_(!0),onDisconnect:()=>_(!1),onError:()=>_(!1)});return()=>C.unsubscribe()},[s,i,l]);const x=o.customPanes||[],w=L(C=>{const q=C.replace("#","").split("?")[0];return q&&[...On,...x.map(K=>K.id)].includes(q)?q:"overview"},[x]);U(()=>{if(typeof window>"u")return;const C=w(window.location.hash);(C!=="overview"||window.location.hash)&&c(C)},[w]),U(()=>{const C=()=>{const q=w(window.location.hash);q!==m.current&&c(q)};return window.addEventListener("hashchange",C),()=>window.removeEventListener("hashchange",C)},[w]),U(()=>{typeof window>"u"||(window.location.hash=u)},[u]);const b=L(()=>{v(C=>{const q=!C;return localStorage.setItem("ss-dash-sidebar",q?"collapsed":"expanded"),q})},[]),E=z(()=>[{id:"overview",label:"Overview",visible:!0},{id:"requests",label:"Requests",visible:!0},{id:"queries",label:"Queries",visible:!0},{id:"events",label:"Events",visible:!0},{id:"routes",label:"Routes",visible:!0},{id:"logs",label:"Logs",visible:!0},{id:"emails",label:"Emails",visible:!0},{id:"cache",label:"Cache",visible:o.cache},{id:"jobs",label:"Jobs",visible:o.queues},{id:"config",label:"Config",visible:!0},{id:"internals",label:"Internals",visible:!0}],[o]),N=z(()=>E.filter(C=>C.visible),[E]),$=z(()=>({baseUrl:s,dashboardEndpoint:n,authToken:l,refreshKey:y}),[s,n,l,y]),{data:T,isLoading:j}=J("overview",$),Q=z(()=>({data:T,isLoading:j}),[T,j]),V=z(()=>{if(!T)return{};const C={};if(T.totalRequests>0&&(C.requests={count:T.totalRequests}),T.queryStats?.total>0&&(C.queries={count:T.queryStats.total}),T.logLevelBreakdown){const q=T.logLevelBreakdown,A=q.error+q.warn+q.info+q.debug;A>0&&(C.logs={count:A})}return C},[T]),W=L(()=>{const C={overview:t(In,{options:$}),requests:t(jn,{options:$}),queries:t(Bn,{options:$}),events:t(Un,{options:$}),routes:t(Hn,{options:$}),logs:t(zn,{options:$}),emails:t(Vn,{options:$}),cache:t(Wn,{options:$}),jobs:t(Kn,{options:$}),config:t(Qn,{options:$}),internals:t(Jn,{options:$,debugEndpoint:r})};return t("div",{className:"ss-dash-pane ss-dash-active",id:`ss-dash-pane-${u}`,children:t("div",{className:"ss-dash-pane-inner",children:t(Ce,{fallback:t("div",{className:"ss-dash-empty",children:"Loading..."}),children:t(Qt.Provider,{value:Q,children:C[u]||t("div",{className:"ss-dash-empty",children:"Unknown section"})})})})})},[u,$,Q]);return t("div",{className:"ss-dash","data-theme":d,id:"ss-dash",children:[t("div",{className:"ss-dash-header",children:[t("div",{className:"ss-dash-header-left",children:[t("span",{className:"ss-dash-logo",children:"Server Stats"}),t("span",{className:"ss-dash-logo-sub",children:"Dashboard"})]}),t("div",{className:"ss-dash-header-center",children:[t("span",{className:`ss-dash-live-dot ${g?"ss-dash-connected":""}`,id:"ss-dash-live-dot"}),t("span",{className:`ss-dash-live-label ${g?"ss-dash-connected":""}`,id:"ss-dash-live-label",children:g?"Live":"Polling"})]}),t("div",{className:"ss-dash-header-right",children:[t(qn,{theme:d,onToggle:h}),a&&t("a",{href:a,className:"ss-dash-back-link",title:"Back to app",children:"← App"})]})]}),t("div",{className:"ss-dash-body",children:[t("div",{className:`ss-dash-sidebar ${p?"ss-dash-collapsed":""}`,id:"ss-dash-sidebar",children:[t("nav",{className:"ss-dash-nav",role:"tablist",children:[N.map(C=>{const q=V[C.id];return t("button",{type:"button",role:"tab","aria-selected":u===C.id,className:`ss-dash-nav-item ${u===C.id?"ss-dash-active":""}`,"data-ss-section":C.id,onClick:()=>{C.id!==u&&c(C.id)},title:p?C.label:void 0,children:[t("span",{className:"ss-dash-nav-icon",children:t("svg",{width:"20",height:"20",viewBox:(H[C.id]||H.config).viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:(H[C.id]||H.config).elements.join("")}})}),t("span",{className:"ss-dash-nav-label",children:C.label}),q&&q.count>0&&t("span",{className:`ss-dash-nav-badge${q.variant?" "+q.variant:""}`,children:q.count})]},C.id)}),x.length>0&&t("div",{className:"ss-dash-nav-sep"}),x.map(C=>t("button",{type:"button",role:"tab","aria-selected":u===C.id,className:`ss-dash-nav-item ${u===C.id?"ss-dash-active":""}`,onClick:()=>c(C.id),title:p?C.label:void 0,children:[t("span",{className:"ss-dash-nav-icon",children:t("svg",{width:"20",height:"20",viewBox:H["custom-pane"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:H["custom-pane"].elements.join("")}})}),t("span",{className:"ss-dash-nav-label",children:C.label})]},C.id))]}),t("button",{type:"button",className:"ss-dash-sidebar-toggle",id:"ss-dash-sidebar-toggle",onClick:b,title:p?"Expand sidebar":"Collapse sidebar",children:p?t("svg",{width:"16",height:"16",viewBox:H["chevron-right"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"1.5",dangerouslySetInnerHTML:{__html:H["chevron-right"].elements.join("")}}):t("svg",{width:"16",height:"16",viewBox:H["chevron-left"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"1.5",dangerouslySetInnerHTML:{__html:H["chevron-left"].elements.join("")}})})]}),t("div",{className:"ss-dash-main",children:W()})]})]})}function Yn(e){const s=document.getElementById(e);return s?JSON.parse(s.textContent||"{}"):{}}function Zn(){function e(s){document.documentElement.setAttribute("data-theme",s)}e(Le()),Kt(e)}const ce=Yn("ss-dash-config");Zn();const Jt=document.getElementById("ss-dash");Jt&&js(t(Gn,{baseUrl:ce.baseUrl,dashboardEndpoint:ce.dashboardEndpoint,debugEndpoint:ce.debugEndpoint,authToken:ce.authToken,backUrl:ce.backUrl,channelName:ce.channelName}),Jt);function I(e,...s){for(const n of s){const r=e[n];if(r!=null)return r}}function Ae(e){return I(e,"createdAt","created_at","timestamp")}function Xn(e){return I(e,"timestamp","createdAt","processedAt","created_at")}function er(e){return I(e,"statusCode","status_code")}function tr(e){return I(e,"total_duration","totalDuration","duration")??0}function sr(e){return I(e,"span_count","spanCount")??0}function nr(e){return I(e,"warning_count","warningCount")??0}function Gt(e){return I(e,"from_addr","from")??""}function Yt(e){return I(e,"to_addr","to")??""}function rr(e){return I(e,"cc","cc_addr")??""}function ar(e){return I(e,"attachment_count","attachmentCount")??0}function Zt(e){return I(e,"event_name","eventName","event")??""}function Xt(e){return I(e,"method","sql_method")??""}function Pe(e){return I(e,"sqlNormalized","normalizedSql","sql_normalized","sql")??""}function ae(e,s,n){const r=e[s];return r!=null&&r!==0?Number(r):Number(e[n])||0}function ir(e){return'"'+(e.length>40?e.slice(0,40)+"...":e)+'"'}function lr(e,s,n){if(e.length===0)return"[]";const r=e.slice(0,3).map(i=>n(i,30)),l=e.length>3?", ..."+e.length+" items":"",a="["+r.join(", ")+l+"]";return a.length>s?"["+e.length+" items]":a}function or(e,s,n){const r=Object.keys(e);if(r.length===0)return"{}";const l=[];for(let d=0;d<Math.min(r.length,4);d++)l.push(r[d]+": "+n(e[r[d]],30));const a=r.length>4?", ...+"+(r.length-4):"",i="{ "+l.join(", ")+a+" }";return i.length<=s?i:"{ "+(r.slice(0,6).join(", ")+(r.length>6?", ...":""))+" }"}function cr(e){if(!e&&e!==0)return"-";const s=Math.floor(e),n=Math.floor(s/86400),r=Math.floor(s%86400/3600),l=Math.floor(s%3600/60);return n>0?`${n}d ${r}h`:r>0?`${r}h ${l}m`:l>0?`${l}m ${s%60}s`:`${s}s`}function te(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:e>=1?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`}function es(e){return/([+-]\d{2}:?\d{2}|Z)\s*$/.test(e)?e:e+"Z"}function dr(e){if(!e)return"-";const s=typeof e=="string"?new Date(es(e)):new Date(e);return Number.isNaN(s.getTime())?"-":s.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})+"."+String(s.getMilliseconds()).padStart(3,"0")}function Ye(e){if(!e)return"-";const s=typeof e=="string"?new Date(es(e)).getTime():e,n=Math.floor((Date.now()-s)/1e3);return n<0?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function hr(e){return e>pn?"very-slow":e>zt?"slow":"normal"}function fe(e,s="ss-dash"){const n=hr(e);return n==="very-slow"?`${s}-very-slow`:n==="slow"?`${s}-slow`:""}function Ze(e,s=100){return e===null?"null":e===void 0?"-":typeof e=="string"?ir(e):typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?lr(e,s,Ze):typeof e=="object"?or(e,s,Ze):String(e)}function ur(e){return e<0?"no expiry":e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function pr(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function ie({ts:e,className:s,style:n}){return e?t("span",{className:s,style:n,title:dr(e),children:Ye(e)}):t("span",{className:s,style:n,children:"-"})}const fr={color:"#34d399",fillOpacityTop:.25,fillOpacityBottom:.02,strokeWidth:1.5,width:120,height:32,padding:2};function mr(e){return{...fr,...e}}let vr=0;function gr(){return`ss-grad-${vr++}`}function _r(e){if(e.length===0)return null;let s=e[0],n=e[0],r=e[0];for(let l=1;l<e.length;l++){const a=e[l];a<s&&(s=a),a>n&&(n=a),r+=a}return{min:s,max:n,avg:r/e.length}}function yr(e,s){if(e.length<2)return null;const n=mr(s),r=_r(e),l=r.max-r.min||1,a=n.width-n.padding*2,i=n.height-n.padding*2,o=n.padding,d=e.length,h=Array.from({length:d});for(let g=0;g<d;g++){const _=o+g/(d-1)*a,y=o+i-(e[g]-r.min)/l*i;h[g]=`${_.toFixed(1)},${y.toFixed(1)}`}const u=h.join(" "),c=(o+a).toFixed(1),m=(o+i).toFixed(1),p=o.toFixed(1),v=`M${h[0]} `+h.slice(1).map(g=>`L${g}`).join(" ")+` L${c},${m} L${p},${m} Z`;return{points:u,areaPath:v,gradientId:gr(),options:n,stats:r}}function De({data:e,color:s="#34d399",width:n=120,height:r=32,className:l=""}){const a=z(()=>yr(e,{width:n,height:r}),[e,n,r]),i=z(()=>"ss-grad-"+Math.random().toString(36).slice(2,8),[]),o={"--ss-accent":s};if(!a)return t("div",{className:`ss-dash-sparkline ${l}`,style:o,children:t("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:t("text",{x:n/2,y:r/2+3,textAnchor:"middle",fill:"#737373",fontSize:"9",children:["collecting","…"]})})});const d=s||"var(--ss-accent)";return t("div",{className:`ss-dash-sparkline ${l}`,style:o,children:t("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:[t("defs",{children:t("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:d,stopOpacity:"0.25"}),t("stop",{offset:"100%",stopColor:d,stopOpacity:"0.02"})]})}),t("path",{d:a.areaPath,fill:`url(#${i})`}),t("path",{className:"ss-dash-sparkline-line",d:"M"+a.points.replace(/ /g," L"),fill:"none",stroke:d,strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round"})]})})}const br=[{value:"5m",label:"5m"},{value:"15m",label:"15m"},{value:"30m",label:"30m"},{value:"1h",label:"1h"},{value:"6h",label:"6h"},{value:"24h",label:"24h"},{value:"7d",label:"7d"}];function wr({value:e,onChange:s,className:n=""}){return t("div",{className:`ss-dash-btn-group ${n}`,children:br.map(r=>t("button",{type:"button",className:`ss-dash-btn ${e===r.value?"ss-dash-active":""}`,onClick:()=>s(r.value),children:r.label},r.value))})}function xr(e,s){if(e<=0)return[0];const n=e/s,r=Math.pow(10,Math.floor(Math.log10(n))),l=n/r;let a;l<=1?a=r:l<=2?a=2*r:l<=5?a=5*r:a=10*r;const i=[];for(let o=a;o<=e+a*.5;o+=a)i.push(Math.round(o));return i.length===0&&i.push(Math.ceil(e)),i}function ts(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"})}catch{return""}}function ss(e){if(e.length===0)return"";if(e.length===1)return`M${e[0].x},${e[0].y}`;let s=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let n=0;n<e.length-1;n++){const r=e[n],l=e[n+1],a=(r.x+l.x)/2;s+=` C${a.toFixed(1)},${r.y.toFixed(1)} ${a.toFixed(1)},${l.y.toFixed(1)} ${l.x.toFixed(1)},${l.y.toFixed(1)}`}return s}function Nr({chartPoints:e}){const s={top:12,right:12,bottom:28,left:38},n=220,r=Vs(),l=`ss-cg-total-${r}`,a=`ss-cg-error-${r}`,i=O(null),[o,d]=k(0);U(()=>{const M=i.current;if(!M)return;d(M.clientWidth);const D=new ResizeObserver(le=>{for(const nt of le)d(nt.contentRect.width)});return D.observe(M),()=>D.disconnect()},[]);const h=o||600,u=h-s.left-s.right,c=n-s.top-s.bottom,m=s.top+c,p=e.map(M=>ae(M,"requestCount","request_count")||M.total||0),v=e.map(M=>ae(M,"errorCount","error_count")),g=Math.max(...p,1),_=Math.ceil(g*1.1),y=v.some(M=>M>0),S=xr(_,4),f=S.length>0?S[S.length-1]:_,x=M=>s.left+M/Math.max(e.length-1,1)*u,w=M=>s.top+c-M/(f||1)*c,b=e.map((M,D)=>({x:x(D),y:w(p[D])})),E=e.map((M,D)=>({x:x(D),y:w(v[D])})),N=ss(b),$=y?ss(E):"",T=b.length>1?`${N} L${b[b.length-1].x.toFixed(1)},${m} L${b[0].x.toFixed(1)},${m} Z`:"",j=y&&E.length>1?`${$} L${E[E.length-1].x.toFixed(1)},${m} L${E[0].x.toFixed(1)},${m} Z`:"",Q=Math.min(10,e.length),V=Math.max(1,Math.ceil(e.length/Q)),[W,C]=k({visible:!1,x:0,idx:-1}),q=L(M=>{const D=b[M].x;C({visible:!0,x:D,idx:M})},[b]),A=L(()=>{C({visible:!1,x:0,idx:-1})},[]),K=120,ge=W.visible?Math.max(K/2,Math.min(W.x,h-K/2)):0;return t("div",{ref:i,style:{position:"relative"},children:[t("svg",{viewBox:`0 0 ${h} ${n}`,className:"ss-dash-chart-svg",children:[t("defs",{children:[t("linearGradient",{id:l,x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:"var(--ss-accent)",stopOpacity:.3}),t("stop",{offset:"100%",stopColor:"var(--ss-accent)",stopOpacity:.02})]}),t("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:"var(--ss-red-fg)",stopOpacity:.35}),t("stop",{offset:"100%",stopColor:"var(--ss-red-fg)",stopOpacity:.02})]})]}),S.map(M=>{const D=w(M);return t("g",{children:[t("line",{x1:s.left,y1:D,x2:h-s.right,y2:D,stroke:"var(--ss-border-faint)",strokeWidth:.5,strokeDasharray:"3,3"}),t("text",{x:s.left-6,y:D,textAnchor:"end",fill:"var(--ss-dim)",fontSize:9,dominantBaseline:"middle",children:M})]},`ytick-${M}`)}),T&&t("path",{d:T,fill:`url(#${l})`}),N&&t("path",{d:N,fill:"none",stroke:"var(--ss-accent)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),j&&t("path",{d:j,fill:`url(#${a})`}),$&&t("path",{d:$,fill:"none",stroke:"var(--ss-red-fg)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:"4,2"}),e.map((M,D)=>{const le=p[D],nt=v[D],rt=b[D].x,Ba=b[D].y,As=u/(e.length||1),Ps=W.visible&&W.idx===D,Ds=W.visible&&W.idx!==D;return t("g",{children:[t("rect",{x:rt-As/2,y:s.top,width:As,height:c,fill:"transparent",className:"ss-dash-chart-hover-zone","data-idx":D,onMouseEnter:()=>q(D),onMouseLeave:A}),le>0&&t("circle",{cx:rt,cy:Ba,r:Ps?4:2.5,fill:"var(--ss-accent)",stroke:"var(--ss-surface)",strokeWidth:1,className:"ss-dash-chart-dot","data-idx":D,opacity:Ds?.3:1}),nt>0&&t("circle",{cx:rt,cy:E[D].y,r:Ps?3.5:2,fill:"var(--ss-red-fg)",stroke:"var(--ss-surface)",strokeWidth:1,className:"ss-dash-chart-dot ss-dash-chart-dot-err","data-idx":D,opacity:Ds?.3:1})]},D)}),e.map((M,D)=>{if(D%V!==0&&D!==e.length-1)return null;const le=ts(M.bucket);return le?t("text",{x:x(D),y:n-6,textAnchor:"middle",fill:"var(--ss-dim)",fontSize:9,children:le},`xlabel-${D}`):null})]}),W.visible&&W.idx>=0&&t("div",{className:"ss-dash-chart-tooltip",style:{left:ge,top:s.top-4,transform:"translate(-50%, -100%)"},children:[t("div",{children:ts(e[W.idx].bucket)}),t("div",{children:["Requests: ",p[W.idx]]}),v[W.idx]>0&&t("div",{style:{color:"var(--ss-red-fg)"},children:["Errors: ",v[W.idx]]})]})]})}function ns({options:e={}}){const s=zs(Qt);return s?t(rs,{options:e,overview:s.data,isLoading:s.isLoading}):t(kr,{options:e})}function kr({options:e}){const{data:s,isLoading:n}=J("overview",e);return t(rs,{options:e,overview:s,isLoading:n})}function rs({options:e,overview:s,isLoading:n}){const[r,l]=k("1h"),{data:a}=J("overview/chart",{...e,timeRange:r});if(n&&!s)return t("div",{className:"ss-dash-empty",children:"Loading overview..."});const i=s||{avgResponseTime:0,p95ResponseTime:0,requestsPerMinute:0,errorRate:0,totalRequests:0,slowestEndpoints:[],queryStats:{total:0,avgDuration:0,perRequest:0},recentErrors:[],topEvents:[],emailActivity:{sent:0,queued:0,failed:0},logLevelBreakdown:{error:0,warn:0,info:0,debug:0},cacheStats:null,jobQueueStatus:null,statusDistribution:{"2xx":0,"3xx":0,"4xx":0,"5xx":0},slowestQueries:[]},o=i,d=ae(o,"avgResponseTime","avg_response_time"),h=ae(o,"p95ResponseTime","p95_response_time"),u=ae(o,"requestsPerMinute","requests_per_minute"),c=ae(o,"errorRate","error_rate"),p=ae(o,"totalRequests","total_requests")>0,v=a?.buckets||[],g=i.sparklines?.avgResponseTime??v.map(f=>f.avgDuration??0),_=i.sparklines?.p95ResponseTime??v.map(f=>f.p95Duration??0),y=i.sparklines?.requestsPerMinute??v.map(f=>f.requestCount??0),S=i.sparklines?.errorRate??v.map(f=>f.errorCount??0);return t("div",{className:"ss-dash-overview",children:[t("div",{className:"ss-dash-cards",children:[t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"Avg Response Time"}),t("div",{className:`ss-dash-card-value ${p?d>500?"ss-dash-red":d>200?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:p?te(d):"-"}),t("div",{className:"ss-dash-sparkline",children:t(De,{data:g,color:"#34d399",width:160,height:40})})]}),t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"P95 Response Time"}),t("div",{className:`ss-dash-card-value ${p?h>500?"ss-dash-red":h>200?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:p?te(h):"-"}),t("div",{className:"ss-dash-sparkline",children:t(De,{data:_,color:"#60a5fa",width:160,height:40})})]}),t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"Requests / min"}),t("div",{className:`ss-dash-card-value ${p?"ss-dash-accent":"ss-dash-dim"}`,children:p?u.toFixed(1):"-"}),t("div",{className:"ss-dash-sparkline",children:t(De,{data:y,color:"#34d399",width:160,height:40})})]}),t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"Error Rate"}),t("div",{className:`ss-dash-card-value ${p?c>5?"ss-dash-red":c>1?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:p?`${c.toFixed(1)}%`:"-"}),t("div",{className:"ss-dash-sparkline",children:t(De,{data:S,color:"#f87171",width:160,height:40})})]})]}),t("div",{className:"ss-dash-chart-container",children:[t("div",{className:"ss-dash-chart-header",children:[t("span",{className:"ss-dash-chart-title",children:"Request Volume"}),t(wr,{value:r,onChange:l})]}),t("div",{className:"ss-dash-chart",id:"ss-dash-chart-area",children:v.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"120px"},children:"No data for this range"}):t(Nr,{chartPoints:v})}),t("div",{className:"ss-dash-chart-legend",id:"ss-dash-chart-legend",children:[t("span",{className:"ss-dash-chart-legend-item",children:[t("span",{className:"ss-dash-legend-dot",style:{background:"var(--ss-accent)"}}),"Requests"]}),v.some(f=>(f.errorCount??0)>0)&&t("span",{className:"ss-dash-chart-legend-item",children:[t("span",{className:"ss-dash-legend-dot",style:{background:"var(--ss-red-fg)"}}),"Errors"]})]})]}),t("div",{className:"ss-dash-secondary-cards",children:[t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#requests",className:"ss-dash-widget-link",children:"Slowest Endpoints"})}),i.slowestEndpoints.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No data yet"}):t("ul",{className:"ss-dash-secondary-list",children:i.slowestEndpoints.slice(0,5).map((f,x)=>{const w=f.url||f.pattern||"-";return t("li",{children:t("a",{href:`#requests?url=${encodeURIComponent(w)}`,className:"ss-dash-widget-row-link",children:[t("span",{title:w,children:w}),t("span",{className:`ss-dash-secondary-list-value ss-dash-duration ${fe(f.avgDuration)}`,children:te(f.avgDuration)})]})},x)})})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#queries",className:"ss-dash-widget-link",children:"Query Stats"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:[t("span",{children:"Total Queries"}),t("span",{className:"ss-dash-secondary-list-value",children:i.queryStats.total})]}),t("li",{children:[t("span",{children:"Avg Duration"}),t("span",{className:"ss-dash-secondary-list-value",children:te(i.queryStats.avgDuration)})]}),t("li",{children:[t("span",{children:"Queries / Request"}),t("span",{className:"ss-dash-secondary-list-value",children:i.queryStats.perRequest.toFixed(1)})]})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#logs?level=error",className:"ss-dash-widget-link",children:"Recent Errors"})}),i.recentErrors.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No recent errors"}):t("ul",{className:"ss-dash-secondary-list",children:i.recentErrors.map((f,x)=>t("li",{children:t("a",{href:`#logs?id=${f.id??""}`,className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},title:f.message,children:f.message}),f.timestamp&&t(ie,{ts:f.timestamp,className:"ss-dash-secondary-list-value",style:{color:"var(--ss-dim)"}})]})},x))})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#events",className:"ss-dash-widget-link",children:"Top Events"})}),i.topEvents.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No events yet"}):t("ul",{className:"ss-dash-secondary-list",children:i.topEvents.slice(0,5).map((f,x)=>{const w=Zt(f);return t("li",{children:t("a",{href:`#events?event_name=${encodeURIComponent(w)}`,className:"ss-dash-widget-row-link",children:[t("span",{children:w}),t("span",{className:"ss-dash-secondary-list-value",children:f.count})]})},x)})})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#emails",className:"ss-dash-widget-link",children:"Email Activity"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#emails?status=sent",className:"ss-dash-widget-row-link",children:[t("span",{children:"Sent"}),t("span",{className:"ss-dash-secondary-list-value",children:i.emailActivity.sent})]})}),t("li",{children:t("a",{href:"#emails?status=queued",className:"ss-dash-widget-row-link",children:[t("span",{children:"Queued"}),t("span",{className:"ss-dash-secondary-list-value",children:i.emailActivity.queued})]})}),t("li",{children:t("a",{href:"#emails?status=failed",className:"ss-dash-widget-row-link",children:[t("span",{children:"Failed"}),t("span",{className:"ss-dash-secondary-list-value",style:i.emailActivity.failed>0?{color:"var(--ss-red-fg)"}:void 0,children:i.emailActivity.failed})]})})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#logs",className:"ss-dash-widget-link",children:"Log Levels"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#logs?level=error",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},children:"Error"}),t("span",{className:"ss-dash-secondary-list-value",children:i.logLevelBreakdown.error})]})}),t("li",{children:t("a",{href:"#logs?level=warn",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-amber-fg)"},children:"Warn"}),t("span",{className:"ss-dash-secondary-list-value",children:i.logLevelBreakdown.warn})]})}),t("li",{children:t("a",{href:"#logs?level=info",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-green-fg)"},children:"Info"}),t("span",{className:"ss-dash-secondary-list-value",children:i.logLevelBreakdown.info})]})}),t("li",{children:t("a",{href:"#logs?level=debug",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-dim)"},children:"Debug"}),t("span",{className:"ss-dash-secondary-list-value",children:i.logLevelBreakdown.debug})]})})]})]}),i.cacheStats&&i.cacheStats.available&&t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#cache",className:"ss-dash-widget-link",children:"Cache"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#cache",className:"ss-dash-widget-row-link",children:[t("span",{children:"Keys"}),t("span",{className:"ss-dash-secondary-list-value",children:i.cacheStats.totalKeys})]})}),t("li",{children:t("a",{href:"#cache",className:"ss-dash-widget-row-link",children:[t("span",{children:"Hit Rate"}),t("span",{className:"ss-dash-secondary-list-value",children:[i.cacheStats.hitRate.toFixed(1),"%"]})]})}),t("li",{children:t("a",{href:"#cache",className:"ss-dash-widget-row-link",children:[t("span",{children:"Memory"}),t("span",{className:"ss-dash-secondary-list-value",children:i.cacheStats.memoryUsedHuman})]})})]})]}),i.jobQueueStatus&&i.jobQueueStatus.available&&t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#jobs",className:"ss-dash-widget-link",children:"Job Queue"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#jobs?status=active",className:"ss-dash-widget-row-link",children:[t("span",{children:"Active"}),t("span",{className:"ss-dash-secondary-list-value",children:i.jobQueueStatus.active})]})}),t("li",{children:t("a",{href:"#jobs?status=waiting",className:"ss-dash-widget-row-link",children:[t("span",{children:"Waiting"}),t("span",{className:"ss-dash-secondary-list-value",children:i.jobQueueStatus.waiting})]})}),t("li",{children:t("a",{href:"#jobs?status=failed",className:"ss-dash-widget-row-link",children:[t("span",{children:"Failed"}),t("span",{className:"ss-dash-secondary-list-value",style:i.jobQueueStatus.failed>0?{color:"var(--ss-red-fg)"}:void 0,children:i.jobQueueStatus.failed})]})}),t("li",{children:t("a",{href:"#jobs?status=completed",className:"ss-dash-widget-row-link",children:[t("span",{children:"Completed"}),t("span",{className:"ss-dash-secondary-list-value",children:i.jobQueueStatus.completed})]})})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#requests",className:"ss-dash-widget-link",children:"Response Status"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#requests?status=2xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-green-fg)"},children:"2xx"}),t("span",{className:"ss-dash-secondary-list-value",children:i.statusDistribution["2xx"]})]})}),t("li",{children:t("a",{href:"#requests?status=3xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-blue-fg)"},children:"3xx"}),t("span",{className:"ss-dash-secondary-list-value",children:i.statusDistribution["3xx"]})]})}),t("li",{children:t("a",{href:"#requests?status=4xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-amber-fg)"},children:"4xx"}),t("span",{className:"ss-dash-secondary-list-value",children:i.statusDistribution["4xx"]})]})}),t("li",{children:t("a",{href:"#requests?status=5xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},children:"5xx"}),t("span",{className:"ss-dash-secondary-list-value",children:i.statusDistribution["5xx"]})]})})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#queries",className:"ss-dash-widget-link",children:"Slowest Queries"})}),i.slowestQueries.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No query data yet"}):t("ul",{className:"ss-dash-secondary-list",children:i.slowestQueries.slice(0,5).map((f,x)=>{const w=Pe(f)||"-";return t("li",{children:t("a",{href:`#queries?pattern=${encodeURIComponent(w)}`,className:"ss-dash-widget-row-link",children:[t("span",{title:w,children:w}),t("span",{className:`ss-dash-secondary-list-value ss-dash-duration ${fe(f.avgDuration)}`,children:te(f.avgDuration)})]})},x)})})]})]})]})}const Sr=Object.freeze(Object.defineProperty({__proto__:null,OverviewSection:ns,default:ns},Symbol.toStringTag,{value:"Module"}));function $r(e){if(!e)return[];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function Cr(e){if(!e)return[];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function Xe(e,s,n,r=0){return e[s]??e[n]??r}function Er(e){return{method:e.method||"",url:e.url||"",statusCode:Xe(e,"status_code","statusCode"),totalDuration:Xe(e,"total_duration","totalDuration")||e.duration||0,spanCount:Xe(e,"span_count","spanCount"),spans:$r(e.spans),warnings:Cr(e.warnings),logs:e.logs||[],httpRequestId:e.httpRequestId||e.http_request_id||void 0}}function as(e="",s){const n=O(null);return U(()=>{n.current=null},[e,s]),L(()=>(n.current||(n.current=new Je({baseUrl:e,authToken:s})),n.current),[e,s])}function Tr({color:e="muted",children:s,className:n="",classPrefix:r="ss-dash"}){return t("span",{className:`${r}-badge ${r}-badge-${e} ${n}`,children:s})}function et({method:e,className:s="",classPrefix:n="ss-dash"}){return t("span",{className:`${n}-method ${n}-method-${e.toLowerCase()} ${s}`,children:e})}function is({code:e,className:s="",classPrefix:n="ss-dash"}){let r=`${n}-status-2xx`;return e>=500?r=`${n}-status-5xx`:e>=400?r=`${n}-status-4xx`:e>=300&&(r=`${n}-status-3xx`),t("span",{className:`${n}-status ${r} ${s}`,children:e})}function Lr(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return null}return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}function ls(e){const s={};for(const[n,r]of Object.entries(e))qr.has(n)||(s[n]=r);return Object.keys(s).length>0?s:null}const Ar=["all","error","warn","info","debug"];function Pr(e){return(e.levelName||e.level_name||(typeof e.level=="string"?e.level:"")||"info").toLowerCase()}function Dr(e){return e.msg||e.message||JSON.stringify(e)}function Mr(e){return e.createdAt||e.created_at||e.time||e.timestamp||0}function Rr(e){const s=e.data||{};return e.requestId||e.request_id||e["x-request-id"]||s.requestId||s.request_id||s["x-request-id"]||""}function Fr(e,s="ss-dbg-log-level"){switch(e){case"error":case"fatal":return`${s}-error`;case"warn":return`${s}-warn`;case"info":return`${s}-info`;case"debug":return`${s}-debug`;case"trace":return`${s}-trace`;default:return`${s}-info`}}const qr=new Set(["level","time","pid","hostname","msg","message","v","name","levelName","level_name","timestamp","createdAt","created_at","requestId","request_id","x-request-id","id","data"]);function Or(e){if(e.data){const s=Lr(e.data);if(s){const n=ls(s);if(n)return n}}return ls(e)}function Me({data:e,maxPreviewLength:s=100,className:n="",classPrefix:r="ss-dash",defaultExpanded:l=!1}){const[a,i]=k(l),o=z(()=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},[e]),d=z(()=>typeof o=="object"&&o!==null?Ze(o,s):String(o??"-"),[o,s]),h=z(()=>typeof o=="object"&&o!==null?JSON.stringify(o,null,2):String(o),[o]),u=L(()=>{i(m=>!m)},[]),c=L(async()=>{try{await navigator.clipboard.writeText(h)}catch{}},[h]);return!e&&e!==0&&e!==!1?t("span",{className:`ss-dim ${r}-c-dim`,children:"-"}):t("div",{className:`${r}-data-cell ${n}`,children:[!a&&t("span",{className:`${r}-data-preview`,onClick:u,role:"button",tabIndex:0,onKeyDown:m=>m.key==="Enter"&&u(),children:d}),a&&t("div",{className:`${r}-data-full`,onClick:u,children:[t("button",{className:`${r}-copy-btn`,onClick:m=>{m.stopPropagation(),c()},title:"Copy to clipboard",type:"button",children:"Copy"}),t("pre",{children:h})]})]})}function os({log:e,index:s,expanded:n,onToggleExpand:r,onReqIdClick:l}){const a=Pr(e),i=Dr(e),o=Mr(e),d=Rr(e),h=Or(e);return t(Ut.Fragment,{children:[t("div",{className:`ss-log-entry${h?" ss-log-entry-expandable":""}`,onClick:()=>h&&r(s),children:[t("span",{className:`ss-log-level ${Fr(a,"ss-log-level")}`,children:a.toUpperCase()}),t(ie,{ts:o,className:"ss-log-time"}),d?t("span",{className:"ss-log-reqid",title:d,onClick:l?u=>{u.stopPropagation(),l(d)}:void 0,role:l?"button":void 0,tabIndex:l?0:void 0,onKeyDown:l?u=>{u.key==="Enter"&&(u.stopPropagation(),l(d))}:void 0,children:d.slice(0,8)}):t("span",{className:"ss-log-reqid-empty",children:"--"}),h?t("span",{className:`ss-log-expand-icon${n?" ss-log-expand-icon-open":""}`,children:"▶"}):t("span",{style:{width:14}}),t("span",{className:"ss-log-msg",children:i})]}),n&&h&&t("div",{className:"ss-log-detail",children:t(Me,{data:h,classPrefix:"ss-dbg",defaultExpanded:!0})})]})}function Ir({logs:e,onReqIdClick:s}){const[n,r]=k(null);return e.length===0?null:t("div",{children:[t("div",{className:"ss-related-logs-title",children:["Related Logs",t("span",{className:"ss-related-logs-count",children:["(",e.length,")"]})]}),t("div",{style:{overflow:"auto"},children:e.map((l,a)=>t(os,{log:l,index:a,expanded:n===a,onToggleExpand:i=>r(n===i?null:i),onReqIdClick:s},l.id||a))})]})}function jr(e){const{container:s,handle:n,topPane:r,bottomPane:l,storageKey:a,minHeight:i=60}=e;if(a){const d=localStorage.getItem(a);if(d){const h=parseFloat(d);h>0&&h<1&&(r.style.flex=`${h}`,l.style.flex=`${1-h}`)}}function o(d){d.preventDefault(),n.setPointerCapture(d.pointerId);const u=s.getBoundingClientRect().height,c=d.clientY,m=r.getBoundingClientRect().height;function p(g){const _=g.clientY-c;let y=m+_;const S=u-i-n.offsetHeight;y=Math.max(i,Math.min(y,S));const f=y/(u-n.offsetHeight);r.style.flex=`${f}`,l.style.flex=`${1-f}`}function v(){if(n.removeEventListener("pointermove",p),n.removeEventListener("pointerup",v),a){const g=s.getBoundingClientRect().height-n.offsetHeight;if(g>0){const _=r.getBoundingClientRect().height/g;localStorage.setItem(a,String(_))}}}n.addEventListener("pointermove",p),n.addEventListener("pointerup",v)}return n.addEventListener("pointerdown",o),()=>{n.removeEventListener("pointerdown",o)}}function Br({children:e,storageKey:s}){const n=O(null),r=O(null),l=O(null),a=O(null);return U(()=>{if(n.current&&r.current&&l.current&&a.current)return jr({container:n.current,handle:r.current,topPane:l.current,bottomPane:a.current,storageKey:s})},[s]),t("div",{ref:n,className:"ss-split-container",children:[t("div",{ref:l,className:"ss-split-top",children:e[0]}),t("div",{ref:r,className:"ss-split-handle"}),t("div",{ref:a,className:"ss-split-bottom",children:e[1]})]})}const Ur="ss-col-resize",cs="ss-resizing";function ds(e){const s=Array.from(e.querySelectorAll("thead th"));if(s.length===0)return()=>{};const n=[];let r=!1;function l(){if(!r){r=!0;for(const a of s)a.style.width=a.offsetWidth+"px";e.style.tableLayout="fixed"}}for(const a of s){let i=function(d){d.preventDefault(),d.stopPropagation(),l();const h=d.clientX,u=a.offsetWidth;o.classList.add(cs),o.setPointerCapture(d.pointerId);function c(p){const v=p.clientX-h,g=Math.max(30,u+v);a.style.width=g+"px"}function m(){o.classList.remove(cs),o.removeEventListener("pointermove",c),o.removeEventListener("pointerup",m)}o.addEventListener("pointermove",c),o.addEventListener("pointerup",m)};if(!a.textContent?.trim())continue;const o=document.createElement("div");o.className=Ur,a.appendChild(o),o.addEventListener("pointerdown",i),n.push(()=>{o.removeEventListener("pointerdown",i),o.remove()})}return()=>{for(const a of n)a()}}function Hr(e=[]){const s=O(null),n=O(null);return U(()=>(s.current&&(n.current?.(),n.current=ds(s.current)),()=>{n.current?.(),n.current=null}),e),L(l=>{n.current?.(),n.current=null,s.current=l,l&&(n.current=ds(l))},[])}function se({columns:e,data:s,keyField:n="id",sort:r,sortDir:l,onSort:a,onRowClick:i,rowClassName:o,emptyMessage:d="No data",className:h="",renderAfterRow:u}){const c=L(p=>{a&&a(p)},[a]),m=Hr([s,e]);return s.length===0?t("div",{className:"ss-dash-empty",children:d}):t("table",{ref:m,className:`ss-dash-table ${h}`,children:[t("colgroup",{children:e.map(p=>t("col",{style:p.width?{width:p.width}:void 0},p.key))}),t("thead",{children:t("tr",{children:e.map(p=>t("th",{onClick:p.sortable?()=>c(p.key):void 0,className:p.sortable?"ss-dash-sortable":"",children:[p.label,r===p.key&&t("span",{className:"ss-dash-sort-arrow",children:l==="asc"?" ▲":" ▼"})]},p.key))})}),t("tbody",{children:s.map((p,v)=>{const g=o?typeof o=="function"?o(p):o:"",_=i?"ss-dash-clickable":"";return t(Ut.Fragment,{children:[t("tr",{onClick:i?()=>i(p):void 0,className:`${_} ${g}`.trim(),children:e.map(y=>t("td",{children:y.render?y.render(p[y.key],p):p[y.key]??"-"},y.key))}),u?u(p,v):null]},p[n]??v)})})]})}function ee({search:e,onSearchChange:s,placeholder:n="Search...",summary:r,children:l,className:a=""}){const i=L(()=>{s("")},[s]);return t("div",{className:`ss-dbg-filter-bar ${a}`,children:[r!=null&&t("span",{className:"ss-dbg-summary",children:r}),t("div",{className:"ss-dbg-search-wrapper",children:[t("svg",{className:"ss-dbg-search-icon",width:"14",height:"14",viewBox:H.search.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:H.search.elements.join("")}}),t("input",{type:"text",className:"ss-dbg-search",placeholder:n,value:e,onChange:o=>s(o.target.value)}),e&&t("button",{type:"button",className:"ss-dbg-search-clear",onClick:i,children:"×"})]}),l&&t("div",{className:"ss-dbg-filter-controls",children:l})]})}function de({page:e,lastPage:s,total:n,onPageChange:r,className:l=""}){const a=z(()=>wn(e,s),[e,s]),i=L(()=>{e>1&&r(e-1)},[e,r]),o=L(()=>{e<s&&r(e+1)},[e,s,r]);return s<=1?null:t("div",{className:`ss-dash-pagination ${l}`,children:[t("span",{className:"ss-dash-page-info",children:["Page ",e," of ",s," (",n," total)"]}),t("div",{className:"ss-dash-pagination-controls",children:[t("button",{type:"button",className:"ss-dash-page-btn",onClick:i,disabled:e<=1,children:"« Prev"}),a.map((d,h)=>d==="..."?t("span",{className:"ss-dash-page-ellipsis",children:"..."},`ellipsis-${h}`):t("button",{type:"button",className:`ss-dash-page-btn ${d===e?"ss-dash-active":""}`,onClick:()=>r(d),children:d},d)),t("button",{type:"button",className:"ss-dash-page-btn",onClick:o,disabled:e>=s,children:"Next »"})]})]})}const hs={request:"#1e3a5f",middleware:"rgba(30, 58, 95, 0.7)",db:"#6d28d9",view:"#0e7490",mail:"#059669",event:"#b45309",custom:"var(--ss-dim)"},zr={request:"Request",middleware:"Middleware",db:"DB",mail:"Mail",event:"Event",view:"View",custom:"Custom"};function us({spans:e,totalDuration:s,className:n="",warnings:r}){const l=e||[],a=z(()=>[...l].sort((o,d)=>o.startOffset-d.startOffset),[l]),i=z(()=>{const o={};for(const d of a)o[d.id]=d.parentId?(o[d.parentId]||0)+1:0;return o},[a]);return l.length===0?t("div",{className:"ss-dash-empty",children:"No spans recorded"}):t("div",{className:`ss-dash-tl-waterfall ${n}`,children:[t("div",{className:"ss-dash-tl-legend",children:Object.entries(zr).map(([o,d])=>t("div",{className:"ss-dash-tl-legend-item",children:[t("span",{className:"ss-dash-tl-legend-dot",style:{background:hs[o]||hs.custom}}),t("span",{children:d})]},o))}),a.map(o=>{const d=s>0?o.startOffset/s*100:0,h=s>0?Math.max(o.duration/s*100,.5):1,u=i[o.id]||0,c=o.label.length>50?o.label.slice(0,50)+"...":o.label,m=o.category==="db"?"DB":o.category,p=o.category==="db"?"purple":o.category==="mail"?"green":o.category==="event"?"amber":o.category==="view"?"blue":"muted",v=o.metadata?Object.entries(o.metadata).filter(([,_])=>_!=null).map(([_,y])=>`${_}=${y}`).join(", "):"",g=v?`${o.label} (${o.duration.toFixed(2)}ms)
2
+ ${v}`:`${o.label} (${o.duration.toFixed(2)}ms)`;return t("div",{className:"ss-dash-tl-row",children:[t("div",{className:"ss-dash-tl-label",title:g,style:{paddingLeft:8+u*16+"px"},children:[t("span",{className:`ss-dash-badge ss-dash-badge-${p}`,style:{fontSize:"9px",marginRight:"4px"},children:m}),c]}),t("div",{className:"ss-dash-tl-track",children:t("div",{className:`ss-dash-tl-bar ss-dash-tl-bar-${o.category||"custom"}`,style:{left:`${d}%`,width:`${h}%`},title:g})}),t("span",{className:"ss-dash-tl-dur",children:[o.duration.toFixed(2),"ms"]})]},o.id)}),r&&r.length>0&&t("div",{className:"ss-dash-tl-warnings",children:[t("div",{className:"ss-dash-tl-warnings-title",children:["Warnings (",r.length,")"]}),r.map((o,d)=>t("div",{className:"ss-dash-tl-warning",children:o},d))]})]})}function ps({options:e={}}){const[s,n]=k(1),[r,l]=k(""),[a,i]=k("createdAt"),[o,d]=k("desc"),[h,u]=k(null),[c,m]=k(!1),p=O(null);U(()=>n(1),[r]);const{data:v,meta:g,isLoading:_,error:y}=J("requests",{...e,page:s,search:r,sort:a,sortDir:o}),S=as(e.baseUrl||"",e.authToken),f=L(b=>{const E=b.id;m(!0),p.current?.abort();const N=new AbortController;p.current=N;const $=e.dashboardEndpoint||"/__stats/api";S().fetch(`${$}/requests/${E}`,{signal:N.signal}).then(T=>{if(N.signal.aborted)return;const j=T,Q=j.trace;if(Q){const V={...j,...Q,logs:j.logs};u(V)}else u(T);m(!1)}).catch(()=>{N.signal.aborted||m(!1)})},[S,e.dashboardEndpoint]);U(()=>()=>p.current?.abort(),[]);const x=L(b=>{a===b?d(E=>E==="asc"?"desc":"asc"):(i(b),d("desc"))},[a]),w=v||[];if(h){const b=Er(h),E=b.logs.length>0;return t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:[t("button",{type:"button",className:"ss-dash-btn",onClick:()=>u(null),children:"← Back to Requests"}),t(et,{method:b.method}),t("span",{style:{color:"var(--ss-text)"},children:b.url}),t(is,{code:b.statusCode}),t("span",{className:"ss-dash-tl-meta",children:[b.totalDuration.toFixed(1),"ms · ",b.spanCount," spans"]})]}),E?t(Br,{storageKey:"ss-requests-split",children:[t(us,{spans:b.spans,totalDuration:b.totalDuration,warnings:b.warnings}),t(Ir,{logs:b.logs})]}):t(us,{spans:b.spans,totalDuration:b.totalDuration,warnings:b.warnings})]})}return c?t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:t("button",{type:"button",className:"ss-dash-btn",onClick:()=>m(!1),children:"← Back to Requests"})}),t("div",{className:"ss-dash-empty",children:"Loading request detail..."})]}):t("div",{children:[t(ee,{search:r,onSearchChange:l,placeholder:"Filter requests...",summary:`${g?.total??0} requests`}),y&&t("div",{className:"ss-dash-empty",children:"Failed to load requests"}),_&&!v?t("div",{className:"ss-dash-empty",children:"Loading requests..."}):t(R,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:b=>t("span",{style:{color:"var(--ss-dim)"},children:b})},{key:"method",label:"Method",width:"70px",sortable:!0,render:b=>t(et,{method:b})},{key:"url",label:"URL",sortable:!0,render:b=>t("span",{style:{color:"var(--ss-text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:b,children:b})},{key:"statusCode",label:"Status",width:"60px",sortable:!0,render:(b,E)=>{const N=er(E);return t(is,{code:N})}},{key:"duration",label:"Duration",width:"80px",sortable:!0,render:(b,E)=>{const N=tr(E);return t("span",{className:`ss-dash-duration ${fe(N)}`,children:[N.toFixed(1),"ms"]})}},{key:"spanCount",label:"Spans",width:"50px",render:(b,E)=>{const N=sr(E);return t("span",{style:{color:"var(--ss-muted)",textAlign:"center"},children:N})}},{key:"warningCount",label:"⚠",width:"40px",render:(b,E)=>{const N=nr(E);return N>0?t("span",{style:{color:"var(--ss-amber-fg)",textAlign:"center",display:"block"},children:N}):t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:"-"})}},{key:"createdAt",label:"Time",width:"80px",sortable:!0,render:(b,E)=>{const N=Ae(E)??"";return t(ie,{ts:N,className:"ss-dash-event-time"})}}],data:w,sort:a,sortDir:o,onSort:x,onRowClick:f,emptyMessage:"No requests recorded yet"})}),g&&t(de,{page:g.page,lastPage:g.lastPage,total:g.total,onPageChange:n})]})]})}const Vr=Object.freeze(Object.defineProperty({__proto__:null,RequestsSection:ps,default:ps},Symbol.toStringTag,{value:"Module"}));function Wr(e,s){let n=0,r=0;for(const d of e){const h=I(d,"duration")??0;r+=h,h>zt&&n++}const l=fs(e);let a=0;for(const d of l.values())d>1&&(a+=d);const i=e.length>0?r/e.length:0,o=s?.total??e.length;return{slowCount:n,dupCount:a,avgDuration:i,totalCount:o}}function fs(e){const s=new Map;for(const n of e){const l=Pe(n);s.set(l,(s.get(l)||0)+1)}return s}class Kr{state;constructor(s="list"){this.state={viewMode:s,sort:{key:s==="list"?"createdAt":"count",dir:"desc"},expandedIds:new Set,explainData:new Map,search:""}}setViewMode(s){return this.state.viewMode=s,this.state.sort={key:s==="list"?"createdAt":"count",dir:"desc"},this.state.expandedIds=new Set,this.state.explainData=new Map,this.state}toggleSort(s){return this.state.sort.key===s?this.state.sort={key:s,dir:this.state.sort.dir==="asc"?"desc":"asc"}:this.state.sort={key:s,dir:"desc"},this.state}toggleExpand(s){return this.state.expandedIds.has(s)?this.state.expandedIds.delete(s):this.state.expandedIds.add(s),this.state}isExpanded(s){return this.state.expandedIds.has(s)}setSearch(s){return this.state.search=s,this.state}startExplain(s){this.state.explainData.set(s,{loading:!0})}completeExplain(s,n){this.state.explainData.set(s,{loading:!1,result:n})}failExplain(s,n){this.state.explainData.set(s,{loading:!1,error:n})}clearExplain(){this.state.explainData=new Map}getExplainState(s){return this.state.explainData.get(s)}}function Qr(e){const s=[];if(e["Startup Cost"]!==null&&e["Startup Cost"]!==void 0&&s.push(`cost=${e["Startup Cost"]}..${e["Total Cost"]}`),e["Plan Rows"]!==null&&e["Plan Rows"]!==void 0&&s.push(`rows=${e["Plan Rows"]}`),e["Plan Width"]!==null&&e["Plan Width"]!==void 0&&s.push(`width=${e["Plan Width"]}`),e.Filter&&s.push(`filter: ${e.Filter}`),e["Index Cond"]&&s.push(`cond: ${e["Index Cond"]}`),e["Hash Cond"]&&s.push(`hash: ${e["Hash Cond"]}`),e["Join Type"]&&s.push(`join: ${e["Join Type"]}`),e["Sort Key"]){const n=Array.isArray(e["Sort Key"])?e["Sort Key"].join(", "):e["Sort Key"];s.push(`sort: ${n}`)}return s}function ms(e,s=0){if(!e)return[];const r=[{depth:s,nodeType:e["Node Type"]||"Unknown",relationName:e["Relation Name"]||"",alias:e.Alias&&e.Alias!==e["Relation Name"]?e.Alias:"",indexName:e["Index Name"]||"",metrics:Qr(e),isRoot:s===0}],l=e.Plans||[];for(const a of l)r.push(...ms(a,s+1));return r}function Jr(e){return!e||typeof e!="object"?!1:"Plan"in e}function Gr(e){if(!e||e.length===0)return[];const s=e[0];return!s||typeof s!="object"?[]:Object.keys(s)}function Yr(e){return e==null?"-":String(e)}function Zr(e){const s=e?.showExplain??!0,n=[{key:"id",label:"#",width:"40px",type:"index"},{key:"sql",label:"SQL",type:"sql"},{key:"duration",label:"Duration",width:"70px",sortable:!0,type:"duration"},{key:"method",label:"Method",width:"60px",type:"method"},{key:"model",label:"Model",width:"90px",type:"model"},{key:"connection",label:"Connection",width:"80px",type:"connection"},{key:"createdAt",label:"Time",width:"90px",sortable:!0,type:"time"}];return s&&n.push({key:"id",label:"",width:"70px",type:"explain"}),n}function Xr(){return[{key:"sqlNormalized",label:"Pattern",type:"sql"},{key:"count",label:"Count",width:"60px",sortable:!0},{key:"avgDuration",label:"Avg",width:"70px",sortable:!0,type:"duration"},{key:"minDuration",label:"Min",width:"70px",type:"duration"},{key:"maxDuration",label:"Max",width:"70px",type:"duration"},{key:"totalDuration",label:"Total",width:"70px",sortable:!0,type:"duration"},{key:"percentOfTotal",label:"% Time",width:"60px"}]}function ea({node:e,depth:s=0}){if(!e)return null;const n=z(()=>ms(e,s),[e,s]);return t(R,{children:n.map((r,l)=>t("div",{className:"ss-dash-explain-node",style:{marginLeft:`${r.depth*20}px`},children:[t("div",{className:"ss-dash-explain-node-header",children:[t("span",{className:"ss-dash-explain-node-type",children:r.nodeType}),r.relationName&&t(R,{children:[" on ",t("strong",{children:r.relationName})]}),r.alias&&` (${r.alias})`,r.indexName&&t(R,{children:[" using ",t("em",{children:r.indexName})]})]}),r.metrics.length>0&&t("div",{className:"ss-dash-explain-metrics",children:r.metrics.join(" · ")})]},l))})}function ta({plan:e}){if(!e||!Array.isArray(e)||e.length===0)return t("div",{className:"ss-dash-explain-result",children:"No plan data returned"});const s=e[0];if(Jr(s))return t("div",{className:"ss-dash-explain-result",children:t(ea,{node:s.Plan,depth:0})});if(typeof s=="object"&&s!==null){const n=Gr(e);return t("div",{className:"ss-dash-explain-result",children:t("table",{children:[t("thead",{children:t("tr",{children:n.map(r=>t("th",{children:r},r))})}),t("tbody",{children:e.map((r,l)=>{const a=r;return t("tr",{children:n.map(i=>t("td",{children:Yr(a[i])},i))},l)})})]})})}return t("div",{className:"ss-dash-explain-result",children:"No plan data returned"})}const vs=t("span",{className:"ss-empty-hint",children:["Queries require ",t("code",{children:"debug: true"})," on your Lucid connections in"," ",t("code",{children:"config/database.ts"})]});function sa({mode:e,controllerState:s,queries:n,meta:r,isLoading:l,onSearchChange:a,onSort:i,onToggleExpand:o,onViewModeChange:d,onPageChange:h,onExplain:u,onCloseExplain:c,summary:m,filterBarChildren:p}){const{viewMode:v,sort:g,expandedIds:_,explainData:y,search:S}=s,f=!!u,x=e==="dashboard"&&!!r,w=e==="dashboard"&&!!d,b=z(()=>fs(n),[n]);if(w&&v==="grouped")return E();return N();function E(){const T=Xr().map(j=>na(j,_,o));return t("div",{children:[t(ee,{search:S,onSearchChange:a,placeholder:"Filter queries...",summary:m,children:p}),l&&n.length===0?t("div",{className:"ss-dash-empty",children:"Loading queries..."}):t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:T,data:n,keyField:"sqlNormalized",sort:g.key,sortDir:g.dir,onSort:i,emptyMessage:t(R,{children:["No queries recorded",vs]})})})]})}function N(){const $=Zr({showExplain:f}),T=$.map(V=>ra(V,_,b,y,o,u)),j=$.length,Q=f?V=>{const W=V.id,C=y.get(W);return!C||C.loading?null:t("tr",{className:"ss-dash-explain-row",children:t("td",{colSpan:j,className:"ss-dash-explain",children:t("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[t("div",{style:{flex:1},children:C.error?t("div",{className:"ss-dash-explain-result ss-dash-explain-error",children:[t("strong",{children:"Error:"})," ",C.error,C.result?.message&&t(R,{children:[t("br",{}),C.result.message]})]}):C.result?t(ta,{plan:C.result.plan||C.result.rows||[]}):null}),t("button",{type:"button",className:"ss-dash-explain-btn",onClick:()=>c?.(),style:{marginLeft:"8px",flexShrink:0},children:"Close"})]})})})}:void 0;return t("div",{children:[t(ee,{search:S,onSearchChange:a,placeholder:"Filter queries...",summary:m,children:p}),l&&n.length===0?t("div",{className:"ss-dash-empty",children:"Loading queries..."}):t(R,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:T,data:n,sort:g.key,sortDir:g.dir,onSort:i,emptyMessage:t(R,{children:["No queries captured",vs]}),renderAfterRow:Q})}),x&&r&&t(de,{page:r.page,lastPage:r.lastPage,total:r.total,onPageChange:h})]})]})}}function na(e,s,n){const r={key:e.key,label:e.label,width:e.width,sortable:e.sortable};switch(e.type){case"sql":r.render=(l,a)=>{const i=l||"",o=(a.count||0)>=3;return t(R,{children:[t("span",{className:`ss-dash-sql ${s.has(i)?"ss-dash-expanded":""}`,title:"Click to expand",onClick:d=>{d.stopPropagation(),n(i)},role:"button",tabIndex:0,onKeyDown:d=>d.key==="Enter"&&n(i),children:i}),o&&t(R,{children:[" ",t("span",{className:"ss-dash-dup",children:"DUP"})]})]})};break;case"duration":r.render=l=>{const a=l||0,i=e.key==="avgDuration"||e.key==="maxDuration";return t("span",{className:`ss-dash-duration ${i?fe(a):""}`,children:e.key==="totalDuration"?a.toFixed(1)+"ms":a.toFixed(2)+"ms"})};break;default:e.key==="count"?r.render=l=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:l||0}):e.key==="percentOfTotal"&&(r.render=l=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:(l||0).toFixed(1)+"%"}));break}return r}function ra(e,s,n,r,l,a){const i={key:e.key,label:e.label,width:e.width,sortable:e.sortable};switch(e.type){case"index":i.render=o=>t("span",{style:{color:"var(--ss-dim)"},children:o});break;case"sql":i.render=(o,d)=>{const h=d.sql||d.sql_text||"",u=d.id;return t("div",{children:[t("span",{className:`ss-dash-sql ${s.has(u)?"ss-dash-expanded":""}`,title:"Click to expand",onClick:c=>{c.stopPropagation(),l(u)},role:"button",tabIndex:0,onKeyDown:c=>c.key==="Enter"&&l(u),children:h}),(n.get(Pe(d))??0)>1&&t("span",{className:"ss-dash-dup",children:["×",n.get(Pe(d))]})]})};break;case"duration":i.render=o=>{const d=o||0;return t("span",{className:`ss-dash-duration ${fe(d)}`,children:d.toFixed(2)+"ms"})};break;case"method":i.render=(o,d)=>{const h=Xt(d);return t("span",{className:`ss-dash-method ss-dash-method-${h.toLowerCase()}`,children:h})};break;case"model":i.render=o=>t("span",{style:{color:"var(--ss-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:o,children:o||"-"});break;case"connection":i.render=o=>t("span",{style:{color:"var(--ss-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o||"-"});break;case"time":i.render=(o,d)=>{const h=o||(Ae(d)??"");return t(ie,{ts:h,className:"ss-dash-event-time"})};break;case"explain":i.render=(o,d)=>{if(Xt(d)!=="select")return null;const u=d.id,c=r.get(u),m=c&&!c.loading&&c.result&&!c.error,p=c?.loading;return t("button",{type:"button",className:`ss-dash-explain-btn${m?" ss-dash-explain-btn-active":""}`,onClick:v=>{v.stopPropagation(),a?.(u)},disabled:!!p,children:p?"...":"EXPLAIN"})};break}return i}function gs({options:e={}}){const[s,n]=k(1),r=O(new Kr("list")),[l,a]=k(r.current.state),i=L(()=>{a({...r.current.state})},[]),{viewMode:o,sort:d,search:h}=l,u=L(N=>{N!==r.current.state.viewMode&&(r.current.setViewMode(N),n(1),i())},[i]),c=L(N=>{r.current.setSearch(N),i()},[i]);U(()=>n(1),[h]);const m=o==="grouped"?"queries/grouped":"queries",{data:p,meta:v,isLoading:g,getApi:_}=J(m,{...e,page:s,search:h,sort:d.key,sortDir:d.dir}),y=L(N=>{r.current.toggleSort(N),i()},[i]),S=L(N=>{r.current.toggleExpand(N),i()},[i]),f=L(async N=>{const $=r.current.getExplainState(N);if($&&!$.loading){r.current.clearExplain(),i();return}r.current.startExplain(N),i();try{const T=await _().explainQuery(N);if(T&&T.error){const j=T.message?`${T.error}: ${T.message}`:T.error;r.current.failExplain(N,j)}else r.current.completeExplain(N,{plan:T?.plan||void 0,rows:T?.rows||void 0})}catch(T){console.warn("[ss] Query explain failed:",T);let j=T instanceof Error?T.message:String(T);const Q=T?.body;if(Q)try{const V=JSON.parse(Q);V.message?j=V.error?`${V.error}: ${V.message}`:V.message:V.error&&(j=V.error)}catch{}r.current.failExplain(N,j)}i()},[_,i]),x=L(()=>{r.current.clearExplain(),i()},[i]),w=o==="grouped"?p?.groups||[]:p||[],b=z(()=>o!=="grouped"?w:w.map(N=>{const $={...N};return $.sqlNormalized??=I(N,"sql_normalized","pattern")??void 0,$.count??=I(N,"total_count"),$.avgDuration??=I(N,"avg_duration"),$.maxDuration??=I(N,"max_duration"),$.minDuration??=I(N,"min_duration"),$.totalDuration??=I(N,"total_duration"),$.percentOfTotal??=I(N,"pct_time"),$}),[w,o]),E=z(()=>{if(o==="grouped")return`${b.length} query patterns`;const N=Wr(b,v??void 0),$=[`${N.totalCount} queries`];return N.slowCount>0&&$.push(`${N.slowCount} slow`),N.dupCount>0&&$.push(`${N.dupCount} dup`),$.push(`avg ${(N.avgDuration||0).toFixed(1)}ms`),$.join(", ")},[o,b,v]);return t(sa,{mode:"dashboard",controllerState:l,queries:b,meta:v,isLoading:g&&!p,onSearchChange:c,onSort:y,onToggleExpand:S,onViewModeChange:u,onPageChange:n,onExplain:f,onCloseExplain:x,summary:E,filterBarChildren:t("div",{className:"ss-dash-btn-group",children:[t("button",{type:"button",className:`ss-dash-btn ${o==="list"?"ss-dash-active":""}`,onClick:()=>u("list"),children:"List"}),t("button",{type:"button",className:`ss-dash-btn ${o==="grouped"?"ss-dash-active":""}`,onClick:()=>u("grouped"),children:"Grouped"})]})})}const aa=Object.freeze(Object.defineProperty({__proto__:null,QueriesSection:gs,default:gs},Symbol.toStringTag,{value:"Module"}));function _s({options:e={}}){const[s,n]=k(1),[r,l]=k(""),{data:a,meta:i,isLoading:o}=J("events",{...e,page:s,search:r}),d=a||[];return U(()=>n(1),[r]),t("div",{children:[t(ee,{search:r,onSearchChange:l,placeholder:"Filter events...",summary:`${i?.total??0} events`}),o&&!a?t("div",{className:"ss-dash-empty",children:"Loading events..."}):t(R,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:h=>t("span",{style:{color:"var(--ss-dim)"},children:h})},{key:"eventName",label:"Event",render:(h,u)=>{const c=Zt(u);return t("span",{className:"ss-dash-event-name",title:c,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:c})}},{key:"data",label:"Data",render:h=>t(Me,{data:h,maxPreviewLength:80,className:"ss-dash-event-data"})},{key:"createdAt",label:"Time",width:"80px",render:(h,u)=>{const c=Ae(u);return t(ie,{ts:c,className:"ss-dash-event-time"})}}],data:d,emptyMessage:"No events recorded yet"})}),i&&t(de,{page:i.page,lastPage:i.lastPage,total:i.total,onPageChange:n})]})]})}const ia=Object.freeze(Object.defineProperty({__proto__:null,EventsSection:_s,default:_s},Symbol.toStringTag,{value:"Module"}));function ys({options:e={}}){const[s,n]=k(""),{data:r,isLoading:l,error:a}=J("routes",{...e,search:s}),i=r,o=Array.isArray(i)?i:i&&Array.isArray(i.routes)?i.routes:i&&Array.isArray(i.data)?i.data:[],d={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};return t("div",{children:[t(ee,{search:s,onSearchChange:n,placeholder:"Filter routes...",summary:`${o.length} routes`}),a?t("div",{className:"ss-dash-empty",children:"Failed to load routes"}):l&&!r?t("div",{className:"ss-dash-empty",children:"Loading routes..."}):t(R,{children:t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"method",label:"Method",width:"70px",render:h=>t(et,{method:h})},{key:"pattern",label:"Pattern",render:h=>t("span",{style:{color:"var(--ss-text)",...d},title:h,children:h})},{key:"name",label:"Name",width:"120px",render:h=>t("span",{style:{color:"var(--ss-muted)",...d},title:h||"-",children:h||"-"})},{key:"handler",label:"Handler",render:h=>t("span",{style:{color:"var(--ss-sql-color)",...d},title:h,children:h})},{key:"middleware",label:"Middleware",render:h=>{const u=h?.length?h.join(", "):"-";return t("span",{style:{color:"var(--ss-dim)",fontSize:"10px",...d},title:u,children:u})}}],data:o,keyField:"pattern",emptyMessage:"No routes available"})})})]})}const la=Object.freeze(Object.defineProperty({__proto__:null,RoutesSection:ys,default:ys},Symbol.toStringTag,{value:"Module"}));function bs({options:e={}}){const[s,n]=k(1),[r,l]=k(""),[a,i]=k("all"),[o,d]=k(""),[h,u]=k(""),[c,m]=k([]),[p,v]=k("level"),[g,_]=k("equals"),[y,S]=k(""),[f,x]=k(null),w={};a!=="all"&&(w.level=a),o&&(w.request_id=o),c.forEach((A,K)=>{w[`filter_field_${K}`]=A.field,w[`filter_op_${K}`]=A.operator,w[`filter_value_${K}`]=A.value});const{data:b,meta:E,isLoading:N}=J("logs",{...e,page:s,search:r,filters:w}),$=b||[],T=L(A=>{d(A),u(A),n(1)},[]),j=L(()=>{const A=h.trim();d(A),n(1)},[h]),Q=L(()=>{d(""),u(""),n(1)},[]),V=L(()=>{i("all"),n(1)},[]),W=L(()=>{const A=y.trim();A&&(m(K=>[...K,{field:p,operator:g,value:A}]),S(""))},[p,g,y]),C=L(A=>{m(K=>K.filter((ge,M)=>M!==A))},[]),q=a!=="all"||o!==""||c.length>0;return t("div",{children:[t(ee,{search:r,onSearchChange:l,placeholder:"Search logs...",summary:`${E?.total??0} logs`,children:t("div",{className:"ss-dash-log-filters",children:[Ar.map(A=>t("button",{type:"button",className:`ss-dash-log-filter ${a===A?"ss-dash-active":""}`,onClick:()=>{i(A),n(1)},children:A},A)),t("input",{type:"text",className:"ss-dash-filter-input ss-dash-reqid-input",placeholder:"Filter by request ID...",value:h,onChange:A=>u(A.target.value),onKeyDown:A=>A.key==="Enter"&&j()}),(h||o)&&t("button",{type:"button",className:"ss-dash-btn ss-dash-reqid-clear",onClick:()=>{Q()},children:"Clear"})]})}),t("div",{className:"ss-dash-structured-search",children:[t("select",{className:"ss-dash-filter-select",value:p,onChange:A=>v(A.target.value),children:[t("option",{value:"level",children:"level"}),t("option",{value:"message",children:"message"}),t("option",{value:"request_id",children:"request_id"}),t("option",{value:"userId",children:"userId"}),t("option",{value:"email",children:"email"}),t("option",{value:"path",children:"path"})]}),t("select",{className:"ss-dash-filter-select",value:g,onChange:A=>_(A.target.value),children:[t("option",{value:"equals",children:"equals"}),t("option",{value:"contains",children:"contains"}),t("option",{value:"starts_with",children:"starts with"})]}),t("input",{className:"ss-dash-filter-input",placeholder:"Value...",value:y,onChange:A=>S(A.target.value),onKeyDown:A=>A.key==="Enter"&&W()}),t("button",{type:"button",className:"ss-dash-btn",onClick:W,children:"Add"})]}),q&&t("div",{className:"ss-dash-filter-chips",children:[a!=="all"&&t("span",{className:"ss-dash-filter-chip",children:["level: ",a,t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:V,children:"×"})]}),o&&t("span",{className:"ss-dash-filter-chip",children:["requestId: ",o.slice(0,8),"...",t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:Q,children:"×"})]}),c.map((A,K)=>t("span",{className:"ss-dash-filter-chip",children:[A.field," ",A.operator,' "',A.value,'"',t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:()=>C(K),children:"×"})]},K))]}),N&&!b?t("div",{className:"ss-dash-empty",children:"Loading logs..."}):$.length===0?t("div",{className:"ss-dash-empty",children:["No log entries",o?` matching request ${o}`:a!=="all"?` for ${a}`:""]}):t("div",{className:"ss-dash-log-entries",children:$.map((A,K)=>t(os,{log:A,index:K,expanded:f===K,onToggleExpand:ge=>x(f===ge?null:ge),onReqIdClick:T},A.id||K))}),E&&t(de,{page:E.page,lastPage:E.lastPage,total:E.total,onPageChange:n})]})}const oa=Object.freeze(Object.defineProperty({__proto__:null,LogsSection:bs,default:bs},Symbol.toStringTag,{value:"Module"}));function ca({email:e,previewHtml:s,isLoading:n=!1,onClose:r,className:l}){return t("div",{className:l||"ss-email-preview",children:[t("div",{className:"ss-email-preview-header",children:[t("div",{className:"ss-email-preview-meta",children:e&&t(R,{children:[e.subject!=null&&t("div",{children:[t("strong",{children:"Subject:"})," ",e.subject]}),e.from!=null&&t("div",{children:[t("strong",{children:"From:"})," ",e.from]}),e.to!=null&&t("div",{children:[t("strong",{children:"To:"})," ",e.to]}),e.cc&&t("div",{children:[t("strong",{children:"CC:"})," ",e.cc]}),e.status&&t("div",{children:[t("strong",{children:"Status:"})," ",t("span",{className:`ss-email-status ss-email-status-${e.status}`,children:e.status})]}),e.mailer&&t("div",{children:[t("strong",{children:"Mailer:"})," ",e.mailer]})]})}),t("button",{className:"ss-dbg-btn-clear",onClick:r,type:"button",children:"×"})]}),n?t("div",{className:"ss-empty",children:"Loading preview..."}):s?t("iframe",{className:"ss-email-iframe",srcDoc:s,title:"Email preview",sandbox:""}):t("div",{style:{padding:"12px",whiteSpace:"pre-wrap"},children:e?.text||"No content"})]})}function ws({options:e={}}){const[s,n]=k(1),[r,l]=k(""),[a,i]=k(null),[o,d]=k(null),h=O(null),{data:u,meta:c,isLoading:m}=J("emails",{...e,page:s,search:r}),p=u||[];U(()=>n(1),[r]);const v=L(async g=>{if(h.current?.abort(),g.html){h.current=null,i(g.id),d(g.html);return}const _=new AbortController;h.current=_;try{const{baseUrl:y="",dashboardEndpoint:S="/__stats/api",authToken:f}=e,x=`${y}${S}/emails/${g.id}/preview`,w={Accept:"text/html"};f&&(w.Authorization=`Bearer ${f}`);const E=await(await fetch(x,{headers:w,credentials:"same-origin",signal:_.signal})).text();if(h.current!==_)return;i(g.id),d(E)}catch(y){if(y instanceof Error&&y.name==="AbortError")return}},[e]);if(U(()=>()=>h.current?.abort(),[]),a&&o){const g=p.find(y=>y.id===a),_=g?{subject:g.subject,from:Gt(g),to:Yt(g),cc:rr(g)||null,status:g.status,mailer:g.mailer}:null;return t(ca,{email:_,previewHtml:o,onClose:()=>{i(null),d(null)},className:"ss-dash-email-preview"})}return t("div",{children:[t(ee,{search:r,onSearchChange:l,placeholder:"Filter emails...",summary:`${c?.total??0} emails`}),m&&!u?t("div",{className:"ss-dash-empty",children:"Loading emails..."}):t(R,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:g=>t("span",{style:{color:"var(--ss-dim)"},children:g})},{key:"from",label:"From",width:"150px",render:(g,_)=>{const y=Gt(_);return t("span",{title:y,style:{color:"var(--ss-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:y})}},{key:"to",label:"To",width:"150px",render:(g,_)=>{const y=Yt(_);return t("span",{title:y,style:{color:"var(--ss-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:y})}},{key:"subject",label:"Subject",render:g=>{const _=g||"";return t("span",{title:_,style:{color:"var(--ss-sql-color)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:_})}},{key:"status",label:"Status",width:"80px",render:g=>{const _=g||"";return t("span",{className:`ss-dash-badge ss-dash-email-status-${_}`,children:_})}},{key:"attachmentCount",label:"ATT",width:"40px",render:(g,_)=>{const y=ar(_);return y>0?t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:y}):t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:"-"})}},{key:"mailer",label:"Mailer",width:"70px",render:g=>{const _=g||"";return t("span",{title:_,style:{color:"var(--ss-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:_})}},{key:"createdAt",label:"Time",width:"80px",render:(g,_)=>{const y=Ae(_);return t(ie,{ts:y,className:"ss-dash-event-time",style:{whiteSpace:"nowrap"}})}}],data:p,onRowClick:v,rowClassName:"ss-dash-email-row",emptyMessage:"No emails captured yet"})}),c&&t(de,{page:c.page,lastPage:c.lastPage,total:c.total,onPageChange:n})]})]})}const da=Object.freeze(Object.defineProperty({__proto__:null,EmailsSection:ws,default:ws},Symbol.toStringTag,{value:"Module"}));function ha({hitRate:e,hits:s,misses:n,keys:r}){return t("div",{className:"ss-cache-stats",children:[t("div",{className:"ss-cache-stat",children:[t("span",{className:"ss-cache-stat-label",children:"Hit Rate:"}),t("span",{className:"ss-cache-stat-value",children:[e.toFixed(1),"%"]})]}),t("div",{className:"ss-cache-stat",children:[t("span",{className:"ss-cache-stat-label",children:"Hits:"}),t("span",{className:"ss-cache-stat-value",children:s})]}),t("div",{className:"ss-cache-stat",children:[t("span",{className:"ss-cache-stat-label",children:"Misses:"}),t("span",{className:"ss-cache-stat-value",children:n})]}),t("div",{className:"ss-cache-stat",children:[t("span",{className:"ss-cache-stat-label",children:"Keys:"}),t("span",{className:"ss-cache-stat-value",children:r})]})]})}function xs({options:e={}}){const[s,n]=k(""),[r,l]=k(null),[a,i]=k(null),[o,d]=k(!1),[h,u]=k(null),c=O(null),{data:m,isLoading:p,mutate:v,getApi:g}=J("cache",{...e,search:s}),_=m,y=L(async f=>{if(confirm(`Delete cache key "${f}"?`))try{await v(`cache/${encodeURIComponent(f)}`,"delete"),r===f&&(l(null),i(null),u(null))}catch{}},[v,r]),S=L(async f=>{if(c.current?.abort(),r===f){c.current=null,l(null),i(null),u(null);return}l(f),i(null),u(null),d(!0);const x=new AbortController;c.current=x;try{const b=await g().fetchCacheKey(f,{signal:x.signal});if(c.current!==x)return;i(b.value!==void 0?b.value:b.data!==void 0?b.data:b),u(null)}catch(w){if(w instanceof Error&&w.name==="AbortError"||c.current!==x)return;i(null),u("Failed to fetch key value")}finally{c.current===x&&d(!1)}},[r,g]);return U(()=>()=>c.current?.abort(),[]),t("div",{children:[_?.available&&_?.stats&&t(ha,{hitRate:_.stats.hitRate??0,hits:_.stats.hits??0,misses:_.stats.misses??0,keys:_.stats.totalKeys||_.stats.keyCount||_.keys?.length||0}),t(ee,{search:s,onSearchChange:n,placeholder:"Filter cache keys...",summary:`${(_?.keys||_?.data||[]).length} keys`}),p&&!m?t("div",{className:"ss-dash-empty",children:"Loading cache..."}):!_||!_.available?t("div",{className:"ss-dash-empty",children:"Cache inspector not available"}):t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"key",label:"Key",render:f=>t("span",{title:f,style:{color:"var(--ss-sql-color)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:f})},{key:"type",label:"Type",width:"70px",render:f=>t("span",{style:{color:"var(--ss-muted)"},children:f})},{key:"size",label:"Size",width:"60px",render:f=>f!=null&&f>0?pr(f):"-"},{key:"ttl",label:"TTL",width:"70px",render:f=>f>0?ur(f):"-"},{key:"_actions",label:"",width:"60px",render:(f,x)=>t("button",{type:"button",className:"ss-dash-retry-btn",onClick:w=>{w.stopPropagation(),y(x.key)},children:"Delete"})}],data:_.keys||_.data||[],keyField:"key",onRowClick:f=>S(f.key),emptyMessage:"No cache keys found"})}),r&&t("div",{className:"ss-dash-cache-detail",children:[t("h4",{children:["Key: ",r]}),o?t("div",{className:"ss-dash-empty",children:"Loading value..."}):h?t("div",{className:"ss-dash-empty",style:{color:"var(--ss-red-fg)"},children:h}):t(Me,{data:a})]})]})}const ua=Object.freeze(Object.defineProperty({__proto__:null,CacheSection:xs,default:xs},Symbol.toStringTag,{value:"Module"})),pa=["all","active","waiting","delayed","completed","failed"];function fa(e){switch(e){case"active":return"blue";case"waiting":return"amber";case"delayed":return"purple";case"completed":return"green";case"failed":return"red";default:return"muted"}}function ma(e){if(!e)return[];if(Array.isArray(e))return e;const s=e;return s.jobs||s.data||[]}function va(e){if(!e||Array.isArray(e))return null;const s=e;return s.stats||s.overview||null}function ga({stats:e,classPrefix:s="ss"}){if(!e)return null;const n=s;return t("div",{className:`${n}-job-stats`,children:[t("div",{className:`${n}-job-stat`,children:[t("span",{className:`${n}-job-stat-label`,children:"Active:"}),t("span",{className:`${n}-job-stat-value`,children:e.active??0})]}),t("div",{className:`${n}-job-stat`,children:[t("span",{className:`${n}-job-stat-label`,children:"Waiting:"}),t("span",{className:`${n}-job-stat-value`,children:e.waiting??0})]}),t("div",{className:`${n}-job-stat`,children:[t("span",{className:`${n}-job-stat-label`,children:"Delayed:"}),t("span",{className:`${n}-job-stat-value`,children:e.delayed??0})]}),t("div",{className:`${n}-job-stat`,children:[t("span",{className:`${n}-job-stat-label`,children:"Completed:"}),t("span",{className:`${n}-job-stat-value`,children:e.completed??0})]}),t("div",{className:`${n}-job-stat`,children:[t("span",{className:`${n}-job-stat-label`,children:"Failed:"}),t("span",{className:`${n}-job-stat-value ${n}-c-red`,children:e.failed??0})]})]})}function Ns({options:e={}}){const[s,n]=k(1),[r,l]=k(""),[a,i]=k("all"),[o,d]=k({}),h={};a!=="all"&&(h.status=a);const{data:u,meta:c,isLoading:m,error:p,refresh:v,mutate:g}=J("jobs",{...e,page:s,search:r,filters:h}),_=ma(u),y=va(u),S=L(async f=>{d(x=>({...x,[f]:"pending"}));try{await g(`jobs/${f}/retry`),d(x=>({...x,[f]:"success"})),setTimeout(()=>{d(x=>{const w={...x};return delete w[f],w}),v()},1e3)}catch{d(x=>{const w={...x};return delete w[f],w})}},[g,v]);return t("div",{children:[t(ga,{stats:y,classPrefix:"ss-dash"}),t(ee,{search:r,onSearchChange:l,placeholder:"Filter jobs...",summary:`${c?.total??_.length} jobs`,children:t("div",{className:"ss-dash-btn-group",children:pa.map(f=>t("button",{type:"button",className:`ss-dash-btn ${a===f?"ss-dash-active":""}`,onClick:()=>{i(f),n(1)},children:f.charAt(0).toUpperCase()+f.slice(1)},f))})}),m&&!u?t("div",{className:"ss-dash-empty",children:"Loading jobs..."}):p?t("div",{className:"ss-dash-empty",children:"Jobs/Queue not available"}):t(R,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"ID",width:"40px",render:f=>t("span",{style:{color:"var(--ss-dim)"},children:f})},{key:"name",label:"Name",render:f=>t("span",{style:{color:"var(--ss-text)"},title:f,children:f})},{key:"status",label:"Status",width:"90px",render:f=>t(Tr,{color:fa(f),children:f})},{key:"payload",label:"Payload",render:(f,x)=>t(Me,{data:f||x?.data,maxPreviewLength:60})},{key:"attempts",label:"Tries",width:"50px",render:(f,x)=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:f||x.attemptsMade||0})},{key:"duration",label:"Duration",width:"75px",render:f=>t("span",{className:"ss-dash-duration",children:f!==null?te(f):"-"})},{key:"timestamp",label:"Time",width:"70px",render:(f,x)=>{const w=f||Xn(x);return t(ie,{ts:w,className:"ss-dash-event-time",style:{whiteSpace:"nowrap"}})}},{key:"_actions",label:"",width:"50px",render:(f,x)=>{const w=x.id,b=o[w];return x.status!=="failed"?null:t("button",{type:"button",className:"ss-dash-retry-btn",disabled:b==="pending"||b==="success",onClick:E=>{E.stopPropagation(),S(w)},children:b==="pending"?"...":b==="success"?"OK":"Retry"})}}],data:_,emptyMessage:"No jobs found"})}),c&&t(de,{page:c.page,lastPage:c.lastPage,total:c.total,onPageChange:n})]})]})}const _a=Object.freeze(Object.defineProperty({__proto__:null,JobsSection:Ns,default:Ns},Symbol.toStringTag,{value:"Module"}));function Y(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.__redacted===!0}function Re(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)&&!Y(e)}function tt(e,s=""){if(!Re(e))return[{path:s,value:e}];const n=[];for(const r of Object.keys(e)){const l=s?`${s}.${r}`:r,a=e[r];Re(a)?n.push(...tt(a,l)):n.push({path:l,value:a})}return n}function st(e){return e==null?{text:"null",color:"var(--ss-dim)"}:typeof e=="boolean"?{text:String(e),color:e?"var(--ss-green-fg)":"var(--ss-red-fg)"}:typeof e=="number"?{text:String(e),color:"var(--ss-amber-fg)"}:Array.isArray(e)?{text:`[${e.map(n=>n==null?"null":typeof n=="object"?JSON.stringify(n):String(n)).join(", ")}]`,color:"var(--ss-purple-fg)"}:typeof e=="object"?{text:JSON.stringify(e),color:"var(--ss-dim)"}:{text:String(e)}}function ks(e){if(e==null||typeof e!="object"||Array.isArray(e)||Y(e))return 1;let s=0;for(const n of Object.keys(e))s+=ks(e[n]);return s}function ya(e){if(!Re(e))return[];const s=[];for(const n of Object.keys(e))Re(e[n])&&s.push(n);return s}function Fe(e,s,n){s&&navigator.clipboard.writeText(e).then(()=>{const r=s.textContent;s.textContent="✓",s.classList.add(`${n}-copy-row-ok`),setTimeout(()=>{s.textContent=r,s.classList.remove(`${n}-copy-row-ok`)},1200)}).catch(()=>{})}function qe({redacted:e,p:s}){return t("span",{className:`${s}-config-redacted`,style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:t("span",{children:e.display})})}function ba({env:e,search:s,p:n}){const r=O(new Map),l=s.toLowerCase(),a=Object.entries(e).filter(([i,o])=>{if(!l)return!0;const d=Y(o)?o.display:o==null?"":String(o);return i.toLowerCase().includes(l)||d.toLowerCase().includes(l)});return t("div",{className:`${n}-config-table-wrap`,children:t("table",{className:`${n}-table ${n}-config-env-table`,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Variable"}),t("th",{children:"Value"}),t("th",{style:{width:36}})]})}),t("tbody",{children:[a.map(([i,o])=>{const d=Y(o),h=d?o.display:o==null?"null":String(o),u=`${i}=${h}`;return t("tr",{children:[t("td",{className:`${n}-env-key`,children:t("span",{className:`${n}-config-key`,children:i})}),t("td",{className:`${n}-env-val`,children:d?t(qe,{redacted:o,p:n}):t("span",{className:`${n}-config-val`,children:h})}),t("td",{children:!d&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:c=>{r.current.set(i,c)},onClick:c=>{c.stopPropagation(),Fe(u,r.current.get(i)??null,n)},children:"⎘"})})]},i)}),a.length===0&&t("tr",{children:t("td",{colSpan:3,style:{textAlign:"center",color:"var(--ss-dim)"},children:"No matching variables"})})]})]})})}function wa({source:e,search:s,p:n}){const r=O(new Map),l=s.toLowerCase(),a=tt(e,""),i=a.filter(o=>{const d=Y(o.value)?o.value.display:o.value===null||o.value===void 0?"":String(o.value);return o.path.toLowerCase().includes(l)||d.toLowerCase().includes(l)});return t("div",{className:`${n}-config-table-wrap`,children:[t("table",{className:`${n}-table`,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Path"}),t("th",{children:"Value"}),t("th",{style:{width:36}})]})}),t("tbody",{children:[i.map(o=>{const d=Y(o.value),h=d?null:st(o.value),u=d?o.value.display:h.text,c=`${o.path}: ${u}`;return t("tr",{children:[t("td",{children:t("span",{className:`${n}-config-key`,style:{whiteSpace:"nowrap"},children:o.path})}),t("td",{children:d?t(qe,{redacted:o.value,p:n}):t("span",{className:`${n}-config-val`,style:{wordBreak:"break-all",color:h.color},children:h.text})}),t("td",{children:!d&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:m=>{r.current.set(o.path,m)},onClick:m=>{m.stopPropagation(),Fe(c,r.current.get(o.path)??null,n)},children:"⎘"})})]},o.path)}),i.length===0&&t("tr",{children:t("td",{colSpan:3,style:{textAlign:"center",color:"var(--ss-dim)"},children:"No matching entries"})})]})]}),t("div",{style:{padding:"4px 16px",fontSize:"10px",color:"var(--ss-muted)"},children:[i.length," of ",a.length," entries"]})]})}function xa({obj:e,prefix:s,p:n}){const r=O(new Map),l=tt(e,s);return t("table",{className:`${n}-table ${n}-config-inner-table`,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"35%"},children:"Key"}),t("th",{children:"Value"}),t("th",{style:{width:36}})]})}),t("tbody",{children:l.map(a=>{const i=a.path.indexOf(s+".")===0?a.path.slice(s.length+1):a.path,o=Y(a.value),d=o?null:st(a.value),h=o?a.value.display:d.text,u=`${a.path}: ${h}`;return t("tr",{children:[t("td",{title:i,children:t("span",{className:`${n}-config-key`,children:i})}),t("td",{title:h,children:o?t(qe,{redacted:a.value,p:n}):t("span",{className:`${n}-config-val`,style:{color:d.color},children:d.text})}),t("td",{children:!o&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:c=>{r.current.set(a.path,c)},onClick:c=>{c.stopPropagation(),Fe(u,r.current.get(a.path)??null,n)},children:"⎘"})})]},a.path)})})]})}function Na({value:e,p:s}){if(e==null)return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-dim)"},children:"null"});if(Y(e))return t(qe,{redacted:e,p:s});if(typeof e=="boolean")return t("span",{className:`${s}-config-val`,style:{color:e?"var(--ss-green-fg)":"var(--ss-red-fg)"},children:String(e)});if(typeof e=="number")return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-amber-fg)"},children:String(e)});if(Array.isArray(e)){const n=e.map(r=>r==null?"null":typeof r=="object"?JSON.stringify(r):String(r));return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-purple-fg)"},children:["[",n.join(", "),"]"]})}return typeof e=="object"?t("span",{className:`${s}-config-val`,style:{color:"var(--ss-dim)"},children:JSON.stringify(e)}):t("span",{className:`${s}-config-val`,children:String(e)})}function ka({obj:e,expandedPaths:s,onToggle:n,p:r}){if(e==null||typeof e!="object"||Array.isArray(e)||Y(e))return null;const l=Object.keys(e),a=O(new Map);return t("div",{className:`${r}-config-sections`,children:l.map(i=>{const o=e[i],d=o!==null&&typeof o=="object"&&!Array.isArray(o)&&!Y(o),h=s.has(i),u=Y(o);return t("div",{className:`${r}-config-section`,children:[t("div",{className:`${r}-config-section-header${d?"":` ${r}-config-leaf`}`,onClick:d?()=>n(i):void 0,style:{cursor:d?"pointer":"default"},children:[d?t("span",{className:`${r}-config-toggle`,children:h?"▼":"▶"}):t("span",{className:`${r}-config-toggle`,style:{visibility:"hidden"},children:"•"}),t("span",{className:`${r}-config-key`,children:i}),d?t("span",{className:`${r}-config-count`,children:[ks(o)," entries"]}):t(R,{children:[t("span",{className:`${r}-config-val`,style:{marginLeft:"8px"},children:t(Na,{value:o,p:r})}),!u&&t("button",{type:"button",className:`${r}-copy-row-btn`,style:{marginLeft:"4px"},title:"Copy",ref:c=>{a.current.set(i,c)},onClick:c=>{c.stopPropagation();const m=st(o);Fe(`${i}: ${m.text}`,a.current.get(i)??null,r)},children:"⎘"})]})]}),d&&h&&t("div",{className:`${r}-config-section-body`,children:t(xa,{obj:o,prefix:i,p:r})})]},i)})})}function Sa({data:e,isLoading:s,classPrefix:n}){const r=n,[l,a]=k(""),[i,o]=k(""),[d,h]=k("app"),[u,c]=k(new Set),[m,p]=k("Copy JSON");U(()=>{const f=setTimeout(()=>o(l),200);return()=>clearTimeout(f)},[l]);const v=e,g=L(f=>{c(x=>{const w=new Set(x);return w.has(f)?w.delete(f):w.add(f),w})},[]),_=L(()=>{if(!v)return;const f=d==="app"?v.app:v.env;if(!f)return;const x=ya(f);c(new Set(x))},[v,d]),y=L(()=>{c(new Set)},[]),S=L(async()=>{if(v)try{const f=d==="app"?v.app:v.env;await navigator.clipboard.writeText(JSON.stringify(f,null,2)),p("Copied!"),setTimeout(()=>p("Copy JSON"),1500)}catch{}},[v,d]);return t("div",{children:[t("div",{className:`${r}-config-toolbar`,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px"},children:[t("button",{type:"button",className:`${r}-config-tab${d==="app"?` ${r}-active`:""}`,onClick:()=>h("app"),children:"App Config"}),t("button",{type:"button",className:`${r}-config-tab${d==="env"?` ${r}-active`:""}`,onClick:()=>h("env"),children:"Env"}),t("div",{style:{position:"relative",flex:1},children:[t("input",{type:"text",className:`${r}-search`,placeholder:"Search keys and values...",value:l,onChange:f=>a(f.target.value),style:{width:"100%"}}),l&&t("button",{type:"button",onClick:()=>a(""),style:{position:"absolute",right:"6px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"14px",color:"var(--ss-dim)",padding:"0 2px",lineHeight:1},children:"×"})]}),d==="app"&&!i&&t(R,{children:[t("button",{type:"button",className:`${r}-btn`,onClick:_,children:"Expand All"}),t("button",{type:"button",className:`${r}-btn`,onClick:y,children:"Collapse All"})]}),t("button",{type:"button",className:`${r}-btn`,onClick:S,children:m})]}),s&&!e?t("div",{className:`${r}-empty`,children:"Loading config..."}):v?d==="env"?t(ba,{env:v.env??{},search:i,p:r}):i?t(wa,{source:v.app??{},search:i,p:r}):t("div",{className:`${r}-config-table-wrap`,children:t(ka,{obj:v.app,expandedPaths:u,onToggle:g,p:r})}):t("div",{className:`${r}-empty`,children:"Config not available"})]})}function Ss({options:e={}}){const{data:s,isLoading:n}=J("config",e);return t(Sa,{data:s,isLoading:n,classPrefix:"ss-dash"})}const $a=Object.freeze(Object.defineProperty({__proto__:null,ConfigSection:Ss,default:Ss},Symbol.toStringTag,{value:"Module"}));function Ca(e={}){const{baseUrl:s="",debugEndpoint:n="/admin/api/debug",authToken:r,refreshInterval:l=3e3}=e,[a,i]=k(null),[o,d]=k(!0),[h,u]=k(null),c=O(null),m=as(s,r),p=L(async()=>{try{const g=await m().get(`${n}/diagnostics`);i(g),u(null),d(!1)}catch(v){if(v instanceof Qe){u(v),d(!1),c.current&&(clearInterval(c.current),c.current=null);return}u(v instanceof Error?v:new Error(String(v))),d(!1)}},[n,m]);return U(()=>(d(!0),u(null),p(),c.current=setInterval(p,l),()=>{c.current&&(clearInterval(c.current),c.current=null)}),[p,l]),{data:a,isLoading:o,error:h}}const Ea=["password","secret","token","key","credential","auth"];function $s(e){const s=e.toLowerCase();return Ea.some(n=>s.includes(n))}function Cs(e){if(e==null)return"-";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.join(", ")||"-";try{return JSON.stringify(e)}catch{return String(e)}}const Ta={collectionInterval:"Stats Collection",dashboardBroadcast:"Dashboard Broadcast",debugBroadcast:"Debug Broadcast",persistFlush:"Persist Flush",retentionCleanup:"Retention Cleanup"};function La(e){return Ta[e]||e}const Aa={prometheus:"Prometheus",pinoHook:"Pino Log Hook",edgePlugin:"Edge Plugin",cacheInspector:"Cache Inspector",queueInspector:"Queue Inspector"};function Pa(e){return Aa[e]||e}const Da=["healthy","active","connected","available","ready"],Ma=["errored","unavailable"];function Ra(e){return Da.includes(e)?"ok":Ma.includes(e)?"err":""}function me({status:e,prefix:s}){const n=Ra(e);let r=`${s}-dot`;return n==="ok"?r+=` ${s}-dot-ok`:n==="err"&&(r+=` ${s}-dot-err`),t("span",{className:r})}const Es=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:H.eye.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:H.eye.elements.join("")}}),Ts=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:H["eye-off"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:H["eye-off"].elements.join("")}});function Fa({value:e}){const[s,n]=k(!1);return t("span",{children:[s?e:"••••••••"," ",t("button",{type:"button",onClick:()=>n(r=>!r),style:{background:"none",border:"1px solid var(--ss-border)",borderRadius:3,padding:"0 4px",fontSize:"10px",color:"var(--ss-dim)",cursor:"pointer",verticalAlign:"middle"},children:s?t(Ts,{}):t(Es,{})})]})}function qa({current:e,max:s,prefix:n}){const r=s>0?Math.min(100,Math.round(e/s*100)):0,l=r>=100;return t("div",{className:`${n}-bar`,children:[t("div",{className:`${n}-bar-track`,children:t("div",{className:`${n}-bar-fill${l?` ${n}-bar-fill-warn`:""}`,style:{width:`${r}%`}})}),t("span",{className:`${n}-bar-pct${l?` ${n}-bar-pct-warn`:""}`,children:[r,"%"]})]})}function Oa({config:e,prefix:s}){const n=Object.entries(e);return n.length===0?t("span",{className:`${s}-c-dim`,children:"-"}):t("span",{className:`${s}-c-muted`,children:n.map(([r,l],a)=>t("span",{children:[a>0&&", ",t("span",{className:`${s}-c-dim`,children:r}),"=",$s(r)&&typeof l=="string"?t(Fa,{value:l}):t("span",{children:Cs(l)})]},r))})}function ve({label:e,value:s,prefix:n}){return t("div",{className:`${n}-info-card`,children:[t("span",{className:`${n}-info-card-label`,children:e}),t("span",{className:`${n}-info-card-value`,children:s})]})}function Ia({data:e,tableClassName:s,classPrefix:n}){const r=n||"ss-dash",[l,a]=k(new Set),i=L(u=>{a(c=>{const m=new Set(c);return m.has(u)?m.delete(u):m.add(u),m})},[]),o=L((u,c)=>{if(c==null)return t("span",{className:`${r}-c-dim`,children:"null"});if(typeof c=="boolean")return t("span",{className:c?`${r}-c-green`:`${r}-c-red`,children:String(c)});if(Array.isArray(c))return t("span",{children:c.join(", ")||"-"});const m=Cs(c);if($s(u)){const p=l.has(u);return t("span",{children:[p?m:"••••••••"," ",t("button",{type:"button",onClick:()=>i(u),style:{background:"none",border:"1px solid var(--ss-border)",borderRadius:3,padding:"0 4px",fontSize:"10px",color:"var(--ss-dim)",cursor:"pointer",verticalAlign:"middle"},children:p?t(Ts,{}):t(Es,{})})]})}return t("span",{children:m})},[l,i,r]),h=e.collectors?.some(u=>u.name==="db_pool"||u.name==="app")&&Array.isArray(e.lucidDebugConnections)&&e.lucidDebugConnections.length===0;return t("div",{children:[h&&t("div",{style:{background:"var(--ss-amber-bg)",color:"var(--ss-amber-fg)",padding:"8px 12px",borderRadius:"6px",fontSize:"12px",marginBottom:"12px",lineHeight:1.5},children:[t("strong",{children:"Query capture disabled"})," — no Lucid connections have"," ",t("code",{style:{fontSize:"11px"},children:"debug: true"}),". Add it to your database connection in ",t("code",{style:{fontSize:"11px"},children:"config/database.ts"})," to see queries in the Queries panel."]}),t("h3",{className:`${r}-internals-title`,children:"Package Info"}),t("div",{className:`${r}-info-cards`,children:[t(ve,{label:"Version",value:e.package.version||"-",prefix:r}),t(ve,{label:"Node.js",value:e.package.nodeVersion||"-",prefix:r}),t(ve,{label:"AdonisJS",value:e.package.adonisVersion||"-",prefix:r}),t(ve,{label:"Uptime",value:cr(e.package.uptime),prefix:r}),t(ve,{label:"Renderer",value:e.devToolbar?.renderer||"preact",prefix:r})]}),e.collectors.length>0&&t(R,{children:[t("h3",{className:`${r}-internals-title`,children:"Collectors"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Collector"}),t("th",{children:"Status"}),t("th",{children:"Last Error"}),t("th",{children:"Config"})]})}),t("tbody",{children:e.collectors.map(u=>t("tr",{children:[t("td",{children:[t("code",{children:u.name}),u.label&&u.label!==u.name&&t("span",{className:`${r}-c-dim`,children:[" ",u.label]})]}),t("td",{children:[t(me,{status:u.status,prefix:r}),u.status]}),t("td",{className:u.lastError?`${r}-c-red`:`${r}-c-dim`,children:u.lastError?t(R,{children:[u.lastError,u.lastErrorAt&&t("span",{className:`${r}-c-dim`,style:{fontSize:"10px"},children:Ye(u.lastErrorAt)})]}):"-"}),t("td",{children:t(Oa,{config:u.config,prefix:r})})]},u.name))})]})]}),t("h3",{className:`${r}-internals-title`,children:"Buffers"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Buffer"}),t("th",{children:"Usage"}),t("th",{children:"Fill %"})]})}),t("tbody",{children:Object.entries(e.buffers).map(([u,c])=>t("tr",{children:[t("td",{style:{textTransform:"capitalize"},children:u}),t("td",{children:[c.current.toLocaleString()," / ",c.max.toLocaleString()]}),t("td",{children:t(qa,{current:c.current,max:c.max,prefix:r})})]},u))})]}),t("h3",{className:`${r}-internals-title`,children:"Timers"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Timer"}),t("th",{children:"Status"}),t("th",{children:"Interval"})]})}),t("tbody",{children:Object.entries(e.timers).map(([u,c])=>t("tr",{children:[t("td",{children:La(u)}),t("td",{children:[t(me,{status:c.active?"active":"inactive",prefix:r}),t("span",{className:c.active?`${r}-c-green`:`${r}-c-dim`,children:c.active?"active":"inactive"})]}),t("td",{children:c.active?c.intervalMs?te(c.intervalMs):c.debounceMs?`${te(c.debounceMs)} (debounce)`:"-":t("span",{className:`${r}-c-dim`,children:"—"})})]},u))})]}),t("h3",{className:`${r}-internals-title`,children:"Integrations"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Integration"}),t("th",{children:"Status"}),t("th",{children:"Details"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"Transmit (SSE)"}),t("td",{children:[t(me,{status:e.transmit.available?"connected":"inactive",prefix:r}),e.transmit.available?"connected":"unavailable"]}),t("td",{style:{fontSize:"11px"},children:e.transmit.channels.length>0?`Channels: ${e.transmit.channels.join(", ")}`:"-"})]}),Object.entries(e.integrations).map(([u,c])=>{const m=c.active??c.available??!1,p=c.active?"active":c.available?"available":"unavailable";let v=c.mode?`Mode: ${c.mode}`:"-";return u==="edgePlugin"&&c.active?v="@serverStats() tag registered":u==="cacheInspector"&&c.available?v="Redis dependency detected":u==="queueInspector"&&c.available&&(v="Queue dependency detected"),t("tr",{children:[t("td",{children:Pa(u)}),t("td",{children:[t(me,{status:m?"active":"inactive",prefix:r}),p]}),t("td",{className:`${r}-c-dim`,style:{fontSize:"11px"},children:v})]},u)})]})]}),e.storage&&t(R,{children:[t("h3",{className:`${r}-internals-title`,children:"Storage (SQLite)"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"200px"},children:"Metric"}),t("th",{children:"Value"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"Status"}),t("td",{children:[t(me,{status:e.storage.ready?"ready":"inactive",prefix:r}),e.storage.ready?"ready":"not ready"]})]}),t("tr",{children:[t("td",{children:"DB Path"}),t("td",{children:t("code",{children:e.storage.dbPath})})]}),t("tr",{children:[t("td",{children:"File Size"}),t("td",{children:[e.storage.fileSizeMb.toFixed(1)," MB"]})]}),t("tr",{children:[t("td",{children:"WAL Size"}),t("td",{children:[e.storage.walSizeMb.toFixed(1)," MB"]})]}),t("tr",{children:[t("td",{children:"Retention"}),t("td",{children:[e.storage.retentionDays," days"]})]}),t("tr",{children:[t("td",{children:"Size Cap"}),t("td",{children:e.storage.maxDbSizeMb>0?`${e.storage.maxDbSizeMb} MB`:"off"})]}),t("tr",{children:[t("td",{children:"Last Cleanup"}),t("td",{children:e.storage.lastCleanupAt?Ye(e.storage.lastCleanupAt):"-"})]})]})]}),e.storage.tables.length>0&&t("table",{className:s,style:{marginTop:8},children:[t("thead",{children:t("tr",{children:[t("th",{children:"Table"}),t("th",{children:"Rows"})]})}),t("tbody",{children:e.storage.tables.map(u=>t("tr",{children:[t("td",{children:t("code",{children:u.name})}),t("td",{children:u.rowCount.toLocaleString()})]},u.name))})]})]}),t("h3",{className:`${r}-internals-title`,children:"Resolved Config"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"200px"},children:"Setting"}),t("th",{children:"Value"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"intervalMs"}),t("td",{children:e.config.intervalMs})]}),t("tr",{children:[t("td",{children:"transport"}),t("td",{children:e.config.transport})]}),t("tr",{children:[t("td",{children:"channelName"}),t("td",{children:e.config.channelName})]}),t("tr",{children:[t("td",{children:"endpoint"}),t("td",{children:e.config.endpoint===!1?"false":e.config.endpoint})]}),t("tr",{children:[t("td",{children:"skipInTest"}),t("td",{children:o("skipInTest",e.config.skipInTest)})]}),t("tr",{children:[t("td",{children:"onStats callback"}),t("td",{children:e.config.hasOnStatsCallback?"defined":"not defined"})]}),t("tr",{children:[t("td",{children:"shouldShow callback"}),t("td",{children:e.config.hasShouldShowCallback?"defined":"not defined"})]})]})]}),t("h4",{className:`${r}-internals-title`,children:"DevToolbar"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"200px"},children:"Setting"}),t("th",{children:"Value"})]})}),t("tbody",{children:Object.entries(e.devToolbar).map(([u,c])=>t("tr",{children:[t("td",{children:u==="customPaneCount"?"customPanes":u}),t("td",{children:u==="customPaneCount"?`${c} registered`:o(u,c)})]},u))})]})]})}function Ls({options:e={},debugEndpoint:s="/admin/api/debug"}){const{data:n,isLoading:r,error:l}=Ca({baseUrl:e.baseUrl,debugEndpoint:s,authToken:e.authToken,refreshInterval:Ht});return r&&!n?t("div",{className:"ss-dash-empty",children:"Loading diagnostics..."}):l?t("div",{className:"ss-dash-empty",children:["Error: ",l.message]}):n?t(Ia,{data:n,tableClassName:"ss-dash-table",classPrefix:"ss-dash"}):t("div",{className:"ss-dash-empty",children:"Diagnostics not available"})}const ja=Object.freeze(Object.defineProperty({__proto__:null,InternalsSection:Ls,default:Ls},Symbol.toStringTag,{value:"Module"}))})();