botmux 2.114.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/adapters/backend/riff-backend.d.ts +15 -0
  2. package/dist/adapters/backend/riff-backend.d.ts.map +1 -1
  3. package/dist/adapters/backend/riff-backend.js +9 -3
  4. package/dist/adapters/backend/riff-backend.js.map +1 -1
  5. package/dist/core/dashboard-ipc-server.js +2 -2
  6. package/dist/core/dashboard-ipc-server.js.map +1 -1
  7. package/dist/dashboard/compat.d.ts +19 -0
  8. package/dist/dashboard/compat.d.ts.map +1 -0
  9. package/dist/dashboard/compat.js +38 -0
  10. package/dist/dashboard/compat.js.map +1 -0
  11. package/dist/dashboard/stale-chunk-module.d.ts +3 -0
  12. package/dist/dashboard/stale-chunk-module.d.ts.map +1 -0
  13. package/dist/dashboard/stale-chunk-module.js +55 -0
  14. package/dist/dashboard/stale-chunk-module.js.map +1 -0
  15. package/dist/dashboard/web/app.d.ts.map +1 -1
  16. package/dist/dashboard/web/app.js +64 -2
  17. package/dist/dashboard/web/app.js.map +1 -1
  18. package/dist/dashboard/web/bot-defaults-page.d.ts.map +1 -1
  19. package/dist/dashboard/web/bot-defaults-page.js +9 -7
  20. package/dist/dashboard/web/bot-defaults-page.js.map +1 -1
  21. package/dist/dashboard/web/i18n.js +10 -10
  22. package/dist/dashboard/web/i18n.js.map +1 -1
  23. package/dist/dashboard/web/sessions-page.js +2 -2
  24. package/dist/dashboard/web/sessions-page.js.map +1 -1
  25. package/dist/dashboard/web/stale-chunk-reload.d.ts +16 -0
  26. package/dist/dashboard/web/stale-chunk-reload.d.ts.map +1 -0
  27. package/dist/dashboard/web/stale-chunk-reload.js +51 -0
  28. package/dist/dashboard/web/stale-chunk-reload.js.map +1 -0
  29. package/dist/dashboard-web/app.js +1 -1
  30. package/dist/dashboard-web/chunks/{bot-defaults-page-SRCBF7Z3.js → bot-defaults-page-MBORWWP7.js} +5 -5
  31. package/dist/dashboard-web/chunks/{chunk-3H6MVXXU.js → chunk-4QTBR7UF.js} +2 -2
  32. package/dist/dashboard-web/chunks/{chunk-77KD4TK2.js → chunk-7STGZ5BX.js} +1 -1
  33. package/dist/dashboard-web/chunks/{chunk-D2I5F4MY.js → chunk-EIO5AWDA.js} +1 -1
  34. package/dist/dashboard-web/chunks/{chunk-NGRUZCXP.js → chunk-G43RUPUN.js} +1 -1
  35. package/dist/dashboard-web/chunks/{connectors-page-RM3BJVMV.js → connectors-page-LKDT4WBG.js} +1 -1
  36. package/dist/dashboard-web/chunks/{groups-page-3D4YSYLA.js → groups-page-XKIWJ2TP.js} +1 -1
  37. package/dist/dashboard-web/chunks/{insights-page-CRFJKA54.js → insights-page-CBEZCYKV.js} +1 -1
  38. package/dist/dashboard-web/chunks/{monitor-room-HLK3XDT2.js → monitor-room-AQTHAWXA.js} +1 -1
  39. package/dist/dashboard-web/chunks/{monitoring-page-E3SNZFFN.js → monitoring-page-2R4NCNBQ.js} +1 -1
  40. package/dist/dashboard-web/chunks/{office-page-MKQ2TENK.js → office-page-5M6MQIIL.js} +1 -1
  41. package/dist/dashboard-web/chunks/{overview-page-ICFKKRLV.js → overview-page-N22HDZ2V.js} +1 -1
  42. package/dist/dashboard-web/chunks/{roles-page-2DFJ7YRU.js → roles-page-J6K2HWFX.js} +1 -1
  43. package/dist/dashboard-web/chunks/{schedules-page-S4WDIXH5.js → schedules-page-CGAQCB4J.js} +1 -1
  44. package/dist/dashboard-web/chunks/{sessions-page-4XWGUGB5.js → sessions-page-WJ2QYTIE.js} +2 -2
  45. package/dist/dashboard-web/chunks/{settings-page-OBTE4LYP.js → settings-page-GLRWV5KU.js} +1 -1
  46. package/dist/dashboard-web/chunks/{skills-page-CTRQJR47.js → skills-page-KQVW42QU.js} +1 -1
  47. package/dist/dashboard-web/chunks/{team-federation-page-GICLDKJP.js → team-federation-page-5PYUOV5M.js} +1 -1
  48. package/dist/dashboard-web/chunks/{v3-page-DI55IRL5.js → v3-page-DXPFILRZ.js} +1 -1
  49. package/dist/dashboard-web/chunks/{whiteboards-page-7KFWMILV.js → whiteboards-page-NUH6VZ4I.js} +1 -1
  50. package/dist/dashboard.js +26 -0
  51. package/dist/dashboard.js.map +1 -1
  52. package/dist/desktop/main/auto-start.d.ts +17 -0
  53. package/dist/desktop/main/auto-start.d.ts.map +1 -0
  54. package/dist/desktop/main/auto-start.js +37 -0
  55. package/dist/desktop/main/auto-start.js.map +1 -0
  56. package/dist/desktop/main/dashboard-compat.d.ts +25 -0
  57. package/dist/desktop/main/dashboard-compat.d.ts.map +1 -0
  58. package/dist/desktop/main/dashboard-compat.js +117 -0
  59. package/dist/desktop/main/dashboard-compat.js.map +1 -0
  60. package/dist/desktop/main/external-runtime.d.ts +29 -0
  61. package/dist/desktop/main/external-runtime.d.ts.map +1 -0
  62. package/dist/desktop/main/external-runtime.js +202 -0
  63. package/dist/desktop/main/external-runtime.js.map +1 -0
  64. package/dist/desktop/main/ipc.d.ts +20 -0
  65. package/dist/desktop/main/ipc.d.ts.map +1 -0
  66. package/dist/desktop/main/ipc.js +241 -0
  67. package/dist/desktop/main/ipc.js.map +1 -0
  68. package/dist/desktop/main/log-service.d.ts +4 -0
  69. package/dist/desktop/main/log-service.d.ts.map +1 -0
  70. package/dist/desktop/main/log-service.js +53 -0
  71. package/dist/desktop/main/log-service.js.map +1 -0
  72. package/dist/desktop/main/login-item.d.ts +10 -0
  73. package/dist/desktop/main/login-item.d.ts.map +1 -0
  74. package/dist/desktop/main/login-item.js +11 -0
  75. package/dist/desktop/main/login-item.js.map +1 -0
  76. package/dist/desktop/main/node-command.d.ts +22 -0
  77. package/dist/desktop/main/node-command.d.ts.map +1 -0
  78. package/dist/desktop/main/node-command.js +56 -0
  79. package/dist/desktop/main/node-command.js.map +1 -0
  80. package/dist/desktop/main/paths.d.ts +11 -0
  81. package/dist/desktop/main/paths.d.ts.map +1 -0
  82. package/dist/desktop/main/paths.js +13 -0
  83. package/dist/desktop/main/paths.js.map +1 -0
  84. package/dist/desktop/main/pm2-apps.d.ts +15 -0
  85. package/dist/desktop/main/pm2-apps.d.ts.map +1 -0
  86. package/dist/desktop/main/pm2-apps.js +97 -0
  87. package/dist/desktop/main/pm2-apps.js.map +1 -0
  88. package/dist/desktop/main/runtime-service.d.ts +49 -0
  89. package/dist/desktop/main/runtime-service.d.ts.map +1 -0
  90. package/dist/desktop/main/runtime-service.js +297 -0
  91. package/dist/desktop/main/runtime-service.js.map +1 -0
  92. package/dist/desktop/main/runtime-source.d.ts +17 -0
  93. package/dist/desktop/main/runtime-source.d.ts.map +1 -0
  94. package/dist/desktop/main/runtime-source.js +61 -0
  95. package/dist/desktop/main/runtime-source.js.map +1 -0
  96. package/dist/desktop/main/tray.d.ts +10 -0
  97. package/dist/desktop/main/tray.d.ts.map +1 -0
  98. package/dist/desktop/main/tray.js +27 -0
  99. package/dist/desktop/main/tray.js.map +1 -0
  100. package/dist/desktop/main/window.d.ts +16 -0
  101. package/dist/desktop/main/window.d.ts.map +1 -0
  102. package/dist/desktop/main/window.js +113 -0
  103. package/dist/desktop/main/window.js.map +1 -0
  104. package/dist/desktop/main.d.ts +2 -0
  105. package/dist/desktop/main.d.ts.map +1 -0
  106. package/dist/desktop/main.js +175 -0
  107. package/dist/desktop/main.js.map +1 -0
  108. package/dist/desktop/preload.d.ts +2 -0
  109. package/dist/desktop/preload.d.ts.map +1 -0
  110. package/dist/desktop/preload.js +24 -0
  111. package/dist/desktop/preload.js.map +1 -0
  112. package/dist/desktop/renderer/app.d.ts +35 -0
  113. package/dist/desktop/renderer/app.d.ts.map +1 -0
  114. package/dist/desktop/renderer/app.js +945 -0
  115. package/dist/desktop/renderer/app.js.map +1 -0
  116. package/dist/desktop/renderer/dashboard-url.d.ts +13 -0
  117. package/dist/desktop/renderer/dashboard-url.d.ts.map +1 -0
  118. package/dist/desktop/renderer/dashboard-url.js +98 -0
  119. package/dist/desktop/renderer/dashboard-url.js.map +1 -0
  120. package/dist/desktop/renderer/runtime-state.d.ts +8 -0
  121. package/dist/desktop/renderer/runtime-state.d.ts.map +1 -0
  122. package/dist/desktop/renderer/runtime-state.js +67 -0
  123. package/dist/desktop/renderer/runtime-state.js.map +1 -0
  124. package/dist/desktop/shared/types.d.ts +48 -0
  125. package/dist/desktop/shared/types.d.ts.map +1 -0
  126. package/dist/desktop/shared/types.js +2 -0
  127. package/dist/desktop/shared/types.js.map +1 -0
  128. package/dist/desktop/smoke.d.ts +28 -0
  129. package/dist/desktop/smoke.d.ts.map +1 -0
  130. package/dist/desktop/smoke.js +258 -0
  131. package/dist/desktop/smoke.js.map +1 -0
  132. package/dist/utils/version-info.d.ts +25 -0
  133. package/dist/utils/version-info.d.ts.map +1 -0
  134. package/dist/utils/version-info.js +48 -0
  135. package/dist/utils/version-info.js.map +1 -0
  136. package/package.json +9 -1
@@ -0,0 +1,51 @@
1
+ const STALE_CHUNK_RELOAD_KEY_PREFIX = 'botmux.dashboard.stale-chunk-reload.v1:';
2
+ const DYNAMIC_IMPORT_ERROR_RE = /Failed to fetch dynamically imported module|Importing a module script failed|error loading dynamically imported module|dynamically imported module/i;
3
+ const MODULE_URL_RE = /\b(?:https?:\/\/|\/assets\/)\S+?\.js\b/;
4
+ function errorText(err) {
5
+ if (err instanceof Error)
6
+ return `${err.name}: ${err.message}`;
7
+ return String(err);
8
+ }
9
+ export function isLikelyStaleRouteChunkError(err) {
10
+ return DYNAMIC_IMPORT_ERROR_RE.test(errorText(err));
11
+ }
12
+ function reloadKeyFor(err, env) {
13
+ const text = errorText(err);
14
+ const moduleUrl = text.match(MODULE_URL_RE)?.[0];
15
+ const source = moduleUrl || `${env.href}|${env.hash}`;
16
+ return `${STALE_CHUNK_RELOAD_KEY_PREFIX}${source.slice(-240)}`;
17
+ }
18
+ export function maybeReloadForStaleRouteChunk(err, env) {
19
+ if (!isLikelyStaleRouteChunkError(err))
20
+ return false;
21
+ const key = reloadKeyFor(err, env);
22
+ try {
23
+ // A loaded app.js can survive a dashboard upgrade and still point at
24
+ // removed content-hashed chunks. Reload once to fetch the current shell,
25
+ // but persist the guard so a real network/build failure does not loop.
26
+ if (env.sessionStorage.getItem(key) === '1')
27
+ return false;
28
+ env.sessionStorage.setItem(key, '1');
29
+ }
30
+ catch {
31
+ return false;
32
+ }
33
+ env.reload();
34
+ return true;
35
+ }
36
+ export function maybeReloadBrowserForStaleRouteChunk(err, env) {
37
+ if (!isLikelyStaleRouteChunkError(err))
38
+ return false;
39
+ let sessionStorage;
40
+ try {
41
+ // Some embedded/browser contexts can throw while reading the storage getter.
42
+ // Keep the original route error path instead of replacing it with a
43
+ // SecurityError when the reload guard cannot be persisted.
44
+ sessionStorage = env.getSessionStorage();
45
+ }
46
+ catch {
47
+ return false;
48
+ }
49
+ return maybeReloadForStaleRouteChunk(err, { ...env, sessionStorage });
50
+ }
51
+ //# sourceMappingURL=stale-chunk-reload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stale-chunk-reload.js","sourceRoot":"","sources":["../../../src/dashboard/web/stale-chunk-reload.ts"],"names":[],"mappings":"AAcA,MAAM,6BAA6B,GAAG,yCAAyC,CAAC;AAChF,MAAM,uBAAuB,GAC3B,qJAAqJ,CAAC;AACxJ,MAAM,aAAa,GAAG,wCAAwC,CAAC;AAE/D,SAAS,SAAS,CAAC,GAAY;IAC7B,IAAI,GAAG,YAAY,KAAK;QAAE,OAAO,GAAG,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;IAC/D,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,GAAY;IACvD,OAAO,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,YAAY,CAAC,GAAY,EAAE,GAAwB;IAC1D,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAC5B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,SAAS,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;IACtD,OAAO,GAAG,6BAA6B,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,GAAY,EAAE,GAAwB;IAClF,IAAI,CAAC,4BAA4B,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAErD,MAAM,GAAG,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACnC,IAAI,CAAC;QACH,qEAAqE;QACrE,yEAAyE;QACzE,uEAAuE;QACvE,IAAI,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG;YAAE,OAAO,KAAK,CAAC;QAC1D,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IAED,GAAG,CAAC,MAAM,EAAE,CAAC;IACb,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,oCAAoC,CAAC,GAAY,EAAE,GAA+B;IAChG,IAAI,CAAC,4BAA4B,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAErD,IAAI,cAAoD,CAAC;IACzD,IAAI,CAAC;QACH,6EAA6E;QAC7E,oEAAoE;QACpE,2DAA2D;QAC3D,cAAc,GAAG,GAAG,CAAC,iBAAiB,EAAE,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,6BAA6B,CAAC,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,cAAc,EAAE,CAAC,CAAC;AACxE,CAAC"}
@@ -1 +1 @@
1
- import{a as xe,b as Me}from"./chunks/chunk-77KD4TK2.js";import{b as we}from"./chunks/chunk-SZOB6VK2.js";import{a as fe}from"./chunks/chunk-BD3PZGH2.js";import{a as G,b as be,c as ye}from"./chunks/chunk-NGRUZCXP.js";import{i as ve}from"./chunks/chunk-I35DXGM4.js";import{A as he,C as me,F as pe,G as U,a as K,b as le,e as ce,r as g,s as m,t as de,u as ue}from"./chunks/chunk-3H6MVXXU.js";import{a as qe,c as Ge,d as ge}from"./chunks/chunk-5THX4DI2.js";import{c as I}from"./chunks/chunk-7SZRL6FY.js";var We=I(Ge(),1),p=I(qe(),1);var J="botmux:close-theme-menu",Xe={palette:'<circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2a10 10 0 0 0 0 20h1.7a2.3 2.3 0 0 0 1.6-4c-.5-.5-.2-1.3.5-1.3H17a5 5 0 0 0 5-5 9.7 9.7 0 0 0-10-9.7z"/>',monitor:'<rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/>',sun:'<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>',moon:'<path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"/>',cpu:'<path d="M12 20v2"/><path d="M12 2v2"/><path d="M17 20v2"/><path d="M17 2v2"/><path d="M2 12h2"/><path d="M2 17h2"/><path d="M2 7h2"/><path d="M20 12h2"/><path d="M20 17h2"/><path d="M20 7h2"/><path d="M7 20v2"/><path d="M7 2v2"/><rect x="4" y="4" width="16" height="16" rx="2"/><rect x="8" y="8" width="8" height="8" rx="1"/>',zap:'<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',chevron:'<path d="m6 9 6 6 6-6"/>'},Te=[{labelKey:"theme.base",options:[{value:"system",labelKey:"status.system",icon:"monitor"},{value:"light",labelKey:"status.light",icon:"sun"},{value:"dark",labelKey:"status.dark",icon:"moon"}]},{labelKey:"theme.skins",options:[{value:"cyber",labelKey:"skin.cyber",icon:"cpu"},{value:"fallout",labelKey:"skin.fallout",icon:"zap"}]}],Ee=Te.flatMap(e=>e.options),y=!1,O=null,H=null,Je=70,Ye=120;function X(e){return`<svg class="tm-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Xe[e]??""}</svg>`}function Qe(e){return e.replace(/[&<>"]/g,n=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[n])}function Le(){let e=document.getElementById("theme-menu"),n=document.getElementById("theme-menu-btn"),o=document.getElementById("theme-menu-pop");if(!e||!n||!o||e.dataset.themeMenuInit==="1")return;e.dataset.themeMenuInit="1",o.innerHTML=Te.map(s=>`<div class="tm-group" data-label-key="${s.labelKey}"></div>`+s.options.map(u=>`<button type="button" class="tm-item" role="option" data-value="${u.value}"><span class="tm-ic">${X(u.icon)}</span><span class="tm-label" data-label-key="${u.labelKey}"></span></button>`).join("")).join("");let r=()=>{if(!y)return;let s=n.getBoundingClientRect(),u=12,c=Math.min(Math.max(o.offsetWidth||216,216),Math.max(0,window.innerWidth-u*2)),N=u+c/2,v=window.innerWidth-u-c/2,b=s.left+s.width/2,E=Math.min(Math.max(b,N),Math.max(N,v)),q=Math.max(180,window.innerHeight-s.bottom-20);o.style.setProperty("--theme-menu-pop-left",`${Math.round(E)}px`),o.style.setProperty("--theme-menu-pop-top",`${Math.round(s.bottom+8)}px`),o.style.setProperty("--theme-menu-pop-max-height",`${Math.round(q)}px`)},a=s=>{O!=null&&(window.clearTimeout(O),O=null),H!=null&&(window.clearTimeout(H),H=null),y=s,n.setAttribute("aria-expanded",String(y)),document.body.classList.toggle("theme-menu-open",y),y?(o.hidden=!1,r(),window.requestAnimationFrame(()=>e.classList.add("open"))):(e.classList.remove("open"),H=window.setTimeout(()=>{H=null,y||(o.hidden=!0)},Ye))},d=()=>a(!0),l=()=>{O==null&&(O=window.setTimeout(()=>a(!1),Je))},h=s=>{s.pointerType!=="touch"&&d()},i=s=>{s.pointerType!=="touch"&&l()};e.addEventListener("pointerenter",h),e.addEventListener("pointerleave",i),o.addEventListener("pointerenter",h),o.addEventListener("pointerleave",i),n.addEventListener("click",s=>{s.stopPropagation(),a(!y)}),n.addEventListener("focus",()=>{n.matches(":focus-visible")&&d()}),e.addEventListener("focusout",s=>{let u=s.relatedTarget;(!(u instanceof Node)||!e.contains(u))&&l()}),o.addEventListener("click",s=>{let u=s.target.closest(".tm-item");u&&(g.setTheme(u.dataset.value??"system"),a(!1))}),document.addEventListener("click",s=>{y&&!e.contains(s.target)&&a(!1)}),document.addEventListener("pointermove",s=>{if(!y||s.pointerType==="touch")return;let u=s.target;u instanceof Node&&e.contains(u)||l()}),document.addEventListener("keydown",s=>{s.key==="Escape"&&y&&a(!1)}),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0),window.addEventListener(J,()=>{y&&a(!1)}),Y()}function Y(){let e=document.getElementById("theme-menu-btn");if(!e)return;let n=Ee.find(o=>o.value===g.theme)??Ee[0];e.innerHTML=`<span class="tm-ic">${X("palette")}</span><span class="tm-current">${Qe(m(n.labelKey))}</span><span class="tm-chev">${X("chevron")}</span>`,document.querySelectorAll("#theme-menu-pop [data-label-key]").forEach(o=>{o.textContent=m(o.dataset.labelKey??"")}),document.querySelectorAll("#theme-menu-pop .tm-item").forEach(o=>{o.classList.toggle("active",o.dataset.value===g.theme)})}function f(e,n,o,r,a=!1){return{id:e,routePrefix:n,rerenderOnUiChange:a,load:async()=>(await o())[r]}}var Ze=[{id:"plugins",routePrefix:"#/plugins",rerenderOnUiChange:!1,load:async()=>{let e=await import("./chunks/plugin-page-7FW2LPJH.js");return n=>e.renderPluginPage(n)}},f("workflows","#/workflows",()=>import("./chunks/v3-page-DI55IRL5.js"),"renderV3RunsPage"),f("groups","#/groups",()=>import("./chunks/groups-page-3D4YSYLA.js"),"renderGroupsPage"),f("settings","#/settings",()=>import("./chunks/settings-page-OBTE4LYP.js"),"renderSettingsPage"),f("bot-defaults","#/bot-defaults",()=>import("./chunks/bot-defaults-page-SRCBF7Z3.js"),"renderBotDefaultsPage"),f("skills","#/skills",()=>import("./chunks/skills-page-CTRQJR47.js"),"renderSkillsPage"),f("connectors-logs","#/connectors/logs",()=>import("./chunks/connectors-page-RM3BJVMV.js"),"renderConnectorsLogsPage"),f("webhook-logs","#/webhook-logs",()=>import("./chunks/connectors-page-RM3BJVMV.js"),"renderConnectorsLogsPage"),f("connectors","#/connectors",()=>import("./chunks/connectors-page-RM3BJVMV.js"),"renderConnectorsPage"),f("team-manage","#/team/manage",()=>import("./chunks/team-federation-page-GICLDKJP.js"),"renderTeamManagePage"),f("team","#/team",()=>import("./chunks/team-federation-page-GICLDKJP.js"),"renderTeamFederationPage"),f("roles-profile","#/roles/profile",()=>import("./chunks/roles-page-2DFJ7YRU.js"),"renderRoleProfilesPage"),f("roles","#/roles",()=>import("./chunks/roles-page-2DFJ7YRU.js"),"renderRolesPage"),f("schedules","#/schedules",()=>import("./chunks/schedules-page-S4WDIXH5.js"),"renderSchedulesPage"),f("whiteboards","#/whiteboards",()=>import("./chunks/whiteboards-page-7KFWMILV.js"),"renderWhiteboardsPage"),f("monitoring","#/monitoring",()=>import("./chunks/monitoring-page-E3SNZFFN.js"),"renderMonitoringPage"),f("sessions","#/sessions",()=>import("./chunks/sessions-page-4XWGUGB5.js"),"renderSessionsPage"),f("monitor-room","#/monitor-room",()=>import("./chunks/monitor-room-HLK3XDT2.js"),"renderMonitorRoomPage",!0),f("office","#/office",()=>import("./chunks/office-page-MKQ2TENK.js"),"renderOfficePage"),f("insights","#/insights",()=>import("./chunks/insights-page-CRFJKA54.js"),"renderInsightsPage")];function Ne(e){return Ze.find(n=>n.exact?e===n.routePrefix:e.startsWith(n.routePrefix))}async function Se(){let e=await import("./chunks/overview-page-ICFKKRLV.js");return n=>e.renderOverviewPage(n)}function ke(){return{seq:0,pageDispose:null,rerenderOnUiChange:!0}}function Oe(e){let n=++e.seq;return e.pageDispose&&(e.pageDispose(),e.pageDispose=null),n}function Re(e,n){return n===e.seq}async function He(e,n,o,r,a={}){let d=await r();if(!Re(e,n))return!1;let l=d(o);return Re(e,n)?(e.pageDispose=typeof l=="function"?l:null,e.rerenderOnUiChange=a.rerenderOnUiChange??!0,!0):(typeof l=="function"&&l(),!1)}var et=new Set(["auto","scroll","overlay"]),z=28,x=3,S=6,Pe=!1,$e=null,De=new WeakMap,M=new Map,Ae=null,Ce=null,Q=0,Z=0,P=null;function tt(e){return e.closest("dialog[open]")??document.body}function nt(e){let n=De.get(e);if(n?.isConnected)return n;let o=document.createElement("div");return o.className="floating-scrollbar-layer",o.setAttribute("aria-hidden","true"),e.appendChild(o),De.set(e,o),o}function ot(e){return et.has(e)}function ee(e,n){let o=getComputedStyle(e),r=n==="y"?o.overflowY:o.overflowX;return ot(r)?n==="y"?e.scrollHeight-e.clientHeight>1:e.scrollWidth-e.clientWidth>1:!1}function rt(e){if(!e.isConnected||e.closest("[hidden]"))return!1;let n=e.getBoundingClientRect();return n.width>0&&n.height>0&&n.bottom>0&&n.right>0&&n.top<window.innerHeight&&n.left<window.innerWidth}function at(e){return[e,...Array.from(e.querySelectorAll("*"))].filter(o=>rt(o)&&(ee(o,"x")||ee(o,"y")))}function W(e){e.hideTimer!==void 0&&window.clearTimeout(e.hideTimer),e.track.remove()}function it(e,n){let o=M.get(e);o||(o={},M.set(e,o));let r=o[n],a=tt(e),d=nt(a);if(r?.track.parentElement===d)return r;r&&W(r);let l=document.createElement("div"),h=document.createElement("div");l.className=`floating-scrollbar floating-scrollbar-${n}`,h.className="floating-scrollbar-thumb",l.appendChild(h),d.appendChild(l);let i={target:e,axis:n,track:l,thumb:h,hideTimer:void 0};return o[n]=i,i}function te(e,n=!1){e.track.classList.add("is-visible"),e.hideTimer!==void 0&&window.clearTimeout(e.hideTimer),e.hideTimer=n?void 0:window.setTimeout(()=>{e.track.classList.remove("is-visible","is-active"),e.hideTimer=void 0},900)}function st(e){let{target:n,axis:o,track:r,thumb:a}=e,d=n.getBoundingClientRect();if(o==="y"){let N=Math.max(0,d.top+x),v=Math.min(window.innerHeight,d.bottom-x),b=Math.max(0,v-N);if(b<z||n.scrollHeight<=n.clientHeight){r.hidden=!0;return}let E=Math.max(z,Math.round(b*n.clientHeight/n.scrollHeight)),q=Math.max(1,n.scrollHeight-n.clientHeight),je=Math.round((b-E)*n.scrollTop/q);r.hidden=!1,r.style.left=`${Math.min(window.innerWidth-S-x,Math.max(x,d.right-S-x))}px`,r.style.top=`${N}px`,r.style.width=`${S}px`,r.style.height=`${b}px`,a.style.width="100%",a.style.height=`${E}px`,a.style.transform=`translate3d(0, ${je}px, 0)`;return}let l=Math.max(0,d.left+x),h=Math.min(window.innerWidth,d.right-x),i=Math.max(0,h-l);if(i<z||n.scrollWidth<=n.clientWidth){r.hidden=!0;return}let s=Math.max(z,Math.round(i*n.clientWidth/n.scrollWidth)),u=Math.max(1,n.scrollWidth-n.clientWidth),c=Math.round((i-s)*n.scrollLeft/u);r.hidden=!1,r.style.left=`${l}px`,r.style.top=`${Math.min(window.innerHeight-S-x,Math.max(x,d.bottom-S-x))}px`,r.style.width=`${i}px`,r.style.height=`${S}px`,a.style.width=`${s}px`,a.style.height="100%",a.style.transform=`translate3d(${c}px, 0, 0)`}function R(){Q||(Q=window.requestAnimationFrame(()=>{Q=0,ct()}))}function lt(){Z||(Z=window.setTimeout(()=>{Z=0,R()},120))}function ct(){let e=$e;if(!e)return;let n=new Set(at(e));for(let[o,r]of M)n.has(o)||(r.x&&W(r.x),r.y&&W(r.y),M.delete(o));for(let o of n){let r=o===P;for(let a of["x","y"]){let d=M.get(o);if(!ee(o,a)){let h=d?.[a];h&&(W(h),delete d?.[a]);continue}let l=it(o,a);st(l),r&&te(l,!0)}}}function dt(e){if(!(e instanceof HTMLElement))return;let n=M.get(e);if(n)for(let o of Object.values(n))o&&(o.track.classList.add("is-active"),te(o))}function ut(e){for(let n=e;n;n=n.parentElement)if(n instanceof HTMLElement&&M.has(n))return n;return null}function Be(e){if(P===e)return;let n=P?M.get(P):void 0;if(P=e,n)for(let r of Object.values(n))r?.track.classList.remove("is-visible");let o=e?M.get(e):void 0;if(o)for(let r of Object.values(o))r&&te(r,!0)}function Ie(e){Pe||(Pe=!0,$e=e,document.documentElement.classList.add("floating-scrollbars-on"),Ae=typeof ResizeObserver>"u"?null:new ResizeObserver(R),Ae?.observe(e),Ce=new MutationObserver(n=>{for(let o of n){let r=o.target;if(!(r instanceof Element&&r.closest(".floating-scrollbar-layer"))){lt();return}}}),Ce.observe(e,{attributes:!0,attributeFilter:["class","style","hidden","open"],childList:!0,subtree:!0}),document.addEventListener("scroll",n=>{dt(n.target),R()},!0),window.addEventListener("resize",R),window.addEventListener("hashchange",R),document.addEventListener("pointermove",n=>{Be(ut(document.elementFromPoint(n.clientX,n.clientY)))}),document.addEventListener("pointerleave",()=>Be(null)),R())}var t=I(ge(),1),ht=["roles","role-profiles","bot-defaults","skills","plugins","team","connectors","insights","whiteboards"],D=[{id:"overview",href:"#/",labelKey:"nav.overview",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"1.5",y:"1.5",width:"5.4",height:"5.4",rx:"1.5"}),(0,t.jsx)("rect",{x:"9.1",y:"1.5",width:"5.4",height:"5.4",rx:"1.5"}),(0,t.jsx)("rect",{x:"1.5",y:"9.1",width:"5.4",height:"5.4",rx:"1.5"}),(0,t.jsx)("rect",{x:"9.1",y:"9.1",width:"5.4",height:"5.4",rx:"1.5"})]})},{id:"sessions",href:"#/sessions",labelKey:"nav.sessions",icon:(0,t.jsx)("path",{d:"M2 3.5h12v7H6l-3 3v-3H2z"})},{id:"groups",href:"#/groups",labelKey:"nav.groups",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"5.6",cy:"5.8",r:"2.4"}),(0,t.jsx)("circle",{cx:"11",cy:"6.8",r:"1.9"}),(0,t.jsx)("path",{d:"M1.8 13.2c.5-2.4 2-3.6 3.8-3.6s3.3 1.2 3.8 3.6M9.8 12.6c.4-1.7 1.5-2.6 2.8-2.6 1 0 1.9.5 2.4 1.6"})]})},{id:"roles",href:"#/roles",labelKey:"nav.roles",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M8 1.8l5.2 2v3.4c0 3.4-2.2 5.9-5.2 7-3-1.1-5.2-3.6-5.2-7V3.8z"}),(0,t.jsx)("path",{d:"M5.8 8l1.6 1.6 2.8-3"})]})},{id:"monitoring",href:"#/monitoring",labelKey:"nav.monitoring",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M2 9.2h2.3l1.3-4.8 2.5 8.4 1.8-5.1h4.1"}),(0,t.jsx)("path",{d:"M2 2.5h12v11H2z"})]})},{id:"insights",href:"#/insights",labelKey:"nav.insights",manage:!0,icon:(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("path",{d:"M2 2v12h12M5 11V7M8.5 11V4.5M12 11V8.5"})})},{id:"workflows",href:"#/workflows",labelKey:"nav.workflows",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"3.4",cy:"3.6",r:"1.9"}),(0,t.jsx)("circle",{cx:"3.4",cy:"12.4",r:"1.9"}),(0,t.jsx)("circle",{cx:"12.6",cy:"8",r:"1.9"}),(0,t.jsx)("path",{d:"M5.2 4.4l5.6 2.8M5.2 11.6l5.6-2.8"})]})},{id:"schedules",href:"#/schedules",labelKey:"nav.schedules",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.2"}),(0,t.jsx)("path",{d:"M8 4.5V8l2.4 1.6"})]})},{id:"whiteboards",href:"#/whiteboards",labelKey:"nav.whiteboards",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.2",y:"2.2",width:"11.6",height:"11.6",rx:"2"}),(0,t.jsx)("path",{d:"M4.8 5.2h6.4M4.8 8h6.4M4.8 10.8h4"})]})},{id:"office",href:"#/office",labelKey:"nav.office",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"3",y:"4",width:"10",height:"7",rx:"2"}),(0,t.jsx)("circle",{cx:"6",cy:"7.5",r:"1"}),(0,t.jsx)("circle",{cx:"10",cy:"7.5",r:"1"}),(0,t.jsx)("path",{d:"M8 4V2M4.5 11v2M11.5 11v2"})]})},{id:"bot-defaults",href:"#/bot-defaults",labelKey:"nav.botDefaults",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.5",y:"5",width:"11",height:"8",rx:"2"}),(0,t.jsx)("circle",{cx:"5.8",cy:"9",r:"1"}),(0,t.jsx)("circle",{cx:"10.2",cy:"9",r:"1"}),(0,t.jsx)("path",{d:"M8 5V2.5M5.5 13v1.2M10.5 13v1.2"})]})},{id:"skills",href:"#/skills",labelKey:"nav.skills",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M3 2.5h10v3H3zM3 7h10v6.5H3z"}),(0,t.jsx)("path",{d:"M5.4 9.2h5.2M5.4 11.2h3.8"})]})},{id:"plugins",href:"#/plugins",label:"\u63D2\u4EF6",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M6.4 1.8h3.2v3h2.8v3.2H9.6v2.8H6.4V8H3.6V4.8h2.8z"}),(0,t.jsx)("path",{d:"M2.2 11.8h11.6v2.4H2.2z"})]})},{id:"team",href:"#/team",labelKey:"nav.team",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.2"}),(0,t.jsx)("path",{d:"M1.8 8h12.4M8 1.8c-2 1.8-2 10.6 0 12.4 2-1.8 2-10.6 0-12.4z"})]})},{id:"connectors",href:"#/connectors",labelKey:"nav.connectors",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M5.5 6.5v-3a2.5 2.5 0 0 1 5 0v3"}),(0,t.jsx)("rect",{x:"3.5",y:"6.5",width:"9",height:"7",rx:"2"})]})},{id:"settings",href:"#/settings",labelKey:"nav.settings",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M8 1.75 9.35 2.05 10 3.28l1.38.3 1.04-.96.96.96-.96 1.04.3 1.38 1.23.65L14.25 8l-.3 1.35-1.23.65-.3 1.38.96 1.04-.96.96-1.04-.96-1.38.3-.65 1.23L8 14.25l-1.35-.3L6 12.72l-1.38-.3-1.04.96-.96-.96.96-1.04-.3-1.38-1.23-.65L1.75 8l.3-1.35 1.23-.65.3-1.38-.96-1.04.96-.96 1.04.96 1.38-.3.65-1.23z"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"2"})]})}],C=[],L=!0,ie=!1,_e=location.hash||"#/",k=null,B=!1,$=null,F=null,V=null,Fe=null,T=ke(),Ve="botmux.ownerAvatar.v1",mt=new Set(["working","analyzing","active","starting"]),se="botmux:auth-expired";function A(e){return(0,t.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e})}function Ke(e){return e.labelKey?m(e.labelKey):e.label??""}function pt(e,n){let o=n||"#/";return e.id==="plugins"&&C.some(r=>r.href===o||o.startsWith(`${r.href}?`)||o.startsWith(`${r.href}/`))?!1:e.id==="sessions"&&(o==="#/monitor-room"||o.startsWith("#/monitor-room?")||o.startsWith("#/monitor-room/"))||e.id==="connectors"&&(o==="#/webhook-logs"||o.startsWith("#/webhook-logs?")||o.startsWith("#/webhook-logs/"))?!0:e.href===o||e.href!=="#/"&&(o.startsWith(`${e.href}?`)||o.startsWith(`${e.href}/`))}function ft(){if(C.length===0)return D;let e=D.findIndex(n=>n.id==="plugins");return e<0?[...D,...C]:[...D.slice(0,e+1),...C,...D.slice(e+1)]}function gt(e){let n=[];return pt(e,_e)&&n.push("active"),e.id==="settings"&&B&&n.push("nav-has-update"),n.length?n.join(" "):void 0}function Ue(){let e=$?`v${$}`:"";return F==="codex"?m("update.navRuntimeBadgeTitle",{version:e}):m("update.navBadgeTitle",{version:e})}function vt(e){V=e}function ne(){if(V)return V;let e=document.getElementById("root");if(!e)throw new Error("dashboard root is not mounted");return V=e,e}function bt(){return(0,p.useEffect)(()=>{Le()},[]),(0,p.useEffect)(()=>{Y()}),(0,t.jsxs)("div",{className:"theme-menu",id:"theme-menu",children:[(0,t.jsx)("button",{type:"button",className:"theme-menu-btn",id:"theme-menu-btn","aria-haspopup":"listbox","aria-expanded":"false","aria-label":"Theme",children:(0,t.jsx)("span",{className:"tm-ic",children:(0,t.jsxs)("svg",{className:"tm-svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}),(0,t.jsx)("path",{d:"M12 2a10 10 0 0 0 0 20h1.7a2.3 2.3 0 0 0 1.6-4c-.5-.5-.2-1.3.5-1.3H17a5 5 0 0 0 5-5 9.7 9.7 0 0 0-10-9.7z"})]})})}),(0,t.jsx)("div",{className:"theme-menu-pop",id:"theme-menu-pop",role:"listbox",hidden:!0})]})}function yt(){let e=[...K.sessions.values()],n=e.filter(i=>i.status!=="closed"),o=n.map(i=>({s:i,reason:pe(i)})).filter(i=>!!i.reason).sort((i,s)=>U(i.s)-U(s.s)),r=new Set(o.map(i=>String(i.s.sessionId??""))),a=n.filter(i=>mt.has(String(i.status))&&!r.has(String(i.sessionId??""))).length,d=o[0]??null,l=Me(e).filter(i=>i.online||i.active.length>0).length,h=Math.max(0,n.length-o.length-a);return{working:a,attention:o.length,idle:h,onlineBots:l,attentionNotice:d?{count:o.length,time:ue(U(d.s)),bot:me(d.s),reason:d.reason}:null}}function _(e){return(0,t.jsxs)("div",{className:`topbar-status-row${e.hot?" topbar-status-row-hot":""}`,children:[(0,t.jsx)("span",{children:e.label}),(0,t.jsx)("b",{className:e.value>0?"status-count-on":void 0,children:e.value})]})}function wt(e){let{attention:n,idle:o,working:r}=e.summary,a=r+n+o,d=a===0?"conic-gradient(var(--border) 0 360deg)":(()=>{let l=r/a*360,h=l+n/a*360;return`conic-gradient(var(--accent) 0 ${l}deg, var(--warning) ${l}deg ${h}deg, var(--success) ${h}deg 360deg)`})();return(0,t.jsxs)("div",{className:"topbar-status-donut-wrap","aria-hidden":"true",children:[(0,t.jsx)("div",{className:"topbar-status-donut",style:{background:d}}),(0,t.jsxs)("div",{className:"topbar-status-donut-center",children:[(0,t.jsx)("b",{children:a}),(0,t.jsx)("span",{children:m("overview.openSessions")})]})]})}function oe(){window.dispatchEvent(new Event(J))}function xt(e){let{autoOpen:n=!1,summary:o}=e,[r,a]=(0,p.useState)(!1),[d,l]=(0,p.useState)(!1),[h,i]=(0,p.useState)(!1),s=(0,p.useRef)(null),u=n&&!d,c=r||u;return(0,p.useEffect)(()=>{n||l(!1)},[n]),(0,p.useEffect)(()=>{if(!c)return;let v=b=>{let E=b.target;E instanceof Node&&s.current?.contains(E)||(a(!1),l(!0))};return document.addEventListener("pointerdown",v),()=>document.removeEventListener("pointerdown",v)},[c]),(0,t.jsxs)("div",{ref:s,className:`topbar-status-menu${u?" topbar-status-auto-open":""}${r?" is-open":""}${h?" suppress-hover":""}`,onPointerEnter:oe,onPointerLeave:()=>i(!1),onFocusCapture:oe,onBlur:v=>{let b=v.relatedTarget;(!(b instanceof Node)||!v.currentTarget.contains(b))&&a(!1)},onKeyDown:v=>{v.key==="Escape"&&(a(!1),l(!0),i(!0),v.currentTarget.querySelector("#status")?.focus())},children:[(0,t.jsx)("button",{type:"button",id:"status",className:"connection-status","aria-haspopup":"true","aria-expanded":c,onClick:()=>{if(oe(),c){a(!1),l(!0),i(!0);return}i(!1),a(!0)},children:m("overview.sessionOverview")}),(0,t.jsxs)("div",{className:"topbar-status-pop",children:[o.attentionNotice?(0,t.jsxs)("a",{className:"topbar-attention-notice",href:"#/sessions",children:[(0,t.jsx)("span",{className:"topbar-attention-dot","aria-hidden":"true"}),(0,t.jsxs)("span",{className:"topbar-attention-copy",children:[(0,t.jsx)("b",{children:m("strip.pending",{count:o.attentionNotice.count})}),(0,t.jsx)("small",{children:m("strip.longestCompact",{time:o.attentionNotice.time,bot:o.attentionNotice.bot,reason:o.attentionNotice.reason})})]}),(0,t.jsx)("span",{className:"topbar-attention-action",children:m("strip.handle")})]}):null,(0,t.jsxs)("div",{className:"topbar-status-list",children:[(0,t.jsx)(_,{label:m("overview.workingSessions"),value:o.working}),(0,t.jsx)(_,{label:m("overview.idleSessions"),value:o.idle}),(0,t.jsx)(_,{label:m("overview.attention"),value:o.attention,hot:o.attention>0}),(0,t.jsx)(_,{label:m("overview.onlineBots"),value:o.onlineBots})]}),(0,t.jsx)(wt,{summary:o})]})]})}function Mt(e){return e.open?(0,t.jsx)("div",{id:"auth-expired-overlay",className:"auth-expired-overlay",role:"presentation",onClick:n=>{n.target===n.currentTarget&&e.onClose()},children:(0,t.jsxs)("div",{className:"auth-expired-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"auth-expired-title",children:[(0,t.jsx)("h2",{id:"auth-expired-title",children:"\u8BBF\u95EE\u94FE\u63A5\u5DF2\u5931\u6548"}),(0,t.jsx)("p",{children:"\u5F53\u524D\u94FE\u63A5/\u8BBF\u95EE\u5DF2\u5931\u6548\uFF0C\u8BF7\u4F7F\u7528\u6700\u65B0\u6388\u6743\u94FE\u63A5\u91CD\u65B0\u8FDB\u5165\uFF08\u8FD0\u884C botmux dashboard \u83B7\u53D6\uFF09\u3002"}),(0,t.jsx)("button",{id:"auth-expired-dismiss",type:"button",className:"primary",onClick:e.onClose,children:"\u77E5\u9053\u4E86"})]})}):null}function Et(){let e=yt(),[n,o]=(0,p.useState)(!1),[r,a]=(0,p.useState)(!1),[d,l]=(0,p.useState)(!1),h=(0,p.useRef)(e.attention),i=(0,p.useRef)(null),s=()=>{i.current!==null&&(window.clearTimeout(i.current),i.current=null)};(0,p.useEffect)(()=>{let c=()=>o(!0);return window.addEventListener(G,c),()=>window.removeEventListener(G,c)},[]),(0,p.useEffect)(()=>{let c=()=>a(!0);return window.addEventListener(se,c),j&&a(!0),()=>window.removeEventListener(se,c)},[]),(0,p.useEffect)(()=>()=>s(),[]),(0,p.useEffect)(()=>{let c=h.current;if(h.current=e.attention,e.attention===0){s(),l(!1);return}c!==0||document.body.classList.contains("theme-menu-open")||(l(!0),s(),i.current=window.setTimeout(()=>{i.current=null,l(!1)},4e3))},[e.attention]);let u=()=>{j=!1,a(!1)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"aurora","aria-hidden":"true",children:[(0,t.jsx)("i",{className:"a1"}),(0,t.jsx)("i",{className:"a2"}),(0,t.jsx)("i",{className:"a3"})]}),(0,t.jsxs)("div",{className:"app-shell",children:[(0,t.jsxs)("header",{className:"topbar",children:[(0,t.jsx)("div",{className:"topbar-left",children:(0,t.jsxs)("a",{className:"brand",href:"#/",children:[(0,t.jsx)("span",{className:"brand-mark","aria-hidden":"true",children:(0,t.jsx)("img",{className:"brand-logo-img",src:"/assets/brand-logo.png",alt:"",decoding:"sync",loading:"eager",fetchPriority:"high"})}),(0,t.jsx)("strong",{className:"brand-wordmark",children:"Botmux"}),(0,t.jsx)("span",{className:"brand-product",children:"Dashboard"})]})}),(0,t.jsxs)("div",{className:"topbar-actions",children:[(0,t.jsx)(xt,{summary:e,autoOpen:d}),(0,t.jsxs)("div",{className:"topbar-tool-group",children:[(0,t.jsx)("button",{type:"button",className:"topbar-locale-toggle","aria-label":g.locale==="zh"?"Switch to English":"\u5207\u6362\u5230\u4E2D\u6587",title:g.locale==="zh"?"Switch to English":"\u5207\u6362\u5230\u4E2D\u6587",onClick:()=>Tt(g.locale==="zh"?"en":"zh"),children:g.locale==="zh"?"CN":"EN"}),(0,t.jsx)(bt,{}),(0,t.jsxs)("a",{className:"topbar-docs-link",href:"https://bytedance.aiforce.cloud/app/app_4k9smq6rdxher/",target:"_blank",rel:"noopener noreferrer",title:m("nav.docs"),"aria-label":m("nav.docs"),children:[A((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.2",y:"2.2",width:"11.6",height:"11.6",rx:"2"}),(0,t.jsx)("path",{d:"M4.8 5.2h6.4M4.8 8h6.4M4.8 10.8h4"})]})),(0,t.jsx)("span",{children:m("nav.docs")})]})]}),(0,t.jsxs)("span",{className:"topbar-owner",title:k?.name,"aria-label":k?.name??"Owner",children:[(0,t.jsx)("span",{className:"topbar-owner-placeholder","aria-hidden":"true",children:A((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"8",cy:"6",r:"2.4"}),(0,t.jsx)("path",{d:"M3.7 13c.7-2.5 2.2-3.7 4.3-3.7s3.6 1.2 4.3 3.7"})]}))}),k?.avatarUrl?(0,t.jsx)("img",{className:"topbar-owner-img",src:k.avatarUrl,alt:"",decoding:"async",referrerPolicy:"no-referrer",onError:c=>{c.currentTarget.remove()}}):null]})]})]}),(0,t.jsxs)("div",{className:"chrome-body",children:[(0,t.jsxs)("aside",{className:"sidebar",children:[L?(0,t.jsxs)("div",{className:"sidebar-create-actions",children:[(0,t.jsxs)("button",{type:"button",className:"sidebar-create-btn",onClick:()=>we(),children:[A((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M2 3.5h12v7H6l-3 3v-3H2z"}),(0,t.jsx)("path",{d:"M8 4.9v4.2M5.9 7h4.2"})]})),(0,t.jsx)("span",{className:"sidebar-nav-label",children:m("nav.createSession")})]}),(0,t.jsxs)("button",{type:"button",className:"sidebar-create-btn",onClick:()=>{be()},children:[A((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.5",y:"6",width:"11",height:"7.5",rx:"2"}),(0,t.jsx)("circle",{cx:"5.8",cy:"9.75",r:"1"}),(0,t.jsx)("circle",{cx:"10.2",cy:"9.75",r:"1"}),(0,t.jsx)("path",{d:"M8 6V3.8M6.3 1.9h3.4"})]})),(0,t.jsx)("span",{className:"sidebar-nav-label",children:m("nav.createBot")})]})]}):null,(0,t.jsx)("nav",{className:"sidebar-nav","aria-label":"Dashboard",children:ft().filter(c=>L||!c.manage).map(c=>(0,t.jsxs)("a",{href:c.href,"data-route":c.id,className:[gt(c),c.plugin?"sidebar-plugin-item":""].filter(Boolean).join(" ")||void 0,title:c.plugin?Ke(c):void 0,children:[A(c.icon),(0,t.jsx)("span",{className:"sidebar-nav-label",children:Ke(c)}),c.id==="settings"&&B?(0,t.jsx)(ve,{className:"nav-update-tip",label:Ue(),trigger:(0,t.jsx)("span",{className:"nav-update-dot","aria-hidden":"true"}),preventClick:!1,focusable:!1,children:Ue()}):null]},c.id))})]}),(0,t.jsxs)("div",{className:"workspace",children:[(0,t.jsx)("dialog",{id:"create-session-modal",className:"create-session-modal"}),(0,t.jsx)(ye,{open:n,onClose:()=>o(!1)}),(0,t.jsx)("main",{id:"root",ref:vt})]})]})]}),(0,t.jsx)(Mt,{open:r,onClose:u})]})}function w(){Fe?.render((0,t.jsx)(Et,{}))}function Tt(e){g.setLocale(e),kt(e)}var j=!1;function Lt(){j||(j=!0,window.dispatchEvent(new Event(se)))}var re;function Nt(){let e=document.getElementById("readonly-toast");e||(e=document.createElement("div"),e.id="readonly-toast",e.style.cssText="position:fixed;left:50%;bottom:28px;transform:translateX(-50%);z-index:9999;background:var(--fg,#1f2329);color:var(--bg,#fff);padding:10px 18px;border-radius:var(--radius-lg);font-size:13px;box-shadow:0 8px 24px rgba(0,0,0,.25)",document.body.appendChild(e)),e.textContent="\u5F53\u524D\u662F\u53EA\u8BFB\u8BBF\u95EE\uFF0C\u6B64\u64CD\u4F5C\u9700\u8981\u6388\u6743\u94FE\u63A5\uFF08\u8FD0\u884C botmux dashboard \u83B7\u53D6\uFF09",e.style.display="block",re&&window.clearTimeout(re),re=window.setTimeout(()=>{e.style.display="none"},4e3)}var St=window.fetch.bind(window);window.fetch=async function(...n){let o=await St(...n);if(o.status===401){let r=(n[1]?.method??"GET").toUpperCase();(r==="GET"||r==="HEAD")&&!ie?Lt():Nt()}return o};async function Rt(){try{let e=await fetch("/api/settings");if(e.ok){let n=await e.json();L=!!n.authed,g.authed=L,ie=!!(n.settings&&n.settings.publicReadOnly),g.publicReadOnly=ie;let o=ce(n.lang);o&&g.setLocale(o)}}catch{}}async function ze(){try{let e=await fetch("/api/plugins/dashboard");if(!e.ok)return;let n=await e.json();C=(Array.isArray(n?.plugins)?n.plugins:[]).filter(r=>r.pinned===!0&&typeof r.route=="string").map(r=>({id:`plugin:${r.pluginId}:${r.id}`,href:r.route,label:r.displayName||r.pluginId,manage:!0,plugin:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M5.2 2.2h5.6v3.1l1.7 1.7-1.4 1.4-1-1v6.4H5.9V7.4l-1 1L3.5 7l1.7-1.7z"}),(0,t.jsx)("path",{d:"M8 13.8v1"})]})})),w()}catch{}}async function kt(e){if(L)try{await fetch("/api/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({lang:e})})}catch{}}async function Ot(){if(L)try{let e=await fetch("/api/update/status");if(!e.ok)return;let n=await e.json(),o=Array.isArray(n.cliUpdates)?n.cliUpdates.find(r=>r?.updateAvailable===!0&&r?.latest):null;n.behind===!0&&n.latest?(B=!0,F="botmux",$=String(n.latest)):o?(B=!0,F="codex",$=String(o.latest)):(B=!1,F=null,$=null),w()}catch{}}function Ht(e){e.innerHTML='<section class="auth-required" style="max-width:520px;margin:64px auto;text-align:center;background:var(--surface);color:var(--fg);border:1px solid var(--border);border-radius:var(--radius-lg);padding:40px 36px;box-shadow:0 8px 28px rgba(0,0,0,.12)"><h2 style="margin:0 0 12px;font-size:20px;color:var(--fg)">\u6B64\u9875\u9700\u8981\u6388\u6743\u94FE\u63A5</h2><p style="margin:0 0 24px;line-height:1.7;color:var(--muted);font-size:14px">\u4F60\u5F53\u524D\u662F\u53EA\u8BFB\u8BBF\u95EE\uFF0C\u7BA1\u7406\u9875\uFF08\u7FA4\u89D2\u8272 / Profiles / Bot \u914D\u7F6E / \u56E2\u961F / Webhook\uFF09\u9700\u8981\u6388\u6743\u94FE\u63A5\u3002\u8FD0\u884C <code>botmux dashboard</code> \u83B7\u53D6\u6700\u65B0\u94FE\u63A5\u540E\u5373\u53EF\u7BA1\u7406\u3002</p><a href="#/" style="display:inline-block;padding:8px 22px;background:var(--accent);color:var(--on-accent);border-radius:var(--radius-lg);text-decoration:none;font-size:14px">\u8FD4\u56DE\u603B\u89C8</a></section>'}async function ae(){let e=Oe(T),n=location.hash||"#/";if(_e=n,w(),!L&&ht.some(o=>n.startsWith("#/"+o))){Ht(ne()),T.rerenderOnUiChange=!0;return}if(n.startsWith("#/v3")){window.location.replace(`#/workflows${n.slice(4)}`);return}else if(n.startsWith("#/legacy-workflow")){window.location.replace("#/workflows");return}else if(/^#\/workflows(?:\/|-)catalog(?:[/?].*)?$/.test(n)){window.location.replace("#/workflows");return}if(n.startsWith("#/role-profiles")){window.location.replace(`#/roles/profile${n.slice(15)}`);return}try{let o=Ne(n);await He(T,e,ne(),o?o.load:Se,{rerenderOnUiChange:o?o.rerenderOnUiChange:!1})}catch(o){if(e!==T.seq)return;ne().innerHTML=`<section class="page"><div class="empty">Dashboard route failed: ${de(String(o))}</div></section>`,T.pageDispose=null,T.rerenderOnUiChange=!0}}function Pt(){try{let e=JSON.parse(window.localStorage.getItem(Ve)??"null");if(e?.avatarUrl)return{avatarUrl:String(e.avatarUrl),name:e.name?String(e.name):void 0}}catch{}return null}function Dt(){k=Pt(),w(),fetch("/api/owner-profile").then(e=>e.ok?e.json():null).then(e=>{if(!(!e?.ok||!e.avatarUrl)){k={avatarUrl:String(e.avatarUrl),name:e.name?String(e.name):void 0};try{window.localStorage.setItem(Ve,JSON.stringify({avatarUrl:e.avatarUrl,name:e.name??""}))}catch{}w()}}).catch(()=>{})}(async()=>{g.init();let e=document.getElementById("app-root");if(!e)throw new Error("missing dashboard app root");Ie(e),Fe=(0,We.createRoot)(e),w(),g.on(()=>{w(),T.rerenderOnUiChange&&ae()}),K.on(()=>{w()}),await Rt(),w(),window.addEventListener(fe,()=>{ze()}),ze(),Ot(),Dt();try{await le()}catch(n){console.error("botmux dashboard bootstrap failed",n),K.setOnline(!1)}he().then(w),xe().then(w),window.addEventListener("hashchange",()=>{ae()}),ae()})();export{Lt as showAuthExpiredOverlay,Nt as showReadOnlyToast};
1
+ import{a as xe,b as Ee}from"./chunks/chunk-7STGZ5BX.js";import{b as J}from"./chunks/chunk-SZOB6VK2.js";import{a as ge}from"./chunks/chunk-BD3PZGH2.js";import{a as z,b as ye,c as we}from"./chunks/chunk-G43RUPUN.js";import{i as be}from"./chunks/chunk-I35DXGM4.js";import{A as me,C as pe,F as fe,G as _,a as U,b as de,e as K,r as g,s as m,t as ue,u as he}from"./chunks/chunk-4QTBR7UF.js";import{a as Qe,c as Ze,d as ve}from"./chunks/chunk-5THX4DI2.js";import{c as $}from"./chunks/chunk-7SZRL6FY.js";var qe=$(Ze(),1),p=$(Qe(),1);var Q="botmux:close-theme-menu",et={palette:'<circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2a10 10 0 0 0 0 20h1.7a2.3 2.3 0 0 0 1.6-4c-.5-.5-.2-1.3.5-1.3H17a5 5 0 0 0 5-5 9.7 9.7 0 0 0-10-9.7z"/>',monitor:'<rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/>',sun:'<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>',moon:'<path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"/>',cpu:'<path d="M12 20v2"/><path d="M12 2v2"/><path d="M17 20v2"/><path d="M17 2v2"/><path d="M2 12h2"/><path d="M2 17h2"/><path d="M2 7h2"/><path d="M20 12h2"/><path d="M20 17h2"/><path d="M20 7h2"/><path d="M7 20v2"/><path d="M7 2v2"/><rect x="4" y="4" width="16" height="16" rx="2"/><rect x="8" y="8" width="8" height="8" rx="1"/>',zap:'<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',chevron:'<path d="m6 9 6 6 6-6"/>'},Se=[{labelKey:"theme.base",options:[{value:"system",labelKey:"status.system",icon:"monitor"},{value:"light",labelKey:"status.light",icon:"sun"},{value:"dark",labelKey:"status.dark",icon:"moon"}]},{labelKey:"theme.skins",options:[{value:"cyber",labelKey:"skin.cyber",icon:"cpu"},{value:"fallout",labelKey:"skin.fallout",icon:"zap"}]}],Me=Se.flatMap(e=>e.options),y=!1,O=null,H=null,tt=70,nt=120;function Y(e){return`<svg class="tm-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${et[e]??""}</svg>`}function ot(e){return e.replace(/[&<>"]/g,n=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[n])}function Te(){let e=document.getElementById("theme-menu"),n=document.getElementById("theme-menu-btn"),o=document.getElementById("theme-menu-pop");if(!e||!n||!o||e.dataset.themeMenuInit==="1")return;e.dataset.themeMenuInit="1",o.innerHTML=Se.map(s=>`<div class="tm-group" data-label-key="${s.labelKey}"></div>`+s.options.map(u=>`<button type="button" class="tm-item" role="option" data-value="${u.value}"><span class="tm-ic">${Y(u.icon)}</span><span class="tm-label" data-label-key="${u.labelKey}"></span></button>`).join("")).join("");let r=()=>{if(!y)return;let s=n.getBoundingClientRect(),u=12,c=Math.min(Math.max(o.offsetWidth||216,216),Math.max(0,window.innerWidth-u*2)),L=u+c/2,v=window.innerWidth-u-c/2,b=s.left+s.width/2,T=Math.min(Math.max(b,L),Math.max(L,v)),X=Math.max(180,window.innerHeight-s.bottom-20);o.style.setProperty("--theme-menu-pop-left",`${Math.round(T)}px`),o.style.setProperty("--theme-menu-pop-top",`${Math.round(s.bottom+8)}px`),o.style.setProperty("--theme-menu-pop-max-height",`${Math.round(X)}px`)},a=s=>{O!=null&&(window.clearTimeout(O),O=null),H!=null&&(window.clearTimeout(H),H=null),y=s,n.setAttribute("aria-expanded",String(y)),document.body.classList.toggle("theme-menu-open",y),y?(o.hidden=!1,r(),window.requestAnimationFrame(()=>e.classList.add("open"))):(e.classList.remove("open"),H=window.setTimeout(()=>{H=null,y||(o.hidden=!0)},nt))},d=()=>a(!0),l=()=>{O==null&&(O=window.setTimeout(()=>a(!1),tt))},h=s=>{s.pointerType!=="touch"&&d()},i=s=>{s.pointerType!=="touch"&&l()};e.addEventListener("pointerenter",h),e.addEventListener("pointerleave",i),o.addEventListener("pointerenter",h),o.addEventListener("pointerleave",i),n.addEventListener("click",s=>{s.stopPropagation(),a(!y)}),n.addEventListener("focus",()=>{n.matches(":focus-visible")&&d()}),e.addEventListener("focusout",s=>{let u=s.relatedTarget;(!(u instanceof Node)||!e.contains(u))&&l()}),o.addEventListener("click",s=>{let u=s.target.closest(".tm-item");u&&(g.setTheme(u.dataset.value??"system"),a(!1))}),document.addEventListener("click",s=>{y&&!e.contains(s.target)&&a(!1)}),document.addEventListener("pointermove",s=>{if(!y||s.pointerType==="touch")return;let u=s.target;u instanceof Node&&e.contains(u)||l()}),document.addEventListener("keydown",s=>{s.key==="Escape"&&y&&a(!1)}),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0),window.addEventListener(Q,()=>{y&&a(!1)}),Z()}function Z(){let e=document.getElementById("theme-menu-btn");if(!e)return;let n=Me.find(o=>o.value===g.theme)??Me[0];e.innerHTML=`<span class="tm-ic">${Y("palette")}</span><span class="tm-current">${ot(m(n.labelKey))}</span><span class="tm-chev">${Y("chevron")}</span>`,document.querySelectorAll("#theme-menu-pop [data-label-key]").forEach(o=>{o.textContent=m(o.dataset.labelKey??"")}),document.querySelectorAll("#theme-menu-pop .tm-item").forEach(o=>{o.classList.toggle("active",o.dataset.value===g.theme)})}function f(e,n,o,r,a=!1){return{id:e,routePrefix:n,rerenderOnUiChange:a,load:async()=>(await o())[r]}}var rt=[{id:"plugins",routePrefix:"#/plugins",rerenderOnUiChange:!1,load:async()=>{let e=await import("./chunks/plugin-page-7FW2LPJH.js");return n=>e.renderPluginPage(n)}},f("workflows","#/workflows",()=>import("./chunks/v3-page-DXPFILRZ.js"),"renderV3RunsPage"),f("groups","#/groups",()=>import("./chunks/groups-page-XKIWJ2TP.js"),"renderGroupsPage"),f("settings","#/settings",()=>import("./chunks/settings-page-GLRWV5KU.js"),"renderSettingsPage"),f("bot-defaults","#/bot-defaults",()=>import("./chunks/bot-defaults-page-MBORWWP7.js"),"renderBotDefaultsPage"),f("skills","#/skills",()=>import("./chunks/skills-page-KQVW42QU.js"),"renderSkillsPage"),f("connectors-logs","#/connectors/logs",()=>import("./chunks/connectors-page-LKDT4WBG.js"),"renderConnectorsLogsPage"),f("webhook-logs","#/webhook-logs",()=>import("./chunks/connectors-page-LKDT4WBG.js"),"renderConnectorsLogsPage"),f("connectors","#/connectors",()=>import("./chunks/connectors-page-LKDT4WBG.js"),"renderConnectorsPage"),f("team-manage","#/team/manage",()=>import("./chunks/team-federation-page-5PYUOV5M.js"),"renderTeamManagePage"),f("team","#/team",()=>import("./chunks/team-federation-page-5PYUOV5M.js"),"renderTeamFederationPage"),f("roles-profile","#/roles/profile",()=>import("./chunks/roles-page-J6K2HWFX.js"),"renderRoleProfilesPage"),f("roles","#/roles",()=>import("./chunks/roles-page-J6K2HWFX.js"),"renderRolesPage"),f("schedules","#/schedules",()=>import("./chunks/schedules-page-CGAQCB4J.js"),"renderSchedulesPage"),f("whiteboards","#/whiteboards",()=>import("./chunks/whiteboards-page-NUH6VZ4I.js"),"renderWhiteboardsPage"),f("monitoring","#/monitoring",()=>import("./chunks/monitoring-page-2R4NCNBQ.js"),"renderMonitoringPage"),f("sessions","#/sessions",()=>import("./chunks/sessions-page-WJ2QYTIE.js"),"renderSessionsPage"),f("monitor-room","#/monitor-room",()=>import("./chunks/monitor-room-AQTHAWXA.js"),"renderMonitorRoomPage",!0),f("office","#/office",()=>import("./chunks/office-page-5M6MQIIL.js"),"renderOfficePage"),f("insights","#/insights",()=>import("./chunks/insights-page-CBEZCYKV.js"),"renderInsightsPage")];function Le(e){return rt.find(n=>n.exact?e===n.routePrefix:e.startsWith(n.routePrefix))}async function Re(){let e=await import("./chunks/overview-page-N22HDZ2V.js");return n=>e.renderOverviewPage(n)}function ke(){return{seq:0,pageDispose:null,rerenderOnUiChange:!0}}function Oe(e){let n=++e.seq;return e.pageDispose&&(e.pageDispose(),e.pageDispose=null),n}function Ne(e,n){return n===e.seq}async function He(e,n,o,r,a={}){let d=await r();if(!Ne(e,n))return!1;let l=d(o);return Ne(e,n)?(e.pageDispose=typeof l=="function"?l:null,e.rerenderOnUiChange=a.rerenderOnUiChange??!0,!0):(typeof l=="function"&&l(),!1)}var at="botmux.dashboard.stale-chunk-reload.v1:",it=/Failed to fetch dynamically imported module|Importing a module script failed|error loading dynamically imported module|dynamically imported module/i,st=/\b(?:https?:\/\/|\/assets\/)\S+?\.js\b/;function Pe(e){return e instanceof Error?`${e.name}: ${e.message}`:String(e)}function Ce(e){return it.test(Pe(e))}function lt(e,n){let a=Pe(e).match(st)?.[0]||`${n.href}|${n.hash}`;return`${at}${a.slice(-240)}`}function ct(e,n){if(!Ce(e))return!1;let o=lt(e,n);try{if(n.sessionStorage.getItem(o)==="1")return!1;n.sessionStorage.setItem(o,"1")}catch{return!1}return n.reload(),!0}function De(e,n){if(!Ce(e))return!1;let o;try{o=n.getSessionStorage()}catch{return!1}return ct(e,{...n,sessionStorage:o})}var dt=new Set(["auto","scroll","overlay"]),W=28,x=3,R=6,Ae=!1,Ke=null,Be=new WeakMap,E=new Map,Ie=null,$e=null,ee=0,te=0,P=null;function ut(e){return e.closest("dialog[open]")??document.body}function ht(e){let n=Be.get(e);if(n?.isConnected)return n;let o=document.createElement("div");return o.className="floating-scrollbar-layer",o.setAttribute("aria-hidden","true"),e.appendChild(o),Be.set(e,o),o}function mt(e){return dt.has(e)}function ne(e,n){let o=getComputedStyle(e),r=n==="y"?o.overflowY:o.overflowX;return mt(r)?n==="y"?e.scrollHeight-e.clientHeight>1:e.scrollWidth-e.clientWidth>1:!1}function pt(e){if(!e.isConnected||e.closest("[hidden]"))return!1;let n=e.getBoundingClientRect();return n.width>0&&n.height>0&&n.bottom>0&&n.right>0&&n.top<window.innerHeight&&n.left<window.innerWidth}function ft(e){return[e,...Array.from(e.querySelectorAll("*"))].filter(o=>pt(o)&&(ne(o,"x")||ne(o,"y")))}function F(e){e.hideTimer!==void 0&&window.clearTimeout(e.hideTimer),e.track.remove()}function gt(e,n){let o=E.get(e);o||(o={},E.set(e,o));let r=o[n],a=ut(e),d=ht(a);if(r?.track.parentElement===d)return r;r&&F(r);let l=document.createElement("div"),h=document.createElement("div");l.className=`floating-scrollbar floating-scrollbar-${n}`,h.className="floating-scrollbar-thumb",l.appendChild(h),d.appendChild(l);let i={target:e,axis:n,track:l,thumb:h,hideTimer:void 0};return o[n]=i,i}function oe(e,n=!1){e.track.classList.add("is-visible"),e.hideTimer!==void 0&&window.clearTimeout(e.hideTimer),e.hideTimer=n?void 0:window.setTimeout(()=>{e.track.classList.remove("is-visible","is-active"),e.hideTimer=void 0},900)}function vt(e){let{target:n,axis:o,track:r,thumb:a}=e,d=n.getBoundingClientRect();if(o==="y"){let L=Math.max(0,d.top+x),v=Math.min(window.innerHeight,d.bottom-x),b=Math.max(0,v-L);if(b<W||n.scrollHeight<=n.clientHeight){r.hidden=!0;return}let T=Math.max(W,Math.round(b*n.clientHeight/n.scrollHeight)),X=Math.max(1,n.scrollHeight-n.clientHeight),Ye=Math.round((b-T)*n.scrollTop/X);r.hidden=!1,r.style.left=`${Math.min(window.innerWidth-R-x,Math.max(x,d.right-R-x))}px`,r.style.top=`${L}px`,r.style.width=`${R}px`,r.style.height=`${b}px`,a.style.width="100%",a.style.height=`${T}px`,a.style.transform=`translate3d(0, ${Ye}px, 0)`;return}let l=Math.max(0,d.left+x),h=Math.min(window.innerWidth,d.right-x),i=Math.max(0,h-l);if(i<W||n.scrollWidth<=n.clientWidth){r.hidden=!0;return}let s=Math.max(W,Math.round(i*n.clientWidth/n.scrollWidth)),u=Math.max(1,n.scrollWidth-n.clientWidth),c=Math.round((i-s)*n.scrollLeft/u);r.hidden=!1,r.style.left=`${l}px`,r.style.top=`${Math.min(window.innerHeight-R-x,Math.max(x,d.bottom-R-x))}px`,r.style.width=`${i}px`,r.style.height=`${R}px`,a.style.width=`${s}px`,a.style.height="100%",a.style.transform=`translate3d(${c}px, 0, 0)`}function N(){ee||(ee=window.requestAnimationFrame(()=>{ee=0,yt()}))}function bt(){te||(te=window.setTimeout(()=>{te=0,N()},120))}function yt(){let e=Ke;if(!e)return;let n=new Set(ft(e));for(let[o,r]of E)n.has(o)||(r.x&&F(r.x),r.y&&F(r.y),E.delete(o));for(let o of n){let r=o===P;for(let a of["x","y"]){let d=E.get(o);if(!ne(o,a)){let h=d?.[a];h&&(F(h),delete d?.[a]);continue}let l=gt(o,a);vt(l),r&&oe(l,!0)}}}function wt(e){if(!(e instanceof HTMLElement))return;let n=E.get(e);if(n)for(let o of Object.values(n))o&&(o.track.classList.add("is-active"),oe(o))}function xt(e){for(let n=e;n;n=n.parentElement)if(n instanceof HTMLElement&&E.has(n))return n;return null}function Ue(e){if(P===e)return;let n=P?E.get(P):void 0;if(P=e,n)for(let r of Object.values(n))r?.track.classList.remove("is-visible");let o=e?E.get(e):void 0;if(o)for(let r of Object.values(o))r&&oe(r,!0)}function _e(e){Ae||(Ae=!0,Ke=e,document.documentElement.classList.add("floating-scrollbars-on"),Ie=typeof ResizeObserver>"u"?null:new ResizeObserver(N),Ie?.observe(e),$e=new MutationObserver(n=>{for(let o of n){let r=o.target;if(!(r instanceof Element&&r.closest(".floating-scrollbar-layer"))){bt();return}}}),$e.observe(e,{attributes:!0,attributeFilter:["class","style","hidden","open"],childList:!0,subtree:!0}),document.addEventListener("scroll",n=>{wt(n.target),N()},!0),window.addEventListener("resize",N),window.addEventListener("hashchange",N),document.addEventListener("pointermove",n=>{Ue(xt(document.elementFromPoint(n.clientX,n.clientY)))}),document.addEventListener("pointerleave",()=>Ue(null)),N())}var t=$(ve(),1),Et=["roles","role-profiles","bot-defaults","skills","plugins","team","connectors","insights","whiteboards"],C=[{id:"overview",href:"#/",labelKey:"nav.overview",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"1.5",y:"1.5",width:"5.4",height:"5.4",rx:"1.5"}),(0,t.jsx)("rect",{x:"9.1",y:"1.5",width:"5.4",height:"5.4",rx:"1.5"}),(0,t.jsx)("rect",{x:"1.5",y:"9.1",width:"5.4",height:"5.4",rx:"1.5"}),(0,t.jsx)("rect",{x:"9.1",y:"9.1",width:"5.4",height:"5.4",rx:"1.5"})]})},{id:"sessions",href:"#/sessions",labelKey:"nav.sessions",icon:(0,t.jsx)("path",{d:"M2 3.5h12v7H6l-3 3v-3H2z"})},{id:"groups",href:"#/groups",labelKey:"nav.groups",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"5.6",cy:"5.8",r:"2.4"}),(0,t.jsx)("circle",{cx:"11",cy:"6.8",r:"1.9"}),(0,t.jsx)("path",{d:"M1.8 13.2c.5-2.4 2-3.6 3.8-3.6s3.3 1.2 3.8 3.6M9.8 12.6c.4-1.7 1.5-2.6 2.8-2.6 1 0 1.9.5 2.4 1.6"})]})},{id:"roles",href:"#/roles",labelKey:"nav.roles",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M8 1.8l5.2 2v3.4c0 3.4-2.2 5.9-5.2 7-3-1.1-5.2-3.6-5.2-7V3.8z"}),(0,t.jsx)("path",{d:"M5.8 8l1.6 1.6 2.8-3"})]})},{id:"monitoring",href:"#/monitoring",labelKey:"nav.monitoring",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M2 9.2h2.3l1.3-4.8 2.5 8.4 1.8-5.1h4.1"}),(0,t.jsx)("path",{d:"M2 2.5h12v11H2z"})]})},{id:"insights",href:"#/insights",labelKey:"nav.insights",manage:!0,icon:(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("path",{d:"M2 2v12h12M5 11V7M8.5 11V4.5M12 11V8.5"})})},{id:"workflows",href:"#/workflows",labelKey:"nav.workflows",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"3.4",cy:"3.6",r:"1.9"}),(0,t.jsx)("circle",{cx:"3.4",cy:"12.4",r:"1.9"}),(0,t.jsx)("circle",{cx:"12.6",cy:"8",r:"1.9"}),(0,t.jsx)("path",{d:"M5.2 4.4l5.6 2.8M5.2 11.6l5.6-2.8"})]})},{id:"schedules",href:"#/schedules",labelKey:"nav.schedules",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.2"}),(0,t.jsx)("path",{d:"M8 4.5V8l2.4 1.6"})]})},{id:"whiteboards",href:"#/whiteboards",labelKey:"nav.whiteboards",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.2",y:"2.2",width:"11.6",height:"11.6",rx:"2"}),(0,t.jsx)("path",{d:"M4.8 5.2h6.4M4.8 8h6.4M4.8 10.8h4"})]})},{id:"office",href:"#/office",labelKey:"nav.office",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"3",y:"4",width:"10",height:"7",rx:"2"}),(0,t.jsx)("circle",{cx:"6",cy:"7.5",r:"1"}),(0,t.jsx)("circle",{cx:"10",cy:"7.5",r:"1"}),(0,t.jsx)("path",{d:"M8 4V2M4.5 11v2M11.5 11v2"})]})},{id:"bot-defaults",href:"#/bot-defaults",labelKey:"nav.botDefaults",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.5",y:"5",width:"11",height:"8",rx:"2"}),(0,t.jsx)("circle",{cx:"5.8",cy:"9",r:"1"}),(0,t.jsx)("circle",{cx:"10.2",cy:"9",r:"1"}),(0,t.jsx)("path",{d:"M8 5V2.5M5.5 13v1.2M10.5 13v1.2"})]})},{id:"skills",href:"#/skills",labelKey:"nav.skills",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M3 2.5h10v3H3zM3 7h10v6.5H3z"}),(0,t.jsx)("path",{d:"M5.4 9.2h5.2M5.4 11.2h3.8"})]})},{id:"plugins",href:"#/plugins",label:"\u63D2\u4EF6",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M6.4 1.8h3.2v3h2.8v3.2H9.6v2.8H6.4V8H3.6V4.8h2.8z"}),(0,t.jsx)("path",{d:"M2.2 11.8h11.6v2.4H2.2z"})]})},{id:"team",href:"#/team",labelKey:"nav.team",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.2"}),(0,t.jsx)("path",{d:"M1.8 8h12.4M8 1.8c-2 1.8-2 10.6 0 12.4 2-1.8 2-10.6 0-12.4z"})]})},{id:"connectors",href:"#/connectors",labelKey:"nav.connectors",manage:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M5.5 6.5v-3a2.5 2.5 0 0 1 5 0v3"}),(0,t.jsx)("rect",{x:"3.5",y:"6.5",width:"9",height:"7",rx:"2"})]})},{id:"settings",href:"#/settings",labelKey:"nav.settings",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M8 1.75 9.35 2.05 10 3.28l1.38.3 1.04-.96.96.96-.96 1.04.3 1.38 1.23.65L14.25 8l-.3 1.35-1.23.65-.3 1.38.96 1.04-.96.96-1.04-.96-1.38.3-.65 1.23L8 14.25l-1.35-.3L6 12.72l-1.38-.3-1.04.96-.96-.96.96-1.04-.3-1.38-1.23-.65L1.75 8l.3-1.35 1.23-.65.3-1.38-.96-1.04.96-.96 1.04.96 1.38-.3.65-1.23z"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"2"})]})}],A=[],S=!0,le=!1,je=location.hash||"#/",k=null,B=!1,I=null,q=null,j=null,Ge=null,M=ke(),Xe="botmux.ownerAvatar.v1",Mt=new Set(["working","analyzing","active","starting"]),ce="botmux:auth-expired";function D(e){return(0,t.jsx)("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e})}function ze(e){return e.labelKey?m(e.labelKey):e.label??""}function St(e,n){let o=n||"#/";return e.id==="plugins"&&A.some(r=>r.href===o||o.startsWith(`${r.href}?`)||o.startsWith(`${r.href}/`))?!1:e.id==="sessions"&&(o==="#/monitor-room"||o.startsWith("#/monitor-room?")||o.startsWith("#/monitor-room/"))||e.id==="connectors"&&(o==="#/webhook-logs"||o.startsWith("#/webhook-logs?")||o.startsWith("#/webhook-logs/"))?!0:e.href===o||e.href!=="#/"&&(o.startsWith(`${e.href}?`)||o.startsWith(`${e.href}/`))}function Tt(){if(A.length===0)return C;let e=C.findIndex(n=>n.id==="plugins");return e<0?[...C,...A]:[...C.slice(0,e+1),...A,...C.slice(e+1)]}function Lt(e){let n=[];return St(e,je)&&n.push("active"),e.id==="settings"&&B&&n.push("nav-has-update"),n.length?n.join(" "):void 0}function Je(){let e=K(new URLSearchParams(location.search).get("locale"));if(e)return e;let n=location.hash.indexOf("?");return n<0?null:K(new URLSearchParams(location.hash.slice(n+1)).get("locale"))}function We(){let e=Je();return!e||e===g.locale?!1:(g.setLocale(e),!0)}function Rt(){let e=location.hash.indexOf("?");return e<0?null:{path:location.hash.slice(0,e)||"#/",params:new URLSearchParams(location.hash.slice(e+1))}}function Nt(){let e=Rt(),n=e?.params.get("open");if(!e||!n||n!=="bot-onboarding"&&n!=="create-session")return!1;e.params.delete("open");let o=e.params.toString();return history.replaceState(null,"",o?`${e.path}?${o}`:e.path),n==="bot-onboarding"?window.dispatchEvent(new Event(z)):J(),!0}function Fe(){let e=I?`v${I}`:"";return q==="codex"?m("update.navRuntimeBadgeTitle",{version:e}):m("update.navBadgeTitle",{version:e})}function kt(e){j=e}function re(){if(j)return j;let e=document.getElementById("root");if(!e)throw new Error("dashboard root is not mounted");return j=e,e}function Ot(){return(0,p.useEffect)(()=>{Te()},[]),(0,p.useEffect)(()=>{Z()}),(0,t.jsxs)("div",{className:"theme-menu",id:"theme-menu",children:[(0,t.jsx)("button",{type:"button",className:"theme-menu-btn",id:"theme-menu-btn","aria-haspopup":"listbox","aria-expanded":"false","aria-label":"Theme",children:(0,t.jsx)("span",{className:"tm-ic",children:(0,t.jsxs)("svg",{className:"tm-svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}),(0,t.jsx)("path",{d:"M12 2a10 10 0 0 0 0 20h1.7a2.3 2.3 0 0 0 1.6-4c-.5-.5-.2-1.3.5-1.3H17a5 5 0 0 0 5-5 9.7 9.7 0 0 0-10-9.7z"})]})})}),(0,t.jsx)("div",{className:"theme-menu-pop",id:"theme-menu-pop",role:"listbox",hidden:!0})]})}function Ht(){let e=[...U.sessions.values()],n=e.filter(i=>i.status!=="closed"),o=n.map(i=>({s:i,reason:fe(i)})).filter(i=>!!i.reason).sort((i,s)=>_(i.s)-_(s.s)),r=new Set(o.map(i=>String(i.s.sessionId??""))),a=n.filter(i=>Mt.has(String(i.status))&&!r.has(String(i.sessionId??""))).length,d=o[0]??null,l=Ee(e).filter(i=>i.online||i.active.length>0).length,h=Math.max(0,n.length-o.length-a);return{working:a,attention:o.length,idle:h,onlineBots:l,attentionNotice:d?{count:o.length,time:he(_(d.s)),bot:pe(d.s),reason:d.reason}:null}}function V(e){return(0,t.jsxs)("div",{className:`topbar-status-row${e.hot?" topbar-status-row-hot":""}`,children:[(0,t.jsx)("span",{children:e.label}),(0,t.jsx)("b",{className:e.value>0?"status-count-on":void 0,children:e.value})]})}function Pt(e){let{attention:n,idle:o,working:r}=e.summary,a=r+n+o,d=a===0?"conic-gradient(var(--border) 0 360deg)":(()=>{let l=r/a*360,h=l+n/a*360;return`conic-gradient(var(--accent) 0 ${l}deg, var(--warning) ${l}deg ${h}deg, var(--success) ${h}deg 360deg)`})();return(0,t.jsxs)("div",{className:"topbar-status-donut-wrap","aria-hidden":"true",children:[(0,t.jsx)("div",{className:"topbar-status-donut",style:{background:d}}),(0,t.jsxs)("div",{className:"topbar-status-donut-center",children:[(0,t.jsx)("b",{children:a}),(0,t.jsx)("span",{children:m("overview.openSessions")})]})]})}function ae(){window.dispatchEvent(new Event(Q))}function Ct(e){let{autoOpen:n=!1,summary:o}=e,[r,a]=(0,p.useState)(!1),[d,l]=(0,p.useState)(!1),[h,i]=(0,p.useState)(!1),s=(0,p.useRef)(null),u=n&&!d,c=r||u;return(0,p.useEffect)(()=>{n||l(!1)},[n]),(0,p.useEffect)(()=>{if(!c)return;let v=b=>{let T=b.target;T instanceof Node&&s.current?.contains(T)||(a(!1),l(!0))};return document.addEventListener("pointerdown",v),()=>document.removeEventListener("pointerdown",v)},[c]),(0,t.jsxs)("div",{ref:s,className:`topbar-status-menu${u?" topbar-status-auto-open":""}${r?" is-open":""}${h?" suppress-hover":""}`,onPointerEnter:ae,onPointerLeave:()=>i(!1),onFocusCapture:ae,onBlur:v=>{let b=v.relatedTarget;(!(b instanceof Node)||!v.currentTarget.contains(b))&&a(!1)},onKeyDown:v=>{v.key==="Escape"&&(a(!1),l(!0),i(!0),v.currentTarget.querySelector("#status")?.focus())},children:[(0,t.jsx)("button",{type:"button",id:"status",className:"connection-status","aria-haspopup":"true","aria-expanded":c,onClick:()=>{if(ae(),c){a(!1),l(!0),i(!0);return}i(!1),a(!0)},children:m("overview.sessionOverview")}),(0,t.jsxs)("div",{className:"topbar-status-pop",children:[o.attentionNotice?(0,t.jsxs)("a",{className:"topbar-attention-notice",href:"#/sessions",children:[(0,t.jsx)("span",{className:"topbar-attention-dot","aria-hidden":"true"}),(0,t.jsxs)("span",{className:"topbar-attention-copy",children:[(0,t.jsx)("b",{children:m("strip.pending",{count:o.attentionNotice.count})}),(0,t.jsx)("small",{children:m("strip.longestCompact",{time:o.attentionNotice.time,bot:o.attentionNotice.bot,reason:o.attentionNotice.reason})})]}),(0,t.jsx)("span",{className:"topbar-attention-action",children:m("strip.handle")})]}):null,(0,t.jsxs)("div",{className:"topbar-status-list",children:[(0,t.jsx)(V,{label:m("overview.workingSessions"),value:o.working}),(0,t.jsx)(V,{label:m("overview.idleSessions"),value:o.idle}),(0,t.jsx)(V,{label:m("overview.attention"),value:o.attention,hot:o.attention>0}),(0,t.jsx)(V,{label:m("overview.onlineBots"),value:o.onlineBots})]}),(0,t.jsx)(Pt,{summary:o})]})]})}function Dt(e){return e.open?(0,t.jsx)("div",{id:"auth-expired-overlay",className:"auth-expired-overlay",role:"presentation",onClick:n=>{n.target===n.currentTarget&&e.onClose()},children:(0,t.jsxs)("div",{className:"auth-expired-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"auth-expired-title",children:[(0,t.jsx)("h2",{id:"auth-expired-title",children:"\u8BBF\u95EE\u94FE\u63A5\u5DF2\u5931\u6548"}),(0,t.jsx)("p",{children:"\u5F53\u524D\u94FE\u63A5/\u8BBF\u95EE\u5DF2\u5931\u6548\uFF0C\u8BF7\u4F7F\u7528\u6700\u65B0\u6388\u6743\u94FE\u63A5\u91CD\u65B0\u8FDB\u5165\uFF08\u8FD0\u884C botmux dashboard \u83B7\u53D6\uFF09\u3002"}),(0,t.jsx)("button",{id:"auth-expired-dismiss",type:"button",className:"primary",onClick:e.onClose,children:"\u77E5\u9053\u4E86"})]})}):null}function At(){let e=Ht(),[n,o]=(0,p.useState)(!1),[r,a]=(0,p.useState)(!1),[d,l]=(0,p.useState)(!1),h=(0,p.useRef)(e.attention),i=(0,p.useRef)(null),s=()=>{i.current!==null&&(window.clearTimeout(i.current),i.current=null)};(0,p.useEffect)(()=>{let c=()=>o(!0);return window.addEventListener(z,c),()=>window.removeEventListener(z,c)},[]),(0,p.useEffect)(()=>{let c=()=>a(!0);return window.addEventListener(ce,c),G&&a(!0),()=>window.removeEventListener(ce,c)},[]),(0,p.useEffect)(()=>()=>s(),[]),(0,p.useEffect)(()=>{let c=h.current;if(h.current=e.attention,e.attention===0){s(),l(!1);return}c!==0||document.body.classList.contains("theme-menu-open")||(l(!0),s(),i.current=window.setTimeout(()=>{i.current=null,l(!1)},4e3))},[e.attention]);let u=()=>{G=!1,a(!1)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"aurora","aria-hidden":"true",children:[(0,t.jsx)("i",{className:"a1"}),(0,t.jsx)("i",{className:"a2"}),(0,t.jsx)("i",{className:"a3"})]}),(0,t.jsxs)("div",{className:"app-shell",children:[(0,t.jsxs)("header",{className:"topbar",children:[(0,t.jsx)("div",{className:"topbar-left",children:(0,t.jsxs)("a",{className:"brand",href:"#/",children:[(0,t.jsx)("span",{className:"brand-mark","aria-hidden":"true",children:(0,t.jsx)("img",{className:"brand-logo-img",src:"/assets/brand-logo.png",alt:"",decoding:"sync",loading:"eager",fetchPriority:"high"})}),(0,t.jsx)("strong",{className:"brand-wordmark",children:"Botmux"}),(0,t.jsx)("span",{className:"brand-product",children:"Dashboard"})]})}),(0,t.jsxs)("div",{className:"topbar-actions",children:[(0,t.jsx)(Ct,{summary:e,autoOpen:d}),(0,t.jsxs)("div",{className:"topbar-tool-group",children:[(0,t.jsx)("button",{type:"button",className:"topbar-locale-toggle","aria-label":g.locale==="zh"?"Switch to English":"\u5207\u6362\u5230\u4E2D\u6587",title:g.locale==="zh"?"Switch to English":"\u5207\u6362\u5230\u4E2D\u6587",onClick:()=>Bt(g.locale==="zh"?"en":"zh"),children:g.locale==="zh"?"CN":"EN"}),(0,t.jsx)(Ot,{}),(0,t.jsxs)("a",{className:"topbar-docs-link",href:"https://bytedance.aiforce.cloud/app/app_4k9smq6rdxher/",target:"_blank",rel:"noopener noreferrer",title:m("nav.docs"),"aria-label":m("nav.docs"),children:[D((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.2",y:"2.2",width:"11.6",height:"11.6",rx:"2"}),(0,t.jsx)("path",{d:"M4.8 5.2h6.4M4.8 8h6.4M4.8 10.8h4"})]})),(0,t.jsx)("span",{children:m("nav.docs")})]})]}),(0,t.jsxs)("span",{className:"topbar-owner",title:k?.name,"aria-label":k?.name??"Owner",children:[(0,t.jsx)("span",{className:"topbar-owner-placeholder","aria-hidden":"true",children:D((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:"8",cy:"6",r:"2.4"}),(0,t.jsx)("path",{d:"M3.7 13c.7-2.5 2.2-3.7 4.3-3.7s3.6 1.2 4.3 3.7"})]}))}),k?.avatarUrl?(0,t.jsx)("img",{className:"topbar-owner-img",src:k.avatarUrl,alt:"",decoding:"async",referrerPolicy:"no-referrer",onError:c=>{c.currentTarget.remove()}}):null]})]})]}),(0,t.jsxs)("div",{className:"chrome-body",children:[(0,t.jsxs)("aside",{className:"sidebar",children:[S?(0,t.jsxs)("div",{className:"sidebar-create-actions",children:[(0,t.jsxs)("button",{type:"button",className:"sidebar-create-btn",onClick:()=>J(),children:[D((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M2 3.5h12v7H6l-3 3v-3H2z"}),(0,t.jsx)("path",{d:"M8 4.9v4.2M5.9 7h4.2"})]})),(0,t.jsx)("span",{className:"sidebar-nav-label",children:m("nav.createSession")})]}),(0,t.jsxs)("button",{type:"button",className:"sidebar-create-btn",onClick:()=>{ye()},children:[D((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:"2.5",y:"6",width:"11",height:"7.5",rx:"2"}),(0,t.jsx)("circle",{cx:"5.8",cy:"9.75",r:"1"}),(0,t.jsx)("circle",{cx:"10.2",cy:"9.75",r:"1"}),(0,t.jsx)("path",{d:"M8 6V3.8M6.3 1.9h3.4"})]})),(0,t.jsx)("span",{className:"sidebar-nav-label",children:m("nav.createBot")})]})]}):null,(0,t.jsx)("nav",{className:"sidebar-nav","aria-label":"Dashboard",children:Tt().filter(c=>S||!c.manage).map(c=>(0,t.jsxs)("a",{href:c.href,"data-route":c.id,className:[Lt(c),c.plugin?"sidebar-plugin-item":""].filter(Boolean).join(" ")||void 0,title:c.plugin?ze(c):void 0,children:[D(c.icon),(0,t.jsx)("span",{className:"sidebar-nav-label",children:ze(c)}),c.id==="settings"&&B?(0,t.jsx)(be,{className:"nav-update-tip",label:Fe(),trigger:(0,t.jsx)("span",{className:"nav-update-dot","aria-hidden":"true"}),preventClick:!1,focusable:!1,children:Fe()}):null]},c.id))})]}),(0,t.jsxs)("div",{className:"workspace",children:[(0,t.jsx)("dialog",{id:"create-session-modal",className:"create-session-modal"}),(0,t.jsx)(we,{open:n,onClose:()=>o(!1)}),(0,t.jsx)("main",{id:"root",ref:kt})]})]})]}),(0,t.jsx)(Dt,{open:r,onClose:u})]})}function w(){Ge?.render((0,t.jsx)(At,{}))}function Bt(e){g.setLocale(e),_t(e)}var G=!1;function It(){G||(G=!0,window.dispatchEvent(new Event(ce)))}var ie;function $t(){let e=document.getElementById("readonly-toast");e||(e=document.createElement("div"),e.id="readonly-toast",e.style.cssText="position:fixed;left:50%;bottom:28px;transform:translateX(-50%);z-index:9999;background:var(--fg,#1f2329);color:var(--bg,#fff);padding:10px 18px;border-radius:var(--radius-lg);font-size:13px;box-shadow:0 8px 24px rgba(0,0,0,.25)",document.body.appendChild(e)),e.textContent="\u5F53\u524D\u662F\u53EA\u8BFB\u8BBF\u95EE\uFF0C\u6B64\u64CD\u4F5C\u9700\u8981\u6388\u6743\u94FE\u63A5\uFF08\u8FD0\u884C botmux dashboard \u83B7\u53D6\uFF09",e.style.display="block",ie&&window.clearTimeout(ie),ie=window.setTimeout(()=>{e.style.display="none"},4e3)}var Ut=window.fetch.bind(window);window.fetch=async function(...n){let o=await Ut(...n);if(o.status===401){let r=(n[1]?.method??"GET").toUpperCase();(r==="GET"||r==="HEAD")&&!le?It():$t()}return o};async function Kt(){try{let e=await fetch("/api/settings");if(e.ok){let n=await e.json();S=!!n.authed,g.authed=S,le=!!(n.settings&&n.settings.publicReadOnly),g.publicReadOnly=le;let o=Je()??K(n.lang);o&&g.setLocale(o)}}catch{}}async function Ve(){try{let e=await fetch("/api/plugins/dashboard");if(!e.ok)return;let n=await e.json();A=(Array.isArray(n?.plugins)?n.plugins:[]).filter(r=>r.pinned===!0&&typeof r.route=="string").map(r=>({id:`plugin:${r.pluginId}:${r.id}`,href:r.route,label:r.displayName||r.pluginId,manage:!0,plugin:!0,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M5.2 2.2h5.6v3.1l1.7 1.7-1.4 1.4-1-1v6.4H5.9V7.4l-1 1L3.5 7l1.7-1.7z"}),(0,t.jsx)("path",{d:"M8 13.8v1"})]})})),w()}catch{}}async function _t(e){if(S)try{await fetch("/api/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({lang:e})})}catch{}}async function zt(){if(S)try{let e=await fetch("/api/update/status");if(!e.ok)return;let n=await e.json(),o=Array.isArray(n.cliUpdates)?n.cliUpdates.find(r=>r?.updateAvailable===!0&&r?.latest):null;n.behind===!0&&n.latest?(B=!0,q="botmux",I=String(n.latest)):o?(B=!0,q="codex",I=String(o.latest)):(B=!1,q=null,I=null),w()}catch{}}function Wt(e){e.innerHTML='<section class="auth-required" style="max-width:520px;margin:64px auto;text-align:center;background:var(--surface);color:var(--fg);border:1px solid var(--border);border-radius:var(--radius-lg);padding:40px 36px;box-shadow:0 8px 28px rgba(0,0,0,.12)"><h2 style="margin:0 0 12px;font-size:20px;color:var(--fg)">\u6B64\u9875\u9700\u8981\u6388\u6743\u94FE\u63A5</h2><p style="margin:0 0 24px;line-height:1.7;color:var(--muted);font-size:14px">\u4F60\u5F53\u524D\u662F\u53EA\u8BFB\u8BBF\u95EE\uFF0C\u7BA1\u7406\u9875\uFF08\u7FA4\u89D2\u8272 / Profiles / Bot \u914D\u7F6E / \u56E2\u961F / Webhook\uFF09\u9700\u8981\u6388\u6743\u94FE\u63A5\u3002\u8FD0\u884C <code>botmux dashboard</code> \u83B7\u53D6\u6700\u65B0\u94FE\u63A5\u540E\u5373\u53EF\u7BA1\u7406\u3002</p><a href="#/" style="display:inline-block;padding:8px 22px;background:var(--accent);color:var(--on-accent);border-radius:var(--radius-lg);text-decoration:none;font-size:14px">\u8FD4\u56DE\u603B\u89C8</a></section>'}async function se(){let e=Oe(M),n=location.hash||"#/";if(je=n,w(),!S&&Et.some(o=>n.startsWith("#/"+o))){Wt(re()),M.rerenderOnUiChange=!0;return}if(n.startsWith("#/v3")){window.location.replace(`#/workflows${n.slice(4)}`);return}else if(n.startsWith("#/legacy-workflow")){window.location.replace("#/workflows");return}else if(/^#\/workflows(?:\/|-)catalog(?:[/?].*)?$/.test(n)){window.location.replace("#/workflows");return}if(n.startsWith("#/role-profiles")){window.location.replace(`#/roles/profile${n.slice(15)}`);return}try{let o=Le(n);await He(M,e,re(),o?o.load:Re,{rerenderOnUiChange:o?o.rerenderOnUiChange:!1}),e===M.seq&&S&&Nt()}catch(o){if(e!==M.seq||De(o,{href:window.location.href,hash:n,getSessionStorage:()=>window.sessionStorage,reload:()=>window.location.reload()}))return;re().innerHTML=`<section class="page"><div class="empty">Dashboard route failed: ${ue(String(o))}</div></section>`,M.pageDispose=null,M.rerenderOnUiChange=!0}}function Ft(){try{let e=JSON.parse(window.localStorage.getItem(Xe)??"null");if(e?.avatarUrl)return{avatarUrl:String(e.avatarUrl),name:e.name?String(e.name):void 0}}catch{}return null}function Vt(){k=Ft(),w(),fetch("/api/owner-profile").then(e=>e.ok?e.json():null).then(e=>{if(!(!e?.ok||!e.avatarUrl)){k={avatarUrl:String(e.avatarUrl),name:e.name?String(e.name):void 0};try{window.localStorage.setItem(Xe,JSON.stringify({avatarUrl:e.avatarUrl,name:e.name??""}))}catch{}w()}}).catch(()=>{})}(async()=>{g.init(),We();let e=document.getElementById("app-root");if(!e)throw new Error("missing dashboard app root");_e(e),Ge=(0,qe.createRoot)(e),w(),g.on(()=>{w(),M.rerenderOnUiChange&&se()}),U.on(()=>{w()}),await Kt(),w(),window.addEventListener(ge,()=>{Ve()}),Ve(),zt(),Vt();try{await de()}catch(n){console.error("botmux dashboard bootstrap failed",n),U.setOnline(!1)}me().then(w),xe().then(w),window.addEventListener("hashchange",()=>{We()||se()}),se()})();export{It as showAuthExpiredOverlay,$t as showReadOnlyToast};