adonisjs-server-stats 1.12.0 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +19 -1
  2. package/dist/core/api-client.d.ts +1 -1
  3. package/dist/core/index.js +1 -1
  4. package/dist/react/{CacheSection-DZFOiOYH.js → CacheSection-CX2duJuc.js} +1 -1
  5. package/dist/react/{CacheTab-D8js5o69.js → CacheTab-CgT4t0oZ.js} +1 -1
  6. package/dist/react/{ConfigSection-DoJmvNkF.js → ConfigSection-Dt0FyeaW.js} +1 -1
  7. package/dist/react/{ConfigTab-CDvljuBF.js → ConfigTab-KtiTtsrj.js} +1 -1
  8. package/dist/react/{CustomPaneTab-Db9eIQ-9.js → CustomPaneTab-15QoEplP.js} +1 -1
  9. package/dist/react/{EmailsTab-BITuGTQm.js → EmailsTab-CUjubln_.js} +2 -2
  10. package/dist/react/{EventsSection-7mDZv70I.js → EventsSection-GGPoYSNv.js} +1 -1
  11. package/dist/react/{EventsTab-DF13BChE.js → EventsTab-Wdwr0_ny.js} +1 -1
  12. package/dist/react/{JobsSection-B_VJFWy6.js → JobsSection-BqqIh_DR.js} +1 -1
  13. package/dist/react/{JobsTab-DK8Fl9nz.js → JobsTab-CBrU-ryL.js} +1 -1
  14. package/dist/react/{LogEntryRow-Bdie9SFe.js → LogEntryRow-BOrRkhRU.js} +1 -1
  15. package/dist/react/{LogsSection-CrWqxWRr.js → LogsSection-Cm_lphM6.js} +2 -2
  16. package/dist/react/{LogsTab-DYSpL637.js → LogsTab-jKwv9G7Q.js} +2 -2
  17. package/dist/react/{OverviewSection-CuaccMZt.js → OverviewSection-XF7bakyM.js} +1 -1
  18. package/dist/react/QueriesSection-DsQBKrNK.js +123 -0
  19. package/dist/react/QueriesTab-CxCC1GVq.js +87 -0
  20. package/dist/react/{RequestsSection-mENyeNsk.js → RequestsSection-D8cMbZU0.js} +2 -2
  21. package/dist/react/{RoutesSection-DjovlaNS.js → RoutesSection-D0y5JQP4.js} +1 -1
  22. package/dist/react/{RoutesTab-CbQECiUc.js → RoutesTab-Y_alJVMV.js} +1 -1
  23. package/dist/react/{SplitPaneWrapper-DyRyH5Re.js → SplitPaneWrapper-CZl1ouIT.js} +1 -1
  24. package/dist/react/{TimelineTab-BKTFbsPe.js → TimelineTab-HyqZpfbp.js} +2 -2
  25. package/dist/react/{index-CAUHa8QX.js → index-CsprmgzI.js} +2 -2
  26. package/dist/react/index.js +1 -1
  27. package/dist/src/edge/client/dashboard.js +2 -2
  28. package/dist/src/edge/client/debug-panel-deferred.js +1 -1
  29. package/dist/src/edge/client/stats-bar.js +1 -1
  30. package/dist/src/edge/client-vue/dashboard.js +3 -3
  31. package/dist/src/edge/client-vue/debug-panel-deferred.js +1 -1
  32. package/dist/src/edge/client-vue/stats-bar.js +1 -1
  33. package/dist/src/provider/auth_middleware_detector.d.ts +12 -6
  34. package/dist/src/provider/auth_middleware_detector.js +53 -6
  35. package/dist/src/provider/boot_helpers.d.ts +1 -0
  36. package/dist/src/provider/boot_helpers.js +7 -1
  37. package/dist/src/provider/server_stats_provider.js +2 -1
  38. package/dist/src/routes/no_session_middleware.d.ts +14 -0
  39. package/dist/src/routes/no_session_middleware.js +16 -0
  40. package/dist/src/routes/register_routes.js +5 -1
  41. package/dist/vue/{CacheSection-Bx41lpfK.js → CacheSection-DRqV3YX2.js} +1 -1
  42. package/dist/vue/{ConfigSection-fkfUdCmx.js → ConfigSection-C6pQCHAL.js} +1 -1
  43. package/dist/vue/{EmailsSection-CbcDKF9Q.js → EmailsSection-BTNw3ZU2.js} +1 -1
  44. package/dist/vue/{EmailsTab-CNyEODVB.js → EmailsTab-CwIF1fik.js} +1 -1
  45. package/dist/vue/{EventsSection-CWbTYOBi.js → EventsSection-BpgkWIwM.js} +1 -1
  46. package/dist/vue/{JobsSection-CGGO6rtS.js → JobsSection-DrghFEKL.js} +1 -1
  47. package/dist/vue/{LogsSection-BPB-C-XA.js → LogsSection-BDxx9Bfi.js} +1 -1
  48. package/dist/vue/{OverviewSection-BTcnPeoM.js → OverviewSection-BAgZTPjY.js} +1 -1
  49. package/dist/vue/{QueriesSection-2SE3igQJ.js → QueriesSection-CUpwhp7u.js} +127 -115
  50. package/dist/vue/{RequestsSection-DXcG5Zok.js → RequestsSection-D8P2xpF2.js} +1 -1
  51. package/dist/vue/{RoutesSection-BkNGWdoP.js → RoutesSection-0qB81hTT.js} +1 -1
  52. package/dist/vue/{index-CptF6Qbp.js → index-30jLw-_w.js} +2 -2
  53. package/dist/vue/index.js +1 -1
  54. package/package.json +1 -1
  55. package/dist/react/QueriesSection-CvGGh5Ij.js +0 -117
  56. package/dist/react/QueriesTab-C7CCwhVc.js +0 -87
  57. package/dist/react/{EmailsSection-D7oxvAjA.js → EmailsSection-YcJYR5eA.js} +1 -1
@@ -1 +1 @@
1
- (function(){"use strict";var j,p,ke,D,we,Te,Se,Ce,oe,se,ie,G={},Y=[],ht=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,q=Array.isArray;function A(e,t){for(var n in t)e[n]=t[n];return e}function le(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function z(e,t,n){var r,s,o,i={};for(o in t)o=="key"?r=t[o]:o=="ref"?s=t[o]:i[o]=t[o];if(arguments.length>2&&(i.children=arguments.length>3?j.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)i[o]===void 0&&(i[o]=e.defaultProps[o]);return X(e,i,r,s,null)}function X(e,t,n,r,s){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++ke,__i:-1,__u:0};return s==null&&p.vnode!=null&&p.vnode(o),o}function N(e){return e.children}function R(e,t){this.props=e,this.context=t}function I(e,t){if(t==null)return e.__?I(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?I(e):null}function pt(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],s=[],o=A({},t);o.__v=t.__v+1,p.vnode&&p.vnode(o),ae(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??I(t),!!(32&t.__u),s),o.__v=t.__v,o.__.__k[o.__i]=o,Ne(r,o,s),t.__e=t.__=null,o.__e!=n&&Ee(o)}}function Ee(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Ee(e)}function Pe(e){(!e.__d&&(e.__d=!0)&&D.push(e)&&!Q.__r++||we!=p.debounceRendering)&&((we=p.debounceRendering)||Te)(Q)}function Q(){for(var e,t=1;D.length;)D.length>t&&D.sort(Se),e=D.shift(),t=D.length,pt(e);Q.__r=0}function $e(e,t,n,r,s,o,i,l,c,u,d){var a,h,_,m,b,y,v,g=r&&r.__k||Y,k=t.length;for(c=mt(n,t,g,c,k),a=0;a<k;a++)(_=n.__k[a])!=null&&(h=_.__i!=-1&&g[_.__i]||G,_.__i=a,y=ae(e,_,h,s,o,i,l,c,u,d),m=_.__e,_.ref&&h.ref!=_.ref&&(h.ref&&ce(h.ref,null,_),d.push(_.ref,_.__c||m,_)),b==null&&m!=null&&(b=m),(v=!!(4&_.__u))||h.__k===_.__k?c=xe(_,c,e,v):typeof _.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),_.__u&=-7);return n.__e=b,c}function mt(e,t,n,r,s){var o,i,l,c,u,d=n.length,a=d,h=0;for(e.__k=new Array(s),o=0;o<s;o++)(i=t[o])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[o]=X(null,i,null,null,null):q(i)?i=e.__k[o]=X(N,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[o]=X(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[o]=i,c=o+h,i.__=e,i.__b=e.__b+1,l=null,(u=i.__i=gt(i,n,c,a))!=-1&&(a--,(l=n[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(s>d?h--:s<d&&h++),typeof i.type!="function"&&(i.__u|=4)):u!=c&&(u==c-1?h--:u==c+1?h++:(u>c?h--:h++,i.__u|=4))):e.__k[o]=null;if(a)for(o=0;o<d;o++)(l=n[o])!=null&&(2&l.__u)==0&&(l.__e==r&&(r=I(l)),Ae(l,l));return r}function xe(e,t,n,r){var s,o;if(typeof e.type=="function"){for(s=e.__k,o=0;s&&o<s.length;o++)s[o]&&(s[o].__=e,t=xe(s[o],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=I(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function J(e,t){return t=t||[],e==null||typeof e=="boolean"||(q(e)?e.some(function(n){J(n,t)}):t.push(e)),t}function gt(e,t,n,r){var s,o,i,l=e.key,c=e.type,u=t[n],d=u!=null&&(2&u.__u)==0;if(u===null&&l==null||d&&l==u.key&&c==u.type)return n;if(r>(d?1:0)){for(s=n-1,o=n+1;s>=0||o<t.length;)if((u=t[i=s>=0?s--:o++])!=null&&(2&u.__u)==0&&l==u.key&&c==u.type)return i}return-1}function Me(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ht.test(t)?n:n+"px"}function Z(e,t,n,r,s){var o,i;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Me(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Me(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Ce,"$1")),i=t.toLowerCase(),t=i in e||t=="onFocusOut"||t=="onFocusIn"?i.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n.u=r.u:(n.u=oe,e.addEventListener(t,o?ie:se,o)):e.removeEventListener(t,o?ie:se,o);else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Ue(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=oe++;else if(t.t<n.u)return;return n(p.event?p.event(t):t)}}}function ae(e,t,n,r,s,o,i,l,c,u){var d,a,h,_,m,b,y,v,g,k,E,U,w,P,$,M=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[l=t.__e=n.__e]),(d=p.__b)&&d(t);e:if(typeof M=="function")try{if(v=t.props,g="prototype"in M&&M.prototype.render,k=(d=M.contextType)&&r[d.__c],E=d?k?k.props.value:d.__:r,n.__c?y=(a=t.__c=n.__c).__=a.__E:(g?t.__c=a=new M(v,E):(t.__c=a=new R(v,E),a.constructor=M,a.render=bt),k&&k.sub(a),a.state||(a.state={}),a.__n=r,h=a.__d=!0,a.__h=[],a._sb=[]),g&&a.__s==null&&(a.__s=a.state),g&&M.getDerivedStateFromProps!=null&&(a.__s==a.state&&(a.__s=A({},a.__s)),A(a.__s,M.getDerivedStateFromProps(v,a.__s))),_=a.props,m=a.state,a.__v=t,h)g&&M.getDerivedStateFromProps==null&&a.componentWillMount!=null&&a.componentWillMount(),g&&a.componentDidMount!=null&&a.__h.push(a.componentDidMount);else{if(g&&M.getDerivedStateFromProps==null&&v!==_&&a.componentWillReceiveProps!=null&&a.componentWillReceiveProps(v,E),t.__v==n.__v||!a.__e&&a.shouldComponentUpdate!=null&&a.shouldComponentUpdate(v,a.__s,E)===!1){t.__v!=n.__v&&(a.props=v,a.state=a.__s,a.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(W){W&&(W.__=t)}),Y.push.apply(a.__h,a._sb),a._sb=[],a.__h.length&&i.push(a);break e}a.componentWillUpdate!=null&&a.componentWillUpdate(v,a.__s,E),g&&a.componentDidUpdate!=null&&a.__h.push(function(){a.componentDidUpdate(_,m,b)})}if(a.context=E,a.props=v,a.__P=e,a.__e=!1,U=p.__r,w=0,g)a.state=a.__s,a.__d=!1,U&&U(t),d=a.render(a.props,a.state,a.context),Y.push.apply(a.__h,a._sb),a._sb=[];else do a.__d=!1,U&&U(t),d=a.render(a.props,a.state,a.context),a.state=a.__s;while(a.__d&&++w<25);a.state=a.__s,a.getChildContext!=null&&(r=A(A({},r),a.getChildContext())),g&&!h&&a.getSnapshotBeforeUpdate!=null&&(b=a.getSnapshotBeforeUpdate(_,m)),P=d!=null&&d.type===N&&d.key==null?He(d.props.children):d,l=$e(e,q(P)?P:[P],t,n,r,s,o,i,l,c,u),a.base=t.__e,t.__u&=-161,a.__h.length&&i.push(a),y&&(a.__E=a.__=null)}catch(W){if(t.__v=null,c||o!=null)if(W.then){for(t.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;o[o.indexOf(l)]=null,t.__e=l}else{for($=o.length;$--;)le(o[$]);ue(t)}else t.__e=n.__e,t.__k=n.__k,W.then||ue(t);p.__e(W,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=vt(n.__e,t,n,r,s,o,i,c,u);return(d=p.diffed)&&d(t),128&t.__u?void 0:l}function ue(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ue))}function Ne(e,t,n){for(var r=0;r<n.length;r++)ce(n[r],n[++r],n[++r]);p.__c&&p.__c(t,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(o){o.call(s)})}catch(o){p.__e(o,s.__v)}})}function He(e){return typeof e!="object"||e==null||e.__b>0?e:q(e)?e.map(He):A({},e)}function vt(e,t,n,r,s,o,i,l,c){var u,d,a,h,_,m,b,y=n.props||G,v=t.props,g=t.type;if(g=="svg"?s="http://www.w3.org/2000/svg":g=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((_=o[u])&&"setAttribute"in _==!!g&&(g?_.localName==g:_.nodeType==3)){e=_,o[u]=null;break}}if(e==null){if(g==null)return document.createTextNode(v);e=document.createElementNS(s,g,v.is&&v),l&&(p.__m&&p.__m(t,o),l=!1),o=null}if(g==null)y===v||l&&e.data==v||(e.data=v);else{if(o=o&&j.call(e.childNodes),!l&&o!=null)for(y={},u=0;u<e.attributes.length;u++)y[(_=e.attributes[u]).name]=_.value;for(u in y)_=y[u],u=="dangerouslySetInnerHTML"?a=_:u=="children"||u in v||u=="value"&&"defaultValue"in v||u=="checked"&&"defaultChecked"in v||Z(e,u,null,_,s);for(u in v)_=v[u],u=="children"?h=_:u=="dangerouslySetInnerHTML"?d=_:u=="value"?m=_:u=="checked"?b=_:l&&typeof _!="function"||y[u]===_||Z(e,u,_,y[u],s);if(d)l||a&&(d.__html==a.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(a&&(e.innerHTML=""),$e(t.type=="template"?e.content:e,q(h)?h:[h],t,n,r,g=="foreignObject"?"http://www.w3.org/1999/xhtml":s,o,i,o?o[0]:n.__k&&I(n,0),l,c),o!=null)for(u=o.length;u--;)le(o[u]);l||(u="value",g=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[u]||g=="progress"&&!m||g=="option"&&m!=y[u])&&Z(e,u,m,y[u],s),u="checked",b!=null&&b!=e[u]&&Z(e,u,b,y[u],s))}return e}function ce(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(s){p.__e(s,n)}}function Ae(e,t,n){var r,s;if(p.unmount&&p.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ce(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){p.__e(o,t)}r.base=r.__P=null}if(r=e.__k)for(s=0;s<r.length;s++)r[s]&&Ae(r[s],t,n||typeof e.type!="function");n||le(e.__e),e.__c=e.__=e.__e=void 0}function bt(e,t,n){return this.constructor(e,n)}function _e(e,t,n){var r,s,o,i;t==document&&(t=document.documentElement),p.__&&p.__(e,t),s=(r=!1)?null:t.__k,o=[],i=[],ae(t,e=t.__k=z(N,null,[e]),s||G,G,t.namespaceURI,s?null:t.firstChild?j.call(t.childNodes):null,o,s?s.__e:t.firstChild,r,i),Ne(o,e,i)}j=Y.slice,p={__e:function(e,t,n,r){for(var s,o,i;t=t.__;)if((s=t.__c)&&!s.__)try{if((o=s.constructor)&&o.getDerivedStateFromError!=null&&(s.setState(o.getDerivedStateFromError(e)),i=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),i=s.__d),i)return s.__E=s}catch(l){e=l}throw e}},ke=0,R.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=A({},this.state),typeof e=="function"&&(e=e(A({},n),this.props)),e&&A(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Pe(this))},R.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Pe(this))},R.prototype.render=N,D=[],Te=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Se=function(e,t){return e.__v.__b-t.__v.__b},Q.__r=0,Ce=/(PointerCapture)$|Capture$/i,oe=0,se=Ue(!1),ie=Ue(!0);var yt=0;function f(e,t,n,r,s,o){t||(t={});var i,l,c=t;if("ref"in c)for(l in c={},t)l=="ref"?i=t[l]:c[l]=t[l];var u={type:e,props:c,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--yt,__i:-1,__u:0,__source:s,__self:o};if(typeof e=="function"&&(i=e.defaultProps))for(l in i)c[l]===void 0&&(c[l]=i[l]);return p.vnode&&p.vnode(u),u}var K,T,de,Re,V=0,Le=[],S=p,Oe=S.__b,De=S.__r,Fe=S.diffed,Ie=S.__c,Be=S.unmount,We=S.__;function fe(e,t){S.__h&&S.__h(T,e,V||t),V=0;var n=T.__H||(T.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function x(e){return V=1,kt(Ke,e)}function kt(e,t,n){var r=fe(K++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ke(void 0,t),function(l){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,l);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=T,!T.__f)){var s=function(l,c,u){if(!r.__c.__H)return!0;var d=r.__c.__H.__.filter(function(h){return h.__c});if(d.every(function(h){return!h.__N}))return!o||o.call(this,l,c,u);var a=r.__c.props!==l;return d.some(function(h){if(h.__N){var _=h.__[0];h.__=h.__N,h.__N=void 0,_!==h.__[0]&&(a=!0)}}),o&&o.call(this,l,c,u)||a};T.__f=!0;var o=T.shouldComponentUpdate,i=T.componentWillUpdate;T.componentWillUpdate=function(l,c,u){if(this.__e){var d=o;o=void 0,s(l,c,u),o=d}i&&i.call(this,l,c,u)},T.shouldComponentUpdate=s}return r.__N||r.__}function L(e,t){var n=fe(K++,3);!S.__s&&ze(n.__H,t)&&(n.__=e,n.u=t,T.__H.__h.push(n))}function O(e){return V=5,H(function(){return{current:e}},[])}function H(e,t){var n=fe(K++,7);return ze(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function B(e,t){return V=8,H(function(){return e},t)}function wt(){for(var e;e=Le.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ee),t.__h.some(he),t.__h=[]}catch(n){t.__h=[],S.__e(n,e.__v)}}}S.__b=function(e){T=null,Oe&&Oe(e)},S.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),We&&We(e,t)},S.__r=function(e){De&&De(e),K=0;var t=(T=e.__c).__H;t&&(de===T?(t.__h=[],T.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(ee),t.__h.some(he),t.__h=[],K=0)),de=T},S.diffed=function(e){Fe&&Fe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Le.push(t)!==1&&Re===S.requestAnimationFrame||((Re=S.requestAnimationFrame)||Tt)(wt)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),de=T=null},S.__c=function(e,t){t.some(function(n){try{n.__h.some(ee),n.__h=n.__h.filter(function(r){return!r.__||he(r)})}catch(r){t.some(function(s){s.__h&&(s.__h=[])}),t=[],S.__e(r,n.__v)}}),Ie&&Ie(e,t)},S.unmount=function(e){Be&&Be(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{ee(r)}catch(s){t=s}}),n.__H=void 0,t&&S.__e(t,n.__v))};var qe=typeof requestAnimationFrame=="function";function Tt(e){var t,n=function(){clearTimeout(r),qe&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);qe&&(t=requestAnimationFrame(n))}function ee(e){var t=T,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),T=t}function he(e){var t=T;e.__c=e.__(),T=t}function ze(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Ke(e,t){return typeof t=="function"?t(e):t}function St(e,t){for(var n in t)e[n]=t[n];return e}function Ve(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function je(e,t){this.props=e,this.context=t}(je.prototype=new R).isPureReactComponent=!0,je.prototype.shouldComponentUpdate=function(e,t){return Ve(this.props,e)||Ve(this.state,t)};var Ge=p.__b;p.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ge&&Ge(e)};var Ct=p.__e;p.__e=function(e,t,n,r){if(e.then){for(var s,o=t;o=o.__;)if((s=o.__c)&&s.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),s.__c(e,t)}Ct(e,t,n,r)};var Ye=p.unmount;function Xe(e,t,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=St({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Xe(r,t,n)})),e}function Qe(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Qe(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function pe(){this.__u=0,this.o=null,this.__b=null}function Je(e){if(!e.__)return null;var t=e.__.__c;return t&&t.__a&&t.__a(e)}function te(){this.i=null,this.l=null}p.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Ye&&Ye(e)},(pe.prototype=new R).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var s=Je(r.__v),o=!1,i=function(){o||r.__z||(o=!0,n.__R=null,s?s(c):c())};n.__R=i;var l=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var u=r.state.__a;r.__v.__k[0]=Qe(u,u.__c.__P,u.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.o.pop();)d.__P=l,d.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(i,i)},pe.prototype.componentWillUnmount=function(){this.o=[]},pe.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Xe(this.__b,n,r.__O=r.__P)}this.__b=null}var s=t.__a&&z(N,null,e.fallback);return s&&(s.__u&=-33),[z(N,null,t.__a?null:e.children),s]};var Ze=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),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]}};function Et(e){return this.getChildContext=function(){return e.context},e.children}function Pt(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){_e(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(s,o){this.childNodes.push(s),t.h.insertBefore(s,o)},removeChild:function(s){this.childNodes.splice(this.childNodes.indexOf(s)>>>1,1),t.h.removeChild(s)}}}_e(z(Et,{context:t.context},e.__v),t.v)}function $t(e,t){var n=z(Pt,{__v:e,h:t});return n.containerInfo=t,n}(te.prototype=new R).__a=function(e){var t=this,n=Je(t.__v),r=t.l.get(e);return r[0]++,function(s){var o=function(){t.props.revealOrder?(r.push(s),Ze(t,e,r)):s()};n?n(o):o()}},te.prototype.render=function(e){this.i=null,this.l=new Map;var t=J(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},te.prototype.componentDidUpdate=te.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Ze(e,n,t)})};var xt=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Mt=/^(?: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]/,Ut=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Nt=/[A-Z0-9]/g,Ht=typeof document<"u",At=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};R.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(R.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var et=p.event;function Rt(){}function Lt(){return this.cancelBubble}function Ot(){return this.defaultPrevented}p.event=function(e){return et&&(e=et(e)),e.persist=Rt,e.isPropagationStopped=Lt,e.isDefaultPrevented=Ot,e.nativeEvent=e};var Dt={enumerable:!1,configurable:!0,get:function(){return this.class}},tt=p.vnode;p.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,r=t.type,s={},o=r.indexOf("-")===-1;for(var i in n){var l=n[i];if(!(i==="value"&&"defaultValue"in n&&l==null||Ht&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var c=i.toLowerCase();i==="defaultValue"&&"value"in n&&n.value==null?i="value":i==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?i="ondblclick":c!=="onchange"||r!=="input"&&r!=="textarea"||At(n.type)?c==="onfocus"?i="onfocusin":c==="onblur"?i="onfocusout":Ut.test(i)&&(i=c):c=i="oninput":o&&Mt.test(i)?i=i.replace(Nt,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&s[i=c]&&(i="oninputCapture"),s[i]=l}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=J(n.children).forEach(function(u){u.props.selected=s.value.indexOf(u.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=J(n.children).forEach(function(u){u.props.selected=s.multiple?s.defaultValue.indexOf(u.props.value)!=-1:s.defaultValue==u.props.value})),n.class&&!n.className?(s.class=n.class,Object.defineProperty(s,"className",Dt)):n.className&&(s.class=s.className=n.className),t.props=s})(e),e.$$typeof=xt,tt&&tt(e)};var nt=p.__r;p.__r=function(e){nt&&nt(e),e.__c};var rt=p.diffed;p.diffed=function(e){rt&&rt(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value)};var Ft={Fragment:N};class ot extends Error{status;constructor(t=403){super(`Unauthorized (HTTP ${t})`),this.name="UnauthorizedError",this.status=t}}class It extends Error{status;body;constructor(t,n){super(`API error (HTTP ${t})`),this.name="ApiError",this.status=t,this.body=n}}class st{baseUrl;authToken;constructor(t){this.baseUrl=t.baseUrl.replace(/\/+$/,""),this.authToken=t.authToken}async fetch(t,n){const s={...{Accept:"application/json",...this.authToken?{Authorization:`Bearer ${this.authToken}`}:{}},...n?.headers},o=await globalThis.fetch(`${this.baseUrl}${t}`,{...n,headers:s,credentials:this.authToken?"omit":"include"});if(n?.signal?.aborted)throw new DOMException("The operation was aborted.","AbortError");if(o.status===401||o.status===403)throw new ot(o.status);if(!o.ok){const i=await o.text().catch(()=>"");throw new It(o.status,i)}return o.json()}async get(t,n){const r=n?`${t}?${n}`:t;return this.fetch(r)}async post(t,n){const r={method:"POST",...n!==void 0?{body:JSON.stringify(n),headers:{"Content-Type":"application/json"}}:{}};return this.fetch(t,r)}async delete(t){return this.fetch(t,{method:"DELETE"})}}const Bt=["tracing","process","system","http","db","redis","queues","cache","app","log","emails","dashboard"],Wt=[{flag:"process",group:"process"},{flag:"process",group:"memory"},{flag:"system",group:"memory"},{flag:"http",group:"http"},{flag:"db",group:"db"},{flag:"redis",group:"redis"},{flag:"queues",group:"queue"},{flag:"app",group:"app"},{flag:"log",group:"log"}],qt=[{group:"process",fields:["cpuPercent","uptime","nodeVersion"]},{group:"memory",fields:["memHeapUsed","memRss","systemMemoryTotalMb","systemMemoryFreeMb"]},{group:"http",fields:["requestsPerSecond","avgResponseTimeMs","errorRate","activeHttpConnections"]},{group:"db",fields:["dbPoolMax","dbPoolUsed","dbPoolFree","dbPoolPending"]},{group:"queue",fields:["queueActive","queueWaiting","queueWorkerCount"]},{group:"app",fields:["onlineUsers","pendingWebhooks","pendingEmails"]},{group:"log",fields:["logErrorsLast5m","logEntriesPerMinute"]}];function me(e){return typeof e=="number"&&!Number.isNaN(e)}const it="/admin/api/debug",lt={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 zt(e){const t={customPanes:e.customPanes??[]},n=e.features;for(const r of Bt)t[r]=n?.[r]??!1;return t}async function Kt(e,t=it){const n=`${t.replace(/\/+$/,"")}/config`;return e.fetch(n)}async function Vt(e){const{baseUrl:t="",debugEndpoint:n=it,authToken:r}=e,s=new st({baseUrl:t,authToken:r});try{const o=await Kt(s,n);return zt(o)}catch{return lt}}function jt(e){const t=new Set,r="features"in e&&typeof e.features=="object"&&e.features!==null?e.features:e;for(const{flag:s,group:o}of Wt)r[s]&&t.add(o);return t}function Gt(e){const t=new Set;(me(e.cpuPercent)||me(e.uptime)||Yt(e))&&t.add("process");for(const n of qt)n.fields.some(r=>me(e[r]))&&t.add(n.group);return e.redisOk!==void 0&&e.redisOk!==null&&t.add("redis"),t}function Yt(e){return typeof e.nodeVersion=="string"&&e.nodeVersion.length>0}const at={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"/>']}},Xt=60,Qt=1e4;function Jt(e){if(!e&&e!==0)return"-";const t=Math.floor(e),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),s=Math.floor(t%3600/60);return n>0?`${n}d ${r}h`:r>0?`${r}h ${s}m`:s>0?`${s}m ${t%60}s`:`${t}s`}function ge(e){const t=e/1048576;return t>=1024?`${(t/1024).toFixed(1)}G`:`${t.toFixed(0)}M`}function ut(e){return e>=1024?`${(e/1024).toFixed(1)}G`:`${e.toFixed(1)}M`}function Zt(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:`${e}`}function ve(e,t){switch(t){case"%":return`${e.toFixed(1)}%`;case"ms":return`${e.toFixed(0)}ms`;case"MB":return`${e.toFixed(1)}M`;case"bytes":return ge(e);case"/s":case"/m":return e.toFixed(1);default:return e.toFixed(1)}}function ne(e,t,n){return e>n?"red":e>t?"amber":"green"}function en(e,t,n){return e<n?"red":e<t?"amber":"green"}function ct(e,t){if(t===0)return"green";const n=e/t;return n>.8?"red":n>.5?"amber":"green"}const tn={green:"ss-green",amber:"ss-amber",red:"ss-red"};function F(e){return tn[e]||""}const _t=[{id:"node",label:"NODE",title:"Node.js Runtime",unit:"",group:"process",extract:e=>0,format:e=>e.nodeVersion,color:()=>""},{id:"uptime",label:"UP",title:"Process Uptime",unit:"",group:"process",extract:e=>e.uptime,format:e=>Jt(e.uptime),color:()=>""},{id:"cpu",label:"CPU",title:"CPU Usage",unit:"%",group:"process",warnThreshold:50,critThreshold:80,extract:e=>e.cpuPercent,format:e=>`${e.cpuPercent.toFixed(1)}%`,color:e=>F(ne(e.cpuPercent,50,80)),historyKey:"cpuPercent"},{id:"eventLoop",label:"EVT",title:"Event Loop Latency",unit:"ms",group:"process",warnThreshold:20,critThreshold:50,extract:e=>e.eventLoopLag,format:e=>`${e.eventLoopLag.toFixed(1)}ms`,color:e=>F(ne(e.eventLoopLag,20,50)),historyKey:"eventLoopLag"},{id:"memory",label:"HEAP",title:"V8 Heap Usage",unit:"bytes",group:"memory",extract:e=>e.memHeapUsed,format:e=>ge(e.memHeapUsed),color:()=>"",historyKey:"memHeapUsed"},{id:"rss",label:"RSS",title:"Resident Set Size",unit:"bytes",group:"memory",extract:e=>e.memRss,format:e=>ge(e.memRss),color:()=>"",historyKey:"memRss"},{id:"systemMemory",label:"SYS",title:"System Memory",unit:"MB",group:"memory",extract:e=>e.systemMemoryTotalMb-e.systemMemoryFreeMb,format:e=>`${ut(e.systemMemoryTotalMb-e.systemMemoryFreeMb)}/${ut(e.systemMemoryTotalMb)}`,color:e=>{const t=e.systemMemoryTotalMb;if(t===0)return"";const n=t-e.systemMemoryFreeMb;return F(ct(n,t))},historyKey:"_sysMemUsed",show:e=>e.systemMemoryTotalMb!==null&&e.systemMemoryTotalMb!==void 0},{id:"reqPerSec",label:"REQ/s",title:"Requests per Second",unit:"/s",group:"http",extract:e=>e.requestsPerSecond,format:e=>e.requestsPerSecond.toFixed(1),color:()=>"",historyKey:"requestsPerSecond"},{id:"avgResponse",label:"AVG",title:"Avg Response Time",unit:"ms",group:"http",warnThreshold:200,critThreshold:500,extract:e=>e.avgResponseTimeMs,format:e=>`${e.avgResponseTimeMs.toFixed(0)}ms`,color:e=>F(ne(e.avgResponseTimeMs,200,500)),historyKey:"avgResponseTimeMs"},{id:"errorRate",label:"ERR",title:"Error Rate",unit:"%",group:"http",warnThreshold:1,critThreshold:5,extract:e=>e.errorRate,format:e=>`${e.errorRate.toFixed(1)}%`,color:e=>F(ne(e.errorRate,1,5)),historyKey:"errorRate"},{id:"connections",label:"CONN",title:"Active Connections",unit:"",group:"http",extract:e=>e.activeHttpConnections,format:e=>`${e.activeHttpConnections}`,color:()=>"",historyKey:"activeHttpConnections"},{id:"dbPool",label:"DB",title:"Database Pool",unit:"",group:"db",extract:e=>e.dbPoolUsed,format:e=>`${e.dbPoolUsed}/${e.dbPoolFree}/${e.dbPoolMax}`,color:e=>F(ct(e.dbPoolUsed,e.dbPoolMax)),historyKey:"dbPoolUsed"},{id:"redis",label:"REDIS",title:"Redis Status",unit:"",group:"redis",extract:e=>e.redisOk?1:0,format:e=>e.redisOk?"✓":"✗",color:e=>e.redisOk?"ss-green":"ss-red"},{id:"redisMem",label:"MEM",title:"Redis Memory",unit:"MB",group:"redis",extract:e=>e.redisMemoryUsedMb,format:e=>`${e.redisMemoryUsedMb.toFixed(1)}M`,color:()=>"",historyKey:"redisMemoryUsedMb",show:e=>e.redisOk},{id:"redisKeys",label:"KEYS",title:"Redis Keys",unit:"",group:"redis",extract:e=>e.redisKeysCount,format:e=>Zt(e.redisKeysCount),color:()=>"",historyKey:"redisKeysCount",show:e=>e.redisOk},{id:"redisHitRate",label:"HIT",title:"Redis Hit Rate",unit:"%",group:"redis",warnThreshold:90,critThreshold:70,inverseThreshold:!0,extract:e=>e.redisHitRate,format:e=>`${e.redisHitRate.toFixed(0)}%`,color:e=>F(en(e.redisHitRate,90,70)),historyKey:"redisHitRate",show:e=>e.redisOk},{id:"queue",label:"Q",title:"Job Queue",unit:"",group:"queue",extract:e=>e.queueActive,format:e=>`${e.queueActive}/${e.queueWaiting}/${e.queueDelayed}`,color:e=>e.queueFailed>0?"ss-amber":"ss-green",historyKey:"queueActive"},{id:"queueWorkers",label:"WORKERS",title:"Queue Workers",unit:"",group:"queue",extract:e=>e.queueWorkerCount,format:e=>`${e.queueWorkerCount}`,color:()=>""},{id:"onlineUsers",label:"USERS",title:"Online Users",unit:"",group:"app",extract:e=>e.onlineUsers,format:e=>`${e.onlineUsers}`,color:()=>"",historyKey:"onlineUsers"},{id:"pendingWebhooks",label:"HOOKS",title:"Pending Webhooks",unit:"",group:"app",extract:e=>e.pendingWebhooks,format:e=>`${e.pendingWebhooks}`,color:e=>e.pendingWebhooks>0?"ss-amber":"",historyKey:"pendingWebhooks"},{id:"pendingEmails",label:"MAIL",title:"Pending Emails",unit:"",group:"app",extract:e=>e.pendingEmails,format:e=>`${e.pendingEmails}`,color:e=>e.pendingEmails>0?"ss-amber":"",historyKey:"pendingEmails"},{id:"logErrors",label:"LOG ERR",title:"Log Errors (5m)",unit:"",group:"log",extract:e=>e.logErrorsLast5m,format:e=>`${e.logErrorsLast5m}`,color:e=>e.logErrorsLast5m>0?"ss-red":e.logWarningsLast5m>0?"ss-amber":"",historyKey:"logErrorsLast5m"},{id:"logRate",label:"LOG/m",title:"Log Entries / Minute",unit:"/m",group:"log",extract:e=>e.logEntriesPerMinute,format:e=>`${e.logEntriesPerMinute}`,color:()=>"",historyKey:"logEntriesPerMinute"}];function nn(e={}){const{baseUrl:t="",debugEndpoint:n="/admin/api/debug",authToken:r}=e,[s,o]=x(lt),[i,l]=x(!0),[c,u]=x(null),d=O(!1);return L(()=>{if(d.current)return;d.current=!0;let a=!1;return(async()=>{try{const _=await Vt({baseUrl:t,debugEndpoint:n,authToken:r});a||(o(_),l(!1))}catch(_){a||(u(_ instanceof Error?_:new Error(String(_))),l(!1))}})(),()=>{a=!0}},[t,n,r]),{features:s,isLoading:i,error:c}}function rn(e=Xt){const t={},n={};let r=!1;function s(o){if(o.count===0)return[];const i=Array.from({length:o.count}),l=o.count<e?0:o.head;for(let c=0;c<o.count;c++)i[c]=o.data[(l+c)%e];return i}return{push(o){r=!1;for(const i of _t){const l=i.historyKey;if(!l)continue;const c=i.extract(o);if(typeof c!="number")continue;t[l]||(t[l]={data:Array.from({length:e}),head:0,count:0});const u=t[l];u.data[u.head]=c,u.head=(u.head+1)%e,u.count<e&&u.count++}},get(o){const i=t[o];return i?s(i):[]},getAll(){if(r)return n;for(const o of Object.keys(t))n[o]=s(t[o]);return r=!0,n}}}function on(e,t){const n=e||(typeof window<"u"?window.location.origin:"");if(!t)return{baseUrl:n};const r={headers:{Authorization:`Bearer ${t}`}};return{baseUrl:n,beforeSubscribe(s){return r},beforeUnsubscribe(s){return r}}}async function sn(){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 ln(e){let t=null,n=null,r=!1;return{subscribe:async()=>{try{const i=await sn();if(!i)throw new Error("Transmit client not available (neither window.Transmit nor @adonisjs/transmit-client)");if(r)return;t=new i(on(e.baseUrl,e.authToken)),n=t.subscription(e.channelName),n.onMessage(l=>{r||e.onMessage(l)}),await n.create()}catch(i){e.onError?.(i)}},unsubscribe:async()=>{r=!0;try{await n?.delete(),n=null,t=null}catch{}}}}function an(e){let t=!1;const n=ln({baseUrl:e.baseUrl,channelName:e.channelName,authToken:e.authToken,onMessage:e.onMessage,onError:r=>{t=!0,e.onError?.(r),e.onDisconnect?.()}});return n.subscribe().then(()=>{t||e.onConnect?.()}).catch(r=>{e.onError?.(r),e.onDisconnect?.()}),{unsubscribe:()=>{n.unsubscribe().catch(()=>{})}}}class un{baseUrl;endpoint;channelName;authToken;pollInterval;onStatsUpdate;onConnectionChange;onStaleChange;onError;onUnauthorizedChange;onHistoryChange;onSseActiveChange;onPollActiveChange;historyBuffer;client=null;sseHandle=null;pollTimer=null;staleTimer=null;lastSuccess=0;unauthorized=!1;stopped=!1;sseActive=!1;isConnected=!1;isStale=!1;constructor(t={}){this.baseUrl=t.baseUrl??"",this.endpoint=t.endpoint??"/admin/api/server-stats",this.channelName=t.channelName??"admin/server-stats",this.authToken=t.authToken,this.pollInterval=t.pollInterval??3e3,this.onStatsUpdate=t.onStatsUpdate,this.onConnectionChange=t.onConnectionChange,this.onStaleChange=t.onStaleChange,this.onError=t.onError,this.onUnauthorizedChange=t.onUnauthorizedChange,this.onHistoryChange=t.onHistoryChange,this.onSseActiveChange=t.onSseActiveChange,this.onPollActiveChange=t.onPollActiveChange,this.historyBuffer=rn()}start(){if(this.unauthorized)return;this.stopped=!1;const t=this.initSseSubscription();this.poll(),t||!this.sseHandle?this.startPollInterval():this.setupSseFallbackTimer(),this.startStaleDetection()}stop(){this.stopped=!0,this.sseHandle?.unsubscribe(),this.sseHandle=null,this.stopPolling(),this.staleTimer&&(clearInterval(this.staleTimer),this.staleTimer=null)}getHistory(t){return this.historyBuffer.get(t)}getAllHistory(){return this.historyBuffer.getAll()}getConnectionMode(){return this.unauthorized?"disconnected":this.sseActive?"live":this.pollTimer?"polling":"disconnected"}initSseSubscription(){let t=!1;try{this.sseHandle=an({baseUrl:this.baseUrl,channelName:this.channelName,authToken:this.authToken,onMessage:n=>{n&&typeof n=="object"&&"timestamp"in n&&this.processStats(n)},onConnect:()=>{this.setSseActive(!0),this.setConnected(!0),this.stopPolling()},onDisconnect:()=>{this.setSseActive(!1),this.setConnected(!1),!this.pollTimer&&!this.unauthorized&&!this.stopped&&this.startPollInterval()},onError:()=>{t=!0}})}catch{t=!0}return t}setupSseFallbackTimer(){const t=setTimeout(()=>{!this.isConnected&&!this.pollTimer&&!this.stopped&&this.startPollInterval()},3e3),n=this.sseHandle?.unsubscribe;this.sseHandle&&(this.sseHandle.unsubscribe=()=>{clearTimeout(t),n?.()})}startStaleDetection(){this.staleTimer=setInterval(()=>{this.lastSuccess>0&&Date.now()-this.lastSuccess>Qt&&this.setStale(!0)},2e3)}processStats(t){this.onStatsUpdate?.(t),this.onError?.(null),this.lastSuccess=Date.now(),this.setStale(!1),this.historyBuffer.push(t),this.onHistoryChange?.(this.historyBuffer.getAll())}async poll(){if(!this.unauthorized){this.client||(this.client=new st({baseUrl:this.baseUrl,authToken:this.authToken}));try{const t=await this.client.get(this.endpoint);this.processStats(t)}catch(t){t instanceof ot&&(this.unauthorized=!0,this.onUnauthorizedChange?.(!0),this.onError?.(t),this.stopPolling())}}}startPollInterval(){this.pollTimer||this.stopped||(this.pollTimer=setInterval(()=>this.poll(),this.pollInterval),this.onPollActiveChange?.(!0))}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null,this.onPollActiveChange?.(!1))}setSseActive(t){this.sseActive!==t&&(this.sseActive=t,this.onSseActiveChange?.(t))}setConnected(t){this.isConnected!==t&&(this.isConnected=t,this.onConnectionChange?.(t))}setStale(t){this.isStale!==t&&(this.isStale=t,this.onStaleChange?.(t))}}function cn(e={}){const{baseUrl:t="",endpoint:n="/admin/api/server-stats",channelName:r="admin/server-stats",authToken:s,pollInterval:o=3e3}=e,[i,l]=x(null),[c,u]=x(!1),[d,a]=x(!1),[h,_]=x(null),[m,b]=x(!1),y=O(null);L(()=>{if(m)return;const g=new un({baseUrl:t,endpoint:n,channelName:r,authToken:s,pollInterval:o,onStatsUpdate:k=>l(k),onConnectionChange:k=>u(k),onStaleChange:k=>a(k),onError:k=>_(k),onUnauthorizedChange:k=>b(k)});return y.current=g,g.start(),()=>{g.stop(),y.current=null}},[t,r,s,o,m]);const v=B(g=>y.current?.getHistory(g)??[],[]);return{stats:i,history:y.current?.getAllHistory()??{},getHistory:v,isConnected:c,isStale:d,error:h,unauthorized:m}}const re="ss-dash-theme",be="ss-theme-change";function ye(){if(typeof window>"u")return"light";const e=localStorage.getItem(re);return e==="dark"||e==="light"?e:window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function _n(e){typeof window>"u"||(localStorage.setItem(re,e),window.dispatchEvent(new CustomEvent(be,{detail:e})))}function dn(){const t=ye()==="dark"?"light":"dark";return _n(t),t}function fn(e){if(typeof window>"u")return()=>{};const t=o=>{const i=o.detail;(i==="dark"||i==="light")&&e(i)},n=o=>{if(o.key===re){const i=o.newValue;e(i==="dark"||i==="light"?i:ye())}},r=window.matchMedia("(prefers-color-scheme: dark)"),s=o=>{localStorage.getItem(re)||e(o.matches?"dark":"light")};return window.addEventListener(be,t),window.addEventListener("storage",n),r.addEventListener("change",s),()=>{window.removeEventListener(be,t),window.removeEventListener("storage",n),r.removeEventListener("change",s)}}function hn(){const[e,t]=x(()=>ye());L(()=>fn(s=>{t(s)}),[]);const n=B(()=>{const r=dn();return t(r),r},[]);return{theme:e,toggleTheme:n}}const pn={color:"#34d399",fillOpacityTop:.25,fillOpacityBottom:.02,strokeWidth:1.5,width:120,height:32,padding:2};function mn(e){return{...pn,...e}}let gn=0;function vn(){return`ss-grad-${gn++}`}function dt(e){if(e.length===0)return null;let t=e[0],n=e[0],r=e[0];for(let s=1;s<e.length;s++){const o=e[s];o<t&&(t=o),o>n&&(n=o),r+=o}return{min:t,max:n,avg:r/e.length}}function bn(e,t){if(e.length<2)return null;const n=mn(t),r=dt(e),s=r.max-r.min||1,o=n.width-n.padding*2,i=n.height-n.padding*2,l=n.padding,c=e.length,u=Array.from({length:c});for(let b=0;b<c;b++){const y=l+b/(c-1)*o,v=l+i-(e[b]-r.min)/s*i;u[b]=`${y.toFixed(1)},${v.toFixed(1)}`}const d=u.join(" "),a=(l+o).toFixed(1),h=(l+i).toFixed(1),_=l.toFixed(1),m=`M${u[0]} `+u.slice(1).map(b=>`L${b}`).join(" ")+` L${a},${h} L${_},${h} Z`;return{points:d,areaPath:m,gradientId:vn(),options:n,stats:r}}function yn({data:e,color:t="#34d399",width:n=120,height:r=32,className:s=""}){const o=H(()=>bn(e,{width:n,height:r}),[e,n,r]),i=H(()=>"ss-grad-"+Math.random().toString(36).slice(2,8),[]),l={"--ss-accent":t};if(!o)return f("div",{className:`ss-dash-sparkline ${s}`,style:l,children:f("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:f("text",{x:n/2,y:r/2+3,textAnchor:"middle",fill:"#737373",fontSize:"9",children:["collecting","…"]})})});const c=t||"var(--ss-accent)";return f("div",{className:`ss-dash-sparkline ${s}`,style:l,children:f("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:[f("defs",{children:f("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[f("stop",{offset:"0%",stopColor:c,stopOpacity:"0.25"}),f("stop",{offset:"100%",stopColor:c,stopOpacity:"0.02"})]})}),f("path",{d:o.areaPath,fill:`url(#${i})`}),f("path",{className:"ss-dash-sparkline-line",d:"M"+o.points.replace(/ /g," L"),fill:"none",stroke:c,strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round"})]})})}const kn={"ss-red":"#f87171","ss-amber":"#fbbf24","ss-green":"#34d399","ss-muted":"#737373"};function wn(e,t,n){const[r,s]=x({position:"absolute",bottom:"100%",left:0,marginBottom:"10px",zIndex:180});return L(()=>{if(!n)return;const o=()=>{const l=e.current,c=t.current;if(!l||!c)return;const u=l.closest(".ss-bar");if(!u)return;const d=l.getBoundingClientRect(),a=u.getBoundingClientRect(),h=d.left-a.left+d.width/2;s({position:"absolute",bottom:"100%",left:`${h}px`,transform:"translateX(-50%)",marginBottom:"10px",zIndex:180}),requestAnimationFrame(()=>{const _=c.getBoundingClientRect();let m=0;_.left<8?m=8-_.left:_.right>window.innerWidth-8&&(m=window.innerWidth-8-_.right),m&&s(b=>({...b,transform:`translateX(calc(-50% + ${m}px))`}))})};o();const i=e.current?.closest(".ss-bar-scroll");return i?.addEventListener("scroll",o),window.addEventListener("resize",o),()=>{i?.removeEventListener("scroll",o),window.removeEventListener("resize",o)}},[n,e,t]),r}function Tn({metric:e,stats:t,history:n,className:r=""}){const[s,o]=x(!1),[i,l]=x(!1),c=O(null),u=O(null);if(e.show&&!e.show(t))return null;const d=e.value?e.value(t):e.format(t),a=e.color?e.color(t):"",h=a&&kn[a]||"#34d399",_=typeof e.detail=="function"?e.detail(t):e.detail,m=H(()=>dt(n),[n]),b=s||i,y=wn(c,u,b),v=B(E=>{E.stopPropagation(),o(U=>!U)},[]);L(()=>{if(!s)return;const E=w=>{const P=w.target;c.current&&!c.current.contains(P)&&u.current&&!u.current.contains(P)&&o(!1)},U=w=>{w.key==="Escape"&&o(!1)};return document.addEventListener("click",E),document.addEventListener("keydown",U),()=>{document.removeEventListener("click",E),document.removeEventListener("keydown",U)}},[s]);const g=c.current?.closest(".ss-bar"),k=b&&g?$t(f("div",{ref:u,className:`ss-tooltip ${s?"ss-pinned":""}`,style:y,children:[f("div",{className:"ss-tooltip-inner",style:{position:"relative"},children:[s&&f("button",{className:"ss-tooltip-close",onClick:E=>{E.stopPropagation(),o(!1)},type:"button",children:"×"}),f("div",{className:"ss-tooltip-header",children:[f("span",{className:"ss-tooltip-title",children:e.title}),e.unit&&f("span",{className:"ss-tooltip-unit",children:e.unit})]}),f("div",{className:"ss-tooltip-current",children:[f("span",{className:"ss-tooltip-current-label",children:"Current: "}),f("span",{className:"ss-tooltip-current-value",children:d})]}),m&&f("div",{className:"ss-tooltip-stats",children:[f("span",{children:["Min: ",ve(m.min,e.unit)]}),f("span",{children:["Max: ",ve(m.max,e.unit)]}),f("span",{children:["Avg: ",ve(m.avg,e.unit)]})]}),_&&f("div",{className:"ss-tooltip-details",children:_}),n.length>0&&f(N,{children:[f("div",{className:"ss-tooltip-sparkline",children:f(yn,{data:n,color:h})}),f("div",{className:"ss-tooltip-samples",children:["Last ",Math.min(n.length,60)," samples (~",Math.round(Math.min(n.length,60)*3/60)," min)"]})]})]}),f("div",{className:"ss-tooltip-arrow"})]}),g):null;return f(N,{children:[f("div",{ref:c,className:`ss-badge ${s?"ss-pinned":""} ${r}`,onClick:v,onMouseEnter:()=>!s&&l(!0),onMouseLeave:()=>l(!1),role:"button",tabIndex:0,onKeyDown:E=>E.key==="Enter"&&v(E),children:[f("span",{className:"ss-label",children:e.label}),f("span",{className:`ss-value ${a}`,children:d})]}),k]})}function Sn(e){const{featureOptions:t,autoHideOnUnauthorized:n=!0,onOpenDebugPanel:r,debugPanelOpen:s=!1,onConnectionChange:o,...i}=e,{stats:l,getHistory:c,isConnected:u,isStale:d,unauthorized:a}=cn(i);L(()=>{o?.(u)},[u,o]);const{features:h}=nn(t),{theme:_}=hn(),[m,b]=x(()=>typeof window>"u"?!0:localStorage.getItem("admin:stats-bar")!=="hidden"),y=O(null),v=O(null);L(()=>{n&&a&&b(!1)},[n,a]);const g=B(()=>{b(w=>{const P=!w;return localStorage.setItem("admin:stats-bar",P?"visible":"hidden"),P})},[]);L(()=>{const w=v.current;if(!w)return;const P=$=>{Math.abs($.deltaX)>Math.abs($.deltaY)||($.preventDefault(),w.scrollLeft+=$.deltaY)};return w.addEventListener("wheel",P,{passive:!1}),()=>w.removeEventListener("wheel",P)},[]);const k=H(()=>l?Gt(l):jt(h),[l,h]),E=H(()=>_t.filter(w=>k.has(w.group||"core")),[k]),U=H(()=>{const w=[];let P="";for(const $ of E){const M=$.group||"core";M!==P&&(P=M,w.push({group:P,metrics:[]})),w[w.length-1].metrics.push($)}return w},[E]);return n&&a?null:f(N,{children:[f("button",{type:"button",className:`ss-toggle ${m?"ss-visible":"ss-collapsed"}`,onClick:g,title:m?"Hide stats bar":"Show stats bar","data-ss-theme":_,children:[!m&&l&&f("span",{className:"ss-toggle-summary",style:{display:"flex"},children:[k.has("process")&&f(N,{children:[f("span",{className:`ss-value ${l.cpuPercent>80?"ss-red":l.cpuPercent>50?"ss-amber":"ss-green"}`,children:[l.cpuPercent.toFixed(0),"%"]}),f("span",{className:"ss-value ss-green",children:l.memHeapUsed!==void 0?Math.round(l.memHeapUsed/(1024*1024))+"M":"-"})]}),k.has("redis")&&l.redisOk!==void 0&&f("span",{className:`ss-value ${l.redisOk?"ss-green":"ss-red"}`,children:l.redisOk?"✓":"✗"})]}),m&&f("span",{className:"ss-toggle-label",style:{color:"#737373"},children:"hide stats"}),f("span",{className:"ss-toggle-arrow",children:m?"▼":"▲"})]}),f("div",{ref:y,className:m?"ss-bar":"ss-bar ss-hidden","data-ss-theme":_,children:[f("div",{className:"ss-bar-left",children:[r&&f("button",{type:"button",className:`ss-dbg-btn ${s?"ss-dbg-active":""}`,onClick:r,title:"Toggle debug panel",id:"ss-dbg-wrench",children:f("svg",{width:"14",height:"14",viewBox:at.wrench.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:at.wrench.elements.join("")}})}),f("div",{className:d?"ss-dot ss-stale":"ss-dot"})]}),f("div",{ref:v,className:"ss-bar-scroll",id:"ss-bar-scroll",children:l&&U.map((w,P)=>f(Ft.Fragment,{children:[P>0&&f("div",{className:"ss-group-sep"}),f("div",{className:"ss-group",children:w.metrics.map($=>f(Tn,{metric:$,stats:l,history:c($.historyKey||"")},$.id))})]},w.group))})]})]})}function Cn(e){const t=document.getElementById(e);return t?JSON.parse(t.textContent||"{}"):{}}const C=Cn("ss-bar-config");function En(){if(window.__ssDebugPanel)return!0;const e=document.querySelector('script[type="text/plain"][data-ss-deferred="debug-panel"]');if(!e)return console.error("[server-stats] Deferred debug panel script not found"),!1;try{const t=document.createElement("script");t.textContent=e.textContent,document.head.appendChild(t)}catch(t){return console.error("[server-stats] Debug panel script evaluation failed:",t),!1}return window.__ssDebugPanel?!0:(console.error("[server-stats] Debug panel failed to register after script evaluation"),!1)}function Pn(){let e=document.getElementById("ss-dbg-deferred");if(!e){e=document.createElement("div"),e.id="ss-dbg-deferred";const t=document.getElementById("ss-bar");t?.parentNode?t.parentNode.insertBefore(e,t.nextSibling):document.body.appendChild(e)}return e}function $n(e,t,n){if(n.current||(n.current=En()),!window.__ssDebugPanel)return;const r=Pn();try{window.__ssDebugPanel.mount(r,e,t.current)}catch(s){console.error("[server-stats] Debug panel mount failed:",s)}}function xn(){const e=document.getElementById("ss-dbg-deferred");if(window.__ssDebugPanel&&e)try{window.__ssDebugPanel.unmount(e)}catch(t){console.error("[server-stats] Debug panel unmount failed:",t)}}function Mn(e,t,n){const r=O(!1);L(()=>{C.showDebug&&(e&&t?$n(t,n,r):xn())},[e,t,n])}function Un(){const[e,t]=x(!1),n=O(!1),r=B(l=>{n.current=l},[]),s=H(()=>C.showDebug?{debugEndpoint:C.debugEndpoint,authToken:C.authToken,dashboardPath:C.dashboardPath}:void 0,[C.showDebug,C.debugEndpoint,C.authToken,C.dashboardPath]),o=H(()=>C.showDebug?{debugEndpoint:C.debugEndpoint,authToken:C.authToken}:void 0,[C.showDebug,C.debugEndpoint,C.authToken]),i=B(()=>{t(l=>!l)},[]);return Mn(e,s,n),f(Sn,{endpoint:C.endpoint,pollInterval:C.pollInterval,channelName:C.channelName,authToken:C.authToken,featureOptions:o,autoHideOnUnauthorized:!1,onOpenDebugPanel:C.showDebug?i:void 0,debugPanelOpen:e,onConnectionChange:r})}const ft=document.getElementById("ss-bar");ft&&_e(f(Un,{}),ft)})();
1
+ (function(){"use strict";var j,p,ke,D,we,Te,Se,Ce,oe,se,ie,G={},Y=[],ht=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,q=Array.isArray;function A(e,t){for(var n in t)e[n]=t[n];return e}function le(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function z(e,t,n){var r,s,o,i={};for(o in t)o=="key"?r=t[o]:o=="ref"?s=t[o]:i[o]=t[o];if(arguments.length>2&&(i.children=arguments.length>3?j.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)i[o]===void 0&&(i[o]=e.defaultProps[o]);return X(e,i,r,s,null)}function X(e,t,n,r,s){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++ke,__i:-1,__u:0};return s==null&&p.vnode!=null&&p.vnode(o),o}function N(e){return e.children}function R(e,t){this.props=e,this.context=t}function I(e,t){if(t==null)return e.__?I(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?I(e):null}function pt(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],s=[],o=A({},t);o.__v=t.__v+1,p.vnode&&p.vnode(o),ae(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??I(t),!!(32&t.__u),s),o.__v=t.__v,o.__.__k[o.__i]=o,Ne(r,o,s),t.__e=t.__=null,o.__e!=n&&Ee(o)}}function Ee(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Ee(e)}function Pe(e){(!e.__d&&(e.__d=!0)&&D.push(e)&&!Q.__r++||we!=p.debounceRendering)&&((we=p.debounceRendering)||Te)(Q)}function Q(){for(var e,t=1;D.length;)D.length>t&&D.sort(Se),e=D.shift(),t=D.length,pt(e);Q.__r=0}function $e(e,t,n,r,s,o,i,l,c,u,d){var a,h,_,m,b,y,v,g=r&&r.__k||Y,k=t.length;for(c=mt(n,t,g,c,k),a=0;a<k;a++)(_=n.__k[a])!=null&&(h=_.__i!=-1&&g[_.__i]||G,_.__i=a,y=ae(e,_,h,s,o,i,l,c,u,d),m=_.__e,_.ref&&h.ref!=_.ref&&(h.ref&&ce(h.ref,null,_),d.push(_.ref,_.__c||m,_)),b==null&&m!=null&&(b=m),(v=!!(4&_.__u))||h.__k===_.__k?c=xe(_,c,e,v):typeof _.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),_.__u&=-7);return n.__e=b,c}function mt(e,t,n,r,s){var o,i,l,c,u,d=n.length,a=d,h=0;for(e.__k=new Array(s),o=0;o<s;o++)(i=t[o])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[o]=X(null,i,null,null,null):q(i)?i=e.__k[o]=X(N,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[o]=X(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[o]=i,c=o+h,i.__=e,i.__b=e.__b+1,l=null,(u=i.__i=gt(i,n,c,a))!=-1&&(a--,(l=n[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(s>d?h--:s<d&&h++),typeof i.type!="function"&&(i.__u|=4)):u!=c&&(u==c-1?h--:u==c+1?h++:(u>c?h--:h++,i.__u|=4))):e.__k[o]=null;if(a)for(o=0;o<d;o++)(l=n[o])!=null&&(2&l.__u)==0&&(l.__e==r&&(r=I(l)),Ae(l,l));return r}function xe(e,t,n,r){var s,o;if(typeof e.type=="function"){for(s=e.__k,o=0;s&&o<s.length;o++)s[o]&&(s[o].__=e,t=xe(s[o],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=I(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function J(e,t){return t=t||[],e==null||typeof e=="boolean"||(q(e)?e.some(function(n){J(n,t)}):t.push(e)),t}function gt(e,t,n,r){var s,o,i,l=e.key,c=e.type,u=t[n],d=u!=null&&(2&u.__u)==0;if(u===null&&l==null||d&&l==u.key&&c==u.type)return n;if(r>(d?1:0)){for(s=n-1,o=n+1;s>=0||o<t.length;)if((u=t[i=s>=0?s--:o++])!=null&&(2&u.__u)==0&&l==u.key&&c==u.type)return i}return-1}function Me(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ht.test(t)?n:n+"px"}function Z(e,t,n,r,s){var o,i;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Me(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Me(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Ce,"$1")),i=t.toLowerCase(),t=i in e||t=="onFocusOut"||t=="onFocusIn"?i.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n.u=r.u:(n.u=oe,e.addEventListener(t,o?ie:se,o)):e.removeEventListener(t,o?ie:se,o);else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Ue(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=oe++;else if(t.t<n.u)return;return n(p.event?p.event(t):t)}}}function ae(e,t,n,r,s,o,i,l,c,u){var d,a,h,_,m,b,y,v,g,k,E,U,w,P,$,M=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[l=t.__e=n.__e]),(d=p.__b)&&d(t);e:if(typeof M=="function")try{if(v=t.props,g="prototype"in M&&M.prototype.render,k=(d=M.contextType)&&r[d.__c],E=d?k?k.props.value:d.__:r,n.__c?y=(a=t.__c=n.__c).__=a.__E:(g?t.__c=a=new M(v,E):(t.__c=a=new R(v,E),a.constructor=M,a.render=bt),k&&k.sub(a),a.state||(a.state={}),a.__n=r,h=a.__d=!0,a.__h=[],a._sb=[]),g&&a.__s==null&&(a.__s=a.state),g&&M.getDerivedStateFromProps!=null&&(a.__s==a.state&&(a.__s=A({},a.__s)),A(a.__s,M.getDerivedStateFromProps(v,a.__s))),_=a.props,m=a.state,a.__v=t,h)g&&M.getDerivedStateFromProps==null&&a.componentWillMount!=null&&a.componentWillMount(),g&&a.componentDidMount!=null&&a.__h.push(a.componentDidMount);else{if(g&&M.getDerivedStateFromProps==null&&v!==_&&a.componentWillReceiveProps!=null&&a.componentWillReceiveProps(v,E),t.__v==n.__v||!a.__e&&a.shouldComponentUpdate!=null&&a.shouldComponentUpdate(v,a.__s,E)===!1){t.__v!=n.__v&&(a.props=v,a.state=a.__s,a.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(W){W&&(W.__=t)}),Y.push.apply(a.__h,a._sb),a._sb=[],a.__h.length&&i.push(a);break e}a.componentWillUpdate!=null&&a.componentWillUpdate(v,a.__s,E),g&&a.componentDidUpdate!=null&&a.__h.push(function(){a.componentDidUpdate(_,m,b)})}if(a.context=E,a.props=v,a.__P=e,a.__e=!1,U=p.__r,w=0,g)a.state=a.__s,a.__d=!1,U&&U(t),d=a.render(a.props,a.state,a.context),Y.push.apply(a.__h,a._sb),a._sb=[];else do a.__d=!1,U&&U(t),d=a.render(a.props,a.state,a.context),a.state=a.__s;while(a.__d&&++w<25);a.state=a.__s,a.getChildContext!=null&&(r=A(A({},r),a.getChildContext())),g&&!h&&a.getSnapshotBeforeUpdate!=null&&(b=a.getSnapshotBeforeUpdate(_,m)),P=d!=null&&d.type===N&&d.key==null?He(d.props.children):d,l=$e(e,q(P)?P:[P],t,n,r,s,o,i,l,c,u),a.base=t.__e,t.__u&=-161,a.__h.length&&i.push(a),y&&(a.__E=a.__=null)}catch(W){if(t.__v=null,c||o!=null)if(W.then){for(t.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;o[o.indexOf(l)]=null,t.__e=l}else{for($=o.length;$--;)le(o[$]);ue(t)}else t.__e=n.__e,t.__k=n.__k,W.then||ue(t);p.__e(W,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=vt(n.__e,t,n,r,s,o,i,c,u);return(d=p.diffed)&&d(t),128&t.__u?void 0:l}function ue(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ue))}function Ne(e,t,n){for(var r=0;r<n.length;r++)ce(n[r],n[++r],n[++r]);p.__c&&p.__c(t,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(o){o.call(s)})}catch(o){p.__e(o,s.__v)}})}function He(e){return typeof e!="object"||e==null||e.__b>0?e:q(e)?e.map(He):A({},e)}function vt(e,t,n,r,s,o,i,l,c){var u,d,a,h,_,m,b,y=n.props||G,v=t.props,g=t.type;if(g=="svg"?s="http://www.w3.org/2000/svg":g=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((_=o[u])&&"setAttribute"in _==!!g&&(g?_.localName==g:_.nodeType==3)){e=_,o[u]=null;break}}if(e==null){if(g==null)return document.createTextNode(v);e=document.createElementNS(s,g,v.is&&v),l&&(p.__m&&p.__m(t,o),l=!1),o=null}if(g==null)y===v||l&&e.data==v||(e.data=v);else{if(o=o&&j.call(e.childNodes),!l&&o!=null)for(y={},u=0;u<e.attributes.length;u++)y[(_=e.attributes[u]).name]=_.value;for(u in y)_=y[u],u=="dangerouslySetInnerHTML"?a=_:u=="children"||u in v||u=="value"&&"defaultValue"in v||u=="checked"&&"defaultChecked"in v||Z(e,u,null,_,s);for(u in v)_=v[u],u=="children"?h=_:u=="dangerouslySetInnerHTML"?d=_:u=="value"?m=_:u=="checked"?b=_:l&&typeof _!="function"||y[u]===_||Z(e,u,_,y[u],s);if(d)l||a&&(d.__html==a.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(a&&(e.innerHTML=""),$e(t.type=="template"?e.content:e,q(h)?h:[h],t,n,r,g=="foreignObject"?"http://www.w3.org/1999/xhtml":s,o,i,o?o[0]:n.__k&&I(n,0),l,c),o!=null)for(u=o.length;u--;)le(o[u]);l||(u="value",g=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[u]||g=="progress"&&!m||g=="option"&&m!=y[u])&&Z(e,u,m,y[u],s),u="checked",b!=null&&b!=e[u]&&Z(e,u,b,y[u],s))}return e}function ce(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(s){p.__e(s,n)}}function Ae(e,t,n){var r,s;if(p.unmount&&p.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ce(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){p.__e(o,t)}r.base=r.__P=null}if(r=e.__k)for(s=0;s<r.length;s++)r[s]&&Ae(r[s],t,n||typeof e.type!="function");n||le(e.__e),e.__c=e.__=e.__e=void 0}function bt(e,t,n){return this.constructor(e,n)}function _e(e,t,n){var r,s,o,i;t==document&&(t=document.documentElement),p.__&&p.__(e,t),s=(r=!1)?null:t.__k,o=[],i=[],ae(t,e=t.__k=z(N,null,[e]),s||G,G,t.namespaceURI,s?null:t.firstChild?j.call(t.childNodes):null,o,s?s.__e:t.firstChild,r,i),Ne(o,e,i)}j=Y.slice,p={__e:function(e,t,n,r){for(var s,o,i;t=t.__;)if((s=t.__c)&&!s.__)try{if((o=s.constructor)&&o.getDerivedStateFromError!=null&&(s.setState(o.getDerivedStateFromError(e)),i=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),i=s.__d),i)return s.__E=s}catch(l){e=l}throw e}},ke=0,R.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=A({},this.state),typeof e=="function"&&(e=e(A({},n),this.props)),e&&A(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Pe(this))},R.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Pe(this))},R.prototype.render=N,D=[],Te=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Se=function(e,t){return e.__v.__b-t.__v.__b},Q.__r=0,Ce=/(PointerCapture)$|Capture$/i,oe=0,se=Ue(!1),ie=Ue(!0);var yt=0;function f(e,t,n,r,s,o){t||(t={});var i,l,c=t;if("ref"in c)for(l in c={},t)l=="ref"?i=t[l]:c[l]=t[l];var u={type:e,props:c,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--yt,__i:-1,__u:0,__source:s,__self:o};if(typeof e=="function"&&(i=e.defaultProps))for(l in i)c[l]===void 0&&(c[l]=i[l]);return p.vnode&&p.vnode(u),u}var K,T,de,Re,V=0,Le=[],S=p,Oe=S.__b,De=S.__r,Fe=S.diffed,Ie=S.__c,Be=S.unmount,We=S.__;function fe(e,t){S.__h&&S.__h(T,e,V||t),V=0;var n=T.__H||(T.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function x(e){return V=1,kt(Ke,e)}function kt(e,t,n){var r=fe(K++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ke(void 0,t),function(l){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,l);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=T,!T.__f)){var s=function(l,c,u){if(!r.__c.__H)return!0;var d=r.__c.__H.__.filter(function(h){return h.__c});if(d.every(function(h){return!h.__N}))return!o||o.call(this,l,c,u);var a=r.__c.props!==l;return d.some(function(h){if(h.__N){var _=h.__[0];h.__=h.__N,h.__N=void 0,_!==h.__[0]&&(a=!0)}}),o&&o.call(this,l,c,u)||a};T.__f=!0;var o=T.shouldComponentUpdate,i=T.componentWillUpdate;T.componentWillUpdate=function(l,c,u){if(this.__e){var d=o;o=void 0,s(l,c,u),o=d}i&&i.call(this,l,c,u)},T.shouldComponentUpdate=s}return r.__N||r.__}function L(e,t){var n=fe(K++,3);!S.__s&&ze(n.__H,t)&&(n.__=e,n.u=t,T.__H.__h.push(n))}function O(e){return V=5,H(function(){return{current:e}},[])}function H(e,t){var n=fe(K++,7);return ze(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function B(e,t){return V=8,H(function(){return e},t)}function wt(){for(var e;e=Le.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ee),t.__h.some(he),t.__h=[]}catch(n){t.__h=[],S.__e(n,e.__v)}}}S.__b=function(e){T=null,Oe&&Oe(e)},S.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),We&&We(e,t)},S.__r=function(e){De&&De(e),K=0;var t=(T=e.__c).__H;t&&(de===T?(t.__h=[],T.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(ee),t.__h.some(he),t.__h=[],K=0)),de=T},S.diffed=function(e){Fe&&Fe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Le.push(t)!==1&&Re===S.requestAnimationFrame||((Re=S.requestAnimationFrame)||Tt)(wt)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),de=T=null},S.__c=function(e,t){t.some(function(n){try{n.__h.some(ee),n.__h=n.__h.filter(function(r){return!r.__||he(r)})}catch(r){t.some(function(s){s.__h&&(s.__h=[])}),t=[],S.__e(r,n.__v)}}),Ie&&Ie(e,t)},S.unmount=function(e){Be&&Be(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{ee(r)}catch(s){t=s}}),n.__H=void 0,t&&S.__e(t,n.__v))};var qe=typeof requestAnimationFrame=="function";function Tt(e){var t,n=function(){clearTimeout(r),qe&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);qe&&(t=requestAnimationFrame(n))}function ee(e){var t=T,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),T=t}function he(e){var t=T;e.__c=e.__(),T=t}function ze(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Ke(e,t){return typeof t=="function"?t(e):t}function St(e,t){for(var n in t)e[n]=t[n];return e}function Ve(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function je(e,t){this.props=e,this.context=t}(je.prototype=new R).isPureReactComponent=!0,je.prototype.shouldComponentUpdate=function(e,t){return Ve(this.props,e)||Ve(this.state,t)};var Ge=p.__b;p.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ge&&Ge(e)};var Ct=p.__e;p.__e=function(e,t,n,r){if(e.then){for(var s,o=t;o=o.__;)if((s=o.__c)&&s.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),s.__c(e,t)}Ct(e,t,n,r)};var Ye=p.unmount;function Xe(e,t,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=St({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Xe(r,t,n)})),e}function Qe(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Qe(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function pe(){this.__u=0,this.o=null,this.__b=null}function Je(e){if(!e.__)return null;var t=e.__.__c;return t&&t.__a&&t.__a(e)}function te(){this.i=null,this.l=null}p.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Ye&&Ye(e)},(pe.prototype=new R).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var s=Je(r.__v),o=!1,i=function(){o||r.__z||(o=!0,n.__R=null,s?s(c):c())};n.__R=i;var l=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var u=r.state.__a;r.__v.__k[0]=Qe(u,u.__c.__P,u.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.o.pop();)d.__P=l,d.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(i,i)},pe.prototype.componentWillUnmount=function(){this.o=[]},pe.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Xe(this.__b,n,r.__O=r.__P)}this.__b=null}var s=t.__a&&z(N,null,e.fallback);return s&&(s.__u&=-33),[z(N,null,t.__a?null:e.children),s]};var Ze=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),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]}};function Et(e){return this.getChildContext=function(){return e.context},e.children}function Pt(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){_e(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(s,o){this.childNodes.push(s),t.h.insertBefore(s,o)},removeChild:function(s){this.childNodes.splice(this.childNodes.indexOf(s)>>>1,1),t.h.removeChild(s)}}}_e(z(Et,{context:t.context},e.__v),t.v)}function $t(e,t){var n=z(Pt,{__v:e,h:t});return n.containerInfo=t,n}(te.prototype=new R).__a=function(e){var t=this,n=Je(t.__v),r=t.l.get(e);return r[0]++,function(s){var o=function(){t.props.revealOrder?(r.push(s),Ze(t,e,r)):s()};n?n(o):o()}},te.prototype.render=function(e){this.i=null,this.l=new Map;var t=J(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},te.prototype.componentDidUpdate=te.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Ze(e,n,t)})};var xt=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Mt=/^(?: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]/,Ut=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Nt=/[A-Z0-9]/g,Ht=typeof document<"u",At=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};R.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(R.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var et=p.event;function Rt(){}function Lt(){return this.cancelBubble}function Ot(){return this.defaultPrevented}p.event=function(e){return et&&(e=et(e)),e.persist=Rt,e.isPropagationStopped=Lt,e.isDefaultPrevented=Ot,e.nativeEvent=e};var Dt={enumerable:!1,configurable:!0,get:function(){return this.class}},tt=p.vnode;p.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,r=t.type,s={},o=r.indexOf("-")===-1;for(var i in n){var l=n[i];if(!(i==="value"&&"defaultValue"in n&&l==null||Ht&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var c=i.toLowerCase();i==="defaultValue"&&"value"in n&&n.value==null?i="value":i==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?i="ondblclick":c!=="onchange"||r!=="input"&&r!=="textarea"||At(n.type)?c==="onfocus"?i="onfocusin":c==="onblur"?i="onfocusout":Ut.test(i)&&(i=c):c=i="oninput":o&&Mt.test(i)?i=i.replace(Nt,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&s[i=c]&&(i="oninputCapture"),s[i]=l}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=J(n.children).forEach(function(u){u.props.selected=s.value.indexOf(u.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=J(n.children).forEach(function(u){u.props.selected=s.multiple?s.defaultValue.indexOf(u.props.value)!=-1:s.defaultValue==u.props.value})),n.class&&!n.className?(s.class=n.class,Object.defineProperty(s,"className",Dt)):n.className&&(s.class=s.className=n.className),t.props=s})(e),e.$$typeof=xt,tt&&tt(e)};var nt=p.__r;p.__r=function(e){nt&&nt(e),e.__c};var rt=p.diffed;p.diffed=function(e){rt&&rt(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value)};var Ft={Fragment:N};class ot extends Error{status;constructor(t=403){super(`Unauthorized (HTTP ${t})`),this.name="UnauthorizedError",this.status=t}}class It extends Error{status;body;constructor(t,n){super(`API error (HTTP ${t})`),this.name="ApiError",this.status=t,this.body=n}}class st{baseUrl;authToken;constructor(t){this.baseUrl=t.baseUrl.replace(/\/+$/,""),this.authToken=t.authToken}async fetch(t,n){const s={...{Accept:"application/json",...this.authToken?{Authorization:`Bearer ${this.authToken}`}:{}},...n?.headers},o=await globalThis.fetch(`${this.baseUrl}${t}`,{...n,headers:s,credentials:this.authToken?"omit":"same-origin"});if(n?.signal?.aborted)throw new DOMException("The operation was aborted.","AbortError");if(o.status===401||o.status===403)throw new ot(o.status);if(!o.ok){const i=await o.text().catch(()=>"");throw new It(o.status,i)}return o.json()}async get(t,n){const r=n?`${t}?${n}`:t;return this.fetch(r)}async post(t,n){const r={method:"POST",...n!==void 0?{body:JSON.stringify(n),headers:{"Content-Type":"application/json"}}:{}};return this.fetch(t,r)}async delete(t){return this.fetch(t,{method:"DELETE"})}}const Bt=["tracing","process","system","http","db","redis","queues","cache","app","log","emails","dashboard"],Wt=[{flag:"process",group:"process"},{flag:"process",group:"memory"},{flag:"system",group:"memory"},{flag:"http",group:"http"},{flag:"db",group:"db"},{flag:"redis",group:"redis"},{flag:"queues",group:"queue"},{flag:"app",group:"app"},{flag:"log",group:"log"}],qt=[{group:"process",fields:["cpuPercent","uptime","nodeVersion"]},{group:"memory",fields:["memHeapUsed","memRss","systemMemoryTotalMb","systemMemoryFreeMb"]},{group:"http",fields:["requestsPerSecond","avgResponseTimeMs","errorRate","activeHttpConnections"]},{group:"db",fields:["dbPoolMax","dbPoolUsed","dbPoolFree","dbPoolPending"]},{group:"queue",fields:["queueActive","queueWaiting","queueWorkerCount"]},{group:"app",fields:["onlineUsers","pendingWebhooks","pendingEmails"]},{group:"log",fields:["logErrorsLast5m","logEntriesPerMinute"]}];function me(e){return typeof e=="number"&&!Number.isNaN(e)}const it="/admin/api/debug",lt={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 zt(e){const t={customPanes:e.customPanes??[]},n=e.features;for(const r of Bt)t[r]=n?.[r]??!1;return t}async function Kt(e,t=it){const n=`${t.replace(/\/+$/,"")}/config`;return e.fetch(n)}async function Vt(e){const{baseUrl:t="",debugEndpoint:n=it,authToken:r}=e,s=new st({baseUrl:t,authToken:r});try{const o=await Kt(s,n);return zt(o)}catch{return lt}}function jt(e){const t=new Set,r="features"in e&&typeof e.features=="object"&&e.features!==null?e.features:e;for(const{flag:s,group:o}of Wt)r[s]&&t.add(o);return t}function Gt(e){const t=new Set;(me(e.cpuPercent)||me(e.uptime)||Yt(e))&&t.add("process");for(const n of qt)n.fields.some(r=>me(e[r]))&&t.add(n.group);return e.redisOk!==void 0&&e.redisOk!==null&&t.add("redis"),t}function Yt(e){return typeof e.nodeVersion=="string"&&e.nodeVersion.length>0}const at={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"/>']}},Xt=60,Qt=1e4;function Jt(e){if(!e&&e!==0)return"-";const t=Math.floor(e),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),s=Math.floor(t%3600/60);return n>0?`${n}d ${r}h`:r>0?`${r}h ${s}m`:s>0?`${s}m ${t%60}s`:`${t}s`}function ge(e){const t=e/1048576;return t>=1024?`${(t/1024).toFixed(1)}G`:`${t.toFixed(0)}M`}function ut(e){return e>=1024?`${(e/1024).toFixed(1)}G`:`${e.toFixed(1)}M`}function Zt(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:`${e}`}function ve(e,t){switch(t){case"%":return`${e.toFixed(1)}%`;case"ms":return`${e.toFixed(0)}ms`;case"MB":return`${e.toFixed(1)}M`;case"bytes":return ge(e);case"/s":case"/m":return e.toFixed(1);default:return e.toFixed(1)}}function ne(e,t,n){return e>n?"red":e>t?"amber":"green"}function en(e,t,n){return e<n?"red":e<t?"amber":"green"}function ct(e,t){if(t===0)return"green";const n=e/t;return n>.8?"red":n>.5?"amber":"green"}const tn={green:"ss-green",amber:"ss-amber",red:"ss-red"};function F(e){return tn[e]||""}const _t=[{id:"node",label:"NODE",title:"Node.js Runtime",unit:"",group:"process",extract:e=>0,format:e=>e.nodeVersion,color:()=>""},{id:"uptime",label:"UP",title:"Process Uptime",unit:"",group:"process",extract:e=>e.uptime,format:e=>Jt(e.uptime),color:()=>""},{id:"cpu",label:"CPU",title:"CPU Usage",unit:"%",group:"process",warnThreshold:50,critThreshold:80,extract:e=>e.cpuPercent,format:e=>`${e.cpuPercent.toFixed(1)}%`,color:e=>F(ne(e.cpuPercent,50,80)),historyKey:"cpuPercent"},{id:"eventLoop",label:"EVT",title:"Event Loop Latency",unit:"ms",group:"process",warnThreshold:20,critThreshold:50,extract:e=>e.eventLoopLag,format:e=>`${e.eventLoopLag.toFixed(1)}ms`,color:e=>F(ne(e.eventLoopLag,20,50)),historyKey:"eventLoopLag"},{id:"memory",label:"HEAP",title:"V8 Heap Usage",unit:"bytes",group:"memory",extract:e=>e.memHeapUsed,format:e=>ge(e.memHeapUsed),color:()=>"",historyKey:"memHeapUsed"},{id:"rss",label:"RSS",title:"Resident Set Size",unit:"bytes",group:"memory",extract:e=>e.memRss,format:e=>ge(e.memRss),color:()=>"",historyKey:"memRss"},{id:"systemMemory",label:"SYS",title:"System Memory",unit:"MB",group:"memory",extract:e=>e.systemMemoryTotalMb-e.systemMemoryFreeMb,format:e=>`${ut(e.systemMemoryTotalMb-e.systemMemoryFreeMb)}/${ut(e.systemMemoryTotalMb)}`,color:e=>{const t=e.systemMemoryTotalMb;if(t===0)return"";const n=t-e.systemMemoryFreeMb;return F(ct(n,t))},historyKey:"_sysMemUsed",show:e=>e.systemMemoryTotalMb!==null&&e.systemMemoryTotalMb!==void 0},{id:"reqPerSec",label:"REQ/s",title:"Requests per Second",unit:"/s",group:"http",extract:e=>e.requestsPerSecond,format:e=>e.requestsPerSecond.toFixed(1),color:()=>"",historyKey:"requestsPerSecond"},{id:"avgResponse",label:"AVG",title:"Avg Response Time",unit:"ms",group:"http",warnThreshold:200,critThreshold:500,extract:e=>e.avgResponseTimeMs,format:e=>`${e.avgResponseTimeMs.toFixed(0)}ms`,color:e=>F(ne(e.avgResponseTimeMs,200,500)),historyKey:"avgResponseTimeMs"},{id:"errorRate",label:"ERR",title:"Error Rate",unit:"%",group:"http",warnThreshold:1,critThreshold:5,extract:e=>e.errorRate,format:e=>`${e.errorRate.toFixed(1)}%`,color:e=>F(ne(e.errorRate,1,5)),historyKey:"errorRate"},{id:"connections",label:"CONN",title:"Active Connections",unit:"",group:"http",extract:e=>e.activeHttpConnections,format:e=>`${e.activeHttpConnections}`,color:()=>"",historyKey:"activeHttpConnections"},{id:"dbPool",label:"DB",title:"Database Pool",unit:"",group:"db",extract:e=>e.dbPoolUsed,format:e=>`${e.dbPoolUsed}/${e.dbPoolFree}/${e.dbPoolMax}`,color:e=>F(ct(e.dbPoolUsed,e.dbPoolMax)),historyKey:"dbPoolUsed"},{id:"redis",label:"REDIS",title:"Redis Status",unit:"",group:"redis",extract:e=>e.redisOk?1:0,format:e=>e.redisOk?"✓":"✗",color:e=>e.redisOk?"ss-green":"ss-red"},{id:"redisMem",label:"MEM",title:"Redis Memory",unit:"MB",group:"redis",extract:e=>e.redisMemoryUsedMb,format:e=>`${e.redisMemoryUsedMb.toFixed(1)}M`,color:()=>"",historyKey:"redisMemoryUsedMb",show:e=>e.redisOk},{id:"redisKeys",label:"KEYS",title:"Redis Keys",unit:"",group:"redis",extract:e=>e.redisKeysCount,format:e=>Zt(e.redisKeysCount),color:()=>"",historyKey:"redisKeysCount",show:e=>e.redisOk},{id:"redisHitRate",label:"HIT",title:"Redis Hit Rate",unit:"%",group:"redis",warnThreshold:90,critThreshold:70,inverseThreshold:!0,extract:e=>e.redisHitRate,format:e=>`${e.redisHitRate.toFixed(0)}%`,color:e=>F(en(e.redisHitRate,90,70)),historyKey:"redisHitRate",show:e=>e.redisOk},{id:"queue",label:"Q",title:"Job Queue",unit:"",group:"queue",extract:e=>e.queueActive,format:e=>`${e.queueActive}/${e.queueWaiting}/${e.queueDelayed}`,color:e=>e.queueFailed>0?"ss-amber":"ss-green",historyKey:"queueActive"},{id:"queueWorkers",label:"WORKERS",title:"Queue Workers",unit:"",group:"queue",extract:e=>e.queueWorkerCount,format:e=>`${e.queueWorkerCount}`,color:()=>""},{id:"onlineUsers",label:"USERS",title:"Online Users",unit:"",group:"app",extract:e=>e.onlineUsers,format:e=>`${e.onlineUsers}`,color:()=>"",historyKey:"onlineUsers"},{id:"pendingWebhooks",label:"HOOKS",title:"Pending Webhooks",unit:"",group:"app",extract:e=>e.pendingWebhooks,format:e=>`${e.pendingWebhooks}`,color:e=>e.pendingWebhooks>0?"ss-amber":"",historyKey:"pendingWebhooks"},{id:"pendingEmails",label:"MAIL",title:"Pending Emails",unit:"",group:"app",extract:e=>e.pendingEmails,format:e=>`${e.pendingEmails}`,color:e=>e.pendingEmails>0?"ss-amber":"",historyKey:"pendingEmails"},{id:"logErrors",label:"LOG ERR",title:"Log Errors (5m)",unit:"",group:"log",extract:e=>e.logErrorsLast5m,format:e=>`${e.logErrorsLast5m}`,color:e=>e.logErrorsLast5m>0?"ss-red":e.logWarningsLast5m>0?"ss-amber":"",historyKey:"logErrorsLast5m"},{id:"logRate",label:"LOG/m",title:"Log Entries / Minute",unit:"/m",group:"log",extract:e=>e.logEntriesPerMinute,format:e=>`${e.logEntriesPerMinute}`,color:()=>"",historyKey:"logEntriesPerMinute"}];function nn(e={}){const{baseUrl:t="",debugEndpoint:n="/admin/api/debug",authToken:r}=e,[s,o]=x(lt),[i,l]=x(!0),[c,u]=x(null),d=O(!1);return L(()=>{if(d.current)return;d.current=!0;let a=!1;return(async()=>{try{const _=await Vt({baseUrl:t,debugEndpoint:n,authToken:r});a||(o(_),l(!1))}catch(_){a||(u(_ instanceof Error?_:new Error(String(_))),l(!1))}})(),()=>{a=!0}},[t,n,r]),{features:s,isLoading:i,error:c}}function rn(e=Xt){const t={},n={};let r=!1;function s(o){if(o.count===0)return[];const i=Array.from({length:o.count}),l=o.count<e?0:o.head;for(let c=0;c<o.count;c++)i[c]=o.data[(l+c)%e];return i}return{push(o){r=!1;for(const i of _t){const l=i.historyKey;if(!l)continue;const c=i.extract(o);if(typeof c!="number")continue;t[l]||(t[l]={data:Array.from({length:e}),head:0,count:0});const u=t[l];u.data[u.head]=c,u.head=(u.head+1)%e,u.count<e&&u.count++}},get(o){const i=t[o];return i?s(i):[]},getAll(){if(r)return n;for(const o of Object.keys(t))n[o]=s(t[o]);return r=!0,n}}}function on(e,t){const n=e||(typeof window<"u"?window.location.origin:"");if(!t)return{baseUrl:n};const r={headers:{Authorization:`Bearer ${t}`}};return{baseUrl:n,beforeSubscribe(s){return r},beforeUnsubscribe(s){return r}}}async function sn(){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 ln(e){let t=null,n=null,r=!1;return{subscribe:async()=>{try{const i=await sn();if(!i)throw new Error("Transmit client not available (neither window.Transmit nor @adonisjs/transmit-client)");if(r)return;t=new i(on(e.baseUrl,e.authToken)),n=t.subscription(e.channelName),n.onMessage(l=>{r||e.onMessage(l)}),await n.create()}catch(i){e.onError?.(i)}},unsubscribe:async()=>{r=!0;try{await n?.delete(),n=null,t=null}catch{}}}}function an(e){let t=!1;const n=ln({baseUrl:e.baseUrl,channelName:e.channelName,authToken:e.authToken,onMessage:e.onMessage,onError:r=>{t=!0,e.onError?.(r),e.onDisconnect?.()}});return n.subscribe().then(()=>{t||e.onConnect?.()}).catch(r=>{e.onError?.(r),e.onDisconnect?.()}),{unsubscribe:()=>{n.unsubscribe().catch(()=>{})}}}class un{baseUrl;endpoint;channelName;authToken;pollInterval;onStatsUpdate;onConnectionChange;onStaleChange;onError;onUnauthorizedChange;onHistoryChange;onSseActiveChange;onPollActiveChange;historyBuffer;client=null;sseHandle=null;pollTimer=null;staleTimer=null;lastSuccess=0;unauthorized=!1;stopped=!1;sseActive=!1;isConnected=!1;isStale=!1;constructor(t={}){this.baseUrl=t.baseUrl??"",this.endpoint=t.endpoint??"/admin/api/server-stats",this.channelName=t.channelName??"admin/server-stats",this.authToken=t.authToken,this.pollInterval=t.pollInterval??3e3,this.onStatsUpdate=t.onStatsUpdate,this.onConnectionChange=t.onConnectionChange,this.onStaleChange=t.onStaleChange,this.onError=t.onError,this.onUnauthorizedChange=t.onUnauthorizedChange,this.onHistoryChange=t.onHistoryChange,this.onSseActiveChange=t.onSseActiveChange,this.onPollActiveChange=t.onPollActiveChange,this.historyBuffer=rn()}start(){if(this.unauthorized)return;this.stopped=!1;const t=this.initSseSubscription();this.poll(),t||!this.sseHandle?this.startPollInterval():this.setupSseFallbackTimer(),this.startStaleDetection()}stop(){this.stopped=!0,this.sseHandle?.unsubscribe(),this.sseHandle=null,this.stopPolling(),this.staleTimer&&(clearInterval(this.staleTimer),this.staleTimer=null)}getHistory(t){return this.historyBuffer.get(t)}getAllHistory(){return this.historyBuffer.getAll()}getConnectionMode(){return this.unauthorized?"disconnected":this.sseActive?"live":this.pollTimer?"polling":"disconnected"}initSseSubscription(){let t=!1;try{this.sseHandle=an({baseUrl:this.baseUrl,channelName:this.channelName,authToken:this.authToken,onMessage:n=>{n&&typeof n=="object"&&"timestamp"in n&&this.processStats(n)},onConnect:()=>{this.setSseActive(!0),this.setConnected(!0),this.stopPolling()},onDisconnect:()=>{this.setSseActive(!1),this.setConnected(!1),!this.pollTimer&&!this.unauthorized&&!this.stopped&&this.startPollInterval()},onError:()=>{t=!0}})}catch{t=!0}return t}setupSseFallbackTimer(){const t=setTimeout(()=>{!this.isConnected&&!this.pollTimer&&!this.stopped&&this.startPollInterval()},3e3),n=this.sseHandle?.unsubscribe;this.sseHandle&&(this.sseHandle.unsubscribe=()=>{clearTimeout(t),n?.()})}startStaleDetection(){this.staleTimer=setInterval(()=>{this.lastSuccess>0&&Date.now()-this.lastSuccess>Qt&&this.setStale(!0)},2e3)}processStats(t){this.onStatsUpdate?.(t),this.onError?.(null),this.lastSuccess=Date.now(),this.setStale(!1),this.historyBuffer.push(t),this.onHistoryChange?.(this.historyBuffer.getAll())}async poll(){if(!this.unauthorized){this.client||(this.client=new st({baseUrl:this.baseUrl,authToken:this.authToken}));try{const t=await this.client.get(this.endpoint);this.processStats(t)}catch(t){t instanceof ot&&(this.unauthorized=!0,this.onUnauthorizedChange?.(!0),this.onError?.(t),this.stopPolling())}}}startPollInterval(){this.pollTimer||this.stopped||(this.pollTimer=setInterval(()=>this.poll(),this.pollInterval),this.onPollActiveChange?.(!0))}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null,this.onPollActiveChange?.(!1))}setSseActive(t){this.sseActive!==t&&(this.sseActive=t,this.onSseActiveChange?.(t))}setConnected(t){this.isConnected!==t&&(this.isConnected=t,this.onConnectionChange?.(t))}setStale(t){this.isStale!==t&&(this.isStale=t,this.onStaleChange?.(t))}}function cn(e={}){const{baseUrl:t="",endpoint:n="/admin/api/server-stats",channelName:r="admin/server-stats",authToken:s,pollInterval:o=3e3}=e,[i,l]=x(null),[c,u]=x(!1),[d,a]=x(!1),[h,_]=x(null),[m,b]=x(!1),y=O(null);L(()=>{if(m)return;const g=new un({baseUrl:t,endpoint:n,channelName:r,authToken:s,pollInterval:o,onStatsUpdate:k=>l(k),onConnectionChange:k=>u(k),onStaleChange:k=>a(k),onError:k=>_(k),onUnauthorizedChange:k=>b(k)});return y.current=g,g.start(),()=>{g.stop(),y.current=null}},[t,r,s,o,m]);const v=B(g=>y.current?.getHistory(g)??[],[]);return{stats:i,history:y.current?.getAllHistory()??{},getHistory:v,isConnected:c,isStale:d,error:h,unauthorized:m}}const re="ss-dash-theme",be="ss-theme-change";function ye(){if(typeof window>"u")return"light";const e=localStorage.getItem(re);return e==="dark"||e==="light"?e:window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function _n(e){typeof window>"u"||(localStorage.setItem(re,e),window.dispatchEvent(new CustomEvent(be,{detail:e})))}function dn(){const t=ye()==="dark"?"light":"dark";return _n(t),t}function fn(e){if(typeof window>"u")return()=>{};const t=o=>{const i=o.detail;(i==="dark"||i==="light")&&e(i)},n=o=>{if(o.key===re){const i=o.newValue;e(i==="dark"||i==="light"?i:ye())}},r=window.matchMedia("(prefers-color-scheme: dark)"),s=o=>{localStorage.getItem(re)||e(o.matches?"dark":"light")};return window.addEventListener(be,t),window.addEventListener("storage",n),r.addEventListener("change",s),()=>{window.removeEventListener(be,t),window.removeEventListener("storage",n),r.removeEventListener("change",s)}}function hn(){const[e,t]=x(()=>ye());L(()=>fn(s=>{t(s)}),[]);const n=B(()=>{const r=dn();return t(r),r},[]);return{theme:e,toggleTheme:n}}const pn={color:"#34d399",fillOpacityTop:.25,fillOpacityBottom:.02,strokeWidth:1.5,width:120,height:32,padding:2};function mn(e){return{...pn,...e}}let gn=0;function vn(){return`ss-grad-${gn++}`}function dt(e){if(e.length===0)return null;let t=e[0],n=e[0],r=e[0];for(let s=1;s<e.length;s++){const o=e[s];o<t&&(t=o),o>n&&(n=o),r+=o}return{min:t,max:n,avg:r/e.length}}function bn(e,t){if(e.length<2)return null;const n=mn(t),r=dt(e),s=r.max-r.min||1,o=n.width-n.padding*2,i=n.height-n.padding*2,l=n.padding,c=e.length,u=Array.from({length:c});for(let b=0;b<c;b++){const y=l+b/(c-1)*o,v=l+i-(e[b]-r.min)/s*i;u[b]=`${y.toFixed(1)},${v.toFixed(1)}`}const d=u.join(" "),a=(l+o).toFixed(1),h=(l+i).toFixed(1),_=l.toFixed(1),m=`M${u[0]} `+u.slice(1).map(b=>`L${b}`).join(" ")+` L${a},${h} L${_},${h} Z`;return{points:d,areaPath:m,gradientId:vn(),options:n,stats:r}}function yn({data:e,color:t="#34d399",width:n=120,height:r=32,className:s=""}){const o=H(()=>bn(e,{width:n,height:r}),[e,n,r]),i=H(()=>"ss-grad-"+Math.random().toString(36).slice(2,8),[]),l={"--ss-accent":t};if(!o)return f("div",{className:`ss-dash-sparkline ${s}`,style:l,children:f("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:f("text",{x:n/2,y:r/2+3,textAnchor:"middle",fill:"#737373",fontSize:"9",children:["collecting","…"]})})});const c=t||"var(--ss-accent)";return f("div",{className:`ss-dash-sparkline ${s}`,style:l,children:f("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:[f("defs",{children:f("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[f("stop",{offset:"0%",stopColor:c,stopOpacity:"0.25"}),f("stop",{offset:"100%",stopColor:c,stopOpacity:"0.02"})]})}),f("path",{d:o.areaPath,fill:`url(#${i})`}),f("path",{className:"ss-dash-sparkline-line",d:"M"+o.points.replace(/ /g," L"),fill:"none",stroke:c,strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round"})]})})}const kn={"ss-red":"#f87171","ss-amber":"#fbbf24","ss-green":"#34d399","ss-muted":"#737373"};function wn(e,t,n){const[r,s]=x({position:"absolute",bottom:"100%",left:0,marginBottom:"10px",zIndex:180});return L(()=>{if(!n)return;const o=()=>{const l=e.current,c=t.current;if(!l||!c)return;const u=l.closest(".ss-bar");if(!u)return;const d=l.getBoundingClientRect(),a=u.getBoundingClientRect(),h=d.left-a.left+d.width/2;s({position:"absolute",bottom:"100%",left:`${h}px`,transform:"translateX(-50%)",marginBottom:"10px",zIndex:180}),requestAnimationFrame(()=>{const _=c.getBoundingClientRect();let m=0;_.left<8?m=8-_.left:_.right>window.innerWidth-8&&(m=window.innerWidth-8-_.right),m&&s(b=>({...b,transform:`translateX(calc(-50% + ${m}px))`}))})};o();const i=e.current?.closest(".ss-bar-scroll");return i?.addEventListener("scroll",o),window.addEventListener("resize",o),()=>{i?.removeEventListener("scroll",o),window.removeEventListener("resize",o)}},[n,e,t]),r}function Tn({metric:e,stats:t,history:n,className:r=""}){const[s,o]=x(!1),[i,l]=x(!1),c=O(null),u=O(null);if(e.show&&!e.show(t))return null;const d=e.value?e.value(t):e.format(t),a=e.color?e.color(t):"",h=a&&kn[a]||"#34d399",_=typeof e.detail=="function"?e.detail(t):e.detail,m=H(()=>dt(n),[n]),b=s||i,y=wn(c,u,b),v=B(E=>{E.stopPropagation(),o(U=>!U)},[]);L(()=>{if(!s)return;const E=w=>{const P=w.target;c.current&&!c.current.contains(P)&&u.current&&!u.current.contains(P)&&o(!1)},U=w=>{w.key==="Escape"&&o(!1)};return document.addEventListener("click",E),document.addEventListener("keydown",U),()=>{document.removeEventListener("click",E),document.removeEventListener("keydown",U)}},[s]);const g=c.current?.closest(".ss-bar"),k=b&&g?$t(f("div",{ref:u,className:`ss-tooltip ${s?"ss-pinned":""}`,style:y,children:[f("div",{className:"ss-tooltip-inner",style:{position:"relative"},children:[s&&f("button",{className:"ss-tooltip-close",onClick:E=>{E.stopPropagation(),o(!1)},type:"button",children:"×"}),f("div",{className:"ss-tooltip-header",children:[f("span",{className:"ss-tooltip-title",children:e.title}),e.unit&&f("span",{className:"ss-tooltip-unit",children:e.unit})]}),f("div",{className:"ss-tooltip-current",children:[f("span",{className:"ss-tooltip-current-label",children:"Current: "}),f("span",{className:"ss-tooltip-current-value",children:d})]}),m&&f("div",{className:"ss-tooltip-stats",children:[f("span",{children:["Min: ",ve(m.min,e.unit)]}),f("span",{children:["Max: ",ve(m.max,e.unit)]}),f("span",{children:["Avg: ",ve(m.avg,e.unit)]})]}),_&&f("div",{className:"ss-tooltip-details",children:_}),n.length>0&&f(N,{children:[f("div",{className:"ss-tooltip-sparkline",children:f(yn,{data:n,color:h})}),f("div",{className:"ss-tooltip-samples",children:["Last ",Math.min(n.length,60)," samples (~",Math.round(Math.min(n.length,60)*3/60)," min)"]})]})]}),f("div",{className:"ss-tooltip-arrow"})]}),g):null;return f(N,{children:[f("div",{ref:c,className:`ss-badge ${s?"ss-pinned":""} ${r}`,onClick:v,onMouseEnter:()=>!s&&l(!0),onMouseLeave:()=>l(!1),role:"button",tabIndex:0,onKeyDown:E=>E.key==="Enter"&&v(E),children:[f("span",{className:"ss-label",children:e.label}),f("span",{className:`ss-value ${a}`,children:d})]}),k]})}function Sn(e){const{featureOptions:t,autoHideOnUnauthorized:n=!0,onOpenDebugPanel:r,debugPanelOpen:s=!1,onConnectionChange:o,...i}=e,{stats:l,getHistory:c,isConnected:u,isStale:d,unauthorized:a}=cn(i);L(()=>{o?.(u)},[u,o]);const{features:h}=nn(t),{theme:_}=hn(),[m,b]=x(()=>typeof window>"u"?!0:localStorage.getItem("admin:stats-bar")!=="hidden"),y=O(null),v=O(null);L(()=>{n&&a&&b(!1)},[n,a]);const g=B(()=>{b(w=>{const P=!w;return localStorage.setItem("admin:stats-bar",P?"visible":"hidden"),P})},[]);L(()=>{const w=v.current;if(!w)return;const P=$=>{Math.abs($.deltaX)>Math.abs($.deltaY)||($.preventDefault(),w.scrollLeft+=$.deltaY)};return w.addEventListener("wheel",P,{passive:!1}),()=>w.removeEventListener("wheel",P)},[]);const k=H(()=>l?Gt(l):jt(h),[l,h]),E=H(()=>_t.filter(w=>k.has(w.group||"core")),[k]),U=H(()=>{const w=[];let P="";for(const $ of E){const M=$.group||"core";M!==P&&(P=M,w.push({group:P,metrics:[]})),w[w.length-1].metrics.push($)}return w},[E]);return n&&a?null:f(N,{children:[f("button",{type:"button",className:`ss-toggle ${m?"ss-visible":"ss-collapsed"}`,onClick:g,title:m?"Hide stats bar":"Show stats bar","data-ss-theme":_,children:[!m&&l&&f("span",{className:"ss-toggle-summary",style:{display:"flex"},children:[k.has("process")&&f(N,{children:[f("span",{className:`ss-value ${l.cpuPercent>80?"ss-red":l.cpuPercent>50?"ss-amber":"ss-green"}`,children:[l.cpuPercent.toFixed(0),"%"]}),f("span",{className:"ss-value ss-green",children:l.memHeapUsed!==void 0?Math.round(l.memHeapUsed/(1024*1024))+"M":"-"})]}),k.has("redis")&&l.redisOk!==void 0&&f("span",{className:`ss-value ${l.redisOk?"ss-green":"ss-red"}`,children:l.redisOk?"✓":"✗"})]}),m&&f("span",{className:"ss-toggle-label",style:{color:"#737373"},children:"hide stats"}),f("span",{className:"ss-toggle-arrow",children:m?"▼":"▲"})]}),f("div",{ref:y,className:m?"ss-bar":"ss-bar ss-hidden","data-ss-theme":_,children:[f("div",{className:"ss-bar-left",children:[r&&f("button",{type:"button",className:`ss-dbg-btn ${s?"ss-dbg-active":""}`,onClick:r,title:"Toggle debug panel",id:"ss-dbg-wrench",children:f("svg",{width:"14",height:"14",viewBox:at.wrench.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:at.wrench.elements.join("")}})}),f("div",{className:d?"ss-dot ss-stale":"ss-dot"})]}),f("div",{ref:v,className:"ss-bar-scroll",id:"ss-bar-scroll",children:l&&U.map((w,P)=>f(Ft.Fragment,{children:[P>0&&f("div",{className:"ss-group-sep"}),f("div",{className:"ss-group",children:w.metrics.map($=>f(Tn,{metric:$,stats:l,history:c($.historyKey||"")},$.id))})]},w.group))})]})]})}function Cn(e){const t=document.getElementById(e);return t?JSON.parse(t.textContent||"{}"):{}}const C=Cn("ss-bar-config");function En(){if(window.__ssDebugPanel)return!0;const e=document.querySelector('script[type="text/plain"][data-ss-deferred="debug-panel"]');if(!e)return console.error("[server-stats] Deferred debug panel script not found"),!1;try{const t=document.createElement("script");t.textContent=e.textContent,document.head.appendChild(t)}catch(t){return console.error("[server-stats] Debug panel script evaluation failed:",t),!1}return window.__ssDebugPanel?!0:(console.error("[server-stats] Debug panel failed to register after script evaluation"),!1)}function Pn(){let e=document.getElementById("ss-dbg-deferred");if(!e){e=document.createElement("div"),e.id="ss-dbg-deferred";const t=document.getElementById("ss-bar");t?.parentNode?t.parentNode.insertBefore(e,t.nextSibling):document.body.appendChild(e)}return e}function $n(e,t,n){if(n.current||(n.current=En()),!window.__ssDebugPanel)return;const r=Pn();try{window.__ssDebugPanel.mount(r,e,t.current)}catch(s){console.error("[server-stats] Debug panel mount failed:",s)}}function xn(){const e=document.getElementById("ss-dbg-deferred");if(window.__ssDebugPanel&&e)try{window.__ssDebugPanel.unmount(e)}catch(t){console.error("[server-stats] Debug panel unmount failed:",t)}}function Mn(e,t,n){const r=O(!1);L(()=>{C.showDebug&&(e&&t?$n(t,n,r):xn())},[e,t,n])}function Un(){const[e,t]=x(!1),n=O(!1),r=B(l=>{n.current=l},[]),s=H(()=>C.showDebug?{debugEndpoint:C.debugEndpoint,authToken:C.authToken,dashboardPath:C.dashboardPath}:void 0,[C.showDebug,C.debugEndpoint,C.authToken,C.dashboardPath]),o=H(()=>C.showDebug?{debugEndpoint:C.debugEndpoint,authToken:C.authToken}:void 0,[C.showDebug,C.debugEndpoint,C.authToken]),i=B(()=>{t(l=>!l)},[]);return Mn(e,s,n),f(Sn,{endpoint:C.endpoint,pollInterval:C.pollInterval,channelName:C.channelName,authToken:C.authToken,featureOptions:o,autoHideOnUnauthorized:!1,onOpenDebugPanel:C.showDebug?i:void 0,debugPanelOpen:e,onConnectionChange:r})}const ft=document.getElementById("ss-bar");ft&&_e(f(Un,{}),ft)})();