adonisjs-server-stats 1.11.6 → 1.11.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/core/types-diagnostics.d.ts +2 -0
- package/dist/react/{CacheSection-BYN53kYO.js → CacheSection-DOUnyUrw.js} +1 -1
- package/dist/react/{CacheTab-DOhuK05d.js → CacheTab-D9o6bsPc.js} +1 -1
- package/dist/react/{ConfigSection-B9EHh4Rp.js → ConfigSection-DzNC7pOJ.js} +1 -1
- package/dist/react/{ConfigTab-C8kriE2b.js → ConfigTab-CT-Tu-ct.js} +1 -1
- package/dist/react/{CustomPaneTab-CvzQS_Wh.js → CustomPaneTab-CvIPe7NP.js} +1 -1
- package/dist/react/{EmailsSection-BJyFJf7A.js → EmailsSection-B1LT7Nx3.js} +1 -1
- package/dist/react/{EmailsTab-Ch8jp10B.js → EmailsTab-DKxK322z.js} +1 -1
- package/dist/react/{EventsSection-DJPwHeT8.js → EventsSection-D3AK0mhw.js} +1 -1
- package/dist/react/{EventsTab-B-FoehXC.js → EventsTab-BRRSW6RI.js} +1 -1
- package/dist/react/InternalsContent-BNOnSoi9.js +393 -0
- package/dist/react/{InternalsSection-B6VlVx5f.js → InternalsSection-BwrTfpjA.js} +1 -1
- package/dist/react/{InternalsTab-CkEKpRMU.js → InternalsTab--RD-L1dX.js} +1 -1
- package/dist/react/{JobsSection-DWF4i1t_.js → JobsSection-BMvj5886.js} +1 -1
- package/dist/react/{JobsTab-DqnifQXV.js → JobsTab-CQXWCrl8.js} +1 -1
- package/dist/react/{LogEntryRow-CMMkqA9M.js → LogEntryRow-DFI52ZEw.js} +1 -1
- package/dist/react/{LogsSection-C1xC5aP4.js → LogsSection-CW2hQ976.js} +2 -2
- package/dist/react/{LogsTab-CS4sLfLw.js → LogsTab-CV4Gf_yb.js} +2 -2
- package/dist/react/{OverviewSection-CxvfOR0v.js → OverviewSection-CxF9cabq.js} +1 -1
- package/dist/react/{QueriesSection-CrMdU5Ax.js → QueriesSection-CZJ-imAb.js} +117 -101
- package/dist/react/{QueriesTab-x85PjkyS.js → QueriesTab-CQHa1ck3.js} +23 -14
- package/dist/react/{RequestsSection-DETN9oZb.js → RequestsSection-Cb5YeqvI.js} +2 -2
- package/dist/react/{RoutesSection-CmorkJeC.js → RoutesSection-B43olD9v.js} +1 -1
- package/dist/react/{RoutesTab-CbzBOzpc.js → RoutesTab-RfhCUbkx.js} +1 -1
- package/dist/react/{SplitPaneWrapper-BiIgT4ND.js → SplitPaneWrapper-B05Mg6Sg.js} +1 -1
- package/dist/react/{TimelineTab-Ue9tUD_n.js → TimelineTab-Dx4686Ti.js} +2 -2
- package/dist/react/components/Dashboard/shared/DataTable.d.ts +1 -1
- package/dist/react/{index-DwDK-4oX.js → index-C4EMJrkH.js} +2 -2
- package/dist/react/index.js +1 -1
- package/dist/react/style.css +1 -1
- package/dist/src/collectors/db_pool_collector.js +17 -23
- package/dist/src/edge/client/dashboard.js +2 -2
- package/dist/src/edge/client/debug-panel-deferred.js +1 -1
- package/dist/src/edge/client-vue/dashboard.js +3 -3
- package/dist/src/edge/client-vue/debug-panel-deferred.js +2 -2
- package/dist/src/provider/diagnostics.d.ts +3 -0
- package/dist/src/provider/diagnostics.js +1 -0
- package/dist/src/provider/server_stats_provider.d.ts +7 -0
- package/dist/src/provider/server_stats_provider.js +36 -0
- package/dist/src/styles/components.css +16 -0
- package/dist/src/styles/dashboard.css +20 -12
- package/dist/vue/{CacheSection-DT2Mwf_s.js → CacheSection-BAotiuQq.js} +1 -1
- package/dist/vue/{ConfigSection-BwKwS9lh.js → ConfigSection-JZjK5E5F.js} +1 -1
- package/dist/vue/{EmailsSection-B65g0FVS.js → EmailsSection-BLwyQO7B.js} +1 -1
- package/dist/vue/{EventsSection-CxqtVF-o.js → EventsSection-BUEwO-0A.js} +1 -1
- package/dist/vue/{InternalsSection-BJUXE-5F.js → InternalsSection-jhTCuK3j.js} +149 -130
- package/dist/vue/{InternalsTab-DEMjqtlw.js → InternalsTab-521fxYYj.js} +152 -133
- package/dist/vue/{JobsSection-rMIyMb-g.js → JobsSection-21A0yQMq.js} +1 -1
- package/dist/vue/{LogsSection-DmmZVJ7D.js → LogsSection-BmOx8SNa.js} +1 -1
- package/dist/vue/{OverviewSection-BMabyqw-.js → OverviewSection-BRDK3Ony.js} +1 -1
- package/dist/vue/QueriesSection-D2WGsuR4.js +444 -0
- package/dist/vue/QueriesTab-6D_xfi7Q.js +114 -0
- package/dist/vue/{RequestsSection-CTu4jPZ_.js → RequestsSection-DLrjCfcE.js} +1 -1
- package/dist/vue/{RoutesSection-zQZDedL7.js → RoutesSection-CPr9w42B.js} +1 -1
- package/dist/vue/{index-CM3yNVUR.js → index-CYaqRGIT.js} +2 -2
- package/dist/vue/index.js +1 -1
- package/dist/vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/react/InternalsContent-O8ino9oM.js +0 -370
- package/dist/vue/QueriesSection-BfDFwGqH.js +0 -428
- package/dist/vue/QueriesTab-DuTG7cpC.js +0 -106
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){"use strict";var ge,L,st,re,nt,rt,at,it,Fe,je,Oe,ye={},be=[],Cs=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ue=Array.isArray;function Z(e,s){for(var n in s)e[n]=s[n];return e}function Ie(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function we(e,s,n){var r,i,a,l={};for(a in s)a=="key"?r=s[a]:a=="ref"?i=s[a]:l[a]=s[a];if(arguments.length>2&&(l.children=arguments.length>3?ge.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)l[a]===void 0&&(l[a]=e.defaultProps[a]);return Ne(e,l,r,i,null)}function Ne(e,s,n,r,i){var a={type:e,props:s,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++st,__i:-1,__u:0};return i==null&&L.vnode!=null&&L.vnode(a),a}function F(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 Ts(e){if(e.__P&&e.__d){var s=e.__v,n=s.__e,r=[],i=[],a=Z({},s);a.__v=s.__v+1,L.vnode&&L.vnode(a),Be(e.__P,a,s,e.__n,e.__P.namespaceURI,32&s.__u?[n]:null,r,n??oe(s),!!(32&s.__u),i),a.__v=s.__v,a.__.__k[a.__i]=a,pt(r,a,i),s.__e=s.__=null,a.__e!=n&<(a)}}function lt(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}),lt(e)}function ot(e){(!e.__d&&(e.__d=!0)&&re.push(e)&&!xe.__r++||nt!=L.debounceRendering)&&((nt=L.debounceRendering)||rt)(xe)}function xe(){for(var e,s=1;re.length;)re.length>s&&re.sort(at),e=re.shift(),s=re.length,Ts(e);xe.__r=0}function ct(e,s,n,r,i,a,l,o,c,d,u){var h,v,p,f,_,k,S,b=r&&r.__k||be,m=s.length;for(c=Ls(n,s,b,c,m),h=0;h<m;h++)(p=n.__k[h])!=null&&(v=p.__i!=-1&&b[p.__i]||ye,p.__i=h,k=Be(e,p,v,i,a,l,o,c,d,u),f=p.__e,p.ref&&v.ref!=p.ref&&(v.ref&&He(v.ref,null,p),u.push(p.ref,p.__c||f,p)),_==null&&f!=null&&(_=f),(S=!!(4&p.__u))||v.__k===p.__k?c=dt(p,c,e,S):typeof p.type=="function"&&k!==void 0?c=k:f&&(c=f.nextSibling),p.__u&=-7);return n.__e=_,c}function Ls(e,s,n,r,i){var a,l,o,c,d,u=n.length,h=u,v=0;for(e.__k=new Array(i),a=0;a<i;a++)(l=s[a])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=e.__k[a]=Ne(null,l,null,null,null):ue(l)?l=e.__k[a]=Ne(F,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=e.__k[a]=Ne(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[a]=l,c=a+v,l.__=e,l.__b=e.__b+1,o=null,(d=l.__i=Es(l,n,c,h))!=-1&&(h--,(o=n[d])&&(o.__u|=2)),o==null||o.__v==null?(d==-1&&(i>u?v--:i<u&&v++),typeof l.type!="function"&&(l.__u|=4)):d!=c&&(d==c-1?v--:d==c+1?v++:(d>c?v--:v++,l.__u|=4))):e.__k[a]=null;if(h)for(a=0;a<u;a++)(o=n[a])!=null&&(2&o.__u)==0&&(o.__e==r&&(r=oe(o)),mt(o,o));return r}function dt(e,s,n,r){var i,a;if(typeof e.type=="function"){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,s=dt(i[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"||(ue(e)?e.some(function(n){ke(n,s)}):s.push(e)),s}function Es(e,s,n,r){var i,a,l,o=e.key,c=e.type,d=s[n],u=d!=null&&(2&d.__u)==0;if(d===null&&o==null||u&&o==d.key&&c==d.type)return n;if(r>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<s.length;)if((d=s[l=i>=0?i--:a++])!=null&&(2&d.__u)==0&&o==d.key&&c==d.type)return l}return-1}function ht(e,s,n){s[0]=="-"?e.setProperty(s,n??""):e[s]=n==null?"":typeof n!="number"||Cs.test(s)?n:n+"px"}function Se(e,s,n,r,i){var a,l;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||ht(e.style,s,"");if(n)for(s in n)r&&n[s]==r[s]||ht(e.style,s,n[s])}else if(s[0]=="o"&&s[1]=="n")a=s!=(s=s.replace(it,"$1")),l=s.toLowerCase(),s=l in e||s=="onFocusOut"||s=="onFocusIn"?l.slice(2):s.slice(2),e.l||(e.l={}),e.l[s+a]=n,n?r?n.u=r.u:(n.u=Fe,e.addEventListener(s,a?Oe:je,a)):e.removeEventListener(s,a?Oe:je,a);else{if(i=="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 ut(e){return function(s){if(this.l){var n=this.l[s.type+e];if(s.t==null)s.t=Fe++;else if(s.t<n.u)return;return n(L.event?L.event(s):s)}}}function Be(e,s,n,r,i,a,l,o,c,d){var u,h,v,p,f,_,k,S,b,m,x,y,A,P,D,R=s.type;if(s.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[o=s.__e=n.__e]),(u=L.__b)&&u(s);e:if(typeof R=="function")try{if(S=s.props,b="prototype"in R&&R.prototype.render,m=(u=R.contextType)&&r[u.__c],x=u?m?m.props.value:u.__:r,n.__c?k=(h=s.__c=n.__c).__=h.__E:(b?s.__c=h=new R(S,x):(s.__c=h=new X(S,x),h.constructor=R,h.render=Ps),m&&m.sub(h),h.state||(h.state={}),h.__n=r,v=h.__d=!0,h.__h=[],h._sb=[]),b&&h.__s==null&&(h.__s=h.state),b&&R.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Z({},h.__s)),Z(h.__s,R.getDerivedStateFromProps(S,h.__s))),p=h.props,f=h.state,h.__v=s,v)b&&R.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),b&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(b&&R.getDerivedStateFromProps==null&&S!==p&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(S,x),s.__v==n.__v||!h.__e&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(S,h.__s,x)===!1){s.__v!=n.__v&&(h.props=S,h.state=h.__s,h.__d=!1),s.__e=n.__e,s.__k=n.__k,s.__k.some(function(H){H&&(H.__=s)}),be.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&l.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(S,h.__s,x),b&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(p,f,_)})}if(h.context=x,h.props=S,h.__P=e,h.__e=!1,y=L.__r,A=0,b)h.state=h.__s,h.__d=!1,y&&y(s),u=h.render(h.props,h.state,h.context),be.push.apply(h.__h,h._sb),h._sb=[];else do h.__d=!1,y&&y(s),u=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++A<25);h.state=h.__s,h.getChildContext!=null&&(r=Z(Z({},r),h.getChildContext())),b&&!v&&h.getSnapshotBeforeUpdate!=null&&(_=h.getSnapshotBeforeUpdate(p,f)),P=u!=null&&u.type===F&&u.key==null?ft(u.props.children):u,o=ct(e,ue(P)?P:[P],s,n,r,i,a,l,o,c,d),h.base=s.__e,s.__u&=-161,h.__h.length&&l.push(h),k&&(h.__E=h.__=null)}catch(H){if(s.__v=null,c||a!=null)if(H.then){for(s.__u|=c?160:128;o&&o.nodeType==8&&o.nextSibling;)o=o.nextSibling;a[a.indexOf(o)]=null,s.__e=o}else{for(D=a.length;D--;)Ie(a[D]);Ue(s)}else s.__e=n.__e,s.__k=n.__k,H.then||Ue(s);L.__e(H,s,n)}else a==null&&s.__v==n.__v?(s.__k=n.__k,s.__e=n.__e):o=s.__e=As(n.__e,s,n,r,i,a,l,c,d);return(u=L.diffed)&&u(s),128&s.__u?void 0:o}function Ue(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ue))}function pt(e,s,n){for(var r=0;r<n.length;r++)He(n[r],n[++r],n[++r]);L.__c&&L.__c(s,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){L.__e(a,i.__v)}})}function ft(e){return typeof e!="object"||e==null||e.__b>0?e:ue(e)?e.map(ft):Z({},e)}function As(e,s,n,r,i,a,l,o,c){var d,u,h,v,p,f,_,k=n.props||ye,S=s.props,b=s.type;if(b=="svg"?i="http://www.w3.org/2000/svg":b=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((p=a[d])&&"setAttribute"in p==!!b&&(b?p.localName==b:p.nodeType==3)){e=p,a[d]=null;break}}if(e==null){if(b==null)return document.createTextNode(S);e=document.createElementNS(i,b,S.is&&S),o&&(L.__m&&L.__m(s,a),o=!1),a=null}if(b==null)k===S||o&&e.data==S||(e.data=S);else{if(a=a&&ge.call(e.childNodes),!o&&a!=null)for(k={},d=0;d<e.attributes.length;d++)k[(p=e.attributes[d]).name]=p.value;for(d in k)p=k[d],d=="dangerouslySetInnerHTML"?h=p:d=="children"||d in S||d=="value"&&"defaultValue"in S||d=="checked"&&"defaultChecked"in S||Se(e,d,null,p,i);for(d in S)p=S[d],d=="children"?v=p:d=="dangerouslySetInnerHTML"?u=p:d=="value"?f=p:d=="checked"?_=p:o&&typeof p!="function"||k[d]===p||Se(e,d,p,k[d],i);if(u)o||h&&(u.__html==h.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),s.__k=[];else if(h&&(e.innerHTML=""),ct(s.type=="template"?e.content:e,ue(v)?v:[v],s,n,r,b=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,l,a?a[0]:n.__k&&oe(n,0),o,c),a!=null)for(d=a.length;d--;)Ie(a[d]);o||(d="value",b=="progress"&&f==null?e.removeAttribute("value"):f!=null&&(f!==e[d]||b=="progress"&&!f||b=="option"&&f!=k[d])&&Se(e,d,f,k[d],i),d="checked",_!=null&&_!=e[d]&&Se(e,d,_,k[d],i))}return e}function He(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(i){L.__e(i,n)}}function mt(e,s,n){var r,i;if(L.unmount&&L.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||He(r,null,s)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){L.__e(a,s)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&mt(r[i],s,n||typeof e.type!="function");n||Ie(e.__e),e.__c=e.__=e.__e=void 0}function Ps(e,s,n){return this.constructor(e,n)}function Rs(e,s,n){var r,i,a,l;s==document&&(s=document.documentElement),L.__&&L.__(e,s),i=(r=!1)?null:s.__k,a=[],l=[],Be(s,e=s.__k=we(F,null,[e]),i||ye,ye,s.namespaceURI,i?null:s.firstChild?ge.call(s.childNodes):null,a,i?i.__e:s.firstChild,r,l),pt(a,e,l)}ge=be.slice,L={__e:function(e,s,n,r){for(var i,a,l;s=s.__;)if((i=s.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),l=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),l=i.__d),l)return i.__E=i}catch(o){e=o}throw e}},st=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),ot(this))},X.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ot(this))},X.prototype.render=F,re=[],rt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,at=function(e,s){return e.__v.__b-s.__v.__b},xe.__r=0,it=/(PointerCapture)$|Capture$/i,Fe=0,je=ut(!1),Oe=ut(!0);var Ms=0;function t(e,s,n,r,i,a){s||(s={});var l,o,c=s;if("ref"in c)for(o in c={},s)o=="ref"?l=s[o]:c[o]=s[o];var d={type:e,props:c,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ms,__i:-1,__u:0,__source:i,__self:a};if(typeof e=="function"&&(l=e.defaultProps))for(o in l)c[o]===void 0&&(c[o]=l[o]);return L.vnode&&L.vnode(d),d}var pe,O,ze,vt,fe=0,_t=[],B=L,gt=B.__b,yt=B.__r,bt=B.diffed,wt=B.__c,Nt=B.unmount,xt=B.__;function We(e,s){B.__h&&B.__h(O,e,fe||s),fe=0;var n=O.__H||(O.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function N(e){return fe=1,Ds($t,e)}function Ds(e,s,n){var r=We(pe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(s):$t(void 0,s),function(o){var c=r.__N?r.__N[0]:r.__[0],d=r.t(c,o);c!==d&&(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=O,!O.__f)){var i=function(o,c,d){if(!r.__c.__H)return!0;var u=r.__c.__H.__.filter(function(v){return v.__c});if(u.every(function(v){return!v.__N}))return!a||a.call(this,o,c,d);var h=r.__c.props!==o;return u.some(function(v){if(v.__N){var p=v.__[0];v.__=v.__N,v.__N=void 0,p!==v.__[0]&&(h=!0)}}),a&&a.call(this,o,c,d)||h};O.__f=!0;var a=O.shouldComponentUpdate,l=O.componentWillUpdate;O.componentWillUpdate=function(o,c,d){if(this.__e){var u=a;a=void 0,i(o,c,d),a=u}l&&l.call(this,o,c,d)},O.shouldComponentUpdate=i}return r.__N||r.__}function V(e,s){var n=We(pe++,3);!B.__s&&St(n.__H,s)&&(n.__=e,n.u=s,O.__H.__h.push(n))}function z(e){return fe=5,W(function(){return{current:e}},[])}function W(e,s){var n=We(pe++,7);return St(n.__H,s)&&(n.__=e(),n.__H=s,n.__h=e),n.__}function E(e,s){return fe=8,W(function(){return e},s)}function qs(){for(var e;e=_t.shift();){var s=e.__H;if(e.__P&&s)try{s.__h.some($e),s.__h.some(Ve),s.__h=[]}catch(n){s.__h=[],B.__e(n,e.__v)}}}B.__b=function(e){O=null,gt&>(e)},B.__=function(e,s){e&&s.__k&&s.__k.__m&&(e.__m=s.__k.__m),xt&&xt(e,s)},B.__r=function(e){yt&&yt(e),pe=0;var s=(O=e.__c).__H;s&&(ze===O?(s.__h=[],O.__h=[],s.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(s.__h.some($e),s.__h.some(Ve),s.__h=[],pe=0)),ze=O},B.diffed=function(e){bt&&bt(e);var s=e.__c;s&&s.__H&&(s.__H.__h.length&&(_t.push(s)!==1&&vt===B.requestAnimationFrame||((vt=B.requestAnimationFrame)||Fs)(qs)),s.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),ze=O=null},B.__c=function(e,s){s.some(function(n){try{n.__h.some($e),n.__h=n.__h.filter(function(r){return!r.__||Ve(r)})}catch(r){s.some(function(i){i.__h&&(i.__h=[])}),s=[],B.__e(r,n.__v)}}),wt&&wt(e,s)},B.unmount=function(e){Nt&&Nt(e);var s,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{$e(r)}catch(i){s=i}}),n.__H=void 0,s&&B.__e(s,n.__v))};var kt=typeof requestAnimationFrame=="function";function Fs(e){var s,n=function(){clearTimeout(r),kt&&cancelAnimationFrame(s),setTimeout(e)},r=setTimeout(n,35);kt&&(s=requestAnimationFrame(n))}function $e(e){var s=O,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),O=s}function Ve(e){var s=O;e.__c=e.__(),O=s}function St(e,s){return!e||e.length!==s.length||s.some(function(n,r){return n!==e[r]})}function $t(e,s){return typeof s=="function"?s(e):s}function js(e,s){for(var n in s)e[n]=s[n];return e}function Ct(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 Tt(e,s){this.props=e,this.context=s}(Tt.prototype=new X).isPureReactComponent=!0,Tt.prototype.shouldComponentUpdate=function(e,s){return Ct(this.props,e)||Ct(this.state,s)};var Lt=L.__b;L.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Lt&&Lt(e)};var Os=L.__e;L.__e=function(e,s,n,r){if(e.then){for(var i,a=s;a=a.__;)if((i=a.__c)&&i.__c)return s.__e==null&&(s.__e=n.__e,s.__k=n.__k),i.__c(e,s)}Os(e,s,n,r)};var Et=L.unmount;function At(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=js({},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 At(r,s,n)})),e}function Pt(e,s,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Pt(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 Rt(e){if(!e.__)return null;var s=e.__.__c;return s&&s.__a&&s.__a(e)}function Q(e){var s,n,r,i=null;function a(l){if(s||(s=e()).then(function(o){o&&(i=o.default||o),r=!0},function(o){n=o,r=!0}),n)throw n;if(!r)throw s;return i?we(i,l):null}return a.displayName="Lazy",a.__f=!0,a}function Te(){this.i=null,this.l=null}L.unmount=function(e){var s=e.__c;s&&(s.__z=!0),s&&s.__R&&s.__R(),s&&32&e.__u&&(e.type=null),Et&&Et(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 i=Rt(r.__v),a=!1,l=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=l;var o=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var d=r.state.__a;r.__v.__k[0]=Pt(d,d.__c.__P,d.__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(l,l)},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]=At(this.__b,n,r.__O=r.__P)}this.__b=null}var i=s.__a&&we(F,null,e.fallback);return i&&(i.__u&=-33),[we(F,null,s.__a?null:e.children),i]};var Mt=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]}};(Te.prototype=new X).__a=function(e){var s=this,n=Rt(s.__v),r=s.l.get(e);return r[0]++,function(i){var a=function(){s.props.revealOrder?(r.push(i),Mt(s,e,r)):i()};n?n(a):a()}},Te.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},Te.prototype.componentDidUpdate=Te.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(s,n){Mt(e,n,s)})};var Is=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Bs=/^(?: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]/,Us=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Hs=/[A-Z0-9]/g,zs=typeof document<"u",Ws=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 Dt=L.event;function Vs(){}function Ks(){return this.cancelBubble}function Qs(){return this.defaultPrevented}L.event=function(e){return Dt&&(e=Dt(e)),e.persist=Vs,e.isPropagationStopped=Ks,e.isDefaultPrevented=Qs,e.nativeEvent=e};var Js={enumerable:!1,configurable:!0,get:function(){return this.class}},qt=L.vnode;L.vnode=function(e){typeof e.type=="string"&&(function(s){var n=s.props,r=s.type,i={},a=r.indexOf("-")===-1;for(var l in n){var o=n[l];if(!(l==="value"&&"defaultValue"in n&&o==null||zs&&l==="children"&&r==="noscript"||l==="class"||l==="className")){var c=l.toLowerCase();l==="defaultValue"&&"value"in n&&n.value==null?l="value":l==="download"&&o===!0?o="":c==="translate"&&o==="no"?o=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?l="ondblclick":c!=="onchange"||r!=="input"&&r!=="textarea"||Ws(n.type)?c==="onfocus"?l="onfocusin":c==="onblur"?l="onfocusout":Us.test(l)&&(l=c):c=l="oninput":a&&Bs.test(l)?l=l.replace(Hs,"-$&").toLowerCase():o===null&&(o=void 0),c==="oninput"&&i[l=c]&&(l="oninputCapture"),i[l]=o}}r=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=ke(n.children).forEach(function(d){d.props.selected=i.value.indexOf(d.props.value)!=-1})),r=="select"&&i.defaultValue!=null&&(i.value=ke(n.children).forEach(function(d){d.props.selected=i.multiple?i.defaultValue.indexOf(d.props.value)!=-1:i.defaultValue==d.props.value})),n.class&&!n.className?(i.class=n.class,Object.defineProperty(i,"className",Js)):n.className&&(i.class=i.className=n.className),s.props=i})(e),e.$$typeof=Is,qt&&qt(e)};var Ft=L.__r;L.__r=function(e){Ft&&Ft(e),e.__c};var jt=L.diffed;L.diffed=function(e){jt&&jt(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 Ot={Fragment:F};const j={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 Gs(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(i){return r},beforeUnsubscribe(i){return r}}}async function Ys(){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 Zs(e){let s=null,n=null,r=!1;return{subscribe:async()=>{try{const l=await Ys();if(!l)throw new Error("Transmit client not available (neither window.Transmit nor @adonisjs/transmit-client)");if(r)return;s=new l(Gs(e.baseUrl,e.authToken)),n=s.subscription(e.channelName),n.onMessage(o=>{r||e.onMessage(o)}),await n.create()}catch(l){e.onError?.(l)}},unsubscribe:async()=>{r=!0;try{await n?.delete(),n=null,s=null}catch{}}}}function Xs(e){let s=!1;const n=Zs({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 Ke extends Error{status;constructor(s=403){super(`Unauthorized (HTTP ${s})`),this.name="UnauthorizedError",this.status=s}}class en extends Error{status;body;constructor(s,n){super(`API error (HTTP ${s})`),this.name="ApiError",this.status=s,this.body=n}}class Qe{baseUrl;authToken;constructor(s){this.baseUrl=s.baseUrl.replace(/\/+$/,""),this.authToken=s.authToken}async fetch(s,n){const i={...{Accept:"application/json",...this.authToken?{Authorization:`Bearer ${this.authToken}`}:{}},...n?.headers},a=await globalThis.fetch(`${this.baseUrl}${s}`,{...n,headers:i,credentials:this.authToken?"omit":"include"});if(n?.signal?.aborted)throw new DOMException("The operation was aborted.","AbortError");if(a.status===401||a.status===403)throw new Ke(a.status);if(!a.ok){const l=await a.text().catch(()=>"");throw new en(a.status,l)}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 tn=5e3,It=1e4,Bt=100,sn=500,nn={overview:"/overview",requests:"/requests",queries:"/queries",events:"/events",routes:"/routes",logs:"/logs",emails:"/emails",timeline:"/traces",cache:"/cache",jobs:"/jobs",config:"/config"};function rn(e){return nn[e]||`/${e}`}class an{constructor(s,n){this.client=s,this.basePath=n}async fetchSection(s,n,r){const i=rn(s),a=n?`${this.basePath}${i}?${n}`:`${this.basePath}${i}`;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){return this.client.fetch(`${this.basePath}/cache/${encodeURIComponent(s)}`)}async deleteCacheKey(s){return this.client.fetch(`${this.basePath}/cache/${encodeURIComponent(s)}`,{method:"DELETE"})}async fetchEmailPreview(s){return this.client.fetch(`${this.basePath}/emails/${s}/preview`)}}function ln(e){if(!e||typeof e!="object")return!1;const s=e;return s.data!==void 0&&s.meta!==void 0}function on(e,s){return s.aborted?!0:e instanceof DOMException&&e.name==="AbortError"}const cn=[{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 dn(e){const s=new URLSearchParams,n=e;for(const{key:r,param:i,isNumeric:a}of cn){const l=n[r];(a?l!=null:l)&&s.set(i,String(l))}if(e.filters)for(const[r,i]of Object.entries(e.filters))i&&s.set(r,i);return s.toString()}function hn(e,s,n=2){if(s<=1)return[1];const r=[],i=Math.max(2,e-n),a=Math.min(s-1,e+n);r.push(1),i>2&&r.push("...");for(let l=i;l<=a;l++)r.push(l);return a<s-1&&r.push("..."),s>1&&r.push(s),r}class un{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 Qe({baseUrl:s.baseUrl,authToken:s.authToken}),this.api=new an(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 i=await this.executeFetch(n);if(this.isStaleResponse(r))return;this.applyFetchResult(i)}catch(i){if(this.shouldIgnoreError(i,n.signal,r))return;this.handleFetchError(i,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 i=`${this.endpoint}/${s}`;try{const a=n==="post"?await this.client.post(i,r):await this.client.delete(i);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 on(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 dn({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){ln(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 Ke){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"?tn:It;this.timer=setInterval(()=>this.fetch(!0),s)}stopRefreshTimer(){this.timer&&(clearInterval(this.timer),this.timer=null)}}function pn(e,s){return new un({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 fn(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 mn(){const[e,s]=N(null),[n,r]=N(null),[i,a]=N(!0),[l,o]=N(null);return{data:e,setData:s,meta:n,setMeta:r,isLoading:i,setIsLoading:a,error:l,setError:o}}function vn(e){const s=E(()=>{e.current?.fetch(!0)},[]),n=E(async(i,a="post",l)=>e.current.mutate(i,a,l),[]),r=E(()=>e.current.getApi(),[]);return{refresh:s,mutate:n,getApi:r}}function _n(e,s,n,r){e.current||(e.current=pn(s,{...n,setData:i=>r.setData(i),setMeta:r.setMeta,setIsLoading:r.setIsLoading,setError:r.setError}))}function gn(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 K(e,s={}){const n=gn(s),r=mn(),i=z(null),a=z(e),l=z(!1);_n(i,e,n,r),V(()=>{const c=a.current;return a.current=e,l.current=fn({ctrl:i.current,section:e,prevSection:c,hasFetched:l.current},n),()=>{i.current.stop()}},[e,n.page,n.perPage,n.search,n.sort,n.sortDir,n.filters,n.timeRange,n.refreshKey]);const o=vn(i);return{data:r.data,meta:r.meta,isLoading:r.isLoading,error:r.error,...o}}const yn=["tracing","process","system","http","db","redis","queues","cache","app","log","emails","dashboard"],Ut="/admin/api/debug",Ht={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 bn(e){const s={customPanes:e.customPanes??[]},n=e.features;for(const r of yn)s[r]=n?.[r]??!1;return s}async function wn(e,s=Ut){const n=`${s.replace(/\/+$/,"")}/config`;return e.fetch(n)}async function Nn(e){const{baseUrl:s="",debugEndpoint:n=Ut,authToken:r}=e,i=new Qe({baseUrl:s,authToken:r});try{const a=await wn(i,n);return bn(a)}catch{return Ht}}function xn(e={}){const{baseUrl:s="",debugEndpoint:n="/admin/api/debug",authToken:r}=e,[i,a]=N(Ht),[l,o]=N(!0),[c,d]=N(null),u=z(!1);return V(()=>{if(u.current)return;u.current=!0;let h=!1;return(async()=>{try{const p=await Nn({baseUrl:s,debugEndpoint:n,authToken:r});h||(a(p),o(!1))}catch(p){h||(d(p instanceof Error?p:new Error(String(p))),o(!1))}})(),()=>{h=!0}},[s,n,r]),{features:i,isLoading:l,error:c}}const Le="ss-dash-theme",Je="ss-theme-change";function Ee(){if(typeof window>"u")return"light";const e=localStorage.getItem(Le);return e==="dark"||e==="light"?e:window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function kn(e){typeof window>"u"||(localStorage.setItem(Le,e),window.dispatchEvent(new CustomEvent(Je,{detail:e})))}function Sn(){const s=Ee()==="dark"?"light":"dark";return kn(s),s}function zt(e){if(typeof window>"u")return()=>{};const s=a=>{const l=a.detail;(l==="dark"||l==="light")&&e(l)},n=a=>{if(a.key===Le){const l=a.newValue;e(l==="dark"||l==="light"?l:Ee())}},r=window.matchMedia("(prefers-color-scheme: dark)"),i=a=>{localStorage.getItem(Le)||e(a.matches?"dark":"light")};return window.addEventListener(Je,s),window.addEventListener("storage",n),r.addEventListener("change",i),()=>{window.removeEventListener(Je,s),window.removeEventListener("storage",n),r.removeEventListener("change",i)}}function $n(){const[e,s]=N(()=>Ee());V(()=>zt(i=>{s(i)}),[]);const n=E(()=>{const r=Sn();return s(r),r},[]);return{theme:e,toggleTheme:n}}function Cn({theme:e,onToggle:s,className:n="",classPrefix:r="ss-dash"}){const i=e==="dark";return t("button",{type:"button",className:`${r==="ss-dbg"?"ss-dbg-theme-toggle":"ss-dash-theme-btn"} ${n}`,onClick:s,title:i?"Switch to light theme":"Switch to dark theme","aria-label":i?"Switch to light theme":"Switch to dark theme",children:i?t("svg",{width:"16",height:"16",viewBox:j.sun.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j.sun.elements.join("")}}):t("svg",{width:"16",height:"16",viewBox:j.moon.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j.moon.elements.join("")}})})}const Tn=["overview","requests","queries","events","routes","logs","emails","cache","jobs","config","internals"],Ln=Q(()=>Promise.resolve().then(()=>fr)),En=Q(()=>Promise.resolve().then(()=>Mr)),An=Q(()=>Promise.resolve().then(()=>Fr)),Pn=Q(()=>Promise.resolve().then(()=>jr)),Rn=Q(()=>Promise.resolve().then(()=>Or)),Mn=Q(()=>Promise.resolve().then(()=>Ir)),Dn=Q(()=>Promise.resolve().then(()=>Ur)),qn=Q(()=>Promise.resolve().then(()=>zr)),Fn=Q(()=>Promise.resolve().then(()=>Gr)),jn=Q(()=>Promise.resolve().then(()=>ra)),On=Q(()=>Promise.resolve().then(()=>ga));function In(e){const{baseUrl:s="",dashboardEndpoint:n="/__stats/api",debugEndpoint:r,authToken:i,backUrl:a="/",channelName:l="server-stats/dashboard"}=e,{features:o}=xn({baseUrl:s,debugEndpoint:r,authToken:i}),{theme:c,toggleTheme:d}=$n(),[u,h]=N("overview"),[v,p]=N(()=>typeof window>"u"?!1:localStorage.getItem("ss-dash-sidebar")==="collapsed"),[f,_]=N(!1),[k,S]=N(0),b=z(0);V(()=>{if(!l)return;const T=Xs({baseUrl:s,channelName:l,authToken:i,onMessage:()=>{b.current+=1,S(b.current)},onConnect:()=>_(!0),onDisconnect:()=>_(!1),onError:()=>_(!1)});return()=>T.unsubscribe()},[s,l,i]);const m=o.customPanes||[],x=E(T=>{const q=T.replace("#","").split("?")[0];return q&&[...Tn,...m.map(w=>w.id)].includes(q)?q:"overview"},[m]);V(()=>{if(typeof window>"u")return;const T=x(window.location.hash);(T!=="overview"||window.location.hash)&&h(T)},[x]),V(()=>{const T=()=>{const q=x(window.location.hash);q!==u&&h(q)};return window.addEventListener("hashchange",T),()=>window.removeEventListener("hashchange",T)},[u,x]),V(()=>{typeof window>"u"||(window.location.hash=u)},[u]);const y=E(()=>{p(T=>{const q=!T;return localStorage.setItem("ss-dash-sidebar",q?"collapsed":"expanded"),q})},[]),A=W(()=>[{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]),P=W(()=>A.filter(T=>T.visible),[A]),D=W(()=>({baseUrl:s,dashboardEndpoint:n,authToken:i,refreshKey:k}),[s,n,i,k]),{data:R}=K("overview",D),H=W(()=>{if(!R)return{};const T={};if(R.totalRequests>0&&(T.requests={count:R.totalRequests}),R.queryStats?.total>0&&(T.queries={count:R.queryStats.total}),R.logLevelBreakdown){const q=R.logLevelBreakdown,G=q.error+q.warn+q.info+q.debug;G>0&&(T.logs={count:G})}return T},[R]),M=E(()=>{const T={overview:t(Ln,{options:D}),requests:t(En,{options:D}),queries:t(An,{options:D}),events:t(Pn,{options:D}),routes:t(Rn,{options:D}),logs:t(Mn,{options:D}),emails:t(Dn,{options:D}),cache:t(qn,{options:D}),jobs:t(Fn,{options:D}),config:t(jn,{options:D}),internals:t(On,{options:D,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[u]||t("div",{className:"ss-dash-empty",children:"Unknown section"})})})})},[u,D]);return t("div",{className:"ss-dash","data-theme":c,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 ${f?"ss-dash-connected":""}`,id:"ss-dash-live-dot"}),t("span",{className:`ss-dash-live-label ${f?"ss-dash-connected":""}`,id:"ss-dash-live-label",children:f?"Live":"Polling"})]}),t("div",{className:"ss-dash-header-right",children:[t(Cn,{theme:c,onToggle:d}),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 ${v?"ss-dash-collapsed":""}`,id:"ss-dash-sidebar",children:[t("nav",{className:"ss-dash-nav",children:[P.map(T=>{const q=H[T.id];return t("button",{type:"button",className:`ss-dash-nav-item ${u===T.id?"ss-dash-active":""}`,"data-ss-section":T.id,onClick:()=>{T.id!==u&&h(T.id)},title:v?T.label:void 0,children:[t("span",{className:"ss-dash-nav-icon",children:t("svg",{width:"20",height:"20",viewBox:(j[T.id]||j.config).viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:(j[T.id]||j.config).elements.join("")}})}),t("span",{className:"ss-dash-nav-label",children:T.label}),q&&q.count>0&&t("span",{className:`ss-dash-nav-badge${q.variant?" "+q.variant:""}`,children:q.count})]},T.id)}),m.length>0&&t("div",{className:"ss-dash-nav-sep"}),m.map(T=>t("button",{type:"button",className:`ss-dash-nav-item ${u===T.id?"ss-dash-active":""}`,onClick:()=>h(T.id),title:v?T.label:void 0,children:[t("span",{className:"ss-dash-nav-icon",children:t("svg",{width:"20",height:"20",viewBox:j["custom-pane"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j["custom-pane"].elements.join("")}})}),t("span",{className:"ss-dash-nav-label",children:T.label})]},T.id))]}),t("button",{type:"button",className:"ss-dash-sidebar-toggle",id:"ss-dash-sidebar-toggle",onClick:y,title:v?"Expand sidebar":"Collapse sidebar",children:v?t("svg",{width:"16",height:"16",viewBox:j["chevron-right"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"1.5",dangerouslySetInnerHTML:{__html:j["chevron-right"].elements.join("")}}):t("svg",{width:"16",height:"16",viewBox:j["chevron-left"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"1.5",dangerouslySetInnerHTML:{__html:j["chevron-left"].elements.join("")}})})]}),t("div",{className:"ss-dash-main",children:M()})]})]})}function Bn(e){const s=document.getElementById(e);return s?JSON.parse(s.textContent||"{}"):{}}function Un(){function e(s){document.documentElement.setAttribute("data-theme",s)}e(Ee()),zt(e)}const ce=Bn("ss-dash-config");Un();const Wt=document.getElementById("ss-dash");Wt&&Rs(t(In,{baseUrl:ce.baseUrl,dashboardEndpoint:ce.dashboardEndpoint,debugEndpoint:ce.debugEndpoint,authToken:ce.authToken,backUrl:ce.backUrl,channelName:ce.channelName}),Wt);function U(e,...s){for(const n of s){const r=e[n];if(r!=null)return r}}function Ae(e){return U(e,"createdAt","created_at","timestamp")}function Hn(e){return U(e,"timestamp","createdAt","processedAt","created_at")}function zn(e){return U(e,"statusCode","status_code")}function Wn(e){return U(e,"total_duration","totalDuration","duration")??0}function Vn(e){return U(e,"span_count","spanCount")??0}function Kn(e){return U(e,"warning_count","warningCount")??0}function Vt(e){return U(e,"from_addr","from")??""}function Kt(e){return U(e,"to_addr","to")??""}function Qn(e){return U(e,"cc","cc_addr")??""}function Jn(e){return U(e,"attachment_count","attachmentCount")??0}function Qt(e){return U(e,"event_name","eventName","event")??""}function Jt(e){return U(e,"method","sql_method")??""}function me(e){return U(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 Gn(e){return'"'+(e.length>40?e.slice(0,40)+"...":e)+'"'}function Yn(e,s,n){if(e.length===0)return"[]";const r=e.slice(0,3).map(l=>n(l,30)),i=e.length>3?", ..."+e.length+" items":"",a="["+r.join(", ")+i+"]";return a.length>s?"["+e.length+" items]":a}function Zn(e,s,n){const r=Object.keys(e);if(r.length===0)return"{}";const i=[];for(let c=0;c<Math.min(r.length,4);c++)i.push(r[c]+": "+n(e[r[c]],30));const a=r.length>4?", ...+"+(r.length-4):"",l="{ "+i.join(", ")+a+" }";return l.length<=s?l:"{ "+(r.slice(0,6).join(", ")+(r.length>6?", ...":""))+" }"}function Xn(e){if(!e&&e!==0)return"-";const s=Math.floor(e),n=Math.floor(s/86400),r=Math.floor(s%86400/3600),i=Math.floor(s%3600/60);return n>0?`${n}d ${r}h`:r>0?`${r}h ${i}m`:i>0?`${i}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 Gt(e){return/([+-]\d{2}:?\d{2}|Z)\s*$/.test(e)?e:e+"Z"}function er(e){if(!e)return"-";const s=typeof e=="string"?new Date(Gt(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 Ge(e){if(!e)return"-";const s=typeof e=="string"?new Date(Gt(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 tr(e){return e>sn?"very-slow":e>Bt?"slow":"normal"}function de(e,s="ss-dash"){const n=tr(e);return n==="very-slow"?`${s}-very-slow`:n==="slow"?`${s}-slow`:""}function Ye(e,s=100){return e===null?"null":e===void 0?"-":typeof e=="string"?Gn(e):typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?Yn(e,s,Ye):typeof e=="object"?Zn(e,s,Ye):String(e)}function sr(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 nr(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}const rr={color:"#34d399",fillOpacityTop:.25,fillOpacityBottom:.02,strokeWidth:1.5,width:120,height:32,padding:2};function ar(e){return{...rr,...e}}let ir=0;function lr(){return`ss-grad-${ir++}`}function or(e){if(e.length===0)return null;let s=e[0],n=e[0],r=e[0];for(let i=1;i<e.length;i++){const a=e[i];a<s&&(s=a),a>n&&(n=a),r+=a}return{min:s,max:n,avg:r/e.length}}function cr(e,s){if(e.length<2)return null;const n=ar(s),r=or(e),i=r.max-r.min||1,a=n.width-n.padding*2,l=n.height-n.padding*2,o=n.padding,c=e.length,d=Array.from({length:c});for(let _=0;_<c;_++){const k=o+_/(c-1)*a,S=o+l-(e[_]-r.min)/i*l;d[_]=`${k.toFixed(1)},${S.toFixed(1)}`}const u=d.join(" "),h=(o+a).toFixed(1),v=(o+l).toFixed(1),p=o.toFixed(1),f=`M${d[0]} `+d.slice(1).map(_=>`L${_}`).join(" ")+` L${h},${v} L${p},${v} Z`;return{points:u,areaPath:f,gradientId:lr(),options:n,stats:r}}function Pe({data:e,color:s="#34d399",width:n=120,height:r=32,className:i=""}){const a=W(()=>cr(e,{width:n,height:r}),[e,n,r]),l=W(()=>"ss-grad-"+Math.random().toString(36).slice(2,8),[]),o={"--ss-accent":s};if(!a)return t("div",{className:`ss-dash-sparkline ${i}`,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 c=s||"var(--ss-accent)";return t("div",{className:`ss-dash-sparkline ${i}`,style:o,children:t("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:[t("defs",{children:t("linearGradient",{id:l,x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:c,stopOpacity:"0.25"}),t("stop",{offset:"100%",stopColor:c,stopOpacity:"0.02"})]})}),t("path",{d:a.areaPath,fill:`url(#${l})`}),t("path",{className:"ss-dash-sparkline-line",d:"M"+a.points.replace(/ /g," L"),fill:"none",stroke:c,strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round"})]})})}function ie({ts:e,className:s,style:n}){return e?t("span",{className:s,style:n,title:er(e),children:Ge(e)}):t("span",{className:s,style:n,children:"-"})}const dr=[{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 hr({value:e,onChange:s,className:n=""}){return t("div",{className:`ss-dash-btn-group ${n}`,children:dr.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 ur(e,s){if(e<=0)return[0];const n=e/s,r=Math.pow(10,Math.floor(Math.log10(n))),i=n/r;let a;i<=1?a=r:i<=2?a=2*r:i<=5?a=5*r:a=10*r;const l=[];for(let o=a;o<=e+a*.5;o+=a)l.push(Math.round(o));return l.length===0&&l.push(Math.ceil(e)),l}function Yt(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"})}catch{return""}}function Zt(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],i=e[n+1],a=(r.x+i.x)/2;s+=` C${a.toFixed(1)},${r.y.toFixed(1)} ${a.toFixed(1)},${i.y.toFixed(1)} ${i.x.toFixed(1)},${i.y.toFixed(1)}`}return s}function pr({chartPoints:e}){const s={top:12,right:12,bottom:28,left:38},n=220,r=z(null),[i,a]=N(0);V(()=>{const g=r.current;if(!g)return;a(g.clientWidth);const C=new ResizeObserver(I=>{for(const ee of I)a(ee.contentRect.width)});return C.observe(g),()=>C.disconnect()},[]);const l=i||600,o=l-s.left-s.right,c=n-s.top-s.bottom,d=s.top+c,u=e.map(g=>ae(g,"requestCount","request_count")||g.total||0),h=e.map(g=>ae(g,"errorCount","error_count")),v=Math.max(...u,1),p=Math.ceil(v*1.1),f=h.some(g=>g>0),_=ur(p,4),k=_.length>0?_[_.length-1]:p,S=g=>s.left+g/Math.max(e.length-1,1)*o,b=g=>s.top+c-g/(k||1)*c,m=e.map((g,C)=>({x:S(C),y:b(u[C])})),x=e.map((g,C)=>({x:S(C),y:b(h[C])})),y=Zt(m),A=f?Zt(x):"",P=m.length>1?`${y} L${m[m.length-1].x.toFixed(1)},${d} L${m[0].x.toFixed(1)},${d} Z`:"",D=f&&x.length>1?`${A} L${x[x.length-1].x.toFixed(1)},${d} L${x[0].x.toFixed(1)},${d} Z`:"",R=Math.min(10,e.length),H=Math.max(1,Math.ceil(e.length/R)),[M,T]=N({visible:!1,x:0,idx:-1}),q=E(g=>{const C=m[g].x;T({visible:!0,x:C,idx:g})},[m]),G=E(()=>{T({visible:!1,x:0,idx:-1})},[]),w=120,$=M.visible?Math.max(w/2,Math.min(M.x,l-w/2)):0;return t("div",{ref:r,style:{position:"relative"},children:[t("svg",{viewBox:`0 0 ${l} ${n}`,className:"ss-dash-chart-svg",children:[t("defs",{children:[t("linearGradient",{id:"ss-cg-total",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:"ss-cg-error",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})]})]}),_.map(g=>{const C=b(g);return t("g",{children:[t("line",{x1:s.left,y1:C,x2:l-s.right,y2:C,stroke:"var(--ss-border-faint)",strokeWidth:.5,strokeDasharray:"3,3"}),t("text",{x:s.left-6,y:C,textAnchor:"end",fill:"var(--ss-dim)",fontSize:9,dominantBaseline:"middle",children:g})]},`ytick-${g}`)}),P&&t("path",{d:P,fill:"url(#ss-cg-total)"}),y&&t("path",{d:y,fill:"none",stroke:"var(--ss-accent)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),D&&t("path",{d:D,fill:"url(#ss-cg-error)"}),A&&t("path",{d:A,fill:"none",stroke:"var(--ss-red-fg)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:"4,2"}),e.map((g,C)=>{const I=u[C],ee=h[C],Y=m[C].x,le=m[C].y,ks=o/(e.length||1),Ss=M.visible&&M.idx===C,$s=M.visible&&M.idx!==C;return t("g",{children:[t("rect",{x:Y-ks/2,y:s.top,width:ks,height:c,fill:"transparent",className:"ss-dash-chart-hover-zone","data-idx":C,onMouseEnter:()=>q(C),onMouseLeave:G}),I>0&&t("circle",{cx:Y,cy:le,r:Ss?4:2.5,fill:"var(--ss-accent)",stroke:"var(--ss-surface)",strokeWidth:1,className:"ss-dash-chart-dot","data-idx":C,opacity:$s?.3:1}),ee>0&&t("circle",{cx:Y,cy:x[C].y,r:Ss?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":C,opacity:$s?.3:1})]},C)}),e.map((g,C)=>{if(C%H!==0&&C!==e.length-1)return null;const I=Yt(g.bucket);return I?t("text",{x:S(C),y:n-6,textAnchor:"middle",fill:"var(--ss-dim)",fontSize:9,children:I},`xlabel-${C}`):null})]}),M.visible&&M.idx>=0&&t("div",{className:"ss-dash-chart-tooltip",style:{left:$,top:s.top-4,transform:"translate(-50%, -100%)"},children:[t("div",{children:Yt(e[M.idx].bucket)}),t("div",{children:["Requests: ",u[M.idx]]}),h[M.idx]>0&&t("div",{style:{color:"var(--ss-red-fg)"},children:["Errors: ",h[M.idx]]})]})]})}function Xt({options:e={}}){const[s,n]=N("1h"),{data:r,isLoading:i}=K("overview",e),{data:a}=K("overview/chart",{...e,timeRange:s});if(i&&!r)return t("div",{className:"ss-dash-empty",children:"Loading overview..."});const l=r||{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=l,c=ae(o,"avgResponseTime","avg_response_time"),d=ae(o,"p95ResponseTime","p95_response_time"),u=ae(o,"requestsPerMinute","requests_per_minute"),h=ae(o,"errorRate","error_rate"),p=ae(o,"totalRequests","total_requests")>0,f=a?.buckets||[],_=l.sparklines?.avgResponseTime??f.map(m=>m.avgDuration??0),k=l.sparklines?.p95ResponseTime??f.map(m=>m.p95Duration??0),S=l.sparklines?.requestsPerMinute??f.map(m=>m.requestCount??0),b=l.sparklines?.errorRate??f.map(m=>m.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?c>500?"ss-dash-red":c>200?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:p?te(c):"-"}),t("div",{className:"ss-dash-sparkline",children:t(Pe,{data:_,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?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(Pe,{data:k,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(Pe,{data:S,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?h>5?"ss-dash-red":h>1?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:p?`${h.toFixed(1)}%`:"-"}),t("div",{className:"ss-dash-sparkline",children:t(Pe,{data:b,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(hr,{value:s,onChange:n})]}),t("div",{className:"ss-dash-chart",id:"ss-dash-chart-area",children:f.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"120px"},children:"No data for this range"}):t(pr,{chartPoints:f})}),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"]}),f.some(m=>(m.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"})}),l.slowestEndpoints.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No data yet"}):t("ul",{className:"ss-dash-secondary-list",children:l.slowestEndpoints.slice(0,5).map((m,x)=>{const y=m.url||m.pattern||"-";return t("li",{children:t("a",{href:`#requests?url=${encodeURIComponent(y)}`,className:"ss-dash-widget-row-link",children:[t("span",{title:y,children:y}),t("span",{className:`ss-dash-secondary-list-value ss-dash-duration ${de(m.avgDuration)}`,children:te(m.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:l.queryStats.total})]}),t("li",{children:[t("span",{children:"Avg Duration"}),t("span",{className:"ss-dash-secondary-list-value",children:te(l.queryStats.avgDuration)})]}),t("li",{children:[t("span",{children:"Queries / Request"}),t("span",{className:"ss-dash-secondary-list-value",children:l.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"})}),l.recentErrors.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No recent errors"}):t("ul",{className:"ss-dash-secondary-list",children:l.recentErrors.map((m,x)=>t("li",{children:t("a",{href:`#logs?id=${m.id??""}`,className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},title:m.message,children:m.message}),m.timestamp&&t(ie,{ts:m.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"})}),l.topEvents.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No events yet"}):t("ul",{className:"ss-dash-secondary-list",children:l.topEvents.slice(0,5).map((m,x)=>{const y=Qt(m);return t("li",{children:t("a",{href:`#events?event_name=${encodeURIComponent(y)}`,className:"ss-dash-widget-row-link",children:[t("span",{children:y}),t("span",{className:"ss-dash-secondary-list-value",children:m.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:l.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:l.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:l.emailActivity.failed>0?{color:"var(--ss-red-fg)"}:void 0,children:l.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:l.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:l.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:l.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:l.logLevelBreakdown.debug})]})})]})]}),l.cacheStats&&l.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:l.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:[l.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:l.cacheStats.memoryUsedHuman})]})})]})]}),l.jobQueueStatus&&l.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:l.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:l.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:l.jobQueueStatus.failed>0?{color:"var(--ss-red-fg)"}:void 0,children:l.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:l.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:l.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:l.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:l.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:l.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"})}),l.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:l.slowestQueries.slice(0,5).map((m,x)=>{const y=me(m)||"-";return t("li",{children:t("a",{href:`#queries?pattern=${encodeURIComponent(y)}`,className:"ss-dash-widget-row-link",children:[t("span",{title:y,children:y}),t("span",{className:`ss-dash-secondary-list-value ss-dash-duration ${de(m.avgDuration)}`,children:te(m.avgDuration)})]})},x)})})]})]})]})}const fr=Object.freeze(Object.defineProperty({__proto__:null,OverviewSection:Xt,default:Xt},Symbol.toStringTag,{value:"Module"}));function mr(e){if(!e)return[];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function vr(e){if(!e)return[];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function Ze(e,s,n,r=0){return e[s]??e[n]??r}function _r(e){return{method:e.method||"",url:e.url||"",statusCode:Ze(e,"status_code","statusCode"),totalDuration:Ze(e,"total_duration","totalDuration")||e.duration||0,spanCount:Ze(e,"span_count","spanCount"),spans:mr(e.spans),warnings:vr(e.warnings),logs:e.logs||[],httpRequestId:e.httpRequestId||e.http_request_id||void 0}}function es(e="",s){const n=z(null);return E(()=>(n.current||(n.current=new Qe({baseUrl:e,authToken:s})),n.current),[e,s])}function gr({color:e="muted",children:s,className:n="",classPrefix:r="ss-dash"}){return t("span",{className:`${r}-badge ${r}-badge-${e} ${n}`,children:s})}function Xe({method:e,className:s="",classPrefix:n="ss-dash"}){return t("span",{className:`${n}-method ${n}-method-${e.toLowerCase()} ${s}`,children:e})}function ts({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 yr(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 ss(e){const s={};for(const[n,r]of Object.entries(e))$r.has(n)||(s[n]=r);return Object.keys(s).length>0?s:null}const br=["all","error","warn","info","debug"];function wr(e){return(e.levelName||e.level_name||(typeof e.level=="string"?e.level:"")||"info").toLowerCase()}function Nr(e){return e.msg||e.message||JSON.stringify(e)}function xr(e){return e.createdAt||e.created_at||e.time||e.timestamp||0}function kr(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 Sr(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 $r=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 Cr(e){if(e.data){const s=yr(e.data);if(s){const n=ss(s);if(n)return n}}return ss(e)}function Re({data:e,maxPreviewLength:s=100,className:n="",classPrefix:r="ss-dash",defaultExpanded:i=!1}){const[a,l]=N(i),o=W(()=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},[e]),c=W(()=>typeof o=="object"&&o!==null?Ye(o,s):String(o??"-"),[o,s]),d=W(()=>typeof o=="object"&&o!==null?JSON.stringify(o,null,2):String(o),[o]),u=E(()=>{l(v=>!v)},[]),h=E(async()=>{try{await navigator.clipboard.writeText(d)}catch{}},[d]);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:v=>v.key==="Enter"&&u(),children:c}),a&&t("div",{className:`${r}-data-full`,onClick:u,children:[t("button",{className:`${r}-copy-btn`,onClick:v=>{v.stopPropagation(),h()},title:"Copy to clipboard",type:"button",children:"Copy"}),t("pre",{children:d})]})]})}function ns({log:e,index:s,expanded:n,onToggleExpand:r,onReqIdClick:i}){const a=wr(e),l=Nr(e),o=xr(e),c=kr(e),d=Cr(e);return t(Ot.Fragment,{children:[t("div",{className:`ss-log-entry${d?" ss-log-entry-expandable":""}`,onClick:()=>d&&r(s),children:[t("span",{className:`ss-log-level ${Sr(a,"ss-log-level")}`,children:a.toUpperCase()}),t(ie,{ts:o,className:"ss-log-time"}),c?t("span",{className:"ss-log-reqid",title:c,onClick:i?u=>{u.stopPropagation(),i(c)}:void 0,role:i?"button":void 0,tabIndex:i?0:void 0,onKeyDown:i?u=>{u.key==="Enter"&&(u.stopPropagation(),i(c))}:void 0,children:c.slice(0,8)}):t("span",{className:"ss-log-reqid-empty",children:"--"}),d?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:l})]}),n&&d&&t("div",{className:"ss-log-detail",children:t(Re,{data:d,classPrefix:"ss-dbg",defaultExpanded:!0})})]})}function Tr({logs:e,onReqIdClick:s}){const[n,r]=N(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((i,a)=>t(ns,{log:i,index:a,expanded:n===a,onToggleExpand:l=>r(n===l?null:l),onReqIdClick:s},i.id||a))})]})}function Lr(e){const{container:s,handle:n,topPane:r,bottomPane:i,storageKey:a,minHeight:l=60}=e;if(a){const c=localStorage.getItem(a);if(c){const d=parseFloat(c);d>0&&d<1&&(r.style.flex=`${d}`,i.style.flex=`${1-d}`)}}function o(c){c.preventDefault(),n.setPointerCapture(c.pointerId);const u=s.getBoundingClientRect().height,h=c.clientY,v=r.getBoundingClientRect().height;function p(_){const k=_.clientY-h;let S=v+k;const b=u-l-n.offsetHeight;S=Math.max(l,Math.min(S,b));const m=S/(u-n.offsetHeight);r.style.flex=`${m}`,i.style.flex=`${1-m}`}function f(){if(n.removeEventListener("pointermove",p),n.removeEventListener("pointerup",f),a){const _=s.getBoundingClientRect().height-n.offsetHeight;if(_>0){const k=r.getBoundingClientRect().height/_;localStorage.setItem(a,String(k))}}}n.addEventListener("pointermove",p),n.addEventListener("pointerup",f)}return n.addEventListener("pointerdown",o),()=>{n.removeEventListener("pointerdown",o)}}function Er({children:e,storageKey:s}){const n=z(null),r=z(null),i=z(null),a=z(null);return V(()=>{if(n.current&&r.current&&i.current&&a.current)return Lr({container:n.current,handle:r.current,topPane:i.current,bottomPane:a.current,storageKey:s})},[s]),t("div",{ref:n,className:"ss-split-container",children:[t("div",{ref:i,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 Ar="ss-col-resize",rs="ss-resizing";function as(e){const s=Array.from(e.querySelectorAll("thead th"));if(s.length===0)return()=>{};const n=[];let r=!1;function i(){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 l=function(c){c.preventDefault(),c.stopPropagation(),i();const d=c.clientX,u=a.offsetWidth;o.classList.add(rs),o.setPointerCapture(c.pointerId);function h(p){const f=p.clientX-d,_=Math.max(30,u+f);a.style.width=_+"px"}function v(){o.classList.remove(rs),o.removeEventListener("pointermove",h),o.removeEventListener("pointerup",v)}o.addEventListener("pointermove",h),o.addEventListener("pointerup",v)};if(!a.textContent?.trim())continue;const o=document.createElement("div");o.className=Ar,a.appendChild(o),o.addEventListener("pointerdown",l),n.push(()=>{o.removeEventListener("pointerdown",l),o.remove()})}return()=>{for(const a of n)a()}}function Pr(e=[]){const s=z(null),n=z(null);return V(()=>(s.current&&(n.current?.(),n.current=as(s.current)),()=>{n.current?.(),n.current=null}),e),E(i=>{n.current?.(),n.current=null,s.current=i,i&&(n.current=as(i))},[])}function se({columns:e,data:s,keyField:n="id",sort:r,sortDir:i,onSort:a,onRowClick:l,rowClassName:o,emptyMessage:c="No data",className:d="",renderAfterRow:u}){const h=E(p=>{a&&a(p)},[a]),v=Pr([s,e]);return s.length===0?t("div",{className:"ss-dash-empty",children:c}):t("table",{ref:v,className:`ss-dash-table ${d}`,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?()=>h(p.key):void 0,className:p.sortable?"ss-dash-sortable":"",children:[p.label,r===p.key&&t("span",{className:"ss-dash-sort-arrow",children:i==="asc"?" ▲":" ▼"})]},p.key))})}),t("tbody",{children:s.map((p,f)=>{const _=o?typeof o=="function"?o(p):o:"",k=l?"ss-dash-clickable":"";return t(Ot.Fragment,{children:[t("tr",{onClick:l?()=>l(p):void 0,className:`${k} ${_}`.trim(),children:e.map(S=>t("td",{children:S.render?S.render(p[S.key],p):p[S.key]??"-"},S.key))}),u?u(p,f):null]},p[n]??f)})})]})}function ne({search:e,onSearchChange:s,placeholder:n="Search...",summary:r,children:i,className:a=""}){const l=E(()=>{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:j.search.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j.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:l,children:"×"})]}),i&&t("div",{className:"ss-dbg-filter-controls",children:i})]})}function he({page:e,lastPage:s,total:n,onPageChange:r,className:i=""}){const a=W(()=>hn(e,s),[e,s]),l=E(()=>{e>1&&r(e-1)},[e,r]),o=E(()=>{e<s&&r(e+1)},[e,s,r]);return s<=1?null:t("div",{className:`ss-dash-pagination ${i}`,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:l,disabled:e<=1,children:"« Prev"}),a.map((c,d)=>c==="..."?t("span",{className:"ss-dash-page-ellipsis",children:"..."},`ellipsis-${d}`):t("button",{type:"button",className:`ss-dash-page-btn ${c===e?"ss-dash-active":""}`,onClick:()=>r(c),children:c},c)),t("button",{type:"button",className:"ss-dash-page-btn",onClick:o,disabled:e>=s,children:"Next »"})]})]})}const is={request:"#1e3a5f",middleware:"rgba(30, 58, 95, 0.7)",db:"#6d28d9",view:"#0e7490",mail:"#059669",event:"#b45309",custom:"var(--ss-dim)"},Rr={request:"Request",middleware:"Middleware",db:"DB",mail:"Mail",event:"Event",view:"View",custom:"Custom"};function ls({spans:e,totalDuration:s,className:n="",warnings:r}){const i=e||[],a=W(()=>[...i].sort((o,c)=>o.startOffset-c.startOffset),[i]),l=W(()=>{const o={};for(const c of a)o[c.id]=c.parentId?(o[c.parentId]||0)+1:0;return o},[a]);return i.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(Rr).map(([o,c])=>t("div",{className:"ss-dash-tl-legend-item",children:[t("span",{className:"ss-dash-tl-legend-dot",style:{background:is[o]||is.custom}}),t("span",{children:c})]},o))}),a.map(o=>{const c=s>0?o.startOffset/s*100:0,d=s>0?Math.max(o.duration/s*100,.5):1,u=l[o.id]||0,h=o.label.length>50?o.label.slice(0,50)+"...":o.label,v=o.category==="db"?"DB":o.category,p=o.category==="db"?"purple":o.category==="mail"?"green":o.category==="event"?"amber":o.category==="view"?"blue":"muted",f=o.metadata?Object.entries(o.metadata).filter(([,k])=>k!=null).map(([k,S])=>`${k}=${S}`).join(", "):"",_=f?`${o.label} (${o.duration.toFixed(2)}ms)
|
|
2
|
-
${f}`:`${o.label} (${o.duration.toFixed(2)}ms)`;return t("div",{className:"ss-dash-tl-row",children:[t("div",{className:"ss-dash-tl-label",title:_,style:{paddingLeft:8+u*16+"px"},children:[t("span",{className:`ss-dash-badge ss-dash-badge-${p}`,style:{fontSize:"9px",marginRight:"4px"},children:v}),h]}),t("div",{className:"ss-dash-tl-track",children:t("div",{className:`ss-dash-tl-bar ss-dash-tl-bar-${o.category||"custom"}`,style:{left:`${c}%`,width:`${d}%`},title:_})}),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,c)=>t("div",{className:"ss-dash-tl-warning",children:o},c))]})]})}function os({options:e={}}){const[s,n]=N(1),[r,i]=N(""),[a,l]=N("createdAt"),[o,c]=N("desc"),[d,u]=N(null),[h,v]=N(!1);V(()=>n(1),[r]);const{data:p,meta:f,isLoading:_,error:k}=K("requests",{...e,page:s,search:r,sort:a,sortDir:o}),S=es(e.baseUrl||"",e.authToken),b=E(y=>{const A=y.id;v(!0);const P=e.dashboardEndpoint||"/__stats/api";S().fetch(`${P}/requests/${A}`).then(D=>{const R=D,H=R.trace;if(H){const M={...R,...H,logs:R.logs};u(M)}else u(D);v(!1)}).catch(()=>{v(!1)})},[S,e.dashboardEndpoint]),m=E(y=>{a===y?c(A=>A==="asc"?"desc":"asc"):(l(y),c("desc"))},[a]),x=p||[];if(d){const y=_r(d),A=y.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(Xe,{method:y.method}),t("span",{style:{color:"var(--ss-text)"},children:y.url}),t(ts,{code:y.statusCode}),t("span",{className:"ss-dash-tl-meta",children:[y.totalDuration.toFixed(1),"ms · ",y.spanCount," spans"]})]}),A?t(Er,{storageKey:"ss-requests-split",children:[t(ls,{spans:y.spans,totalDuration:y.totalDuration,warnings:y.warnings}),t(Tr,{logs:y.logs})]}):t(ls,{spans:y.spans,totalDuration:y.totalDuration,warnings:y.warnings})]})}return h?t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:t("button",{type:"button",className:"ss-dash-btn",onClick:()=>v(!1),children:"← Back to Requests"})}),t("div",{className:"ss-dash-empty",children:"Loading request detail..."})]}):t("div",{children:[t(ne,{search:r,onSearchChange:i,placeholder:"Filter requests...",summary:`${f?.total??0} requests`}),k&&t("div",{className:"ss-dash-empty",children:"Failed to load requests"}),_&&!p?t("div",{className:"ss-dash-empty",children:"Loading requests..."}):t(F,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:y=>t("span",{style:{color:"var(--ss-dim)"},children:y})},{key:"method",label:"Method",width:"70px",sortable:!0,render:y=>t(Xe,{method:y})},{key:"url",label:"URL",sortable:!0,render:y=>t("span",{style:{color:"var(--ss-text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:y,children:y})},{key:"statusCode",label:"Status",width:"60px",sortable:!0,render:(y,A)=>{const P=zn(A);return t(ts,{code:P})}},{key:"duration",label:"Duration",width:"80px",sortable:!0,render:(y,A)=>{const P=Wn(A);return t("span",{className:`ss-dash-duration ${de(P)}`,children:[P.toFixed(1),"ms"]})}},{key:"spanCount",label:"Spans",width:"50px",render:(y,A)=>{const P=Vn(A);return t("span",{style:{color:"var(--ss-muted)",textAlign:"center"},children:P})}},{key:"warningCount",label:"⚠",width:"40px",render:(y,A)=>{const P=Kn(A);return P>0?t("span",{style:{color:"var(--ss-amber-fg)",textAlign:"center",display:"block"},children:P}):t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:"-"})}},{key:"createdAt",label:"Time",width:"80px",sortable:!0,render:(y,A)=>{const P=Ae(A)??"";return t(ie,{ts:P,className:"ss-dash-event-time"})}}],data:x,sort:a,sortDir:o,onSort:m,onRowClick:b,emptyMessage:"No requests recorded yet"})}),f&&t(he,{page:f.page,lastPage:f.lastPage,total:f.total,onPageChange:n})]})]})}const Mr=Object.freeze(Object.defineProperty({__proto__:null,RequestsSection:os,default:os},Symbol.toStringTag,{value:"Module"}));function cs({node:e,depth:s=0}){if(!e)return null;const n=s*20,r=e["Node Type"]||"Unknown",i=e["Relation Name"]?t(F,{children:[" on ",t("strong",{children:e["Relation Name"]})]}):null,a=e.Alias&&e.Alias!==e["Relation Name"]?` (${e.Alias})`:"",l=e["Index Name"]?t(F,{children:[" using ",t("em",{children:e["Index Name"]})]}):null,o=[];if(e["Startup Cost"]!==null&&e["Startup Cost"]!==void 0&&o.push(`cost=${e["Startup Cost"]}..${e["Total Cost"]}`),e["Plan Rows"]!==null&&e["Plan Rows"]!==void 0&&o.push(`rows=${e["Plan Rows"]}`),e["Plan Width"]!==null&&e["Plan Width"]!==void 0&&o.push(`width=${e["Plan Width"]}`),e.Filter&&o.push(`filter: ${e.Filter}`),e["Index Cond"]&&o.push(`cond: ${e["Index Cond"]}`),e["Hash Cond"]&&o.push(`hash: ${e["Hash Cond"]}`),e["Join Type"]&&o.push(`join: ${e["Join Type"]}`),e["Sort Key"]){const d=Array.isArray(e["Sort Key"])?e["Sort Key"].join(", "):e["Sort Key"];o.push(`sort: ${d}`)}const c=e.Plans||[];return t("div",{className:"ss-dash-explain-node",style:{marginLeft:`${n}px`},children:[t("div",{className:"ss-dash-explain-node-header",children:[t("span",{className:"ss-dash-explain-node-type",children:r}),i,a,l]}),o.length>0&&t("div",{className:"ss-dash-explain-metrics",children:o.join(" · ")}),c.map((d,u)=>t(cs,{node:d,depth:s+1},u))]})}function Dr({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(s&&s.Plan)return t("div",{className:"ss-dash-explain-result",children:t(cs,{node:s.Plan,depth:0})});if(typeof s=="object"&&s!==null){const n=Object.keys(s);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,i)=>{const a=r;return t("tr",{children:n.map(l=>t("td",{children:a[l]!==null&&a[l]!==void 0?String(a[l]):"-"},l))},i)})})]})})}return t("div",{className:"ss-dash-explain-result",children:"No plan data returned"})}const qr=8;function ds({options:e={}}){const[s,n]=N(1),[r,i]=N(""),[a,l]=N("createdAt"),[o,c]=N("desc"),[d,u]=N("list"),[h,v]=N(null),[p,f]=N(null),[_,k]=N(null),S=E(w=>{w!==d&&(u(w),n(1),l(w==="list"?"createdAt":"count"),c("desc"),v(null),f(null),k(null))},[d]);V(()=>n(1),[r]);const b=d==="grouped"?"queries/grouped":"queries",{data:m,meta:x,isLoading:y,getApi:A}=K(b,{...e,page:s,search:r,sort:a,sortDir:o}),P=E(w=>{a===w?c($=>$==="asc"?"desc":"asc"):(l(w),c("desc"))},[a]),D=E(async w=>{if(p&&p.queryId===w){f(null);return}k(w);try{const $=await A().explainQuery(w);$&&$.error?f({queryId:w,plan:[],error:$.error,message:$.message}):f({queryId:w,plan:$?.plan||$?.rows||[]})}catch($){console.warn("[ss] Query explain failed:",$),f({queryId:w,plan:[],error:$ instanceof Error?$.message:String($)})}finally{k(null)}},[A,p]),R=E(w=>{const $=w.id;return!p||p.queryId!==$?null:t("tr",{className:"ss-dash-explain-row",children:t("td",{colSpan:qr,className:"ss-dash-explain",children:t("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[t("div",{style:{flex:1},children:p.error?t("div",{className:"ss-dash-explain-result ss-dash-explain-error",children:[t("strong",{children:"Error:"})," ",p.error,p.message&&t(F,{children:[t("br",{}),p.message]})]}):t(Dr,{plan:p.plan})}),t("button",{type:"button",className:"ss-dash-explain-btn",onClick:()=>f(null),style:{marginLeft:"8px",flexShrink:0},children:"Close"})]})})})},[p]),H=d==="grouped"?m?.groups||[]:m||[],M=W(()=>d!=="grouped"?H:H.map(w=>{const $={...w};return $.sqlNormalized??=U(w,"sql_normalized","pattern")??void 0,$.count??=U(w,"total_count"),$.avgDuration??=U(w,"avg_duration"),$.maxDuration??=U(w,"max_duration"),$.minDuration??=U(w,"min_duration"),$.totalDuration??=U(w,"total_duration"),$.percentOfTotal??=U(w,"pct_time"),$}),[H,d]),T=W(()=>{const w=x?.total??M.length;let $=0,g=0,C=0,I=0;for(const Y of M){const le=Y.duration||0;C+=le,I++,le>Bt&&$++}const ee=new Map;for(const Y of M){const le=me(Y);ee.set(le,(ee.get(le)||0)+1)}for(const Y of ee.values())Y>1&&(g+=Y);return{total:w,slow:$,duplicates:g,avgDuration:I>0?C/I:0}},[M,x]),q=W(()=>{const w=new Map;for(const $ of M){const g=me($);w.set(g,(w.get(g)||0)+1)}return w},[M]),G=W(()=>{if(d==="grouped")return`${M.length} query patterns`;const w=[`${T.total} queries`];return T.slow>0&&w.push(`${T.slow} slow`),T.duplicates>0&&w.push(`${T.duplicates} dup`),w.push(`avg ${(T.avgDuration||0).toFixed(1)}ms`),w.join(", ")},[d,M.length,T]);return t("div",{children:[t(ne,{search:r,onSearchChange:i,placeholder:"Filter queries...",summary:G,children:t("div",{className:"ss-dash-btn-group",children:[t("button",{type:"button",className:`ss-dash-btn ${d==="list"?"ss-dash-active":""}`,onClick:()=>S("list"),children:"List"}),t("button",{type:"button",className:`ss-dash-btn ${d==="grouped"?"ss-dash-active":""}`,onClick:()=>S("grouped"),children:"Grouped"})]})}),y&&!m?t("div",{className:"ss-dash-empty",children:"Loading queries..."}):d==="grouped"?t(F,{children:t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"sqlNormalized",label:"Pattern",render:(w,$)=>{const g=w||"",C=($.count||0)>=3;return t(F,{children:[t("span",{className:`ss-dash-sql ${h===g?"ss-dash-expanded":""}`,title:"Click to expand",onClick:I=>{I.stopPropagation(),v(h===g?null:g)},role:"button",tabIndex:0,onKeyDown:I=>I.key==="Enter"&&v(h===g?null:g),children:g}),C&&t(F,{children:[" ",t("span",{className:"ss-dash-dup",children:"DUP"})]})]})}},{key:"count",label:"Count",width:"60px",sortable:!0,render:w=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:w||0})},{key:"avgDuration",label:"Avg",width:"70px",sortable:!0,render:w=>{const $=w||0;return t("span",{className:`ss-dash-duration ${de($)}`,children:$.toFixed(2)+"ms"})}},{key:"minDuration",label:"Min",width:"70px",render:w=>t("span",{className:"ss-dash-duration",children:(w||0).toFixed(2)+"ms"})},{key:"maxDuration",label:"Max",width:"70px",render:w=>{const $=w||0;return t("span",{className:`ss-dash-duration ${de($)}`,children:$.toFixed(2)+"ms"})}},{key:"totalDuration",label:"Total",width:"70px",sortable:!0,render:w=>t("span",{className:"ss-dash-duration",children:(w||0).toFixed(1)+"ms"})},{key:"percentOfTotal",label:"% Time",width:"60px",render:w=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:(w||0).toFixed(1)+"%"})}],data:M,keyField:"sqlNormalized",sort:a,sortDir:o,onSort:P,emptyMessage:"No queries recorded"})})}):t(F,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:w=>t("span",{style:{color:"var(--ss-dim)"},children:w})},{key:"sql",label:"SQL",render:(w,$)=>{const g=$.sql||$.sql_text||"";return t("div",{children:[t("span",{className:`ss-dash-sql ${h===$.id?"ss-dash-expanded":""}`,title:"Click to expand",onClick:C=>{C.stopPropagation(),v(h===$.id?null:$.id)},role:"button",tabIndex:0,onKeyDown:C=>C.key==="Enter"&&v(h===$.id?null:$.id),children:g}),(q.get(me($))??0)>1&&t("span",{className:"ss-dash-dup",children:["×",q.get(me($))]})]})}},{key:"duration",label:"Duration",width:"70px",sortable:!0,render:w=>{const $=w||0;return t("span",{className:`ss-dash-duration ${de($)}`,children:$.toFixed(2)+"ms"})}},{key:"method",label:"Method",width:"60px",render:(w,$)=>{const g=Jt($);return t("span",{className:`ss-dash-method ss-dash-method-${g.toLowerCase()}`,children:g})}},{key:"model",label:"Model",width:"90px",render:w=>t("span",{style:{color:"var(--ss-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:w,children:w||"-"})},{key:"connection",label:"Connection",width:"80px",render:w=>t("span",{style:{color:"var(--ss-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w||"-"})},{key:"createdAt",label:"Time",width:"90px",sortable:!0,render:(w,$)=>{const g=w||(Ae($)??"");return t(ie,{ts:g,className:"ss-dash-event-time"})}},{key:"id",label:"",width:"70px",render:(w,$)=>{if(Jt($)!=="select")return null;const C=p?.queryId===$.id&&!p?.error;return t("button",{type:"button",className:`ss-dash-explain-btn${C?" ss-dash-explain-btn-active":""}`,onClick:I=>{I.stopPropagation(),D($.id)},disabled:_===$.id,children:_===$.id?"...":"EXPLAIN"})}}],data:M,sort:a,sortDir:o,onSort:P,emptyMessage:"No queries recorded",renderAfterRow:R})}),x&&t(he,{page:x.page,lastPage:x.lastPage,total:x.total,onPageChange:n})]})]})}const Fr=Object.freeze(Object.defineProperty({__proto__:null,QueriesSection:ds,default:ds},Symbol.toStringTag,{value:"Module"}));function hs({options:e={}}){const[s,n]=N(1),[r,i]=N(""),{data:a,meta:l,isLoading:o}=K("events",{...e,page:s,search:r}),c=a||[];return V(()=>n(1),[r]),t("div",{children:[t(ne,{search:r,onSearchChange:i,placeholder:"Filter events...",summary:`${l?.total??0} events`}),o&&!a?t("div",{className:"ss-dash-empty",children:"Loading events..."}):t(F,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:d=>t("span",{style:{color:"var(--ss-dim)"},children:d})},{key:"eventName",label:"Event",render:(d,u)=>{const h=Qt(u);return t("span",{className:"ss-dash-event-name",title:h,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:h})}},{key:"data",label:"Data",render:d=>t(Re,{data:d,maxPreviewLength:80,className:"ss-dash-event-data"})},{key:"createdAt",label:"Time",width:"80px",render:(d,u)=>{const h=Ae(u);return t(ie,{ts:h,className:"ss-dash-event-time"})}}],data:c,emptyMessage:"No events recorded yet"})}),l&&t(he,{page:l.page,lastPage:l.lastPage,total:l.total,onPageChange:n})]})]})}const jr=Object.freeze(Object.defineProperty({__proto__:null,EventsSection:hs,default:hs},Symbol.toStringTag,{value:"Module"}));function us({options:e={}}){const[s,n]=N(""),{data:r,isLoading:i,error:a}=K("routes",{...e,search:s}),l=r,o=Array.isArray(l)?l:l&&Array.isArray(l.routes)?l.routes:l&&Array.isArray(l.data)?l.data:[],c={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};return t("div",{children:[t(ne,{search:s,onSearchChange:n,placeholder:"Filter routes...",summary:`${o.length} routes`}),a?t("div",{className:"ss-dash-empty",children:"Failed to load routes"}):i&&!r?t("div",{className:"ss-dash-empty",children:"Loading routes..."}):t(F,{children:t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"method",label:"Method",width:"70px",render:d=>t(Xe,{method:d})},{key:"pattern",label:"Pattern",render:d=>t("span",{style:{color:"var(--ss-text)",...c},title:d,children:d})},{key:"name",label:"Name",width:"120px",render:d=>t("span",{style:{color:"var(--ss-muted)",...c},title:d||"-",children:d||"-"})},{key:"handler",label:"Handler",render:d=>t("span",{style:{color:"var(--ss-sql-color)",...c},title:d,children:d})},{key:"middleware",label:"Middleware",render:d=>{const u=d?.length?d.join(", "):"-";return t("span",{style:{color:"var(--ss-dim)",fontSize:"10px",...c},title:u,children:u})}}],data:o,keyField:"pattern",emptyMessage:"No routes available"})})})]})}const Or=Object.freeze(Object.defineProperty({__proto__:null,RoutesSection:us,default:us},Symbol.toStringTag,{value:"Module"}));function ps({options:e={}}){const[s,n]=N(1),[r,i]=N(""),[a,l]=N("all"),[o,c]=N(""),[d,u]=N(""),[h,v]=N([]),[p,f]=N("level"),[_,k]=N("equals"),[S,b]=N(""),[m,x]=N(null),y={};a!=="all"&&(y.level=a),o&&(y.request_id=o),h.forEach((g,C)=>{y[`filter_field_${C}`]=g.field,y[`filter_op_${C}`]=g.operator,y[`filter_value_${C}`]=g.value});const{data:A,meta:P,isLoading:D}=K("logs",{...e,page:s,search:r,filters:y}),R=A||[],H=E(g=>{c(g),u(g),n(1)},[]),M=E(()=>{const g=d.trim();c(g),n(1)},[d]),T=E(()=>{c(""),u(""),n(1)},[]),q=E(()=>{l("all"),n(1)},[]),G=E(()=>{const g=S.trim();g&&(v(C=>[...C,{field:p,operator:_,value:g}]),b(""))},[p,_,S]),w=E(g=>{v(C=>C.filter((I,ee)=>ee!==g))},[]),$=a!=="all"||o!==""||h.length>0;return t("div",{children:[t(ne,{search:r,onSearchChange:i,placeholder:"Search logs...",summary:`${P?.total??0} logs`,children:t("div",{className:"ss-dash-log-filters",children:[br.map(g=>t("button",{type:"button",className:`ss-dash-log-filter ${a===g?"ss-dash-active":""}`,onClick:()=>{l(g),n(1)},children:g},g)),t("input",{type:"text",className:"ss-dash-filter-input ss-dash-reqid-input",placeholder:"Filter by request ID...",value:d,onChange:g=>u(g.target.value),onKeyDown:g=>g.key==="Enter"&&M()}),(d||o)&&t("button",{type:"button",className:"ss-dash-btn ss-dash-reqid-clear",onClick:()=>{T()},children:"Clear"})]})}),t("div",{className:"ss-dash-structured-search",children:[t("select",{className:"ss-dash-filter-select",value:p,onChange:g=>f(g.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:_,onChange:g=>k(g.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:S,onChange:g=>b(g.target.value),onKeyDown:g=>g.key==="Enter"&&G()}),t("button",{type:"button",className:"ss-dash-btn",onClick:G,children:"Add"})]}),$&&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:q,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:T,children:"×"})]}),h.map((g,C)=>t("span",{className:"ss-dash-filter-chip",children:[g.field," ",g.operator,' "',g.value,'"',t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:()=>w(C),children:"×"})]},C))]}),D&&!A?t("div",{className:"ss-dash-empty",children:"Loading logs..."}):R.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:R.map((g,C)=>t(ns,{log:g,index:C,expanded:m===C,onToggleExpand:I=>x(m===I?null:I),onReqIdClick:H},g.id||C))}),P&&t(he,{page:P.page,lastPage:P.lastPage,total:P.total,onPageChange:n})]})}const Ir=Object.freeze(Object.defineProperty({__proto__:null,LogsSection:ps,default:ps},Symbol.toStringTag,{value:"Module"}));function Br({email:e,previewHtml:s,isLoading:n=!1,onClose:r,className:i}){return t("div",{className:i||"ss-email-preview",children:[t("div",{className:"ss-email-preview-header",children:[t("div",{className:"ss-email-preview-meta",children:e&&t(F,{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 fs({options:e={}}){const[s,n]=N(1),[r,i]=N(""),[a,l]=N(null),[o,c]=N(null),{data:d,meta:u,isLoading:h}=K("emails",{...e,page:s,search:r}),v=d||[];V(()=>n(1),[r]);const p=E(async f=>{if(f.html){l(f.id),c(f.html);return}try{const{baseUrl:_="",dashboardEndpoint:k="/__stats/api",authToken:S}=e,b=`${_}${k}/emails/${f.id}/preview`,m={Accept:"text/html"};S&&(m.Authorization=`Bearer ${S}`);const y=await(await fetch(b,{headers:m,credentials:"same-origin"})).text();l(f.id),c(y)}catch{}},[e]);if(a&&o){const f=v.find(k=>k.id===a),_=f?{subject:f.subject,from:Vt(f),to:Kt(f),cc:Qn(f)||null,status:f.status,mailer:f.mailer}:null;return t(Br,{email:_,previewHtml:o,onClose:()=>{l(null),c(null)},className:"ss-dash-email-preview"})}return t("div",{children:[t(ne,{search:r,onSearchChange:i,placeholder:"Filter emails...",summary:`${u?.total??0} emails`}),h&&!d?t("div",{className:"ss-dash-empty",children:"Loading emails..."}):t(F,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:f=>t("span",{style:{color:"var(--ss-dim)"},children:f})},{key:"from",label:"From",width:"150px",render:(f,_)=>{const k=Vt(_);return t("span",{title:k,style:{color:"var(--ss-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:k})}},{key:"to",label:"To",width:"150px",render:(f,_)=>{const k=Kt(_);return t("span",{title:k,style:{color:"var(--ss-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:k})}},{key:"subject",label:"Subject",render:f=>{const _=f||"";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:f=>{const _=f||"";return t("span",{className:`ss-dash-badge ss-dash-email-status-${_}`,children:_})}},{key:"attachmentCount",label:"ATT",width:"40px",render:(f,_)=>{const k=Jn(_);return k>0?t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:k}):t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:"-"})}},{key:"mailer",label:"Mailer",width:"70px",render:f=>{const _=f||"";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:(f,_)=>{const k=Ae(_);return t(ie,{ts:k,className:"ss-dash-event-time",style:{whiteSpace:"nowrap"}})}}],data:v,onRowClick:p,rowClassName:"ss-dash-email-row",emptyMessage:"No emails captured yet"})}),u&&t(he,{page:u.page,lastPage:u.lastPage,total:u.total,onPageChange:n})]})]})}const Ur=Object.freeze(Object.defineProperty({__proto__:null,EmailsSection:fs,default:fs},Symbol.toStringTag,{value:"Module"}));function Hr({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 ms({options:e={}}){const[s,n]=N(""),[r,i]=N(null),[a,l]=N(null),[o,c]=N(!1),[d,u]=N(null),{data:h,isLoading:v,mutate:p,getApi:f}=K("cache",{...e,search:s}),_=h,k=E(async b=>{if(confirm(`Delete cache key "${b}"?`))try{await p(`cache/${encodeURIComponent(b)}`,"delete"),r===b&&(i(null),l(null),u(null))}catch{}},[p,r]),S=E(async b=>{if(r===b){i(null),l(null),u(null);return}i(b),l(null),u(null),c(!0);try{const x=await f().fetchCacheKey(b);l(x.value!==void 0?x.value:x.data!==void 0?x.data:x),u(null)}catch{l(null),u("Failed to fetch key value")}finally{c(!1)}},[r,f]);return t("div",{children:[_?.available&&_?.stats&&t(Hr,{hitRate:_.stats.hitRate??0,hits:_.stats.hits??0,misses:_.stats.misses??0,keys:_.stats.totalKeys||_.stats.keyCount||_.keys?.length||0}),t(ne,{search:s,onSearchChange:n,placeholder:"Filter cache keys...",summary:`${(_?.keys||_?.data||[]).length} keys`}),v&&!h?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:b=>t("span",{title:b,style:{color:"var(--ss-sql-color)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:b})},{key:"type",label:"Type",width:"70px",render:b=>t("span",{style:{color:"var(--ss-muted)"},children:b})},{key:"size",label:"Size",width:"60px",render:b=>b!=null&&b>0?nr(b):"-"},{key:"ttl",label:"TTL",width:"70px",render:b=>b>0?sr(b):"-"},{key:"_actions",label:"",width:"60px",render:(b,m)=>t("button",{type:"button",className:"ss-dash-retry-btn",onClick:x=>{x.stopPropagation(),k(m.key)},children:"Delete"})}],data:_.keys||_.data||[],keyField:"key",onRowClick:b=>S(b.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..."}):d?t("div",{className:"ss-dash-empty",style:{color:"var(--ss-red-fg)"},children:d}):t(Re,{data:a})]})]})}const zr=Object.freeze(Object.defineProperty({__proto__:null,CacheSection:ms,default:ms},Symbol.toStringTag,{value:"Module"})),Wr=["all","active","waiting","delayed","completed","failed"];function Vr(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 Kr(e){if(!e)return[];if(Array.isArray(e))return e;const s=e;return s.jobs||s.data||[]}function Qr(e){if(!e||Array.isArray(e))return null;const s=e;return s.stats||s.overview||null}function Jr({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 vs({options:e={}}){const[s,n]=N(1),[r,i]=N(""),[a,l]=N("all"),[o,c]=N({}),d={};a!=="all"&&(d.status=a);const{data:u,meta:h,isLoading:v,error:p,refresh:f,mutate:_}=K("jobs",{...e,page:s,search:r,filters:d}),k=Kr(u),S=Qr(u),b=E(async m=>{c(x=>({...x,[m]:"pending"}));try{await _(`jobs/${m}/retry`),c(x=>({...x,[m]:"success"})),setTimeout(()=>{c(x=>{const y={...x};return delete y[m],y}),f()},1e3)}catch{c(x=>{const y={...x};return delete y[m],y})}},[_,f]);return t("div",{children:[t(Jr,{stats:S,classPrefix:"ss-dash"}),t(ne,{search:r,onSearchChange:i,placeholder:"Filter jobs...",summary:`${h?.total??k.length} jobs`,children:t("div",{className:"ss-dash-btn-group",children:Wr.map(m=>t("button",{type:"button",className:`ss-dash-btn ${a===m?"ss-dash-active":""}`,onClick:()=>{l(m),n(1)},children:m.charAt(0).toUpperCase()+m.slice(1)},m))})}),v&&!u?t("div",{className:"ss-dash-empty",children:"Loading jobs..."}):p?t("div",{className:"ss-dash-empty",children:"Jobs/Queue not available"}):t(F,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"ID",width:"40px",render:m=>t("span",{style:{color:"var(--ss-dim)"},children:m})},{key:"name",label:"Name",render:m=>t("span",{style:{color:"var(--ss-text)"},title:m,children:m})},{key:"status",label:"Status",width:"90px",render:m=>t(gr,{color:Vr(m),children:m})},{key:"payload",label:"Payload",render:(m,x)=>t(Re,{data:m||x?.data,maxPreviewLength:60})},{key:"attempts",label:"Tries",width:"50px",render:(m,x)=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:m||x.attemptsMade||0})},{key:"duration",label:"Duration",width:"75px",render:m=>t("span",{className:"ss-dash-duration",children:m!==null?te(m):"-"})},{key:"timestamp",label:"Time",width:"70px",render:(m,x)=>{const y=m||Hn(x);return t(ie,{ts:y,className:"ss-dash-event-time",style:{whiteSpace:"nowrap"}})}},{key:"_actions",label:"",width:"50px",render:(m,x)=>{const y=x.id,A=o[y];return x.status!=="failed"?null:t("button",{type:"button",className:"ss-dash-retry-btn",disabled:A==="pending"||A==="success",onClick:P=>{P.stopPropagation(),b(y)},children:A==="pending"?"...":A==="success"?"OK":"Retry"})}}],data:k,emptyMessage:"No jobs found"})}),h&&t(he,{page:h.page,lastPage:h.lastPage,total:h.total,onPageChange:n})]})]})}const Gr=Object.freeze(Object.defineProperty({__proto__:null,JobsSection:vs,default:vs},Symbol.toStringTag,{value:"Module"}));function J(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)&&!J(e)}function et(e,s=""){if(!Me(e))return[{path:s,value:e}];const n=[];for(const r of Object.keys(e)){const i=s?`${s}.${r}`:r,a=e[r];Me(a)?n.push(...et(a,i)):n.push({path:i,value:a})}return n}function tt(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 _s(e){if(e==null||typeof e!="object"||Array.isArray(e)||J(e))return 1;let s=0;for(const n of Object.keys(e))s+=_s(e[n]);return s}function Yr(e){if(!Me(e))return[];const s=[];for(const n of Object.keys(e))Me(e[n])&&s.push(n);return s}function De(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}){const[n,r]=N(!1);return t("span",{className:`${s}-config-redacted`,style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[t("span",{children:n?e.value:e.display}),t("button",{type:"button",className:`${s}-btn`,title:n?"Hide":"Reveal",style:{padding:"0 4px",fontSize:"0.85em",lineHeight:1,minWidth:"auto"},onClick:i=>{i.stopPropagation(),r(a=>!a)},children:n?t("svg",{width:"14",height:"14",viewBox:j["eye-off"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j["eye-off"].elements.join("")}}):t("svg",{width:"14",height:"14",viewBox:j.eye.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j.eye.elements.join("")}})})]})}function Zr({env:e,search:s,p:n}){const r=z(new Map),i=s.toLowerCase(),a=Object.entries(e).filter(([l,o])=>{if(!i)return!0;const c=J(o)?o.display:o==null?"":String(o);return l.toLowerCase().includes(i)||c.toLowerCase().includes(i)});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(([l,o])=>{const c=J(o),d=c?o.display:o==null?"null":String(o),u=`${l}=${d}`;return t("tr",{children:[t("td",{className:`${n}-env-key`,children:t("span",{className:`${n}-config-key`,children:l})}),t("td",{className:`${n}-env-val`,children:c?t(qe,{redacted:o,p:n}):t("span",{className:`${n}-config-val`,children:d})}),t("td",{children:!c&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:h=>{r.current.set(l,h)},onClick:h=>{h.stopPropagation(),De(u,r.current.get(l)??null,n)},children:"⎘"})})]},l)}),a.length===0&&t("tr",{children:t("td",{colSpan:3,style:{textAlign:"center",color:"var(--ss-dim)"},children:"No matching variables"})})]})]})})}function Xr({source:e,search:s,p:n}){const r=z(new Map),i=s.toLowerCase(),a=et(e,""),l=a.filter(o=>{const c=J(o.value)?o.value.display:o.value===null||o.value===void 0?"":String(o.value);return o.path.toLowerCase().includes(i)||c.toLowerCase().includes(i)});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:[l.map(o=>{const c=J(o.value),d=c?null:tt(o.value),u=c?o.value.display:d.text,h=`${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:c?t(qe,{redacted:o.value,p:n}):t("span",{className:`${n}-config-val`,style:{wordBreak:"break-all",color:d.color},children:d.text})}),t("td",{children:!c&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:v=>{r.current.set(o.path,v)},onClick:v=>{v.stopPropagation(),De(h,r.current.get(o.path)??null,n)},children:"⎘"})})]},o.path)}),l.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:[l.length," of ",a.length," entries"]})]})}function ea({obj:e,prefix:s,p:n}){const r=z(new Map),i=et(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:i.map(a=>{const l=a.path.indexOf(s+".")===0?a.path.slice(s.length+1):a.path,o=J(a.value),c=o?null:tt(a.value),d=o?a.value.display:c.text,u=`${a.path}: ${d}`;return t("tr",{children:[t("td",{title:l,children:t("span",{className:`${n}-config-key`,children:l})}),t("td",{title:d,children:o?t(qe,{redacted:a.value,p:n}):t("span",{className:`${n}-config-val`,style:{color:c.color},children:c.text})}),t("td",{children:!o&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:h=>{r.current.set(a.path,h)},onClick:h=>{h.stopPropagation(),De(u,r.current.get(a.path)??null,n)},children:"⎘"})})]},a.path)})})]})}function ta({value:e,p:s}){if(e==null)return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-dim)"},children:"null"});if(J(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 sa({obj:e,expandedPaths:s,onToggle:n,p:r}){if(e==null||typeof e!="object"||Array.isArray(e)||J(e))return null;const i=Object.keys(e),a=z(new Map);return t("div",{className:`${r}-config-sections`,children:i.map(l=>{const o=e[l],c=o!==null&&typeof o=="object"&&!Array.isArray(o)&&!J(o),d=s.has(l),u=J(o);return t("div",{className:`${r}-config-section`,children:[t("div",{className:`${r}-config-section-header${c?"":` ${r}-config-leaf`}`,onClick:c?()=>n(l):void 0,style:{cursor:c?"pointer":"default"},children:[c?t("span",{className:`${r}-config-toggle`,children:d?"▼":"▶"}):t("span",{className:`${r}-config-toggle`,style:{visibility:"hidden"},children:"•"}),t("span",{className:`${r}-config-key`,children:l}),c?t("span",{className:`${r}-config-count`,children:[_s(o)," entries"]}):t(F,{children:[t("span",{className:`${r}-config-val`,style:{marginLeft:"8px"},children:t(ta,{value:o,p:r})}),!u&&t("button",{type:"button",className:`${r}-copy-row-btn`,style:{marginLeft:"4px"},title:"Copy",ref:h=>{a.current.set(l,h)},onClick:h=>{h.stopPropagation();const v=tt(o);De(`${l}: ${v.text}`,a.current.get(l)??null,r)},children:"⎘"})]})]}),c&&d&&t("div",{className:`${r}-config-section-body`,children:t(ea,{obj:o,prefix:l,p:r})})]},l)})})}function na({data:e,isLoading:s,classPrefix:n}){const r=n,[i,a]=N(""),[l,o]=N(""),[c,d]=N("app"),[u,h]=N(new Set),[v,p]=N("Copy JSON");V(()=>{const m=setTimeout(()=>o(i),200);return()=>clearTimeout(m)},[i]);const f=e,_=E(m=>{h(x=>{const y=new Set(x);return y.has(m)?y.delete(m):y.add(m),y})},[]),k=E(()=>{if(!f)return;const m=c==="app"?f.app:f.env;if(!m)return;const x=Yr(m);h(new Set(x))},[f,c]),S=E(()=>{h(new Set)},[]),b=E(async()=>{if(f)try{const m=c==="app"?f.app:f.env;await navigator.clipboard.writeText(JSON.stringify(m,null,2)),p("Copied!"),setTimeout(()=>p("Copy JSON"),1500)}catch{}},[f,c]);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${c==="app"?` ${r}-active`:""}`,onClick:()=>d("app"),children:"App Config"}),t("button",{type:"button",className:`${r}-config-tab${c==="env"?` ${r}-active`:""}`,onClick:()=>d("env"),children:"Env"}),t("div",{style:{position:"relative",flex:1},children:[t("input",{type:"text",className:`${r}-search`,placeholder:"Search keys and values...",value:i,onChange:m=>a(m.target.value),style:{width:"100%"}}),i&&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:"×"})]}),c==="app"&&!l&&t(F,{children:[t("button",{type:"button",className:`${r}-btn`,onClick:k,children:"Expand All"}),t("button",{type:"button",className:`${r}-btn`,onClick:S,children:"Collapse All"})]}),t("button",{type:"button",className:`${r}-btn`,onClick:b,children:v})]}),s&&!e?t("div",{className:`${r}-empty`,children:"Loading config..."}):f?c==="env"?t(Zr,{env:f.env??{},search:l,p:r}):l?t(Xr,{source:f.app??{},search:l,p:r}):t("div",{className:`${r}-config-table-wrap`,children:t(sa,{obj:f.app,expandedPaths:u,onToggle:_,p:r})}):t("div",{className:`${r}-empty`,children:"Config not available"})]})}function gs({options:e={}}){const{data:s,isLoading:n}=K("config",e);return t(na,{data:s,isLoading:n,classPrefix:"ss-dash"})}const ra=Object.freeze(Object.defineProperty({__proto__:null,ConfigSection:gs,default:gs},Symbol.toStringTag,{value:"Module"}));function aa(e={}){const{baseUrl:s="",debugEndpoint:n="/admin/api/debug",authToken:r,refreshInterval:i=3e3}=e,[a,l]=N(null),[o,c]=N(!0),[d,u]=N(null),h=z(null),v=es(s,r),p=E(async()=>{try{const _=await v().get(`${n}/diagnostics`);l(_),u(null),c(!1)}catch(f){if(f instanceof Ke){u(f),c(!1),h.current&&(clearInterval(h.current),h.current=null);return}u(f instanceof Error?f:new Error(String(f))),c(!1)}},[n,v]);return V(()=>(c(!0),u(null),p(),h.current=setInterval(p,i),()=>{h.current&&(clearInterval(h.current),h.current=null)}),[p,i]),{data:a,isLoading:o,error:d}}const ia=["password","secret","token","key","credential","auth"];function ys(e){const s=e.toLowerCase();return ia.some(n=>s.includes(n))}function bs(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 la={collectionInterval:"Stats Collection",dashboardBroadcast:"Dashboard Broadcast",debugBroadcast:"Debug Broadcast",persistFlush:"Persist Flush",retentionCleanup:"Retention Cleanup"};function oa(e){return la[e]||e}const ca={prometheus:"Prometheus",pinoHook:"Pino Log Hook",edgePlugin:"Edge Plugin",cacheInspector:"Cache Inspector",queueInspector:"Queue Inspector"};function da(e){return ca[e]||e}const ha=["healthy","active","connected","available","ready"],ua=["errored","unavailable"];function pa(e){return ha.includes(e)?"ok":ua.includes(e)?"err":""}function ve({status:e,prefix:s}){const n=pa(e);let r=`${s}-dot`;return n==="ok"?r+=` ${s}-dot-ok`:n==="err"&&(r+=` ${s}-dot-err`),t("span",{className:r})}const ws=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:j.eye.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j.eye.elements.join("")}}),Ns=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:j["eye-off"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j["eye-off"].elements.join("")}});function fa({value:e}){const[s,n]=N(!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(Ns,{}):t(ws,{})})]})}function ma({current:e,max:s,prefix:n}){const r=s>0?Math.min(100,Math.round(e/s*100)):0,i=r>=100;return t("div",{className:`${n}-bar`,children:[t("div",{className:`${n}-bar-track`,children:t("div",{className:`${n}-bar-fill${i?` ${n}-bar-fill-warn`:""}`,style:{width:`${r}%`}})}),t("span",{className:`${n}-bar-pct${i?` ${n}-bar-pct-warn`:""}`,children:[r,"%"]})]})}function va({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,i],a)=>t("span",{children:[a>0&&", ",t("span",{className:`${s}-c-dim`,children:r}),"=",ys(r)&&typeof i=="string"?t(fa,{value:i}):t("span",{children:bs(i)})]},r))})}function _e({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 _a({data:e,tableClassName:s,classPrefix:n}){const r=n||"ss-dash",[i,a]=N(new Set),l=E(c=>{a(d=>{const u=new Set(d);return u.has(c)?u.delete(c):u.add(c),u})},[]),o=E((c,d)=>{if(d==null)return t("span",{className:`${r}-c-dim`,children:"null"});if(typeof d=="boolean")return t("span",{className:d?`${r}-c-green`:`${r}-c-red`,children:String(d)});if(Array.isArray(d))return t("span",{children:d.join(", ")||"-"});const u=bs(d);if(ys(c)){const h=i.has(c);return t("span",{children:[h?u:"••••••••"," ",t("button",{type:"button",onClick:()=>l(c),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:h?t(Ns,{}):t(ws,{})})]})}return t("span",{children:u})},[i,l,r]);return t("div",{children:[t("h3",{className:`${r}-internals-title`,children:"Package Info"}),t("div",{className:`${r}-info-cards`,children:[t(_e,{label:"Version",value:e.package.version||"-",prefix:r}),t(_e,{label:"Node.js",value:e.package.nodeVersion||"-",prefix:r}),t(_e,{label:"AdonisJS",value:e.package.adonisVersion||"-",prefix:r}),t(_e,{label:"Uptime",value:Xn(e.package.uptime),prefix:r}),t(_e,{label:"Renderer",value:e.devToolbar?.renderer||"preact",prefix:r})]}),e.collectors.length>0&&t(F,{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(c=>t("tr",{children:[t("td",{children:[t("code",{children:c.name}),c.label&&c.label!==c.name&&t("span",{className:`${r}-c-dim`,children:[" ",c.label]})]}),t("td",{children:[t(ve,{status:c.status,prefix:r}),c.status]}),t("td",{className:c.lastError?`${r}-c-red`:`${r}-c-dim`,children:c.lastError?t(F,{children:[c.lastError,c.lastErrorAt&&t("span",{className:`${r}-c-dim`,style:{fontSize:"10px"},children:Ge(c.lastErrorAt)})]}):"-"}),t("td",{children:t(va,{config:c.config,prefix:r})})]},c.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(([c,d])=>t("tr",{children:[t("td",{style:{textTransform:"capitalize"},children:c}),t("td",{children:[d.current.toLocaleString()," / ",d.max.toLocaleString()]}),t("td",{children:t(ma,{current:d.current,max:d.max,prefix:r})})]},c))})]}),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(([c,d])=>t("tr",{children:[t("td",{children:oa(c)}),t("td",{children:[t(ve,{status:d.active?"active":"inactive",prefix:r}),t("span",{className:d.active?`${r}-c-green`:`${r}-c-dim`,children:d.active?"active":"inactive"})]}),t("td",{children:d.active?d.intervalMs?te(d.intervalMs):d.debounceMs?`${te(d.debounceMs)} (debounce)`:"-":t("span",{className:`${r}-c-dim`,children:"—"})})]},c))})]}),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(ve,{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(([c,d])=>{const u=d.active??d.available??!1,h=d.active?"active":d.available?"available":"unavailable";let v=d.mode?`Mode: ${d.mode}`:"-";return c==="edgePlugin"&&d.active?v="@serverStats() tag registered":c==="cacheInspector"&&d.available?v="Redis dependency detected":c==="queueInspector"&&d.available&&(v="Queue dependency detected"),t("tr",{children:[t("td",{children:da(c)}),t("td",{children:[t(ve,{status:u?"active":"inactive",prefix:r}),h]}),t("td",{className:`${r}-c-dim`,style:{fontSize:"11px"},children:v})]},c)})]})]}),e.storage&&t(F,{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(ve,{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?Ge(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(c=>t("tr",{children:[t("td",{children:t("code",{children:c.name})}),t("td",{children:c.rowCount.toLocaleString()})]},c.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(([c,d])=>t("tr",{children:[t("td",{children:c==="customPaneCount"?"customPanes":c}),t("td",{children:c==="customPaneCount"?`${d} registered`:o(c,d)})]},c))})]})]})}function xs({options:e={},debugEndpoint:s="/admin/api/debug"}){const{data:n,isLoading:r,error:i}=aa({baseUrl:e.baseUrl,debugEndpoint:s,authToken:e.authToken,refreshInterval:It});return r&&!n?t("div",{className:"ss-dash-empty",children:"Loading diagnostics..."}):i?t("div",{className:"ss-dash-empty",children:["Error: ",i.message]}):n?t(_a,{data:n,tableClassName:"ss-dash-table",classPrefix:"ss-dash"}):t("div",{className:"ss-dash-empty",children:"Diagnostics not available"})}const ga=Object.freeze(Object.defineProperty({__proto__:null,InternalsSection:xs,default:xs},Symbol.toStringTag,{value:"Module"}))})();
|
|
1
|
+
(function(){"use strict";var ge,L,st,re,nt,rt,at,it,Fe,je,Oe,ye={},be=[],Cs=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ue=Array.isArray;function Z(e,s){for(var n in s)e[n]=s[n];return e}function Ie(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function we(e,s,n){var r,i,a,l={};for(a in s)a=="key"?r=s[a]:a=="ref"?i=s[a]:l[a]=s[a];if(arguments.length>2&&(l.children=arguments.length>3?ge.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)l[a]===void 0&&(l[a]=e.defaultProps[a]);return xe(e,l,r,i,null)}function xe(e,s,n,r,i){var a={type:e,props:s,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++st,__i:-1,__u:0};return i==null&&L.vnode!=null&&L.vnode(a),a}function D(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 Ts(e){if(e.__P&&e.__d){var s=e.__v,n=s.__e,r=[],i=[],a=Z({},s);a.__v=s.__v+1,L.vnode&&L.vnode(a),Be(e.__P,a,s,e.__n,e.__P.namespaceURI,32&s.__u?[n]:null,r,n??oe(s),!!(32&s.__u),i),a.__v=s.__v,a.__.__k[a.__i]=a,pt(r,a,i),s.__e=s.__=null,a.__e!=n&<(a)}}function lt(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}),lt(e)}function ot(e){(!e.__d&&(e.__d=!0)&&re.push(e)&&!Ne.__r++||nt!=L.debounceRendering)&&((nt=L.debounceRendering)||rt)(Ne)}function Ne(){for(var e,s=1;re.length;)re.length>s&&re.sort(at),e=re.shift(),s=re.length,Ts(e);Ne.__r=0}function ct(e,s,n,r,i,a,l,o,h,d,u){var c,v,p,f,_,k,S,b=r&&r.__k||be,m=s.length;for(h=Ls(n,s,b,h,m),c=0;c<m;c++)(p=n.__k[c])!=null&&(v=p.__i!=-1&&b[p.__i]||ye,p.__i=c,k=Be(e,p,v,i,a,l,o,h,d,u),f=p.__e,p.ref&&v.ref!=p.ref&&(v.ref&&He(v.ref,null,p),u.push(p.ref,p.__c||f,p)),_==null&&f!=null&&(_=f),(S=!!(4&p.__u))||v.__k===p.__k?h=dt(p,h,e,S):typeof p.type=="function"&&k!==void 0?h=k:f&&(h=f.nextSibling),p.__u&=-7);return n.__e=_,h}function Ls(e,s,n,r,i){var a,l,o,h,d,u=n.length,c=u,v=0;for(e.__k=new Array(i),a=0;a<i;a++)(l=s[a])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=e.__k[a]=xe(null,l,null,null,null):ue(l)?l=e.__k[a]=xe(D,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=e.__k[a]=xe(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[a]=l,h=a+v,l.__=e,l.__b=e.__b+1,o=null,(d=l.__i=Es(l,n,h,c))!=-1&&(c--,(o=n[d])&&(o.__u|=2)),o==null||o.__v==null?(d==-1&&(i>u?v--:i<u&&v++),typeof l.type!="function"&&(l.__u|=4)):d!=h&&(d==h-1?v--:d==h+1?v++:(d>h?v--:v++,l.__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)),mt(o,o));return r}function dt(e,s,n,r){var i,a;if(typeof e.type=="function"){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,s=dt(i[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"||(ue(e)?e.some(function(n){ke(n,s)}):s.push(e)),s}function Es(e,s,n,r){var i,a,l,o=e.key,h=e.type,d=s[n],u=d!=null&&(2&d.__u)==0;if(d===null&&o==null||u&&o==d.key&&h==d.type)return n;if(r>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<s.length;)if((d=s[l=i>=0?i--:a++])!=null&&(2&d.__u)==0&&o==d.key&&h==d.type)return l}return-1}function ht(e,s,n){s[0]=="-"?e.setProperty(s,n??""):e[s]=n==null?"":typeof n!="number"||Cs.test(s)?n:n+"px"}function Se(e,s,n,r,i){var a,l;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||ht(e.style,s,"");if(n)for(s in n)r&&n[s]==r[s]||ht(e.style,s,n[s])}else if(s[0]=="o"&&s[1]=="n")a=s!=(s=s.replace(it,"$1")),l=s.toLowerCase(),s=l in e||s=="onFocusOut"||s=="onFocusIn"?l.slice(2):s.slice(2),e.l||(e.l={}),e.l[s+a]=n,n?r?n.u=r.u:(n.u=Fe,e.addEventListener(s,a?Oe:je,a)):e.removeEventListener(s,a?Oe:je,a);else{if(i=="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 ut(e){return function(s){if(this.l){var n=this.l[s.type+e];if(s.t==null)s.t=Fe++;else if(s.t<n.u)return;return n(L.event?L.event(s):s)}}}function Be(e,s,n,r,i,a,l,o,h,d){var u,c,v,p,f,_,k,S,b,m,N,y,A,P,q,R=s.type;if(s.constructor!==void 0)return null;128&n.__u&&(h=!!(32&n.__u),a=[o=s.__e=n.__e]),(u=L.__b)&&u(s);e:if(typeof R=="function")try{if(S=s.props,b="prototype"in R&&R.prototype.render,m=(u=R.contextType)&&r[u.__c],N=u?m?m.props.value:u.__:r,n.__c?k=(c=s.__c=n.__c).__=c.__E:(b?s.__c=c=new R(S,N):(s.__c=c=new X(S,N),c.constructor=R,c.render=Ps),m&&m.sub(c),c.state||(c.state={}),c.__n=r,v=c.__d=!0,c.__h=[],c._sb=[]),b&&c.__s==null&&(c.__s=c.state),b&&R.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=Z({},c.__s)),Z(c.__s,R.getDerivedStateFromProps(S,c.__s))),p=c.props,f=c.state,c.__v=s,v)b&&R.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),b&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(b&&R.getDerivedStateFromProps==null&&S!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(S,N),s.__v==n.__v||!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(S,c.__s,N)===!1){s.__v!=n.__v&&(c.props=S,c.state=c.__s,c.__d=!1),s.__e=n.__e,s.__k=n.__k,s.__k.some(function(H){H&&(H.__=s)}),be.push.apply(c.__h,c._sb),c._sb=[],c.__h.length&&l.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(S,c.__s,N),b&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,f,_)})}if(c.context=N,c.props=S,c.__P=e,c.__e=!1,y=L.__r,A=0,b)c.state=c.__s,c.__d=!1,y&&y(s),u=c.render(c.props,c.state,c.context),be.push.apply(c.__h,c._sb),c._sb=[];else do c.__d=!1,y&&y(s),u=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++A<25);c.state=c.__s,c.getChildContext!=null&&(r=Z(Z({},r),c.getChildContext())),b&&!v&&c.getSnapshotBeforeUpdate!=null&&(_=c.getSnapshotBeforeUpdate(p,f)),P=u!=null&&u.type===D&&u.key==null?ft(u.props.children):u,o=ct(e,ue(P)?P:[P],s,n,r,i,a,l,o,h,d),c.base=s.__e,s.__u&=-161,c.__h.length&&l.push(c),k&&(c.__E=c.__=null)}catch(H){if(s.__v=null,h||a!=null)if(H.then){for(s.__u|=h?160:128;o&&o.nodeType==8&&o.nextSibling;)o=o.nextSibling;a[a.indexOf(o)]=null,s.__e=o}else{for(q=a.length;q--;)Ie(a[q]);Ue(s)}else s.__e=n.__e,s.__k=n.__k,H.then||Ue(s);L.__e(H,s,n)}else a==null&&s.__v==n.__v?(s.__k=n.__k,s.__e=n.__e):o=s.__e=As(n.__e,s,n,r,i,a,l,h,d);return(u=L.diffed)&&u(s),128&s.__u?void 0:o}function Ue(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ue))}function pt(e,s,n){for(var r=0;r<n.length;r++)He(n[r],n[++r],n[++r]);L.__c&&L.__c(s,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){L.__e(a,i.__v)}})}function ft(e){return typeof e!="object"||e==null||e.__b>0?e:ue(e)?e.map(ft):Z({},e)}function As(e,s,n,r,i,a,l,o,h){var d,u,c,v,p,f,_,k=n.props||ye,S=s.props,b=s.type;if(b=="svg"?i="http://www.w3.org/2000/svg":b=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((p=a[d])&&"setAttribute"in p==!!b&&(b?p.localName==b:p.nodeType==3)){e=p,a[d]=null;break}}if(e==null){if(b==null)return document.createTextNode(S);e=document.createElementNS(i,b,S.is&&S),o&&(L.__m&&L.__m(s,a),o=!1),a=null}if(b==null)k===S||o&&e.data==S||(e.data=S);else{if(a=a&&ge.call(e.childNodes),!o&&a!=null)for(k={},d=0;d<e.attributes.length;d++)k[(p=e.attributes[d]).name]=p.value;for(d in k)p=k[d],d=="dangerouslySetInnerHTML"?c=p:d=="children"||d in S||d=="value"&&"defaultValue"in S||d=="checked"&&"defaultChecked"in S||Se(e,d,null,p,i);for(d in S)p=S[d],d=="children"?v=p:d=="dangerouslySetInnerHTML"?u=p:d=="value"?f=p:d=="checked"?_=p:o&&typeof p!="function"||k[d]===p||Se(e,d,p,k[d],i);if(u)o||c&&(u.__html==c.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),s.__k=[];else if(c&&(e.innerHTML=""),ct(s.type=="template"?e.content:e,ue(v)?v:[v],s,n,r,b=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,l,a?a[0]:n.__k&&oe(n,0),o,h),a!=null)for(d=a.length;d--;)Ie(a[d]);o||(d="value",b=="progress"&&f==null?e.removeAttribute("value"):f!=null&&(f!==e[d]||b=="progress"&&!f||b=="option"&&f!=k[d])&&Se(e,d,f,k[d],i),d="checked",_!=null&&_!=e[d]&&Se(e,d,_,k[d],i))}return e}function He(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(i){L.__e(i,n)}}function mt(e,s,n){var r,i;if(L.unmount&&L.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||He(r,null,s)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){L.__e(a,s)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&mt(r[i],s,n||typeof e.type!="function");n||Ie(e.__e),e.__c=e.__=e.__e=void 0}function Ps(e,s,n){return this.constructor(e,n)}function Rs(e,s,n){var r,i,a,l;s==document&&(s=document.documentElement),L.__&&L.__(e,s),i=(r=!1)?null:s.__k,a=[],l=[],Be(s,e=s.__k=we(D,null,[e]),i||ye,ye,s.namespaceURI,i?null:s.firstChild?ge.call(s.childNodes):null,a,i?i.__e:s.firstChild,r,l),pt(a,e,l)}ge=be.slice,L={__e:function(e,s,n,r){for(var i,a,l;s=s.__;)if((i=s.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),l=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),l=i.__d),l)return i.__E=i}catch(o){e=o}throw e}},st=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),ot(this))},X.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ot(this))},X.prototype.render=D,re=[],rt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,at=function(e,s){return e.__v.__b-s.__v.__b},Ne.__r=0,it=/(PointerCapture)$|Capture$/i,Fe=0,je=ut(!1),Oe=ut(!0);var Ms=0;function t(e,s,n,r,i,a){s||(s={});var l,o,h=s;if("ref"in h)for(o in h={},s)o=="ref"?l=s[o]:h[o]=s[o];var d={type:e,props:h,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ms,__i:-1,__u:0,__source:i,__self:a};if(typeof e=="function"&&(l=e.defaultProps))for(o in l)h[o]===void 0&&(h[o]=l[o]);return L.vnode&&L.vnode(d),d}var pe,O,ze,vt,fe=0,_t=[],B=L,gt=B.__b,yt=B.__r,bt=B.diffed,wt=B.__c,xt=B.unmount,Nt=B.__;function We(e,s){B.__h&&B.__h(O,e,fe||s),fe=0;var n=O.__H||(O.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function x(e){return fe=1,Ds($t,e)}function Ds(e,s,n){var r=We(pe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(s):$t(void 0,s),function(o){var h=r.__N?r.__N[0]:r.__[0],d=r.t(h,o);h!==d&&(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=O,!O.__f)){var i=function(o,h,d){if(!r.__c.__H)return!0;var u=r.__c.__H.__.filter(function(v){return v.__c});if(u.every(function(v){return!v.__N}))return!a||a.call(this,o,h,d);var c=r.__c.props!==o;return u.some(function(v){if(v.__N){var p=v.__[0];v.__=v.__N,v.__N=void 0,p!==v.__[0]&&(c=!0)}}),a&&a.call(this,o,h,d)||c};O.__f=!0;var a=O.shouldComponentUpdate,l=O.componentWillUpdate;O.componentWillUpdate=function(o,h,d){if(this.__e){var u=a;a=void 0,i(o,h,d),a=u}l&&l.call(this,o,h,d)},O.shouldComponentUpdate=i}return r.__N||r.__}function V(e,s){var n=We(pe++,3);!B.__s&&St(n.__H,s)&&(n.__=e,n.u=s,O.__H.__h.push(n))}function z(e){return fe=5,W(function(){return{current:e}},[])}function W(e,s){var n=We(pe++,7);return St(n.__H,s)&&(n.__=e(),n.__H=s,n.__h=e),n.__}function E(e,s){return fe=8,W(function(){return e},s)}function qs(){for(var e;e=_t.shift();){var s=e.__H;if(e.__P&&s)try{s.__h.some($e),s.__h.some(Ve),s.__h=[]}catch(n){s.__h=[],B.__e(n,e.__v)}}}B.__b=function(e){O=null,gt&>(e)},B.__=function(e,s){e&&s.__k&&s.__k.__m&&(e.__m=s.__k.__m),Nt&&Nt(e,s)},B.__r=function(e){yt&&yt(e),pe=0;var s=(O=e.__c).__H;s&&(ze===O?(s.__h=[],O.__h=[],s.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(s.__h.some($e),s.__h.some(Ve),s.__h=[],pe=0)),ze=O},B.diffed=function(e){bt&&bt(e);var s=e.__c;s&&s.__H&&(s.__H.__h.length&&(_t.push(s)!==1&&vt===B.requestAnimationFrame||((vt=B.requestAnimationFrame)||Fs)(qs)),s.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),ze=O=null},B.__c=function(e,s){s.some(function(n){try{n.__h.some($e),n.__h=n.__h.filter(function(r){return!r.__||Ve(r)})}catch(r){s.some(function(i){i.__h&&(i.__h=[])}),s=[],B.__e(r,n.__v)}}),wt&&wt(e,s)},B.unmount=function(e){xt&&xt(e);var s,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{$e(r)}catch(i){s=i}}),n.__H=void 0,s&&B.__e(s,n.__v))};var kt=typeof requestAnimationFrame=="function";function Fs(e){var s,n=function(){clearTimeout(r),kt&&cancelAnimationFrame(s),setTimeout(e)},r=setTimeout(n,35);kt&&(s=requestAnimationFrame(n))}function $e(e){var s=O,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),O=s}function Ve(e){var s=O;e.__c=e.__(),O=s}function St(e,s){return!e||e.length!==s.length||s.some(function(n,r){return n!==e[r]})}function $t(e,s){return typeof s=="function"?s(e):s}function js(e,s){for(var n in s)e[n]=s[n];return e}function Ct(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 Tt(e,s){this.props=e,this.context=s}(Tt.prototype=new X).isPureReactComponent=!0,Tt.prototype.shouldComponentUpdate=function(e,s){return Ct(this.props,e)||Ct(this.state,s)};var Lt=L.__b;L.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Lt&&Lt(e)};var Os=L.__e;L.__e=function(e,s,n,r){if(e.then){for(var i,a=s;a=a.__;)if((i=a.__c)&&i.__c)return s.__e==null&&(s.__e=n.__e,s.__k=n.__k),i.__c(e,s)}Os(e,s,n,r)};var Et=L.unmount;function At(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=js({},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 At(r,s,n)})),e}function Pt(e,s,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Pt(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 Rt(e){if(!e.__)return null;var s=e.__.__c;return s&&s.__a&&s.__a(e)}function Q(e){var s,n,r,i=null;function a(l){if(s||(s=e()).then(function(o){o&&(i=o.default||o),r=!0},function(o){n=o,r=!0}),n)throw n;if(!r)throw s;return i?we(i,l):null}return a.displayName="Lazy",a.__f=!0,a}function Te(){this.i=null,this.l=null}L.unmount=function(e){var s=e.__c;s&&(s.__z=!0),s&&s.__R&&s.__R(),s&&32&e.__u&&(e.type=null),Et&&Et(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 i=Rt(r.__v),a=!1,l=function(){a||r.__z||(a=!0,n.__R=null,i?i(h):h())};n.__R=l;var o=n.__P;n.__P=null;var h=function(){if(!--r.__u){if(r.state.__a){var d=r.state.__a;r.__v.__k[0]=Pt(d,d.__c.__P,d.__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(l,l)},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]=At(this.__b,n,r.__O=r.__P)}this.__b=null}var i=s.__a&&we(D,null,e.fallback);return i&&(i.__u&=-33),[we(D,null,s.__a?null:e.children),i]};var Mt=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]}};(Te.prototype=new X).__a=function(e){var s=this,n=Rt(s.__v),r=s.l.get(e);return r[0]++,function(i){var a=function(){s.props.revealOrder?(r.push(i),Mt(s,e,r)):i()};n?n(a):a()}},Te.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},Te.prototype.componentDidUpdate=Te.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(s,n){Mt(e,n,s)})};var Is=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Bs=/^(?: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]/,Us=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Hs=/[A-Z0-9]/g,zs=typeof document<"u",Ws=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 Dt=L.event;function Vs(){}function Ks(){return this.cancelBubble}function Qs(){return this.defaultPrevented}L.event=function(e){return Dt&&(e=Dt(e)),e.persist=Vs,e.isPropagationStopped=Ks,e.isDefaultPrevented=Qs,e.nativeEvent=e};var Js={enumerable:!1,configurable:!0,get:function(){return this.class}},qt=L.vnode;L.vnode=function(e){typeof e.type=="string"&&(function(s){var n=s.props,r=s.type,i={},a=r.indexOf("-")===-1;for(var l in n){var o=n[l];if(!(l==="value"&&"defaultValue"in n&&o==null||zs&&l==="children"&&r==="noscript"||l==="class"||l==="className")){var h=l.toLowerCase();l==="defaultValue"&&"value"in n&&n.value==null?l="value":l==="download"&&o===!0?o="":h==="translate"&&o==="no"?o=!1:h[0]==="o"&&h[1]==="n"?h==="ondoubleclick"?l="ondblclick":h!=="onchange"||r!=="input"&&r!=="textarea"||Ws(n.type)?h==="onfocus"?l="onfocusin":h==="onblur"?l="onfocusout":Us.test(l)&&(l=h):h=l="oninput":a&&Bs.test(l)?l=l.replace(Hs,"-$&").toLowerCase():o===null&&(o=void 0),h==="oninput"&&i[l=h]&&(l="oninputCapture"),i[l]=o}}r=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=ke(n.children).forEach(function(d){d.props.selected=i.value.indexOf(d.props.value)!=-1})),r=="select"&&i.defaultValue!=null&&(i.value=ke(n.children).forEach(function(d){d.props.selected=i.multiple?i.defaultValue.indexOf(d.props.value)!=-1:i.defaultValue==d.props.value})),n.class&&!n.className?(i.class=n.class,Object.defineProperty(i,"className",Js)):n.className&&(i.class=i.className=n.className),s.props=i})(e),e.$$typeof=Is,qt&&qt(e)};var Ft=L.__r;L.__r=function(e){Ft&&Ft(e),e.__c};var jt=L.diffed;L.diffed=function(e){jt&&jt(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 Ot={Fragment:D};const j={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 Gs(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(i){return r},beforeUnsubscribe(i){return r}}}async function Ys(){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 Zs(e){let s=null,n=null,r=!1;return{subscribe:async()=>{try{const l=await Ys();if(!l)throw new Error("Transmit client not available (neither window.Transmit nor @adonisjs/transmit-client)");if(r)return;s=new l(Gs(e.baseUrl,e.authToken)),n=s.subscription(e.channelName),n.onMessage(o=>{r||e.onMessage(o)}),await n.create()}catch(l){e.onError?.(l)}},unsubscribe:async()=>{r=!0;try{await n?.delete(),n=null,s=null}catch{}}}}function Xs(e){let s=!1;const n=Zs({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 Ke extends Error{status;constructor(s=403){super(`Unauthorized (HTTP ${s})`),this.name="UnauthorizedError",this.status=s}}class en extends Error{status;body;constructor(s,n){super(`API error (HTTP ${s})`),this.name="ApiError",this.status=s,this.body=n}}class Qe{baseUrl;authToken;constructor(s){this.baseUrl=s.baseUrl.replace(/\/+$/,""),this.authToken=s.authToken}async fetch(s,n){const i={...{Accept:"application/json",...this.authToken?{Authorization:`Bearer ${this.authToken}`}:{}},...n?.headers},a=await globalThis.fetch(`${this.baseUrl}${s}`,{...n,headers:i,credentials:this.authToken?"omit":"include"});if(n?.signal?.aborted)throw new DOMException("The operation was aborted.","AbortError");if(a.status===401||a.status===403)throw new Ke(a.status);if(!a.ok){const l=await a.text().catch(()=>"");throw new en(a.status,l)}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 tn=5e3,It=1e4,Bt=100,sn=500,nn={overview:"/overview",requests:"/requests",queries:"/queries",events:"/events",routes:"/routes",logs:"/logs",emails:"/emails",timeline:"/traces",cache:"/cache",jobs:"/jobs",config:"/config"};function rn(e){return nn[e]||`/${e}`}class an{constructor(s,n){this.client=s,this.basePath=n}async fetchSection(s,n,r){const i=rn(s),a=n?`${this.basePath}${i}?${n}`:`${this.basePath}${i}`;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){return this.client.fetch(`${this.basePath}/cache/${encodeURIComponent(s)}`)}async deleteCacheKey(s){return this.client.fetch(`${this.basePath}/cache/${encodeURIComponent(s)}`,{method:"DELETE"})}async fetchEmailPreview(s){return this.client.fetch(`${this.basePath}/emails/${s}/preview`)}}function ln(e){if(!e||typeof e!="object")return!1;const s=e;return s.data!==void 0&&s.meta!==void 0}function on(e,s){return s.aborted?!0:e instanceof DOMException&&e.name==="AbortError"}const cn=[{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 dn(e){const s=new URLSearchParams,n=e;for(const{key:r,param:i,isNumeric:a}of cn){const l=n[r];(a?l!=null:l)&&s.set(i,String(l))}if(e.filters)for(const[r,i]of Object.entries(e.filters))i&&s.set(r,i);return s.toString()}function hn(e,s,n=2){if(s<=1)return[1];const r=[],i=Math.max(2,e-n),a=Math.min(s-1,e+n);r.push(1),i>2&&r.push("...");for(let l=i;l<=a;l++)r.push(l);return a<s-1&&r.push("..."),s>1&&r.push(s),r}class un{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 Qe({baseUrl:s.baseUrl,authToken:s.authToken}),this.api=new an(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 i=await this.executeFetch(n);if(this.isStaleResponse(r))return;this.applyFetchResult(i)}catch(i){if(this.shouldIgnoreError(i,n.signal,r))return;this.handleFetchError(i,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 i=`${this.endpoint}/${s}`;try{const a=n==="post"?await this.client.post(i,r):await this.client.delete(i);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 on(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 dn({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){ln(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 Ke){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"?tn:It;this.timer=setInterval(()=>this.fetch(!0),s)}stopRefreshTimer(){this.timer&&(clearInterval(this.timer),this.timer=null)}}function pn(e,s){return new un({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 fn(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 mn(){const[e,s]=x(null),[n,r]=x(null),[i,a]=x(!0),[l,o]=x(null);return{data:e,setData:s,meta:n,setMeta:r,isLoading:i,setIsLoading:a,error:l,setError:o}}function vn(e){const s=E(()=>{e.current?.fetch(!0)},[]),n=E(async(i,a="post",l)=>e.current.mutate(i,a,l),[]),r=E(()=>e.current.getApi(),[]);return{refresh:s,mutate:n,getApi:r}}function _n(e,s,n,r){e.current||(e.current=pn(s,{...n,setData:i=>r.setData(i),setMeta:r.setMeta,setIsLoading:r.setIsLoading,setError:r.setError}))}function gn(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 K(e,s={}){const n=gn(s),r=mn(),i=z(null),a=z(e),l=z(!1);_n(i,e,n,r),V(()=>{const h=a.current;return a.current=e,l.current=fn({ctrl:i.current,section:e,prevSection:h,hasFetched:l.current},n),()=>{i.current.stop()}},[e,n.page,n.perPage,n.search,n.sort,n.sortDir,n.filters,n.timeRange,n.refreshKey]);const o=vn(i);return{data:r.data,meta:r.meta,isLoading:r.isLoading,error:r.error,...o}}const yn=["tracing","process","system","http","db","redis","queues","cache","app","log","emails","dashboard"],Ut="/admin/api/debug",Ht={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 bn(e){const s={customPanes:e.customPanes??[]},n=e.features;for(const r of yn)s[r]=n?.[r]??!1;return s}async function wn(e,s=Ut){const n=`${s.replace(/\/+$/,"")}/config`;return e.fetch(n)}async function xn(e){const{baseUrl:s="",debugEndpoint:n=Ut,authToken:r}=e,i=new Qe({baseUrl:s,authToken:r});try{const a=await wn(i,n);return bn(a)}catch{return Ht}}function Nn(e={}){const{baseUrl:s="",debugEndpoint:n="/admin/api/debug",authToken:r}=e,[i,a]=x(Ht),[l,o]=x(!0),[h,d]=x(null),u=z(!1);return V(()=>{if(u.current)return;u.current=!0;let c=!1;return(async()=>{try{const p=await xn({baseUrl:s,debugEndpoint:n,authToken:r});c||(a(p),o(!1))}catch(p){c||(d(p instanceof Error?p:new Error(String(p))),o(!1))}})(),()=>{c=!0}},[s,n,r]),{features:i,isLoading:l,error:h}}const Le="ss-dash-theme",Je="ss-theme-change";function Ee(){if(typeof window>"u")return"light";const e=localStorage.getItem(Le);return e==="dark"||e==="light"?e:window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function kn(e){typeof window>"u"||(localStorage.setItem(Le,e),window.dispatchEvent(new CustomEvent(Je,{detail:e})))}function Sn(){const s=Ee()==="dark"?"light":"dark";return kn(s),s}function zt(e){if(typeof window>"u")return()=>{};const s=a=>{const l=a.detail;(l==="dark"||l==="light")&&e(l)},n=a=>{if(a.key===Le){const l=a.newValue;e(l==="dark"||l==="light"?l:Ee())}},r=window.matchMedia("(prefers-color-scheme: dark)"),i=a=>{localStorage.getItem(Le)||e(a.matches?"dark":"light")};return window.addEventListener(Je,s),window.addEventListener("storage",n),r.addEventListener("change",i),()=>{window.removeEventListener(Je,s),window.removeEventListener("storage",n),r.removeEventListener("change",i)}}function $n(){const[e,s]=x(()=>Ee());V(()=>zt(i=>{s(i)}),[]);const n=E(()=>{const r=Sn();return s(r),r},[]);return{theme:e,toggleTheme:n}}function Cn({theme:e,onToggle:s,className:n="",classPrefix:r="ss-dash"}){const i=e==="dark";return t("button",{type:"button",className:`${r==="ss-dbg"?"ss-dbg-theme-toggle":"ss-dash-theme-btn"} ${n}`,onClick:s,title:i?"Switch to light theme":"Switch to dark theme","aria-label":i?"Switch to light theme":"Switch to dark theme",children:i?t("svg",{width:"16",height:"16",viewBox:j.sun.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j.sun.elements.join("")}}):t("svg",{width:"16",height:"16",viewBox:j.moon.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j.moon.elements.join("")}})})}const Tn=["overview","requests","queries","events","routes","logs","emails","cache","jobs","config","internals"],Ln=Q(()=>Promise.resolve().then(()=>fr)),En=Q(()=>Promise.resolve().then(()=>Mr)),An=Q(()=>Promise.resolve().then(()=>Fr)),Pn=Q(()=>Promise.resolve().then(()=>jr)),Rn=Q(()=>Promise.resolve().then(()=>Or)),Mn=Q(()=>Promise.resolve().then(()=>Ir)),Dn=Q(()=>Promise.resolve().then(()=>Ur)),qn=Q(()=>Promise.resolve().then(()=>zr)),Fn=Q(()=>Promise.resolve().then(()=>Gr)),jn=Q(()=>Promise.resolve().then(()=>ra)),On=Q(()=>Promise.resolve().then(()=>ga));function In(e){const{baseUrl:s="",dashboardEndpoint:n="/__stats/api",debugEndpoint:r,authToken:i,backUrl:a="/",channelName:l="server-stats/dashboard"}=e,{features:o}=Nn({baseUrl:s,debugEndpoint:r,authToken:i}),{theme:h,toggleTheme:d}=$n(),[u,c]=x("overview"),[v,p]=x(()=>typeof window>"u"?!1:localStorage.getItem("ss-dash-sidebar")==="collapsed"),[f,_]=x(!1),[k,S]=x(0),b=z(0);V(()=>{if(!l)return;const T=Xs({baseUrl:s,channelName:l,authToken:i,onMessage:()=>{b.current+=1,S(b.current)},onConnect:()=>_(!0),onDisconnect:()=>_(!1),onError:()=>_(!1)});return()=>T.unsubscribe()},[s,l,i]);const m=o.customPanes||[],N=E(T=>{const F=T.replace("#","").split("?")[0];return F&&[...Tn,...m.map(w=>w.id)].includes(F)?F:"overview"},[m]);V(()=>{if(typeof window>"u")return;const T=N(window.location.hash);(T!=="overview"||window.location.hash)&&c(T)},[N]),V(()=>{const T=()=>{const F=N(window.location.hash);F!==u&&c(F)};return window.addEventListener("hashchange",T),()=>window.removeEventListener("hashchange",T)},[u,N]),V(()=>{typeof window>"u"||(window.location.hash=u)},[u]);const y=E(()=>{p(T=>{const F=!T;return localStorage.setItem("ss-dash-sidebar",F?"collapsed":"expanded"),F})},[]),A=W(()=>[{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]),P=W(()=>A.filter(T=>T.visible),[A]),q=W(()=>({baseUrl:s,dashboardEndpoint:n,authToken:i,refreshKey:k}),[s,n,i,k]),{data:R}=K("overview",q),H=W(()=>{if(!R)return{};const T={};if(R.totalRequests>0&&(T.requests={count:R.totalRequests}),R.queryStats?.total>0&&(T.queries={count:R.queryStats.total}),R.logLevelBreakdown){const F=R.logLevelBreakdown,G=F.error+F.warn+F.info+F.debug;G>0&&(T.logs={count:G})}return T},[R]),M=E(()=>{const T={overview:t(Ln,{options:q}),requests:t(En,{options:q}),queries:t(An,{options:q}),events:t(Pn,{options:q}),routes:t(Rn,{options:q}),logs:t(Mn,{options:q}),emails:t(Dn,{options:q}),cache:t(qn,{options:q}),jobs:t(Fn,{options:q}),config:t(jn,{options:q}),internals:t(On,{options:q,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[u]||t("div",{className:"ss-dash-empty",children:"Unknown section"})})})})},[u,q]);return t("div",{className:"ss-dash","data-theme":h,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 ${f?"ss-dash-connected":""}`,id:"ss-dash-live-dot"}),t("span",{className:`ss-dash-live-label ${f?"ss-dash-connected":""}`,id:"ss-dash-live-label",children:f?"Live":"Polling"})]}),t("div",{className:"ss-dash-header-right",children:[t(Cn,{theme:h,onToggle:d}),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 ${v?"ss-dash-collapsed":""}`,id:"ss-dash-sidebar",children:[t("nav",{className:"ss-dash-nav",children:[P.map(T=>{const F=H[T.id];return t("button",{type:"button",className:`ss-dash-nav-item ${u===T.id?"ss-dash-active":""}`,"data-ss-section":T.id,onClick:()=>{T.id!==u&&c(T.id)},title:v?T.label:void 0,children:[t("span",{className:"ss-dash-nav-icon",children:t("svg",{width:"20",height:"20",viewBox:(j[T.id]||j.config).viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:(j[T.id]||j.config).elements.join("")}})}),t("span",{className:"ss-dash-nav-label",children:T.label}),F&&F.count>0&&t("span",{className:`ss-dash-nav-badge${F.variant?" "+F.variant:""}`,children:F.count})]},T.id)}),m.length>0&&t("div",{className:"ss-dash-nav-sep"}),m.map(T=>t("button",{type:"button",className:`ss-dash-nav-item ${u===T.id?"ss-dash-active":""}`,onClick:()=>c(T.id),title:v?T.label:void 0,children:[t("span",{className:"ss-dash-nav-icon",children:t("svg",{width:"20",height:"20",viewBox:j["custom-pane"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j["custom-pane"].elements.join("")}})}),t("span",{className:"ss-dash-nav-label",children:T.label})]},T.id))]}),t("button",{type:"button",className:"ss-dash-sidebar-toggle",id:"ss-dash-sidebar-toggle",onClick:y,title:v?"Expand sidebar":"Collapse sidebar",children:v?t("svg",{width:"16",height:"16",viewBox:j["chevron-right"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"1.5",dangerouslySetInnerHTML:{__html:j["chevron-right"].elements.join("")}}):t("svg",{width:"16",height:"16",viewBox:j["chevron-left"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"1.5",dangerouslySetInnerHTML:{__html:j["chevron-left"].elements.join("")}})})]}),t("div",{className:"ss-dash-main",children:M()})]})]})}function Bn(e){const s=document.getElementById(e);return s?JSON.parse(s.textContent||"{}"):{}}function Un(){function e(s){document.documentElement.setAttribute("data-theme",s)}e(Ee()),zt(e)}const ce=Bn("ss-dash-config");Un();const Wt=document.getElementById("ss-dash");Wt&&Rs(t(In,{baseUrl:ce.baseUrl,dashboardEndpoint:ce.dashboardEndpoint,debugEndpoint:ce.debugEndpoint,authToken:ce.authToken,backUrl:ce.backUrl,channelName:ce.channelName}),Wt);function U(e,...s){for(const n of s){const r=e[n];if(r!=null)return r}}function Ae(e){return U(e,"createdAt","created_at","timestamp")}function Hn(e){return U(e,"timestamp","createdAt","processedAt","created_at")}function zn(e){return U(e,"statusCode","status_code")}function Wn(e){return U(e,"total_duration","totalDuration","duration")??0}function Vn(e){return U(e,"span_count","spanCount")??0}function Kn(e){return U(e,"warning_count","warningCount")??0}function Vt(e){return U(e,"from_addr","from")??""}function Kt(e){return U(e,"to_addr","to")??""}function Qn(e){return U(e,"cc","cc_addr")??""}function Jn(e){return U(e,"attachment_count","attachmentCount")??0}function Qt(e){return U(e,"event_name","eventName","event")??""}function Jt(e){return U(e,"method","sql_method")??""}function me(e){return U(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 Gn(e){return'"'+(e.length>40?e.slice(0,40)+"...":e)+'"'}function Yn(e,s,n){if(e.length===0)return"[]";const r=e.slice(0,3).map(l=>n(l,30)),i=e.length>3?", ..."+e.length+" items":"",a="["+r.join(", ")+i+"]";return a.length>s?"["+e.length+" items]":a}function Zn(e,s,n){const r=Object.keys(e);if(r.length===0)return"{}";const i=[];for(let h=0;h<Math.min(r.length,4);h++)i.push(r[h]+": "+n(e[r[h]],30));const a=r.length>4?", ...+"+(r.length-4):"",l="{ "+i.join(", ")+a+" }";return l.length<=s?l:"{ "+(r.slice(0,6).join(", ")+(r.length>6?", ...":""))+" }"}function Xn(e){if(!e&&e!==0)return"-";const s=Math.floor(e),n=Math.floor(s/86400),r=Math.floor(s%86400/3600),i=Math.floor(s%3600/60);return n>0?`${n}d ${r}h`:r>0?`${r}h ${i}m`:i>0?`${i}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 Gt(e){return/([+-]\d{2}:?\d{2}|Z)\s*$/.test(e)?e:e+"Z"}function er(e){if(!e)return"-";const s=typeof e=="string"?new Date(Gt(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 Ge(e){if(!e)return"-";const s=typeof e=="string"?new Date(Gt(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 tr(e){return e>sn?"very-slow":e>Bt?"slow":"normal"}function de(e,s="ss-dash"){const n=tr(e);return n==="very-slow"?`${s}-very-slow`:n==="slow"?`${s}-slow`:""}function Ye(e,s=100){return e===null?"null":e===void 0?"-":typeof e=="string"?Gn(e):typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?Yn(e,s,Ye):typeof e=="object"?Zn(e,s,Ye):String(e)}function sr(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 nr(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}const rr={color:"#34d399",fillOpacityTop:.25,fillOpacityBottom:.02,strokeWidth:1.5,width:120,height:32,padding:2};function ar(e){return{...rr,...e}}let ir=0;function lr(){return`ss-grad-${ir++}`}function or(e){if(e.length===0)return null;let s=e[0],n=e[0],r=e[0];for(let i=1;i<e.length;i++){const a=e[i];a<s&&(s=a),a>n&&(n=a),r+=a}return{min:s,max:n,avg:r/e.length}}function cr(e,s){if(e.length<2)return null;const n=ar(s),r=or(e),i=r.max-r.min||1,a=n.width-n.padding*2,l=n.height-n.padding*2,o=n.padding,h=e.length,d=Array.from({length:h});for(let _=0;_<h;_++){const k=o+_/(h-1)*a,S=o+l-(e[_]-r.min)/i*l;d[_]=`${k.toFixed(1)},${S.toFixed(1)}`}const u=d.join(" "),c=(o+a).toFixed(1),v=(o+l).toFixed(1),p=o.toFixed(1),f=`M${d[0]} `+d.slice(1).map(_=>`L${_}`).join(" ")+` L${c},${v} L${p},${v} Z`;return{points:u,areaPath:f,gradientId:lr(),options:n,stats:r}}function Pe({data:e,color:s="#34d399",width:n=120,height:r=32,className:i=""}){const a=W(()=>cr(e,{width:n,height:r}),[e,n,r]),l=W(()=>"ss-grad-"+Math.random().toString(36).slice(2,8),[]),o={"--ss-accent":s};if(!a)return t("div",{className:`ss-dash-sparkline ${i}`,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 h=s||"var(--ss-accent)";return t("div",{className:`ss-dash-sparkline ${i}`,style:o,children:t("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:[t("defs",{children:t("linearGradient",{id:l,x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:h,stopOpacity:"0.25"}),t("stop",{offset:"100%",stopColor:h,stopOpacity:"0.02"})]})}),t("path",{d:a.areaPath,fill:`url(#${l})`}),t("path",{className:"ss-dash-sparkline-line",d:"M"+a.points.replace(/ /g," L"),fill:"none",stroke:h,strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round"})]})})}function ie({ts:e,className:s,style:n}){return e?t("span",{className:s,style:n,title:er(e),children:Ge(e)}):t("span",{className:s,style:n,children:"-"})}const dr=[{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 hr({value:e,onChange:s,className:n=""}){return t("div",{className:`ss-dash-btn-group ${n}`,children:dr.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 ur(e,s){if(e<=0)return[0];const n=e/s,r=Math.pow(10,Math.floor(Math.log10(n))),i=n/r;let a;i<=1?a=r:i<=2?a=2*r:i<=5?a=5*r:a=10*r;const l=[];for(let o=a;o<=e+a*.5;o+=a)l.push(Math.round(o));return l.length===0&&l.push(Math.ceil(e)),l}function Yt(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"})}catch{return""}}function Zt(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],i=e[n+1],a=(r.x+i.x)/2;s+=` C${a.toFixed(1)},${r.y.toFixed(1)} ${a.toFixed(1)},${i.y.toFixed(1)} ${i.x.toFixed(1)},${i.y.toFixed(1)}`}return s}function pr({chartPoints:e}){const s={top:12,right:12,bottom:28,left:38},n=220,r=z(null),[i,a]=x(0);V(()=>{const g=r.current;if(!g)return;a(g.clientWidth);const C=new ResizeObserver(I=>{for(const ee of I)a(ee.contentRect.width)});return C.observe(g),()=>C.disconnect()},[]);const l=i||600,o=l-s.left-s.right,h=n-s.top-s.bottom,d=s.top+h,u=e.map(g=>ae(g,"requestCount","request_count")||g.total||0),c=e.map(g=>ae(g,"errorCount","error_count")),v=Math.max(...u,1),p=Math.ceil(v*1.1),f=c.some(g=>g>0),_=ur(p,4),k=_.length>0?_[_.length-1]:p,S=g=>s.left+g/Math.max(e.length-1,1)*o,b=g=>s.top+h-g/(k||1)*h,m=e.map((g,C)=>({x:S(C),y:b(u[C])})),N=e.map((g,C)=>({x:S(C),y:b(c[C])})),y=Zt(m),A=f?Zt(N):"",P=m.length>1?`${y} L${m[m.length-1].x.toFixed(1)},${d} L${m[0].x.toFixed(1)},${d} Z`:"",q=f&&N.length>1?`${A} L${N[N.length-1].x.toFixed(1)},${d} L${N[0].x.toFixed(1)},${d} Z`:"",R=Math.min(10,e.length),H=Math.max(1,Math.ceil(e.length/R)),[M,T]=x({visible:!1,x:0,idx:-1}),F=E(g=>{const C=m[g].x;T({visible:!0,x:C,idx:g})},[m]),G=E(()=>{T({visible:!1,x:0,idx:-1})},[]),w=120,$=M.visible?Math.max(w/2,Math.min(M.x,l-w/2)):0;return t("div",{ref:r,style:{position:"relative"},children:[t("svg",{viewBox:`0 0 ${l} ${n}`,className:"ss-dash-chart-svg",children:[t("defs",{children:[t("linearGradient",{id:"ss-cg-total",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:"ss-cg-error",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})]})]}),_.map(g=>{const C=b(g);return t("g",{children:[t("line",{x1:s.left,y1:C,x2:l-s.right,y2:C,stroke:"var(--ss-border-faint)",strokeWidth:.5,strokeDasharray:"3,3"}),t("text",{x:s.left-6,y:C,textAnchor:"end",fill:"var(--ss-dim)",fontSize:9,dominantBaseline:"middle",children:g})]},`ytick-${g}`)}),P&&t("path",{d:P,fill:"url(#ss-cg-total)"}),y&&t("path",{d:y,fill:"none",stroke:"var(--ss-accent)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),q&&t("path",{d:q,fill:"url(#ss-cg-error)"}),A&&t("path",{d:A,fill:"none",stroke:"var(--ss-red-fg)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:"4,2"}),e.map((g,C)=>{const I=u[C],ee=c[C],Y=m[C].x,le=m[C].y,ks=o/(e.length||1),Ss=M.visible&&M.idx===C,$s=M.visible&&M.idx!==C;return t("g",{children:[t("rect",{x:Y-ks/2,y:s.top,width:ks,height:h,fill:"transparent",className:"ss-dash-chart-hover-zone","data-idx":C,onMouseEnter:()=>F(C),onMouseLeave:G}),I>0&&t("circle",{cx:Y,cy:le,r:Ss?4:2.5,fill:"var(--ss-accent)",stroke:"var(--ss-surface)",strokeWidth:1,className:"ss-dash-chart-dot","data-idx":C,opacity:$s?.3:1}),ee>0&&t("circle",{cx:Y,cy:N[C].y,r:Ss?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":C,opacity:$s?.3:1})]},C)}),e.map((g,C)=>{if(C%H!==0&&C!==e.length-1)return null;const I=Yt(g.bucket);return I?t("text",{x:S(C),y:n-6,textAnchor:"middle",fill:"var(--ss-dim)",fontSize:9,children:I},`xlabel-${C}`):null})]}),M.visible&&M.idx>=0&&t("div",{className:"ss-dash-chart-tooltip",style:{left:$,top:s.top-4,transform:"translate(-50%, -100%)"},children:[t("div",{children:Yt(e[M.idx].bucket)}),t("div",{children:["Requests: ",u[M.idx]]}),c[M.idx]>0&&t("div",{style:{color:"var(--ss-red-fg)"},children:["Errors: ",c[M.idx]]})]})]})}function Xt({options:e={}}){const[s,n]=x("1h"),{data:r,isLoading:i}=K("overview",e),{data:a}=K("overview/chart",{...e,timeRange:s});if(i&&!r)return t("div",{className:"ss-dash-empty",children:"Loading overview..."});const l=r||{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=l,h=ae(o,"avgResponseTime","avg_response_time"),d=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,f=a?.buckets||[],_=l.sparklines?.avgResponseTime??f.map(m=>m.avgDuration??0),k=l.sparklines?.p95ResponseTime??f.map(m=>m.p95Duration??0),S=l.sparklines?.requestsPerMinute??f.map(m=>m.requestCount??0),b=l.sparklines?.errorRate??f.map(m=>m.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?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(Pe,{data:_,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?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(Pe,{data:k,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(Pe,{data:S,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(Pe,{data:b,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(hr,{value:s,onChange:n})]}),t("div",{className:"ss-dash-chart",id:"ss-dash-chart-area",children:f.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"120px"},children:"No data for this range"}):t(pr,{chartPoints:f})}),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"]}),f.some(m=>(m.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"})}),l.slowestEndpoints.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No data yet"}):t("ul",{className:"ss-dash-secondary-list",children:l.slowestEndpoints.slice(0,5).map((m,N)=>{const y=m.url||m.pattern||"-";return t("li",{children:t("a",{href:`#requests?url=${encodeURIComponent(y)}`,className:"ss-dash-widget-row-link",children:[t("span",{title:y,children:y}),t("span",{className:`ss-dash-secondary-list-value ss-dash-duration ${de(m.avgDuration)}`,children:te(m.avgDuration)})]})},N)})})]}),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:l.queryStats.total})]}),t("li",{children:[t("span",{children:"Avg Duration"}),t("span",{className:"ss-dash-secondary-list-value",children:te(l.queryStats.avgDuration)})]}),t("li",{children:[t("span",{children:"Queries / Request"}),t("span",{className:"ss-dash-secondary-list-value",children:l.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"})}),l.recentErrors.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No recent errors"}):t("ul",{className:"ss-dash-secondary-list",children:l.recentErrors.map((m,N)=>t("li",{children:t("a",{href:`#logs?id=${m.id??""}`,className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},title:m.message,children:m.message}),m.timestamp&&t(ie,{ts:m.timestamp,className:"ss-dash-secondary-list-value",style:{color:"var(--ss-dim)"}})]})},N))})]}),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"})}),l.topEvents.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No events yet"}):t("ul",{className:"ss-dash-secondary-list",children:l.topEvents.slice(0,5).map((m,N)=>{const y=Qt(m);return t("li",{children:t("a",{href:`#events?event_name=${encodeURIComponent(y)}`,className:"ss-dash-widget-row-link",children:[t("span",{children:y}),t("span",{className:"ss-dash-secondary-list-value",children:m.count})]})},N)})})]}),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:l.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:l.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:l.emailActivity.failed>0?{color:"var(--ss-red-fg)"}:void 0,children:l.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:l.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:l.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:l.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:l.logLevelBreakdown.debug})]})})]})]}),l.cacheStats&&l.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:l.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:[l.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:l.cacheStats.memoryUsedHuman})]})})]})]}),l.jobQueueStatus&&l.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:l.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:l.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:l.jobQueueStatus.failed>0?{color:"var(--ss-red-fg)"}:void 0,children:l.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:l.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:l.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:l.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:l.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:l.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"})}),l.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:l.slowestQueries.slice(0,5).map((m,N)=>{const y=me(m)||"-";return t("li",{children:t("a",{href:`#queries?pattern=${encodeURIComponent(y)}`,className:"ss-dash-widget-row-link",children:[t("span",{title:y,children:y}),t("span",{className:`ss-dash-secondary-list-value ss-dash-duration ${de(m.avgDuration)}`,children:te(m.avgDuration)})]})},N)})})]})]})]})}const fr=Object.freeze(Object.defineProperty({__proto__:null,OverviewSection:Xt,default:Xt},Symbol.toStringTag,{value:"Module"}));function mr(e){if(!e)return[];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function vr(e){if(!e)return[];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function Ze(e,s,n,r=0){return e[s]??e[n]??r}function _r(e){return{method:e.method||"",url:e.url||"",statusCode:Ze(e,"status_code","statusCode"),totalDuration:Ze(e,"total_duration","totalDuration")||e.duration||0,spanCount:Ze(e,"span_count","spanCount"),spans:mr(e.spans),warnings:vr(e.warnings),logs:e.logs||[],httpRequestId:e.httpRequestId||e.http_request_id||void 0}}function es(e="",s){const n=z(null);return E(()=>(n.current||(n.current=new Qe({baseUrl:e,authToken:s})),n.current),[e,s])}function gr({color:e="muted",children:s,className:n="",classPrefix:r="ss-dash"}){return t("span",{className:`${r}-badge ${r}-badge-${e} ${n}`,children:s})}function Xe({method:e,className:s="",classPrefix:n="ss-dash"}){return t("span",{className:`${n}-method ${n}-method-${e.toLowerCase()} ${s}`,children:e})}function ts({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 yr(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 ss(e){const s={};for(const[n,r]of Object.entries(e))$r.has(n)||(s[n]=r);return Object.keys(s).length>0?s:null}const br=["all","error","warn","info","debug"];function wr(e){return(e.levelName||e.level_name||(typeof e.level=="string"?e.level:"")||"info").toLowerCase()}function xr(e){return e.msg||e.message||JSON.stringify(e)}function Nr(e){return e.createdAt||e.created_at||e.time||e.timestamp||0}function kr(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 Sr(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 $r=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 Cr(e){if(e.data){const s=yr(e.data);if(s){const n=ss(s);if(n)return n}}return ss(e)}function Re({data:e,maxPreviewLength:s=100,className:n="",classPrefix:r="ss-dash",defaultExpanded:i=!1}){const[a,l]=x(i),o=W(()=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},[e]),h=W(()=>typeof o=="object"&&o!==null?Ye(o,s):String(o??"-"),[o,s]),d=W(()=>typeof o=="object"&&o!==null?JSON.stringify(o,null,2):String(o),[o]),u=E(()=>{l(v=>!v)},[]),c=E(async()=>{try{await navigator.clipboard.writeText(d)}catch{}},[d]);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:v=>v.key==="Enter"&&u(),children:h}),a&&t("div",{className:`${r}-data-full`,onClick:u,children:[t("button",{className:`${r}-copy-btn`,onClick:v=>{v.stopPropagation(),c()},title:"Copy to clipboard",type:"button",children:"Copy"}),t("pre",{children:d})]})]})}function ns({log:e,index:s,expanded:n,onToggleExpand:r,onReqIdClick:i}){const a=wr(e),l=xr(e),o=Nr(e),h=kr(e),d=Cr(e);return t(Ot.Fragment,{children:[t("div",{className:`ss-log-entry${d?" ss-log-entry-expandable":""}`,onClick:()=>d&&r(s),children:[t("span",{className:`ss-log-level ${Sr(a,"ss-log-level")}`,children:a.toUpperCase()}),t(ie,{ts:o,className:"ss-log-time"}),h?t("span",{className:"ss-log-reqid",title:h,onClick:i?u=>{u.stopPropagation(),i(h)}:void 0,role:i?"button":void 0,tabIndex:i?0:void 0,onKeyDown:i?u=>{u.key==="Enter"&&(u.stopPropagation(),i(h))}:void 0,children:h.slice(0,8)}):t("span",{className:"ss-log-reqid-empty",children:"--"}),d?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:l})]}),n&&d&&t("div",{className:"ss-log-detail",children:t(Re,{data:d,classPrefix:"ss-dbg",defaultExpanded:!0})})]})}function Tr({logs:e,onReqIdClick:s}){const[n,r]=x(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((i,a)=>t(ns,{log:i,index:a,expanded:n===a,onToggleExpand:l=>r(n===l?null:l),onReqIdClick:s},i.id||a))})]})}function Lr(e){const{container:s,handle:n,topPane:r,bottomPane:i,storageKey:a,minHeight:l=60}=e;if(a){const h=localStorage.getItem(a);if(h){const d=parseFloat(h);d>0&&d<1&&(r.style.flex=`${d}`,i.style.flex=`${1-d}`)}}function o(h){h.preventDefault(),n.setPointerCapture(h.pointerId);const u=s.getBoundingClientRect().height,c=h.clientY,v=r.getBoundingClientRect().height;function p(_){const k=_.clientY-c;let S=v+k;const b=u-l-n.offsetHeight;S=Math.max(l,Math.min(S,b));const m=S/(u-n.offsetHeight);r.style.flex=`${m}`,i.style.flex=`${1-m}`}function f(){if(n.removeEventListener("pointermove",p),n.removeEventListener("pointerup",f),a){const _=s.getBoundingClientRect().height-n.offsetHeight;if(_>0){const k=r.getBoundingClientRect().height/_;localStorage.setItem(a,String(k))}}}n.addEventListener("pointermove",p),n.addEventListener("pointerup",f)}return n.addEventListener("pointerdown",o),()=>{n.removeEventListener("pointerdown",o)}}function Er({children:e,storageKey:s}){const n=z(null),r=z(null),i=z(null),a=z(null);return V(()=>{if(n.current&&r.current&&i.current&&a.current)return Lr({container:n.current,handle:r.current,topPane:i.current,bottomPane:a.current,storageKey:s})},[s]),t("div",{ref:n,className:"ss-split-container",children:[t("div",{ref:i,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 Ar="ss-col-resize",rs="ss-resizing";function as(e){const s=Array.from(e.querySelectorAll("thead th"));if(s.length===0)return()=>{};const n=[];let r=!1;function i(){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 l=function(h){h.preventDefault(),h.stopPropagation(),i();const d=h.clientX,u=a.offsetWidth;o.classList.add(rs),o.setPointerCapture(h.pointerId);function c(p){const f=p.clientX-d,_=Math.max(30,u+f);a.style.width=_+"px"}function v(){o.classList.remove(rs),o.removeEventListener("pointermove",c),o.removeEventListener("pointerup",v)}o.addEventListener("pointermove",c),o.addEventListener("pointerup",v)};if(!a.textContent?.trim())continue;const o=document.createElement("div");o.className=Ar,a.appendChild(o),o.addEventListener("pointerdown",l),n.push(()=>{o.removeEventListener("pointerdown",l),o.remove()})}return()=>{for(const a of n)a()}}function Pr(e=[]){const s=z(null),n=z(null);return V(()=>(s.current&&(n.current?.(),n.current=as(s.current)),()=>{n.current?.(),n.current=null}),e),E(i=>{n.current?.(),n.current=null,s.current=i,i&&(n.current=as(i))},[])}function se({columns:e,data:s,keyField:n="id",sort:r,sortDir:i,onSort:a,onRowClick:l,rowClassName:o,emptyMessage:h="No data",className:d="",renderAfterRow:u}){const c=E(p=>{a&&a(p)},[a]),v=Pr([s,e]);return s.length===0?t("div",{className:"ss-dash-empty",children:h}):t("table",{ref:v,className:`ss-dash-table ${d}`,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:i==="asc"?" ▲":" ▼"})]},p.key))})}),t("tbody",{children:s.map((p,f)=>{const _=o?typeof o=="function"?o(p):o:"",k=l?"ss-dash-clickable":"";return t(Ot.Fragment,{children:[t("tr",{onClick:l?()=>l(p):void 0,className:`${k} ${_}`.trim(),children:e.map(S=>t("td",{children:S.render?S.render(p[S.key],p):p[S.key]??"-"},S.key))}),u?u(p,f):null]},p[n]??f)})})]})}function ne({search:e,onSearchChange:s,placeholder:n="Search...",summary:r,children:i,className:a=""}){const l=E(()=>{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:j.search.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j.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:l,children:"×"})]}),i&&t("div",{className:"ss-dbg-filter-controls",children:i})]})}function he({page:e,lastPage:s,total:n,onPageChange:r,className:i=""}){const a=W(()=>hn(e,s),[e,s]),l=E(()=>{e>1&&r(e-1)},[e,r]),o=E(()=>{e<s&&r(e+1)},[e,s,r]);return s<=1?null:t("div",{className:`ss-dash-pagination ${i}`,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:l,disabled:e<=1,children:"« Prev"}),a.map((h,d)=>h==="..."?t("span",{className:"ss-dash-page-ellipsis",children:"..."},`ellipsis-${d}`):t("button",{type:"button",className:`ss-dash-page-btn ${h===e?"ss-dash-active":""}`,onClick:()=>r(h),children:h},h)),t("button",{type:"button",className:"ss-dash-page-btn",onClick:o,disabled:e>=s,children:"Next »"})]})]})}const is={request:"#1e3a5f",middleware:"rgba(30, 58, 95, 0.7)",db:"#6d28d9",view:"#0e7490",mail:"#059669",event:"#b45309",custom:"var(--ss-dim)"},Rr={request:"Request",middleware:"Middleware",db:"DB",mail:"Mail",event:"Event",view:"View",custom:"Custom"};function ls({spans:e,totalDuration:s,className:n="",warnings:r}){const i=e||[],a=W(()=>[...i].sort((o,h)=>o.startOffset-h.startOffset),[i]),l=W(()=>{const o={};for(const h of a)o[h.id]=h.parentId?(o[h.parentId]||0)+1:0;return o},[a]);return i.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(Rr).map(([o,h])=>t("div",{className:"ss-dash-tl-legend-item",children:[t("span",{className:"ss-dash-tl-legend-dot",style:{background:is[o]||is.custom}}),t("span",{children:h})]},o))}),a.map(o=>{const h=s>0?o.startOffset/s*100:0,d=s>0?Math.max(o.duration/s*100,.5):1,u=l[o.id]||0,c=o.label.length>50?o.label.slice(0,50)+"...":o.label,v=o.category==="db"?"DB":o.category,p=o.category==="db"?"purple":o.category==="mail"?"green":o.category==="event"?"amber":o.category==="view"?"blue":"muted",f=o.metadata?Object.entries(o.metadata).filter(([,k])=>k!=null).map(([k,S])=>`${k}=${S}`).join(", "):"",_=f?`${o.label} (${o.duration.toFixed(2)}ms)
|
|
2
|
+
${f}`:`${o.label} (${o.duration.toFixed(2)}ms)`;return t("div",{className:"ss-dash-tl-row",children:[t("div",{className:"ss-dash-tl-label",title:_,style:{paddingLeft:8+u*16+"px"},children:[t("span",{className:`ss-dash-badge ss-dash-badge-${p}`,style:{fontSize:"9px",marginRight:"4px"},children:v}),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:`${h}%`,width:`${d}%`},title:_})}),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,h)=>t("div",{className:"ss-dash-tl-warning",children:o},h))]})]})}function os({options:e={}}){const[s,n]=x(1),[r,i]=x(""),[a,l]=x("createdAt"),[o,h]=x("desc"),[d,u]=x(null),[c,v]=x(!1);V(()=>n(1),[r]);const{data:p,meta:f,isLoading:_,error:k}=K("requests",{...e,page:s,search:r,sort:a,sortDir:o}),S=es(e.baseUrl||"",e.authToken),b=E(y=>{const A=y.id;v(!0);const P=e.dashboardEndpoint||"/__stats/api";S().fetch(`${P}/requests/${A}`).then(q=>{const R=q,H=R.trace;if(H){const M={...R,...H,logs:R.logs};u(M)}else u(q);v(!1)}).catch(()=>{v(!1)})},[S,e.dashboardEndpoint]),m=E(y=>{a===y?h(A=>A==="asc"?"desc":"asc"):(l(y),h("desc"))},[a]),N=p||[];if(d){const y=_r(d),A=y.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(Xe,{method:y.method}),t("span",{style:{color:"var(--ss-text)"},children:y.url}),t(ts,{code:y.statusCode}),t("span",{className:"ss-dash-tl-meta",children:[y.totalDuration.toFixed(1),"ms · ",y.spanCount," spans"]})]}),A?t(Er,{storageKey:"ss-requests-split",children:[t(ls,{spans:y.spans,totalDuration:y.totalDuration,warnings:y.warnings}),t(Tr,{logs:y.logs})]}):t(ls,{spans:y.spans,totalDuration:y.totalDuration,warnings:y.warnings})]})}return c?t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:t("button",{type:"button",className:"ss-dash-btn",onClick:()=>v(!1),children:"← Back to Requests"})}),t("div",{className:"ss-dash-empty",children:"Loading request detail..."})]}):t("div",{children:[t(ne,{search:r,onSearchChange:i,placeholder:"Filter requests...",summary:`${f?.total??0} requests`}),k&&t("div",{className:"ss-dash-empty",children:"Failed to load requests"}),_&&!p?t("div",{className:"ss-dash-empty",children:"Loading requests..."}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:y=>t("span",{style:{color:"var(--ss-dim)"},children:y})},{key:"method",label:"Method",width:"70px",sortable:!0,render:y=>t(Xe,{method:y})},{key:"url",label:"URL",sortable:!0,render:y=>t("span",{style:{color:"var(--ss-text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:y,children:y})},{key:"statusCode",label:"Status",width:"60px",sortable:!0,render:(y,A)=>{const P=zn(A);return t(ts,{code:P})}},{key:"duration",label:"Duration",width:"80px",sortable:!0,render:(y,A)=>{const P=Wn(A);return t("span",{className:`ss-dash-duration ${de(P)}`,children:[P.toFixed(1),"ms"]})}},{key:"spanCount",label:"Spans",width:"50px",render:(y,A)=>{const P=Vn(A);return t("span",{style:{color:"var(--ss-muted)",textAlign:"center"},children:P})}},{key:"warningCount",label:"⚠",width:"40px",render:(y,A)=>{const P=Kn(A);return P>0?t("span",{style:{color:"var(--ss-amber-fg)",textAlign:"center",display:"block"},children:P}):t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:"-"})}},{key:"createdAt",label:"Time",width:"80px",sortable:!0,render:(y,A)=>{const P=Ae(A)??"";return t(ie,{ts:P,className:"ss-dash-event-time"})}}],data:N,sort:a,sortDir:o,onSort:m,onRowClick:b,emptyMessage:"No requests recorded yet"})}),f&&t(he,{page:f.page,lastPage:f.lastPage,total:f.total,onPageChange:n})]})]})}const Mr=Object.freeze(Object.defineProperty({__proto__:null,RequestsSection:os,default:os},Symbol.toStringTag,{value:"Module"}));function cs({node:e,depth:s=0}){if(!e)return null;const n=s*20,r=e["Node Type"]||"Unknown",i=e["Relation Name"]?t(D,{children:[" on ",t("strong",{children:e["Relation Name"]})]}):null,a=e.Alias&&e.Alias!==e["Relation Name"]?` (${e.Alias})`:"",l=e["Index Name"]?t(D,{children:[" using ",t("em",{children:e["Index Name"]})]}):null,o=[];if(e["Startup Cost"]!==null&&e["Startup Cost"]!==void 0&&o.push(`cost=${e["Startup Cost"]}..${e["Total Cost"]}`),e["Plan Rows"]!==null&&e["Plan Rows"]!==void 0&&o.push(`rows=${e["Plan Rows"]}`),e["Plan Width"]!==null&&e["Plan Width"]!==void 0&&o.push(`width=${e["Plan Width"]}`),e.Filter&&o.push(`filter: ${e.Filter}`),e["Index Cond"]&&o.push(`cond: ${e["Index Cond"]}`),e["Hash Cond"]&&o.push(`hash: ${e["Hash Cond"]}`),e["Join Type"]&&o.push(`join: ${e["Join Type"]}`),e["Sort Key"]){const d=Array.isArray(e["Sort Key"])?e["Sort Key"].join(", "):e["Sort Key"];o.push(`sort: ${d}`)}const h=e.Plans||[];return t("div",{className:"ss-dash-explain-node",style:{marginLeft:`${n}px`},children:[t("div",{className:"ss-dash-explain-node-header",children:[t("span",{className:"ss-dash-explain-node-type",children:r}),i,a,l]}),o.length>0&&t("div",{className:"ss-dash-explain-metrics",children:o.join(" · ")}),h.map((d,u)=>t(cs,{node:d,depth:s+1},u))]})}function Dr({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(s&&s.Plan)return t("div",{className:"ss-dash-explain-result",children:t(cs,{node:s.Plan,depth:0})});if(typeof s=="object"&&s!==null){const n=Object.keys(s);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,i)=>{const a=r;return t("tr",{children:n.map(l=>t("td",{children:a[l]!==null&&a[l]!==void 0?String(a[l]):"-"},l))},i)})})]})})}return t("div",{className:"ss-dash-explain-result",children:"No plan data returned"})}const qr=8;function ds({options:e={}}){const[s,n]=x(1),[r,i]=x(""),[a,l]=x("createdAt"),[o,h]=x("desc"),[d,u]=x("list"),[c,v]=x(null),[p,f]=x(null),[_,k]=x(null),S=E(w=>{w!==d&&(u(w),n(1),l(w==="list"?"createdAt":"count"),h("desc"),v(null),f(null),k(null))},[d]);V(()=>n(1),[r]);const b=d==="grouped"?"queries/grouped":"queries",{data:m,meta:N,isLoading:y,getApi:A}=K(b,{...e,page:s,search:r,sort:a,sortDir:o}),P=E(w=>{a===w?h($=>$==="asc"?"desc":"asc"):(l(w),h("desc"))},[a]),q=E(async w=>{if(p&&p.queryId===w){f(null);return}k(w);try{const $=await A().explainQuery(w);$&&$.error?f({queryId:w,plan:[],error:$.error,message:$.message}):f({queryId:w,plan:$?.plan||$?.rows||[]})}catch($){console.warn("[ss] Query explain failed:",$),f({queryId:w,plan:[],error:$ instanceof Error?$.message:String($)})}finally{k(null)}},[A,p]),R=E(w=>{const $=w.id;return!p||p.queryId!==$?null:t("tr",{className:"ss-dash-explain-row",children:t("td",{colSpan:qr,className:"ss-dash-explain",children:t("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[t("div",{style:{flex:1},children:p.error?t("div",{className:"ss-dash-explain-result ss-dash-explain-error",children:[t("strong",{children:"Error:"})," ",p.error,p.message&&t(D,{children:[t("br",{}),p.message]})]}):t(Dr,{plan:p.plan})}),t("button",{type:"button",className:"ss-dash-explain-btn",onClick:()=>f(null),style:{marginLeft:"8px",flexShrink:0},children:"Close"})]})})})},[p]),H=d==="grouped"?m?.groups||[]:m||[],M=W(()=>d!=="grouped"?H:H.map(w=>{const $={...w};return $.sqlNormalized??=U(w,"sql_normalized","pattern")??void 0,$.count??=U(w,"total_count"),$.avgDuration??=U(w,"avg_duration"),$.maxDuration??=U(w,"max_duration"),$.minDuration??=U(w,"min_duration"),$.totalDuration??=U(w,"total_duration"),$.percentOfTotal??=U(w,"pct_time"),$}),[H,d]),T=W(()=>{const w=N?.total??M.length;let $=0,g=0,C=0,I=0;for(const Y of M){const le=Y.duration||0;C+=le,I++,le>Bt&&$++}const ee=new Map;for(const Y of M){const le=me(Y);ee.set(le,(ee.get(le)||0)+1)}for(const Y of ee.values())Y>1&&(g+=Y);return{total:w,slow:$,duplicates:g,avgDuration:I>0?C/I:0}},[M,N]),F=W(()=>{const w=new Map;for(const $ of M){const g=me($);w.set(g,(w.get(g)||0)+1)}return w},[M]),G=W(()=>{if(d==="grouped")return`${M.length} query patterns`;const w=[`${T.total} queries`];return T.slow>0&&w.push(`${T.slow} slow`),T.duplicates>0&&w.push(`${T.duplicates} dup`),w.push(`avg ${(T.avgDuration||0).toFixed(1)}ms`),w.join(", ")},[d,M.length,T]);return t("div",{children:[t(ne,{search:r,onSearchChange:i,placeholder:"Filter queries...",summary:G,children:t("div",{className:"ss-dash-btn-group",children:[t("button",{type:"button",className:`ss-dash-btn ${d==="list"?"ss-dash-active":""}`,onClick:()=>S("list"),children:"List"}),t("button",{type:"button",className:`ss-dash-btn ${d==="grouped"?"ss-dash-active":""}`,onClick:()=>S("grouped"),children:"Grouped"})]})}),y&&!m?t("div",{className:"ss-dash-empty",children:"Loading queries..."}):d==="grouped"?t(D,{children:t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"sqlNormalized",label:"Pattern",render:(w,$)=>{const g=w||"",C=($.count||0)>=3;return t(D,{children:[t("span",{className:`ss-dash-sql ${c===g?"ss-dash-expanded":""}`,title:"Click to expand",onClick:I=>{I.stopPropagation(),v(c===g?null:g)},role:"button",tabIndex:0,onKeyDown:I=>I.key==="Enter"&&v(c===g?null:g),children:g}),C&&t(D,{children:[" ",t("span",{className:"ss-dash-dup",children:"DUP"})]})]})}},{key:"count",label:"Count",width:"60px",sortable:!0,render:w=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:w||0})},{key:"avgDuration",label:"Avg",width:"70px",sortable:!0,render:w=>{const $=w||0;return t("span",{className:`ss-dash-duration ${de($)}`,children:$.toFixed(2)+"ms"})}},{key:"minDuration",label:"Min",width:"70px",render:w=>t("span",{className:"ss-dash-duration",children:(w||0).toFixed(2)+"ms"})},{key:"maxDuration",label:"Max",width:"70px",render:w=>{const $=w||0;return t("span",{className:`ss-dash-duration ${de($)}`,children:$.toFixed(2)+"ms"})}},{key:"totalDuration",label:"Total",width:"70px",sortable:!0,render:w=>t("span",{className:"ss-dash-duration",children:(w||0).toFixed(1)+"ms"})},{key:"percentOfTotal",label:"% Time",width:"60px",render:w=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:(w||0).toFixed(1)+"%"})}],data:M,keyField:"sqlNormalized",sort:a,sortDir:o,onSort:P,emptyMessage:t(D,{children:["No queries recorded",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"})]})]})})})}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:w=>t("span",{style:{color:"var(--ss-dim)"},children:w})},{key:"sql",label:"SQL",render:(w,$)=>{const g=$.sql||$.sql_text||"";return t("div",{children:[t("span",{className:`ss-dash-sql ${c===$.id?"ss-dash-expanded":""}`,title:"Click to expand",onClick:C=>{C.stopPropagation(),v(c===$.id?null:$.id)},role:"button",tabIndex:0,onKeyDown:C=>C.key==="Enter"&&v(c===$.id?null:$.id),children:g}),(F.get(me($))??0)>1&&t("span",{className:"ss-dash-dup",children:["×",F.get(me($))]})]})}},{key:"duration",label:"Duration",width:"70px",sortable:!0,render:w=>{const $=w||0;return t("span",{className:`ss-dash-duration ${de($)}`,children:$.toFixed(2)+"ms"})}},{key:"method",label:"Method",width:"60px",render:(w,$)=>{const g=Jt($);return t("span",{className:`ss-dash-method ss-dash-method-${g.toLowerCase()}`,children:g})}},{key:"model",label:"Model",width:"90px",render:w=>t("span",{style:{color:"var(--ss-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:w,children:w||"-"})},{key:"connection",label:"Connection",width:"80px",render:w=>t("span",{style:{color:"var(--ss-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w||"-"})},{key:"createdAt",label:"Time",width:"90px",sortable:!0,render:(w,$)=>{const g=w||(Ae($)??"");return t(ie,{ts:g,className:"ss-dash-event-time"})}},{key:"id",label:"",width:"70px",render:(w,$)=>{if(Jt($)!=="select")return null;const C=p?.queryId===$.id&&!p?.error;return t("button",{type:"button",className:`ss-dash-explain-btn${C?" ss-dash-explain-btn-active":""}`,onClick:I=>{I.stopPropagation(),q($.id)},disabled:_===$.id,children:_===$.id?"...":"EXPLAIN"})}}],data:M,sort:a,sortDir:o,onSort:P,emptyMessage:t(D,{children:["No queries recorded",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"})]})]}),renderAfterRow:R})}),N&&t(he,{page:N.page,lastPage:N.lastPage,total:N.total,onPageChange:n})]})]})}const Fr=Object.freeze(Object.defineProperty({__proto__:null,QueriesSection:ds,default:ds},Symbol.toStringTag,{value:"Module"}));function hs({options:e={}}){const[s,n]=x(1),[r,i]=x(""),{data:a,meta:l,isLoading:o}=K("events",{...e,page:s,search:r}),h=a||[];return V(()=>n(1),[r]),t("div",{children:[t(ne,{search:r,onSearchChange:i,placeholder:"Filter events...",summary:`${l?.total??0} events`}),o&&!a?t("div",{className:"ss-dash-empty",children:"Loading events..."}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:d=>t("span",{style:{color:"var(--ss-dim)"},children:d})},{key:"eventName",label:"Event",render:(d,u)=>{const c=Qt(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:d=>t(Re,{data:d,maxPreviewLength:80,className:"ss-dash-event-data"})},{key:"createdAt",label:"Time",width:"80px",render:(d,u)=>{const c=Ae(u);return t(ie,{ts:c,className:"ss-dash-event-time"})}}],data:h,emptyMessage:"No events recorded yet"})}),l&&t(he,{page:l.page,lastPage:l.lastPage,total:l.total,onPageChange:n})]})]})}const jr=Object.freeze(Object.defineProperty({__proto__:null,EventsSection:hs,default:hs},Symbol.toStringTag,{value:"Module"}));function us({options:e={}}){const[s,n]=x(""),{data:r,isLoading:i,error:a}=K("routes",{...e,search:s}),l=r,o=Array.isArray(l)?l:l&&Array.isArray(l.routes)?l.routes:l&&Array.isArray(l.data)?l.data:[],h={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};return t("div",{children:[t(ne,{search:s,onSearchChange:n,placeholder:"Filter routes...",summary:`${o.length} routes`}),a?t("div",{className:"ss-dash-empty",children:"Failed to load routes"}):i&&!r?t("div",{className:"ss-dash-empty",children:"Loading routes..."}):t(D,{children:t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"method",label:"Method",width:"70px",render:d=>t(Xe,{method:d})},{key:"pattern",label:"Pattern",render:d=>t("span",{style:{color:"var(--ss-text)",...h},title:d,children:d})},{key:"name",label:"Name",width:"120px",render:d=>t("span",{style:{color:"var(--ss-muted)",...h},title:d||"-",children:d||"-"})},{key:"handler",label:"Handler",render:d=>t("span",{style:{color:"var(--ss-sql-color)",...h},title:d,children:d})},{key:"middleware",label:"Middleware",render:d=>{const u=d?.length?d.join(", "):"-";return t("span",{style:{color:"var(--ss-dim)",fontSize:"10px",...h},title:u,children:u})}}],data:o,keyField:"pattern",emptyMessage:"No routes available"})})})]})}const Or=Object.freeze(Object.defineProperty({__proto__:null,RoutesSection:us,default:us},Symbol.toStringTag,{value:"Module"}));function ps({options:e={}}){const[s,n]=x(1),[r,i]=x(""),[a,l]=x("all"),[o,h]=x(""),[d,u]=x(""),[c,v]=x([]),[p,f]=x("level"),[_,k]=x("equals"),[S,b]=x(""),[m,N]=x(null),y={};a!=="all"&&(y.level=a),o&&(y.request_id=o),c.forEach((g,C)=>{y[`filter_field_${C}`]=g.field,y[`filter_op_${C}`]=g.operator,y[`filter_value_${C}`]=g.value});const{data:A,meta:P,isLoading:q}=K("logs",{...e,page:s,search:r,filters:y}),R=A||[],H=E(g=>{h(g),u(g),n(1)},[]),M=E(()=>{const g=d.trim();h(g),n(1)},[d]),T=E(()=>{h(""),u(""),n(1)},[]),F=E(()=>{l("all"),n(1)},[]),G=E(()=>{const g=S.trim();g&&(v(C=>[...C,{field:p,operator:_,value:g}]),b(""))},[p,_,S]),w=E(g=>{v(C=>C.filter((I,ee)=>ee!==g))},[]),$=a!=="all"||o!==""||c.length>0;return t("div",{children:[t(ne,{search:r,onSearchChange:i,placeholder:"Search logs...",summary:`${P?.total??0} logs`,children:t("div",{className:"ss-dash-log-filters",children:[br.map(g=>t("button",{type:"button",className:`ss-dash-log-filter ${a===g?"ss-dash-active":""}`,onClick:()=>{l(g),n(1)},children:g},g)),t("input",{type:"text",className:"ss-dash-filter-input ss-dash-reqid-input",placeholder:"Filter by request ID...",value:d,onChange:g=>u(g.target.value),onKeyDown:g=>g.key==="Enter"&&M()}),(d||o)&&t("button",{type:"button",className:"ss-dash-btn ss-dash-reqid-clear",onClick:()=>{T()},children:"Clear"})]})}),t("div",{className:"ss-dash-structured-search",children:[t("select",{className:"ss-dash-filter-select",value:p,onChange:g=>f(g.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:_,onChange:g=>k(g.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:S,onChange:g=>b(g.target.value),onKeyDown:g=>g.key==="Enter"&&G()}),t("button",{type:"button",className:"ss-dash-btn",onClick:G,children:"Add"})]}),$&&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:F,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:T,children:"×"})]}),c.map((g,C)=>t("span",{className:"ss-dash-filter-chip",children:[g.field," ",g.operator,' "',g.value,'"',t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:()=>w(C),children:"×"})]},C))]}),q&&!A?t("div",{className:"ss-dash-empty",children:"Loading logs..."}):R.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:R.map((g,C)=>t(ns,{log:g,index:C,expanded:m===C,onToggleExpand:I=>N(m===I?null:I),onReqIdClick:H},g.id||C))}),P&&t(he,{page:P.page,lastPage:P.lastPage,total:P.total,onPageChange:n})]})}const Ir=Object.freeze(Object.defineProperty({__proto__:null,LogsSection:ps,default:ps},Symbol.toStringTag,{value:"Module"}));function Br({email:e,previewHtml:s,isLoading:n=!1,onClose:r,className:i}){return t("div",{className:i||"ss-email-preview",children:[t("div",{className:"ss-email-preview-header",children:[t("div",{className:"ss-email-preview-meta",children:e&&t(D,{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 fs({options:e={}}){const[s,n]=x(1),[r,i]=x(""),[a,l]=x(null),[o,h]=x(null),{data:d,meta:u,isLoading:c}=K("emails",{...e,page:s,search:r}),v=d||[];V(()=>n(1),[r]);const p=E(async f=>{if(f.html){l(f.id),h(f.html);return}try{const{baseUrl:_="",dashboardEndpoint:k="/__stats/api",authToken:S}=e,b=`${_}${k}/emails/${f.id}/preview`,m={Accept:"text/html"};S&&(m.Authorization=`Bearer ${S}`);const y=await(await fetch(b,{headers:m,credentials:"same-origin"})).text();l(f.id),h(y)}catch{}},[e]);if(a&&o){const f=v.find(k=>k.id===a),_=f?{subject:f.subject,from:Vt(f),to:Kt(f),cc:Qn(f)||null,status:f.status,mailer:f.mailer}:null;return t(Br,{email:_,previewHtml:o,onClose:()=>{l(null),h(null)},className:"ss-dash-email-preview"})}return t("div",{children:[t(ne,{search:r,onSearchChange:i,placeholder:"Filter emails...",summary:`${u?.total??0} emails`}),c&&!d?t("div",{className:"ss-dash-empty",children:"Loading emails..."}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"#",width:"40px",render:f=>t("span",{style:{color:"var(--ss-dim)"},children:f})},{key:"from",label:"From",width:"150px",render:(f,_)=>{const k=Vt(_);return t("span",{title:k,style:{color:"var(--ss-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:k})}},{key:"to",label:"To",width:"150px",render:(f,_)=>{const k=Kt(_);return t("span",{title:k,style:{color:"var(--ss-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:k})}},{key:"subject",label:"Subject",render:f=>{const _=f||"";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:f=>{const _=f||"";return t("span",{className:`ss-dash-badge ss-dash-email-status-${_}`,children:_})}},{key:"attachmentCount",label:"ATT",width:"40px",render:(f,_)=>{const k=Jn(_);return k>0?t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:k}):t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:"-"})}},{key:"mailer",label:"Mailer",width:"70px",render:f=>{const _=f||"";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:(f,_)=>{const k=Ae(_);return t(ie,{ts:k,className:"ss-dash-event-time",style:{whiteSpace:"nowrap"}})}}],data:v,onRowClick:p,rowClassName:"ss-dash-email-row",emptyMessage:"No emails captured yet"})}),u&&t(he,{page:u.page,lastPage:u.lastPage,total:u.total,onPageChange:n})]})]})}const Ur=Object.freeze(Object.defineProperty({__proto__:null,EmailsSection:fs,default:fs},Symbol.toStringTag,{value:"Module"}));function Hr({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 ms({options:e={}}){const[s,n]=x(""),[r,i]=x(null),[a,l]=x(null),[o,h]=x(!1),[d,u]=x(null),{data:c,isLoading:v,mutate:p,getApi:f}=K("cache",{...e,search:s}),_=c,k=E(async b=>{if(confirm(`Delete cache key "${b}"?`))try{await p(`cache/${encodeURIComponent(b)}`,"delete"),r===b&&(i(null),l(null),u(null))}catch{}},[p,r]),S=E(async b=>{if(r===b){i(null),l(null),u(null);return}i(b),l(null),u(null),h(!0);try{const N=await f().fetchCacheKey(b);l(N.value!==void 0?N.value:N.data!==void 0?N.data:N),u(null)}catch{l(null),u("Failed to fetch key value")}finally{h(!1)}},[r,f]);return t("div",{children:[_?.available&&_?.stats&&t(Hr,{hitRate:_.stats.hitRate??0,hits:_.stats.hits??0,misses:_.stats.misses??0,keys:_.stats.totalKeys||_.stats.keyCount||_.keys?.length||0}),t(ne,{search:s,onSearchChange:n,placeholder:"Filter cache keys...",summary:`${(_?.keys||_?.data||[]).length} keys`}),v&&!c?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:b=>t("span",{title:b,style:{color:"var(--ss-sql-color)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:b})},{key:"type",label:"Type",width:"70px",render:b=>t("span",{style:{color:"var(--ss-muted)"},children:b})},{key:"size",label:"Size",width:"60px",render:b=>b!=null&&b>0?nr(b):"-"},{key:"ttl",label:"TTL",width:"70px",render:b=>b>0?sr(b):"-"},{key:"_actions",label:"",width:"60px",render:(b,m)=>t("button",{type:"button",className:"ss-dash-retry-btn",onClick:N=>{N.stopPropagation(),k(m.key)},children:"Delete"})}],data:_.keys||_.data||[],keyField:"key",onRowClick:b=>S(b.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..."}):d?t("div",{className:"ss-dash-empty",style:{color:"var(--ss-red-fg)"},children:d}):t(Re,{data:a})]})]})}const zr=Object.freeze(Object.defineProperty({__proto__:null,CacheSection:ms,default:ms},Symbol.toStringTag,{value:"Module"})),Wr=["all","active","waiting","delayed","completed","failed"];function Vr(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 Kr(e){if(!e)return[];if(Array.isArray(e))return e;const s=e;return s.jobs||s.data||[]}function Qr(e){if(!e||Array.isArray(e))return null;const s=e;return s.stats||s.overview||null}function Jr({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 vs({options:e={}}){const[s,n]=x(1),[r,i]=x(""),[a,l]=x("all"),[o,h]=x({}),d={};a!=="all"&&(d.status=a);const{data:u,meta:c,isLoading:v,error:p,refresh:f,mutate:_}=K("jobs",{...e,page:s,search:r,filters:d}),k=Kr(u),S=Qr(u),b=E(async m=>{h(N=>({...N,[m]:"pending"}));try{await _(`jobs/${m}/retry`),h(N=>({...N,[m]:"success"})),setTimeout(()=>{h(N=>{const y={...N};return delete y[m],y}),f()},1e3)}catch{h(N=>{const y={...N};return delete y[m],y})}},[_,f]);return t("div",{children:[t(Jr,{stats:S,classPrefix:"ss-dash"}),t(ne,{search:r,onSearchChange:i,placeholder:"Filter jobs...",summary:`${c?.total??k.length} jobs`,children:t("div",{className:"ss-dash-btn-group",children:Wr.map(m=>t("button",{type:"button",className:`ss-dash-btn ${a===m?"ss-dash-active":""}`,onClick:()=>{l(m),n(1)},children:m.charAt(0).toUpperCase()+m.slice(1)},m))})}),v&&!u?t("div",{className:"ss-dash-empty",children:"Loading jobs..."}):p?t("div",{className:"ss-dash-empty",children:"Jobs/Queue not available"}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(se,{columns:[{key:"id",label:"ID",width:"40px",render:m=>t("span",{style:{color:"var(--ss-dim)"},children:m})},{key:"name",label:"Name",render:m=>t("span",{style:{color:"var(--ss-text)"},title:m,children:m})},{key:"status",label:"Status",width:"90px",render:m=>t(gr,{color:Vr(m),children:m})},{key:"payload",label:"Payload",render:(m,N)=>t(Re,{data:m||N?.data,maxPreviewLength:60})},{key:"attempts",label:"Tries",width:"50px",render:(m,N)=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:m||N.attemptsMade||0})},{key:"duration",label:"Duration",width:"75px",render:m=>t("span",{className:"ss-dash-duration",children:m!==null?te(m):"-"})},{key:"timestamp",label:"Time",width:"70px",render:(m,N)=>{const y=m||Hn(N);return t(ie,{ts:y,className:"ss-dash-event-time",style:{whiteSpace:"nowrap"}})}},{key:"_actions",label:"",width:"50px",render:(m,N)=>{const y=N.id,A=o[y];return N.status!=="failed"?null:t("button",{type:"button",className:"ss-dash-retry-btn",disabled:A==="pending"||A==="success",onClick:P=>{P.stopPropagation(),b(y)},children:A==="pending"?"...":A==="success"?"OK":"Retry"})}}],data:k,emptyMessage:"No jobs found"})}),c&&t(he,{page:c.page,lastPage:c.lastPage,total:c.total,onPageChange:n})]})]})}const Gr=Object.freeze(Object.defineProperty({__proto__:null,JobsSection:vs,default:vs},Symbol.toStringTag,{value:"Module"}));function J(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)&&!J(e)}function et(e,s=""){if(!Me(e))return[{path:s,value:e}];const n=[];for(const r of Object.keys(e)){const i=s?`${s}.${r}`:r,a=e[r];Me(a)?n.push(...et(a,i)):n.push({path:i,value:a})}return n}function tt(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 _s(e){if(e==null||typeof e!="object"||Array.isArray(e)||J(e))return 1;let s=0;for(const n of Object.keys(e))s+=_s(e[n]);return s}function Yr(e){if(!Me(e))return[];const s=[];for(const n of Object.keys(e))Me(e[n])&&s.push(n);return s}function De(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}){const[n,r]=x(!1);return t("span",{className:`${s}-config-redacted`,style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[t("span",{children:n?e.value:e.display}),t("button",{type:"button",className:`${s}-btn`,title:n?"Hide":"Reveal",style:{padding:"0 4px",fontSize:"0.85em",lineHeight:1,minWidth:"auto"},onClick:i=>{i.stopPropagation(),r(a=>!a)},children:n?t("svg",{width:"14",height:"14",viewBox:j["eye-off"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j["eye-off"].elements.join("")}}):t("svg",{width:"14",height:"14",viewBox:j.eye.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j.eye.elements.join("")}})})]})}function Zr({env:e,search:s,p:n}){const r=z(new Map),i=s.toLowerCase(),a=Object.entries(e).filter(([l,o])=>{if(!i)return!0;const h=J(o)?o.display:o==null?"":String(o);return l.toLowerCase().includes(i)||h.toLowerCase().includes(i)});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(([l,o])=>{const h=J(o),d=h?o.display:o==null?"null":String(o),u=`${l}=${d}`;return t("tr",{children:[t("td",{className:`${n}-env-key`,children:t("span",{className:`${n}-config-key`,children:l})}),t("td",{className:`${n}-env-val`,children:h?t(qe,{redacted:o,p:n}):t("span",{className:`${n}-config-val`,children:d})}),t("td",{children:!h&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:c=>{r.current.set(l,c)},onClick:c=>{c.stopPropagation(),De(u,r.current.get(l)??null,n)},children:"⎘"})})]},l)}),a.length===0&&t("tr",{children:t("td",{colSpan:3,style:{textAlign:"center",color:"var(--ss-dim)"},children:"No matching variables"})})]})]})})}function Xr({source:e,search:s,p:n}){const r=z(new Map),i=s.toLowerCase(),a=et(e,""),l=a.filter(o=>{const h=J(o.value)?o.value.display:o.value===null||o.value===void 0?"":String(o.value);return o.path.toLowerCase().includes(i)||h.toLowerCase().includes(i)});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:[l.map(o=>{const h=J(o.value),d=h?null:tt(o.value),u=h?o.value.display:d.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:h?t(qe,{redacted:o.value,p:n}):t("span",{className:`${n}-config-val`,style:{wordBreak:"break-all",color:d.color},children:d.text})}),t("td",{children:!h&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:v=>{r.current.set(o.path,v)},onClick:v=>{v.stopPropagation(),De(c,r.current.get(o.path)??null,n)},children:"⎘"})})]},o.path)}),l.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:[l.length," of ",a.length," entries"]})]})}function ea({obj:e,prefix:s,p:n}){const r=z(new Map),i=et(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:i.map(a=>{const l=a.path.indexOf(s+".")===0?a.path.slice(s.length+1):a.path,o=J(a.value),h=o?null:tt(a.value),d=o?a.value.display:h.text,u=`${a.path}: ${d}`;return t("tr",{children:[t("td",{title:l,children:t("span",{className:`${n}-config-key`,children:l})}),t("td",{title:d,children:o?t(qe,{redacted:a.value,p:n}):t("span",{className:`${n}-config-val`,style:{color:h.color},children:h.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(),De(u,r.current.get(a.path)??null,n)},children:"⎘"})})]},a.path)})})]})}function ta({value:e,p:s}){if(e==null)return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-dim)"},children:"null"});if(J(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 sa({obj:e,expandedPaths:s,onToggle:n,p:r}){if(e==null||typeof e!="object"||Array.isArray(e)||J(e))return null;const i=Object.keys(e),a=z(new Map);return t("div",{className:`${r}-config-sections`,children:i.map(l=>{const o=e[l],h=o!==null&&typeof o=="object"&&!Array.isArray(o)&&!J(o),d=s.has(l),u=J(o);return t("div",{className:`${r}-config-section`,children:[t("div",{className:`${r}-config-section-header${h?"":` ${r}-config-leaf`}`,onClick:h?()=>n(l):void 0,style:{cursor:h?"pointer":"default"},children:[h?t("span",{className:`${r}-config-toggle`,children:d?"▼":"▶"}):t("span",{className:`${r}-config-toggle`,style:{visibility:"hidden"},children:"•"}),t("span",{className:`${r}-config-key`,children:l}),h?t("span",{className:`${r}-config-count`,children:[_s(o)," entries"]}):t(D,{children:[t("span",{className:`${r}-config-val`,style:{marginLeft:"8px"},children:t(ta,{value:o,p:r})}),!u&&t("button",{type:"button",className:`${r}-copy-row-btn`,style:{marginLeft:"4px"},title:"Copy",ref:c=>{a.current.set(l,c)},onClick:c=>{c.stopPropagation();const v=tt(o);De(`${l}: ${v.text}`,a.current.get(l)??null,r)},children:"⎘"})]})]}),h&&d&&t("div",{className:`${r}-config-section-body`,children:t(ea,{obj:o,prefix:l,p:r})})]},l)})})}function na({data:e,isLoading:s,classPrefix:n}){const r=n,[i,a]=x(""),[l,o]=x(""),[h,d]=x("app"),[u,c]=x(new Set),[v,p]=x("Copy JSON");V(()=>{const m=setTimeout(()=>o(i),200);return()=>clearTimeout(m)},[i]);const f=e,_=E(m=>{c(N=>{const y=new Set(N);return y.has(m)?y.delete(m):y.add(m),y})},[]),k=E(()=>{if(!f)return;const m=h==="app"?f.app:f.env;if(!m)return;const N=Yr(m);c(new Set(N))},[f,h]),S=E(()=>{c(new Set)},[]),b=E(async()=>{if(f)try{const m=h==="app"?f.app:f.env;await navigator.clipboard.writeText(JSON.stringify(m,null,2)),p("Copied!"),setTimeout(()=>p("Copy JSON"),1500)}catch{}},[f,h]);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${h==="app"?` ${r}-active`:""}`,onClick:()=>d("app"),children:"App Config"}),t("button",{type:"button",className:`${r}-config-tab${h==="env"?` ${r}-active`:""}`,onClick:()=>d("env"),children:"Env"}),t("div",{style:{position:"relative",flex:1},children:[t("input",{type:"text",className:`${r}-search`,placeholder:"Search keys and values...",value:i,onChange:m=>a(m.target.value),style:{width:"100%"}}),i&&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:"×"})]}),h==="app"&&!l&&t(D,{children:[t("button",{type:"button",className:`${r}-btn`,onClick:k,children:"Expand All"}),t("button",{type:"button",className:`${r}-btn`,onClick:S,children:"Collapse All"})]}),t("button",{type:"button",className:`${r}-btn`,onClick:b,children:v})]}),s&&!e?t("div",{className:`${r}-empty`,children:"Loading config..."}):f?h==="env"?t(Zr,{env:f.env??{},search:l,p:r}):l?t(Xr,{source:f.app??{},search:l,p:r}):t("div",{className:`${r}-config-table-wrap`,children:t(sa,{obj:f.app,expandedPaths:u,onToggle:_,p:r})}):t("div",{className:`${r}-empty`,children:"Config not available"})]})}function gs({options:e={}}){const{data:s,isLoading:n}=K("config",e);return t(na,{data:s,isLoading:n,classPrefix:"ss-dash"})}const ra=Object.freeze(Object.defineProperty({__proto__:null,ConfigSection:gs,default:gs},Symbol.toStringTag,{value:"Module"}));function aa(e={}){const{baseUrl:s="",debugEndpoint:n="/admin/api/debug",authToken:r,refreshInterval:i=3e3}=e,[a,l]=x(null),[o,h]=x(!0),[d,u]=x(null),c=z(null),v=es(s,r),p=E(async()=>{try{const _=await v().get(`${n}/diagnostics`);l(_),u(null),h(!1)}catch(f){if(f instanceof Ke){u(f),h(!1),c.current&&(clearInterval(c.current),c.current=null);return}u(f instanceof Error?f:new Error(String(f))),h(!1)}},[n,v]);return V(()=>(h(!0),u(null),p(),c.current=setInterval(p,i),()=>{c.current&&(clearInterval(c.current),c.current=null)}),[p,i]),{data:a,isLoading:o,error:d}}const ia=["password","secret","token","key","credential","auth"];function ys(e){const s=e.toLowerCase();return ia.some(n=>s.includes(n))}function bs(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 la={collectionInterval:"Stats Collection",dashboardBroadcast:"Dashboard Broadcast",debugBroadcast:"Debug Broadcast",persistFlush:"Persist Flush",retentionCleanup:"Retention Cleanup"};function oa(e){return la[e]||e}const ca={prometheus:"Prometheus",pinoHook:"Pino Log Hook",edgePlugin:"Edge Plugin",cacheInspector:"Cache Inspector",queueInspector:"Queue Inspector"};function da(e){return ca[e]||e}const ha=["healthy","active","connected","available","ready"],ua=["errored","unavailable"];function pa(e){return ha.includes(e)?"ok":ua.includes(e)?"err":""}function ve({status:e,prefix:s}){const n=pa(e);let r=`${s}-dot`;return n==="ok"?r+=` ${s}-dot-ok`:n==="err"&&(r+=` ${s}-dot-err`),t("span",{className:r})}const ws=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:j.eye.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j.eye.elements.join("")}}),xs=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:j["eye-off"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:j["eye-off"].elements.join("")}});function fa({value:e}){const[s,n]=x(!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(xs,{}):t(ws,{})})]})}function ma({current:e,max:s,prefix:n}){const r=s>0?Math.min(100,Math.round(e/s*100)):0,i=r>=100;return t("div",{className:`${n}-bar`,children:[t("div",{className:`${n}-bar-track`,children:t("div",{className:`${n}-bar-fill${i?` ${n}-bar-fill-warn`:""}`,style:{width:`${r}%`}})}),t("span",{className:`${n}-bar-pct${i?` ${n}-bar-pct-warn`:""}`,children:[r,"%"]})]})}function va({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,i],a)=>t("span",{children:[a>0&&", ",t("span",{className:`${s}-c-dim`,children:r}),"=",ys(r)&&typeof i=="string"?t(fa,{value:i}):t("span",{children:bs(i)})]},r))})}function _e({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 _a({data:e,tableClassName:s,classPrefix:n}){const r=n||"ss-dash",[i,a]=x(new Set),l=E(u=>{a(c=>{const v=new Set(c);return v.has(u)?v.delete(u):v.add(u),v})},[]),o=E((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 v=bs(c);if(ys(u)){const p=i.has(u);return t("span",{children:[p?v:"••••••••"," ",t("button",{type:"button",onClick:()=>l(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(xs,{}):t(ws,{})})]})}return t("span",{children:v})},[i,l,r]),d=e.collectors?.some(u=>u.name==="db_pool"||u.name==="app")&&Array.isArray(e.lucidDebugConnections)&&e.lucidDebugConnections.length===0;return t("div",{children:[d&&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(_e,{label:"Version",value:e.package.version||"-",prefix:r}),t(_e,{label:"Node.js",value:e.package.nodeVersion||"-",prefix:r}),t(_e,{label:"AdonisJS",value:e.package.adonisVersion||"-",prefix:r}),t(_e,{label:"Uptime",value:Xn(e.package.uptime),prefix:r}),t(_e,{label:"Renderer",value:e.devToolbar?.renderer||"preact",prefix:r})]}),e.collectors.length>0&&t(D,{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(ve,{status:u.status,prefix:r}),u.status]}),t("td",{className:u.lastError?`${r}-c-red`:`${r}-c-dim`,children:u.lastError?t(D,{children:[u.lastError,u.lastErrorAt&&t("span",{className:`${r}-c-dim`,style:{fontSize:"10px"},children:Ge(u.lastErrorAt)})]}):"-"}),t("td",{children:t(va,{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(ma,{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:oa(u)}),t("td",{children:[t(ve,{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(ve,{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 v=c.active??c.available??!1,p=c.active?"active":c.available?"available":"unavailable";let f=c.mode?`Mode: ${c.mode}`:"-";return u==="edgePlugin"&&c.active?f="@serverStats() tag registered":u==="cacheInspector"&&c.available?f="Redis dependency detected":u==="queueInspector"&&c.available&&(f="Queue dependency detected"),t("tr",{children:[t("td",{children:da(u)}),t("td",{children:[t(ve,{status:v?"active":"inactive",prefix:r}),p]}),t("td",{className:`${r}-c-dim`,style:{fontSize:"11px"},children:f})]},u)})]})]}),e.storage&&t(D,{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(ve,{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?Ge(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 Ns({options:e={},debugEndpoint:s="/admin/api/debug"}){const{data:n,isLoading:r,error:i}=aa({baseUrl:e.baseUrl,debugEndpoint:s,authToken:e.authToken,refreshInterval:It});return r&&!n?t("div",{className:"ss-dash-empty",children:"Loading diagnostics..."}):i?t("div",{className:"ss-dash-empty",children:["Error: ",i.message]}):n?t(_a,{data:n,tableClassName:"ss-dash-table",classPrefix:"ss-dash"}):t("div",{className:"ss-dash-empty",children:"Diagnostics not available"})}const ga=Object.freeze(Object.defineProperty({__proto__:null,InternalsSection:Ns,default:Ns},Symbol.toStringTag,{value:"Module"}))})();
|