@sleep2agi/agent-network-dashboard 0.4.6-preview.138 → 0.4.6-preview.139

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 (155) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/diagnostics/route-bundle-stats.json +4 -4
  4. package/.next/fallback-build-manifest.json +3 -3
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/server/app/_global-error.html +1 -1
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/_not-found.html +2 -2
  15. package/.next/server/app/_not-found.rsc +2 -2
  16. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  17. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  19. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  22. package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  23. package/.next/server/app/admin.html +2 -2
  24. package/.next/server/app/admin.rsc +2 -2
  25. package/.next/server/app/admin.segments/_full.segment.rsc +2 -2
  26. package/.next/server/app/admin.segments/_head.segment.rsc +1 -1
  27. package/.next/server/app/admin.segments/_index.segment.rsc +2 -2
  28. package/.next/server/app/admin.segments/_tree.segment.rsc +2 -2
  29. package/.next/server/app/admin.segments/admin/__PAGE__.segment.rsc +1 -1
  30. package/.next/server/app/admin.segments/admin.segment.rsc +1 -1
  31. package/.next/server/app/index.html +2 -2
  32. package/.next/server/app/index.rsc +3 -3
  33. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  34. package/.next/server/app/index.segments/_full.segment.rsc +3 -3
  35. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  36. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  37. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  38. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  39. package/.next/server/app/login.html +2 -2
  40. package/.next/server/app/login.rsc +3 -3
  41. package/.next/server/app/login.segments/_full.segment.rsc +3 -3
  42. package/.next/server/app/login.segments/_head.segment.rsc +1 -1
  43. package/.next/server/app/login.segments/_index.segment.rsc +2 -2
  44. package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  45. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  46. package/.next/server/app/login.segments/login.segment.rsc +1 -1
  47. package/.next/server/app/logs/page_client-reference-manifest.js +1 -1
  48. package/.next/server/app/logs.html +2 -2
  49. package/.next/server/app/logs.rsc +2 -2
  50. package/.next/server/app/logs.segments/_full.segment.rsc +2 -2
  51. package/.next/server/app/logs.segments/_head.segment.rsc +1 -1
  52. package/.next/server/app/logs.segments/_index.segment.rsc +2 -2
  53. package/.next/server/app/logs.segments/_tree.segment.rsc +2 -2
  54. package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +1 -1
  55. package/.next/server/app/logs.segments/logs.segment.rsc +1 -1
  56. package/.next/server/app/messages/page_client-reference-manifest.js +1 -1
  57. package/.next/server/app/messages.html +2 -2
  58. package/.next/server/app/messages.rsc +2 -2
  59. package/.next/server/app/messages.segments/_full.segment.rsc +2 -2
  60. package/.next/server/app/messages.segments/_head.segment.rsc +1 -1
  61. package/.next/server/app/messages.segments/_index.segment.rsc +2 -2
  62. package/.next/server/app/messages.segments/_tree.segment.rsc +2 -2
  63. package/.next/server/app/messages.segments/messages/__PAGE__.segment.rsc +1 -1
  64. package/.next/server/app/messages.segments/messages.segment.rsc +1 -1
  65. package/.next/server/app/node/page_client-reference-manifest.js +1 -1
  66. package/.next/server/app/node.html +2 -2
  67. package/.next/server/app/node.rsc +2 -2
  68. package/.next/server/app/node.segments/_full.segment.rsc +2 -2
  69. package/.next/server/app/node.segments/_head.segment.rsc +1 -1
  70. package/.next/server/app/node.segments/_index.segment.rsc +2 -2
  71. package/.next/server/app/node.segments/_tree.segment.rsc +2 -2
  72. package/.next/server/app/node.segments/node/__PAGE__.segment.rsc +1 -1
  73. package/.next/server/app/node.segments/node.segment.rsc +1 -1
  74. package/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
  75. package/.next/server/app/nodes.html +2 -2
  76. package/.next/server/app/nodes.rsc +2 -2
  77. package/.next/server/app/nodes.segments/_full.segment.rsc +2 -2
  78. package/.next/server/app/nodes.segments/_head.segment.rsc +1 -1
  79. package/.next/server/app/nodes.segments/_index.segment.rsc +2 -2
  80. package/.next/server/app/nodes.segments/_tree.segment.rsc +2 -2
  81. package/.next/server/app/nodes.segments/nodes/__PAGE__.segment.rsc +1 -1
  82. package/.next/server/app/nodes.segments/nodes.segment.rsc +1 -1
  83. package/.next/server/app/page_client-reference-manifest.js +1 -1
  84. package/.next/server/app/server-logs/page_client-reference-manifest.js +1 -1
  85. package/.next/server/app/server-logs.html +2 -2
  86. package/.next/server/app/server-logs.rsc +2 -2
  87. package/.next/server/app/server-logs.segments/_full.segment.rsc +2 -2
  88. package/.next/server/app/server-logs.segments/_head.segment.rsc +1 -1
  89. package/.next/server/app/server-logs.segments/_index.segment.rsc +2 -2
  90. package/.next/server/app/server-logs.segments/_tree.segment.rsc +2 -2
  91. package/.next/server/app/server-logs.segments/server-logs/__PAGE__.segment.rsc +1 -1
  92. package/.next/server/app/server-logs.segments/server-logs.segment.rsc +1 -1
  93. package/.next/server/app/settings/networks/page_client-reference-manifest.js +1 -1
  94. package/.next/server/app/settings/networks.html +2 -2
  95. package/.next/server/app/settings/networks.rsc +2 -2
  96. package/.next/server/app/settings/networks.segments/_full.segment.rsc +2 -2
  97. package/.next/server/app/settings/networks.segments/_head.segment.rsc +1 -1
  98. package/.next/server/app/settings/networks.segments/_index.segment.rsc +2 -2
  99. package/.next/server/app/settings/networks.segments/_tree.segment.rsc +2 -2
  100. package/.next/server/app/settings/networks.segments/settings/networks/__PAGE__.segment.rsc +1 -1
  101. package/.next/server/app/settings/networks.segments/settings/networks.segment.rsc +1 -1
  102. package/.next/server/app/settings/networks.segments/settings.segment.rsc +1 -1
  103. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  104. package/.next/server/app/settings/tokens/page_client-reference-manifest.js +1 -1
  105. package/.next/server/app/settings/tokens.html +2 -2
  106. package/.next/server/app/settings/tokens.rsc +2 -2
  107. package/.next/server/app/settings/tokens.segments/_full.segment.rsc +2 -2
  108. package/.next/server/app/settings/tokens.segments/_head.segment.rsc +1 -1
  109. package/.next/server/app/settings/tokens.segments/_index.segment.rsc +2 -2
  110. package/.next/server/app/settings/tokens.segments/_tree.segment.rsc +2 -2
  111. package/.next/server/app/settings/tokens.segments/settings/tokens/__PAGE__.segment.rsc +1 -1
  112. package/.next/server/app/settings/tokens.segments/settings/tokens.segment.rsc +1 -1
  113. package/.next/server/app/settings/tokens.segments/settings.segment.rsc +1 -1
  114. package/.next/server/app/settings.html +2 -2
  115. package/.next/server/app/settings.rsc +3 -3
  116. package/.next/server/app/settings.segments/_full.segment.rsc +3 -3
  117. package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  118. package/.next/server/app/settings.segments/_index.segment.rsc +2 -2
  119. package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  120. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +2 -2
  121. package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
  122. package/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
  123. package/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  124. package/.next/server/app/tasks.html +2 -2
  125. package/.next/server/app/tasks.rsc +2 -2
  126. package/.next/server/app/tasks.segments/_full.segment.rsc +2 -2
  127. package/.next/server/app/tasks.segments/_head.segment.rsc +1 -1
  128. package/.next/server/app/tasks.segments/_index.segment.rsc +2 -2
  129. package/.next/server/app/tasks.segments/_tree.segment.rsc +2 -2
  130. package/.next/server/app/tasks.segments/tasks/__PAGE__.segment.rsc +1 -1
  131. package/.next/server/app/tasks.segments/tasks.segment.rsc +1 -1
  132. package/.next/server/chunks/ssr/agent-network-dashboard_09kk21a._.js +1 -1
  133. package/.next/server/chunks/ssr/agent-network-dashboard_09kk21a._.js.map +1 -1
  134. package/.next/server/chunks/ssr/agent-network-dashboard_app_01jhlxz._.js +1 -1
  135. package/.next/server/chunks/ssr/agent-network-dashboard_app_01jhlxz._.js.map +1 -1
  136. package/.next/server/chunks/ssr/agent-network-dashboard_app_09d29my._.js +1 -1
  137. package/.next/server/chunks/ssr/agent-network-dashboard_app_09d29my._.js.map +1 -1
  138. package/.next/server/middleware-build-manifest.js +3 -3
  139. package/.next/server/pages/404.html +2 -2
  140. package/.next/server/pages/500.html +1 -1
  141. package/.next/server/server-reference-manifest.js +1 -1
  142. package/.next/server/server-reference-manifest.json +1 -1
  143. package/.next/static/chunks/{0lquwnvbayt_v.css → 05b69-7w4fvbn.css} +1 -1
  144. package/.next/static/chunks/{005ceit6j4evs.js → 081vobmypeqpc.js} +1 -1
  145. package/.next/static/chunks/{0qswjae_xt_w7.js → 0oe7tip~fqkt_.js} +1 -1
  146. package/.next/static/chunks/{0.ejb5a6-vo0j.js → 0xlots8qq.1ym.js} +1 -1
  147. package/.next/trace +2 -2
  148. package/.next/trace-build +1 -1
  149. package/app/components/TopoGraph.tsx +24 -1
  150. package/app/globals.css +10 -2
  151. package/package.json +1 -1
  152. package/scripts/topo-groupbox-march-busyness-test.mjs +155 -0
  153. /package/.next/static/{taXhHpHryUIHwTLEw9ToR → 5JDBhpBY9uNwiKtTBhuHL}/_buildManifest.js +0 -0
  154. /package/.next/static/{taXhHpHryUIHwTLEw9ToR → 5JDBhpBY9uNwiKtTBhuHL}/_clientMiddlewareManifest.js +0 -0
  155. /package/.next/static/{taXhHpHryUIHwTLEw9ToR → 5JDBhpBY9uNwiKtTBhuHL}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
1
  (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,136,(e,t,a)=>{},7454,(e,t,a)=>{var n=e.i(20888);e.r(136);var r=e.r(23910),s=r&&"object"==typeof r&&"default"in r?r:{default:r},l=void 0!==n.default&&n.default.env&&!0,i=function(e){return"[object String]"===Object.prototype.toString.call(e)},o=function(){function e(e){var t=void 0===e?{}:e,a=t.name,n=void 0===a?"stylesheet":a,r=t.optimizeForSpeed,s=void 0===r?l:r;d(i(n),"`name` must be a string"),this._name=n,this._deletedRulePlaceholder="#"+n+"-deleted-rule____{}",d("boolean"==typeof s,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=s,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var o="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=o?o.getAttribute("content"):null}var t,a=e.prototype;return a.setOptimizeForSpeed=function(e){d("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),d(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},a.isOptimizeForSpeed=function(){return this._optimizeForSpeed},a.inject=function(){var e=this;if(d(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(l||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,a){return"number"==typeof a?e._serverSheet.cssRules[a]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),a},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},a.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},a.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},a.insertRule=function(e,t){if(d(i(e),"`insertRule` accepts only strings"),"u"<typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var a=this.getSheet();"number"!=typeof t&&(t=a.cssRules.length);try{a.insertRule(e,t)}catch(t){return l||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var n=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,n))}return this._rulesCount++},a.replaceRule=function(e,t){if(this._optimizeForSpeed||"u"<typeof window){var a="u">typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!a.cssRules[e])return e;a.deleteRule(e);try{a.insertRule(t,e)}catch(n){l||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),a.insertRule(this._deletedRulePlaceholder,e)}}else{var n=this._tags[e];d(n,"old rule at index `"+e+"` not found"),n.textContent=t}return e},a.deleteRule=function(e){if("u"<typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];d(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},a.flush=function(){this._injected=!1,this._rulesCount=0,"u">typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},a.cssRules=function(){var e=this;return"u"<typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,a){return a?t=t.concat(Array.prototype.map.call(e.getSheetForTag(a).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},a.makeStyleTag=function(e,t,a){t&&d(i(t),"makeStyleTag accepts only strings as second parameter");var n=document.createElement("style");this._nonce&&n.setAttribute("nonce",this._nonce),n.type="text/css",n.setAttribute("data-"+e,""),t&&n.appendChild(document.createTextNode(t));var r=document.head||document.getElementsByTagName("head")[0];return a?r.insertBefore(n,a):r.appendChild(n),n},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}();function d(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var c=function(e){for(var t=5381,a=e.length;a;)t=33*t^e.charCodeAt(--a);return t>>>0},u={};function h(e,t){if(!t)return"jsx-"+e;var a=String(t),n=e+a;return u[n]||(u[n]="jsx-"+c(e+"-"+a)),u[n]}function x(e,t){"u"<typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var a=e+t;return u[a]||(u[a]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[a]}var f=function(){function e(e){var t=void 0===e?{}:e,a=t.styleSheet,n=void 0===a?null:a,r=t.optimizeForSpeed,s=void 0!==r&&r;this._sheet=n||new o({name:"styled-jsx",optimizeForSpeed:s}),this._sheet.inject(),n&&"boolean"==typeof s&&(this._sheet.setOptimizeForSpeed(s),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"u">typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var a=this.getIdAndRules(e),n=a.styleId,r=a.rules;if(n in this._instancesCounts){this._instancesCounts[n]+=1;return}var s=r.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[n]=s,this._instancesCounts[n]=1},t.remove=function(e){var t=this,a=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(a in this._instancesCounts,"styleId: `"+a+"` not found"),this._instancesCounts[a]-=1,this._instancesCounts[a]<1){var n=this._fromServer&&this._fromServer[a];n?(n.parentNode.removeChild(n),delete this._fromServer[a]):(this._indices[a].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[a]),delete this._instancesCounts[a]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],a=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return a[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,a;return t=this.cssRules(),void 0===(a=e)&&(a={}),t.map(function(e){var t=e[0],n=e[1];return s.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:a.nonce?a.nonce:void 0,dangerouslySetInnerHTML:{__html:n}})})},t.getIdAndRules=function(e){var t=e.children,a=e.dynamic,n=e.id;if(a){var r=h(n,a);return{styleId:r,rules:Array.isArray(t)?t.map(function(e){return x(r,e)}):[x(r,t)]}}return{styleId:h(n),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=r.createContext(null);function m(){return new f}function g(){return r.useContext(p)}p.displayName="StyleSheetContext";var y=s.default.useInsertionEffect||s.default.useLayoutEffect,b="u">typeof window?m():void 0;function v(e){var t=b||g();return t&&("u"<typeof window?t.add(e):y(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}v.dynamic=function(e){return e.map(function(e){return h(e[0],e[1])}).join(" ")},a.StyleRegistry=function(e){var t=e.registry,a=e.children,n=r.useContext(p),l=r.useState(function(){return n||t||m()})[0];return s.default.createElement(p.Provider,{value:l},a)},a.createStyleRegistry=m,a.style=v,a.useStyleRegistry=g},6694,(e,t,a)=>{t.exports=e.r(7454).style},18722,e=>{"use strict";var t=e.i(20888),a=e.i(22381),n=e.i(23910),r=e.i(56839),s=e.i(3479);function l({online:e,working:t,total:n,version:r,uptime:s}){let o=n>0?Math.round(e/n*100):0,d=0===n;return(0,a.jsxs)("div",{className:d?"mb-4":"mb-8",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"Agent Network"}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["CommHub ",r," · ",s]})]}),d?(0,a.jsxs)("div",{className:"anet-stat-strip flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs text-gray-500 border-t border-b border-[#2a2a4a] py-2",children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full bg-gray-600"}),(0,a.jsx)("span",{className:"text-gray-300 tabular-nums",children:"0"})," online"]}),(0,a.jsx)("span",{className:"text-gray-700",children:"·"}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full bg-gray-600"}),(0,a.jsx)("span",{className:"text-gray-300 tabular-nums",children:"0"})," working"]}),(0,a.jsx)("span",{className:"text-gray-700",children:"·"}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full bg-gray-600"}),(0,a.jsx)("span",{className:"text-gray-300 tabular-nums",children:"0"})," registered"]})]}):(0,a.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,a.jsx)(i,{value:e,label:"Online",sub:`${o}% of fleet`,color:"text-green-400",accent:"from-green-500/20 to-green-500/0",border:"border-green-500/15"}),(0,a.jsx)(i,{value:t,label:"Working",sub:e>0?`${Math.round(t/e*100)}% utilization`:"--",color:"text-cyan-400",accent:"from-cyan-500/20 to-cyan-500/0",border:"border-cyan-500/15"}),(0,a.jsx)(i,{value:n-e,label:"Offline",sub:n-e==0?"All systems go":`${n-e} disconnected`,color:"text-gray-400",accent:"from-gray-500/10 to-gray-500/0",border:"border-gray-500/15"}),(0,a.jsx)(i,{value:n,label:"Total",sub:"Registered nodes",color:"text-white",accent:"from-blue-500/15 to-blue-500/0",border:"border-blue-500/15"})]})]})}function i({value:e,label:t,sub:n,color:r,accent:s,border:l}){let o=r.replace("text-","").split("-")[0];return(0,a.jsxs)("div",{"data-anet-stat-card":o,className:`anet-stat-card relative overflow-hidden rounded-xl border ${l} bg-[#111128] px-4 py-3 transition-all`,children:[(0,a.jsx)("div",{className:`absolute inset-0 bg-gradient-to-br ${s} pointer-events-none`}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{className:`text-3xl font-bold ${r} tabular-nums leading-tight`,children:e}),(0,a.jsx)("div",{className:"text-sm text-gray-300 mt-0.5",children:t}),(0,a.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:n})]})]})}function o(){let[e,t]=(0,n.useState)(""),[r,s]=(0,n.useState)(!1),[l,i]=(0,n.useState)(""),o=async()=>{if(e.trim()){s(!0),i("");try{let a=await fetch("/api/hub/broadcast",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e})}),n=await a.json();n.ok?(i(`Broadcast sent to ${n.recipients} node(s)`),t("")):i(`Failed: ${n.error||"Send error"}`)}catch(e){i(`Failed: ${e instanceof Error?e.message:"Send error"}`)}s(!1),setTimeout(()=>i(""),5e3)}};return(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:e,onChange:e=>t(e.target.value),onKeyDown:e=>"Enter"===e.key&&o(),placeholder:"Broadcast message to all online agents...",maxLength:500,"aria-label":"Broadcast message",className:"flex-1 bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-2.5 text-sm text-white placeholder-gray-600 focus:border-blue-500/50 focus:ring-1 focus:ring-blue-500/20 focus:outline-none transition-colors"}),(0,a.jsx)("button",{onClick:o,disabled:r||!e.trim(),"aria-label":"Send broadcast",className:"flex items-center gap-2 px-5 py-2.5 bg-blue-600 hover:bg-blue-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-all font-medium cursor-pointer disabled:cursor-not-allowed",children:r?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("svg",{"aria-hidden":!0,className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),(0,a.jsx)("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}),(0,a.jsx)("span",{children:"Sending…"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("svg",{"aria-hidden":!0,className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M3 11v3a1 1 0 0 0 1 1h2l3.29 3.29a1 1 0 0 0 1.71-.71V7.42a1 1 0 0 0-1.71-.71L6 10H4a1 1 0 0 0-1 1Z"}),(0,a.jsx)("path",{d:"M16 8a5 5 0 0 1 0 6",opacity:"0.7"}),(0,a.jsx)("path",{d:"M19 5a9 9 0 0 1 0 12",opacity:"0.45"})]}),(0,a.jsx)("span",{children:"Broadcast"})]})})]}),e.length>0&&(0,a.jsxs)("div",{className:"text-right text-xs text-gray-600 mt-1 tabular-nums",children:[e.length,"/500"]}),l&&(0,a.jsx)("div",{className:`mt-3 text-sm text-center anet-fade-in ${l.startsWith("Failed")?"text-red-400":"text-green-400/80"}`,children:l})]})}var d=e.i(46228),c=e.i(43058),u=e.i(59276),h=e.i(59746);function x({alias:e,onClose:t}){let[r,s]=(0,n.useState)({x:0,y:0}),[l,i]=(0,n.useState)({w:380,h:520}),o=(0,n.useRef)({active:!1,startX:0,startY:0,baseX:0,baseY:0}),f=(0,n.useRef)({active:!1,startX:0,startY:0,baseW:0,baseH:0}),{sessions:p}=(0,u.useSessions)(),m=(0,n.useMemo)(()=>p.find(t=>t.alias===e),[p,e]),g=m&&"offline"!==m.status?null:(0,h.relativeAgo)(m?.last_seen_at),y=(0,n.useCallback)((e,t,a,n)=>({x:Math.min(Math.max(16,e),Math.max(16,window.innerWidth-a-16)),y:Math.min(Math.max(16,t),Math.max(16,window.innerHeight-n-16))}),[]);(0,n.useEffect)(()=>{let e=()=>{let e=window.innerWidth,t=window.innerHeight,a=Math.min(380,e-32),n=Math.min(520,t-96);i({w:a,h:n});let r=e<640;s(y(r?16:e-a-24,r?t-n-16:96,a,n))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[y]),(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&t()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]);let b=e=>{if(o.current.active){o.current.active=!1;try{e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}}},v=e=>{if(f.current.active){f.current.active=!1,e.stopPropagation();try{e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}}};return(0,a.jsxs)("div",{className:"fixed z-50 flex flex-col overflow-hidden rounded-xl border border-[var(--border)] bg-[var(--bg)] shadow-2xl shadow-black/60 anet-fade-in",style:{left:r.x,top:r.y,width:l.w,height:l.h},role:"dialog","aria-label":`Chat with ${e}`,children:[(0,a.jsxs)("div",{onPointerDown:e=>{0===e.button&&(e.currentTarget.setPointerCapture?.(e.pointerId),o.current={active:!0,startX:e.clientX,startY:e.clientY,baseX:r.x,baseY:r.y})},onPointerMove:e=>{let t=o.current;t.active&&s(y(t.baseX+(e.clientX-t.startX),t.baseY+(e.clientY-t.startY),l.w,l.h))},onPointerUp:b,onPointerCancel:b,className:"flex items-center justify-between px-3 py-2.5 border-b border-[var(--border)] bg-[var(--bg-secondary)] rounded-t-xl cursor-grab active:cursor-grabbing select-none touch-none",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,a.jsx)(d.AliasAvatar,{alias:e,size:28}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-semibold text-[var(--fg)] truncate",children:e}),m?.project_dir?(0,a.jsxs)("div",{className:"text-[10px] text-[var(--fg-muted)] truncate font-mono",title:m.project_dir,"data-popover-cwd":!0,children:["cwd: ",m.project_dir]}):null,g?(0,a.jsxs)("div",{className:"text-[10px] text-[var(--fg-muted)] truncate","data-popover-lastseen":!0,children:["last seen: ",g]}):null,m?.project_dir||g?null:(0,a.jsx)("div",{className:"text-[10px] text-[var(--fg-muted)]",children:"Drag to move · Esc to close"})]})]}),(0,a.jsx)("button",{onClick:t,onPointerDown:e=>e.stopPropagation(),"aria-label":"Close chat",className:"text-[var(--fg-muted)] hover:text-[var(--fg)] p-1.5 rounded-lg hover:bg-[var(--bg-elevated)] shrink-0",children:(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,a.jsx)("div",{className:"flex-1 min-h-0",children:(0,a.jsx)(c.TaskChatPanel,{alias:e,onClose:t,inline:!0})}),(0,a.jsx)("div",{onPointerDown:e=>{0===e.button&&(e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),f.current={active:!0,startX:e.clientX,startY:e.clientY,baseW:l.w,baseH:l.h})},onPointerMove:e=>{let t=f.current;if(!t.active)return;e.stopPropagation();let a=Math.max(300,window.innerWidth-r.x-16),n=Math.max(320,window.innerHeight-r.y-16);i({w:Math.min(a,Math.max(300,t.baseW+(e.clientX-t.startX))),h:Math.min(n,Math.max(320,t.baseH+(e.clientY-t.startY)))})},onPointerUp:v,onPointerCancel:v,"aria-label":"Resize chat",className:"absolute bottom-0 right-0 w-5 h-5 cursor-nwse-resize touch-none z-10",style:{touchAction:"none"},children:(0,a.jsx)("svg",{className:"absolute bottom-0.5 right-0.5 w-3 h-3 text-[var(--fg-dim)]",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":!0,children:(0,a.jsx)("path",{d:"M11 5L5 11M11 9L9 11"})})})]})}let f={id:"unknown",label:"Unknown vendor",mono:{bg:"hsl(220 10% 26%)",ring:"hsl(220 10% 46%)",text:"hsl(220 14% 82%)"},initial:"?",logo:null},p=[{test:e=>e.startsWith("intern"),vendor:{id:"intern",label:"书生 · 上海 AI 实验室",mono:{bg:"hsl(28 38% 24%)",ring:"hsl(32 45% 52%)",text:"hsl(34 60% 82%)"},initial:"书",logo:"/intern_avatar.png"}},{test:e=>e.startsWith("minimax"),vendor:{id:"minimax",label:"MiniMax",mono:{bg:"hsl(18 50% 26%)",ring:"hsl(18 65% 52%)",text:"hsl(20 80% 82%)"},initial:"M",logo:null}},{test:e=>e.startsWith("claude"),vendor:{id:"anthropic",label:"Anthropic",mono:{bg:"hsl(16 32% 26%)",ring:"hsl(16 48% 54%)",text:"hsl(18 60% 84%)"},initial:"A",logo:null}},{test:e=>e.startsWith("gpt")||e.startsWith("codex")||e.startsWith("o1")||e.startsWith("o3")||e.startsWith("o4"),vendor:{id:"openai",label:"OpenAI",mono:{bg:"hsl(165 26% 22%)",ring:"hsl(165 40% 44%)",text:"hsl(165 45% 80%)"},initial:"O",logo:null}}];function m(e){if(!e)return f;let t=e.toLowerCase();for(let e of p)if(e.test(t))return e.vendor;return f}let g={"claude-code-cli":{label:"Claude Code CLI",iconPath:"M4 5h16v14H4z M7 9l3 3-3 3 M13 15h4",color:"#a78bfa"},"codex-sdk":{label:"Codex SDK",iconPath:"M9 7l-5 5 5 5 M15 7l5 5-5 5",color:"#38bdf8"},"claude-agent-sdk":{label:"Claude Agent SDK",iconPath:"M4 7h16v10H4z M8 11h8 M8 14h5",color:"#34d399"},"http-api":{label:"HTTP API",iconPath:"M7 18a4 4 0 010-8 5 5 0 019.6-1.3A3.5 3.5 0 0118 18z",color:"#fbbf24"}};function y(e){return e?g[e]??null:null}function b(e,t,a,n=0){let r=t<=2?Math.PI:1.78*Math.PI,s=-Math.PI/2-r/2,l=t<=1?-Math.PI/2:s+r*e/(t-1)+n;return{x:500+a*Math.cos(l),y:330+a*Math.sin(l)}}function v(e,t,a=0){let n=(e.x+t.x)/2,r=(e.y+t.y)/2,s=t.x-e.x,l=t.y-e.y,i=Math.hypot(s,l)||1,o={x:n+-l/i*a,y:r+s/i*a};return`M${e.x},${e.y} Q${o.x},${o.y} ${t.x},${t.y}`}function j(e,t){return e.length>t?`${e.slice(0,t-1)}...`:e}function k({sessions:e}){let t=(0,n.useRef)(Date.now()),[r,s]=(0,n.useState)(()=>Date.now());(0,n.useEffect)(()=>{t.current=Date.now()},[e]),(0,n.useEffect)(()=>{let e=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(e)},[]);let l=Math.max(0,Math.floor((r-t.current)/1e3)),i=l>10;return(0,a.jsxs)("span",{className:i?"hidden sm:inline px-2.5 py-1 rounded-md bg-amber-500/10 text-amber-300 border border-amber-500/20 font-mono":"hidden sm:inline px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20 font-mono",title:i?`Last sync ${l}s ago — SWR refresh may be lagging`:`Live data \xb7 refreshes every 5s \xb7 last sync ${l}s ago`,"data-freshness-chip":!0,children:["live · ",l,"s"]})}function w(e,t,a){return t?"working"===e.status?{label:"working",primary:a?"#059669":"#22c55e",halo:a?"#d1fae5":"#14532d",text:a?"#065f46":"#dcfce7"}:"idle"===e.status?{label:"idle",primary:a?"#0d9488":"#2dd4bf",halo:a?"#ccfbf1":"#134e4a",text:a?"#115e59":"#ccfbf1"}:{label:e.status||"online",primary:a?"#0284c7":"#38bdf8",halo:a?"#e0f2fe":"#0c4a6e",text:a?"#0c4a6e":"#e0f2fe"}:{label:"offline",primary:a?"#94a3b8":"#6b7280",halo:a?"#e2e8f0":"#111827",text:a?"#475569":"#9ca3af"}}let N={panelStops:["#0b1220","#080814","#101018"],radarStops:[{color:"#22d3ee",opacity:.18},{color:"#22c55e",opacity:.045},{color:"#020617",opacity:0}],arrowFill:"#67e8f9",ringStroke:"#164e63",spokeStroke:{active:"#22d3ee",idle:"#155e75"},flowEdge:"#67e8f9",flowPath:"#e0f2fe",flowParticle:"#fef08a",nodeFill:{online:"#020617",offline:"#080814"},labelBox:{fill:"#020617",stroke:"#1f2937"},legendBox:{fill:"#020617",stroke:"#1f2937"},legendText:"#94a3b8",legendHeadline:"#e5e7eb",legendAccent:"#67e8f9",containerBg:"#080814",containerBorder:"#2a2a4a",topRailGradient:"from-transparent via-cyan-400/70 to-transparent"},S={panelStops:["#f8fafc","#ffffff","#f1f5f9"],radarStops:[{color:"#10b981",opacity:.06},{color:"#3b82f6",opacity:.03},{color:"#ffffff",opacity:0}],arrowFill:"#10b981",ringStroke:"#cbd5e1",spokeStroke:{active:"#10b981",idle:"#cbd5e1"},flowEdge:"#10b981",flowPath:"#475569",flowParticle:"#f59e0b",nodeFill:{online:"#ffffff",offline:"#f8fafc"},labelBox:{fill:"#ffffff",stroke:"#e2e8f0"},legendBox:{fill:"#ffffff",stroke:"#e2e8f0"},legendText:"#475569",legendHeadline:"#0f172a",legendAccent:"#0d9488",containerBg:"#ffffff",containerBorder:"#e3e6eb",topRailGradient:"from-transparent via-emerald-500/40 to-transparent"};function M(e,t){let a=0;for(;a<e.length&&a<t.length&&e[a]===t[a];)a++;return e.slice(0,a)}function C(e){let t=e.length,a=e.map((e,t)=>t),n=e=>{for(;a[e]!==e;)a[e]=a[a[e]],e=a[e];return e},r=(e,t)=>{let r=n(e),s=n(t);r!==s&&(a[r]=s)},s={};for(let t of(e.forEach((e,t)=>{let a=e.project_dir?.trim();a&&(s[a]||=[]).push(t)}),Object.values(s)))for(let e=1;e<t.length;e++)r(t[0],t[e]);let l=e.map((e,t)=>t).sort((t,a)=>e[t].alias.localeCompare(e[a].alias));for(let t=0;t+1<l.length;t++)M(e[l[t]].alias,e[l[t+1]].alias).length>=2&&r(l[t],l[t+1]);let i={};for(let e=0;e<t;e++)(i[n(e)]||=[]).push(e);let o={};for(let t of Object.values(i)){let a;if(1===t.length)a=e[t[0]].alias;else{let n=new Set(t.map(t=>e[t].project_dir?.trim()).filter(Boolean));if(1===n.size){let e=[...n][0];a=e.split("/").filter(Boolean).pop()||e}else(a=t.map(t=>e[t].alias).reduce((e,t)=>M(e,t))).length<2&&(a=e[t[0]].alias)}for(let n of t)o[e[n].alias]=a}return o}function _(e,t){let a=new Map;return e.forEach(e=>{if(!t[e.from_alias]||!t[e.to_alias]||e.from_alias===e.to_alias)return;let n=`${e.from_alias}->${e.to_alias}`,r=a.get(n),s=e.created_at||"",l=r?s>r.last_at?s:r.last_at:s;a.set(n,{key:n,from:e.from_alias,to:e.to_alias,count:(r?.count||0)+1,content:r?.content||e.content,last_at:l})}),[...a.values()].slice(0,18)}function $({sessions:e,sseSessions:t,renameSignal:r}){let s,l,i,o,c,u,f,p,g,M,E,z,P,A,L,T,F,I,W,R,B,D,O,H,Y,X,U,K,G,J,V,q,Z,Q,ee,et,ea,en,er,es,el="light"===function(){let[e,t]=(0,n.useState)("dark");return(0,n.useEffect)(()=>{let e=()=>{let e=document.documentElement.getAttribute("data-theme")||"cyber";t("light"===e||"mint"===e?"light":"dark")};e();let a=new MutationObserver(e);return a.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>a.disconnect()},[]),e}(),ei=function(){let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{if(!window.matchMedia)return;let e=window.matchMedia("(prefers-reduced-motion: reduce)");t(e.matches);let a=e=>t(e.matches);return e.addEventListener("change",a),()=>e.removeEventListener("change",a)},[]),e}(),eo=el?S:N,ed="intern"===function(){let[e,t]=(0,n.useState)(null);return(0,n.useEffect)(()=>{try{let e=new URL(window.location.href).searchParams.get("brand");null!==e?""===e||"none"===e?(localStorage.removeItem("anet-brand"),t(null)):(localStorage.setItem("anet-brand",e),t(e)):t(localStorage.getItem("anet-brand"))}catch{}},[]),e}(),[ec,eu]=(0,n.useState)([]),[eh,ex]=(0,n.useState)("ring");(0,n.useEffect)(()=>{try{let e=localStorage.getItem("anet-topo-layout");("grid"===e||"ring"===e)&&ex(e)}catch{}},[]);let ef=()=>ex(e=>{let t="ring"===e?"grid":"ring";try{localStorage.setItem("anet-topo-layout",t)}catch{}return t}),[ep,em]=(0,n.useState)(.84);(0,n.useEffect)(()=>{try{let e=parseFloat(localStorage.getItem("anet-topo-nodescale")||"");(.7===e||.84===e||1===e)&&em(e)}catch{}},[]),(0,n.useEffect)(()=>{let e=async()=>{try{let e=await fetch("/api/hub/messages?limit=50");if(401===e.status)return void window.location.assign("/login");let t=await e.json();eu(t.messages||[])}catch{}};e();let t=setInterval(e,5e3);return()=>clearInterval(t)},[]);let{onlineNodes:eg,offlineNodes:ey,nodePositions:eb,flowLinks:ev,activeAliases:ej,groupKeys:ek,groupBoxes:ew,gridContentBottom:eN}=(0,n.useMemo)(()=>{let a=e=>(e.network_id?t[`${e.network_id}:${e.alias}`]:void 0)??t[e.alias],n=(e,t)=>e.alias.localeCompare(t.alias),r=Date.now(),s=e.filter(e=>"offline"!==e.status||a(e)).sort(n),l=e.filter(e=>"offline"===e.status&&!a(e)&&!(e=>{if("offline"!==e.status||a(e)||!e.last_seen_at)return!1;let t=(0,h.parseHubTime)(e.last_seen_at);return null!==t&&r-t>36e5})(e)).sort(n),i={};if("grid"===eh){let e=[...s,...l],t=C(e),n=Math.max(1,Math.ceil(Math.sqrt(e.length))),r=700/n,o=Math.round(26*ep),d=[];for(let a of e){let e=t[a.alias],n=d[d.length-1];n&&n.key===e?n.members.push(a):d.push({key:e,members:[a]})}let c=[],u=0,h=0;for(;h<d.length;)if(d[h].members.length>=2)c.push({members:d[h].members,startRow:u,centred:!1,isGroup:!0}),u+=Math.ceil(d[h].members.length/n),h++;else{let e=[];for(;h<d.length&&d[h].members.length<2;)e.push(d[h].members[0]),h++;c.push({members:e,startRow:u,centred:!0,isGroup:!1}),u+=Math.ceil(e.length/n)}let x=Math.max(1,u),f=o+20,p=Math.max(2*o+22,f+12,o+(ep<.8?12:14)+f+3,Math.min(100,526/x));for(let e of c)e.members.forEach((t,a)=>{let s=Math.floor(a/n),l=a%n,o=Math.min(n,e.members.length-s*n),d=e.centred?(n-o)*r/2:0;i[t.alias]={x:150+d+(l+.5)*r,y:126+(e.startRow+s+.5)*p}});let m=_(ec,i),g=new Set;m.forEach(e=>{g.add(e.from),g.add(e.to)});let y=Math.max(8,Math.min(26,p-f-8)),b=c.filter(e=>e.isGroup).map(e=>{let n=e.members.map(e=>i[e.alias]).filter(Boolean),r=n.map(e=>e.x),s=n.map(e=>e.y),l=Math.min(...r),o=Math.min(...s),d=0,c=0,u=0;for(let t of e.members){let e="offline"!==t.status||!!a(t);"working"===t.status?d++:e?c++:u++}return{key:e.members.length?t[e.members[0].alias]:"",count:e.members.length,statuses:{working:d,idle:c,offline:u},x:l-y,y:o-f,w:Math.max(...r)-l+2*y,h:Math.max(...s)-o+f+y}});return{onlineNodes:s,offlineNodes:l,nodePositions:i,flowLinks:m,activeAliases:g,groupKeys:t,groupBoxes:b,gridContentBottom:126+x*p+8}}let o=s.length>14,d=!o&&s.length>8,c=s.length;if(o){let e=Math.ceil(s.length/3),t=s.slice(0,e),a=s.slice(e,2*e),n=s.slice(2*e);t.forEach((e,a)=>{i[e.alias]=b(a,Math.max(t.length,1),145)});let r=t.length<=2?Math.PI:1.78*Math.PI,l=t.length>1?r/(t.length-1):0;a.forEach((e,t)=>{i[e.alias]=b(t,Math.max(a.length,1),215,l/2)}),n.forEach((e,t)=>{i[e.alias]=b(t,Math.max(n.length,1),285)}),c=n.length}else if(d){let e=Math.ceil(s.length/2),t=s.length-e,a=s.slice(0,e),n=s.slice(e);a.forEach((t,a)=>{i[t.alias]=b(a,Math.max(e,1),175)});let r=e<=2?Math.PI:1.78*Math.PI,l=e>1?r/(e-1):0;n.forEach((e,a)=>{i[e.alias]=b(a,Math.max(t,1),260,l/2)}),c=t}else s.forEach((e,t)=>{i[e.alias]=b(t,Math.max(s.length,1),220)});let u=c<=2?Math.PI:1.78*Math.PI,x=c>1?u/(c-1):0,f=c>0?x/2:0,p=325+6*Math.max(0,l.length-4);l.forEach((e,t)=>{i[e.alias]=b(t,Math.max(l.length,1),p,f)});let m=_(ec,i),g=new Set;m.forEach(e=>{g.add(e.from),g.add(e.to)});let y=C([...s,...l]);return{onlineNodes:s,offlineNodes:l,nodePositions:i,flowLinks:m,activeAliases:g,groupKeys:y,groupBoxes:[],gridContentBottom:0}},[ec,e,t,eh,ep]),eS=eg.filter(e=>"working"===e.status).length,eM=(0,n.useMemo)(()=>{let e=new Map;for(let t of[...eg,...ey]){let a=m(t.model),n="unknown"===a.id?"?":a.initial,r=e.get(n);r?r.count++:e.set(n,{initial:n,count:1,color:a.mono.text})}return[...e.values()].sort((e,t)=>t.count-e.count)},[eg,ey]),eC=eg.length+ey.length>16,[e_,e$]=(0,n.useState)(null),[eE,ez]=(0,n.useState)(null),eP=eE??(e_?ek[e_]??e_:null),[eA,eL]=(0,n.useState)(()=>{try{return sessionStorage.getItem("anet-topo-pinned-group")}catch{return null}}),eT=eP??eA;(0,n.useEffect)(()=>{try{eA?sessionStorage.setItem("anet-topo-pinned-group",eA):sessionStorage.removeItem("anet-topo-pinned-group")}catch{}},[eA]),(0,n.useEffect)(()=>{!eA||new Set(Object.values(ek)).has(eA)||eL(null)},[eA,ek]);let[eF,eI]=(0,n.useState)(null),[eW,eR]=(0,n.useState)(null),eB=eF??eW,[eD,eO]=(0,n.useState)(!1),[eH,eY]=(0,n.useState)(!1),[eX,eU]=(0,n.useState)(null),[eK,eG]=(0,n.useState)(()=>{try{return sessionStorage.getItem("anet-topo-pinned-vendor")}catch{return null}}),eJ=eX??eK;(0,n.useEffect)(()=>{try{eK?sessionStorage.setItem("anet-topo-pinned-vendor",eK):sessionStorage.removeItem("anet-topo-pinned-vendor")}catch{}},[eK]),(0,n.useEffect)(()=>{eK&&!eM.some(e=>e.initial===eK)&&eG(null)},[eK,eM]);let[eV,eq]=(0,n.useState)(null),[eZ,eQ]=(0,n.useState)(()=>{try{let e=sessionStorage.getItem("anet-topo-pinned-status");return"working"===e||"idle"===e||"offline"===e?e:null}catch{return null}}),e0=eV??eZ;(0,n.useEffect)(()=>{try{eZ?sessionStorage.setItem("anet-topo-pinned-status",eZ):sessionStorage.removeItem("anet-topo-pinned-status")}catch{}},[eZ]),(0,n.useEffect)(()=>{let e=e=>{let t=e.detail||{};if("clear"===t.kind)eQ(null),eL(null),eG(null),eR(null);else if("clear-vendor"===t.kind)eG(null);else if("clear-edge"===t.kind)eR(null);else if("status"===t.kind){let e=t.value;("working"===e||"idle"===e||"offline"===e)&&eQ(e)}else"group"===t.kind&&"string"==typeof t.value?eL(t.value):"vendor"===t.kind&&"string"==typeof t.value&&eG(t.value)};return window.addEventListener("anet:topo-pin",e),()=>window.removeEventListener("anet:topo-pin",e)},[]);let e1=(0,n.useMemo)(()=>{if(!eB)return null;let e=ev.find(e=>e.key===eB);return e?new Set([e.from,e.to]):null},[eB,ev]),e2=(0,n.useRef)(null),e5=(0,n.useRef)(null),[e3,e4]=(0,n.useState)({zoom:1,x:0,y:0}),e8=(0,n.useRef)(e3),e6=(0,n.useRef)({active:!1,startX:0,startY:0,baseX:0,baseY:0}),[e7,e9]=(0,n.useState)(!1),[te,tt]=(0,n.useState)(null),[ta,tn]=(0,n.useState)(null);(0,n.useEffect)(()=>{r&&r.from===te&&tt(r.to)},[r]),(0,n.useEffect)(()=>{e8.current=e3},[e3]),(0,n.useEffect)(()=>{try{let e=localStorage.getItem("anet-topo-view");if(e){let t=JSON.parse(e);"number"==typeof t?.zoom&&e4({zoom:Math.min(4,Math.max(.5,t.zoom)),x:"number"==typeof t.x?t.x:0,y:"number"==typeof t.y?t.y:0})}}catch{}},[]);let[tr]=(0,n.useState)(()=>!!localStorage.getItem("anet-topo-view")),ts=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(!ts.current){if(tr){ts.current=!0;return}if("grid"===eh&&0!==e.length&&eN){if(eN<=680){ts.current=!0;return}e4({zoom:Math.max(.5,Math.min(1,680/eN)),x:0,y:0}),ts.current=!0}}},[eh,e.length,eN,tr]),(0,n.useEffect)(()=>{try{localStorage.setItem("anet-topo-view",JSON.stringify(e3))}catch{}},[e3]),(0,n.useEffect)(()=>{let e=()=>e9(document.fullscreenElement===e2.current);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),(0,n.useEffect)(()=>{let e=e5.current;if(!e)return;let t=t=>{if(!e7&&!t.ctrlKey&&!t.metaKey)return;t.preventDefault();let a=e.getBoundingClientRect(),n=(t.clientX-a.left)/a.width*1e3,r=(t.clientY-a.top)/a.height*680;e4(e=>{let a=Math.min(1.08,Math.max(.926,Math.exp(-(6e-4*t.deltaY)))),s=Math.min(4,Math.max(.5,e.zoom*a)),l=s/e.zoom;return{zoom:s,x:n-(n-e.x)*l,y:r-(r-e.y)*l}})};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[e7]);let[tl,ti]=(0,n.useState)(!1),to=e=>{if(e6.current.active){e6.current.active=!1,ti(!1);try{e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}}},td=e=>{e4(t=>{let a=Math.min(4,Math.max(.5,t.zoom*e)),n=a/t.zoom;return{zoom:a,x:500-(500-t.x)*n,y:340-(340-t.y)*n}})},tc=()=>e4({zoom:1,x:0,y:0}),tu=(0,n.useCallback)(()=>{e4({zoom:!eN||eN<=680?1:Math.max(.5,Math.min(1,680/eN)),x:0,y:0})},[eN]);return(0,n.useEffect)(()=>{let e=e=>{"toggle"===(e.detail||{}).kind&&ef()},t=e=>{"fit"===(e.detail||{}).kind&&tu()};return window.addEventListener("anet:topo-layout",e),window.addEventListener("anet:topo-view",t),()=>{window.removeEventListener("anet:topo-layout",e),window.removeEventListener("anet:topo-view",t)}},[tu]),(0,n.useEffect)(()=>{let e=e=>{if(e.ctrlKey||e.metaKey||e.altKey)return;let t=document.activeElement;if(t){let e=t.tagName;if("INPUT"===e||"TEXTAREA"===e||"SELECT"===e||t.isContentEditable)return}"+"===e.key||"="===e.key?(td(1.2),e.preventDefault()):"-"===e.key||"_"===e.key?(td(1/1.2),e.preventDefault()):"0"===e.key?(tc(),e.preventDefault()):"f"===e.key||"F"===e.key?(tu(),e.preventDefault()):"l"===e.key||"L"===e.key?(ef(),e.preventDefault()):"Escape"===e.key&&!te&&(eZ||eA||eK||eW)&&(eZ&&eQ(null),eA&&eL(null),eK&&eG(null),eW&&eR(null),e.preventDefault())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[tu,te,eZ,eA,eK,eW]),(0,a.jsxs)("section",{className:"w-full max-w-6xl mx-auto mb-8",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between mb-3 px-1",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs uppercase text-gray-600 tracking-wider",children:"Network Topology"}),(0,a.jsx)("h2",{className:"text-lg text-white font-semibold",children:"Command mesh"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(0,a.jsxs)("div",{className:"inline-flex rounded-md border border-gray-500/25 overflow-hidden",role:"group","aria-label":"Topology layout",children:[(0,a.jsx)("button",{onClick:()=>{"ring"!==eh&&ef()},"aria-pressed":"ring"===eh,title:"Ring layout (l to toggle)",className:`px-2.5 py-1 transition-colors ${"ring"===eh?"bg-cyan-500/15 text-cyan-300":"text-gray-500 hover:text-gray-400"}`,children:"Ring"}),(0,a.jsx)("button",{onClick:()=>{"grid"!==eh&&ef()},"aria-pressed":"grid"===eh,title:"Grid layout (l to toggle)",className:`px-2.5 py-1 border-l border-gray-500/25 transition-colors ${"grid"===eh?"bg-cyan-500/15 text-cyan-300":"text-gray-500 hover:text-gray-400"}`,children:"Grid"})]}),(s=eg.filter(e=>"working"===e.status).map(e=>e.alias),l=eg.map(e=>e.alias),i=e=>e.slice(0,8).join(", ")+(e.length>8?` + ${e.length-8} more`:""),o=0===eS?void 0:"working"===eZ?`${i(s)} — pinned, Esc to clear`:`${i(s)} — hover highlights, click to pin`,c=0===eg.length?void 0:"idle"===eZ?`${i(l)} — pinned, Esc to clear`:`${i(l)} — hover highlights online`,(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-green-500/10 text-green-300 border border-green-500/20","data-working-chip":!0,"data-working-chip-aliases":s.join(","),"data-pin-mirror":"working"===eZ?"true":"false",title:o,style:{cursor:eS>0?"pointer":void 0,boxShadow:"working"===eZ?"inset 0 0 0 1px #4ade80, inset 0 0 0 2px rgba(255,255,255,0.45)":void 0},onMouseEnter:()=>{eS>0&&eq("working")},onMouseLeave:()=>eq(e=>"working"===e?null:e),children:[eS," working"]}),(0,a.jsxs)("span",{className:"px-2.5 py-1 rounded-md bg-cyan-500/10 text-cyan-300 border border-cyan-500/20","data-online-chip":!0,"data-online-chip-aliases":l.join(","),"data-pin-mirror":"idle"===eZ?"true":"false",title:c,style:{cursor:eg.length>0?"pointer":void 0,boxShadow:"idle"===eZ?"inset 0 0 0 1px #67e8f9, inset 0 0 0 2px rgba(255,255,255,0.45)":void 0},onMouseEnter:()=>{let e=eg.length-eS;eS>0?eq("working"):e>0&&eq("idle")},onMouseLeave:()=>eq(e=>"working"===e||"idle"===e?null:e),children:[eg.length," online"]})]})),(()=>{let e=eg.length-eS,t=ey.length,n=eS+e+t;if(0===n)return null;let r=(e,t,r,s)=>{if(0===e)return null;let l=eZ===r,i="working"===r?eg.filter(e=>"working"===e.status).map(e=>e.alias):"idle"===r?eg.filter(e=>"working"!==e.status).map(e=>e.alias):ey.map(e=>e.alias),o=i.slice(0,8).join(", "),d=i.length>8?` + ${i.length-8} more`:"",c=l?"click to release filter":"click to highlight";return(0,a.jsx)("span",{"data-pressure-seg":r,"data-pressure-seg-aliases":i.join(","),role:"button",tabIndex:0,"aria-pressed":l,title:`${e} ${s}
2
2
  ${o}${d}
3
- ${c}`,style:{width:`${e/n*100}%`,background:t,height:"100%",cursor:"pointer",boxShadow:l?`inset 0 0 0 1px ${t}, inset 0 0 0 2px rgba(255,255,255,0.6)`:void 0},onClick:e=>{e.stopPropagation(),eQ(e=>e===r?null:r)},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),eQ(e=>e===r?null:r))},onMouseEnter:()=>eq(r),onMouseLeave:()=>eq(e=>e===r?null:e)},r)};return(0,a.jsxs)("span",{className:"hidden sm:inline-flex items-center gap-2 px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20 font-mono",title:`${eS} working \xb7 ${e} idle \xb7 ${t} offline`,"data-fleet-pressure":!0,children:[(0,a.jsx)("span",{className:"text-[10px] tracking-wide",children:"pressure"}),(0,a.jsxs)("span",{className:"inline-flex h-1.5 w-16 rounded-full overflow-hidden",style:{background:"rgb(75 85 99 / 0.25)"},children:[r(eS,el?"#059669":"#22c55e","working","working"),r(e,el?"#0d9488":"#2dd4bf","idle","idle"),r(t,el?"#94a3b8":"#6b7280","offline","offline")]})]})})(),eZ&&(u="working"===eZ?eS:"idle"===eZ?eg.length-eS:ey.length,p=(f="working"===eZ?eg.filter(e=>"working"===e.status).map(e=>e.alias):"idle"===eZ?eg.filter(e=>"working"!==e.status).map(e=>e.alias):ey.map(e=>e.alias)).slice(0,8).join(", "),g=f.length>8?` + ${f.length-8} more`:"",(0,a.jsxs)("span",{"data-active-filter":"status","data-filter-match-count":u,"data-filter-match-aliases":f.join(","),className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in",title:u>0?`${p}${g} — click to clear`:"Click to clear filter",onClick:()=>eQ(null),style:{background:"working"===eZ?el?"#05966914":"#22c55e1f":"idle"===eZ?el?"#0d948814":"#2dd4bf1f":el?"#94a3b814":"#6b72801f",color:"working"===eZ?el?"#047857":"#86efac":"idle"===eZ?el?"#0f766e":"#5eead4":el?"#475569":"#9ca3af",borderColor:"currentColor",cursor:"pointer"},children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"hidden sm:inline","data-filter-prefix":!0,children:"filter: "}),eZ,(0,a.jsxs)("span",{className:"opacity-70",children:[" · ",u]})]}),(0,a.jsx)("button",{type:"button","aria-label":`Clear ${eZ} filter`,onClick:e=>{e.stopPropagation(),eQ(null)},className:"ml-0.5 leading-none hover:opacity-70",style:{background:"transparent",color:"inherit",cursor:"pointer",padding:0},children:"×"})]})),eA&&(M=Object.values(ek).filter(e=>e===eA).length,z=(E=Object.entries(ek).filter(([,e])=>e===eA).map(([e])=>e)).slice(0,8).join(", "),P=E.length>8?` + ${E.length-8} more`:"",(0,a.jsxs)("span",{"data-active-filter":"group","data-filter-match-count":M,"data-filter-match-aliases":E.join(","),className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in",title:M>0?`${z}${P} — click to clear`:"Click to clear filter",onClick:()=>eL(null),style:{background:el?"#67e8f914":"#67e8f91f",color:eo.legendAccent,borderColor:"currentColor",cursor:"pointer"},children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"hidden sm:inline","data-filter-prefix":!0,children:"filter: "}),eA,(0,a.jsxs)("span",{className:"opacity-70",children:[" · ",M]})]}),(0,a.jsx)("button",{type:"button","aria-label":`Clear group filter ${eA}`,onClick:e=>{e.stopPropagation(),eL(null)},className:"ml-0.5 leading-none hover:opacity-70",style:{background:"transparent",color:"inherit",cursor:"pointer",padding:0},children:"×"})]})),eK&&(A=eM.find(e=>e.initial===eK),L=A?.count??0,T=A?.color??eo.legendText,I=(F=[...eg,...ey].filter(e=>{let t=m(e.model);return("unknown"===t.id?"?":t.initial)===eK}).map(e=>e.alias)).slice(0,8).join(", "),W=F.length>8?` + ${F.length-8} more`:"",(0,a.jsxs)("span",{"data-active-filter":"vendor","data-filter-match-count":L,"data-filter-match-aliases":F.join(","),className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in",title:L>0?`${I}${W} — click to clear`:"Click to clear vendor filter",onClick:()=>eG(null),style:{background:`${T}1f`,color:T,borderColor:"currentColor",cursor:"pointer"},children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"hidden sm:inline","data-filter-prefix":!0,children:"filter: "}),eK,(0,a.jsxs)("span",{className:"opacity-70",children:[" · ",L]})]}),(0,a.jsx)("button",{type:"button","aria-label":`Clear vendor filter ${eK}`,onClick:e=>{e.stopPropagation(),eG(null)},className:"ml-0.5 leading-none hover:opacity-70",style:{background:"transparent",color:"inherit",cursor:"pointer",padding:0},children:"×"})]})),eW&&((R=ev.find(e=>e.key===eW))?(0,a.jsxs)("span",{"data-active-filter":"edge","data-filter-match-count":R.count,"data-filter-match-aliases":`${R.from},${R.to}`,className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in",title:`${R.from} → ${R.to} (${R.count} msg${1===R.count?"":"s"}) — click to clear`,onClick:()=>eR(null),style:{background:el?`${eo.flowEdge}14`:`${eo.flowEdge}1f`,color:eo.flowEdge,borderColor:"currentColor",cursor:"pointer"},children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"hidden sm:inline","data-filter-prefix":!0,children:"filter: "}),R.from,"→",R.to,(0,a.jsxs)("span",{className:"opacity-70",children:[" · ",R.count]})]}),(0,a.jsx)("button",{type:"button","aria-label":`Clear edge filter ${R.from} → ${R.to}`,onClick:e=>{e.stopPropagation(),eR(null)},className:"ml-0.5 leading-none hover:opacity-70",style:{background:"transparent",color:"inherit",cursor:"pointer",padding:0},children:"×"})]}):null),(()=>{let e=+!!eZ+ +!!eA+ +!!eK+ +!!eW;if(e<2)return null;let t=eW?ev.find(e=>e.key===eW):null,n=t?new Set([t.from,t.to]):null,r=[...eg,...ey].filter(e=>{let t="offline"!==e.status;if("working"===eZ&&"working"!==e.status||"idle"===eZ&&!(t&&"working"!==e.status)||"offline"===eZ&&t||eA&&(ek[e.alias]??e.alias)!==eA)return!1;if(eK){let t=m(e.model);if(("unknown"===t.id?"?":t.initial)!==eK)return!1}return!n||!!n.has(e.alias)}).map(e=>e.alias),s=r.slice(0,8).join(", "),l=r.length>8?` + ${r.length-8} more`:"",i=0===r.length,o=i?`No nodes pass all ${e} pinned filters — release one to widen (Esc clears all)`:`${s}${l} — nodes passing all ${e} pinned filters`;return(0,a.jsx)("span",{"data-pin-intersection":!0,"data-pin-dim-count":e,"data-pin-intersection-count":r.length,"data-pin-intersection-empty":i?"true":"false","data-pin-intersection-aliases":r.join(","),className:"hidden sm:inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in",title:o,style:{background:i?el?"#d9770614":"#fbbf241f":el?"#94a3b814":"#94a3b81f",color:i?el?"#d97706":"#fbbf24":el?"#475569":"#9ca3af",borderColor:"currentColor"},children:(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"hidden sm:inline","data-pin-intersection-prefix":!0,children:"match: "}),e," pins",(0,a.jsxs)("span",{className:"opacity-70",children:[" · ",r.length]}),i&&(0,a.jsx)("span",{className:"ml-1","aria-hidden":!0,children:"⚠"})]})})})(),eM.length>1&&(0,a.jsx)("span",{className:"hidden sm:inline-flex items-center gap-2 px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20 font-mono",title:"Hover to highlight; click to pin",children:eM.map(e=>{let t=eK===e.initial,n=[...eg,...ey].filter(t=>{let a=m(t.model);return("unknown"===a.id?"?":a.initial)===e.initial}).map(e=>e.alias),r=n.slice(0,8).join(", "),s=n.length>8?` + ${n.length-8} more`:"",l=t?`${r}${s} — click again or Esc to clear`:`${r}${s} — click to pin`;return(0,a.jsxs)("span",{role:"button",tabIndex:0,"aria-pressed":t,className:"inline-flex items-baseline gap-0.5 px-1 rounded","data-vendor-letter":e.initial,"data-vendor-pinned":t?"true":"false","data-vendor-aliases":n.join(","),title:l,style:{cursor:"pointer",boxShadow:t?`inset 0 0 0 1px ${e.color}, inset 0 0 0 2px rgba(255,255,255,0.45)`:void 0},onMouseEnter:()=>eU(e.initial),onMouseLeave:()=>eU(t=>t===e.initial?null:t),onClick:()=>eG(t=>t===e.initial?null:e.initial),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),eG(t=>t===e.initial?null:e.initial))},children:[(0,a.jsx)("span",{style:{color:e.color},children:e.initial}),(0,a.jsxs)("span",{className:"text-gray-500",children:[":",e.count]})]},e.initial)})}),(D=null!==(B=ev.reduce((e,t)=>{if(!t.last_at)return e;let a=(0,h.parseHubTime)(t.last_at);return null===a?e:null===e||a>e?a:e},null))?(0,h.relativeAgo)(new Date(B).toISOString()):null,O=ev.slice(0,6).map(e=>`${e.from}→${e.to} (${e.count})`).join(", "),H=ev.length>6?` + ${ev.length-6} more`:"",Y=0===ev.length?void 0:`${O}${H} — hover brightens all`,(0,a.jsxs)("span",{className:"hidden sm:inline px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20","data-active-links-chip":!0,"data-active-links-flow-count":ev.length,title:Y,style:{cursor:ev.length>0?"pointer":void 0},onMouseEnter:()=>{ev.length>0&&eO(!0)},onMouseLeave:()=>eO(!1),children:[ev.length," active link",1===ev.length?"":"s",D?(0,a.jsxs)("span",{className:"text-gray-500",children:[" · last ",D]}):null]})),(0,a.jsx)(k,{sessions:e})]})]}),(0,a.jsxs)("div",{ref:e2,className:`relative overflow-hidden rounded-lg border shadow-2xl ${el?"shadow-zinc-900/5":"shadow-cyan-950/30"} ${e7?"flex items-center justify-center":""}`,style:{background:eo.containerBg,borderColor:eo.containerBorder},children:[(0,a.jsx)("div",{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r ${eo.topRailGradient}`}),(0,a.jsxs)("svg",{ref:e5,viewBox:"0 0 1000 680",className:"w-full h-auto block",preserveAspectRatio:"xMidYMid meet",onPointerDown:e=>{0===e.button&&(e.currentTarget.setPointerCapture?.(e.pointerId),e6.current={active:!0,startX:e.clientX,startY:e.clientY,baseX:e8.current.x,baseY:e8.current.y},ti(!0))},onPointerMove:e=>{let t=e6.current;if(!t.active)return;let a=e5.current;if(!a)return;let n=a.getBoundingClientRect(),r=(e.clientX-t.startX)/n.width*1e3,s=(e.clientY-t.startY)/n.height*680;e4(e=>({...e,x:t.baseX+r,y:t.baseY+s}))},onPointerUp:to,onPointerLeave:to,onDoubleClick:e=>{let t=e.target;t?.closest("g[data-node]")||tc()},style:{cursor:tl?"grabbing":"grab",touchAction:"none"},children:[(0,a.jsxs)("defs",{children:[(0,a.jsxs)("linearGradient",{id:"topo-panel",x1:"0",x2:"1",y1:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:eo.panelStops[0]}),(0,a.jsx)("stop",{offset:"48%",stopColor:eo.panelStops[1]}),(0,a.jsx)("stop",{offset:"100%",stopColor:eo.panelStops[2]})]}),(0,a.jsxs)("radialGradient",{id:"topo-radar",cx:"50%",cy:"50%",r:"55%",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:eo.radarStops[0].color,stopOpacity:eo.radarStops[0].opacity}),(0,a.jsx)("stop",{offset:"45%",stopColor:eo.radarStops[1].color,stopOpacity:eo.radarStops[1].opacity}),(0,a.jsx)("stop",{offset:"100%",stopColor:eo.radarStops[2].color,stopOpacity:eo.radarStops[2].opacity})]}),!el&&(0,a.jsxs)("filter",{id:"topo-glow",children:[(0,a.jsx)("feGaussianBlur",{stdDeviation:"4",result:"blur"}),(0,a.jsxs)("feMerge",{children:[(0,a.jsx)("feMergeNode",{in:"blur"}),(0,a.jsx)("feMergeNode",{in:"SourceGraphic"})]})]}),[{id:"topo-arrow-s",size:12},{id:"topo-arrow",size:16},{id:"topo-arrow-l",size:22}].map(e=>(0,a.jsx)("marker",{id:e.id,viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:e.size,markerHeight:e.size,markerUnits:"userSpaceOnUse",orient:"auto-start-reverse",children:(0,a.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:eo.arrowFill})},e.id)),(0,a.jsxs)("radialGradient",{id:"topo-sweep",cx:"0%",cy:"50%",r:"100%",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:el?"#0d9488":"#22d3ee",stopOpacity:el?.18:.32}),(0,a.jsx)("stop",{offset:"70%",stopColor:el?"#0d9488":"#22d3ee",stopOpacity:el?.1:.18}),(0,a.jsx)("stop",{offset:"100%",stopColor:el?"#0d9488":"#22d3ee",stopOpacity:"0"})]})]}),(0,a.jsx)("rect",{width:"1000",height:"680",fill:"url(#topo-panel)"}),(0,a.jsxs)("g",{transform:`translate(${e3.x} ${e3.y}) scale(${e3.zoom})`,children:["ring"===eh&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("circle",{cx:500,cy:330,r:"330",fill:"url(#topo-radar)",style:{pointerEvents:"none"}}),!el&&(0,a.jsx)("g",{opacity:"0.5",style:{pointerEvents:"none"},children:Array.from({length:28}).map((e,t)=>{let n=9301*t+49297;return(0,a.jsx)("circle",{cx:13*n%1e3,cy:7*n%680,r:t%3==0?1.2:.7,fill:"#a5b4fc",opacity:.35+t%4*.05},t)})}),(0,a.jsx)("g",{style:{transformOrigin:"500px 330px",transformBox:"view-box",pointerEvents:"none"},className:"anet-topo-sweep",opacity:el?.7:1,children:(0,a.jsx)("path",{d:`M 500 330 L 830 330 A 330 330 0 0 0 ${500+330*Math.cos(-Math.PI/4.5)} ${330+330*Math.sin(-Math.PI/4.5)} Z`,fill:"url(#topo-sweep)"})}),[90,170,250,330].map(e=>(0,a.jsx)("circle",{cx:500,cy:330,r:e,fill:"none",stroke:eo.ringStroke,strokeWidth:"1",opacity:el?.6:.35},e)),(X=eg.length>14?[145,215,285]:eg.length>8?[175,260]:eg.length>0?[220]:[],K=(U=!!(eZ||eA||eK))?eo.legendAccent:eo.ringStroke,X.map(e=>{let t=eg.reduce((t,a)=>{let n=eb[a.alias];return n&&15>Math.abs(Math.hypot(n.x-500,n.y-330)-e)?t+1:t},0);if(0===t)return null;let n=t<=2?0:t<=6?1:2,r=[.24,.36,.5][n],s=[.32,.46,.62][n];return(0,a.jsx)("circle",{cx:500,cy:330,r:e,fill:"none",stroke:K,strokeWidth:"0.7",strokeDasharray:"2 8",opacity:el?r:s,style:{pointerEvents:"none",transition:"stroke 200ms ease-out"},"data-tier-ring":e,"data-tier-occupancy":t,"data-tier-bucket":n,"data-tier-tinted":U?"true":"false"},`tier-${e}`)})),!el&&(J=[16,14,12,10][G=0===eS?0:eS<=2?1:eS<=5?2:3],[0,.25,.5,.75].map((e,t)=>(0,a.jsx)("g",{"data-topo-orbit-bucket":G,"data-topo-orbit-dur":J,children:(0,a.jsx)("circle",{cx:830,cy:330,r:0===t?2.8:2.2,fill:"#22d3ee",opacity:.9,filter:"url(#topo-glow)",children:(0,a.jsx)("animateTransform",{attributeName:"transform",type:"rotate",from:`${360*e} 500 330`,to:`${360*e+360} 500 330`,dur:`${J}s`,repeatCount:"indefinite"})})},`orbit-${t}`))),[0,30,60,90,120,150].map(e=>(0,a.jsx)("line",{x1:500-360*Math.cos(e*Math.PI/180),y1:330-360*Math.sin(e*Math.PI/180),x2:500+360*Math.cos(e*Math.PI/180),y2:330+360*Math.sin(e*Math.PI/180),stroke:eo.ringStroke,strokeWidth:"1",opacity:el?.35:.18},e))]}),"ring"===eh&&eg.map((e,t)=>{let n=eb[e.alias];if(!n)return null;let r=v({x:500,y:330},n,0),s=ej.has(e.alias);return(0,a.jsx)("path",{d:r,fill:"none",stroke:s?eo.spokeStroke.active:eo.spokeStroke.idle,strokeWidth:s?2:1,strokeDasharray:s?"none":"6 14",opacity:s?.7:.45,className:s?void 0:"anet-topo-spoke-flow",style:s?void 0:{animationDelay:`${-(.25*t)}s`}},`hub-${e.alias}`)}),ew.map(e=>{let t,n,r,s,l=eT===e.key,i=eA===e.key;return(0,a.jsxs)("g",{"data-group":e.key,className:"transition-opacity",style:{opacity:!eT||l?1:.28},children:[(0,a.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:"14",fill:el?"#0f172a":"#a5b4fc",fillOpacity:i?el?.08:.13:l?el?.05:.09:el?.025:.045,stroke:i||l?eo.legendAccent:eo.ringStroke,strokeWidth:i?3:l?2:1.5,strokeDasharray:i||l?"none":"6 6","data-group-box-pinned":i?"true":"false","data-group-box-live":i||l||!(e.statuses.working>0)?"false":"true",className:i||l||!(e.statuses.working>0)?void 0:"anet-topo-groupbox-live",style:{transition:"stroke 200ms ease-out, stroke-width 200ms ease-out, fill-opacity 200ms ease-out",pointerEvents:"none"}}),(0,a.jsxs)("g",{role:"button",tabIndex:0,"aria-pressed":eA===e.key,"data-group-label-hit":e.key,style:{pointerEvents:"all",cursor:"pointer"},onPointerDown:e=>e.stopPropagation(),onClick:()=>eL(t=>t===e.key?null:e.key),onPointerEnter:()=>ez(e.key),onPointerLeave:()=>ez(t=>t===e.key?null:t),children:[(n=(t=Object.entries(ek).filter(([,t])=>t===e.key).map(([e])=>e)).slice(0,8).join(", "),r=t.length>8?` + ${t.length-8} more`:"",s=[e.statuses.working>0?`${e.statuses.working} working`:null,e.statuses.idle>0?`${e.statuses.idle} idle`:null,e.statuses.offline>0?`${e.statuses.offline} offline`:null].filter(Boolean).join(" · "),(0,a.jsx)("title",{children:[`${e.key} (${t.length} member${1===t.length?"":"s"})`,s||null,`${n}${r}`,eA===e.key?"click to release pin":"click to pin this group"].filter(Boolean).join("\n")})),(0,a.jsx)("rect",{x:e.x+6,y:e.y+2,width:Math.min(e.w-12,240),height:20,rx:"4",fill:eA===e.key||eE===e.key?eo.legendAccent:"transparent",opacity:eA===e.key?el?.16:.2:eE===e.key?el?.09:.13:1,"data-group-label-tinted":eA===e.key?"pinned":eE===e.key?"hover":"none",style:{transition:"fill 150ms ease-out, opacity 150ms ease-out"}}),(0,a.jsxs)("text",{x:e.x+12,y:e.y+14,fill:l?eo.legendHeadline:eo.legendText,fontSize:"13",fontFamily:"monospace",fontWeight:"700",style:{transition:"fill 200ms ease-out"},"data-group-label":e.key,children:[e.key,(0,a.jsxs)("tspan",{dx:"6",fill:eo.legendText,fontSize:"11",fontWeight:"400",children:["· ",e.count]}),e.statuses.working>0&&(0,a.jsxs)("tspan",{dx:"8",fill:el?"#059669":"#22c55e",fontSize:"11",fontWeight:"600",children:[e.statuses.working,"w"]}),e.statuses.idle>0&&(0,a.jsxs)("tspan",{dx:"4",fill:el?"#0d9488":"#2dd4bf",fontSize:"11",fontWeight:"600",children:[e.statuses.idle,"i"]}),e.statuses.offline>0&&(0,a.jsxs)("tspan",{dx:"4",fill:el?"#94a3b8":"#6b7280",fontSize:"11",fontWeight:"600",children:[e.statuses.offline,"o"]})]})]})]},`grp-${e.key}`)}),ev.map((e,t)=>{let n,r,s,l,i,o,d,c,u,x,f=eb[e.from],p=eb[e.to];if(!f||!p)return null;let m=(t%2==0?1:-1)*Math.min(36,.18*Math.hypot(p.x-f.x,p.y-f.y)),g=v(f,p,m),y=Math.min(2+e.count,7),b=Math.max(.9,2.6/Math.sqrt(e.count)),j=Math.max(.35,1-(e.last_at?Math.max(0,Date.now()-Date.parse(e.last_at)):0)/3e5),k=e.count<=2?"topo-arrow-s":e.count<=4?"topo-arrow":"topo-arrow-l",w=(0,h.relativeAgo)(e.last_at),N=`${e.from} → ${e.to}
3
+ ${c}`,style:{width:`${e/n*100}%`,background:t,height:"100%",cursor:"pointer",boxShadow:l?`inset 0 0 0 1px ${t}, inset 0 0 0 2px rgba(255,255,255,0.6)`:void 0},onClick:e=>{e.stopPropagation(),eQ(e=>e===r?null:r)},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),eQ(e=>e===r?null:r))},onMouseEnter:()=>eq(r),onMouseLeave:()=>eq(e=>e===r?null:e)},r)};return(0,a.jsxs)("span",{className:"hidden sm:inline-flex items-center gap-2 px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20 font-mono",title:`${eS} working \xb7 ${e} idle \xb7 ${t} offline`,"data-fleet-pressure":!0,children:[(0,a.jsx)("span",{className:"text-[10px] tracking-wide",children:"pressure"}),(0,a.jsxs)("span",{className:"inline-flex h-1.5 w-16 rounded-full overflow-hidden",style:{background:"rgb(75 85 99 / 0.25)"},children:[r(eS,el?"#059669":"#22c55e","working","working"),r(e,el?"#0d9488":"#2dd4bf","idle","idle"),r(t,el?"#94a3b8":"#6b7280","offline","offline")]})]})})(),eZ&&(u="working"===eZ?eS:"idle"===eZ?eg.length-eS:ey.length,p=(f="working"===eZ?eg.filter(e=>"working"===e.status).map(e=>e.alias):"idle"===eZ?eg.filter(e=>"working"!==e.status).map(e=>e.alias):ey.map(e=>e.alias)).slice(0,8).join(", "),g=f.length>8?` + ${f.length-8} more`:"",(0,a.jsxs)("span",{"data-active-filter":"status","data-filter-match-count":u,"data-filter-match-aliases":f.join(","),className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in",title:u>0?`${p}${g} — click to clear`:"Click to clear filter",onClick:()=>eQ(null),style:{background:"working"===eZ?el?"#05966914":"#22c55e1f":"idle"===eZ?el?"#0d948814":"#2dd4bf1f":el?"#94a3b814":"#6b72801f",color:"working"===eZ?el?"#047857":"#86efac":"idle"===eZ?el?"#0f766e":"#5eead4":el?"#475569":"#9ca3af",borderColor:"currentColor",cursor:"pointer"},children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"hidden sm:inline","data-filter-prefix":!0,children:"filter: "}),eZ,(0,a.jsxs)("span",{className:"opacity-70",children:[" · ",u]})]}),(0,a.jsx)("button",{type:"button","aria-label":`Clear ${eZ} filter`,onClick:e=>{e.stopPropagation(),eQ(null)},className:"ml-0.5 leading-none hover:opacity-70",style:{background:"transparent",color:"inherit",cursor:"pointer",padding:0},children:"×"})]})),eA&&(M=Object.values(ek).filter(e=>e===eA).length,z=(E=Object.entries(ek).filter(([,e])=>e===eA).map(([e])=>e)).slice(0,8).join(", "),P=E.length>8?` + ${E.length-8} more`:"",(0,a.jsxs)("span",{"data-active-filter":"group","data-filter-match-count":M,"data-filter-match-aliases":E.join(","),className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in",title:M>0?`${z}${P} — click to clear`:"Click to clear filter",onClick:()=>eL(null),style:{background:el?"#67e8f914":"#67e8f91f",color:eo.legendAccent,borderColor:"currentColor",cursor:"pointer"},children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"hidden sm:inline","data-filter-prefix":!0,children:"filter: "}),eA,(0,a.jsxs)("span",{className:"opacity-70",children:[" · ",M]})]}),(0,a.jsx)("button",{type:"button","aria-label":`Clear group filter ${eA}`,onClick:e=>{e.stopPropagation(),eL(null)},className:"ml-0.5 leading-none hover:opacity-70",style:{background:"transparent",color:"inherit",cursor:"pointer",padding:0},children:"×"})]})),eK&&(A=eM.find(e=>e.initial===eK),L=A?.count??0,T=A?.color??eo.legendText,I=(F=[...eg,...ey].filter(e=>{let t=m(e.model);return("unknown"===t.id?"?":t.initial)===eK}).map(e=>e.alias)).slice(0,8).join(", "),W=F.length>8?` + ${F.length-8} more`:"",(0,a.jsxs)("span",{"data-active-filter":"vendor","data-filter-match-count":L,"data-filter-match-aliases":F.join(","),className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in",title:L>0?`${I}${W} — click to clear`:"Click to clear vendor filter",onClick:()=>eG(null),style:{background:`${T}1f`,color:T,borderColor:"currentColor",cursor:"pointer"},children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"hidden sm:inline","data-filter-prefix":!0,children:"filter: "}),eK,(0,a.jsxs)("span",{className:"opacity-70",children:[" · ",L]})]}),(0,a.jsx)("button",{type:"button","aria-label":`Clear vendor filter ${eK}`,onClick:e=>{e.stopPropagation(),eG(null)},className:"ml-0.5 leading-none hover:opacity-70",style:{background:"transparent",color:"inherit",cursor:"pointer",padding:0},children:"×"})]})),eW&&((R=ev.find(e=>e.key===eW))?(0,a.jsxs)("span",{"data-active-filter":"edge","data-filter-match-count":R.count,"data-filter-match-aliases":`${R.from},${R.to}`,className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in",title:`${R.from} → ${R.to} (${R.count} msg${1===R.count?"":"s"}) — click to clear`,onClick:()=>eR(null),style:{background:el?`${eo.flowEdge}14`:`${eo.flowEdge}1f`,color:eo.flowEdge,borderColor:"currentColor",cursor:"pointer"},children:[(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"hidden sm:inline","data-filter-prefix":!0,children:"filter: "}),R.from,"→",R.to,(0,a.jsxs)("span",{className:"opacity-70",children:[" · ",R.count]})]}),(0,a.jsx)("button",{type:"button","aria-label":`Clear edge filter ${R.from} → ${R.to}`,onClick:e=>{e.stopPropagation(),eR(null)},className:"ml-0.5 leading-none hover:opacity-70",style:{background:"transparent",color:"inherit",cursor:"pointer",padding:0},children:"×"})]}):null),(()=>{let e=+!!eZ+ +!!eA+ +!!eK+ +!!eW;if(e<2)return null;let t=eW?ev.find(e=>e.key===eW):null,n=t?new Set([t.from,t.to]):null,r=[...eg,...ey].filter(e=>{let t="offline"!==e.status;if("working"===eZ&&"working"!==e.status||"idle"===eZ&&!(t&&"working"!==e.status)||"offline"===eZ&&t||eA&&(ek[e.alias]??e.alias)!==eA)return!1;if(eK){let t=m(e.model);if(("unknown"===t.id?"?":t.initial)!==eK)return!1}return!n||!!n.has(e.alias)}).map(e=>e.alias),s=r.slice(0,8).join(", "),l=r.length>8?` + ${r.length-8} more`:"",i=0===r.length,o=i?`No nodes pass all ${e} pinned filters — release one to widen (Esc clears all)`:`${s}${l} — nodes passing all ${e} pinned filters`;return(0,a.jsx)("span",{"data-pin-intersection":!0,"data-pin-dim-count":e,"data-pin-intersection-count":r.length,"data-pin-intersection-empty":i?"true":"false","data-pin-intersection-aliases":r.join(","),className:"hidden sm:inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md font-mono text-xs border anet-fade-in",title:o,style:{background:i?el?"#d9770614":"#fbbf241f":el?"#94a3b814":"#94a3b81f",color:i?el?"#d97706":"#fbbf24":el?"#475569":"#9ca3af",borderColor:"currentColor"},children:(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"hidden sm:inline","data-pin-intersection-prefix":!0,children:"match: "}),e," pins",(0,a.jsxs)("span",{className:"opacity-70",children:[" · ",r.length]}),i&&(0,a.jsx)("span",{className:"ml-1","aria-hidden":!0,children:"⚠"})]})})})(),eM.length>1&&(0,a.jsx)("span",{className:"hidden sm:inline-flex items-center gap-2 px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20 font-mono",title:"Hover to highlight; click to pin",children:eM.map(e=>{let t=eK===e.initial,n=[...eg,...ey].filter(t=>{let a=m(t.model);return("unknown"===a.id?"?":a.initial)===e.initial}).map(e=>e.alias),r=n.slice(0,8).join(", "),s=n.length>8?` + ${n.length-8} more`:"",l=t?`${r}${s} — click again or Esc to clear`:`${r}${s} — click to pin`;return(0,a.jsxs)("span",{role:"button",tabIndex:0,"aria-pressed":t,className:"inline-flex items-baseline gap-0.5 px-1 rounded","data-vendor-letter":e.initial,"data-vendor-pinned":t?"true":"false","data-vendor-aliases":n.join(","),title:l,style:{cursor:"pointer",boxShadow:t?`inset 0 0 0 1px ${e.color}, inset 0 0 0 2px rgba(255,255,255,0.45)`:void 0},onMouseEnter:()=>eU(e.initial),onMouseLeave:()=>eU(t=>t===e.initial?null:t),onClick:()=>eG(t=>t===e.initial?null:e.initial),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),eG(t=>t===e.initial?null:e.initial))},children:[(0,a.jsx)("span",{style:{color:e.color},children:e.initial}),(0,a.jsxs)("span",{className:"text-gray-500",children:[":",e.count]})]},e.initial)})}),(D=null!==(B=ev.reduce((e,t)=>{if(!t.last_at)return e;let a=(0,h.parseHubTime)(t.last_at);return null===a?e:null===e||a>e?a:e},null))?(0,h.relativeAgo)(new Date(B).toISOString()):null,O=ev.slice(0,6).map(e=>`${e.from}→${e.to} (${e.count})`).join(", "),H=ev.length>6?` + ${ev.length-6} more`:"",Y=0===ev.length?void 0:`${O}${H} — hover brightens all`,(0,a.jsxs)("span",{className:"hidden sm:inline px-2.5 py-1 rounded-md bg-gray-500/10 text-gray-400 border border-gray-500/20","data-active-links-chip":!0,"data-active-links-flow-count":ev.length,title:Y,style:{cursor:ev.length>0?"pointer":void 0},onMouseEnter:()=>{ev.length>0&&eO(!0)},onMouseLeave:()=>eO(!1),children:[ev.length," active link",1===ev.length?"":"s",D?(0,a.jsxs)("span",{className:"text-gray-500",children:[" · last ",D]}):null]})),(0,a.jsx)(k,{sessions:e})]})]}),(0,a.jsxs)("div",{ref:e2,className:`relative overflow-hidden rounded-lg border shadow-2xl ${el?"shadow-zinc-900/5":"shadow-cyan-950/30"} ${e7?"flex items-center justify-center":""}`,style:{background:eo.containerBg,borderColor:eo.containerBorder},children:[(0,a.jsx)("div",{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r ${eo.topRailGradient}`}),(0,a.jsxs)("svg",{ref:e5,viewBox:"0 0 1000 680",className:"w-full h-auto block",preserveAspectRatio:"xMidYMid meet",onPointerDown:e=>{0===e.button&&(e.currentTarget.setPointerCapture?.(e.pointerId),e6.current={active:!0,startX:e.clientX,startY:e.clientY,baseX:e8.current.x,baseY:e8.current.y},ti(!0))},onPointerMove:e=>{let t=e6.current;if(!t.active)return;let a=e5.current;if(!a)return;let n=a.getBoundingClientRect(),r=(e.clientX-t.startX)/n.width*1e3,s=(e.clientY-t.startY)/n.height*680;e4(e=>({...e,x:t.baseX+r,y:t.baseY+s}))},onPointerUp:to,onPointerLeave:to,onDoubleClick:e=>{let t=e.target;t?.closest("g[data-node]")||tc()},style:{cursor:tl?"grabbing":"grab",touchAction:"none"},children:[(0,a.jsxs)("defs",{children:[(0,a.jsxs)("linearGradient",{id:"topo-panel",x1:"0",x2:"1",y1:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:eo.panelStops[0]}),(0,a.jsx)("stop",{offset:"48%",stopColor:eo.panelStops[1]}),(0,a.jsx)("stop",{offset:"100%",stopColor:eo.panelStops[2]})]}),(0,a.jsxs)("radialGradient",{id:"topo-radar",cx:"50%",cy:"50%",r:"55%",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:eo.radarStops[0].color,stopOpacity:eo.radarStops[0].opacity}),(0,a.jsx)("stop",{offset:"45%",stopColor:eo.radarStops[1].color,stopOpacity:eo.radarStops[1].opacity}),(0,a.jsx)("stop",{offset:"100%",stopColor:eo.radarStops[2].color,stopOpacity:eo.radarStops[2].opacity})]}),!el&&(0,a.jsxs)("filter",{id:"topo-glow",children:[(0,a.jsx)("feGaussianBlur",{stdDeviation:"4",result:"blur"}),(0,a.jsxs)("feMerge",{children:[(0,a.jsx)("feMergeNode",{in:"blur"}),(0,a.jsx)("feMergeNode",{in:"SourceGraphic"})]})]}),[{id:"topo-arrow-s",size:12},{id:"topo-arrow",size:16},{id:"topo-arrow-l",size:22}].map(e=>(0,a.jsx)("marker",{id:e.id,viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:e.size,markerHeight:e.size,markerUnits:"userSpaceOnUse",orient:"auto-start-reverse",children:(0,a.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:eo.arrowFill})},e.id)),(0,a.jsxs)("radialGradient",{id:"topo-sweep",cx:"0%",cy:"50%",r:"100%",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:el?"#0d9488":"#22d3ee",stopOpacity:el?.18:.32}),(0,a.jsx)("stop",{offset:"70%",stopColor:el?"#0d9488":"#22d3ee",stopOpacity:el?.1:.18}),(0,a.jsx)("stop",{offset:"100%",stopColor:el?"#0d9488":"#22d3ee",stopOpacity:"0"})]})]}),(0,a.jsx)("rect",{width:"1000",height:"680",fill:"url(#topo-panel)"}),(0,a.jsxs)("g",{transform:`translate(${e3.x} ${e3.y}) scale(${e3.zoom})`,children:["ring"===eh&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("circle",{cx:500,cy:330,r:"330",fill:"url(#topo-radar)",style:{pointerEvents:"none"}}),!el&&(0,a.jsx)("g",{opacity:"0.5",style:{pointerEvents:"none"},children:Array.from({length:28}).map((e,t)=>{let n=9301*t+49297;return(0,a.jsx)("circle",{cx:13*n%1e3,cy:7*n%680,r:t%3==0?1.2:.7,fill:"#a5b4fc",opacity:.35+t%4*.05},t)})}),(0,a.jsx)("g",{style:{transformOrigin:"500px 330px",transformBox:"view-box",pointerEvents:"none"},className:"anet-topo-sweep",opacity:el?.7:1,children:(0,a.jsx)("path",{d:`M 500 330 L 830 330 A 330 330 0 0 0 ${500+330*Math.cos(-Math.PI/4.5)} ${330+330*Math.sin(-Math.PI/4.5)} Z`,fill:"url(#topo-sweep)"})}),[90,170,250,330].map(e=>(0,a.jsx)("circle",{cx:500,cy:330,r:e,fill:"none",stroke:eo.ringStroke,strokeWidth:"1",opacity:el?.6:.35},e)),(X=eg.length>14?[145,215,285]:eg.length>8?[175,260]:eg.length>0?[220]:[],K=(U=!!(eZ||eA||eK))?eo.legendAccent:eo.ringStroke,X.map(e=>{let t=eg.reduce((t,a)=>{let n=eb[a.alias];return n&&15>Math.abs(Math.hypot(n.x-500,n.y-330)-e)?t+1:t},0);if(0===t)return null;let n=t<=2?0:t<=6?1:2,r=[.24,.36,.5][n],s=[.32,.46,.62][n];return(0,a.jsx)("circle",{cx:500,cy:330,r:e,fill:"none",stroke:K,strokeWidth:"0.7",strokeDasharray:"2 8",opacity:el?r:s,style:{pointerEvents:"none",transition:"stroke 200ms ease-out"},"data-tier-ring":e,"data-tier-occupancy":t,"data-tier-bucket":n,"data-tier-tinted":U?"true":"false"},`tier-${e}`)})),!el&&(J=[16,14,12,10][G=0===eS?0:eS<=2?1:eS<=5?2:3],[0,.25,.5,.75].map((e,t)=>(0,a.jsx)("g",{"data-topo-orbit-bucket":G,"data-topo-orbit-dur":J,children:(0,a.jsx)("circle",{cx:830,cy:330,r:0===t?2.8:2.2,fill:"#22d3ee",opacity:.9,filter:"url(#topo-glow)",children:(0,a.jsx)("animateTransform",{attributeName:"transform",type:"rotate",from:`${360*e} 500 330`,to:`${360*e+360} 500 330`,dur:`${J}s`,repeatCount:"indefinite"})})},`orbit-${t}`))),[0,30,60,90,120,150].map(e=>(0,a.jsx)("line",{x1:500-360*Math.cos(e*Math.PI/180),y1:330-360*Math.sin(e*Math.PI/180),x2:500+360*Math.cos(e*Math.PI/180),y2:330+360*Math.sin(e*Math.PI/180),stroke:eo.ringStroke,strokeWidth:"1",opacity:el?.35:.18},e))]}),"ring"===eh&&eg.map((e,t)=>{let n=eb[e.alias];if(!n)return null;let r=v({x:500,y:330},n,0),s=ej.has(e.alias);return(0,a.jsx)("path",{d:r,fill:"none",stroke:s?eo.spokeStroke.active:eo.spokeStroke.idle,strokeWidth:s?2:1,strokeDasharray:s?"none":"6 14",opacity:s?.7:.45,className:s?void 0:"anet-topo-spoke-flow",style:s?void 0:{animationDelay:`${-(.25*t)}s`}},`hub-${e.alias}`)}),ew.map(e=>{let t,n,r,s,l=eT===e.key,i=eA===e.key,o=e.statuses.working,d=o>=6?8:o>=4?10:o>=2?12:14;return(0,a.jsxs)("g",{"data-group":e.key,className:"transition-opacity",style:{opacity:!eT||l?1:.28},children:[(0,a.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:"14",fill:el?"#0f172a":"#a5b4fc",fillOpacity:i?el?.08:.13:l?el?.05:.09:el?.025:.045,stroke:i||l?eo.legendAccent:eo.ringStroke,strokeWidth:i?3:l?2:1.5,strokeDasharray:i||l?"none":"6 6","data-group-box-pinned":i?"true":"false","data-group-box-live":i||l||!(e.statuses.working>0)?"false":"true","data-group-box-march-dur":d,className:i||l||!(e.statuses.working>0)?void 0:"anet-topo-groupbox-live",style:{transition:"stroke 200ms ease-out, stroke-width 200ms ease-out, fill-opacity 200ms ease-out",pointerEvents:"none",...{"--march-dur":`${d}s`}}}),(0,a.jsxs)("g",{role:"button",tabIndex:0,"aria-pressed":eA===e.key,"data-group-label-hit":e.key,style:{pointerEvents:"all",cursor:"pointer"},onPointerDown:e=>e.stopPropagation(),onClick:()=>eL(t=>t===e.key?null:e.key),onPointerEnter:()=>ez(e.key),onPointerLeave:()=>ez(t=>t===e.key?null:t),children:[(n=(t=Object.entries(ek).filter(([,t])=>t===e.key).map(([e])=>e)).slice(0,8).join(", "),r=t.length>8?` + ${t.length-8} more`:"",s=[e.statuses.working>0?`${e.statuses.working} working`:null,e.statuses.idle>0?`${e.statuses.idle} idle`:null,e.statuses.offline>0?`${e.statuses.offline} offline`:null].filter(Boolean).join(" · "),(0,a.jsx)("title",{children:[`${e.key} (${t.length} member${1===t.length?"":"s"})`,s||null,`${n}${r}`,eA===e.key?"click to release pin":"click to pin this group"].filter(Boolean).join("\n")})),(0,a.jsx)("rect",{x:e.x+6,y:e.y+2,width:Math.min(e.w-12,240),height:20,rx:"4",fill:eA===e.key||eE===e.key?eo.legendAccent:"transparent",opacity:eA===e.key?el?.16:.2:eE===e.key?el?.09:.13:1,"data-group-label-tinted":eA===e.key?"pinned":eE===e.key?"hover":"none",style:{transition:"fill 150ms ease-out, opacity 150ms ease-out"}}),(0,a.jsxs)("text",{x:e.x+12,y:e.y+14,fill:l?eo.legendHeadline:eo.legendText,fontSize:"13",fontFamily:"monospace",fontWeight:"700",style:{transition:"fill 200ms ease-out"},"data-group-label":e.key,children:[e.key,(0,a.jsxs)("tspan",{dx:"6",fill:eo.legendText,fontSize:"11",fontWeight:"400",children:["· ",e.count]}),e.statuses.working>0&&(0,a.jsxs)("tspan",{dx:"8",fill:el?"#059669":"#22c55e",fontSize:"11",fontWeight:"600",children:[e.statuses.working,"w"]}),e.statuses.idle>0&&(0,a.jsxs)("tspan",{dx:"4",fill:el?"#0d9488":"#2dd4bf",fontSize:"11",fontWeight:"600",children:[e.statuses.idle,"i"]}),e.statuses.offline>0&&(0,a.jsxs)("tspan",{dx:"4",fill:el?"#94a3b8":"#6b7280",fontSize:"11",fontWeight:"600",children:[e.statuses.offline,"o"]})]})]})]},`grp-${e.key}`)}),ev.map((e,t)=>{let n,r,s,l,i,o,d,c,u,x,f=eb[e.from],p=eb[e.to];if(!f||!p)return null;let m=(t%2==0?1:-1)*Math.min(36,.18*Math.hypot(p.x-f.x,p.y-f.y)),g=v(f,p,m),y=Math.min(2+e.count,7),b=Math.max(.9,2.6/Math.sqrt(e.count)),j=Math.max(.35,1-(e.last_at?Math.max(0,Date.now()-Date.parse(e.last_at)):0)/3e5),k=e.count<=2?"topo-arrow-s":e.count<=4?"topo-arrow":"topo-arrow-l",w=(0,h.relativeAgo)(e.last_at),N=`${e.from} → ${e.to}
4
4
  ${e.count} message${1===e.count?"":"s"}${w?` \xb7 last ${w}`:""}`,S=eB===e.key,M=ek[e.from]??e.from,C=ek[e.to]??e.to,_=S?2:eB?.35:e_||eT?e.from===e_||e.to===e_?1.7:eT&&M===eT&&C===eT?1.3:.35:eD?1.5:1,$=S?Math.min(1.4*y,10):y;return(0,a.jsxs)("g",{children:[(0,a.jsx)("path",{d:g,fill:"none",stroke:"transparent",strokeWidth:Math.max(y+10,16),style:{pointerEvents:"stroke"},"data-edge-hitbox":!0,onMouseEnter:()=>eI(e.key),onMouseLeave:()=>eI(t=>t===e.key?null:t),children:(0,a.jsx)("title",{children:N})}),(0,a.jsx)("path",{d:g,fill:"none",stroke:eo.flowEdge,strokeWidth:$,opacity:Math.min(1,(el?.22:.28)*j*_),filter:el?void 0:"url(#topo-glow)",markerEnd:`url(#${k})`,className:"transition-opacity duration-300",style:{pointerEvents:"none"}}),(0,a.jsx)("path",{id:`flow-path-${t}`,d:g,fill:"none",stroke:eo.flowPath,strokeWidth:"1",strokeDasharray:"2 12",opacity:Math.min(1,(el?.4:.75)*j*_),className:"transition-opacity duration-300"}),!ei&&(0,a.jsx)("circle",{r:"4",fill:eo.flowParticle,filter:el?void 0:"url(#topo-glow)",opacity:Math.min(1,j*_),children:(0,a.jsx)("animateMotion",{dur:`${b}s`,begin:`-${(.37*t%b).toFixed(3)}s`,repeatCount:"indefinite",path:g})}),!ei&&j>.5&&(0,a.jsxs)("circle",{cx:p.x,cy:p.y,r:"0",fill:"none",stroke:eo.flowEdge,strokeWidth:"1.5",opacity:"0",style:{pointerEvents:"none"},"data-arrival-ping":e.key,children:[(0,a.jsx)("animate",{attributeName:"r",values:"0;14;22",dur:`${b}s`,begin:`-${(.92*b).toFixed(2)}s`,repeatCount:"indefinite"}),(0,a.jsx)("animate",{attributeName:"opacity",values:"0;0.55;0",dur:`${b}s`,begin:`-${(.92*b).toFixed(2)}s`,repeatCount:"indefinite"})]}),!ei&&j>.5&&e.count>=3&&(0,a.jsxs)("circle",{cx:f.x,cy:f.y,r:"0",fill:"none",stroke:eo.flowEdge,strokeWidth:"1.5",opacity:"0",style:{pointerEvents:"none"},"data-dispatch-pulse":e.key,children:[(0,a.jsx)("animate",{attributeName:"r",values:"0;12;18",dur:`${b}s`,begin:"0s",repeatCount:"indefinite"}),(0,a.jsx)("animate",{attributeName:"opacity",values:"0;0.45;0",dur:`${b}s`,begin:"0s",repeatCount:"indefinite"})]}),e.count>=3&&(n=(f.x+p.x)/2,r=(f.y+p.y)/2,s=p.x-f.x,i=Math.hypot(s,l=p.y-f.y)||1,o=n+-l/i*m*.5,d=r+s/i*m*.5,c=Math.min(1,j*_),u=eW===e.key,x=e.count>=10,(0,a.jsxs)("g",{"data-edge-count-badge":e.key,"data-edge-count-badge-pinned":u?"true":"false","data-edge-count-badge-hot":x?"true":"false",role:"button",tabIndex:0,"aria-pressed":u,style:{pointerEvents:"all",cursor:"pointer"},opacity:c,onPointerDown:e=>e.stopPropagation(),onMouseEnter:()=>eI(e.key),onMouseLeave:()=>eI(t=>t===e.key?null:t),onClick:t=>{t.stopPropagation(),eR(t=>t===e.key?null:e.key)},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),eR(t=>t===e.key?null:e.key))},children:[(0,a.jsx)("title",{children:u?`${e.from} → ${e.to} (${e.count}) — click to release pin`:`${e.from} → ${e.to} (${e.count}) — click to pin`}),(0,a.jsx)("circle",{cx:o,cy:d,r:"9",fill:eo.legendBox.fill,stroke:u?eo.legendHeadline:x?el?"#d97706":"#fbbf24":eo.flowEdge,strokeWidth:u||x?2:1,opacity:el?.95:.82}),(0,a.jsx)("text",{x:o,y:d+3,textAnchor:"middle",fill:eo.legendHeadline,fontSize:"10",fontFamily:"monospace",fontWeight:"700",style:{pointerEvents:"none"},children:e.count})]}))]},e.key)}),"ring"===eh&&(0,a.jsxs)("g",{"data-topo-hub":!0,"data-topo-hub-hovered":eH?"true":"false",style:{cursor:"pointer"},onPointerDown:e=>e.stopPropagation(),onMouseEnter:()=>eY(!0),onMouseLeave:()=>eY(!1),onClick:()=>{tu(),tn({ts:Date.now(),x:500,y:330,r0:18,color:el?"#059669":"#10b981"}),setTimeout(()=>tn(e=>e&&500===e.x&&330===e.y?null:e),600)},children:[(0,a.jsx)("title",{children:(V=e.length,q=["Network hub",`${V} session${1===V?"":"s"}`],eg.length>0&&q.push(`${eg.length} online`),eS>0&&q.push(`${eS} working`),ev.length>0&&q.push(`${ev.length} active link${1===ev.length?"":"s"}`),q.join(" · ")+"\nclick to fit view")}),(Q=[.52,.58,.65,.72][Z=0===eS?0:eS<=2?1:eS<=5?2:3],ee=[.16,.2,.26,.32][Z],et=[4,3.2,2.7,2.4][Z],ea=`0.32;${Q};0.32`,en=`0.08;${ee};0.08`,(0,a.jsx)("circle",{cx:500,cy:330,r:"18",fill:el?"#d1fae5":"#10b981",opacity:el?.42:.12,"data-hub-busyness":Z,children:!ei&&(0,a.jsx)("animate",{attributeName:"opacity",values:el?ea:en,dur:`${et}s`,repeatCount:"indefinite"})})),(0,a.jsx)("circle",{cx:500,cy:330,r:"10",fill:el?"#059669":"#10b981"}),eS>0?(0,a.jsx)("text",{x:500,y:330,textAnchor:"middle",dy:"0.36em",fill:el?"#d1fae5":"#ecfdf5",fontSize:"11",fontFamily:"monospace",fontWeight:"700",style:{pointerEvents:"none"},"data-topo-hub-working-count":eS,children:eS}):(0,a.jsx)("circle",{cx:500,cy:330,r:"5",fill:"#d1fae5",opacity:"0.9","data-topo-hub-highlight":!0}),(0,a.jsx)("circle",{cx:500,cy:330,r:"14",fill:"none",stroke:el?"#059669":"#10b981",strokeWidth:"1.5",opacity:eH?el?.85:.7:0,"data-topo-hub-hover-ring":!0,style:{pointerEvents:"none",transition:"opacity 180ms ease-out"}})]}),[...eg,...ey].map((e,n)=>{let r,s,l,i,o,c=eb[e.alias];if(!c)return null;let u=(e.network_id?t[`${e.network_id}:${e.alias}`]:void 0)??t[e.alias],x="offline"!==e.status||!!u,f=w(e,x,el),p=ej.has(e.alias),g=Math.round((x?26:18)*ep),b=!eC||e_===e.alias||e3.zoom>=1.4,v=!eT||(ek[e.alias]??e.alias)===eT,k=0;if("ring"===eh){let t=eb[e.alias];if(t){let e=Math.hypot(t.x-500,t.y-330);k=e<195?0:e<270?1:e<310?2:3}}return(0,a.jsxs)("g",{"data-node":e.alias,"data-tier-idx":"ring"===eh?k:-1,className:"group transition-opacity anet-fade-in",style:{cursor:"pointer",opacity:e1&&!e1.has(e.alias)&&te!==e.alias||eJ&&te!==e.alias&&("unknown"===(r=m(e.model)).id?"?":r.initial)!==eJ||e0&&te!==e.alias&&!("working"===e0?"working"===e.status:"idle"===e0?x&&"working"!==e.status:!x)?.28:v?te===e.alias||x?1:.6:.32,animationDelay:"ring"===eh?`${180*k+n%6*25}ms`:`${25*Math.min(n,24)}ms`,transform:ei||e_!==e.alias?void 0:"translateY(-2px)",transition:"transform 180ms cubic-bezier(0.4,0,0.2,1)"},onPointerDown:e=>e.stopPropagation(),onPointerEnter:()=>e$(e.alias),onPointerLeave:()=>e$(t=>t===e.alias?null:t),onClick:()=>{tt(e.alias),tn({ts:Date.now(),x:c.x,y:c.y,r0:g,color:f.primary}),setTimeout(()=>tn(e=>e&&Date.now()-e.ts>=590?null:e),600)},children:[(()=>{var t,n;let r,s,l,i=!x&&e.last_seen_at?(0,h.relativeAgo)(e.last_seen_at):null,o=ek[e.alias],d=o?Object.values(ek).filter(e=>e===o).length:1,c=d>1?`group: ${o} \xb7 ${d}`:null,u=0,f=0;for(let t of ev)t.from===e.alias&&(f+=t.count),t.to===e.alias&&(u+=t.count);let p=u+f>0?`flows: ${u} in / ${f} out`:null;return(0,a.jsx)("title",{children:[`${e.alias} \xb7 ${e.status}`,(t=e.model,n=e.runtime,r=m(t),s=y(n),l=[],"unknown"!==r.id&&l.push(r.label),t&&l.push(t),s&&l.push(s.label),l.join(" · ")),c,e.project_dir?`cwd: ${e.project_dir}`:null,i?`last seen: ${i}`:null,p].filter(Boolean).join("\n")})})(),(0,a.jsx)("circle",{cx:c.x,cy:c.y,r:g+12,fill:"none",stroke:f.primary,strokeWidth:"2",className:"opacity-0 group-hover:opacity-70 transition-opacity duration-150",style:{pointerEvents:"none"}}),te===e.alias&&(0,a.jsx)("circle",{cx:c.x,cy:c.y,r:g+14,fill:"none",stroke:f.primary,strokeWidth:"2.5",opacity:el?.85:.95,filter:el?void 0:"url(#topo-glow)",className:"transition-opacity duration-200",style:{pointerEvents:"none"},"data-chat-target-ring":!0,"data-chat-target-breath":ei?"off":"on",children:!ei&&(0,a.jsx)("animate",{attributeName:"opacity",values:el?"0.72;0.95;0.72":"0.82;1;0.82",dur:"3s",repeatCount:"indefinite"})}),p&&!ei&&(0,a.jsxs)("circle",{cx:c.x,cy:c.y,r:g+14,fill:f.primary,opacity:el?.08:.12,children:[(0,a.jsx)("animate",{attributeName:"r",values:`${g+8};${g+22};${g+8}`,dur:"2.4s",repeatCount:"indefinite"}),(0,a.jsx)("animate",{attributeName:"opacity",values:el?"0.12;0.02;0.12":"0.18;0.04;0.18",dur:"2.4s",repeatCount:"indefinite"})]}),(0,a.jsx)("circle",{cx:c.x,cy:c.y,r:g+8,fill:f.halo,opacity:x?el?.85:.65:el?.4:.25,className:"transition-[fill,opacity] duration-300 ease-out","data-node-halo-breath":ei||"working"!==e.status?"off":"on",children:!ei&&"working"===e.status&&(0,a.jsx)("animate",{attributeName:"opacity",values:el?"0.73;0.92;0.73":"0.53;0.78;0.53",dur:"3s",repeatCount:"indefinite"})}),e1&&e1.has(e.alias)&&(0,a.jsx)("circle",{cx:c.x,cy:c.y,r:g+7,fill:"none",stroke:eo.flowEdge,strokeWidth:1.5,opacity:el?.9:.85,"data-edge-endpoint-ring":!0,style:{pointerEvents:"none",transition:"opacity 180ms ease-out"}}),(0,a.jsx)("circle",{cx:c.x,cy:c.y,r:g,fill:x?eo.nodeFill.online:eo.nodeFill.offline,stroke:f.primary,strokeWidth:x?3:1.5,strokeDasharray:x?"none":"5 5",filter:x&&!el?"url(#topo-glow)":void 0,className:"transition-[fill,stroke] duration-300 ease-out"}),(()=>{let t=Math.round((x?14:10)*ep),n=2*g,r=m(e.model),s=/书生|书小生|intern/i.test(e.alias);if(ed||s||r.logo)return(0,a.jsx)("image",{href:r.logo??"/intern_avatar.png",x:c.x-n/2,y:c.y-n/2,width:n,height:n,preserveAspectRatio:"xMidYMid meet"});if("unknown"!==r.id)return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("circle",{cx:c.x,cy:c.y,r:t,fill:r.mono.bg,stroke:r.mono.ring,strokeWidth:"1"}),(0,a.jsx)("text",{x:c.x,y:c.y,dy:"0.34em",textAnchor:"middle",fill:r.mono.text,fontSize:t,fontFamily:"monospace",fontWeight:"700",children:r.initial})]});let l=(0,d.aliasAvatarColors)(ek[e.alias]||e.alias);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("circle",{cx:c.x,cy:c.y,r:t,fill:l.bg,stroke:l.ring,strokeWidth:"1"}),(0,a.jsx)("text",{x:c.x,y:c.y,dy:"0.34em",textAnchor:"middle",fill:l.text,fontSize:t,fontFamily:"monospace",fontWeight:"700",children:(0,d.aliasInitial)(e.alias)})]})})(),(()=>{let t=y(e.runtime);if(!t)return null;let n=x?7:5.5,r=c.x+.72*g,s=c.y+.72*g,l=2*n*.62;return(0,a.jsxs)("g",{style:{pointerEvents:"none"},children:[(0,a.jsx)("circle",{cx:r,cy:s,r:n,fill:eo.containerBg,stroke:t.color,strokeWidth:"1.5"}),(0,a.jsx)("g",{transform:`translate(${r-l/2} ${s-l/2}) scale(${l/24})`,children:(0,a.jsx)("path",{d:t.iconPath,fill:"none",stroke:t.color,strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})]})})(),"working"===e.status&&(l=(s=u??0)>=4?"0.7s":s>=2?"0.9s":"1.2s",(0,a.jsx)("circle",{cx:c.x,cy:c.y-(g-6),r:"2.5",fill:eo.flowParticle,"data-pulse-dur":l,opacity:ei?.6:void 0,children:!ei&&(0,a.jsx)("animate",{attributeName:"opacity",values:"1;0.25;1",dur:l,repeatCount:"indefinite"})})),(o=(i=ep<.8)?88:100,b?(0,a.jsxs)("g",{transform:`translate(${c.x}, ${c.y+g+(i?18:22)})`,style:{pointerEvents:"none"},className:"transition-transform duration-200 group-hover:-translate-y-[1.5px]",children:[(0,a.jsx)("rect",{x:-o/2,y:i?-12:-14,width:o,height:i?36:42,rx:"6",fill:eo.labelBox.fill,stroke:eo.labelBox.stroke,opacity:el?1:.94}),(0,a.jsx)("text",{x:"0",y:"1",textAnchor:"middle",fill:f.text,fontSize:i?11:12,fontFamily:"monospace",fontWeight:"700",children:j(e.alias,i?11:12)}),(0,a.jsxs)("text",{x:"0",y:i?15:17,textAnchor:"middle",fill:f.primary,fontSize:i?8:9,fontFamily:"monospace",children:[f.label,x&&null!=u?` sse:${u}`:""]})]}):(0,a.jsx)("text",{x:c.x,y:c.y+g+(i?12:14),textAnchor:"middle",fill:f.text,fontSize:i?9:10,fontFamily:"monospace",fontWeight:"700",opacity:.9,className:"transition-transform duration-200 group-hover:-translate-y-[1.5px]",style:{pointerEvents:"none",paintOrder:"stroke"},stroke:eo.containerBg,strokeWidth:"3",children:j(e.alias,i?9:10)}))]},e.alias)}),ta&&!ei&&(0,a.jsxs)("circle",{cx:ta.x,cy:ta.y,r:ta.r0+4,fill:"none",stroke:ta.color,strokeWidth:"2",opacity:"0",style:{pointerEvents:"none"},children:[(0,a.jsx)("animate",{attributeName:"r",values:`${ta.r0+4};${ta.r0+30}`,dur:"0.5s",fill:"freeze"}),(0,a.jsx)("animate",{attributeName:"opacity",values:"0.7;0",dur:"0.5s",fill:"freeze"})]},ta.ts)]}),(0,a.jsxs)("g",{transform:"translate(16, 16)",children:[(0,a.jsx)("rect",{x:"0",y:"0",width:"230",height:"84",rx:"10",fill:eo.legendBox.fill,stroke:eo.legendBox.stroke,opacity:el?.97:.92,style:{filter:el?"drop-shadow(0 2px 6px rgba(15,23,42,0.08))":"drop-shadow(0 2px 6px rgba(0,0,0,0.45))"},"data-topo-panel-elevation":"recent"}),(0,a.jsx)("text",{x:"13",y:"21",fill:eo.legendHeadline,fontSize:"12",fontFamily:"monospace",fontWeight:"700",children:"recent signal"}),(er=ev.filter(e=>e.count>=10).length,(0,a.jsxs)("text",{x:"217",y:"21",textAnchor:"end",fontSize:"10",fontFamily:"monospace",children:[(0,a.jsxs)("tspan",{fill:eo.legendAccent,"data-recent-panel-count":!0,children:[ev.length," flows"]}),er>0&&(0,a.jsxs)("tspan",{fill:el?"#d97706":"#fbbf24",fontWeight:"700","data-recent-panel-hot-count":er,children:[" · ",er," hot"]})]})),0===ev.length?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("text",{x:"115",y:"54",textAnchor:"middle",fill:eo.legendText,fontSize:"10",fontFamily:"monospace",fontStyle:"italic",opacity:.65,"data-recent-signal-empty":!0,children:"no flow yet"}),(0,a.jsx)("text",{x:"115",y:"68",textAnchor:"middle",fill:eo.legendText,fontSize:"8",fontFamily:"monospace",opacity:.45,"data-recent-signal-empty-hint":!0,children:"send a message between agents"})]}):ev.slice(0,3).map((e,t)=>{let n=e.last_at?(0,h.relativeAgo)(e.last_at):null,r=n?n.replace(/\s+ago$/,""):null,s=eF===e.key,l=eW===e.key,i=s||l,o=e.count>=10;return(0,a.jsxs)("g",{"data-recent-row":e.key,"data-recent-row-hovered":s?"true":"false","data-recent-row-pinned":l?"true":"false","data-recent-row-hot":o?"true":"false",role:"button",tabIndex:0,"aria-pressed":l,style:{cursor:"pointer"},onPointerDown:e=>e.stopPropagation(),onMouseEnter:()=>eI(e.key),onMouseLeave:()=>eI(t=>t===e.key?null:t),onClick:()=>eR(t=>t===e.key?null:e.key),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),eR(t=>t===e.key?null:e.key))},children:[(0,a.jsx)("rect",{x:"6",y:38+16*t-10,width:"218",height:"14",rx:"3",fill:i?eo.legendAccent:"transparent",opacity:l?el?.18:.22:s?el?.1:.14:1,style:{transition:"fill 150ms ease-out, opacity 150ms ease-out"}}),(0,a.jsxs)("text",{x:"13",y:38+16*t,fill:i?eo.legendHeadline:eo.legendText,fontSize:"9",fontFamily:"monospace",style:{transition:"fill 150ms ease-out"},children:[j(e.from,6)," ","->"," ",j(e.to,6)," ","/ ",o?(0,a.jsx)("tspan",{fill:el?"#d97706":"#fbbf24",fontWeight:"700","data-recent-row-count-hot":!0,children:e.count}):(0,a.jsx)("tspan",{"data-recent-row-count":!0,children:e.count})," / ",j(e.content,8)]}),r?(0,a.jsx)("text",{x:"217",y:38+16*t,textAnchor:"end",fill:eo.legendText,fontSize:"8",fontFamily:"monospace",opacity:.55,"data-recent-row-ts":e.key,style:{pointerEvents:"none"},children:r}):null]},e.key)}),ev.length>3&&(0,a.jsxs)("text",{x:"115",y:"82",textAnchor:"middle",fill:eo.legendText,fontSize:"8",fontFamily:"monospace",fontStyle:"italic",opacity:.55,"data-recent-panel-more":ev.length-3,children:["+ ",ev.length-3," more flow",ev.length-3==1?"":"s"]})]}),(0,a.jsxs)("g",{transform:"translate(760, 16)",children:[(0,a.jsx)("rect",{x:"0",y:"0",width:"224",height:"104",rx:"10",fill:eo.legendBox.fill,stroke:eo.legendBox.stroke,opacity:el?.97:.92,style:{filter:el?"drop-shadow(0 2px 6px rgba(15,23,42,0.08))":"drop-shadow(0 2px 6px rgba(0,0,0,0.45))"},"data-topo-panel-elevation":"legend"}),(0,a.jsx)("text",{x:"13",y:"21",fill:eo.legendHeadline,fontSize:"12",fontFamily:"monospace",fontWeight:"700",children:"legend"}),(0,a.jsxs)("text",{x:"215",y:"21",textAnchor:"end",fill:eo.legendAccent,fontSize:"10",fontFamily:"monospace","data-legend-panel-count":!0,children:[e.length," node",1===e.length?"":"s"]}),(es=eg.length-eS,[{key:"working",y0:32,y1:36,fill:el?"#059669":"#22c55e",label:"working node",count:eS},{key:"idle",y0:56,y1:60,fill:el?"#0d9488":"#2dd4bf",label:"online idle",count:es},{key:"offline",y0:80,y1:84,fill:el?"#94a3b8":"#6b7280",label:"offline / no SSE",count:ey.length}]).map(e=>{let t=eZ===e.key;return(0,a.jsxs)("g",{"data-legend-status":e.key,role:"button",tabIndex:0,"aria-pressed":t,style:{cursor:"pointer"},onPointerDown:e=>e.stopPropagation(),onMouseEnter:()=>eq(e.key),onMouseLeave:()=>eq(t=>t===e.key?null:t),onClick:()=>eQ(t=>t===e.key?null:e.key),children:[(0,a.jsx)("rect",{x:"6",y:e.y0-12,width:"170",height:"22",rx:"3",fill:eV===e.key||t?e.fill:"transparent",opacity:t?el?.14:.18:eV===e.key?el?.08:.12:1,"data-legend-row-tinted":t?"pinned":eV===e.key?"hover":"none",style:{transition:"fill 150ms ease-out, opacity 150ms ease-out"}}),(0,a.jsx)("circle",{cx:"16",cy:e.y0,r:"5.5",fill:e.fill}),t&&(0,a.jsx)("circle",{cx:"16",cy:e.y0,r:"8",fill:"none",stroke:e.fill,strokeWidth:"1.5"}),(0,a.jsx)("text",{x:"30",y:e.y1,fill:eV===e.key||t?eo.legendHeadline:eo.legendText,fontSize:"11",fontFamily:"monospace",style:{transition:"fill 150ms ease-out"},children:e.label}),(0,a.jsx)("text",{x:"215",y:e.y1,textAnchor:"end",fill:eo.legendText,fontSize:"11",fontFamily:"monospace",opacity:eV===e.key||t?.95:.65,"data-legend-count":e.key,style:{pointerEvents:"none",transition:"opacity 150ms ease-out"},children:e.count})]},e.key)}),(0,a.jsx)("path",{d:"M140,80 Q164,56 196,80",fill:"none",stroke:eo.flowEdge,strokeWidth:"3",markerEnd:"url(#topo-arrow)",style:{pointerEvents:"none"}})]})]}),(()=>{if(.01>Math.abs(e3.zoom-1)&&1>Math.abs(e3.x)&&1>Math.abs(e3.y)||eg.length+ey.length===0)return null;let e=-e3.x/e3.zoom*.12,n=-e3.y/e3.zoom*.12058823529411765,r=1e3/e3.zoom*.12,s=680/e3.zoom*.12058823529411765;return(0,a.jsx)("div",{className:"absolute right-3 rounded-md border shadow-lg shadow-black/30 overflow-hidden anet-fade-in",style:{bottom:56,background:eo.legendBox.fill,borderColor:eo.containerBorder,cursor:"crosshair"},role:"img","aria-label":"Topology minimap — click to recenter",title:"Minimap · click to recenter",onClick:e=>{let t=e.currentTarget.getBoundingClientRect(),a=(e.clientX-t.left)/t.width,n=(e.clientY-t.top)/t.height;e4(e=>({...e,x:500-1e3*a*e.zoom,y:340-680*n*e.zoom}))},"data-topo-minimap":!0,children:(0,a.jsxs)("svg",{width:120,height:82,viewBox:"0 0 120 82",style:{display:"block"},children:[[...eg,...ey].map(e=>{let n=eb[e.alias];if(!n)return null;let r=(e.network_id?t[`${e.network_id}:${e.alias}`]:void 0)??t[e.alias],s="offline"!==e.status||!!r,l=w(e,s,el);return(0,a.jsx)("circle",{cx:.12*n.x,cy:.12058823529411765*n.y,r:s?1.7:1.2,fill:l.primary,opacity:s?.9:.5},e.alias)}),(0,a.jsx)("rect",{x:Math.max(0,e),y:Math.max(0,n),width:Math.max(0,Math.min(120-Math.max(0,e),r)),height:Math.max(0,Math.min(82-Math.max(0,n),s)),fill:"none",stroke:eo.legendAccent,strokeWidth:"1",opacity:"0.9"})]})})})(),(0,a.jsxs)("div",{className:"absolute bottom-3 right-3 flex items-center gap-1.5 text-xs select-none",children:[(0,a.jsx)("div",{className:"flex items-center rounded-md border overflow-hidden",style:{background:eo.legendBox.fill,borderColor:eo.containerBorder},role:"group","aria-label":"Node size",children:[["S",.7],["M",.84],["L",1]].map(([e,t],n)=>(0,a.jsx)("button",{onClick:()=>(e=>{em(e);try{localStorage.setItem("anet-topo-nodescale",String(e))}catch{}})(t),"aria-pressed":ep===t,title:`Node size: ${"S"===e?"small":"M"===e?"medium":"large"}`,className:`px-2 py-1 transition-colors ${n>0?"border-l":""} ${ep===t?"bg-cyan-500/15 text-cyan-300":"hover:bg-white/5"}`,style:{color:ep===t?void 0:eo.legendText,borderColor:eo.containerBorder},children:e},e))}),(0,a.jsxs)("div",{className:"flex items-center rounded-md border overflow-hidden",style:{background:eo.legendBox.fill,borderColor:eo.containerBorder},children:[(0,a.jsx)("button",{onClick:()=>td(1/1.2),className:"px-2 py-1 hover:bg-white/5 transition-colors",style:{color:eo.legendText},"aria-label":"Zoom out",title:"Zoom out (−)",children:(0,a.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":!0,children:(0,a.jsx)("path",{d:"M5 12h14"})})}),(0,a.jsxs)("span",{className:"px-2 py-1 tabular-nums border-x text-center",style:{color:eo.legendText,borderColor:eo.containerBorder,minWidth:46},title:"Current zoom level",children:[Math.round(100*e3.zoom),"%"]}),(0,a.jsx)("button",{onClick:()=>td(1.2),className:"px-2 py-1 hover:bg-white/5 transition-colors",style:{color:eo.legendText},"aria-label":"Zoom in",title:"Zoom in (+)",children:(0,a.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":!0,children:(0,a.jsx)("path",{d:"M12 5v14M5 12h14"})})})]}),(0,a.jsx)("button",{onClick:tc,className:"p-1.5 rounded-md border hover:bg-white/5 transition-colors",style:{background:eo.legendBox.fill,borderColor:eo.containerBorder,color:eo.legendText},"aria-label":"Reset view",title:"Reset zoom + pan (0, or double-click the canvas)",children:(0,a.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,a.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9 9 0 0 0-6.4 2.6L3 8"}),(0,a.jsx)("path",{d:"M3 3v5h5"})]})}),(0,a.jsx)("button",{onClick:()=>{let e=e2.current;if(e)if(document.fullscreenElement)document.exitFullscreen?.();else{let t=e.requestFullscreen||e.webkitRequestFullscreen;t?.call(e)}},className:"p-1.5 rounded-md border hover:bg-white/5 transition-colors",style:{background:eo.legendBox.fill,borderColor:eo.containerBorder,color:eo.legendText},"aria-label":e7?"Exit fullscreen":"Enter fullscreen",title:e7?"Exit fullscreen":"Fullscreen",children:e7?(0,a.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,a.jsx)("path",{d:"M8 3v4a1 1 0 0 1-1 1H3M21 8h-4a1 1 0 0 1-1-1V3M3 16h4a1 1 0 0 1 1 1v4M16 21v-4a1 1 0 0 1 1-1h4"})}):(0,a.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,a.jsx)("path",{d:"M3 8V5a2 2 0 0 1 2-2h3M21 8V5a2 2 0 0 0-2-2h-3M3 16v3a2 2 0 0 0 2 2h3M21 16v3a2 2 0 0 1-2 2h-3"})})})]}),te&&(0,a.jsx)(x,{alias:te,onClose:()=>tt(null)})]})]})}let E={working:{bg:"bg-green-900/30 border-green-800/30",text:"text-green-300",dot:"bg-green-500",glow:"shadow-green-500/10"},idle:{bg:"bg-cyan-900/30 border-cyan-800/30",text:"text-cyan-300",dot:"bg-cyan-400",glow:"shadow-cyan-500/5"},blocked:{bg:"bg-yellow-900/30 border-yellow-800/30",text:"text-yellow-300",dot:"bg-yellow-500",glow:""},error:{bg:"bg-red-900/30 border-red-800/30",text:"text-red-300",dot:"bg-red-500",glow:""}},z={bg:"bg-gray-800/50 border-gray-700/30",text:"text-gray-500",dot:"bg-gray-500",glow:""};function P({session:e,hasSse:t,sseCount:n,onChat:l}){let i=t&&E[e.status]||z;return(0,a.jsxs)(r.default,{href:`/node?alias=${encodeURIComponent(e.alias)}`,prefetch:!1,className:`anet-agent-card group relative block rounded-xl border p-4 transition-all duration-300 cursor-pointer hover:-translate-y-0.5 ${t?`bg-[#111128] border-[#2a2a4a] hover:border-cyan-500/30 hover:shadow-lg ${i.glow}`:"bg-[#0d0d1a] border-[#1a1a2a] opacity-40"}`,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)(d.AliasAvatar,{alias:e.alias,size:22}),(0,a.jsx)("span",{className:"font-semibold text-white truncate text-sm",title:e.alias,children:e.alias}),(0,a.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full shrink-0 ${i.dot} ${t&&"working"===e.status?"animate-pulse":""}`})]}),(0,a.jsx)("span",{className:`text-[11px] px-2 py-0.5 rounded-md border shrink-0 ${i.bg} ${i.text}`,children:t?e.status:"offline"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,a.jsx)("span",{className:"text-xs text-gray-600 bg-[#0a0a15] px-2 py-0.5 rounded border border-[#1a1a2a]",children:e.agent||"unknown"}),t&&(0,a.jsxs)("span",{className:"text-[10px] text-green-500",children:["SSE:",n]})]}),e.task?(0,a.jsx)("div",{className:"text-xs text-gray-400 bg-[#0a0a15] rounded-lg px-3 py-2 border border-[#1a1a2a] line-clamp-2",title:e.task,children:e.task}):(0,a.jsx)("div",{className:"text-xs text-gray-700 italic",children:"No active task"}),e.progress>0&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsxs)("div",{className:"flex justify-between text-[10px] mb-1",children:[(0,a.jsx)("span",{className:"text-gray-600",children:"Progress"}),(0,a.jsxs)("span",{className:i.text,children:[e.progress,"%"]})]}),(0,a.jsx)("div",{className:"w-full bg-gray-800 rounded-full h-1.5 overflow-hidden",children:(0,a.jsx)("div",{className:`h-1.5 rounded-full transition-all duration-700 ${"working"===e.status?"bg-green-500":"bg-cyan-500"}`,style:{width:`${Math.min(e.progress,100)}%`}})})]}),(0,a.jsxs)("div",{className:"mt-3 flex justify-between items-center text-[10px] text-gray-600",children:[(0,a.jsx)("span",{className:"truncate",title:e.server||"",children:e.server||"--"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[l&&t&&(0,a.jsx)("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),l(e.alias)},className:"text-cyan-400 hover:text-cyan-300 px-1.5 py-0.5 rounded border border-cyan-500/20 hover:bg-cyan-500/10 transition-colors",children:"Chat"}),(0,a.jsx)("span",{children:(0,s.timeAgo)(e.updated_at)}),(0,a.jsx)("svg",{"aria-hidden":!0,className:"w-3 h-3 text-gray-700 opacity-0 -translate-x-1 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-200",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M9 18l6-6-6-6"})})]})]})]})}function A({messages:e}){return 0===e.length?null:(0,a.jsxs)("div",{className:"mt-8",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold text-white mb-3 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-gray-500",children:"Inbox"}),(0,a.jsx)("span",{className:"text-xs bg-blue-900/30 text-blue-400 px-2 py-0.5 rounded-full border border-blue-800/30",children:e.length})]}),(0,a.jsx)("div",{className:"space-y-2 max-h-96 overflow-y-auto pr-1 scrollbar-thin",children:e.map(e=>(0,a.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-3 text-sm transition-colors hover:border-[#3a3a5a]",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs mb-1.5",children:[e.from_session&&(0,a.jsx)(d.AliasAvatar,{alias:e.from_session,size:16}),(0,a.jsx)("span",{className:"text-gray-200 font-medium truncate",children:e.from_session}),(0,a.jsx)("span",{className:"ml-auto text-gray-600 shrink-0",title:e.created_at,children:(0,s.timeAgo)(e.created_at)})]}),(0,a.jsx)("div",{className:"text-gray-300 leading-relaxed line-clamp-3",title:e.content||"",children:(0,s.previewContent)(e.content)})]},e.id))})]})}function L(){return(0,a.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-8 anet-skeleton-pulse",children:[1,2,3,4].map(e=>(0,a.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] px-4 py-3",children:[(0,a.jsx)(T,{w:"2.5rem",h:"1.75rem"}),(0,a.jsx)(T,{w:"3.5rem",h:"0.75rem",className:"mt-2"}),(0,a.jsx)(T,{w:"5rem",h:"0.625rem",className:"mt-1"})]},e))}),(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-3 anet-skeleton-pulse",children:[(0,a.jsx)(T,{w:"6rem",h:"2.5rem",rounded:"0.75rem"}),(0,a.jsxs)("div",{className:"flex-1 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-2.5 flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-full anet-skeleton-bar"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)(T,{w:"6rem",h:"0.875rem"}),(0,a.jsx)(T,{w:"10rem",h:"0.625rem",className:"mt-1"})]})]})]}),(0,a.jsx)("div",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 anet-skeleton-pulse",children:(0,a.jsx)(T,{w:"14rem",h:"0.875rem"})}),(0,a.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:gap-3 mb-3 anet-skeleton-pulse",children:[1,2,3].map(e=>(0,a.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] px-3 py-3",children:[(0,a.jsx)(T,{w:"2rem",h:"1.25rem"}),(0,a.jsx)(T,{w:"2.5rem",h:"0.75rem",className:"mt-1"}),(0,a.jsx)(T,{w:"3.5rem",h:"0.625rem",className:"mt-px"})]},e))}),(0,a.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:gap-3 mb-6 anet-skeleton-pulse",children:[1,2,3].map(e=>(0,a.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] px-3 py-2.5 flex items-center justify-center gap-2",children:[(0,a.jsx)("div",{className:"w-4 h-4 rounded anet-skeleton-bar"}),(0,a.jsx)(T,{w:"4rem",h:"0.75rem"})]},e))}),(0,a.jsxs)("div",{className:"mb-6 flex gap-2 anet-skeleton-pulse",children:[(0,a.jsx)("div",{className:"flex-1 h-10 rounded-lg border border-[#2a2a4a] bg-[#111128]"}),(0,a.jsx)("div",{className:"w-28 h-10 rounded-lg anet-skeleton-bar"})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-3 sm:gap-4 anet-skeleton-pulse",children:[1,2,3,4].map(e=>(0,a.jsxs)("div",{className:"rounded-xl border border-[#2a2a4a] bg-[#111128] p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full anet-skeleton-bar"}),(0,a.jsx)(T,{w:"6rem",h:"0.875rem"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(T,{w:"100%",h:"0.625rem"}),(0,a.jsx)(T,{w:"75%",h:"0.625rem"}),(0,a.jsx)(T,{w:"55%",h:"0.625rem"})]})]},e))})]})}function T({w:e,h:t,rounded:n,className:r}){return(0,a.jsx)("div",{className:`anet-skeleton-bar ${r||""}`,style:{width:e,height:t,borderRadius:n||"0.375rem"}})}var F=e.i(76161),I=e.i(98025),W=e.i(11449);function R(){let{setNetworkId:e}=(0,W.useNetworkId)(),[t,r]=(0,n.useState)({user:null,networks:[],currentNetwork:"",token:""}),[s,l]=(0,n.useState)(!1),[i,o]=(0,n.useState)(""),[d,c]=(0,n.useState)(""),[u,h]=(0,n.useState)(""),[x,f]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let e=sessionStorage.getItem("anet_v3_auth");if(e)try{r(JSON.parse(e))}catch{}},[]);let[p,m]=(0,n.useState)(!1),[g,y]=(0,n.useState)(""),[b,v]=(0,n.useState)(""),j=async()=>{try{await fetch(`/api/hub/auth?token=${t.token}&endpoint=/api/auth/me`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update_profile",token:t.token,display_name:g,email:b})});let e=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update_profile",token:t.token,display_name:g,email:b})}),a=await e.json();if(a.ok&&a.user){let e={...t,user:a.user};r(e),sessionStorage.setItem("anet_v3_auth",JSON.stringify(e)),m(!1)}}catch{}};if(!t.user)return null;let k=(t.user.display_name||t.user.username).slice(0,2).toUpperCase();return(0,a.jsxs)("div",{className:"flex items-center justify-between bg-[#111128] border border-[#2a2a4a] rounded-lg px-4 py-2.5 mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-cyan-500 to-blue-600 flex items-center justify-center text-xs font-bold text-white",children:k}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm text-white font-medium",children:t.user.display_name||t.user.username}),(0,a.jsxs)("div",{className:"text-[10px] text-gray-500",children:[t.user.role," · ",t.user.user_id]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[t.networks.length>0&&(0,a.jsx)("select",{value:t.currentNetwork,onChange:a=>{let n={...t,currentNetwork:a.target.value};r(n),e(a.target.value),sessionStorage.setItem("anet_v3_auth",JSON.stringify(n))},className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white focus:outline-none",children:t.networks.map(e=>(0,a.jsx)("option",{value:e.network_id,children:e.network_name},e.network_id))}),(0,a.jsxs)("button",{onClick:()=>{y(t.user?.display_name||""),v(""),m(!p)},className:"text-xs text-gray-500 hover:text-gray-300 whitespace-nowrap","aria-label":"Edit profile",children:[(0,a.jsx)("span",{className:"hidden sm:inline",children:"Edit"}),(0,a.jsx)("svg",{className:"sm:hidden w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.862 4.487z"})})]}),(0,a.jsxs)("button",{onClick:()=>{r({user:null,networks:[],currentNetwork:"",token:""}),sessionStorage.removeItem("anet_v3_auth")},className:"text-xs text-gray-500 hover:text-gray-300 whitespace-nowrap","aria-label":"Sign out",children:[(0,a.jsx)("span",{className:"hidden sm:inline",children:"Sign out"}),(0,a.jsx)("svg",{className:"sm:hidden w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"})})]})]}),p&&(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-2 pt-2 border-t border-[#2a2a4a]",children:[(0,a.jsx)("input",{type:"text",value:g,onChange:e=>y(e.target.value),placeholder:"Display name",className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white placeholder-gray-600 focus:outline-none w-32"}),(0,a.jsx)("input",{type:"email",value:b,onChange:e=>v(e.target.value),placeholder:"Email",className:"bg-[#0a0a15] border border-[#2a2a4a] rounded px-2 py-1 text-xs text-white placeholder-gray-600 focus:outline-none w-40"}),(0,a.jsx)("button",{onClick:j,className:"px-2 py-1 bg-cyan-600 hover:bg-cyan-500 text-white text-xs rounded",children:"Save"})]})]})}var B=e.i(6694);function D({tabs:e,activeTab:t,onOpenTab:n,onCloseTab:r,onSetActive:s,onClose:l}){return 0===e.length?null:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{onClick:l,className:"jsx-f7cf3d1a6fdfc074 fixed inset-0 bg-black/30 z-40 lg:hidden"}),(0,a.jsxs)("div",{className:"jsx-f7cf3d1a6fdfc074 fixed top-0 right-0 h-full w-full lg:w-[500px] bg-[#0a0a1a] border-l border-[#2a2a4a] z-50 flex flex-col shadow-2xl shadow-black/60 animate-slide-in",children:[(0,a.jsxs)("div",{className:"jsx-f7cf3d1a6fdfc074 flex items-center border-b border-[#2a2a4a] bg-[#0d0d1a] overflow-x-auto",children:[(0,a.jsx)("div",{className:"jsx-f7cf3d1a6fdfc074 flex-1 flex min-w-0",children:e.map(e=>(0,a.jsxs)("button",{onClick:()=>s(e),className:`jsx-f7cf3d1a6fdfc074 flex items-center gap-1.5 px-3 py-2.5 text-xs border-b-2 transition-colors shrink-0 ${t===e?"border-cyan-400 text-cyan-300 bg-cyan-500/5":"border-transparent text-gray-500 hover:text-gray-300"}`,children:[(0,a.jsx)("div",{className:`jsx-f7cf3d1a6fdfc074 w-2 h-2 rounded-full ${t===e?"bg-cyan-400":"bg-gray-600"}`}),(0,a.jsx)("span",{className:"jsx-f7cf3d1a6fdfc074 max-w-[80px] truncate",children:e}),(0,a.jsx)("button",{onClick:t=>{t.stopPropagation(),r(e)},className:"jsx-f7cf3d1a6fdfc074 ml-1 text-gray-600 hover:text-gray-300 p-0.5",children:"×"})]},e))}),(0,a.jsx)("button",{onClick:l,className:"jsx-f7cf3d1a6fdfc074 text-gray-500 hover:text-white px-3 py-2.5 shrink-0 border-l border-[#2a2a4a]",children:(0,a.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-f7cf3d1a6fdfc074 w-4 h-4",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-f7cf3d1a6fdfc074"})})})]}),(0,a.jsx)("div",{className:"jsx-f7cf3d1a6fdfc074 flex-1 relative overflow-hidden",children:e.map(e=>(0,a.jsx)("div",{className:`jsx-f7cf3d1a6fdfc074 absolute inset-0 ${t===e?"block":"hidden"}`,children:(0,a.jsx)(O,{alias:e})},e))})]}),(0,a.jsx)(B.default,{id:"f7cf3d1a6fdfc074",children:"@keyframes slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}"})]})}function O({alias:e}){return(0,a.jsx)(c.TaskChatPanel,{alias:e,onClose:()=>{},inline:!0})}function H({sessions:e,onClose:t}){let[r,s]=(0,n.useState)(new Set),[l,i]=(0,n.useState)(""),[o,c]=(0,n.useState)("normal"),[u,h]=(0,n.useState)(!1),[x,f]=(0,n.useState)([]),[p,m]=(0,n.useState)(""),g=e.filter(e=>"offline"!==e.status).filter(e=>!p||e.alias.toLowerCase().includes(p.toLowerCase())||(e.agent||"").toLowerCase().includes(p.toLowerCase())),y=async()=>{if(!l.trim()||0===r.size||u)return;h(!0),f([]);let e=[...r].map(async e=>{try{let t=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:e,task:l,priority:o})}),a=await t.json();return{alias:e,ok:!!a.ok,error:a.error}}catch(t){return{alias:e,ok:!1,error:"send failed"}}});f(await Promise.all(e)),h(!1)},b=x.filter(e=>e.ok).length;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"fixed inset-0 bg-black/50 z-40 anet-fade-in",onClick:t}),(0,a.jsxs)("div",{className:"fixed inset-4 lg:inset-x-[15%] lg:inset-y-[5%] bg-[#0a0a1a] border border-[#2a2a4a] rounded-2xl z-50 flex flex-col shadow-2xl shadow-black/70 overflow-hidden anet-fade-in",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-bold text-white",children:"Dispatch Task"}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"Send a task to one or more agents"})]}),(0,a.jsx)("button",{onClick:t,className:"text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col lg:flex-row overflow-hidden",children:[(0,a.jsxs)("div",{className:"lg:w-[280px] border-b lg:border-b-0 lg:border-r border-[#2a2a4a] flex flex-col",children:[(0,a.jsxs)("div",{className:"px-4 py-3 border-b border-[#2a2a4a]",children:[(0,a.jsx)("input",{type:"text",value:p,onChange:e=>m(e.target.value),placeholder:"Filter agents...",className:"w-full bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-xs text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none"}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,a.jsx)("button",{onClick:()=>{r.size===g.length?s(new Set):s(new Set(g.map(e=>e.alias)))},className:"text-[10px] text-cyan-400 hover:text-cyan-300",children:r.size===g.length?"Deselect all":`Select all (${g.length})`}),(0,a.jsxs)("span",{className:"text-[10px] text-gray-600",children:[r.size," selected"]})]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto px-2 py-2 space-y-0.5 max-h-[200px] lg:max-h-none",children:[g.map(e=>(0,a.jsxs)("button",{onClick:()=>{var t;return t=e.alias,void s(e=>{let a=new Set(e);return a.has(t)?a.delete(t):a.add(t),a})},className:`w-full flex items-center gap-2 px-3 py-2 rounded-lg text-xs text-left transition-colors ${r.has(e.alias)?"bg-cyan-500/10 text-cyan-300 border border-cyan-500/20":"text-gray-400 hover:bg-[#1a1a2a]"}`,children:[(0,a.jsx)(d.AliasAvatar,{alias:e.alias,size:16}),(0,a.jsx)("div",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"working"===e.status?"bg-green-400":"idle"===e.status?"bg-cyan-400":"bg-gray-500"}`}),(0,a.jsx)("span",{className:"truncate flex-1",children:e.alias}),(0,a.jsx)("span",{className:"text-[9px] text-gray-600",children:e.agent||"--"})]},e.alias)),0===g.length&&(0,a.jsx)("div",{className:"text-center text-xs text-gray-600 py-4",children:"No online agents"})]})]}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,a.jsxs)("div",{className:"flex-1 px-6 py-4 flex flex-col",children:[(0,a.jsx)("label",{className:"text-xs text-gray-500 uppercase mb-2",children:"Task Prompt"}),(0,a.jsx)("textarea",{value:l,onChange:e=>i(e.target.value),placeholder:"Enter the task you want to dispatch...",className:"flex-1 min-h-[120px] bg-[#111128] border border-[#2a2a4a] rounded-xl px-4 py-3 text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none resize-none"}),(0,a.jsxs)("div",{className:"flex items-center gap-3 mt-4",children:[(0,a.jsxs)("select",{value:o,onChange:e=>c(e.target.value),className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-xs text-white focus:outline-none",children:[(0,a.jsx)("option",{value:"normal",children:"Normal priority"}),(0,a.jsx)("option",{value:"high",children:"High priority"}),(0,a.jsx)("option",{value:"low",children:"Low priority"})]}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsx)("button",{onClick:y,disabled:u||!l.trim()||0===r.size,className:"px-6 py-2.5 bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 disabled:from-gray-800 disabled:to-gray-800 disabled:text-gray-600 text-white text-sm font-medium rounded-xl transition-all shadow-lg shadow-cyan-500/10 disabled:shadow-none active:scale-95",children:u?(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Sending..."]}):`Dispatch to ${r.size} agent${r.size>1?"s":""}`})]})]}),x.length>0&&(0,a.jsxs)("div",{className:"px-6 py-3 border-t border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,a.jsxs)("div",{className:"text-xs text-gray-500 mb-2",children:[b,"/",x.length," dispatched successfully"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:x.map(e=>(0,a.jsxs)("span",{className:`flex items-center gap-1.5 text-[10px] pl-1 pr-2 py-0.5 rounded-full border ${e.ok?"text-green-300 border-green-500/20 bg-green-500/5":"text-red-300 border-red-500/20 bg-red-500/5"}`,children:[(0,a.jsx)(d.AliasAvatar,{alias:e.alias,size:14}),(0,a.jsx)("span",{children:e.alias}),(0,a.jsx)("span",{"aria-hidden":!0,children:e.ok?"✓":e.error||"✗"})]},e.alias))})]})]})]})]})]})}var Y=e.i(2684),X=e.i(50111);e.s(["default",0,function(){let e,i,c,h,x;(0,n.useEffect)(()=>{sessionStorage.getItem("anet_v3_auth")||(fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),window.location.assign("/login"))},[]);let{sessions:f,hint:p,error:m,isLoading:g}=(0,u.useSessions)(),{health:y}=(0,u.useHealth)(),{config:b}=(0,u.useAnetConfig)(),{tasks:v}=(0,u.useTasks)({limit:"500"}),{stats:j}=(0,u.useStats)(),[k,w]=(0,n.useState)(window.innerWidth>=1024),[N,S]=(0,n.useState)(!1),M=function(){let[e,t]=(0,n.useState)([]),[a,r]=(0,n.useState)("");return{tabs:e,activeTab:a,openTab:e=>{t(t=>t.includes(e)?t:[...t,e]),r(e)},closeTab:e=>{t(t=>{let n=t.filter(t=>t!==e);return a===e&&r(n[n.length-1]||""),n})},closeAll:()=>{t([]),r("")},setActiveTab:r}}(),[C,_]=(0,n.useState)(!1),[E,z]=(0,n.useState)([]),[T,W]=(0,n.useState)("all"),[B,O]=(0,n.useState)(null),{mutate:U}=(0,X.useSWRConfig)(),K="1"!==t.default.env.NEXT_PUBLIC_DISABLE_SSE,{connected:G,supported:J}=(0,Y.useSSE)({url:"/api/hub/events",enabled:K,onEvent:e=>{if("node.renamed"===e.type){U("/api/hub/status");let t=e.data;t?.old_alias&&t?.new_alias&&O({from:t.old_alias,to:t.new_alias,ts:Date.now()});return}["new_task","new_message","new_reply","node_status_changed","broadcast"].includes(e.type)&&(U("/api/hub/status"),U(e=>"string"==typeof e&&e.startsWith("/api/hub/tasks"),void 0,{revalidate:!0}))}});if((0,n.useEffect)(()=>{let e=()=>{fetch("/api/hub/inbox").then(e=>e.json()).then(e=>{e.messages?.length&&z(t=>{let a=new Set(t.map(e=>e.id));return[...e.messages.filter(e=>!a.has(e.id)),...t].slice(0,100)})}).catch(()=>{})};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[]),g)return(0,a.jsx)(L,{});let V=y?.sse_sessions||{},q=e=>(e.network_id?V[`${e.network_id}:${e.alias}`]:void 0)??V[e.alias],Z=e=>"offline"!==e.status||!!q(e),Q=f.filter(Z).length,ee=f.length,et=f.filter(e=>"working"===e.status).length,ea=y?(0,s.formatUptime)(y.uptime):"--",en=y?.version||"--",er=!!(b?.hub&&b.tokenConfigured),es=b?.source==="file"?"Local config":b?.source==="runtime-env"?"Runtime env":"Config missing",el={};if(j?.tasks?.by_status?.length)for(let e of j.tasks.by_status)el[e.status]=e.count;else for(let e of v)el[e.status]=(el[e.status]||0)+1;let ei=[...f].sort((e,t)=>{let a=+!!Z(e),n=+!!Z(t);if(a!==n)return n-a;let r=+("working"===e.status);return("working"===t.status)-r}),eo=0===f.length&&!m;return(0,a.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,a.jsx)("div",{className:"lg:ml-0 ml-10",children:(0,a.jsx)(l,{online:Q,working:et,total:ee,version:en,uptime:ea})}),(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[!eo&&(0,a.jsx)("button",{onClick:()=>_(!0),className:"px-4 py-2 bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 text-white text-sm font-medium rounded-xl shadow-lg shadow-cyan-500/10 transition-all active:scale-95 shrink-0",children:"⚡ Dispatch"}),(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(R,{})})]}),(0,a.jsxs)("section",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 shadow-lg shadow-black/20",children:[(0,a.jsxs)("button",{onClick:()=>S(!N),className:"w-full flex items-center justify-between text-left",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,a.jsx)("span",{className:"uppercase text-gray-600",children:"Config"}),(0,a.jsx)("span",{className:`w-2 h-2 rounded-full ${er?"bg-green-400":"bg-red-400"}`}),(0,a.jsx)("span",{className:"text-gray-500",children:es})]}),(0,a.jsx)("svg",{className:`w-4 h-4 text-gray-600 transition-transform ${N?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),N&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-[#2a2a4a]",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("div",{className:"min-w-0",children:(0,a.jsxs)("div",{className:"text-gray-100 truncate text-sm",title:b?.hub||void 0,children:["Hub: ",(0,a.jsx)("span",{className:b?.hub?"text-cyan-300":"text-red-300",children:b?.hub?.trim()||"not configured"})]})}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 text-xs",children:(0,a.jsxs)("span",{className:`px-2.5 py-1 rounded-md border ${b?.tokenConfigured?"bg-blue-500/5 text-blue-300 border-blue-500/20":"bg-gray-500/5 text-gray-400 border-gray-500/20"}`,children:["Token: ",b?.tokenPreview||"not configured"]})})]}),b?.error&&(0,a.jsx)("div",{className:"mt-2 text-xs text-gray-600",children:b.error})]})]}),Object.keys(el).length>0&&(0,a.jsxs)("section",{className:"mb-6 rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 shadow-lg shadow-black/20",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("div",{className:"text-xs uppercase text-gray-600",children:"Task Status"}),(0,a.jsx)(r.default,{href:"/tasks",prefetch:!1,className:"text-xs text-cyan-400 hover:text-cyan-300",children:"View all →"})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:["running","delivered","acked","replied","created","failed","cancelled","expired","closed"].filter(e=>el[e]).map(e=>(0,a.jsxs)(r.default,{href:`/tasks?status=${e}`,prefetch:!1,className:`px-2.5 py-1 rounded-md border text-xs ${I.STATUS_CHIP_CLASS[e]} hover:opacity-80 transition-opacity`,children:[e,": ",el[e]]},e))})]}),!eo&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-[0.12em] text-gray-600 mb-2",children:"Quick navigation"}),(0,a.jsx)("section",{className:"mb-3 grid grid-cols-3 gap-2 sm:gap-3",children:(e=f.filter(e=>Z(e)&&"working"!==e.status).length,i=ee-Q,c=v.filter(e=>"failed"===e.status).length,[{href:"/nodes",label:"Nodes",value:`${Q}/${ee}`,sub:`${ee>0?Math.round(Q/ee*100):0}% online`,color:"text-green-400 border-green-500/20",popover:0===ee?null:[{k:"working",v:et,dot:"",color:"#4ade80"},{k:"idle",v:e,dot:"",color:"#22d3ee"},{k:"offline",v:i,dot:"",color:"#9ca3af"}]},{href:"/tasks",label:"Tasks",value:String(Object.values(el).reduce((e,t)=>e+t,0)||0),sub:"all-time",color:"text-cyan-400 border-cyan-500/20",popover:0===Object.keys(el).length?null:["running","replied","failed","cancelled","expired","closed","created","delivered","acked"].filter(e=>el[e]).map(e=>({k:e,v:el[e],dot:"",color:({running:"#4ade80",replied:"#a78bfa",failed:"#f87171",cancelled:"#facc15",expired:"#fb923c",closed:"#9ca3af",created:"#9ca3af",delivered:"#60a5fa",acked:"#22d3ee"})[e]||"#9ca3af"}))},{href:"/tasks?status=failed",label:"Failed",value:String(el.failed||0),sub:el.failed?"needs review":"none",color:el.failed?"text-red-400 border-red-500/25":"text-gray-500 border-gray-700/30",popover:c?[{k:`${c} in current view`,v:"",dot:"",color:"#f87171"}]:[{k:"no failures yet",v:"",dot:"",color:"#4b5563"}]}].map(e=>(0,a.jsxs)(r.default,{href:e.href,prefetch:!1,className:`anet-stat-link group relative rounded-xl border ${e.color} bg-[#111128] px-3 py-3 transition-all hover:-translate-y-px`,children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,a.jsx)("div",{className:`text-xl font-semibold tabular-nums ${e.color.split(" ")[0]}`,children:e.value}),(0,a.jsx)("div",{className:"hidden sm:block text-[10px] text-gray-600 group-hover:text-gray-400 transition-colors",children:"View →"})]}),(0,a.jsx)("div",{className:"text-[11px] text-gray-400 mt-0.5",children:e.label}),(0,a.jsx)("div",{className:"text-[10px] text-gray-600 mt-px",children:e.sub}),e.popover&&e.popover.length>0&&(0,a.jsxs)("div",{className:"anet-stat-popover hidden md:block pointer-events-none absolute left-2 right-2 top-full mt-1 z-20 rounded-lg border border-[#2a2a4a] bg-[#0d0d1a] shadow-lg shadow-black/30 px-3 py-2 opacity-0 translate-y-[-2px] group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-150 delay-100",children:[(0,a.jsx)("div",{className:"text-[10px] text-gray-600 uppercase tracking-wider mb-1.5",children:"Breakdown"}),(0,a.jsx)("ul",{className:"space-y-1",children:e.popover.map(e=>(0,a.jsxs)("li",{className:"flex items-center gap-2 text-[11px]",children:[(0,a.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:e.color},"aria-hidden":!0}),(0,a.jsx)("span",{className:"text-gray-400 capitalize",children:e.k}),""!==e.v&&(0,a.jsx)("span",{className:"ml-auto text-gray-300 tabular-nums font-medium",children:e.v})]},e.k))})]})]},e.href)))}),(0,a.jsx)("section",{className:"mb-6 grid grid-cols-3 gap-2 sm:gap-3",children:[{href:"/messages",label:"Messages",icon:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"},{href:"/logs",label:"Audit log",icon:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8"},{href:"/admin",label:"Admin",icon:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4z M6 21v-2a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v2"}].map(e=>(0,a.jsxs)(r.default,{href:e.href,prefetch:!1,className:"anet-nav-tile flex items-center justify-center gap-2 rounded-xl border border-[#2a2a4a] bg-[#111128] px-3 py-2.5 text-[12px] text-gray-400 hover:text-gray-200 transition-colors",children:[(0,a.jsx)("svg",{className:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:e.icon})}),(0,a.jsx)("span",{children:e.label})]},e.href))}),(0,a.jsx)(o,{}),v.length>0&&(0,a.jsxs)("section",{className:"mb-6 bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Recent Activity"}),(0,a.jsx)(r.default,{href:"/tasks",className:"text-xs text-cyan-400 hover:text-cyan-300",children:"All tasks →"})]}),(0,a.jsx)("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:v.slice(0,5).map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:I.STATUS_DOT_HEX[e.status]||"#6b7280"}}),e.from_name&&(0,a.jsx)(d.AliasAvatar,{alias:e.from_name,size:14}),(0,a.jsx)("span",{className:"text-gray-300 shrink-0 max-w-[20%] truncate",children:e.from_name||"?"}),(0,a.jsx)("span",{className:"text-gray-600",children:"→"}),e.to_name&&(0,a.jsx)(d.AliasAvatar,{alias:e.to_name,size:14}),(0,a.jsx)("span",{className:"text-gray-300 shrink-0 max-w-[20%] truncate",children:e.to_name||"?"}),(0,a.jsx)("span",{className:"text-gray-500 truncate flex-1",title:e.content||"",children:(0,s.previewContent)(e.content).slice(0,60)}),(0,a.jsx)("span",{className:`shrink-0 px-1.5 py-0.5 rounded text-[10px] border ${I.STATUS_CHIP_CLASS[e.status]||"text-gray-500 border-gray-700/30"}`,children:e.status})]},e.task_id))})]})]}),m&&(0,a.jsxs)("div",{className:"bg-red-900/20 border border-red-800/40 text-red-300 px-4 py-3 rounded-lg mb-6 text-sm flex items-center justify-between",role:"alert",children:[(0,a.jsx)("span",{children:String(m)}),(0,a.jsx)("span",{className:"text-gray-500 text-xs",children:"Check CommHub connection"})]}),f.length>0&&(0,a.jsx)("div",{className:"flex justify-center mb-4",children:(0,a.jsx)("button",{onClick:()=>w(!k),className:"text-xs text-gray-500 hover:text-gray-300 border border-gray-700/50 px-4 py-1.5 rounded-lg transition-colors hover:border-gray-600 cursor-pointer",children:k?"Hide Topology":"Show Topology"})}),!k&&f.length>0&&(0,a.jsx)("div",{className:"lg:hidden text-center text-xs text-gray-600 mb-4",children:"Topology hidden on mobile for better readability"}),k&&f.length>0&&(0,a.jsx)($,{sessions:f,sseSessions:V,renameSignal:B}),0!==f.length||m?(h={all:ei.length,working:ei.filter(e=>Z(e)&&"working"===e.status).length,idle:ei.filter(e=>Z(e)&&"working"!==e.status).length,offline:ei.filter(e=>!Z(e)).length},x=ei.filter(e=>"all"===T||("offline"===T?!Z(e):"working"===T?Z(e)&&"working"===e.status:"idle"!==T||Z(e)&&"working"!==e.status)),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-3 flex flex-wrap items-center gap-1",children:[{key:"all",label:"All"},{key:"working",label:"Working",dot:"#4ade80"},{key:"idle",label:"Idle",dot:"#22d3ee"},{key:"offline",label:"Offline",dot:"#6b7280"}].map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>W(e.key),disabled:0===h[e.key]&&"all"!==e.key,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs transition-colors disabled:opacity-30 disabled:cursor-not-allowed ${T===e.key?"bg-cyan-500/10 text-cyan-300 border border-cyan-500/30":"text-gray-500 hover:text-gray-200 hover:bg-[#1a1a2a] border border-transparent"}`,children:[e.dot&&(0,a.jsx)("span",{"aria-hidden":!0,className:"inline-block w-1.5 h-1.5 rounded-full",style:{backgroundColor:e.dot}}),(0,a.jsx)("span",{children:e.label}),(0,a.jsx)("span",{className:`text-[10px] tabular-nums ${T===e.key?"text-cyan-400":"text-gray-600"}`,children:h[e.key]})]},e.key))}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-3 sm:gap-4",children:x.map(e=>(0,a.jsx)(P,{session:e,hasSse:Z(e),sseCount:q(e)||0,onChat:M.openTab},e.alias))}),0===x.length&&(0,a.jsxs)("div",{className:"mt-4 text-center text-xs text-gray-600",children:['No agents match "',T,'" — ',(0,a.jsx)("button",{onClick:()=>W("all"),className:"underline hover:text-gray-400",children:"Show all"})]})]})):(0,a.jsx)(F.NodesEmptyState,{hint:p,taskHistoryCount:Object.values(el).reduce((e,t)=>e+t,0)}),(0,a.jsx)(A,{messages:E}),(0,a.jsx)("div",{className:"mt-8 text-center text-xs text-gray-600 flex items-center justify-center gap-2 flex-wrap",children:J&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${G?"bg-green-400":"bg-gray-600"}`}),G?"SSE live":"SWR polling"]})}),C&&(0,a.jsx)(H,{sessions:f,onClose:()=>_(!1)}),M.tabs.length>0&&(0,a.jsx)(D,{tabs:M.tabs,activeTab:M.activeTab,onOpenTab:M.openTab,onCloseTab:M.closeTab,onSetActive:M.setActiveTab,onClose:M.closeAll})]})}],18722)}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,70286,e=>{"use strict";e.s(["DASHBOARD_VERSION",0,"0.4.6-preview.138"],70286)},48941,e=>{"use strict";var t=e.i(22381),r=e.i(23910),a=e.i(70286);e.s(["default",0,function(){let[e,s]=(0,r.useState)("login"),[n,o]=(0,r.useState)(""),[i,l]=(0,r.useState)(""),[c,d]=(0,r.useState)(!1),[x,g]=(0,r.useState)(""),[h,m]=(0,r.useState)(!1),u=async t=>{t.preventDefault(),m(!0),g("");try{let t=await fetch("/api/auth/v3",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,username:n,password:i})}),r=await t.json();if(r.ok){r.token&&sessionStorage.setItem("anet_v3_auth",JSON.stringify({user:r.user,token:r.token,networks:r.networks||[],currentNetwork:r.network_id||r.networks?.[0]?.network_id||""})),window.location.assign("/");return}g(r.error||"Login failed")}catch{g("Connection failed")}m(!1)};return(0,t.jsxs)("main",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 font-mono flex items-center justify-center relative overflow-hidden px-4 py-10 sm:py-16",children:[(0,t.jsx)("div",{className:"absolute inset-0 pointer-events-none anet-login-bg","aria-hidden":!0}),(0,t.jsxs)("div",{className:"relative w-full max-w-sm",children:[(0,t.jsxs)("div",{className:"text-center mb-7",children:[(0,t.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 mb-4 rounded-2xl bg-[#111128] border border-[#2a2a4a] anet-login-mark",children:(0,t.jsxs)("svg",{className:"w-9 h-9",viewBox:"0 0 32 32","aria-hidden":!0,children:[(0,t.jsx)("circle",{cx:"16",cy:"16",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",opacity:"0.25",className:"text-cyan-400 anet-login-mark-ring"}),(0,t.jsx)("line",{x1:"16",y1:"10",x2:"10",y2:"20",stroke:"currentColor",strokeWidth:"1",opacity:"0.5",className:"text-cyan-400 anet-login-mark-edge"}),(0,t.jsx)("line",{x1:"16",y1:"10",x2:"22",y2:"20",stroke:"currentColor",strokeWidth:"1",opacity:"0.5",className:"text-cyan-400 anet-login-mark-edge"}),(0,t.jsx)("line",{x1:"10",y1:"20",x2:"22",y2:"20",stroke:"currentColor",strokeWidth:"1",opacity:"0.5",className:"text-cyan-400 anet-login-mark-edge"}),(0,t.jsx)("circle",{cx:"16",cy:"10",r:"3",fill:"currentColor",className:"text-cyan-400 anet-login-mark-node-a"}),(0,t.jsx)("circle",{cx:"10",cy:"20",r:"3",fill:"currentColor",className:"text-green-400 anet-login-mark-node-b"}),(0,t.jsx)("circle",{cx:"22",cy:"20",r:"3",fill:"currentColor",className:"text-violet-400 anet-login-mark-node-c"})]})}),(0,t.jsx)("h1",{className:"text-[22px] sm:text-2xl font-semibold text-white tracking-tight",children:"Agent Network"}),(0,t.jsx)("p",{className:"text-[13px] text-gray-500 mt-1.5 leading-snug",children:"login"===e?(0,t.jsxs)(t.Fragment,{children:["Welcome back · ",(0,t.jsx)("span",{className:"text-gray-600",children:"Tasks · Mesh · Messages"})]}):(0,t.jsxs)(t.Fragment,{children:["Create your account · ",(0,t.jsx)("span",{className:"text-gray-600",children:"Free preview · no credit card"})]})})]}),(0,t.jsx)("div",{className:"flex rounded-lg border border-[#2a2a4a] bg-[#111128] p-1 mb-4",children:["login","register"].map(r=>(0,t.jsx)("button",{type:"button",onClick:()=>{s(r),g("")},className:`flex-1 rounded-md px-3 py-2 text-sm transition-colors ${e===r?"bg-cyan-500/10 text-cyan-300":"text-gray-500 hover:text-gray-200"}`,children:"login"===r?"Sign in":"Register"},r))}),(0,t.jsxs)("form",{onSubmit:u,className:"border border-[#2a2a4a] bg-[#111128]/80 backdrop-blur-sm rounded-xl p-6 shadow-2xl shadow-black/30",children:[(0,t.jsx)("label",{htmlFor:"username",className:"block text-xs text-gray-500 mb-2 uppercase tracking-wider",children:"Username"}),(0,t.jsx)("input",{id:"username",type:"text",value:n,onChange:e=>o(e.target.value),autoFocus:!0,placeholder:"Enter username",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-4 py-3 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:ring-1 focus:ring-cyan-500/20 focus:outline-none transition-all mb-4"}),(0,t.jsx)("label",{htmlFor:"password",className:"block text-xs text-gray-500 mb-2 uppercase tracking-wider",children:"Password"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("input",{id:"password",type:c?"text":"password",value:i,onChange:e=>l(e.target.value),placeholder:"Enter password",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-4 pr-11 py-3 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:ring-1 focus:ring-cyan-500/20 focus:outline-none transition-all"}),(0,t.jsx)("button",{type:"button",onClick:()=>d(e=>!e),tabIndex:-1,"aria-label":c?"Hide password":"Show password",className:"absolute inset-y-0 right-0 flex items-center px-3 text-gray-600 hover:text-gray-300 transition-colors",children:c?(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,t.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),x&&(0,t.jsx)("div",{className:"mt-3 text-sm text-red-300 bg-red-500/5 border border-red-500/10 rounded-lg px-3 py-2",children:x}),(0,t.jsxs)("button",{type:"submit",disabled:h||!i||!n.trim(),className:"mt-5 w-full flex items-center justify-center gap-2 px-4 py-3 bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 disabled:from-gray-800 disabled:to-gray-800 disabled:text-gray-600 text-white text-sm font-medium rounded-lg transition-all shadow-lg shadow-cyan-500/10 hover:shadow-cyan-500/20 disabled:shadow-none",children:[h&&(0,t.jsxs)("svg",{"aria-hidden":!0,className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),(0,t.jsx)("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}),(0,t.jsx)("span",{children:h?"login"===e?"Signing in…":"Registering…":"login"===e?"Sign in":"Create account"})]})]}),(0,t.jsxs)("p",{className:"text-center text-[11px] text-gray-700 mt-6",children:["Sleep2AGI · Apache-2.0 · ",(0,t.jsx)("a",{href:"https://anet.sh",className:"hover:text-gray-500 transition-colors",children:"anet.sh"}),(0,t.jsx)("span",{className:"mx-1 text-gray-800",children:"·"}),(0,t.jsxs)("span",{className:"font-mono",title:"@sleep2agi/agent-network-dashboard",children:["v",a.DASHBOARD_VERSION]})]})]})]})}])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,70286,e=>{"use strict";e.s(["DASHBOARD_VERSION",0,"0.4.6-preview.139"],70286)},48941,e=>{"use strict";var t=e.i(22381),r=e.i(23910),a=e.i(70286);e.s(["default",0,function(){let[e,s]=(0,r.useState)("login"),[n,o]=(0,r.useState)(""),[i,l]=(0,r.useState)(""),[c,d]=(0,r.useState)(!1),[x,g]=(0,r.useState)(""),[h,m]=(0,r.useState)(!1),u=async t=>{t.preventDefault(),m(!0),g("");try{let t=await fetch("/api/auth/v3",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,username:n,password:i})}),r=await t.json();if(r.ok){r.token&&sessionStorage.setItem("anet_v3_auth",JSON.stringify({user:r.user,token:r.token,networks:r.networks||[],currentNetwork:r.network_id||r.networks?.[0]?.network_id||""})),window.location.assign("/");return}g(r.error||"Login failed")}catch{g("Connection failed")}m(!1)};return(0,t.jsxs)("main",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 font-mono flex items-center justify-center relative overflow-hidden px-4 py-10 sm:py-16",children:[(0,t.jsx)("div",{className:"absolute inset-0 pointer-events-none anet-login-bg","aria-hidden":!0}),(0,t.jsxs)("div",{className:"relative w-full max-w-sm",children:[(0,t.jsxs)("div",{className:"text-center mb-7",children:[(0,t.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 mb-4 rounded-2xl bg-[#111128] border border-[#2a2a4a] anet-login-mark",children:(0,t.jsxs)("svg",{className:"w-9 h-9",viewBox:"0 0 32 32","aria-hidden":!0,children:[(0,t.jsx)("circle",{cx:"16",cy:"16",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",opacity:"0.25",className:"text-cyan-400 anet-login-mark-ring"}),(0,t.jsx)("line",{x1:"16",y1:"10",x2:"10",y2:"20",stroke:"currentColor",strokeWidth:"1",opacity:"0.5",className:"text-cyan-400 anet-login-mark-edge"}),(0,t.jsx)("line",{x1:"16",y1:"10",x2:"22",y2:"20",stroke:"currentColor",strokeWidth:"1",opacity:"0.5",className:"text-cyan-400 anet-login-mark-edge"}),(0,t.jsx)("line",{x1:"10",y1:"20",x2:"22",y2:"20",stroke:"currentColor",strokeWidth:"1",opacity:"0.5",className:"text-cyan-400 anet-login-mark-edge"}),(0,t.jsx)("circle",{cx:"16",cy:"10",r:"3",fill:"currentColor",className:"text-cyan-400 anet-login-mark-node-a"}),(0,t.jsx)("circle",{cx:"10",cy:"20",r:"3",fill:"currentColor",className:"text-green-400 anet-login-mark-node-b"}),(0,t.jsx)("circle",{cx:"22",cy:"20",r:"3",fill:"currentColor",className:"text-violet-400 anet-login-mark-node-c"})]})}),(0,t.jsx)("h1",{className:"text-[22px] sm:text-2xl font-semibold text-white tracking-tight",children:"Agent Network"}),(0,t.jsx)("p",{className:"text-[13px] text-gray-500 mt-1.5 leading-snug",children:"login"===e?(0,t.jsxs)(t.Fragment,{children:["Welcome back · ",(0,t.jsx)("span",{className:"text-gray-600",children:"Tasks · Mesh · Messages"})]}):(0,t.jsxs)(t.Fragment,{children:["Create your account · ",(0,t.jsx)("span",{className:"text-gray-600",children:"Free preview · no credit card"})]})})]}),(0,t.jsx)("div",{className:"flex rounded-lg border border-[#2a2a4a] bg-[#111128] p-1 mb-4",children:["login","register"].map(r=>(0,t.jsx)("button",{type:"button",onClick:()=>{s(r),g("")},className:`flex-1 rounded-md px-3 py-2 text-sm transition-colors ${e===r?"bg-cyan-500/10 text-cyan-300":"text-gray-500 hover:text-gray-200"}`,children:"login"===r?"Sign in":"Register"},r))}),(0,t.jsxs)("form",{onSubmit:u,className:"border border-[#2a2a4a] bg-[#111128]/80 backdrop-blur-sm rounded-xl p-6 shadow-2xl shadow-black/30",children:[(0,t.jsx)("label",{htmlFor:"username",className:"block text-xs text-gray-500 mb-2 uppercase tracking-wider",children:"Username"}),(0,t.jsx)("input",{id:"username",type:"text",value:n,onChange:e=>o(e.target.value),autoFocus:!0,placeholder:"Enter username",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-4 py-3 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:ring-1 focus:ring-cyan-500/20 focus:outline-none transition-all mb-4"}),(0,t.jsx)("label",{htmlFor:"password",className:"block text-xs text-gray-500 mb-2 uppercase tracking-wider",children:"Password"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("input",{id:"password",type:c?"text":"password",value:i,onChange:e=>l(e.target.value),placeholder:"Enter password",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-4 pr-11 py-3 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:ring-1 focus:ring-cyan-500/20 focus:outline-none transition-all"}),(0,t.jsx)("button",{type:"button",onClick:()=>d(e=>!e),tabIndex:-1,"aria-label":c?"Hide password":"Show password",className:"absolute inset-y-0 right-0 flex items-center px-3 text-gray-600 hover:text-gray-300 transition-colors",children:c?(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,t.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),x&&(0,t.jsx)("div",{className:"mt-3 text-sm text-red-300 bg-red-500/5 border border-red-500/10 rounded-lg px-3 py-2",children:x}),(0,t.jsxs)("button",{type:"submit",disabled:h||!i||!n.trim(),className:"mt-5 w-full flex items-center justify-center gap-2 px-4 py-3 bg-gradient-to-r from-cyan-600 to-blue-600 hover:from-cyan-500 hover:to-blue-500 disabled:from-gray-800 disabled:to-gray-800 disabled:text-gray-600 text-white text-sm font-medium rounded-lg transition-all shadow-lg shadow-cyan-500/10 hover:shadow-cyan-500/20 disabled:shadow-none",children:[h&&(0,t.jsxs)("svg",{"aria-hidden":!0,className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),(0,t.jsx)("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}),(0,t.jsx)("span",{children:h?"login"===e?"Signing in…":"Registering…":"login"===e?"Sign in":"Create account"})]})]}),(0,t.jsxs)("p",{className:"text-center text-[11px] text-gray-700 mt-6",children:["Sleep2AGI · Apache-2.0 · ",(0,t.jsx)("a",{href:"https://anet.sh",className:"hover:text-gray-500 transition-colors",children:"anet.sh"}),(0,t.jsx)("span",{className:"mx-1 text-gray-800",children:"·"}),(0,t.jsxs)("span",{className:"font-mono",title:"@sleep2agi/agent-network-dashboard",children:["v",a.DASHBOARD_VERSION]})]})]})]})}])}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,59276,e=>{"use strict";var s=e.i(12629),a=e.i(11449);let t=async e=>{let s=await fetch(e);if(401===s.status)throw window.location.assign("/login"),Error("unauthorized");return s.json()},r={refreshInterval:5e3,dedupingInterval:3e3};function n(e,s){if(!s)return e;let a=e.includes("?")?"&":"?";return`${e}${a}network_id=${encodeURIComponent(s)}`}e.s(["useAnetConfig",0,function(){let{data:e}=(0,s.default)("/api/anet/config",t,{refreshInterval:3e4});return{config:e||null}},"useHealth",0,function(){let{data:e,error:a}=(0,s.default)("/api/hub/health",t,r);return{health:e||null,error:a}},"useLicense",0,function(){let{data:e,error:a}=(0,s.default)("/api/hub/license",t,{refreshInterval:6e4});return{license:e?.ok?e:null,error:a}},"useMessages",0,function(e=100){let{networkId:l}=(0,a.useNetworkId)(),{data:i,error:c,isLoading:d}=(0,s.default)(n(`/api/hub/messages?limit=${e}`,l),t,r);return{messages:i?.messages||[],error:c,isLoading:d}},"useSessions",0,function(){let{networkId:e}=(0,a.useNetworkId)(),{data:l,error:i,isLoading:c}=(0,s.default)(n("/api/hub/status",e),t,r);return{sessions:l?.sessions||[],hint:l?._hint,error:i,isLoading:c}},"useStats",0,function(){let{networkId:e}=(0,a.useNetworkId)(),{data:l,error:i}=(0,s.default)(n("/api/hub/stats",e),t,r);return{stats:l?.ok?l:null,error:i}},"useTasks",0,function(e){let{networkId:l}=(0,a.useNetworkId)(),i=new URLSearchParams({limit:"100",...e}).toString(),{data:c,error:d,isLoading:o}=(0,s.default)(n(`/api/hub/tasks?${i}`,l),t,r);return{tasks:c?.tasks||[],count:c?.count??0,source:c?.source,error:d,isLoading:o}}])},70286,e=>{"use strict";e.s(["DASHBOARD_VERSION",0,"0.4.6-preview.138"],70286)},65610,e=>{"use strict";var s=e.i(22381),a=e.i(23910),t=e.i(56839),r=e.i(59276),n=e.i(70286);e.s(["default",0,function(){let{config:e}=(0,r.useAnetConfig)(),{health:l}=(0,r.useHealth)(),{license:i}=(0,r.useLicense)(),[c,d]=(0,a.useState)(""),[o,x]=(0,a.useState)(""),[m,h]=(0,a.useState)(""),[g,u]=(0,a.useState)(""),[p,N]=(0,a.useState)(""),b="flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between",j="break-all sm:max-w-[320px] sm:text-right";return(0,s.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-white mb-3 lg:ml-0 ml-10",children:"Settings"}),(0,s.jsx)("nav",{className:"mb-8 flex flex-wrap gap-1 text-xs",children:[{href:"#connection",label:"Connection"},{href:"#account",label:"Account"},{href:"#resources",label:"Resources"}].map(e=>(0,s.jsx)("a",{href:e.href,className:"rounded-md px-2.5 py-1 text-gray-500 hover:text-cyan-300 hover:bg-cyan-500/10 transition-colors",children:e.label},e.href))}),(0,s.jsxs)("div",{className:"max-w-2xl space-y-10",children:[(0,s.jsxs)("div",{id:"connection",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Connection"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#2a2a4a]"})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"CommHub Connection"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500 shrink-0",children:"Hub URL"}),(0,s.jsx)("span",{className:`text-cyan-300 ${j}`,children:e?.hub||"not configured"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Config Source"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:e?.source==="file"?"Local file (~/.anet/config.json)":e?.source==="runtime-env"?"Vercel env vars":"Missing"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Auth Token"}),(0,s.jsx)("span",{className:`${e?.tokenConfigured?"text-green-400":"text-red-400"} ${j}`,children:e?.tokenConfigured?`Configured (${e.tokenPreview})`:"Not configured"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Server Auth"}),(0,s.jsx)("span",{className:`${l?.auth==="enabled"?"text-green-400":"text-yellow-400"} sm:text-right`,children:l?.auth||"--"})]}),e?.error&&(0,s.jsx)("div",{className:"border-t border-[#2a2a4a] pt-3 text-xs text-gray-600",children:e.error})]})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Server Info"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Version"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:l?.version||"--"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Sessions"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:l?.sessions??"--"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsxs)("span",{className:"text-gray-500",children:["SSE streams ",(0,s.jsx)("span",{className:"text-gray-600",children:"· server"})]}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:l?.sse_connections??"--"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Uptime"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:l?.uptime?`${Math.floor(l.uptime/3600)}h ${Math.floor(l.uptime%3600/60)}m`:"--"})]})]})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Dashboard"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Version"}),(0,s.jsx)("span",{className:`text-gray-300 font-mono ${j}`,title:"From package.json @sleep2agi/agent-network-dashboard",children:n.DASHBOARD_VERSION})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Data Layer"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:"SWR (5s refresh, 3s dedup)"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Pages"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:"Overview, Tasks, Nodes, Messages, Networks, Audit, Server Logs, Admin, Settings"})]})]})]})]}),(0,s.jsxs)("div",{id:"account",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Account"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#2a2a4a]"})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsxs)("h2",{className:"text-sm font-semibold text-gray-300 mb-4 flex items-center gap-2",children:["License",i?.license&&(0,s.jsxs)("span",{className:`inline-flex items-center gap-1.5 text-[10px] font-medium px-2 py-0.5 rounded-full border ${"pro"===i.license.type?"text-green-300 bg-green-500/10 border-green-500/30":i.license.days_left<=7?"text-red-300 bg-red-500/10 border-red-500/30":"text-amber-300 bg-amber-500/10 border-amber-500/30"}`,children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"w-1.5 h-1.5 rounded-full bg-current"}),i.license.type,i.license.days_left?` \xb7 ${i.license.days_left}d left`:""]})]}),i?.license?(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[i.license.days_left<=7&&(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-red-400 font-medium",children:"⚠ Expiring soon"}),(0,s.jsxs)("span",{className:"text-red-400",children:[i.license.days_left," days left"]})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Expires"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:i.license.expires_at})]}),i.limits&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Max Agents"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:i.limits.max_agents})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Max Networks"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:i.limits.max_networks})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Tasks/Day"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:i.limits.max_tasks_day})]})]}),(0,s.jsxs)("div",{className:"pt-3 border-t border-[#2a2a4a]",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:c,onChange:e=>d(e.target.value),placeholder:"anet-XXXX-XXXX-XXXX-XXXX",className:"flex-1 bg-[#0a0a15] border border-[#2a2a4a] rounded px-3 py-2 text-xs text-white placeholder-gray-600 focus:outline-none"}),(0,s.jsx)("button",{onClick:async()=>{if(!c.trim())return;let e=await fetch("/api/hub/license",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:c})}),s=await e.json();x(s.ok?`Activated: ${s.type}`:`Failed: ${s.error}`),s.ok&&d(""),setTimeout(()=>x(""),5e3)},className:"px-3 py-2 bg-cyan-600 hover:bg-cyan-500 text-white text-xs rounded transition-colors",children:"Activate"})]}),o&&(0,s.jsx)("div",{className:`mt-2 text-xs ${o.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:o})]})]}):(0,s.jsx)("div",{className:"text-xs text-gray-600",children:"License info not available"})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Change Password"}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("input",{type:"password",value:m,onChange:e=>h(e.target.value),placeholder:"Current password",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,s.jsx)("input",{type:"password",value:g,onChange:e=>u(e.target.value),placeholder:"New password",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,s.jsx)("button",{onClick:async()=>{if(!m||!g)return;let e=sessionStorage.getItem("anet_v3_auth");if(!e)return void N("Not logged in with V3 auth");let{token:s}=JSON.parse(e),a=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"change_password",token:s,current_password:m,new_password:g})}),t=await a.json();if(N(t.ok?"Password changed":`Failed: ${t.error}`),t.ok){if(t.token){let s=JSON.parse(e);sessionStorage.setItem("anet_v3_auth",JSON.stringify({...s,token:t.token}))}h(""),u("")}setTimeout(()=>N(""),5e3)},disabled:!m||!g,className:"px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-colors",children:"Change Password"})]}),p&&(0,s.jsx)("div",{className:`mt-2 text-xs ${p.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:p})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Sign out"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mb-3",children:"Signing out clears your dashboard session cookie. You'll return to the login page."}),(0,s.jsx)("button",{onClick:async()=>{await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),window.location.assign("/login")},className:"px-4 py-2 bg-transparent hover:bg-[#1a1a2a] text-gray-300 text-sm rounded-lg border border-[#2a2a4a] hover:border-[#3a3a5a] transition-colors",children:"Sign out"})]})]}),(0,s.jsxs)("div",{id:"resources",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Resources"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#2a2a4a]"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)(t.default,{href:"/settings/tokens",className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"API Tokens"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Create and manage tokens for CLI access."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Manage →"})]}),(0,s.jsxs)(t.default,{href:"/settings/networks",className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Networks"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Create, manage, and delete agent networks."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Manage →"})]})]})]})]})]})}])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,59276,e=>{"use strict";var s=e.i(12629),a=e.i(11449);let t=async e=>{let s=await fetch(e);if(401===s.status)throw window.location.assign("/login"),Error("unauthorized");return s.json()},r={refreshInterval:5e3,dedupingInterval:3e3};function n(e,s){if(!s)return e;let a=e.includes("?")?"&":"?";return`${e}${a}network_id=${encodeURIComponent(s)}`}e.s(["useAnetConfig",0,function(){let{data:e}=(0,s.default)("/api/anet/config",t,{refreshInterval:3e4});return{config:e||null}},"useHealth",0,function(){let{data:e,error:a}=(0,s.default)("/api/hub/health",t,r);return{health:e||null,error:a}},"useLicense",0,function(){let{data:e,error:a}=(0,s.default)("/api/hub/license",t,{refreshInterval:6e4});return{license:e?.ok?e:null,error:a}},"useMessages",0,function(e=100){let{networkId:l}=(0,a.useNetworkId)(),{data:i,error:c,isLoading:d}=(0,s.default)(n(`/api/hub/messages?limit=${e}`,l),t,r);return{messages:i?.messages||[],error:c,isLoading:d}},"useSessions",0,function(){let{networkId:e}=(0,a.useNetworkId)(),{data:l,error:i,isLoading:c}=(0,s.default)(n("/api/hub/status",e),t,r);return{sessions:l?.sessions||[],hint:l?._hint,error:i,isLoading:c}},"useStats",0,function(){let{networkId:e}=(0,a.useNetworkId)(),{data:l,error:i}=(0,s.default)(n("/api/hub/stats",e),t,r);return{stats:l?.ok?l:null,error:i}},"useTasks",0,function(e){let{networkId:l}=(0,a.useNetworkId)(),i=new URLSearchParams({limit:"100",...e}).toString(),{data:c,error:d,isLoading:o}=(0,s.default)(n(`/api/hub/tasks?${i}`,l),t,r);return{tasks:c?.tasks||[],count:c?.count??0,source:c?.source,error:d,isLoading:o}}])},70286,e=>{"use strict";e.s(["DASHBOARD_VERSION",0,"0.4.6-preview.139"],70286)},65610,e=>{"use strict";var s=e.i(22381),a=e.i(23910),t=e.i(56839),r=e.i(59276),n=e.i(70286);e.s(["default",0,function(){let{config:e}=(0,r.useAnetConfig)(),{health:l}=(0,r.useHealth)(),{license:i}=(0,r.useLicense)(),[c,d]=(0,a.useState)(""),[o,x]=(0,a.useState)(""),[m,h]=(0,a.useState)(""),[g,u]=(0,a.useState)(""),[p,N]=(0,a.useState)(""),b="flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between",j="break-all sm:max-w-[320px] sm:text-right";return(0,s.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-white mb-3 lg:ml-0 ml-10",children:"Settings"}),(0,s.jsx)("nav",{className:"mb-8 flex flex-wrap gap-1 text-xs",children:[{href:"#connection",label:"Connection"},{href:"#account",label:"Account"},{href:"#resources",label:"Resources"}].map(e=>(0,s.jsx)("a",{href:e.href,className:"rounded-md px-2.5 py-1 text-gray-500 hover:text-cyan-300 hover:bg-cyan-500/10 transition-colors",children:e.label},e.href))}),(0,s.jsxs)("div",{className:"max-w-2xl space-y-10",children:[(0,s.jsxs)("div",{id:"connection",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Connection"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#2a2a4a]"})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"CommHub Connection"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500 shrink-0",children:"Hub URL"}),(0,s.jsx)("span",{className:`text-cyan-300 ${j}`,children:e?.hub||"not configured"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Config Source"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:e?.source==="file"?"Local file (~/.anet/config.json)":e?.source==="runtime-env"?"Vercel env vars":"Missing"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Auth Token"}),(0,s.jsx)("span",{className:`${e?.tokenConfigured?"text-green-400":"text-red-400"} ${j}`,children:e?.tokenConfigured?`Configured (${e.tokenPreview})`:"Not configured"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Server Auth"}),(0,s.jsx)("span",{className:`${l?.auth==="enabled"?"text-green-400":"text-yellow-400"} sm:text-right`,children:l?.auth||"--"})]}),e?.error&&(0,s.jsx)("div",{className:"border-t border-[#2a2a4a] pt-3 text-xs text-gray-600",children:e.error})]})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Server Info"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Version"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:l?.version||"--"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Sessions"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:l?.sessions??"--"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsxs)("span",{className:"text-gray-500",children:["SSE streams ",(0,s.jsx)("span",{className:"text-gray-600",children:"· server"})]}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:l?.sse_connections??"--"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Uptime"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:l?.uptime?`${Math.floor(l.uptime/3600)}h ${Math.floor(l.uptime%3600/60)}m`:"--"})]})]})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Dashboard"}),(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Version"}),(0,s.jsx)("span",{className:`text-gray-300 font-mono ${j}`,title:"From package.json @sleep2agi/agent-network-dashboard",children:n.DASHBOARD_VERSION})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Data Layer"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:"SWR (5s refresh, 3s dedup)"})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Pages"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:"Overview, Tasks, Nodes, Messages, Networks, Audit, Server Logs, Admin, Settings"})]})]})]})]}),(0,s.jsxs)("div",{id:"account",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Account"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#2a2a4a]"})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsxs)("h2",{className:"text-sm font-semibold text-gray-300 mb-4 flex items-center gap-2",children:["License",i?.license&&(0,s.jsxs)("span",{className:`inline-flex items-center gap-1.5 text-[10px] font-medium px-2 py-0.5 rounded-full border ${"pro"===i.license.type?"text-green-300 bg-green-500/10 border-green-500/30":i.license.days_left<=7?"text-red-300 bg-red-500/10 border-red-500/30":"text-amber-300 bg-amber-500/10 border-amber-500/30"}`,children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"w-1.5 h-1.5 rounded-full bg-current"}),i.license.type,i.license.days_left?` \xb7 ${i.license.days_left}d left`:""]})]}),i?.license?(0,s.jsxs)("div",{className:"space-y-3 text-sm",children:[i.license.days_left<=7&&(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-red-400 font-medium",children:"⚠ Expiring soon"}),(0,s.jsxs)("span",{className:"text-red-400",children:[i.license.days_left," days left"]})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Expires"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:i.license.expires_at})]}),i.limits&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Max Agents"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:i.limits.max_agents})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Max Networks"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:i.limits.max_networks})]}),(0,s.jsxs)("div",{className:b,children:[(0,s.jsx)("span",{className:"text-gray-500",children:"Tasks/Day"}),(0,s.jsx)("span",{className:`text-gray-300 ${j}`,children:i.limits.max_tasks_day})]})]}),(0,s.jsxs)("div",{className:"pt-3 border-t border-[#2a2a4a]",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:c,onChange:e=>d(e.target.value),placeholder:"anet-XXXX-XXXX-XXXX-XXXX",className:"flex-1 bg-[#0a0a15] border border-[#2a2a4a] rounded px-3 py-2 text-xs text-white placeholder-gray-600 focus:outline-none"}),(0,s.jsx)("button",{onClick:async()=>{if(!c.trim())return;let e=await fetch("/api/hub/license",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:c})}),s=await e.json();x(s.ok?`Activated: ${s.type}`:`Failed: ${s.error}`),s.ok&&d(""),setTimeout(()=>x(""),5e3)},className:"px-3 py-2 bg-cyan-600 hover:bg-cyan-500 text-white text-xs rounded transition-colors",children:"Activate"})]}),o&&(0,s.jsx)("div",{className:`mt-2 text-xs ${o.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:o})]})]}):(0,s.jsx)("div",{className:"text-xs text-gray-600",children:"License info not available"})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Change Password"}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("input",{type:"password",value:m,onChange:e=>h(e.target.value),placeholder:"Current password",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,s.jsx)("input",{type:"password",value:g,onChange:e=>u(e.target.value),placeholder:"New password",className:"w-full bg-[#0a0a15] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-cyan-500/50 focus:outline-none"}),(0,s.jsx)("button",{onClick:async()=>{if(!m||!g)return;let e=sessionStorage.getItem("anet_v3_auth");if(!e)return void N("Not logged in with V3 auth");let{token:s}=JSON.parse(e),a=await fetch("/api/hub/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"change_password",token:s,current_password:m,new_password:g})}),t=await a.json();if(N(t.ok?"Password changed":`Failed: ${t.error}`),t.ok){if(t.token){let s=JSON.parse(e);sessionStorage.setItem("anet_v3_auth",JSON.stringify({...s,token:t.token}))}h(""),u("")}setTimeout(()=>N(""),5e3)},disabled:!m||!g,className:"px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 disabled:text-gray-600 text-white text-sm rounded-lg transition-colors",children:"Change Password"})]}),p&&(0,s.jsx)("div",{className:`mt-2 text-xs ${p.startsWith("Failed")?"text-red-400":"text-green-400"}`,children:p})]}),(0,s.jsxs)("section",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-4",children:"Sign out"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mb-3",children:"Signing out clears your dashboard session cookie. You'll return to the login page."}),(0,s.jsx)("button",{onClick:async()=>{await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),window.location.assign("/login")},className:"px-4 py-2 bg-transparent hover:bg-[#1a1a2a] text-gray-300 text-sm rounded-lg border border-[#2a2a4a] hover:border-[#3a3a5a] transition-colors",children:"Sign out"})]})]}),(0,s.jsxs)("div",{id:"resources",className:"space-y-4 scroll-mt-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("div",{className:"text-[11px] uppercase tracking-[0.14em] text-gray-400 font-semibold",children:"Resources"}),(0,s.jsx)("div",{className:"flex-1 h-px bg-[#2a2a4a]"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)(t.default,{href:"/settings/tokens",className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"API Tokens"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Create and manage tokens for CLI access."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Manage →"})]}),(0,s.jsxs)(t.default,{href:"/settings/networks",className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-5 hover:border-cyan-500/30 transition-colors",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:"Networks"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Create, manage, and delete agent networks."}),(0,s.jsx)("span",{className:"text-xs text-cyan-400 mt-3 inline-block",children:"Manage →"})]})]})]})]})]})}])}]);