@minecraft-docker/mcctl-console 2.2.0 → 2.3.1

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 (186) hide show
  1. package/.next/standalone/platform/services/mcctl-console/.next/BUILD_ID +1 -1
  2. package/.next/standalone/platform/services/mcctl-console/.next/app-build-manifest.json +88 -87
  3. package/.next/standalone/platform/services/mcctl-console/.next/app-path-routes-manifest.json +1 -1
  4. package/.next/standalone/platform/services/mcctl-console/.next/build-manifest.json +4 -4
  5. package/.next/standalone/platform/services/mcctl-console/.next/prerender-manifest.json +1 -1
  6. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/admin/users/page.js +1 -1
  7. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/admin/users/page.js.nft.json +1 -1
  8. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/admin/users/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/audit-logs/page.js +51 -1
  10. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/audit-logs/page.js.nft.json +1 -1
  11. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/audit-logs/page_client-reference-manifest.js +1 -1
  12. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/backups/page.js +1 -1
  13. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/backups/page.js.nft.json +1 -1
  14. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/backups/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/dashboard/page.js +51 -1
  16. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/dashboard/page.js.nft.json +1 -1
  17. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/dashboard/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/players/page.js +1 -1
  19. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/players/page.js.nft.json +1 -1
  20. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/players/page_client-reference-manifest.js +1 -1
  21. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/routing/page.js +51 -1
  22. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/routing/page.js.nft.json +1 -1
  23. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/routing/page_client-reference-manifest.js +1 -1
  24. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/console/page_client-reference-manifest.js +1 -1
  25. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page.js +1 -1
  26. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page.js.nft.json +1 -1
  27. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page_client-reference-manifest.js +1 -1
  28. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/page.js +1 -1
  29. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/page.js.nft.json +1 -1
  30. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/page_client-reference-manifest.js +1 -1
  31. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/settings/page.js +1 -1
  32. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/settings/page.js.nft.json +1 -1
  33. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/settings/page_client-reference-manifest.js +1 -1
  34. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/worlds/page.js +1 -1
  35. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/worlds/page.js.nft.json +1 -1
  36. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/worlds/page_client-reference-manifest.js +1 -1
  37. package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  38. package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found.html +1 -1
  39. package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found.rsc +1 -1
  40. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/playit/start/route.js +1 -0
  41. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/playit/start/route.js.nft.json +1 -0
  42. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/playit/status/route.js +1 -0
  43. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/playit/status/route.js.nft.json +1 -0
  44. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/playit/stop/route.js +1 -0
  45. package/.next/standalone/platform/services/mcctl-console/.next/server/app/api/playit/stop/route.js.nft.json +1 -0
  46. package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.html +1 -1
  47. package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.rsc +2 -2
  48. package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.html +1 -1
  49. package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.rsc +2 -2
  50. package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.html +1 -1
  51. package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.rsc +2 -2
  52. package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.html +1 -1
  53. package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.rsc +1 -1
  54. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login/page_client-reference-manifest.js +1 -1
  55. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.html +1 -1
  56. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.rsc +1 -1
  57. package/.next/standalone/platform/services/mcctl-console/.next/server/app/page_client-reference-manifest.js +1 -1
  58. package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.html +1 -1
  59. package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.rsc +2 -2
  60. package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.html +1 -1
  61. package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.rsc +2 -2
  62. package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.html +1 -1
  63. package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.rsc +2 -2
  64. package/.next/standalone/platform/services/mcctl-console/.next/server/app/settings.html +1 -1
  65. package/.next/standalone/platform/services/mcctl-console/.next/server/app/settings.rsc +2 -2
  66. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup/page_client-reference-manifest.js +1 -1
  67. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.html +1 -1
  68. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.rsc +1 -1
  69. package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.html +1 -1
  70. package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.rsc +2 -2
  71. package/.next/standalone/platform/services/mcctl-console/.next/server/app-paths-manifest.json +24 -21
  72. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/1309.js +1 -1
  73. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/2658.js +1 -0
  74. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/3810.js +1 -0
  75. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/4207.js +1 -0
  76. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/4609.js +1 -0
  77. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/4859.js +1 -0
  78. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/5843.js +1 -0
  79. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/5845.js +51 -0
  80. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/7402.js +54 -0
  81. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/7445.js +1 -0
  82. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/8504.js +2 -0
  83. package/.next/standalone/platform/services/mcctl-console/.next/server/middleware-build-manifest.js +1 -1
  84. package/.next/standalone/platform/services/mcctl-console/.next/server/middleware-manifest.json +5 -5
  85. package/.next/standalone/platform/services/mcctl-console/.next/server/next-font-manifest.js +1 -1
  86. package/.next/standalone/platform/services/mcctl-console/.next/server/next-font-manifest.json +1 -1
  87. package/.next/standalone/platform/services/mcctl-console/.next/server/pages/404.html +1 -1
  88. package/.next/standalone/platform/services/mcctl-console/.next/server/pages/500.html +1 -1
  89. package/.next/standalone/platform/services/mcctl-console/.next/server/server-reference-manifest.json +1 -1
  90. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/190-9ecdd3c2ad7fadef.js +1 -0
  91. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2538-09440cfe5c38aa16.js +1 -0
  92. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2698-aeed063326ab23db.js +1 -0
  93. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2844-de6e17c136b0de1e.js +1 -0
  94. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/3468-6b2e00f103a95869.js +1 -0
  95. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/4596-fa980f5e0b65f2b7.js +1 -0
  96. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/5386-a568e84580b1d208.js +1 -0
  97. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/7965-9d8c883e48d2ae13.js +1 -0
  98. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/8854-11e2a182afd76dcd.js +1 -0
  99. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/9186-5b49ecbdcac7ddc4.js +1 -0
  100. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/9727-8e82372636a2fca6.js +1 -0
  101. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/9951-34eb9e4c6b6cdd23.js +1 -0
  102. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/admin/users/page-b4483a2e5c12dce7.js +1 -0
  103. package/.next/{static/chunks/app/(main)/audit-logs/page-592b5471bbfd01e3.js → standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/audit-logs/page-2763a56ce0490dd1.js} +1 -1
  104. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/backups/{page-201b9f9aecc8932e.js → page-76da68ecfd3fd38f.js} +1 -1
  105. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/dashboard/page-b2677b1041311201.js +1 -0
  106. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/players/page-a06b9b52377085b5.js +1 -0
  107. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/routing/page-8333f2419cbdd686.js +1 -0
  108. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/page-00a86e5a4cd95b72.js +1 -0
  109. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/{page-9d374aef836cdbae.js → page-c5378a7bfc6472ca.js} +1 -1
  110. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/settings/page-af345917f438de8d.js +1 -0
  111. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/worlds/page-01447db96eaf75eb.js +1 -0
  112. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/{main-c1b58e7640294abf.js → main-0309b77c14e952d4.js} +1 -1
  113. package/.next/static/chunks/190-9ecdd3c2ad7fadef.js +1 -0
  114. package/.next/static/chunks/2538-09440cfe5c38aa16.js +1 -0
  115. package/.next/static/chunks/2698-aeed063326ab23db.js +1 -0
  116. package/.next/static/chunks/2844-de6e17c136b0de1e.js +1 -0
  117. package/.next/static/chunks/3468-6b2e00f103a95869.js +1 -0
  118. package/.next/static/chunks/4596-fa980f5e0b65f2b7.js +1 -0
  119. package/.next/static/chunks/5386-a568e84580b1d208.js +1 -0
  120. package/.next/static/chunks/7965-9d8c883e48d2ae13.js +1 -0
  121. package/.next/static/chunks/8854-11e2a182afd76dcd.js +1 -0
  122. package/.next/static/chunks/9186-5b49ecbdcac7ddc4.js +1 -0
  123. package/.next/static/chunks/9727-8e82372636a2fca6.js +1 -0
  124. package/.next/static/chunks/9951-34eb9e4c6b6cdd23.js +1 -0
  125. package/.next/static/chunks/app/(main)/admin/users/page-b4483a2e5c12dce7.js +1 -0
  126. package/.next/{standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/audit-logs/page-592b5471bbfd01e3.js → static/chunks/app/(main)/audit-logs/page-2763a56ce0490dd1.js} +1 -1
  127. package/.next/static/chunks/app/(main)/backups/{page-201b9f9aecc8932e.js → page-76da68ecfd3fd38f.js} +1 -1
  128. package/.next/static/chunks/app/(main)/dashboard/page-b2677b1041311201.js +1 -0
  129. package/.next/static/chunks/app/(main)/players/page-a06b9b52377085b5.js +1 -0
  130. package/.next/static/chunks/app/(main)/routing/page-8333f2419cbdd686.js +1 -0
  131. package/.next/static/chunks/app/(main)/servers/[name]/page-00a86e5a4cd95b72.js +1 -0
  132. package/.next/static/chunks/app/(main)/servers/{page-9d374aef836cdbae.js → page-c5378a7bfc6472ca.js} +1 -1
  133. package/.next/static/chunks/app/(main)/settings/page-af345917f438de8d.js +1 -0
  134. package/.next/static/chunks/app/(main)/worlds/page-01447db96eaf75eb.js +1 -0
  135. package/.next/static/chunks/{main-c1b58e7640294abf.js → main-0309b77c14e952d4.js} +1 -1
  136. package/package.json +2 -2
  137. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/1080.js +0 -1
  138. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/1314.js +0 -54
  139. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/3434.js +0 -1
  140. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/5019.js +0 -1
  141. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/5068.js +0 -1
  142. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/5466.js +0 -2
  143. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/701.js +0 -1
  144. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/8685.js +0 -1
  145. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/8849.js +0 -1
  146. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/8913.js +0 -51
  147. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/1189-9b2b752dc97065ac.js +0 -1
  148. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/1854-71dbad60b363e57e.js +0 -1
  149. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2777-90cc701b41e837af.js +0 -1
  150. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/4668-f487c5c564e045d6.js +0 -1
  151. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/521-a5b59e2a19c8dd4f.js +0 -1
  152. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/6479-f31fbc0f2cf7ddd0.js +0 -1
  153. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/7359-45760f0e0e93f86b.js +0 -1
  154. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/892-a0f20ea0df618c15.js +0 -1
  155. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/9058-02ac41562ff141d0.js +0 -1
  156. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/9154-c792f0aadd25fffe.js +0 -1
  157. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/9654-84c0d7b06321aab9.js +0 -1
  158. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/admin/users/page-48f4e3bdef6c2202.js +0 -1
  159. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/dashboard/page-626f566be94160eb.js +0 -1
  160. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/players/page-a655062812711f1b.js +0 -1
  161. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/routing/page-7797d4cf74c7fa77.js +0 -1
  162. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/page-f1026a973b0f8ac1.js +0 -1
  163. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/settings/page-fe918cc58acd9ed9.js +0 -1
  164. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/worlds/page-2e4a4b525d3b0f1d.js +0 -1
  165. package/.next/static/chunks/1189-9b2b752dc97065ac.js +0 -1
  166. package/.next/static/chunks/1854-71dbad60b363e57e.js +0 -1
  167. package/.next/static/chunks/2777-90cc701b41e837af.js +0 -1
  168. package/.next/static/chunks/4668-f487c5c564e045d6.js +0 -1
  169. package/.next/static/chunks/521-a5b59e2a19c8dd4f.js +0 -1
  170. package/.next/static/chunks/6479-f31fbc0f2cf7ddd0.js +0 -1
  171. package/.next/static/chunks/7359-45760f0e0e93f86b.js +0 -1
  172. package/.next/static/chunks/892-a0f20ea0df618c15.js +0 -1
  173. package/.next/static/chunks/9058-02ac41562ff141d0.js +0 -1
  174. package/.next/static/chunks/9154-c792f0aadd25fffe.js +0 -1
  175. package/.next/static/chunks/9654-84c0d7b06321aab9.js +0 -1
  176. package/.next/static/chunks/app/(main)/admin/users/page-48f4e3bdef6c2202.js +0 -1
  177. package/.next/static/chunks/app/(main)/dashboard/page-626f566be94160eb.js +0 -1
  178. package/.next/static/chunks/app/(main)/players/page-a655062812711f1b.js +0 -1
  179. package/.next/static/chunks/app/(main)/routing/page-7797d4cf74c7fa77.js +0 -1
  180. package/.next/static/chunks/app/(main)/servers/[name]/page-f1026a973b0f8ac1.js +0 -1
  181. package/.next/static/chunks/app/(main)/settings/page-fe918cc58acd9ed9.js +0 -1
  182. package/.next/static/chunks/app/(main)/worlds/page-2e4a4b525d3b0f1d.js +0 -1
  183. /package/.next/standalone/platform/services/mcctl-console/.next/static/{0yTJAIAp_3b6rB4bkr7KX → U7hes5rGui7VmCbmR2z8L}/_buildManifest.js +0 -0
  184. /package/.next/standalone/platform/services/mcctl-console/.next/static/{0yTJAIAp_3b6rB4bkr7KX → U7hes5rGui7VmCbmR2z8L}/_ssgManifest.js +0 -0
  185. /package/.next/static/{0yTJAIAp_3b6rB4bkr7KX → U7hes5rGui7VmCbmR2z8L}/_buildManifest.js +0 -0
  186. /package/.next/static/{0yTJAIAp_3b6rB4bkr7KX → U7hes5rGui7VmCbmR2z8L}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6302],{1366:function(e,s,n){Promise.resolve().then(n.bind(n,6643))},6643:function(e,s,n){"use strict";n.r(s),n.d(s,{default:function(){return N}});var t=n(94655),r=n(31317),i=n(7281),a=n(69899),o=n(70115),c=n(76492),l=n(91606),d=n(628),h=n(41565),x=n(25333),u=n(46207),j=n(43436),Z=n(92666);function m(){let{data:e,isLoading:s,error:n}=(0,Z.mj)();if(s)return(0,t.jsx)(d.Z,{children:(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(r.Z,{variant:"h6",gutterBottom:!0,children:"Backup Status"}),(0,t.jsx)(r.Z,{color:"text.secondary",children:"Loading..."})]})});if(n)return(0,t.jsx)(d.Z,{children:(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(r.Z,{variant:"h6",gutterBottom:!0,children:"Backup Status"}),(0,t.jsx)(r.Z,{color:"error",children:"Failed to load backup status"})]})});let{configured:a,lastBackup:o,repository:c}=e||{};return(0,t.jsx)(d.Z,{children:(0,t.jsxs)(h.Z,{children:[(0,t.jsxs)(i.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(r.Z,{variant:"h6",children:"Backup Status"}),(0,t.jsx)(x.Z,{icon:a?(0,t.jsx)(u.Z,{}):(0,t.jsx)(j.Z,{}),label:a?"Configured":"Not Configured",color:a?"success":"error",size:"small"})]}),a?(0,t.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:[c&&(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"caption",color:"text.secondary",children:"Repository"}),(0,t.jsx)(r.Z,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.875rem"},children:c})]}),o&&(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"caption",color:"text.secondary",children:"Last Backup"}),(0,t.jsx)(r.Z,{variant:"body2",children:function(e){let s=new Date,n=new Date(e),t=Math.floor((s.getTime()-n.getTime())/6e4),r=Math.floor(t/60);return t<1?"just now":t<60?"".concat(t," minutes ago"):r<24?"".concat(r," hours ago"):"".concat(Math.floor(r/24)," days ago")}(o)})]}),!o&&(0,t.jsx)(r.Z,{variant:"body2",color:"text.secondary",children:"No backups yet"})]}):(0,t.jsx)(r.Z,{variant:"body2",color:"text.secondary",children:"GitHub backup is not configured. Please configure BACKUP_REPO_URL in your environment."})]})})}var p=n(35106),g=n(21138),y=n(84811),b=n(47001),f=n(53281),v=n(11254),k=n(70366),C=n(79983),w=n(97731),B=n(30417),S=n(99770),F=n(76678),D=n(5682),I=n(65087),T=n(62508),R=n(81071),z=n(93017);function P(e){var s;let{open:n,commit:a,onClose:o}=e,{mutate:c,isPending:l}=(0,Z.s8)(),[d,h]=(0,p.useState)(""),[x,u]=(0,p.useState)(""),j=()=>{l||(h(""),u(""),o())};return(0,t.jsxs)(S.Z,{open:n,onClose:j,maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(T.Z,{children:"Restore Backup"}),(0,t.jsxs)(D.Z,{children:[(0,t.jsx)(R.Z,{severity:"warning",sx:{mb:2},children:"This will restore all worlds from the selected backup. Current world data will be overwritten."}),d&&(0,t.jsx)(R.Z,{severity:"success",sx:{mb:2},children:d}),x&&(0,t.jsx)(R.Z,{severity:"error",sx:{mb:2},children:x}),(0,t.jsx)(I.Z,{sx:{mb:2},children:"Are you sure you want to restore from this backup?"}),(0,t.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:[(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"caption",color:"text.secondary",children:"Commit Hash"}),(0,t.jsx)(r.Z,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.875rem"},children:a.hash})]}),(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"caption",color:"text.secondary",children:"Date"}),(0,t.jsx)(r.Z,{variant:"body2",children:(s=a.date,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(s)))})]}),(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"caption",color:"text.secondary",children:"Message"}),(0,t.jsx)(r.Z,{variant:"body2",children:a.message})]}),(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"caption",color:"text.secondary",children:"Author"}),(0,t.jsx)(r.Z,{variant:"body2",children:a.author})]})]})]}),(0,t.jsxs)(F.Z,{children:[(0,t.jsx)(B.Z,{onClick:j,disabled:l,children:"Cancel"}),(0,t.jsx)(B.Z,{onClick:()=>{h(""),u(""),c(a.hash,{onSuccess:()=>{h("Backup restored successfully from ".concat(a.hash.substring(0,7))),setTimeout(()=>{o()},2e3)},onError:e=>{u("Failed to restore backup: ".concat(e.message))}})},variant:"contained",color:"warning",disabled:l,startIcon:l?(0,t.jsx)(z.Z,{size:16}):(0,t.jsx)(w.Z,{}),children:l?"Restoring...":"Restore"})]})]})}function _(){let{data:e,isLoading:s,error:n}=(0,Z.$t)(20),[i,a]=(0,p.useState)(null),o=e=>{a(e)};if(s)return(0,t.jsx)(d.Z,{children:(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(r.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),(0,t.jsx)(r.Z,{color:"text.secondary",children:"Loading..."})]})});if(n)return(0,t.jsx)(d.Z,{children:(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(r.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),(0,t.jsx)(r.Z,{color:"error",children:"Failed to load backup history"})]})});let c=(null==e?void 0:e.commits)||[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.Z,{children:(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(r.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),0===c.length?(0,t.jsx)(r.Z,{color:"text.secondary",children:"No backup history available"}):(0,t.jsx)(f.Z,{children:(0,t.jsxs)(g.Z,{children:[(0,t.jsx)(v.Z,{children:(0,t.jsxs)(k.Z,{children:[(0,t.jsx)(b.Z,{children:"Commit"}),(0,t.jsx)(b.Z,{children:"Date"}),(0,t.jsx)(b.Z,{children:"Message"}),(0,t.jsx)(b.Z,{children:"Author"}),(0,t.jsx)(b.Z,{align:"right",children:"Actions"})]})}),(0,t.jsx)(y.Z,{children:c.map(e=>{var s;return(0,t.jsxs)(k.Z,{children:[(0,t.jsx)(b.Z,{children:(0,t.jsx)(x.Z,{label:e.hash.substring(0,7),size:"small",variant:"outlined",sx:{fontFamily:"monospace"}})}),(0,t.jsx)(b.Z,{children:(0,t.jsx)(r.Z,{variant:"body2",children:(s=e.date,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(s)))})}),(0,t.jsx)(b.Z,{children:(0,t.jsx)(r.Z,{variant:"body2",children:e.message})}),(0,t.jsx)(b.Z,{children:(0,t.jsx)(r.Z,{variant:"body2",color:"text.secondary",children:e.author})}),(0,t.jsx)(b.Z,{align:"right",children:(0,t.jsx)(C.Z,{size:"small",color:"primary",onClick:()=>o(e),title:"Restore this backup",children:(0,t.jsx)(w.Z,{})})})]},e.hash)})})]})})]})}),i&&(0,t.jsx)(P,{open:!!i,commit:i,onClose:()=>{a(null)}})]})}var H=n(97436),M=n(34675);function E(e){let{disabled:s}=e,[n,r]=(0,p.useState)(!1),[i,a]=(0,p.useState)(""),[o,c]=(0,p.useState)(""),[l,d]=(0,p.useState)(""),{mutate:h,isPending:x}=(0,Z.c5)(),u=()=>{x||(r(!1),a(""),c(""),d(""))};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B.Z,{variant:"contained",startIcon:(0,t.jsx)(M.Z,{}),onClick:()=>{r(!0),c(""),d(""),a("Backup ".concat(new Date().toISOString().split("T")[0]))},disabled:s||x,children:"Push Backup"}),(0,t.jsxs)(S.Z,{open:n,onClose:u,maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(T.Z,{children:"Push Backup"}),(0,t.jsxs)(D.Z,{children:[o&&(0,t.jsx)(R.Z,{severity:"success",sx:{mb:2},children:o}),l&&(0,t.jsx)(R.Z,{severity:"error",sx:{mb:2},children:l}),(0,t.jsx)(H.Z,{autoFocus:!0,margin:"dense",label:"Commit Message",type:"text",fullWidth:!0,variant:"outlined",value:i,onChange:e=>a(e.target.value),disabled:x,helperText:"Optional message describing this backup"})]}),(0,t.jsxs)(F.Z,{children:[(0,t.jsx)(B.Z,{onClick:u,disabled:x,children:"Cancel"}),(0,t.jsx)(B.Z,{onClick:()=>{c(""),d(""),h({message:i||void 0},{onSuccess:e=>{c(e.commitHash?"Backup pushed successfully (".concat(e.commitHash.substring(0,7),")"):"Backup pushed successfully"),setTimeout(()=>{u()},2e3)},onError:e=>{d("Failed to push backup: ".concat(e.message))}})},variant:"contained",disabled:x,startIcon:x?(0,t.jsx)(z.Z,{size:16}):(0,t.jsx)(M.Z,{}),children:x?"Pushing...":"Push"})]})]})]})}function N(){var e;let{data:s}=(0,Z.mj)(),n=null!==(e=null==s?void 0:s.configured)&&void 0!==e&&e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(a.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,c.Fq)(e.palette.secondary.main,.1)," 0%, ").concat((0,c.Fq)(e.palette.info.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,c.Fq)(e.palette.secondary.main,.2)),display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,t.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,t.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"secondary.main",color:"secondary.contrastText"},children:(0,t.jsx)(l.Z,{sx:{fontSize:32}})}),(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Backups"}),(0,t.jsx)(r.Z,{variant:"body1",color:"text.secondary",children:"Manage world backups and restore points"})]})]}),(0,t.jsx)(E,{disabled:!n})]}),(0,t.jsxs)(o.Z,{spacing:3,children:[(0,t.jsx)(m,{}),n&&(0,t.jsx)(_,{})]})]})}}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,7359,880,9654,892,2666,3669,2757,1744],function(){return e(e.s=1366)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6302],{1366:function(e,s,n){Promise.resolve().then(n.bind(n,6643))},6643:function(e,s,n){"use strict";n.r(s),n.d(s,{default:function(){return N}});var t=n(94655),r=n(31317),i=n(7281),a=n(69899),o=n(70115),c=n(76492),l=n(91606),d=n(628),h=n(41565),x=n(25333),u=n(46207),j=n(43436),Z=n(92666);function m(){let{data:e,isLoading:s,error:n}=(0,Z.mj)();if(s)return(0,t.jsx)(d.Z,{children:(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(r.Z,{variant:"h6",gutterBottom:!0,children:"Backup Status"}),(0,t.jsx)(r.Z,{color:"text.secondary",children:"Loading..."})]})});if(n)return(0,t.jsx)(d.Z,{children:(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(r.Z,{variant:"h6",gutterBottom:!0,children:"Backup Status"}),(0,t.jsx)(r.Z,{color:"error",children:"Failed to load backup status"})]})});let{configured:a,lastBackup:o,repository:c}=e||{};return(0,t.jsx)(d.Z,{children:(0,t.jsxs)(h.Z,{children:[(0,t.jsxs)(i.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(r.Z,{variant:"h6",children:"Backup Status"}),(0,t.jsx)(x.Z,{icon:a?(0,t.jsx)(u.Z,{}):(0,t.jsx)(j.Z,{}),label:a?"Configured":"Not Configured",color:a?"success":"error",size:"small"})]}),a?(0,t.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:[c&&(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"caption",color:"text.secondary",children:"Repository"}),(0,t.jsx)(r.Z,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.875rem"},children:c})]}),o&&(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"caption",color:"text.secondary",children:"Last Backup"}),(0,t.jsx)(r.Z,{variant:"body2",children:function(e){let s=new Date,n=new Date(e),t=Math.floor((s.getTime()-n.getTime())/6e4),r=Math.floor(t/60);return t<1?"just now":t<60?"".concat(t," minutes ago"):r<24?"".concat(r," hours ago"):"".concat(Math.floor(r/24)," days ago")}(o)})]}),!o&&(0,t.jsx)(r.Z,{variant:"body2",color:"text.secondary",children:"No backups yet"})]}):(0,t.jsx)(r.Z,{variant:"body2",color:"text.secondary",children:"GitHub backup is not configured. Please configure BACKUP_REPO_URL in your environment."})]})})}var p=n(35106),g=n(21138),y=n(84811),b=n(47001),f=n(53281),v=n(11254),k=n(70366),C=n(79983),w=n(97731),B=n(30417),S=n(99770),F=n(76678),D=n(5682),I=n(65087),T=n(62508),R=n(81071),z=n(93017);function P(e){var s;let{open:n,commit:a,onClose:o}=e,{mutate:c,isPending:l}=(0,Z.s8)(),[d,h]=(0,p.useState)(""),[x,u]=(0,p.useState)(""),j=()=>{l||(h(""),u(""),o())};return(0,t.jsxs)(S.Z,{open:n,onClose:j,maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(T.Z,{children:"Restore Backup"}),(0,t.jsxs)(D.Z,{children:[(0,t.jsx)(R.Z,{severity:"warning",sx:{mb:2},children:"This will restore all worlds from the selected backup. Current world data will be overwritten."}),d&&(0,t.jsx)(R.Z,{severity:"success",sx:{mb:2},children:d}),x&&(0,t.jsx)(R.Z,{severity:"error",sx:{mb:2},children:x}),(0,t.jsx)(I.Z,{sx:{mb:2},children:"Are you sure you want to restore from this backup?"}),(0,t.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:[(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"caption",color:"text.secondary",children:"Commit Hash"}),(0,t.jsx)(r.Z,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.875rem"},children:a.hash})]}),(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"caption",color:"text.secondary",children:"Date"}),(0,t.jsx)(r.Z,{variant:"body2",children:(s=a.date,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(s)))})]}),(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"caption",color:"text.secondary",children:"Message"}),(0,t.jsx)(r.Z,{variant:"body2",children:a.message})]}),(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"caption",color:"text.secondary",children:"Author"}),(0,t.jsx)(r.Z,{variant:"body2",children:a.author})]})]})]}),(0,t.jsxs)(F.Z,{children:[(0,t.jsx)(B.Z,{onClick:j,disabled:l,children:"Cancel"}),(0,t.jsx)(B.Z,{onClick:()=>{h(""),u(""),c(a.hash,{onSuccess:()=>{h("Backup restored successfully from ".concat(a.hash.substring(0,7))),setTimeout(()=>{o()},2e3)},onError:e=>{u("Failed to restore backup: ".concat(e.message))}})},variant:"contained",color:"warning",disabled:l,startIcon:l?(0,t.jsx)(z.Z,{size:16}):(0,t.jsx)(w.Z,{}),children:l?"Restoring...":"Restore"})]})]})}function _(){let{data:e,isLoading:s,error:n}=(0,Z.$t)(20),[i,a]=(0,p.useState)(null),o=e=>{a(e)};if(s)return(0,t.jsx)(d.Z,{children:(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(r.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),(0,t.jsx)(r.Z,{color:"text.secondary",children:"Loading..."})]})});if(n)return(0,t.jsx)(d.Z,{children:(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(r.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),(0,t.jsx)(r.Z,{color:"error",children:"Failed to load backup history"})]})});let c=(null==e?void 0:e.commits)||[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.Z,{children:(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(r.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),0===c.length?(0,t.jsx)(r.Z,{color:"text.secondary",children:"No backup history available"}):(0,t.jsx)(f.Z,{children:(0,t.jsxs)(g.Z,{children:[(0,t.jsx)(v.Z,{children:(0,t.jsxs)(k.Z,{children:[(0,t.jsx)(b.Z,{children:"Commit"}),(0,t.jsx)(b.Z,{children:"Date"}),(0,t.jsx)(b.Z,{children:"Message"}),(0,t.jsx)(b.Z,{children:"Author"}),(0,t.jsx)(b.Z,{align:"right",children:"Actions"})]})}),(0,t.jsx)(y.Z,{children:c.map(e=>{var s;return(0,t.jsxs)(k.Z,{children:[(0,t.jsx)(b.Z,{children:(0,t.jsx)(x.Z,{label:e.hash.substring(0,7),size:"small",variant:"outlined",sx:{fontFamily:"monospace"}})}),(0,t.jsx)(b.Z,{children:(0,t.jsx)(r.Z,{variant:"body2",children:(s=e.date,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(s)))})}),(0,t.jsx)(b.Z,{children:(0,t.jsx)(r.Z,{variant:"body2",children:e.message})}),(0,t.jsx)(b.Z,{children:(0,t.jsx)(r.Z,{variant:"body2",color:"text.secondary",children:e.author})}),(0,t.jsx)(b.Z,{align:"right",children:(0,t.jsx)(C.Z,{size:"small",color:"primary",onClick:()=>o(e),title:"Restore this backup",children:(0,t.jsx)(w.Z,{})})})]},e.hash)})})]})})]})}),i&&(0,t.jsx)(P,{open:!!i,commit:i,onClose:()=>{a(null)}})]})}var H=n(97436),M=n(34675);function E(e){let{disabled:s}=e,[n,r]=(0,p.useState)(!1),[i,a]=(0,p.useState)(""),[o,c]=(0,p.useState)(""),[l,d]=(0,p.useState)(""),{mutate:h,isPending:x}=(0,Z.c5)(),u=()=>{x||(r(!1),a(""),c(""),d(""))};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B.Z,{variant:"contained",startIcon:(0,t.jsx)(M.Z,{}),onClick:()=>{r(!0),c(""),d(""),a("Backup ".concat(new Date().toISOString().split("T")[0]))},disabled:s||x,children:"Push Backup"}),(0,t.jsxs)(S.Z,{open:n,onClose:u,maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(T.Z,{children:"Push Backup"}),(0,t.jsxs)(D.Z,{children:[o&&(0,t.jsx)(R.Z,{severity:"success",sx:{mb:2},children:o}),l&&(0,t.jsx)(R.Z,{severity:"error",sx:{mb:2},children:l}),(0,t.jsx)(H.Z,{autoFocus:!0,margin:"dense",label:"Commit Message",type:"text",fullWidth:!0,variant:"outlined",value:i,onChange:e=>a(e.target.value),disabled:x,helperText:"Optional message describing this backup"})]}),(0,t.jsxs)(F.Z,{children:[(0,t.jsx)(B.Z,{onClick:u,disabled:x,children:"Cancel"}),(0,t.jsx)(B.Z,{onClick:()=>{c(""),d(""),h({message:i||void 0},{onSuccess:e=>{c(e.commitHash?"Backup pushed successfully (".concat(e.commitHash.substring(0,7),")"):"Backup pushed successfully"),setTimeout(()=>{u()},2e3)},onError:e=>{d("Failed to push backup: ".concat(e.message))}})},variant:"contained",disabled:x,startIcon:x?(0,t.jsx)(z.Z,{size:16}):(0,t.jsx)(M.Z,{}),children:x?"Pushing...":"Push"})]})]})]})}function N(){var e;let{data:s}=(0,Z.mj)(),n=null!==(e=null==s?void 0:s.configured)&&void 0!==e&&e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(a.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,c.Fq)(e.palette.secondary.main,.1)," 0%, ").concat((0,c.Fq)(e.palette.info.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,c.Fq)(e.palette.secondary.main,.2)),display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,t.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,t.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"secondary.main",color:"secondary.contrastText"},children:(0,t.jsx)(l.Z,{sx:{fontSize:32}})}),(0,t.jsxs)(i.Z,{children:[(0,t.jsx)(r.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Backups"}),(0,t.jsx)(r.Z,{variant:"body1",color:"text.secondary",children:"Manage world backups and restore points"})]})]}),(0,t.jsx)(E,{disabled:!n})]}),(0,t.jsxs)(o.Z,{spacing:3,children:[(0,t.jsx)(m,{}),n&&(0,t.jsx)(_,{})]})]})}}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,880,2844,8854,2666,3669,2757,1744],function(){return e(e.s=1366)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2248],{12121:function(e,t,n){Promise.resolve().then(n.bind(n,64924))},64924:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return U}});var r=n(94655),s=n(69899),i=n(76492),a=n(7281),o=n(31317),l=n(84840),c=n(628),d=n(41565),u=n(10721),h=n(25065),x=n(91179),p=n(11767),m=n(53832),f=n(30164),g=n(92666),v=n(59104);function j(e){let{title:t,value:n,icon:s,color:i="primary",description:l}=e,u={primary:"#1bd96a",success:"#22c55e",info:"#3b82f6",secondary:"#7c3aed"};return(0,r.jsx)(c.Z,{"data-testid":"stat-card",sx:{height:"100%",position:"relative",overflow:"hidden","&::before":{content:'""',position:"absolute",top:0,left:0,right:0,height:"4px",background:u[i]}},children:(0,r.jsxs)(d.Z,{children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2},children:[(0,r.jsx)(o.Z,{variant:"body2",color:"text.secondary",sx:{fontWeight:500},children:t}),s&&(0,r.jsx)(a.Z,{sx:{color:u[i],opacity:.8},children:s})]}),(0,r.jsx)(o.Z,{variant:"h3",component:"div",sx:{fontWeight:700,color:"text.primary",mb:l?1:0},children:n}),l&&(0,r.jsx)(o.Z,{variant:"caption",color:"text.secondary",children:l})]})})}var y=n(98406),Z=n(93017),b=n(25333),w=n(46725),S=n(8690),C=n(31358);function T(e){let{servers:t,statusMap:n={},isLoading:s,maxItems:i,showViewAll:l=!1,onServerClick:u}=e,h=(0,C.x)(),x=i?t.slice(0,i):t,p=e=>{u?u(e):h.push("/servers/".concat(e))},m=e=>{switch(e){case"running":return"success";case"stopped":case"exited":return"error";case"created":return"warning";default:return"default"}},f=e=>{switch(e){case"healthy":return"success";case"unhealthy":return"error";case"starting":return"warning";default:return"default"}};return s?(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(y.Z,{title:"Servers"}),(0,r.jsx)(d.Z,{children:(0,r.jsx)(a.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,r.jsx)(Z.Z,{})})})]}):0===t.length?(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(y.Z,{title:"Servers"}),(0,r.jsx)(d.Z,{children:(0,r.jsx)(o.Z,{color:"text.secondary",align:"center",children:"No servers found. Create your first server to get started."})})]}):(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(y.Z,{title:"Servers",action:l&&t.length>(i||0)?(0,r.jsxs)(w.default,{href:"/servers",onClick:()=>(0,S.Av)(),style:{textDecoration:"none",color:"inherit",fontSize:"0.875rem"},children:["View All (",t.length,")"]}):null}),(0,r.jsx)(d.Z,{children:(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"column",gap:2},children:x.map(e=>{let t=n[e.name],s=(null==t?void 0:t.status)||e.status,i=(null==t?void 0:t.health)||e.health;return(0,r.jsx)(a.Z,{role:"button",onClick:()=>p(e.name),sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider",cursor:"pointer",transition:"all 0.2s","&:hover":{borderColor:"primary.main",backgroundColor:"action.hover"}},children:(0,r.jsxs)(a.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,r.jsxs)(a.Z,{children:[(0,r.jsx)(o.Z,{variant:"subtitle1",fontWeight:600,children:e.name}),(0,r.jsx)(o.Z,{variant:"caption",color:"text.secondary",children:e.hostname})]}),(0,r.jsxs)(a.Z,{sx:{display:"flex",gap:1},children:[(0,r.jsx)(b.Z,{label:s,color:m(s),size:"small"}),"none"!==i&&(0,r.jsx)(b.Z,{label:i,color:f(i),size:"small",variant:"outlined"})]})]})},e.name)})})})]})}var k=n(35106),z=n(41261);function I(e){let{maxVersions:t=2,title:n="Recent Updates"}=e,[s,i]=(0,k.useState)([]),[l,h]=(0,k.useState)(!0),[x,p]=(0,k.useState)(null);return((0,k.useEffect)(()=>{(async function(){try{let e=await fetch("https://api.github.com/repos/smallmiro/minecraft-server-manager/contents/CHANGELOG.md",{headers:{Accept:"application/vnd.github.v3+json"}});if(!e.ok)throw Error("Failed to fetch changelog");let n=await e.json(),r=atob(n.content),s=function(e,t){let n=[],r=e.split("\n"),s=null,i="added";for(let e of r){let r=e.match(/^## \[([^\]]+)\] - (\d{4}-\d{2}-\d{2})/);if(r){if(s&&(n.push(s),n.length>=t))break;s={version:r[1],date:r[2],items:[]};continue}let a=e.match(/^### (Added|Fixed|Changed)/i);if(a){i=a[1].toLowerCase();continue}let o=e.match(/^- \*\*([^*]+)\*\*\s*[-–]?\s*(.*)$/);o&&s&&s.items.push({type:i,message:o[1].trim()})}return s&&n.length<t&&n.push(s),n}(r,t);i(s)}catch(e){p(e instanceof Error?e.message:"Unknown error")}finally{h(!1)}})()},[t]),l)?(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(y.Z,{title:n}),(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(u.Z,{variant:"text",width:"60%",height:28}),(0,r.jsx)(u.Z,{variant:"text",width:"80%"}),(0,r.jsx)(u.Z,{variant:"text",width:"70%"}),(0,r.jsxs)(a.Z,{sx:{mt:2},children:[(0,r.jsx)(u.Z,{variant:"text",width:"60%",height:28}),(0,r.jsx)(u.Z,{variant:"text",width:"75%"})]})]})]}):x?(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(y.Z,{title:n}),(0,r.jsx)(d.Z,{children:(0,r.jsx)(o.Z,{color:"text.secondary",align:"center",children:"Unable to load updates"})})]}):(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(y.Z,{title:n,action:(0,r.jsx)(z.Z,{href:"https://github.com/smallmiro/minecraft-server-manager/blob/develop/CHANGELOG.md",target:"_blank",rel:"noopener",sx:{fontSize:13,mr:1},children:"View all"})}),(0,r.jsx)(d.Z,{sx:{pt:0},children:s.map((e,t)=>{let n=e.items.filter(e=>"added"===e.type),i=e.items.filter(e=>"fixed"===e.type),l=e.items.filter(e=>"changed"===e.type);return(0,r.jsxs)(a.Z,{sx:{mb:t<s.length-1?2.5:0,pb:t<s.length-1?2:0,borderBottom:t<s.length-1?"1px solid":"none",borderColor:"divider"},children:[(0,r.jsxs)(o.Z,{variant:"subtitle2",sx:{fontWeight:600,color:"primary.main",mb:1},children:["[",e.version,"] - ",e.date]}),n.length>0&&(0,r.jsxs)(a.Z,{sx:{mb:1},children:[(0,r.jsx)(b.Z,{label:"Added",size:"small",sx:{bgcolor:"success.main",color:"success.contrastText",fontSize:11,height:20,mb:.5}}),n.map((e,t)=>(0,r.jsxs)(o.Z,{variant:"body2",sx:{color:"text.secondary",pl:1},children:["• ",e.message]},t))]}),i.length>0&&(0,r.jsxs)(a.Z,{sx:{mb:1},children:[(0,r.jsx)(b.Z,{label:"Fixed",size:"small",sx:{bgcolor:"warning.main",color:"warning.contrastText",fontSize:11,height:20,mb:.5}}),i.map((e,t)=>(0,r.jsxs)(o.Z,{variant:"body2",sx:{color:"text.secondary",pl:1},children:["• ",e.message]},t))]}),l.length>0&&(0,r.jsxs)(a.Z,{children:[(0,r.jsx)(b.Z,{label:"Changed",size:"small",sx:{bgcolor:"info.main",color:"info.contrastText",fontSize:11,height:20,mb:.5}}),l.map((e,t)=>(0,r.jsxs)(o.Z,{variant:"body2",sx:{color:"text.secondary",pl:1},children:["• ",e.message]},t))]})]},e.version)})})]})}var R=n(30417),E=n(90158),P=n(58347),A=n(73424),F=n(95511),N=n(26577),D=n(56813),W=n(26892),L=n(84509);function q(e){var t;let{maxItems:n=5}=e,{data:s,isLoading:i,error:l}=(0,L.oL)(n),h=null!==(t=null==s?void 0:s.logs)&&void 0!==t?t:[];return(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(y.Z,{title:"Recent Activity",action:(0,r.jsx)(R.Z,{component:w.default,href:"/audit-logs",size:"small",endIcon:(0,r.jsx)(N.Z,{}),sx:{textTransform:"none"},children:"View All"})}),(0,r.jsx)(d.Z,{sx:{pt:0},children:i?(0,r.jsx)(E.Z,{sx:{py:0},children:[...Array(n)].map((e,t)=>(0,r.jsx)(P.ZP,{sx:{px:0,py:1.5},children:(0,r.jsx)(A.Z,{primary:(0,r.jsxs)(a.Z,{sx:{display:"flex",gap:1},children:[(0,r.jsx)(u.Z,{variant:"rounded",width:60,height:24}),(0,r.jsx)(u.Z,{variant:"text",width:80}),(0,r.jsx)(u.Z,{variant:"text",width:60})]}),secondary:(0,r.jsx)(u.Z,{variant:"text",width:50})})},t))}):l?(0,r.jsx)(o.Z,{color:"text.secondary",align:"center",children:"Failed to load recent activity"}):0===h.length?(0,r.jsx)(o.Z,{color:"text.secondary",align:"center",sx:{py:2},children:"No recent activity"}):(0,r.jsx)(E.Z,{sx:{py:0},children:h.map(e=>{var t;return(0,r.jsx)(P.ZP,{sx:{px:0,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:(0,r.jsx)(A.Z,{primary:(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[(0,r.jsx)(D.I,{action:e.action,size:"small"}),(0,r.jsx)(o.Z,{variant:"body2",sx:{fontWeight:500},children:e.targetName}),(0,r.jsxs)(o.Z,{variant:"body2",color:"text.secondary",children:["by ",e.actor.replace("api:","").replace("cli:","")]}),"failure"===e.status&&(0,r.jsx)(W.c,{status:e.status,size:"small"})]}),secondary:(0,r.jsx)(F.Z,{title:(t=e.timestamp,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"}).format(new Date(t))),arrow:!0,children:(0,r.jsx)(o.Z,{variant:"caption",component:"span",color:"text.disabled",children:function(e){let t=new Date,n=new Date(e),r=Math.floor((t.getTime()-n.getTime())/6e4),s=Math.floor(r/60);return r<1?"just now":r<60?"".concat(r,"m ago"):s<24?"".concat(s,"h ago"):"".concat(Math.floor(s/24),"d ago")}(e.timestamp)})})})},e.id)})})})]})}var O=n(84974),M=n(37228);function K(){let{data:e,isLoading:t}=(0,M.UW)();if(t)return(0,r.jsx)(c.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2},children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,r.jsx)(u.Z,{variant:"circular",width:20,height:20}),(0,r.jsx)(u.Z,{variant:"text",width:120})]}),(0,r.jsx)(u.Z,{variant:"rounded",width:60,height:24})]}),(0,r.jsx)(u.Z,{variant:"text",width:"50%",height:32}),(0,r.jsx)(u.Z,{variant:"text",width:"70%"})]})});if(!(null==e?void 0:e.enabled))return(0,r.jsx)(c.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2},children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,r.jsx)(O.Z,{sx:{fontSize:20,color:"text.secondary"}}),(0,r.jsx)(o.Z,{variant:"body2",fontWeight:500,color:"text.secondary",children:"External Access"})]}),(0,r.jsx)(b.Z,{label:"Not configured",size:"small",variant:"outlined"})]}),(0,r.jsx)(o.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"playit.gg is not configured"}),(0,r.jsx)(R.Z,{component:w.default,href:"/routing",size:"small",endIcon:(0,r.jsx)(N.Z,{}),sx:{fontSize:12},children:"Manage"})]})});let n=e.agentRunning&&"running"===e.containerStatus,s=e.servers.length,i=e.servers.filter(e=>e.playitDomain).length;return(0,r.jsx)(c.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2},children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,r.jsx)(O.Z,{sx:{fontSize:20,color:"primary.main"}}),(0,r.jsx)(o.Z,{variant:"body2",fontWeight:500,children:"External Access"})]}),(0,r.jsx)(b.Z,{label:n?"Running":"Stopped",size:"small",color:n?"success":"default",variant:"outlined"})]}),(0,r.jsxs)(o.Z,{variant:"h6",sx:{mb:.5},children:[i," / ",s," servers"]}),(0,r.jsx)(o.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"With external domains"}),(0,r.jsx)(R.Z,{component:w.default,href:"/routing",size:"small",endIcon:(0,r.jsx)(N.Z,{}),sx:{fontSize:12},children:"Manage"})]})})}function U(){let{data:e,isLoading:t}=(0,g.x$)(),{data:n,isLoading:y}=(0,g.Sr)(),{statusMap:Z}=(0,v.d)(),b=t||y,w=(null==e?void 0:e.total)||0,S=(null==e?void 0:e.servers.filter(e=>{let t=Z[e.name];return"running"===((null==t?void 0:t.status)||e.status)}).length)||0,C=(null==n?void 0:n.total)||0;return b?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,i.Fq)(e.palette.secondary.main,.1)," 0%, ").concat((0,i.Fq)(e.palette.primary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,i.Fq)(e.palette.secondary.main,.2))},children:(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,r.jsx)(a.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"primary.main",color:"primary.contrastText"},children:(0,r.jsx)(h.Z,{sx:{fontSize:32}})}),(0,r.jsxs)(a.Z,{children:[(0,r.jsx)(o.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Dashboard"}),(0,r.jsx)(o.Z,{variant:"body1",color:"text.secondary",children:"Overview of your Minecraft server infrastructure"})]})]})}),(0,r.jsx)(l.ZP,{container:!0,spacing:3,sx:{mb:4},children:[0,1,2,3].map(e=>(0,r.jsx)(l.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,r.jsx)(c.Z,{sx:{height:"100%",position:"relative",overflow:"hidden","&::before":{content:'""',position:"absolute",top:0,left:0,right:0,height:"4px",background:"grey.300"}},children:(0,r.jsxs)(d.Z,{children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2},children:[(0,r.jsx)(u.Z,{variant:"text",width:"60%"}),(0,r.jsx)(u.Z,{variant:"circular",width:32,height:32})]}),(0,r.jsx)(u.Z,{variant:"text",width:"40%",height:48}),(0,r.jsx)(u.Z,{variant:"text",width:"70%"})]})})},e))}),(0,r.jsxs)(l.ZP,{container:!0,spacing:3,children:[(0,r.jsx)(l.ZP,{item:!0,xs:12,lg:7,children:(0,r.jsx)(c.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(u.Z,{variant:"text",width:"30%",height:32,sx:{mb:2}}),[0,1,2,3,4].map(e=>(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,borderBottom:"1px solid",borderColor:"divider"},children:[(0,r.jsx)(u.Z,{variant:"circular",width:10,height:10}),(0,r.jsx)(u.Z,{variant:"text",width:"25%"}),(0,r.jsx)(u.Z,{variant:"rounded",width:60,height:24,sx:{ml:"auto"}})]},e))]})})}),(0,r.jsx)(l.ZP,{item:!0,xs:12,lg:5,children:(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,r.jsx)(c.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(u.Z,{variant:"text",width:"40%",height:32,sx:{mb:2}}),[0,1,2,3].map(e=>(0,r.jsxs)(a.Z,{sx:{display:"flex",gap:1.5,py:1,borderBottom:"1px solid",borderColor:"divider"},children:[(0,r.jsx)(u.Z,{variant:"circular",width:24,height:24}),(0,r.jsxs)(a.Z,{sx:{flex:1},children:[(0,r.jsx)(u.Z,{variant:"text",width:"80%"}),(0,r.jsx)(u.Z,{variant:"text",width:"50%"})]})]},e))]})}),(0,r.jsx)(c.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(u.Z,{variant:"text",width:"35%",height:32,sx:{mb:2}}),[0,1].map(e=>(0,r.jsxs)(a.Z,{sx:{py:1,borderBottom:"1px solid",borderColor:"divider"},children:[(0,r.jsx)(u.Z,{variant:"text",width:"60%"}),(0,r.jsx)(u.Z,{variant:"text",width:"90%"})]},e))]})})]})})]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,i.Fq)(e.palette.secondary.main,.1)," 0%, ").concat((0,i.Fq)(e.palette.primary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,i.Fq)(e.palette.secondary.main,.2))},children:(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,r.jsx)(a.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"secondary.main",color:"secondary.contrastText"},children:(0,r.jsx)(h.Z,{sx:{fontSize:32}})}),(0,r.jsxs)(a.Z,{children:[(0,r.jsx)(o.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Dashboard"}),(0,r.jsx)(o.Z,{variant:"body1",color:"text.secondary",children:"Overview of your Minecraft server infrastructure"})]})]})}),(0,r.jsxs)(l.ZP,{container:!0,spacing:3,sx:{mb:4},children:[(0,r.jsx)(l.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,r.jsx)(j,{title:"Total Servers",value:w,icon:(0,r.jsx)(x.Z,{fontSize:"large"}),color:"primary",description:"All configured servers"})}),(0,r.jsx)(l.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,r.jsx)(j,{title:"Online Servers",value:S,icon:(0,r.jsx)(p.Z,{fontSize:"large"}),color:"success",description:"Currently running"})}),(0,r.jsx)(l.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,r.jsx)(j,{title:"Total Players",value:0,icon:(0,r.jsx)(m.Z,{fontSize:"large"}),color:"info",description:"Across all servers"})}),(0,r.jsx)(l.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,r.jsx)(j,{title:"Total Worlds",value:C,icon:(0,r.jsx)(f.Z,{fontSize:"large"}),color:"secondary",description:"Available worlds"})})]}),(0,r.jsxs)(l.ZP,{container:!0,spacing:3,children:[(0,r.jsx)(l.ZP,{item:!0,xs:12,lg:7,children:(0,r.jsx)(T,{servers:(null==e?void 0:e.servers)||[],statusMap:Z,isLoading:t,maxItems:5,showViewAll:!0})}),(0,r.jsx)(l.ZP,{item:!0,xs:12,lg:5,children:(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,r.jsx)(K,{}),(0,r.jsx)(q,{maxItems:5}),(0,r.jsx)(I,{maxVersions:2})]})})]})]})}},56813:function(e,t,n){"use strict";n.d(t,{I:function(){return a}});var r=n(94655),s=n(25333),i=n(82925);function a(e){let{action:t,size:n="small"}=e,a=i.Lu[t]||"default",o=i.n3[t]||t;return(0,r.jsx)(s.Z,{label:o,color:a,size:n,variant:"filled",sx:{fontWeight:600,fontSize:"small"===n?"0.7rem":"0.8rem"}})}},26892:function(e,t,n){"use strict";n.d(t,{c:function(){return o}});var r=n(94655),s=n(25333),i=n(46207),a=n(43436);function o(e){let{status:t,size:n="small"}=e;return(0,r.jsx)(s.Z,{icon:"success"===t?(0,r.jsx)(i.Z,{}):(0,r.jsx)(a.Z,{}),label:"success"===t?"OK":"Error",color:"success"===t?"success":"error",size:n,variant:"outlined",sx:{fontWeight:500,fontSize:"small"===n?"0.7rem":"0.8rem"}})}},3454:function(e,t,n){"use strict";n.d(t,{LoadingProvider:function(){return l},startLoading:function(){return c},stopLoading:function(){return d}});var r=n(94655),s=n(35106),i=n(74228),a=n(31477),o=n.n(a);function l(e){let{children:t}=e,n=(0,i.usePathname)(),a=(0,i.useSearchParams)();return(0,s.useEffect)(()=>{o().done()},[n,a]),(0,r.jsx)(r.Fragment,{children:t})}function c(){o().start()}function d(){o().done()}o().configure({showSpinner:!1,speed:300,minimum:.1})},8690:function(e,t,n){"use strict";n.d(t,{Av:function(){return r.startLoading}});var r=n(3454)},31358:function(e,t,n){"use strict";n.d(t,{x:function(){return a}});var r=n(74228),s=n(35106),i=n(8690);function a(){let e=(0,r.useRouter)(),t=(0,s.useCallback)((t,n)=>{(0,i.Av)(),e.push(t,n)},[e]),n=(0,s.useCallback)((t,n)=>{(0,i.Av)(),e.replace(t,n)},[e]);return(0,s.useMemo)(()=>({...e,push:t,replace:n}),[e,t,n])}},84509:function(e,t,n){"use strict";n.d(t,{DM:function(){return a},HZ:function(){return l},VM:function(){return o},hT:function(){return i},oL:function(){return c}});var r=n(5632),s=n(42936);function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=function(e){let t=new URLSearchParams;e.action&&t.set("action",e.action),e.actor&&t.set("actor",e.actor),e.targetType&&t.set("targetType",e.targetType),e.targetName&&t.set("targetName",e.targetName),e.status&&t.set("status",e.status),e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),void 0!==e.limit&&t.set("limit",String(e.limit)),void 0!==e.offset&&t.set("offset",String(e.offset)),e.sort&&t.set("sort",e.sort);let n=t.toString();return n?"?".concat(n):""}(e);return(0,r.a)({queryKey:["audit-logs",e],queryFn:()=>(0,s.SC)("/api/audit-logs".concat(n)),enabled:(null==t?void 0:t.enabled)!==!1})}function a(e){return(0,r.a)({queryKey:["audit-logs","stats"],queryFn:()=>(0,s.SC)("/api/audit-logs/stats"),enabled:(null==e?void 0:e.enabled)!==!1,refetchInterval:3e4})}function o(e,t){return(0,r.a)({queryKey:["audit-logs",e],queryFn:()=>(0,s.SC)("/api/audit-logs/".concat(encodeURIComponent(e))),enabled:(null==t?void 0:t.enabled)!==!1&&!!e})}function l(e,t){var n;return i({targetType:"server",targetName:e,limit:null!==(n=null==t?void 0:t.limit)&&void 0!==n?n:20},{enabled:(null==t?void 0:t.enabled)!==!1&&!!e})}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return i({limit:e,sort:"timestamp:desc"})}},37228:function(e,t,n){"use strict";n.d(t,{Bc:function(){return l},N$:function(){return c},UW:function(){return o}});var r=n(5632),s=n(58919),i=n(20367),a=n(42936);function o(){return(0,r.a)({queryKey:["playit-status"],queryFn:()=>(0,a.SC)("/api/playit/status"),refetchInterval:3e4})}function l(){let e=(0,s.NL)();return(0,i.D)({mutationFn:()=>(0,a.SC)("/api/playit/start",{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["playit-status"]})}})}function c(){let e=(0,s.NL)();return(0,i.D)({mutationFn:()=>(0,a.SC)("/api/playit/stop",{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["playit-status"]})}})}},93757:function(e,t,n){"use strict";n.d(t,{D:function(){return i}});var r=n(35106);class s{connect(e){this.options=e,this.shouldReconnect=!0,this.establishConnection()}establishConnection(){this.options&&(this.updateState("connecting"),this.eventSource&&this.eventSource.close(),this.eventSource=new EventSource(this.options.url,{withCredentials:this.options.withCredentials||!1}),this.eventSource.onopen=()=>{this.updateState("connected"),this.retryCount=0,this.lastError=null},this.eventSource.onmessage=e=>{if(!e.data.startsWith(":"))try{var t,n;let r=JSON.parse(e.data);null===(n=this.options)||void 0===n||null===(t=n.onMessage)||void 0===t||t.call(n,r)}catch(e){console.warn("Failed to parse SSE message:",e)}},this.eventSource.onerror=()=>{var e,t;let n={message:"SSE connection error",code:"CONNECTION_ERROR",retryCount:this.retryCount,timestamp:new Date};this.lastError=n,this.updateState("error"),null===(t=this.options)||void 0===t||null===(e=t.onError)||void 0===e||e.call(t,n),this.shouldReconnect&&this.scheduleReconnect()})}scheduleReconnect(){var e,t;if(!this.options)return;let n=null!==(e=this.options.maxReconnectAttempts)&&void 0!==e?e:1/0;if(this.retryCount>=n)return;this.reconnectTimer&&clearTimeout(this.reconnectTimer);let r=null!==(t=this.options.reconnectInterval)&&void 0!==t?t:3e3;this.reconnectTimer=setTimeout(()=>{this.retryCount++,this.establishConnection()},r)}disconnect(){this.shouldReconnect=!1,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.updateState("disconnected")}getState(){return this.state}isConnected(){return"connected"===this.state}getLastError(){return this.lastError}getRetryCount(){return this.retryCount}reconnect(){this.retryCount++,this.shouldReconnect=!0,this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.establishConnection()}updateState(e){var t,n;this.state=e,null===(n=this.options)||void 0===n||null===(t=n.onStateChange)||void 0===t||t.call(n,e)}constructor(){this.eventSource=null,this.state="disconnected",this.retryCount=0,this.lastError=null,this.reconnectTimer=null,this.options=null,this.shouldReconnect=!0}}function i(e){let{url:t,onMessage:n,onError:i,reconnectInterval:a=3e3,maxReconnectAttempts:o=1/0,enabled:l=!0,withCredentials:c=!1}=e,[d,u]=(0,r.useState)(null),[h,x]=(0,r.useState)("disconnected"),[p,m]=(0,r.useState)(null),[f,g]=(0,r.useState)(0),v=(0,r.useRef)(null),j=(0,r.useCallback)(e=>{u(e),null==n||n(e)},[n]),y=(0,r.useCallback)(e=>{x(e),"connected"===e&&g(0)},[]),Z=(0,r.useCallback)(e=>{m(e),"number"==typeof e.retryCount&&g(e.retryCount),null==i||i(e)},[i]),b=(0,r.useCallback)(()=>{v.current&&(v.current.reconnect(),g(v.current.getRetryCount()))},[]),w=(0,r.useCallback)(()=>{v.current&&v.current.disconnect()},[]);return(0,r.useEffect)(()=>{if(!l){v.current&&(v.current.disconnect(),v.current=null);return}return v.current||(v.current=new s),v.current.connect({url:t,onMessage:j,onStateChange:y,onError:Z,reconnectInterval:a,maxReconnectAttempts:o,withCredentials:c}),()=>{v.current&&(v.current.disconnect(),v.current=null)}},[t,l,a,o,c,j,y,Z]),{data:d,isConnected:"connected"===h,state:h,error:p,retryCount:f,reconnect:b,disconnect:w}}},59104:function(e,t,n){"use strict";n.d(t,{d:function(){return i}});var r=n(35106),s=n(93757);function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onStatusChange:t,enabled:n=!0,reconnectInterval:i=3e3}=e,[a,o]=(0,r.useState)({}),l=(0,r.useCallback)(e=>{if("server-status"===e.type){let{serverName:n,status:r,health:s,timestamp:i}=e.data;o(e=>({...e,[n]:{status:r,health:s,timestamp:i}})),null==t||t(n,r,s)}},[t]),{isConnected:c,reconnect:d,retryCount:u}=(0,s.D)({url:"/api/sse/servers-status",onMessage:l,enabled:n,reconnectInterval:i}),h=(0,r.useCallback)(e=>a[e]||null,[a]);return(0,r.useEffect)(()=>{n||o({})},[n]),{statusMap:a,getServerStatus:h,isConnected:c,reconnect:d,retryCount:u}}},82925:function(e,t,n){"use strict";n.d(t,{KK:function(){return o},Lu:function(){return r},Xn:function(){return a},n3:function(){return s},xg:function(){return i}});let r={"server.create":"success","server.delete":"error","server.start":"info","server.stop":"warning","server.restart":"secondary","player.whitelist.add":"success","player.whitelist.remove":"warning","player.ban":"error","player.unban":"success","player.op":"info","player.deop":"warning","player.kick":"error","audit.purge":"default"},s={"server.create":"Create","server.delete":"Delete","server.start":"Start","server.stop":"Stop","server.restart":"Restart","player.whitelist.add":"Whitelist Add","player.whitelist.remove":"Whitelist Remove","player.ban":"Ban","player.unban":"Unban","player.op":"Op","player.deop":"Deop","player.kick":"Kick","audit.purge":"Purge"},i=["server.create","server.delete","server.start","server.stop","server.restart","player.whitelist.add","player.whitelist.remove","player.ban","player.unban","player.op","player.deop","player.kick","audit.purge"],a=["server.create","server.delete","server.start","server.stop","server.restart"],o=["player.whitelist.add","player.whitelist.remove","player.ban","player.unban","player.op","player.deop","player.kick"]}},function(e){e.O(0,[6812,9760,6758,1668,540,4416,2538,5511,55,8347,9951,9727,2666,3669,2757,1744],function(){return e(e.s=12121)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[781],{31809:function(e,n,a){Promise.resolve().then(a.bind(a,38538))},38538:function(e,n,a){"use strict";a.r(n),a.d(n,{default:function(){return ep}});var r=a(94655),l=a(35106),t=a(7281),s=a(31317),i=a(84840),o=a(33402),c=a(60097),d=a(29793),h=a(75726),x=a(62328),u=a(7178),p=a(69899),m=a(76492),j=a(35847),y=a(628),Z=a(41565),v=a(90158),b=a(58347),g=a(73424),f=a(69783),C=a(86702),w=a(79983),k=a(30417),S=a(25333),E=a(99770),P=a(62508),F=a(5682),I=a(65087),A=a(76678),O=a(97436),W=a(93017),D=a(81071),L=a(66561),N=a(12795),z=a(96407),B=a(69366),R=a(11597),T=a(81960),U=a(30114);function M(e){let{onPlayerKicked:n}=e,[a,i]=(0,l.useState)(!0),[o,c]=(0,l.useState)(null),[d,h]=(0,l.useState)([]),[x,u]=(0,l.useState)(!1),[p,m]=(0,l.useState)(null),[j,M]=(0,l.useState)(""),[_,K]=(0,l.useState)(!1),q=(0,l.useCallback)(async()=>{i(!0),c(null);try{let e=await fetch("/api/players");if(!e.ok)throw Error("Failed to fetch players");let n=await e.json();h(n.servers)}catch(e){c("Failed to load players"),console.error("Error fetching players:",e)}finally{i(!1)}},[]);(0,l.useEffect)(()=>{q()},[q]);let J=(e,n)=>{m({player:e,server:n}),M(""),u(!0)},G=async()=>{if(p){K(!0);try{if(!(await fetch("/api/players/kick",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({player:p.player.name,server:p.server,reason:j||"Kicked by administrator"})})).ok)throw Error("Failed to kick player");u(!1),m(null),null==n||n(p.player,p.server),await q()}catch(e){console.error("Error kicking player:",e)}finally{K(!1)}}},Y=d.some(e=>e.players.length>0);return(0,r.jsx)(y.Z,{"data-testid":"player-list",children:(0,r.jsxs)(Z.Z,{children:[(0,r.jsxs)(t.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,r.jsx)(s.Z,{variant:"h6",children:"Online Players"}),(0,r.jsx)(w.Z,{onClick:q,disabled:a,"aria-label":"Refresh",children:(0,r.jsx)(B.Z,{})})]}),a&&(0,r.jsx)(t.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,r.jsx)(W.Z,{})}),o&&(0,r.jsx)(D.Z,{severity:"error",sx:{mb:2},children:o}),!a&&!o&&!Y&&(0,r.jsx)(s.Z,{color:"text.secondary",sx:{textAlign:"center",py:4},children:"No players online"}),!a&&!o&&Y&&(0,r.jsx)(t.Z,{children:d.map(e=>(0,r.jsxs)(L.Z,{defaultExpanded:e.players.length>0,children:[(0,r.jsx)(N.Z,{expandIcon:(0,r.jsx)(T.Z,{}),children:(0,r.jsxs)(t.Z,{sx:{display:"flex",alignItems:"center",gap:2,width:"100%"},children:[(0,r.jsx)(s.Z,{variant:"subtitle1",sx:{fontWeight:500},children:e.name}),(0,r.jsx)(S.Z,{label:"".concat(e.players.length," player").concat(1!==e.players.length?"s":""),size:"small",color:e.players.length>0?"success":"default"})]})}),(0,r.jsx)(z.Z,{children:0===e.players.length?(0,r.jsx)(s.Z,{color:"text.secondary",sx:{fontStyle:"italic"},children:"No players online on this server"}):(0,r.jsx)(v.Z,{dense:!0,children:e.players.map(n=>(0,r.jsxs)(b.ZP,{secondaryAction:(0,r.jsx)(w.Z,{edge:"end","aria-label":"Kick player",onClick:()=>J(n,e.name),color:"error",children:(0,r.jsx)(R.Z,{})}),children:[(0,r.jsx)(f.Z,{children:(0,r.jsx)(C.Z,{src:"https://mc-heads.net/avatar/".concat(n.uuid,"/40"),alt:n.name,children:(0,r.jsx)(U.Z,{})})}),(0,r.jsx)(g.Z,{primary:n.name,secondary:n.uuid.substring(0,8)+"..."})]},n.uuid))})})]},e.name))}),(0,r.jsxs)(E.Z,{open:x,onClose:()=>u(!1),children:[(0,r.jsx)(P.Z,{children:"Kick Player"}),(0,r.jsxs)(F.Z,{children:[(0,r.jsxs)(I.Z,{children:["Are you sure you want to kick ",null==p?void 0:p.player.name," from ",null==p?void 0:p.server,"?"]}),(0,r.jsx)(O.Z,{autoFocus:!0,margin:"dense",label:"Reason (optional)",fullWidth:!0,variant:"outlined",value:j,onChange:e=>M(e.target.value),placeholder:"Kicked by administrator"})]}),(0,r.jsxs)(A.Z,{children:[(0,r.jsx)(k.Z,{onClick:()=>u(!1),disabled:_,children:"Cancel"}),(0,r.jsx)(k.Z,{onClick:G,color:"error",variant:"contained",disabled:_,"aria-label":"Confirm kick",children:_?(0,r.jsx)(W.Z,{size:20}):"Confirm"})]})]})]})})}var _=a(70115),K=a(38393),q=a(52082),J=a(21111),G=a(47606),Y=a(42431),H=a(29114),$=a(92666);function Q(e){var n,a;let{serverName:i}=e,[o,c]=(0,l.useState)(""),[d,h]=(0,l.useState)(null),[x,u]=(0,l.useState)(!1),[p,m]=(0,l.useState)(""),[j,E]=(0,l.useState)(null),[P,F]=(0,l.useState)(""),{data:I,isLoading:A,error:L}=(0,$.ox)(i),{data:N}=(0,$.Yo)(i),z=(0,$.zF)(),B=(0,$.Ll)(),R=(0,$.S0)(),T=null!==(n=null==I?void 0:I.players)&&void 0!==n?n:[],M=null==I?void 0:I.source,Q=null!==(a=null==N?void 0:N.enabled)&&void 0!==a&&a,V=(0,l.useMemo)(()=>{if(!P.trim())return T;let e=P.toLowerCase();return T.filter(n=>n.name.toLowerCase().includes(e))},[T,P]),X=(null==L?void 0:L.message)||(B.error?"Failed to add player to whitelist":null)||(R.error&&!d?"Failed to remove player from whitelist":null)||(z.error?"Failed to update whitelist status":null),ee=()=>{o.trim()&&B.mutate({serverName:i,player:o.trim()},{onSuccess:()=>c("")})},en=e=>{h(e),R.mutate({serverName:i,player:e},{onSettled:()=>h(null)})},ea=async()=>{let e=p.split(/[,\n]/).map(e=>e.trim()).filter(Boolean);if(0===e.length)return;E(null);let n=0;for(let a of e)try{await B.mutateAsync({serverName:i,player:a}),n++}catch(e){}E("Added ".concat(n," of ").concat(e.length," players")),n>0&&m("")},er=B.isPending;return(0,r.jsx)(y.Z,{"data-testid":"whitelist-manager",children:(0,r.jsxs)(Z.Z,{children:[(0,r.jsxs)(_.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:2},children:[(0,r.jsxs)(_.Z,{direction:"row",alignItems:"center",spacing:1,children:[(0,r.jsx)(s.Z,{variant:"h6",children:"Whitelist"}),(0,r.jsx)(S.Z,{label:Q?"ON":"OFF",color:Q?"success":"default",size:"small","data-testid":"whitelist-status-chip"})]}),(0,r.jsx)(K.Z,{checked:Q,onChange:()=>{z.mutate({serverName:i,enabled:!Q})},disabled:z.isPending,inputProps:{"aria-label":"Toggle whitelist"},"data-testid":"whitelist-toggle"})]}),X&&(0,r.jsx)(D.Z,{severity:"error",sx:{mb:2},children:X}),!A&&M&&"rcon"!==M&&(0,r.jsxs)(D.Z,{severity:"info",sx:{mb:2},children:["Server is offline. Showing data from ","config"===M?"config.env":"whitelist.json",". Changes will apply on next server start."]}),(0,r.jsxs)(_.Z,{direction:"row",spacing:1,alignItems:"flex-start",sx:{mb:2},children:[x?(0,r.jsxs)(t.Z,{sx:{flex:1},children:[(0,r.jsx)(O.Z,{size:"small",placeholder:"player1, player2, player3",value:p,onChange:e=>m(e.target.value),disabled:er,fullWidth:!0,multiline:!0,rows:3,"data-testid":"bulk-input"}),j&&(0,r.jsx)(D.Z,{severity:"info",sx:{mt:1},"data-testid":"bulk-result",children:j})]}):(0,r.jsx)(O.Z,{size:"small",placeholder:"Player name",value:o,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ee()},disabled:er,fullWidth:!0}),x?(0,r.jsx)(k.Z,{variant:"contained",onClick:ea,disabled:!p.trim()||er,startIcon:er?(0,r.jsx)(W.Z,{size:16}):(0,r.jsx)(H.Z,{}),"aria-label":"Add players in bulk",children:"Add All"}):(0,r.jsx)(k.Z,{variant:"contained",onClick:ee,disabled:!o.trim()||er,startIcon:er?(0,r.jsx)(W.Z,{size:16}):(0,r.jsx)(G.Z,{}),"aria-label":"Add player to whitelist",children:"Add"}),(0,r.jsx)(k.Z,{variant:x?"contained":"outlined",onClick:()=>{u(!x),E(null)},"aria-label":"Toggle bulk mode","data-testid":"bulk-toggle",sx:{whiteSpace:"nowrap"},children:"Bulk"})]}),T.length>=5&&(0,r.jsx)(O.Z,{size:"small",placeholder:"Search players...",value:P,onChange:e=>F(e.target.value),fullWidth:!0,sx:{mb:2},InputProps:{startAdornment:(0,r.jsx)(q.Z,{position:"start",children:(0,r.jsx)(Y.Z,{})})},"data-testid":"search-input"}),A&&(0,r.jsx)(t.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,r.jsx)(W.Z,{})}),!A&&0===T.length&&(0,r.jsx)(s.Z,{color:"text.secondary",sx:{textAlign:"center",py:4},children:"No players whitelisted"}),!A&&T.length>0&&0===V.length&&(0,r.jsx)(s.Z,{color:"text.secondary",sx:{textAlign:"center",py:4},"data-testid":"no-match-message",children:"No matching players"}),!A&&V.length>0&&(0,r.jsx)(v.Z,{dense:!0,children:V.map(e=>(0,r.jsxs)(b.ZP,{secondaryAction:(0,r.jsx)(w.Z,{edge:"end","aria-label":"Remove from whitelist",onClick:()=>en(e.name),disabled:d===e.name,color:"error",children:d===e.name?(0,r.jsx)(W.Z,{size:20}):(0,r.jsx)(J.Z,{})}),children:[(0,r.jsx)(f.Z,{children:(0,r.jsx)(C.Z,{src:e.uuid?"https://mc-heads.net/avatar/".concat(e.uuid,"/40"):void 0,alt:e.name,children:(0,r.jsx)(U.Z,{})})}),(0,r.jsx)(g.Z,{primary:e.name,secondary:e.uuid?e.uuid.substring(0,8)+"...":"UUID not available"})]},e.uuid||e.name))})]})})}var V=a(35694),X=a(37809),ee=a(407),en=a(45813);let ea={1:{color:"info",label:"Moderator",icon:"\uD83D\uDEE1️"},2:{color:"success",label:"Gamemaster",icon:"\uD83C\uDFAE"},3:{color:"warning",label:"Admin",icon:"⚙️"},4:{color:"error",label:"Owner",icon:"\uD83D\uDC51"}};function er(e){let{level:n,showIcon:a=!1,compact:l=!1,size:s="medium",variant:i="filled"}=e,o=ea[n];if(!o)return null;let c=l?n.toString():"Level ".concat(n," - ").concat(o.label),d=a?(0,r.jsx)(t.Z,{component:"span",sx:{mr:.5},children:o.icon}):void 0;return(0,r.jsx)(S.Z,{label:(0,r.jsxs)(r.Fragment,{children:[d,c]}),color:o.color,size:s,variant:i})}var el=a(68038),et=a(34080),es=a(40064),ei=a(39181);let eo=[{value:1,label:"Level 1 - Moderator",description:"Bypass spawn protection",icon:"\uD83D\uDEE1️"},{value:2,label:"Level 2 - Gamemaster",description:"Cheats, command blocks",icon:"\uD83C\uDFAE"},{value:3,label:"Level 3 - Admin",description:"Player management commands",icon:"⚙️"},{value:4,label:"Level 4 - Owner",description:"Full server control",icon:"\uD83D\uDC51"}];function ec(e){let{value:n,onChange:a,label:l,disabled:i=!1}=e;return(0,r.jsxs)(d.Z,{component:"fieldset",fullWidth:!0,disabled:i,children:[l&&(0,r.jsx)(el.Z,{component:"legend",sx:{mb:1},children:l}),(0,r.jsx)(et.Z,{value:n,onChange:e=>{a(parseInt(e.target.value,10))},children:eo.map(e=>(0,r.jsx)(es.Z,{value:e.value,control:(0,r.jsx)(ei.Z,{}),label:(0,r.jsxs)(t.Z,{children:[(0,r.jsxs)(t.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,r.jsx)(s.Z,{component:"span",children:e.icon}),(0,r.jsx)(s.Z,{component:"span",fontWeight:"medium",children:e.label})]}),(0,r.jsx)(s.Z,{variant:"body2",color:"text.secondary",sx:{ml:4},children:e.description})]}),sx:{alignItems:"flex-start",py:1}},e.value))})]})}function ed(e){let{serverName:n}=e,[a,i]=(0,l.useState)(!0),[o,c]=(0,l.useState)(null),[d,h]=(0,l.useState)([]),[x,p]=(0,l.useState)(),[m,j]=(0,l.useState)(""),[S,I]=(0,l.useState)(!1),[L,N]=(0,l.useState)(null),[z,B]=(0,l.useState)(!1),[R,T]=(0,l.useState)(4),[U,M]=(0,l.useState)(!1),[_,K]=(0,l.useState)(null),[q,Y]=(0,l.useState)(4),[H,$]=(0,l.useState)(!1),[Q,ea]=(0,l.useState)(null),[el,et]=(0,l.useState)(null),es=(0,l.useCallback)(async()=>{i(!0),c(null);try{let e=await fetch("/api/players/op?server=".concat(encodeURIComponent(n)));if(!e.ok)throw Error("Failed to fetch operators");let a=await e.json();h(a.operators),p(a.source)}catch(e){c("Failed to load operators"),console.error("Error fetching operators:",e)}finally{i(!1)}},[n]);(0,l.useEffect)(()=>{es()},[es]);let ei=async()=>{if(m.trim()){I(!0),c(null);try{if(!(await fetch("/api/players/op",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({player:m.trim(),server:n,level:R})})).ok)throw Error("Failed to add operator");j(""),T(4),B(!1),await es()}catch(e){c("Failed to add operator"),console.error("Error adding operator:",e)}finally{I(!1)}}},eo=async e=>{N(e),c(null),ea(null),et(null);try{if(!(await fetch("/api/players/op?player=".concat(encodeURIComponent(e),"&server=").concat(encodeURIComponent(n)),{method:"DELETE"})).ok)throw Error("Failed to remove operator");await es()}catch(e){c("Failed to remove operator"),console.error("Error removing operator:",e)}finally{N(null)}},ed=async()=>{if(_){$(!0),c(null);try{if(!(await fetch("/api/players/op/".concat(encodeURIComponent(_.name),"?server=").concat(encodeURIComponent(n)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({level:q})})).ok)throw Error("Failed to change operator level");M(!1),K(null),await es()}catch(e){c("Failed to change operator level"),console.error("Error changing operator level:",e)}finally{$(!1)}}},eh=(e,n)=>{ea(e.currentTarget),et(n)},ex=()=>{ea(null),et(null)};return(0,r.jsxs)(y.Z,{"data-testid":"op-manager",children:[(0,r.jsxs)(Z.Z,{children:[(0,r.jsx)(s.Z,{variant:"h6",gutterBottom:!0,children:"Operators"}),o&&(0,r.jsx)(D.Z,{severity:"error",sx:{mb:2},children:o}),!a&&x&&"rcon"!==x&&(0,r.jsxs)(D.Z,{severity:"info",sx:{mb:2},children:["Server is offline. Showing data from ","config"===x?"config.env":"ops.json",". Changes will apply on next server start."]}),(0,r.jsx)(t.Z,{sx:{mb:2},children:(0,r.jsx)(k.Z,{variant:"contained",onClick:()=>B(!0),startIcon:(0,r.jsx)(G.Z,{}),"aria-label":"Add operator",fullWidth:!0,children:"Add Operator"})}),a&&(0,r.jsx)(t.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,r.jsx)(W.Z,{})}),!a&&0===d.length&&(0,r.jsx)(s.Z,{color:"text.secondary",sx:{textAlign:"center",py:4},children:"No operators configured"}),!a&&d.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(v.Z,{dense:!0,children:d.map(e=>(0,r.jsxs)(b.ZP,{secondaryAction:(0,r.jsx)(w.Z,{edge:"end","aria-label":"Operator actions",onClick:n=>eh(n,e),disabled:L===e.name,children:L===e.name?(0,r.jsx)(W.Z,{size:20}):(0,r.jsx)(X.Z,{})}),children:[(0,r.jsx)(f.Z,{children:(0,r.jsx)(C.Z,{src:e.uuid?"https://mc-heads.net/avatar/".concat(e.uuid,"/40"):void 0,alt:e.name,sx:{bgcolor:"warning.main"},children:(0,r.jsx)(ee.Z,{})})}),(0,r.jsx)(g.Z,{primary:(0,r.jsxs)(t.Z,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[(0,r.jsx)(s.Z,{component:"span",children:e.name}),(0,r.jsx)(er,{level:e.level,showIcon:!0,size:"small"})]}),secondary:e.uuid?e.uuid.substring(0,8)+"...":"UUID not available"})]},e.uuid||e.name))}),(0,r.jsxs)(V.Z,{anchorEl:Q,open:!!Q,onClose:ex,children:[(0,r.jsxs)(u.Z,{onClick:()=>{el&&(K(el),Y(el.level),M(!0),ex())},children:[(0,r.jsx)(en.Z,{sx:{mr:1},fontSize:"small"}),"Change Level"]}),(0,r.jsxs)(u.Z,{onClick:()=>el&&eo(el.name),children:[(0,r.jsx)(J.Z,{sx:{mr:1},fontSize:"small",color:"error"}),"Remove OP"]})]})]})]}),(0,r.jsxs)(E.Z,{open:z,onClose:()=>!S&&B(!1),maxWidth:"sm",fullWidth:!0,children:[(0,r.jsx)(P.Z,{children:"Add Operator"}),(0,r.jsxs)(F.Z,{children:[(0,r.jsx)(O.Z,{autoFocus:!0,margin:"dense",label:"Player Name",placeholder:"Enter player name",fullWidth:!0,value:m,onChange:e=>j(e.target.value),disabled:S,sx:{mb:2}}),(0,r.jsx)(ec,{value:R,onChange:T,label:"OP Level",disabled:S})]}),(0,r.jsxs)(A.Z,{children:[(0,r.jsx)(k.Z,{onClick:()=>B(!1),disabled:S,children:"Cancel"}),(0,r.jsx)(k.Z,{variant:"contained",onClick:ei,disabled:!m.trim()||S,startIcon:S?(0,r.jsx)(W.Z,{size:16}):void 0,children:S?"Adding...":"Add OP"})]})]}),(0,r.jsxs)(E.Z,{open:U,onClose:()=>!H&&M(!1),maxWidth:"sm",fullWidth:!0,children:[(0,r.jsxs)(P.Z,{children:["Change OP Level - ",null==_?void 0:_.name]}),(0,r.jsx)(F.Z,{children:_&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:["Current: Level ",_.level," (",_.role,")"]}),(0,r.jsx)(ec,{value:q,onChange:Y,label:"New Level",disabled:H})]})}),(0,r.jsxs)(A.Z,{children:[(0,r.jsx)(k.Z,{onClick:()=>M(!1),disabled:H,children:"Cancel"}),(0,r.jsx)(k.Z,{variant:"contained",onClick:ed,disabled:H||q===(null==_?void 0:_.level),startIcon:H?(0,r.jsx)(W.Z,{size:16}):void 0,children:H?"Saving...":"Save Changes"})]})]})]})}var eh=a(397);function ex(e){let{serverName:n}=e,[a,i]=(0,l.useState)(!0),[o,c]=(0,l.useState)(null),[d,h]=(0,l.useState)([]),[x,u]=(0,l.useState)(),[p,m]=(0,l.useState)(!1),[j,S]=(0,l.useState)({player:"",reason:""}),[I,L]=(0,l.useState)(!1),[N,z]=(0,l.useState)(null),B=(0,l.useCallback)(async()=>{i(!0),c(null);try{let e=await fetch("/api/players/ban?server=".concat(encodeURIComponent(n)));if(!e.ok)throw Error("Failed to fetch bans");let a=await e.json();h(a.players),u(a.source)}catch(e){c("Failed to load ban list"),console.error("Error fetching bans:",e)}finally{i(!1)}},[n]);(0,l.useEffect)(()=>{B()},[B]);let R=()=>{m(!1),S({player:"",reason:""})},T=async()=>{if(j.player.trim()){L(!0),c(null);try{if(!(await fetch("/api/players/ban",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({player:j.player.trim(),reason:j.reason.trim()||"Banned by administrator",server:n})})).ok)throw Error("Failed to ban player");R(),await B()}catch(e){c("Failed to ban player"),console.error("Error banning player:",e)}finally{L(!1)}}},M=async e=>{z(e),c(null);try{if(!(await fetch("/api/players/ban?player=".concat(encodeURIComponent(e),"&server=").concat(encodeURIComponent(n)),{method:"DELETE"})).ok)throw Error("Failed to unban player");await B()}catch(e){c("Failed to unban player"),console.error("Error unbanning player:",e)}finally{z(null)}},K=e=>{try{return new Date(e).toLocaleDateString()}catch(n){return e}};return(0,r.jsx)(y.Z,{"data-testid":"ban-manager",children:(0,r.jsxs)(Z.Z,{children:[(0,r.jsxs)(t.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,r.jsx)(s.Z,{variant:"h6",children:"Ban List"}),(0,r.jsx)(k.Z,{variant:"outlined",color:"error",startIcon:(0,r.jsx)(eh.Z,{}),onClick:()=>{S({player:"",reason:""}),m(!0)},"aria-label":"Ban player",children:"Ban Player"})]}),o&&(0,r.jsx)(D.Z,{severity:"error",sx:{mb:2},children:o}),!a&&x&&"rcon"!==x&&(0,r.jsxs)(D.Z,{severity:"info",sx:{mb:2},children:["Server is offline. Showing data from ","config"===x?"config.env":"banned-players.json",". Changes will apply on next server start."]}),a&&(0,r.jsx)(t.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,r.jsx)(W.Z,{})}),!a&&0===d.length&&(0,r.jsx)(s.Z,{color:"text.secondary",sx:{textAlign:"center",py:4},children:"No players banned"}),!a&&d.length>0&&(0,r.jsx)(v.Z,{dense:!0,children:d.map(e=>(0,r.jsxs)(b.ZP,{secondaryAction:(0,r.jsx)(w.Z,{edge:"end","aria-label":"Unban player",onClick:()=>M(e.name),disabled:N===e.name,color:"success",children:N===e.name?(0,r.jsx)(W.Z,{size:20}):(0,r.jsx)(J.Z,{})}),children:[(0,r.jsx)(f.Z,{children:(0,r.jsx)(C.Z,{src:e.uuid?"https://mc-heads.net/avatar/".concat(e.uuid,"/40"):void 0,alt:e.name,sx:{bgcolor:"error.main"},children:(0,r.jsx)(U.Z,{})})}),(0,r.jsx)(g.Z,{primary:e.name,secondary:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.Z,{component:"span",variant:"body2",color:"text.secondary",children:["Reason: ",e.reason||"No reason specified"]}),(0,r.jsx)("br",{}),(0,r.jsxs)(s.Z,{component:"span",variant:"caption",color:"text.secondary",children:["Banned: ",K(e.created)," by ",e.source||"Unknown"]})]})})]},e.uuid||e.name))}),(0,r.jsxs)(E.Z,{open:p,onClose:R,maxWidth:"sm",fullWidth:!0,children:[(0,r.jsx)(P.Z,{children:"Ban Player"}),(0,r.jsx)(F.Z,{children:(0,r.jsxs)(_.Z,{spacing:2,sx:{mt:1},children:[(0,r.jsx)(O.Z,{label:"Player Name",placeholder:"Enter player name",value:j.player,onChange:e=>S({...j,player:e.target.value}),fullWidth:!0,required:!0}),(0,r.jsx)(O.Z,{label:"Reason",placeholder:"Banned by administrator",value:j.reason,onChange:e=>S({...j,reason:e.target.value}),fullWidth:!0,multiline:!0,rows:2})]})}),(0,r.jsxs)(A.Z,{children:[(0,r.jsx)(k.Z,{onClick:R,disabled:I,children:"Cancel"}),(0,r.jsx)(k.Z,{onClick:T,color:"error",variant:"contained",disabled:!j.player.trim()||I,startIcon:I?(0,r.jsx)(W.Z,{size:16}):(0,r.jsx)(eh.Z,{}),children:"Ban"})]})]})]})})}function eu(e){let{children:n,value:a,index:l}=e;return(0,r.jsx)("div",{role:"tabpanel",hidden:a!==l,children:a===l&&(0,r.jsx)(t.Z,{sx:{py:3},children:n})})}function ep(){let[e,n]=(0,l.useState)(0),[a,y]=(0,l.useState)(""),{data:Z,isLoading:v}=(0,$.x$)(),b=null==Z?void 0:Z.servers;return(0,l.useEffect)(()=>{!a&&b&&b.length>0&&y(b[0].name)},[b,a]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,m.Fq)(e.palette.info.main,.1)," 0%, ").concat((0,m.Fq)(e.palette.secondary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,m.Fq)(e.palette.info.main,.2))},children:(0,r.jsxs)(t.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,r.jsx)(t.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"info.main",color:"info.contrastText"},children:(0,r.jsx)(j.Z,{sx:{fontSize:32}})}),(0,r.jsxs)(t.Z,{children:[(0,r.jsx)(s.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Player Management"}),(0,r.jsx)(s.Z,{variant:"body1",color:"text.secondary",children:"Manage players, whitelist, operators, and bans across your servers"})]})]})}),(0,r.jsx)(t.Z,{sx:{mb:3},children:(0,r.jsxs)(d.Z,{sx:{minWidth:200},children:[(0,r.jsx)(h.Z,{id:"server-select-label",children:"Server"}),(0,r.jsx)(x.Z,{labelId:"server-select-label",value:a,label:"Server",onChange:e=>y(e.target.value),disabled:v,children:null==b?void 0:b.map(e=>(0,r.jsx)(u.Z,{value:e.name,children:e.name},e.name))})]})}),(0,r.jsx)(t.Z,{sx:{borderBottom:1,borderColor:"divider"},children:(0,r.jsxs)(o.Z,{value:e,onChange:(e,a)=>{n(a)},"aria-label":"Player management tabs",children:[(0,r.jsx)(c.Z,{label:"Online Players"}),(0,r.jsx)(c.Z,{label:"Whitelist",disabled:!a}),(0,r.jsx)(c.Z,{label:"Operators",disabled:!a}),(0,r.jsx)(c.Z,{label:"Ban List",disabled:!a})]})}),(0,r.jsx)(eu,{value:e,index:0,children:(0,r.jsx)(M,{})}),(0,r.jsx)(eu,{value:e,index:1,children:a&&(0,r.jsxs)(i.ZP,{container:!0,spacing:3,children:[(0,r.jsx)(i.ZP,{item:!0,xs:12,md:8,children:(0,r.jsx)(Q,{serverName:a})}),(0,r.jsx)(i.ZP,{item:!0,xs:12,md:4,children:(0,r.jsxs)(t.Z,{sx:{p:2,bgcolor:"background.paper",borderRadius:1},children:[(0,r.jsx)(s.Z,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"About Whitelist"}),(0,r.jsx)(s.Z,{variant:"body2",color:"text.secondary",children:"The whitelist controls which players can join your server. When enabled, only players on the whitelist can connect. Add players by their Minecraft username."})]})})]})}),(0,r.jsx)(eu,{value:e,index:2,children:a&&(0,r.jsxs)(i.ZP,{container:!0,spacing:3,children:[(0,r.jsx)(i.ZP,{item:!0,xs:12,md:8,children:(0,r.jsx)(ed,{serverName:a})}),(0,r.jsx)(i.ZP,{item:!0,xs:12,md:4,children:(0,r.jsxs)(t.Z,{sx:{p:2,bgcolor:"background.paper",borderRadius:1},children:[(0,r.jsx)(s.Z,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"About Operators"}),(0,r.jsx)(s.Z,{variant:"body2",color:"text.secondary",children:"Operators (OPs) have elevated permissions on the server. They can use commands like /give, /gamemode, /tp, and more. OP levels range from 1-4, with 4 being the highest."}),(0,r.jsxs)(t.Z,{sx:{mt:2},children:[(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",component:"div",children:"Level 1: Can bypass spawn protection"}),(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",component:"div",children:"Level 2: Can use /clear, /gamemode, etc."}),(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",component:"div",children:"Level 3: Can use /ban, /kick, /op, etc."}),(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",component:"div",children:"Level 4: Can use /stop, full access"})]})]})})]})}),(0,r.jsx)(eu,{value:e,index:3,children:a&&(0,r.jsxs)(i.ZP,{container:!0,spacing:3,children:[(0,r.jsx)(i.ZP,{item:!0,xs:12,md:8,children:(0,r.jsx)(ex,{serverName:a})}),(0,r.jsx)(i.ZP,{item:!0,xs:12,md:4,children:(0,r.jsxs)(t.Z,{sx:{p:2,bgcolor:"background.paper",borderRadius:1},children:[(0,r.jsx)(s.Z,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"About Bans"}),(0,r.jsx)(s.Z,{variant:"body2",color:"text.secondary",children:"Banned players cannot connect to your server. You can ban players by username and provide an optional reason. Bans can be removed (pardoned) at any time."})]})})]})})]})}}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,2538,880,7727,8347,1658,5381,4474,7305,3468,2666,3669,2757,1744],function(){return e(e.s=31809)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[148],{61943:function(t,e,i){Promise.resolve().then(i.bind(i,34488))},24559:function(t,e,i){"use strict";var s=i(8091);e.Z=void 0;var r=s(i(66758)),n=i(94655);e.Z=(0,r.default)((0,n.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check")},10449:function(t,e,i){"use strict";var s=i(8091);e.Z=void 0;var r=s(i(66758)),n=i(94655);e.Z=(0,r.default)((0,n.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"}),"ContentCopy")},59602:function(t,e,i){"use strict";var s=i(8091);e.Z=void 0;var r=s(i(66758)),n=i(94655);e.Z=(0,r.default)((0,n.jsx)("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"InfoOutlined")},70603:function(t,e,i){"use strict";var s=i(8091);e.Z=void 0;var r=s(i(66758)),n=i(94655);e.Z=(0,r.default)((0,n.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1z"}),"Lock")},5501:function(t,e,i){"use strict";var s=i(8091);e.Z=void 0;var r=s(i(66758)),n=i(94655);e.Z=(0,r.default)((0,n.jsx)("path",{d:"M8 5v14l11-7z"}),"PlayArrow")},28058:function(t,e,i){"use strict";var s=i(8091);e.Z=void 0;var r=s(i(66758)),n=i(94655);e.Z=(0,r.default)((0,n.jsx)("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"}),"Visibility")},34488:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return f}});var s=i(94655),r=i(7281),n=i(84840),a=i(31317),c=i(10721),d=i(81071),x=i(628),l=i(41565),o=i(69899),h=i(76492),u=i(29983),j=i(92666),Z=i(57965);function v(t){let{rows:e}=t;return(0,s.jsx)(x.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[(0,s.jsx)(c.Z,{variant:"circular",width:24,height:24}),(0,s.jsx)(c.Z,{variant:"text",width:"50%",height:32})]}),[...Array(e)].map((t,e)=>(0,s.jsxs)(r.Z,{sx:{display:"flex",justifyContent:"space-between",py:.75},children:[(0,s.jsx)(c.Z,{variant:"text",width:"35%"}),(0,s.jsx)(c.Z,{variant:"text",width:"40%"})]},e))]})})}function m(){return(0,s.jsx)(x.Z,{sx:{height:"100%"},children:(0,s.jsxs)(l.Z,{children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[(0,s.jsx)(c.Z,{variant:"circular",width:24,height:24}),(0,s.jsx)(c.Z,{variant:"text",width:"40%",height:32}),(0,s.jsxs)(r.Z,{sx:{ml:"auto",display:"flex",gap:1},children:[(0,s.jsx)(c.Z,{variant:"rounded",width:70,height:24}),(0,s.jsx)(c.Z,{variant:"rounded",width:70,height:24})]})]}),(0,s.jsx)(c.Z,{variant:"text",width:"30%",sx:{mt:3,mb:1}}),[0,1].map(t=>(0,s.jsxs)(r.Z,{sx:{border:1,borderColor:"divider",p:2,"&:not(:last-child)":{borderBottom:0}},children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.5},children:[(0,s.jsx)(c.Z,{variant:"circular",width:10,height:10}),(0,s.jsx)(c.Z,{variant:"text",width:"25%"}),(0,s.jsx)(c.Z,{variant:"text",width:"15%"}),(0,s.jsx)(c.Z,{variant:"text",width:"10%",sx:{ml:"auto"}})]}),[0,1,2].map(t=>(0,s.jsx)(c.Z,{variant:"text",width:"70%",sx:{ml:2.5}},t))]},t))]})})}function f(){let{data:t,isLoading:e,error:i}=(0,j.nv)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.Z,{elevation:0,sx:{mb:4,p:3,background:t=>"linear-gradient(135deg, ".concat((0,h.Fq)(t.palette.warning.main,.1)," 0%, ").concat((0,h.Fq)(t.palette.info.main,.1)," 100%)"),borderRadius:2,border:t=>"1px solid ".concat((0,h.Fq)(t.palette.warning.main,.2))},children:(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,s.jsx)(r.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"warning.main",color:"warning.contrastText"},children:(0,s.jsx)(u.Z,{sx:{fontSize:32}})}),(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(a.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Routing"}),(0,s.jsx)(a.Z,{variant:"body1",color:"text.secondary",children:"Server routing and network configuration"})]})]})}),i&&(0,s.jsxs)(d.Z,{severity:"error",sx:{mb:3},children:["Failed to load router status: ",i.message]}),e?(0,s.jsxs)(n.ZP,{container:!0,spacing:3,children:[(0,s.jsx)(n.ZP,{item:!0,xs:12,md:4,children:(0,s.jsxs)(r.Z,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,s.jsx)(v,{rows:4}),(0,s.jsx)(v,{rows:4}),(0,s.jsx)(v,{rows:1})]})}),(0,s.jsx)(n.ZP,{item:!0,xs:12,md:8,children:(0,s.jsx)(m,{})})]}):(null==t?void 0:t.router)?(0,s.jsxs)(n.ZP,{container:!0,spacing:3,children:[(0,s.jsx)(n.ZP,{item:!0,xs:12,md:4,children:(0,s.jsxs)(r.Z,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,s.jsx)(Z.hI,{router:t.router}),(0,s.jsx)(Z.SB,{router:t.router}),(0,s.jsx)(Z.E4,{avahi:t.avahi}),(0,s.jsx)(Z.aY,{})]})}),(0,s.jsx)(n.ZP,{item:!0,xs:12,md:8,children:(0,s.jsx)(Z.Ik,{router:t.router})})]}):null]})}}},function(t){t.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,2538,5511,2542,2844,9951,5381,2666,7965,3669,2757,1744],function(){return t(t.s=61943)}),_N_E=t.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[278],{59616:function(e,r,s){Promise.resolve().then(s.bind(s,50924))},50924:function(e,r,s){"use strict";s.r(r),s.d(r,{default:function(){return eX}});var t=s(94655),n=s(35106),i=s(74228),a=s(31358),o=s(7281),l=s(30417),d=s(79983),c=s(81071),x=s(93017),u=s(10721),h=s(628),m=s(41565),p=s(31317),v=s(35694),j=s(7178),g=s(17820),Z=s(73424),y=s(99770),f=s(62508),b=s(5682),C=s(76678),w=s(97436),S=s(84840),k=s(76492),R=s(10117),z=s(5501),I=s(37809),P=s(21111),W=s(17978),F=s(89573),T=s(96292),D=s(33104),A=s(25333),M=s(52082),O=s(69123),B=s(71185),E=s(30165),N=s(97293),U=s(11259),q=s(66615),L=s(89161),H=s(34071),K=s(4405);function G(e){let{value:r,unit:s,label:n,icon:i,progress:a,progressMax:l,color:d="#1bd96a"}=e;return(0,t.jsxs)(h.Z,{"data-testid":"resource-stat-card",sx:{p:2.5,bgcolor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:3},children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:2},children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"baseline",gap:.75,flexWrap:"wrap",minWidth:0},children:[(0,t.jsx)(p.Z,{variant:"h4",component:"span",sx:{fontWeight:700,color:"text.primary",fontFamily:"'JetBrains Mono', 'Fira Code', monospace",letterSpacing:"-0.5px"},children:r}),(0,t.jsx)(p.Z,{variant:"body2",component:"span",sx:{color:"text.secondary",fontWeight:500},children:s})]}),(0,t.jsx)(o.Z,{sx:{color:"text.secondary",flexShrink:0},children:i})]}),(0,t.jsx)(p.Z,{variant:"body2",sx:{color:"text.secondary",fontWeight:500,mt:.5},children:n}),(0,t.jsx)(K.Z,{variant:"determinate",value:Math.min(a/l*100,100),sx:{mt:1,height:6,borderRadius:1.5,bgcolor:"#2a2d3a","& .MuiLinearProgress-bar":{borderRadius:1.5,background:"linear-gradient(90deg, ".concat(d," 0%, ").concat(d,"cc 100%)")}}})]})}var V=s(163),_=s(73660),J=s(90158),Q=s(58347),$=s(95511),Y=s(46725),X=s(26577),ee=s(56813),er=s(26892),es=s(84509);function et(e){var r;let{serverName:s}=e,{data:n,isLoading:i,error:a}=(0,es.HZ)(s,{limit:20});if(i)return(0,t.jsx)(o.Z,{children:[void 0,void 0,void 0,void 0,void 0].map((e,r)=>(0,t.jsxs)(o.Z,{sx:{display:"flex",gap:2,py:1.5},children:[(0,t.jsx)(u.Z,{variant:"rounded",width:60,height:24}),(0,t.jsx)(u.Z,{variant:"text",width:"60%"}),(0,t.jsx)(u.Z,{variant:"text",width:50})]},r))});if(a)return(0,t.jsxs)(c.Z,{severity:"error",children:["Failed to load activity: ",a.message]});let d=null!==(r=null==n?void 0:n.logs)&&void 0!==r?r:[];if(0===d.length)return(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{py:4,textAlign:"center"},children:"No activity recorded for this server yet."});let x="/audit-logs?targetType=server&targetName=".concat(encodeURIComponent(s));return(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(J.Z,{sx:{py:0},children:d.map(e=>{var r;return(0,t.jsx)(Q.ZP,{sx:{px:0,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:(0,t.jsx)(Z.Z,{primary:(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,t.jsx)(ee.I,{action:e.action,size:"small"}),(0,t.jsxs)(p.Z,{variant:"body2",color:"text.secondary",children:["by ",e.actor.replace("api:","").replace("cli:","")]}),(0,t.jsx)(er.c,{status:e.status,size:"small"})]}),secondary:(0,t.jsx)($.Z,{title:(r=e.timestamp,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"}).format(new Date(r))),arrow:!0,children:(0,t.jsx)(p.Z,{variant:"caption",component:"span",color:"text.disabled",children:function(e){let r=new Date,s=new Date(e),t=Math.floor((r.getTime()-s.getTime())/6e4),n=Math.floor(t/60);return t<1?"just now":t<60?"".concat(t,"m ago"):n<24?"".concat(n,"h ago"):"".concat(Math.floor(n/24),"d ago")}(e.timestamp)})})})},e.id)})}),(0,t.jsx)(o.Z,{sx:{mt:2,textAlign:"center"},children:(0,t.jsx)(l.Z,{component:Y.default,href:x,size:"small",endIcon:(0,t.jsx)(X.Z,{}),sx:{textTransform:"none"},children:"View Full History"})})]})}var en=s(62328),ei=s(29793),ea=s(75726),eo=s(40064),el=s(38393),ed=s(37530),ec=s(5942),ex=s(84420),eu=s(46121),eh=s(84775),em=s(92666),ep=s(70115),ev=s(70603),ej=s(32366),eg=s(25523);function eZ(e){let{serverName:r}=e,{data:s,isLoading:i}=(0,em.Js)(r),a=(0,em.Bx)(),[u,v]=(0,n.useState)([]),[j,g]=(0,n.useState)(!1),[Z,y]=(0,n.useState)(!1),[f,b]=(0,n.useState)(""),[C,S]=(0,n.useState)(""),[k,R]=(0,n.useState)(!1),[z,I]=(0,n.useState)({open:!1,message:"",severity:"success"});(0,n.useEffect)(()=>{(null==s?void 0:s.customHostnames)&&(v(s.customHostnames),g(!1),R(!1))},[s]);let W=e=>{let r=e.trim().toLowerCase();return r?r.length>253?"Domain exceeds 253 characters":/^[a-z0-9]([a-z0-9\-.]*[a-z0-9])?$/.test(r)?r.endsWith(".local")?"Cannot use .local system domain":r.endsWith(".nip.io")?"Cannot use .nip.io system domain":u.includes(r)?"Domain already exists":"":"Invalid domain format":"Domain cannot be empty"},F=()=>{let e=f.trim().toLowerCase(),r=W(e);if(r){S(r);return}v(r=>[...r,e]),b(""),S(""),y(!1),g(!0)},T=e=>{v(r=>r.filter(r=>r!==e)),g(!0)},D=async()=>{try{await a.mutateAsync({serverName:r,customHostnames:u}),g(!1),R(!0),I({open:!0,message:"Hostnames saved. Container recreation required to apply changes.",severity:"warning"})}catch(e){I({open:!0,message:e instanceof Error?e.message:"Failed to save hostnames",severity:"error"})}},M=()=>{y(!1),b(""),S("")};return i?(0,t.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,t.jsx)(m.Z,{children:(0,t.jsx)(o.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,t.jsx)(x.Z,{size:24})})})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1},children:[(0,t.jsx)(eg.Z,{color:"primary"}),(0,t.jsx)(p.Z,{variant:"h6",fontWeight:600,children:"Hostnames / Domains"})]}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Manage hostnames used by mc-router to route connections to this server."}),(0,t.jsx)(O.Z,{sx:{mb:3}}),(null==s?void 0:s.systemHostnames)&&s.systemHostnames.length>0&&(0,t.jsxs)(o.Z,{sx:{mb:3},children:[(0,t.jsx)(p.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1},children:"System Hostnames (read-only)"}),(0,t.jsx)(ep.Z,{direction:"row",flexWrap:"wrap",gap:1,children:s.systemHostnames.map(e=>(0,t.jsx)(A.Z,{icon:(0,t.jsx)(ev.Z,{sx:{fontSize:16}}),label:e.hostname,title:e.description,variant:"outlined",color:"default",size:"small"},e.hostname))})]}),(0,t.jsxs)(o.Z,{sx:{mb:2},children:[(0,t.jsx)(p.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1},children:"Custom Domains"}),0===u.length&&!Z&&(0,t.jsx)(p.Z,{variant:"body2",color:"text.disabled",sx:{mb:1},children:"No custom domains configured."}),(0,t.jsx)(ep.Z,{spacing:1,children:u.map(e=>(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:.5,px:1.5,borderRadius:1,bgcolor:"action.hover"},children:[(0,t.jsx)(p.Z,{variant:"body2",fontFamily:"monospace",children:e}),(0,t.jsx)(d.Z,{size:"small",color:"error",onClick:()=>T(e),title:"Remove domain",children:(0,t.jsx)(P.Z,{fontSize:"small"})})]},e))}),Z?(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"flex-start",gap:1,mt:1},children:[(0,t.jsx)(w.Z,{size:"small",placeholder:"e.g. play.example.com",value:f,onChange:e=>{b(e.target.value),S("")},onKeyDown:e=>{"Enter"===e.key&&F(),"Escape"===e.key&&M()},error:!!C,helperText:C,autoFocus:!0,sx:{flex:1}}),(0,t.jsx)(l.Z,{size:"small",variant:"contained",onClick:F,children:"Add"}),(0,t.jsx)(d.Z,{size:"small",onClick:M,children:(0,t.jsx)(B.Z,{fontSize:"small"})})]}):(0,t.jsx)(l.Z,{size:"small",startIcon:(0,t.jsx)(ej.Z,{}),onClick:()=>y(!0),sx:{mt:1},children:"Add Domain"})]}),k&&(0,t.jsxs)(c.Z,{severity:"warning",sx:{mb:2},children:["Container recreation is required for hostname changes to take effect. Run ",(0,t.jsx)("code",{children:"docker compose up -d"})," or restart the server from the dashboard."]}),(0,t.jsx)(o.Z,{sx:{display:"flex",justifyContent:"flex-end"},children:(0,t.jsx)(l.Z,{variant:"contained",size:"small",startIcon:(0,t.jsx)(ec.Z,{}),onClick:D,disabled:!j||a.isPending,children:a.isPending?"Saving...":"Save Hostnames"})})]})}),(0,t.jsx)(ed.Z,{open:z.open,autoHideDuration:6e3,onClose:()=>I({...z,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,t.jsx)(c.Z,{onClose:()=>I({...z,open:!1}),severity:z.severity,sx:{width:"100%"},children:z.message})})]})}function ey(e){var r,s;let{serverName:i,isRunning:a}=e,{data:d,isLoading:u}=(0,em.iC)(i),v=(0,em.MH)(),g=(0,em.gx)(),[Z,k]=(0,n.useState)({}),[R,z]=(0,n.useState)(!1),[I,P]=(0,n.useState)(!1),[W,F]=(0,n.useState)(!1),[T,D]=(0,n.useState)(""),[A,M]=(0,n.useState)({open:!1,message:"",severity:"info"});(0,n.useEffect)(()=>{(null==d?void 0:d.config)&&k(d.config)},[d]);let B=(e,r)=>{k(s=>({...s,[e]:r})),z(!0),("memory"===e||"useAikarFlags"===e)&&P(!0)},E=async()=>{try{let e=await v.mutateAsync({serverName:i,config:Z});M({open:!0,message:e.restartRequired?"Settings saved. Restart required for some changes to take effect.":"Settings saved successfully.",severity:e.restartRequired?"warning":"success"}),z(!1),P(!1)}catch(e){M({open:!0,message:e instanceof Error?e.message:"Failed to save settings",severity:"error"})}},N=async()=>{if("RESET"!==T){M({open:!0,message:"Please type RESET to confirm",severity:"warning"});return}try{await g.mutateAsync(i),M({open:!0,message:"World reset successfully",severity:"success"}),F(!1),D("")}catch(e){M({open:!0,message:e instanceof Error?e.message:"Failed to reset world",severity:"error"})}};return u?(0,t.jsx)(o.Z,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,t.jsx)(x.Z,{})}):(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(eZ,{serverName:i}),I&&(0,t.jsx)(c.Z,{severity:"warning",icon:(0,t.jsx)(ex.Z,{}),sx:{mb:3},children:"Performance settings require a server restart to take effect."}),(0,t.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Properties"}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"These settings can be changed without restarting the server."}),(0,t.jsx)(O.Z,{sx:{mb:3}}),(0,t.jsxs)(S.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(S.ZP,{item:!0,xs:12,children:(0,t.jsx)(w.Z,{fullWidth:!0,label:"MOTD (Message of the Day)",value:Z.motd||"",onChange:e=>B("motd",e.target.value),helperText:"The message displayed in the server list"})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(w.Z,{fullWidth:!0,type:"number",label:"Max Players",value:Z.maxPlayers||20,onChange:e=>B("maxPlayers",parseInt(e.target.value,10)),inputProps:{min:1,max:100}})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsxs)(ei.Z,{fullWidth:!0,children:[(0,t.jsx)(ea.Z,{children:"Difficulty"}),(0,t.jsxs)(en.Z,{value:Z.difficulty||"normal",label:"Difficulty",onChange:e=>B("difficulty",e.target.value),children:[(0,t.jsx)(j.Z,{value:"peaceful",children:"Peaceful"}),(0,t.jsx)(j.Z,{value:"easy",children:"Easy"}),(0,t.jsx)(j.Z,{value:"normal",children:"Normal"}),(0,t.jsx)(j.Z,{value:"hard",children:"Hard"})]})]})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsxs)(ei.Z,{fullWidth:!0,children:[(0,t.jsx)(ea.Z,{children:"Game Mode"}),(0,t.jsxs)(en.Z,{value:Z.gameMode||"survival",label:"Game Mode",onChange:e=>B("gameMode",e.target.value),children:[(0,t.jsx)(j.Z,{value:"survival",children:"Survival"}),(0,t.jsx)(j.Z,{value:"creative",children:"Creative"}),(0,t.jsx)(j.Z,{value:"adventure",children:"Adventure"}),(0,t.jsx)(j.Z,{value:"spectator",children:"Spectator"})]})]})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(eo.Z,{control:(0,t.jsx)(el.Z,{checked:null===(r=Z.pvp)||void 0===r||r,onChange:e=>B("pvp",e.target.checked)}),label:"Enable PvP"})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(w.Z,{fullWidth:!0,type:"number",label:"View Distance (chunks)",value:Z.viewDistance||10,onChange:e=>B("viewDistance",parseInt(e.target.value,10)),inputProps:{min:3,max:32}})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(w.Z,{fullWidth:!0,type:"number",label:"Spawn Protection (blocks)",value:Z.spawnProtection||16,onChange:e=>B("spawnProtection",parseInt(e.target.value,10)),inputProps:{min:0,max:128}})})]})]})}),(0,t.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Performance Settings"}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"These settings require a server restart to take effect."}),(0,t.jsx)(O.Z,{sx:{mb:3}}),(0,t.jsxs)(S.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(w.Z,{fullWidth:!0,label:"Memory Allocation",value:Z.memory||"4G",onChange:e=>B("memory",e.target.value),helperText:"Format: 4G, 8G, etc."})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(eo.Z,{control:(0,t.jsx)(el.Z,{checked:null!==(s=Z.useAikarFlags)&&void 0!==s&&s,onChange:e=>B("useAikarFlags",e.target.checked)}),label:"Use Aikar's Flags (Optimized GC)"})})]})]})}),(0,t.jsx)(o.Z,{sx:{display:"flex",justifyContent:"flex-end",mb:3},children:(0,t.jsx)(l.Z,{variant:"contained",size:"large",startIcon:(0,t.jsx)(ec.Z,{}),onClick:E,disabled:!R||v.isPending,sx:{px:4},children:v.isPending?"Saving...":"Save Changes"})}),(0,t.jsx)(h.Z,{sx:{borderRadius:3,borderColor:"error.main",borderWidth:1,borderStyle:"solid"},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,color:"error",children:"Danger Zone"}),(0,t.jsx)(O.Z,{sx:{mb:3}}),(0,t.jsxs)(o.Z,{sx:{mb:3},children:[(0,t.jsx)(p.Z,{variant:"subtitle1",fontWeight:600,gutterBottom:!0,children:"Reset World"}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"This will permanently delete the current world and generate a new one. This action cannot be undone."}),(0,t.jsx)(l.Z,{variant:"outlined",color:"error",startIcon:(0,t.jsx)(eh.Z,{}),onClick:()=>F(!0),disabled:a,children:"Reset World"}),a&&(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",sx:{ml:2},children:"Stop the server first"})]})]})}),(0,t.jsxs)(y.Z,{open:W,onClose:()=>F(!1),maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(f.Z,{children:(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,t.jsx)(ex.Z,{color:"error"}),(0,t.jsx)(p.Z,{variant:"h6",fontWeight:600,children:"Reset World"})]})}),(0,t.jsxs)(b.Z,{children:[(0,t.jsxs)(p.Z,{variant:"body1",gutterBottom:!0,children:["This will permanently delete the world for ",(0,t.jsx)("strong",{children:i})," and generate a new one."]}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",gutterBottom:!0,children:"This action cannot be undone. All player progress and builds will be lost."}),(0,t.jsx)(w.Z,{fullWidth:!0,label:"Type RESET to confirm",value:T,onChange:e=>D(e.target.value),sx:{mt:3},autoFocus:!0})]}),(0,t.jsxs)(C.Z,{children:[(0,t.jsx)(l.Z,{onClick:()=>F(!1),children:"Cancel"}),(0,t.jsx)(l.Z,{variant:"contained",color:"error",onClick:N,disabled:"RESET"!==T||g.isPending,startIcon:g.isPending?(0,t.jsx)(x.Z,{size:16}):(0,t.jsx)(eu.Z,{}),children:g.isPending?"Resetting...":"Reset World"})]})]}),(0,t.jsx)(ed.Z,{open:A.open,autoHideDuration:6e3,onClose:()=>M({...A,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,t.jsx)(c.Z,{onClose:()=>M({...A,open:!1}),severity:A.severity,sx:{width:"100%"},children:A.message})})]})}var ef=s(86702),eb=s(47606),eC=s(407),ew=s(56056),eS=s(28058),ek=s(11597),eR=s(59602);let ez={admin:{label:"Owner",color:"primary",variant:"filled"},manage:{label:"Operator",color:"info",variant:"outlined"},view:{label:"Viewer",color:"default",variant:"outlined"}};function eI(e){let{permission:r,size:s="medium"}=e,n=ez[r];return(0,t.jsx)(A.Z,{label:n.label,color:n.color,variant:n.variant,size:s})}var eP=s(99046),eW=s(68038),eF=s(34080),eT=s(39181),eD=s(5632),eA=s(58919),eM=s(20367),eO=s(42936);function eB(e){var r,s;let{open:i,onClose:a,serverId:d}=e,[u,h]=(0,n.useState)(""),[m,v]=(0,n.useState)(null),[j,g]=(0,n.useState)("view"),{data:Z,isLoading:S}=(s={enabled:i},(0,eD.a)({queryKey:["users","search",u],queryFn:()=>(0,eO.SC)("/api/users?q=".concat(encodeURIComponent(u))),enabled:(null==s?void 0:s.enabled)!==!1&&u.length>=2,staleTime:3e4})),k=function(){let e=(0,eA.NL)();return(0,eM.D)({mutationFn:e=>(0,eO.SC)("/api/user-servers",{method:"POST",body:JSON.stringify(e)}),onSuccess:(r,s)=>{e.invalidateQueries({queryKey:["user-servers",s.serverId]}),e.invalidateQueries({queryKey:["user-servers"]})}})}(),R=(0,n.useMemo)(()=>{var e;return null!==(e=null==Z?void 0:Z.users)&&void 0!==e?e:[]},[Z]),z=()=>{h(""),v(null),g("view"),k.reset(),a()};return(0,t.jsxs)(y.Z,{open:i,onClose:z,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:3}},children:[(0,t.jsx)(f.Z,{sx:{fontWeight:600},children:"Add User Access"}),(0,t.jsxs)(b.Z,{sx:{display:"flex",flexDirection:"column",gap:3,pt:"8px !important"},children:[k.isError&&(0,t.jsx)(c.Z,{severity:"error",sx:{mb:1},children:(null===(r=k.error)||void 0===r?void 0:r.message)||"Failed to grant access"}),(0,t.jsx)(eP.Z,{options:R,getOptionLabel:e=>e.name||e.email,isOptionEqualToValue:(e,r)=>e.id===r.id,value:m,onChange:(e,r)=>v(r),inputValue:u,onInputChange:(e,r)=>h(r),loading:S,filterOptions:e=>e,noOptionsText:u.length<2?"Type at least 2 characters":"No users found",renderInput:e=>(0,t.jsx)(w.Z,{...e,label:"Search User",placeholder:"Search by name or email...",InputProps:{...e.InputProps,endAdornment:(0,t.jsxs)(t.Fragment,{children:[S&&(0,t.jsx)(x.Z,{size:20}),e.InputProps.endAdornment]})}}),renderOption:(e,r)=>{var s,n,i;let{key:a,...l}=e;return(0,t.jsxs)(o.Z,{component:"li",...l,sx:{display:"flex",gap:1.5,py:1},children:[(0,t.jsx)(ef.Z,{src:null!==(i=r.image)&&void 0!==i?i:void 0,sx:{width:32,height:32,bgcolor:"primary.main",fontSize:14},children:((null===(s=r.name)||void 0===s?void 0:s[0])||(null===(n=r.email)||void 0===n?void 0:n[0])||"?").toUpperCase()}),(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,children:r.name||"Unknown"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",children:r.email})]})]},a)}}),(0,t.jsxs)(ei.Z,{children:[(0,t.jsx)(eW.Z,{sx:{fontWeight:500,mb:1},children:"Permission Level"}),(0,t.jsxs)(eF.Z,{value:j,onChange:e=>g(e.target.value),children:[(0,t.jsx)(eo.Z,{value:"view",control:(0,t.jsx)(eT.Z,{size:"small"}),label:(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,children:"Viewer"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",children:"Can view server status and logs"})]})}),(0,t.jsx)(eo.Z,{value:"manage",control:(0,t.jsx)(eT.Z,{size:"small"}),label:(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,children:"Operator"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",children:"Can start, stop, and configure the server"})]})}),(0,t.jsx)(eo.Z,{value:"admin",control:(0,t.jsx)(eT.Z,{size:"small"}),label:(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,children:"Owner"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",children:"Full control including managing other users"})]})})]})]})]}),(0,t.jsxs)(C.Z,{sx:{px:3,pb:2},children:[(0,t.jsx)(l.Z,{onClick:z,color:"inherit",children:"Cancel"}),(0,t.jsx)(l.Z,{onClick:()=>{m&&k.mutate({userId:m.id,serverId:d,permission:j},{onSuccess:z})},variant:"contained",disabled:!m||k.isPending,sx:{borderRadius:2},children:k.isPending?"Adding...":"Add User"})]})]})}function eE(e){var r,s;let{serverId:i}=e,{data:a,isLoading:x,error:y}=(0,eD.a)({queryKey:["user-servers",i],queryFn:()=>(0,eO.SC)("/api/user-servers?serverId=".concat(encodeURIComponent(i))),enabled:!!i}),f=function(){let e=(0,eA.NL)();return(0,eM.D)({mutationFn:e=>{let{id:r,permission:s}=e;return(0,eO.SC)("/api/user-servers/".concat(encodeURIComponent(r)),{method:"PATCH",body:JSON.stringify({permission:s})})},onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),b=function(){let e=(0,eA.NL)();return(0,eM.D)({mutationFn:e=>(0,eO.SC)("/api/user-servers/".concat(encodeURIComponent(e)),{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),[C,w]=(0,n.useState)(!1),[S,k]=(0,n.useState)(null),[R,z]=(0,n.useState)(null),P=(e,r)=>{k(e.currentTarget),z(r)},W=()=>{k(null),z(null)},F=e=>{if(!R||R.permission===e){W();return}f.mutate({id:R.id,permission:e},{onSettled:W})},T=null!==(r=null==a?void 0:a.users.filter(e=>"admin"===e.permission).length)&&void 0!==r?r:0,D=(null==R?void 0:R.permission)==="admin"&&T<=1;if(x)return(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(u.Z,{variant:"text",width:"30%",height:32}),(0,t.jsx)(u.Z,{variant:"rounded",width:120,height:36,sx:{borderRadius:2}})]}),(0,t.jsx)(O.Z,{sx:{mb:2}}),[0,1,2].map(e=>(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,borderBottom:"1px solid",borderColor:"divider"},children:[(0,t.jsx)(u.Z,{variant:"circular",width:40,height:40}),(0,t.jsxs)(o.Z,{sx:{flex:1},children:[(0,t.jsx)(u.Z,{variant:"text",width:"40%"}),(0,t.jsx)(u.Z,{variant:"text",width:"60%"})]}),(0,t.jsx)(u.Z,{variant:"rounded",width:80,height:28,sx:{borderRadius:10}}),(0,t.jsx)(u.Z,{variant:"circular",width:32,height:32})]},e))]})});if(y)return(0,t.jsxs)(c.Z,{severity:"error",children:["Failed to load access list: ",y.message]});let A=null!==(s=null==a?void 0:a.users)&&void 0!==s?s:[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(p.Z,{variant:"h6",fontWeight:600,children:"Server Access"}),(0,t.jsx)(l.Z,{variant:"contained",size:"small",startIcon:(0,t.jsx)(eb.Z,{}),onClick:()=>w(!0),sx:{borderRadius:2},children:"Add User"})]}),(0,t.jsx)(O.Z,{sx:{mb:1}}),0===A.length?(0,t.jsx)(o.Z,{sx:{py:4,textAlign:"center"},children:(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",children:"No users have been granted access to this server yet."})}):A.map(e=>{var r,s,n,i,a,l,c,x;return(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:[(0,t.jsx)(ef.Z,{src:null!==(x=null===(r=e.user)||void 0===r?void 0:r.image)&&void 0!==x?x:void 0,sx:{width:40,height:40,bgcolor:"primary.main",fontSize:16},children:((null===(n=e.user)||void 0===n?void 0:null===(s=n.name)||void 0===s?void 0:s[0])||(null===(a=e.user)||void 0===a?void 0:null===(i=a.email)||void 0===i?void 0:i[0])||"?").toUpperCase()}),(0,t.jsxs)(o.Z,{sx:{flex:1,minWidth:0},children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,noWrap:!0,children:(null===(l=e.user)||void 0===l?void 0:l.name)||"Unknown User"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",noWrap:!0,children:(null===(c=e.user)||void 0===c?void 0:c.email)||e.userId})]}),(0,t.jsx)(eI,{permission:e.permission,size:"small"}),(0,t.jsx)(d.Z,{size:"small",onClick:r=>P(r,e),sx:{color:"text.secondary"},children:(0,t.jsx)(I.Z,{fontSize:"small"})})]},e.id)}),(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:1,mt:2,pt:1},children:[(0,t.jsx)(eR.Z,{sx:{fontSize:16,color:"text.disabled"}}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.disabled",children:"Only platform admins and server owners can manage access."})]})]})}),(0,t.jsxs)(v.Z,{anchorEl:S,open:!!S,onClose:W,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,children:[(0,t.jsxs)(j.Z,{onClick:()=>F("admin"),disabled:(null==R?void 0:R.permission)==="admin",children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(eC.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Owner"})]}),(0,t.jsxs)(j.Z,{onClick:()=>F("manage"),disabled:(null==R?void 0:R.permission)==="manage"||D,children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(ew.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Operator"})]}),(0,t.jsxs)(j.Z,{onClick:()=>F("view"),disabled:(null==R?void 0:R.permission)==="view"||D,children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(eS.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Viewer"})]}),(0,t.jsx)(O.Z,{}),(0,t.jsxs)(j.Z,{onClick:()=>{R&&b.mutate(R.id,{onSettled:W})},disabled:D,sx:{color:"error.main"},children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(ek.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,t.jsx)(Z.Z,{children:"Remove Access"})]})]}),(0,t.jsx)(eB,{open:C,onClose:()=>w(!1),serverId:i})]})}var eN=s(10449),eU=s(24559),eq=s(37228);function eL(e){let{text:r}=e,[s,i]=(0,n.useState)(!1),a=async()=>{try{await navigator.clipboard.writeText(r),i(!0),setTimeout(()=>i(!1),2e3)}catch(e){console.error("Failed to copy:",e)}};return(0,t.jsx)(d.Z,{size:"small",onClick:a,sx:{ml:1,color:s?"success.main":"text.secondary","&:hover":{bgcolor:"action.hover"}},"aria-label":s?"Copied":"Copy to clipboard",children:s?(0,t.jsx)(eU.Z,{sx:{fontSize:16}}):(0,t.jsx)(eN.Z,{sx:{fontSize:16}})})}function eH(e){let{label:r,value:s,copyText:n}=e;return(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",py:1},children:[(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",children:r}),(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,t.jsx)(p.Z,{variant:"body2",sx:{fontFamily:n?"monospace":"inherit",color:n?"text.primary":"text.secondary"},children:s}),n&&(0,t.jsx)(eL,{text:n})]})]})}function eK(e){let{serverName:r,hostname:s}=e,{data:n,isLoading:i}=(0,eq.UW)();if(i)return(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(u.Z,{variant:"text",width:"40%",height:28,sx:{mb:1}}),(0,t.jsx)(u.Z,{variant:"rectangular",height:1,sx:{mb:2}}),(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(u.Z,{variant:"text",width:"30%"}),(0,t.jsx)(u.Z,{variant:"text",width:"40%"})]}),(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(u.Z,{variant:"text",width:"30%"}),(0,t.jsx)(u.Z,{variant:"text",width:"40%"})]})]})});let a=s?"".concat(s,":25565"):"Not configured",l=(null==n?void 0:n.enabled)&&n.servers.length>0,d=null==n?void 0:n.servers.find(e=>e.serverName===r),c=(null==d?void 0:d.playitDomain)||"Not configured",x=!!(null==d?void 0:d.playitDomain);return(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Connection"}),(0,t.jsx)(O.Z,{sx:{mb:2}}),(0,t.jsx)(eH,{label:"LAN Address",value:a,copyText:s?a:void 0}),l&&(0,t.jsx)(eH,{label:"External Address",value:c,copyText:x?c:void 0})]})})}let eG=["Overview","Activity","Content","Files","Backups","Access","Options"];function eV(e){return e.replace(/\x1b\[\?[\d;]*[a-zA-Z]/g,"").replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"").replace(/\x1b=/g,"").replace(/\[\?[\d;]*[a-zA-Z]/g,"").replace(/\[[0-9;]*[a-zA-Z]/g,"").replace(/\[m/g,"").replace(/>\.\.\.\.\r?/g,"").replace(/\r/g,"").trim()}function e_(e){var r,s,i,a,c;let{server:x,onSendCommand:u}=e,[v,j]=(0,n.useState)("Overview"),[g,Z]=(0,n.useState)(""),[f,C]=(0,n.useState)(!0),[R,z]=(0,n.useState)(!1),I=(0,n.useRef)(null),{logs:P,isConnected:W}=(0,V.Y)({serverName:x.name}),F=(0,n.useMemo)(()=>P.filter(e=>!e.includes("RCON Listener")&&!e.includes("RCON Client")&&!e.includes("RconClient")),[P]);(0,n.useEffect)(()=>{I.current&&f&&(I.current.scrollTop=I.current.scrollHeight)},[F,f]);let T=async()=>{g.trim()&&u&&(await u(g.trim()),Z(""))},D=null!==(a=null===(r=x.stats)||void 0===r?void 0:r.cpuPercent)&&void 0!==a?a:0;(null===(s=x.stats)||void 0===s?void 0:s.memoryUsage)&&x.stats.memoryUsage,function(e){if(!e)return;let r=e.match(/^(\d+)\s*(M|G)?$/i);if(r)parseInt(r[1],10),(r[2]||"M").toUpperCase()}(x.memory);let K=null!==(c=null===(i=x.stats)||void 0===i?void 0:i.memoryPercent)&&void 0!==c?c:0;return(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(o.Z,{sx:{display:"flex",gap:.5,mb:3},children:eG.map(e=>(0,t.jsx)(l.Z,{onClick:()=>j(e),sx:{px:2,py:1,borderRadius:5,fontSize:14,fontWeight:500,textTransform:"none",bgcolor:v===e?"primary.main":"transparent",color:v===e?"#0a0e14":"text.secondary","&:hover":{bgcolor:v===e?"primary.main":(0,k.Fq)("#1bd96a",.1)}},children:e},e))}),(0,t.jsxs)(o.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, 1fr)"},gap:2,mb:2.5},children:[(0,t.jsx)(G,{value:"".concat(D.toFixed(2),"%"),unit:"/ 100%",label:"CPU usage",icon:(0,t.jsx)(E.Z,{sx:{fontSize:28}}),progress:D,progressMax:100,color:"#1bd96a"}),(0,t.jsx)(G,{value:"".concat(K.toFixed(2),"%"),unit:"/ 100%",label:"Memory usage",icon:(0,t.jsx)(N.Z,{sx:{fontSize:28}}),progress:K,progressMax:100,color:"#1bd96a"}),(0,t.jsx)(G,{value:x.worldSize||"0 B",unit:"/ 10 GB",label:"World size",icon:(0,t.jsx)(U.Z,{sx:{fontSize:28}}),progress:function(e){if(!e)return 0;let r=e.match(/^([\d.]+)\s*(B|KB|MB|MiB|GB|GiB)?$/i);if(!r)return 0;let s=parseFloat(r[1]);switch((r[2]||"B").toUpperCase()){case"GB":case"GIB":return 1024*s;case"MB":case"MIB":return s;case"KB":return s/1024;default:return s/1048576}}(x.worldSize),progressMax:10240,color:"#1bd96a"})]}),(0,t.jsxs)(h.Z,{sx:{bgcolor:"background.paper",borderRadius:3,border:"1px solid",borderColor:"divider",overflow:"hidden"},children:[(0,t.jsxs)(o.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,t.jsx)(p.Z,{variant:"h6",sx:{fontWeight:700,color:"text.primary"},children:"Console"}),(0,t.jsx)(o.Z,{sx:{width:10,height:10,borderRadius:"50%",bgcolor:W?"primary.main":"error.main",boxShadow:W?"0 0 8px rgba(27, 217, 106, 0.4)":"0 0 8px rgba(239, 68, 68, 0.4)"}})]}),(0,t.jsxs)(o.Z,{sx:{position:"relative"},children:[(0,t.jsx)(o.Z,{ref:I,onScroll:()=>{if(!I.current)return;let{scrollTop:e,scrollHeight:r,clientHeight:s}=I.current;C(r-e-s<30)},sx:{height:360,overflowY:"auto",px:2.5,py:2,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace",fontSize:13,lineHeight:1.85,color:"#b4b6c4",bgcolor:"#0a0a0a",scrollbarWidth:"thin",scrollbarColor:"#3a3d4e #0a0a0a","&::-webkit-scrollbar":{width:8},"&::-webkit-scrollbar-track":{bgcolor:"#0a0a0a"},"&::-webkit-scrollbar-thumb":{bgcolor:"#3a3d4e",borderRadius:4}},children:0===F.length?(0,t.jsx)(p.Z,{sx:{color:"text.secondary",textAlign:"center",py:8},children:"Waiting for logs..."}):F.map((e,r)=>{let s=function(e){let r=eV(e).match(/\[(\d{2}:\d{2}:\d{2})\]\s*\[([^/]+)\/(\w+)\]:\s*(.+)/);return r?{time:r[1],thread:r[2],level:r[3]||"INFO",msg:r[4]}:null}(e);return s?(0,t.jsxs)(o.Z,{sx:{display:"flex",gap:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,t.jsxs)(o.Z,{component:"span",sx:{color:"#4a4d60"},children:["[",s.time,"]"]}),(0,t.jsxs)(o.Z,{component:"span",sx:{color:"#4a4d60"},children:["\xa0[",s.thread,"/",(0,t.jsx)(o.Z,{component:"span",sx:{color:"WARN"===s.level?"#e8a848":"#6b6e80"},children:s.level}),"]:\xa0"]}),(0,t.jsx)(o.Z,{component:"span",sx:{color:"WARN"===s.level?"#c4a45a":"#b4b6c4"},children:s.msg})]},r):(0,t.jsx)(o.Z,{sx:{color:"#b4b6c4"},children:eV(e)},r)})}),(0,t.jsx)(d.Z,{onClick:()=>z(!0),sx:{position:"absolute",top:12,right:12,width:36,height:36,borderRadius:2,bgcolor:"#282a3a",border:"1px solid #3a3d4e",color:"#8b8da0","&:hover":{bgcolor:"#313440"}},children:(0,t.jsx)(q.Z,{sx:{fontSize:18}})}),!f&&(0,t.jsx)(d.Z,{onClick:()=>{I.current&&I.current.scrollTo({top:I.current.scrollHeight,behavior:"smooth"})},sx:{position:"absolute",bottom:12,right:12,width:36,height:36,borderRadius:2,bgcolor:"#282a3a",border:"1px solid #3a3d4e",color:"#8b8da0","&:hover":{bgcolor:"#313440"}},children:(0,t.jsx)(L.Z,{sx:{fontSize:18}})})]}),(0,t.jsx)(o.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,t.jsx)(w.Z,{fullWidth:!0,size:"small",placeholder:"Send a command",value:g,onChange:e=>Z(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),T())},disabled:!W,InputProps:{startAdornment:(0,t.jsx)(M.Z,{position:"start",children:(0,t.jsx)(H.Z,{sx:{fontSize:16,color:"#999"}})}),sx:{bgcolor:"#13141c",borderRadius:2,fontFamily:"'JetBrains Mono', 'Fira Code', monospace",fontSize:14,"& .MuiOutlinedInput-notchedOutline":{borderColor:"#2a2d3e"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#3a3d4e"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"}}}})})]}),"Overview"===v&&(0,t.jsxs)(S.ZP,{container:!0,spacing:3,sx:{mt:1},children:[(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Information"}),(0,t.jsx)(O.Z,{sx:{mb:2}}),(0,t.jsx)(eJ,{label:"Name",value:x.name}),(0,t.jsx)(eJ,{label:"Container",value:x.container}),(0,t.jsx)(eJ,{label:"Hostname",value:x.hostname}),(0,t.jsx)(eJ,{label:"Type",value:x.type}),(0,t.jsx)(eJ,{label:"Version",value:x.version}),(0,t.jsx)(eJ,{label:"Memory",value:x.memory}),(0,t.jsx)(eJ,{label:"Uptime",value:x.uptime||function(e){if(!e||e<0)return"0s";let r=Math.floor(e/3600),s=Math.floor(e%3600/60),t=e%60;return r>0?"".concat(r,"h ").concat(s,"m"):s>0?"".concat(s,"m ").concat(t,"s"):"".concat(t,"s")}(x.uptimeSeconds)})]})})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Players"}),(0,t.jsx)(O.Z,{sx:{mb:2}}),x.players?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eJ,{label:"Online",value:"".concat(x.players.online," / ").concat(x.players.max)}),x.players.list&&x.players.list.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mt:2,mb:1},children:"Online Players"}),(0,t.jsx)(o.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:x.players.list.map(e=>(0,t.jsx)(A.Z,{label:e,size:"small"},e))})]})]}):(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",children:"Player information unavailable"})]})})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(eK,{serverName:x.name,hostname:x.hostname})})]}),"Activity"===v&&(0,t.jsx)(o.Z,{sx:{mt:3},children:(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Activity"}),(0,t.jsx)(O.Z,{sx:{mb:2}}),(0,t.jsx)(et,{serverName:x.name})]})})}),"Content"===v&&(0,t.jsx)(o.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"Content management coming soon"})}),"Files"===v&&(0,t.jsx)(o.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"File browser coming soon"})}),"Backups"===v&&(0,t.jsx)(o.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"Backup management coming soon"})}),"Access"===v&&(0,t.jsx)(o.Z,{sx:{mt:3},children:(0,t.jsx)(eE,{serverId:x.name})}),"Options"===v&&(0,t.jsx)(o.Z,{sx:{mt:3},children:(0,t.jsx)(ey,{serverName:x.name,isRunning:"running"===x.status})}),(0,t.jsxs)(y.Z,{open:R,onClose:()=>z(!1),maxWidth:"xl",fullWidth:!0,PaperProps:{sx:{height:"90vh",bgcolor:"background.paper"}},children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",p:2,borderBottom:1,borderColor:"divider"},children:[(0,t.jsxs)(p.Z,{variant:"h6",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,letterSpacing:"0.05em"},children:["Console - ",x.name]}),(0,t.jsx)(d.Z,{onClick:()=>z(!1),children:(0,t.jsx)(B.Z,{})})]}),(0,t.jsx)(b.Z,{sx:{p:0,display:"flex",flexDirection:"column"},children:(0,t.jsx)(_.K,{serverName:x.name})})]})]})}function eJ(e){let{label:r,value:s}=e;return s?(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",children:r}),(0,t.jsx)(p.Z,{variant:"body2",sx:{fontWeight:500},children:s})]}):null}var eQ=s(93757);function e$(){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]})}function eY(){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M21 2v6h-6"}),(0,t.jsx)("path",{d:"M3 12a9 9 0 0115.36-6.36L21 8"}),(0,t.jsx)("path",{d:"M3 22v-6h6"}),(0,t.jsx)("path",{d:"M21 12a9 9 0 01-15.36 6.36L3 16"})]})}function eX(){var e,r,s,A;let M=(0,i.useParams)(),O=(0,a.x)(),B=decodeURIComponent(M.name),{data:E,isLoading:N,error:U}=(0,em.Hy)(B),{status:q,health:L}=function(e){let{serverName:r,onStatusChange:s,enabled:t=!0,reconnectInterval:i=3e3}=e,[a,o]=(0,n.useState)(null),[l,d]=(0,n.useState)(null);(0,n.useEffect)(()=>{o(null),d(null)},[r]);let c=(0,n.useCallback)(e=>{if("server-status"===e.type){let r=e.data.status,t=e.data.health;o(r),d(t),null==s||s(r,t)}},[s]),{isConnected:x,reconnect:u,retryCount:h}=(0,eQ.D)({url:"/api/sse/servers/".concat(encodeURIComponent(r),"/status"),onMessage:c,enabled:t,reconnectInterval:i});return{status:a,health:l,isConnected:x,reconnect:u,retryCount:h}}({serverName:B,enabled:!!B}),[H,K]=(0,n.useState)(null),[G,V]=(0,n.useState)(!1),[_,J]=(0,n.useState)(""),Q=(0,em.jM)(),$=(0,em.Aw)(),Y=(0,em._I)(),X=(0,em.Hq)(),ee=async()=>{try{await Q.mutateAsync(B)}catch(e){console.error("Failed to start server:",e)}},er=async()=>{try{await $.mutateAsync(B)}catch(e){console.error("Failed to stop server:",e)}},es=async()=>{try{await Y.mutateAsync(B)}catch(e){console.error("Failed to restart server:",e)}},et=async e=>{try{await fetch("/api/servers/".concat(encodeURIComponent(B),"/exec"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})})}catch(e){console.error("Failed to send command:",e)}},en=q||(null==E?void 0:E.server.status),ei=Q.isPending||$.isPending||Y.isPending,ea=null==E?void 0:E.server;return(0,t.jsxs)(t.Fragment,{children:[U&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to load server: ",U.message]}),Q.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to start server: ",null===(e=Q.error)||void 0===e?void 0:e.message]}),$.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to stop server: ",null===(r=$.error)||void 0===r?void 0:r.message]}),Y.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to restart server: ",null===(s=Y.error)||void 0===s?void 0:s.message]}),X.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to delete server: ",null===(A=X.error)||void 0===A?void 0:A.message]}),N?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,t.jsx)(u.Z,{variant:"rounded",width:64,height:64,sx:{borderRadius:3,flexShrink:0}}),(0,t.jsxs)(o.Z,{sx:{flex:1},children:[(0,t.jsx)(u.Z,{variant:"text",width:80,height:18,sx:{mb:.5}}),(0,t.jsx)(u.Z,{variant:"text",width:"40%",height:40}),(0,t.jsxs)(o.Z,{sx:{display:"flex",gap:2,mt:.75},children:[(0,t.jsx)(u.Z,{variant:"text",width:100}),(0,t.jsx)(u.Z,{variant:"text",width:60}),(0,t.jsx)(u.Z,{variant:"text",width:140}),(0,t.jsx)(u.Z,{variant:"text",width:50})]})]}),(0,t.jsxs)(o.Z,{sx:{display:"flex",gap:1,flexShrink:0},children:[(0,t.jsx)(u.Z,{variant:"rounded",width:90,height:40,sx:{borderRadius:2}}),(0,t.jsx)(u.Z,{variant:"rounded",width:36,height:36,sx:{borderRadius:2}})]})]}),(0,t.jsx)(o.Z,{sx:{display:"flex",gap:.5,mb:3},children:[80,70,65,50,65,65].map((e,r)=>(0,t.jsx)(u.Z,{variant:"rounded",width:e,height:36,sx:{borderRadius:5}},r))}),(0,t.jsx)(o.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, 1fr)"},gap:2,mb:2.5},children:[0,1,2].map(e=>(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1.5},children:[(0,t.jsx)(u.Z,{variant:"text",width:"50%"}),(0,t.jsx)(u.Z,{variant:"circular",width:28,height:28})]}),(0,t.jsx)(u.Z,{variant:"text",width:"60%",height:36}),(0,t.jsx)(u.Z,{variant:"rounded",width:"100%",height:6,sx:{borderRadius:3,mt:1}})]})},e))}),(0,t.jsxs)(h.Z,{sx:{borderRadius:3,border:"1px solid",borderColor:"divider"},children:[(0,t.jsxs)(o.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,t.jsx)(u.Z,{variant:"text",width:80,height:28}),(0,t.jsx)(u.Z,{variant:"circular",width:10,height:10})]}),(0,t.jsx)(u.Z,{variant:"rectangular",height:360,sx:{bgcolor:"#0a0a0a"}}),(0,t.jsx)(o.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,t.jsx)(u.Z,{variant:"rounded",width:"100%",height:40,sx:{borderRadius:2}})})]}),(0,t.jsxs)(S.ZP,{container:!0,spacing:3,sx:{mt:1},children:[(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(u.Z,{variant:"text",width:"40%",height:28,sx:{mb:1}}),(0,t.jsx)(u.Z,{variant:"rectangular",height:1,sx:{mb:2}}),[0,1,2,3,4,5,6].map(e=>(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(u.Z,{variant:"text",width:"30%"}),(0,t.jsx)(u.Z,{variant:"text",width:"40%"})]},e))]})})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(u.Z,{variant:"text",width:"30%",height:28,sx:{mb:1}}),(0,t.jsx)(u.Z,{variant:"rectangular",height:1,sx:{mb:2}}),(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(u.Z,{variant:"text",width:"25%"}),(0,t.jsx)(u.Z,{variant:"text",width:"20%"})]})]})})})]})]}):ea?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,t.jsx)(o.Z,{sx:{width:64,height:64,borderRadius:3,overflow:"hidden",bgcolor:"background.paper",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"1px solid",borderColor:"divider",fontSize:36},children:function(e){if(!e)return"\uD83C\uDFAE";let r=e.toUpperCase();return["PAPER","SPIGOT","BUKKIT","PURPUR"].includes(r)?"\uD83D\uDD0C":["FORGE","NEOFORGE","FABRIC","QUILT"].includes(r)?"\uD83D\uDD27":"\uD83C\uDFAE"}(ea.type)}),(0,t.jsxs)(o.Z,{sx:{flex:1},children:[(0,t.jsxs)(p.Z,{onClick:()=>O.push("/servers"),sx:{fontSize:12,color:"primary.main",cursor:"pointer",mb:.25,display:"flex",alignItems:"center",gap:.5,"&:hover":{textDecoration:"underline"}},children:[(0,t.jsx)(R.Z,{sx:{fontSize:14}})," All servers"]}),(0,t.jsx)(p.Z,{variant:"h4",component:"h1",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,color:"text.primary",letterSpacing:"0.5px",m:0,textTransform:"uppercase"},children:B}),(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:0,mt:.75,flexWrap:"wrap",fontSize:13,color:"text.secondary"},children:[ea.version&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(W.Z,{sx:{fontSize:14}}),"Minecraft ",ea.version]}),(0,t.jsx)(o.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.type&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(F.Z,{sx:{fontSize:14}}),ea.type]}),(0,t.jsx)(o.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.hostname&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(T.Z,{sx:{fontSize:14}}),ea.hostname]}),(0,t.jsx)(o.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(D.Z,{sx:{fontSize:14}}),ea.uptime||function(e){if(!e||e<0)return"0s";let r=Math.floor(e/3600),s=Math.floor(e%3600/60),t=e%60;return r>0?"".concat(r,"h ").concat(s,"m"):s>0?"".concat(s,"m ").concat(t,"s"):"".concat(t,"s")}(ea.uptimeSeconds)||"0s"]})]})]}),(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:1.25,flexShrink:0},children:[("stopped"===en||"exited"===en||"not_created"===en)&&(0,t.jsx)(l.Z,{variant:"contained",color:"success",startIcon:ei?(0,t.jsx)(x.Z,{size:16,color:"inherit"}):(0,t.jsx)(z.Z,{}),onClick:ee,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:600},children:"Start"}),"running"===en&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.Z,{variant:"outlined",startIcon:ei?(0,t.jsx)(x.Z,{size:16}):(0,t.jsx)(e$,{}),onClick:er,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:500,borderColor:"divider",color:"text.secondary","&:hover":{borderColor:"text.secondary",bgcolor:(0,k.Fq)("#fff",.05)}},children:"Stop"}),(0,t.jsx)(l.Z,{variant:"contained",startIcon:ei?(0,t.jsx)(x.Z,{size:16,color:"inherit"}):(0,t.jsx)(eY,{}),onClick:es,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:600,bgcolor:"primary.main",color:"#0a0e14","&:hover":{bgcolor:"primary.dark"}},children:"Restart"})]}),(0,t.jsx)(d.Z,{onClick:e=>K(e.currentTarget),sx:{width:36,height:36,borderRadius:2,border:"1px solid",borderColor:"divider",color:"text.secondary"},children:(0,t.jsx)(I.Z,{sx:{fontSize:18}})}),(0,t.jsx)(v.Z,{anchorEl:H,open:!!H,onClose:()=>K(null),children:(0,t.jsxs)(j.Z,{onClick:()=>{K(null),V(!0),J("")},sx:{color:"error.main"},children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(P.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,t.jsx)(Z.Z,{children:"Delete Server"})]})})]})]}),(0,t.jsx)(e_,{server:ea,onSendCommand:et})]}):(0,t.jsx)(c.Z,{severity:"warning",children:"Server not found"}),(0,t.jsxs)(y.Z,{open:G,onClose:()=>{V(!1),J("")},maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(f.Z,{children:"Delete Server"}),(0,t.jsxs)(b.Z,{children:[(0,t.jsxs)(p.Z,{sx:{mb:2},children:["This action cannot be undone. Type ",(0,t.jsx)("strong",{children:B})," to confirm deletion."]}),(0,t.jsx)(w.Z,{label:"Server name",value:_,onChange:e=>J(e.target.value),fullWidth:!0,autoFocus:!0})]}),(0,t.jsxs)(C.Z,{sx:{px:3,pb:2},children:[(0,t.jsx)(l.Z,{onClick:()=>{V(!1),J("")},children:"Cancel"}),(0,t.jsx)(l.Z,{variant:"contained",color:"error",onClick:()=>{_===B&&X.mutate({name:B,force:!0},{onSuccess:()=>{O.push("/servers")}})},disabled:_!==B||X.isPending,startIcon:X.isPending?(0,t.jsx)(x.Z,{size:16}):null,children:X.isPending?"Deleting...":"Delete"})]})]})]})}},56813:function(e,r,s){"use strict";s.d(r,{I:function(){return a}});var t=s(94655),n=s(25333),i=s(82925);function a(e){let{action:r,size:s="small"}=e,a=i.Lu[r]||"default",o=i.n3[r]||r;return(0,t.jsx)(n.Z,{label:o,color:a,size:s,variant:"filled",sx:{fontWeight:600,fontSize:"small"===s?"0.7rem":"0.8rem"}})}},26892:function(e,r,s){"use strict";s.d(r,{c:function(){return o}});var t=s(94655),n=s(25333),i=s(46207),a=s(43436);function o(e){let{status:r,size:s="small"}=e;return(0,t.jsx)(n.Z,{icon:"success"===r?(0,t.jsx)(i.Z,{}):(0,t.jsx)(a.Z,{}),label:"success"===r?"OK":"Error",color:"success"===r?"success":"error",size:s,variant:"outlined",sx:{fontWeight:500,fontSize:"small"===s?"0.7rem":"0.8rem"}})}},84509:function(e,r,s){"use strict";s.d(r,{DM:function(){return a},HZ:function(){return l},VM:function(){return o},hT:function(){return i},oL:function(){return d}});var t=s(5632),n=s(42936);function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,s=function(e){let r=new URLSearchParams;e.action&&r.set("action",e.action),e.actor&&r.set("actor",e.actor),e.targetType&&r.set("targetType",e.targetType),e.targetName&&r.set("targetName",e.targetName),e.status&&r.set("status",e.status),e.from&&r.set("from",e.from),e.to&&r.set("to",e.to),void 0!==e.limit&&r.set("limit",String(e.limit)),void 0!==e.offset&&r.set("offset",String(e.offset)),e.sort&&r.set("sort",e.sort);let s=r.toString();return s?"?".concat(s):""}(e);return(0,t.a)({queryKey:["audit-logs",e],queryFn:()=>(0,n.SC)("/api/audit-logs".concat(s)),enabled:(null==r?void 0:r.enabled)!==!1})}function a(e){return(0,t.a)({queryKey:["audit-logs","stats"],queryFn:()=>(0,n.SC)("/api/audit-logs/stats"),enabled:(null==e?void 0:e.enabled)!==!1,refetchInterval:3e4})}function o(e,r){return(0,t.a)({queryKey:["audit-logs",e],queryFn:()=>(0,n.SC)("/api/audit-logs/".concat(encodeURIComponent(e))),enabled:(null==r?void 0:r.enabled)!==!1&&!!e})}function l(e,r){var s;return i({targetType:"server",targetName:e,limit:null!==(s=null==r?void 0:r.limit)&&void 0!==s?s:20},{enabled:(null==r?void 0:r.enabled)!==!1&&!!e})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return i({limit:e,sort:"timestamp:desc"})}},37228:function(e,r,s){"use strict";s.d(r,{Bc:function(){return l},N$:function(){return d},UW:function(){return o}});var t=s(5632),n=s(58919),i=s(20367),a=s(42936);function o(){return(0,t.a)({queryKey:["playit-status"],queryFn:()=>(0,a.SC)("/api/playit/status"),refetchInterval:3e4})}function l(){let e=(0,n.NL)();return(0,i.D)({mutationFn:()=>(0,a.SC)("/api/playit/start",{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["playit-status"]})}})}function d(){let e=(0,n.NL)();return(0,i.D)({mutationFn:()=>(0,a.SC)("/api/playit/stop",{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["playit-status"]})}})}},82925:function(e,r,s){"use strict";s.d(r,{KK:function(){return o},Lu:function(){return t},Xn:function(){return a},n3:function(){return n},xg:function(){return i}});let t={"server.create":"success","server.delete":"error","server.start":"info","server.stop":"warning","server.restart":"secondary","player.whitelist.add":"success","player.whitelist.remove":"warning","player.ban":"error","player.unban":"success","player.op":"info","player.deop":"warning","player.kick":"error","audit.purge":"default"},n={"server.create":"Create","server.delete":"Delete","server.start":"Start","server.stop":"Stop","server.restart":"Restart","player.whitelist.add":"Whitelist Add","player.whitelist.remove":"Whitelist Remove","player.ban":"Ban","player.unban":"Unban","player.op":"Op","player.deop":"Deop","player.kick":"Kick","audit.purge":"Purge"},i=["server.create","server.delete","server.start","server.stop","server.restart","player.whitelist.add","player.whitelist.remove","player.ban","player.unban","player.op","player.deop","player.kick","audit.purge"],a=["server.create","server.delete","server.start","server.stop","server.restart"],o=["player.whitelist.add","player.whitelist.remove","player.ban","player.unban","player.op","player.deop","player.kick"]}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,2538,5511,880,55,7727,8347,1658,9951,6727,6645,7305,4596,9186,2666,5787,3669,2757,1744],function(){return e(e.s=59616)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[224],{49726:function(e,t,r){Promise.resolve().then(r.bind(r,7854))},7854:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return en}});var n=r(94655),s=r(35106),o=r(31358),i=r(7281),a=r(30417),l=r(81071),c=r(93017),d=r(69899),u=r(31317),h=r(76492),x=r(32366),m=r(78067),p=r(84840),f=r(97436),v=r(52082),g=r(89923),j=r(10297),y=r(42431),S=r(628),b=r(41565),Z=r(25935),C=r(79983),k=r(25333),w=r(95511),T=r(5501),E=r(93315),R=r(27171),I=r(96292);let P=e=>{switch(e){case"running":return"success";case"stopped":case"exited":case"not_created":return"error";case"created":return"warning";default:return"default"}},M=e=>{switch(e){case"running":return"Running";case"stopped":case"exited":return"Stopped";case"not_created":return"Not Created";case"created":return"Created";default:return e||"Unknown"}},O=e=>{if(!e)return"-";let t=e.split(",").map(e=>e.trim());return t.find(e=>e.endsWith(".local"))||t[0]||"-"};function F(e){var t;let{server:r,statusOverride:s,onClick:o,onStart:a,onStop:l,loading:c=!1}=e,d=(null==s?void 0:s.status)||r.status,h=(e,t)=>{e.stopPropagation(),t(r.name)},x="running"===d,m="stopped"===d||"exited"===d||"not_created"===d,p=O(r.hostname),f=(null===(t=r.hostname)||void 0===t?void 0:t.split(",").map(e=>e.trim()))||[];return(0,n.jsxs)(S.Z,{role:"article",onClick:()=>{o&&o(r.name)},sx:{cursor:o?"pointer":"default",transition:"all 0.2s",height:180,display:"flex",flexDirection:"column","&:hover":o?{transform:"translateY(-2px)",boxShadow:4}:{}},children:[(0,n.jsxs)(b.Z,{sx:{flex:1,pb:1},children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,n.jsx)(u.Z,{variant:"h6",component:"h3",sx:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,mr:1},children:r.name}),(0,n.jsx)(k.Z,{label:M(d),size:"small",color:P(d),sx:{fontWeight:500,minWidth:70}})]}),(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.5},children:[(0,n.jsx)(I.Z,{sx:{fontSize:16,color:"text.secondary"}}),(0,n.jsx)(w.Z,{title:f.length>1?f.join("\n"):"",arrow:!0,children:(0,n.jsxs)(u.Z,{variant:"body2",color:"text.secondary",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[p,f.length>1&&" (+".concat(f.length-1,")")]})})]}),(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,n.jsx)(R.Z,{sx:{fontSize:16,color:"text.secondary"}}),(0,n.jsx)(u.Z,{variant:"body2",color:"text.secondary",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.container})]})]}),(0,n.jsxs)(Z.Z,{sx:{justifyContent:"flex-end",px:2,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:[m&&a&&(0,n.jsx)(C.Z,{"aria-label":"Start server",color:"success",onClick:e=>h(e,a),disabled:c,size:"small",children:(0,n.jsx)(T.Z,{})}),x&&l&&(0,n.jsx)(C.Z,{"aria-label":"Stop server",color:"error",onClick:e=>h(e,l),disabled:c,size:"small",children:(0,n.jsx)(E.Z,{})}),!m&&!x&&(0,n.jsx)(i.Z,{sx:{height:34}})]})]})}function L(e){let{servers:t,statusMap:r={},onServerClick:o,onStart:l,onStop:c,onCreate:d,loadingServers:h=[]}=e,[m,S]=(0,s.useState)(""),[b,Z]=(0,s.useState)("all"),C=(0,s.useMemo)(()=>t.filter(e=>{if(m&&!e.name.toLowerCase().includes(m.toLowerCase()))return!1;let t=r[e.name],n=(null==t?void 0:t.status)||e.status;return("running"!==b||"running"===n)&&("stopped"!==b||"stopped"===n||"exited"===n||"not_created"===n)}),[t,r,m,b]);return 0===t.length?(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"400px",gap:2},children:[(0,n.jsx)(u.Z,{variant:"h6",color:"text.secondary",children:"No servers found"}),d&&(0,n.jsx)(a.Z,{variant:"contained",startIcon:(0,n.jsx)(x.Z,{}),onClick:d,children:"Create Server"})]}):(0,n.jsxs)(i.Z,{children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},gap:2,mb:3,alignItems:{xs:"stretch",sm:"center"},justifyContent:"space-between"},children:[(0,n.jsxs)(j.Z,{value:b,exclusive:!0,onChange:(e,t)=>{null!==t&&Z(t)},size:"small",sx:{flexShrink:0},children:[(0,n.jsx)(g.Z,{value:"all",children:"All"}),(0,n.jsx)(g.Z,{value:"running",children:"Running"}),(0,n.jsx)(g.Z,{value:"stopped",children:"Stopped"})]}),(0,n.jsx)(f.Z,{size:"small",placeholder:"Search servers...",value:m,onChange:e=>S(e.target.value),InputProps:{startAdornment:(0,n.jsx)(v.Z,{position:"start",children:(0,n.jsx)(y.Z,{})})},sx:{flexGrow:{xs:1,sm:0},minWidth:{sm:300}}})]}),(0,n.jsxs)(u.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:[C.length," ",1===C.length?"server":"servers"]}),0===C.length?(0,n.jsx)(i.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"200px",gap:2},children:(0,n.jsx)(u.Z,{variant:"h6",color:"text.secondary",children:"No servers found"})}):(0,n.jsx)(p.ZP,{container:!0,spacing:2,children:C.map(e=>(0,n.jsx)(p.ZP,{item:!0,xs:12,sm:6,md:4,children:(0,n.jsx)(F,{server:e,statusOverride:r[e.name],onClick:o,onStart:l,onStop:c,loading:h.includes(e.name)})},e.name))})]})}var W=r(99770),A=r(62508),N=r(5682),z=r(76678),D=r(7178),_=r(40064),G=r(45547),V=r(4405),q=r(73383),U=r(82285),H=r(13609),J=r(46207),$=r(43436),B=r(87716);let Y=["VANILLA","PAPER","FABRIC","FORGE","NEOFORGE"],K=["","forge","fabric","neoforge","quilt"],Q={name:"",type:"PAPER",version:"1.21.1",memory:"4G",autoStart:!1,sudoPassword:""},X=[{key:"initializing",label:"Initializing"},{key:"creating",label:"Creating"},{key:"configuring",label:"Configuring"},{key:"starting",label:"Starting"}];function ee(e){let t,{open:r,onClose:o,onSubmit:d,loading:h=!1,status:x="idle",progress:m=0,message:p=""}=e,[v,y]=(0,s.useState)("standard"),[S,b]=(0,s.useState)(Q),[Z,C]=(0,s.useState)({}),[k,w]=(0,s.useState)(!1),T=(0,s.useRef)(null),E=(0,s.useRef)(null),R=X.findIndex(e=>e.key===x),I="idle"!==x&&"completed"!==x&&"error"!==x;(0,s.useEffect)(()=>{r||(y("standard"),b(Q),C({}),w(!1))},[r]);let P=e=>e?/^[a-z0-9-]+$/.test(e)?null:"Only lowercase letters, numbers, and hyphens are allowed":"Server name is required",M=e=>e?null:"Modpack slug is required",O=e=>t=>{let r=t.target.value;b(t=>({...t,[e]:r})),"memory"===e&&w(!0),Z[e]&&C(t=>({...t,[e]:""}))};return(0,n.jsx)(W.Z,{open:r,onClose:I?void 0:o,maxWidth:"sm",fullWidth:!0,children:(0,n.jsxs)("form",{onSubmit:e=>{e.preventDefault(),C({});let t=P(S.name);if(t){C({name:t});return}if("modpack"===v){let e=M(S.modpack||"");if(e){C({modpack:e});return}}let r={name:S.name,memory:S.memory,autoStart:S.autoStart,sudoPassword:S.sudoPassword};"standard"===v?(r.type=S.type,r.version=S.version):(r.type="MODRINTH",r.modpack=S.modpack,S.modpackVersion&&(r.modpackVersion=S.modpackVersion),S.modLoader&&(r.modLoader=S.modLoader)),d(r)},children:[(0,n.jsx)(A.Z,{children:"completed"===x?(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,n.jsx)(J.Z,{color:"success"}),"Server Created Successfully"]}):"error"===x?(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,n.jsx)($.Z,{color:"error"}),"Creation Failed"]}):"Create New Server"}),(0,n.jsx)(N.Z,{children:I||"completed"===x||"error"===x?(0,n.jsxs)(i.Z,{sx:{py:2},children:[(0,n.jsx)(q.Z,{activeStep:R,alternativeLabel:!0,sx:{mb:3},children:X.map(e=>(0,n.jsx)(U.Z,{children:(0,n.jsx)(H.Z,{children:e.label})},e.key))}),I&&(0,n.jsxs)(i.Z,{sx:{mb:3},children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",justifyContent:"space-between",mb:1},children:[(0,n.jsx)(u.Z,{variant:"body2",color:"text.secondary",children:p}),(0,n.jsxs)(u.Z,{variant:"body2",color:"text.secondary",children:[m,"%"]})]}),(0,n.jsx)(V.Z,{variant:"determinate",value:m})]}),"completed"===x&&(0,n.jsx)(u.Z,{color:"success.main",sx:{textAlign:"center"},children:p}),"error"===x&&(0,n.jsx)(u.Z,{color:"error.main",sx:{textAlign:"center"},children:p})]}):(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2,pt:1},children:[(0,n.jsx)(i.Z,{ref:E,role:"status","aria-live":"polite",sx:{position:"absolute",left:"-10000px",width:"1px",height:"1px",overflow:"hidden"}}),(0,n.jsx)(f.Z,{label:"Server Name",value:S.name,onChange:O("name"),error:!!Z.name,helperText:Z.name||"Only lowercase letters, numbers, and hyphens",fullWidth:!0,autoFocus:!0,disabled:I}),(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2},children:[(0,n.jsx)(u.Z,{variant:"subtitle2",color:"text.secondary",children:"Server Type"}),(0,n.jsxs)(j.Z,{value:v,exclusive:!0,onChange:(e,t)=>{null!==t&&(y(t),E.current&&(E.current.textContent="".concat("standard"===t?"Standard Server":"Modpack"," category selected")),k||b(e=>({...e,memory:"standard"===t?"4G":"6G"})),setTimeout(()=>{"modpack"===t&&T.current&&T.current.focus()},300))},"aria-label":"Server category",fullWidth:!0,disabled:I,children:[(0,n.jsx)(g.Z,{value:"standard","aria-label":"Standard Server",children:"Standard Server"}),(0,n.jsx)(g.Z,{value:"modpack","aria-label":"Modpack",children:"Modpack"})]}),(0,n.jsx)(B.Z,{in:"standard"===v,unmountOnExit:!0,children:(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[(0,n.jsx)(f.Z,{label:"Server Type",select:!0,value:S.type,onChange:O("type"),fullWidth:!0,disabled:I,children:Y.map(e=>(0,n.jsx)(D.Z,{value:e,children:e},e))}),(0,n.jsx)(f.Z,{label:"Minecraft Version",value:S.version,onChange:O("version"),helperText:"e.g., 1.21.1, 1.20.4, latest",fullWidth:!0,disabled:I})]})}),(0,n.jsx)(B.Z,{in:"modpack"===v,unmountOnExit:!0,children:(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[(0,n.jsx)(l.Z,{severity:"info",children:"Minecraft version is automatically determined by the modpack"}),(0,n.jsx)(f.Z,{label:"Modpack Slug",value:S.modpack||"",onChange:O("modpack"),error:!!Z.modpack,helperText:Z.modpack||"e.g., cobblemon, adrenaserver (from modrinth.com/modpacks/SLUG)",fullWidth:!0,disabled:I,inputRef:T}),(0,n.jsxs)(f.Z,{label:"Mod Loader",select:!0,value:S.modLoader||"",onChange:O("modLoader"),helperText:"Leave empty to auto-detect from modpack",fullWidth:!0,disabled:I,children:[(0,n.jsx)(D.Z,{value:"",children:"Auto-detect"}),K.filter(e=>e).map(e=>(0,n.jsx)(D.Z,{value:e,children:e},e))]}),(0,n.jsx)(f.Z,{label:"Modpack Version",value:S.modpackVersion||"",onChange:O("modpackVersion"),helperText:"Leave empty for latest",fullWidth:!0,disabled:I})]})})]}),(0,n.jsx)(f.Z,{label:"Memory",value:S.memory,onChange:O("memory"),helperText:"e.g., 4G, 8G, 16G",fullWidth:!0,disabled:I}),(0,n.jsx)(f.Z,{label:"Sudo Password",type:"password",value:S.sudoPassword||"",onChange:O("sudoPassword"),helperText:"Required for mDNS hostname registration (avahi)",fullWidth:!0,disabled:I}),(0,n.jsx)(_.Z,{control:(0,n.jsx)(G.Z,{checked:S.autoStart||!1,onChange:(t="autoStart",e=>{b(r=>({...r,[t]:e.target.checked}))}),disabled:I}),label:"Auto-start after creation"})]})}),(0,n.jsx)(z.Z,{sx:{px:3,pb:2},children:"completed"===x||"error"===x?(0,n.jsx)(a.Z,{onClick:o,variant:"contained",fullWidth:!0,children:"Close"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.Z,{onClick:o,disabled:I,children:"Cancel"}),(0,n.jsx)(a.Z,{type:"submit",variant:"contained",disabled:I,startIcon:I?(0,n.jsx)(c.Z,{size:16}):null,children:I?"Creating...":"Create"})]})})]})})}var et=r(92666),er=r(59104);function en(){var e,t;let r=(0,o.x)(),[p,f]=(0,s.useState)(!1),[v,g]=(0,s.useState)([]),{data:j,isLoading:y,error:S}=(0,et.x$)(),{statusMap:b}=(0,er.d)(),Z=(0,et.jM)(),C=(0,et.Aw)(),k=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onSuccess:t,onError:r,onProgress:n}=e,[o,i]=(0,s.useState)("idle"),[a,l]=(0,s.useState)(0),[c,d]=(0,s.useState)(""),[u,h]=(0,s.useState)(null),x=(0,s.useRef)(null),m=(0,s.useRef)(""),p=(0,s.useCallback)(()=>{i("idle"),l(0),d(""),h(null),x.current&&(x.current.close(),x.current=null)},[]),f=(0,s.useCallback)((e,t,r)=>{i(e),d(t),l(r),null==n||n(e,t,r)},[n]),v=(0,s.useCallback)(async e=>{if("idle"===o||"completed"===o||"error"===o){h(null),f("initializing","Initializing server creation...",0),m.current=e.name,x.current&&x.current.close();try{let r=await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){let e=await r.text();throw Error(e||"Server creation failed: ".concat(r.statusText))}await r.json(),f("creating","Creating server configuration...",25),await new Promise(e=>setTimeout(e,500)),f("configuring","Configuring Docker compose...",50),await new Promise(e=>setTimeout(e,500)),f("starting","Starting server container...",75),await new Promise(e=>setTimeout(e,500)),f("completed","Server created successfully!",100),null==t||t(e.name)}catch(t){let e=t instanceof Error?t.message:"Unknown error occurred";i("error"),h(e),d("Server creation failed"),null==r||r(e)}}},[o,f,t,r]);return(0,s.useEffect)(()=>()=>{x.current&&(x.current.close(),x.current=null)},[]),{status:o,progress:a,message:c,error:u,isCreating:"idle"!==o&&"completed"!==o&&"error"!==o,createServer:v,reset:p}}({onSuccess:()=>{f(!1)},onError:e=>{console.error("Failed to create server:",e)}}),w=async e=>{g(t=>[...t,e]);try{await Z.mutateAsync(e)}catch(e){console.error("Failed to start server:",e)}finally{g(t=>t.filter(t=>t!==e))}},T=async e=>{g(t=>[...t,e]);try{await C.mutateAsync(e)}catch(e){console.error("Failed to stop server:",e)}finally{g(t=>t.filter(t=>t!==e))}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(d.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,h.Fq)(e.palette.info.main,.1)," 0%, ").concat((0,h.Fq)(e.palette.primary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,h.Fq)(e.palette.info.main,.2)),display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,n.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"info.main",color:"info.contrastText"},children:(0,n.jsx)(m.Z,{sx:{fontSize:32}})}),(0,n.jsxs)(i.Z,{children:[(0,n.jsx)(u.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Servers"}),(0,n.jsx)(u.Z,{variant:"body1",color:"text.secondary",children:"Manage your Minecraft servers"})]})]}),(0,n.jsx)(a.Z,{variant:"contained",startIcon:(0,n.jsx)(x.Z,{}),onClick:()=>f(!0),size:"large",children:"Create Server"})]}),S&&(0,n.jsxs)(l.Z,{severity:"error",sx:{mb:3},children:["Failed to load servers: ",S.message]}),k.error&&(0,n.jsxs)(l.Z,{severity:"error",sx:{mb:3},children:["Failed to create server: ",k.error]}),Z.isError&&(0,n.jsxs)(l.Z,{severity:"error",sx:{mb:3},children:["Failed to start server: ",null===(e=Z.error)||void 0===e?void 0:e.message]}),C.isError&&(0,n.jsxs)(l.Z,{severity:"error",sx:{mb:3},children:["Failed to stop server: ",null===(t=C.error)||void 0===t?void 0:t.message]}),y?(0,n.jsx)(i.Z,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,n.jsx)(c.Z,{})}):(0,n.jsx)(L,{servers:(null==j?void 0:j.servers)||[],statusMap:b,onServerClick:e=>{r.push("/servers/".concat(encodeURIComponent(e)))},onStart:w,onStop:T,onCreate:()=>f(!0),loadingServers:v}),(0,n.jsx)(ee,{open:p,onClose:()=>{f(!1),k.reset()},onSubmit:e=>{k.createServer(e)},loading:k.isCreating,status:k.status,progress:k.progress,message:k.message})]})}},3454:function(e,t,r){"use strict";r.d(t,{LoadingProvider:function(){return l},startLoading:function(){return c},stopLoading:function(){return d}});var n=r(94655),s=r(35106),o=r(74228),i=r(31477),a=r.n(i);function l(e){let{children:t}=e,r=(0,o.usePathname)(),i=(0,o.useSearchParams)();return(0,s.useEffect)(()=>{a().done()},[r,i]),(0,n.jsx)(n.Fragment,{children:t})}function c(){a().start()}function d(){a().done()}a().configure({showSpinner:!1,speed:300,minimum:.1})},8690:function(e,t,r){"use strict";r.d(t,{Av:function(){return n.startLoading}});var n=r(3454)},31358:function(e,t,r){"use strict";r.d(t,{x:function(){return i}});var n=r(74228),s=r(35106),o=r(8690);function i(){let e=(0,n.useRouter)(),t=(0,s.useCallback)((t,r)=>{(0,o.Av)(),e.push(t,r)},[e]),r=(0,s.useCallback)((t,r)=>{(0,o.Av)(),e.replace(t,r)},[e]);return(0,s.useMemo)(()=>({...e,push:t,replace:r}),[e,t,r])}},93757:function(e,t,r){"use strict";r.d(t,{D:function(){return o}});var n=r(35106);class s{connect(e){this.options=e,this.shouldReconnect=!0,this.establishConnection()}establishConnection(){this.options&&(this.updateState("connecting"),this.eventSource&&this.eventSource.close(),this.eventSource=new EventSource(this.options.url,{withCredentials:this.options.withCredentials||!1}),this.eventSource.onopen=()=>{this.updateState("connected"),this.retryCount=0,this.lastError=null},this.eventSource.onmessage=e=>{if(!e.data.startsWith(":"))try{var t,r;let n=JSON.parse(e.data);null===(r=this.options)||void 0===r||null===(t=r.onMessage)||void 0===t||t.call(r,n)}catch(e){console.warn("Failed to parse SSE message:",e)}},this.eventSource.onerror=()=>{var e,t;let r={message:"SSE connection error",code:"CONNECTION_ERROR",retryCount:this.retryCount,timestamp:new Date};this.lastError=r,this.updateState("error"),null===(t=this.options)||void 0===t||null===(e=t.onError)||void 0===e||e.call(t,r),this.shouldReconnect&&this.scheduleReconnect()})}scheduleReconnect(){var e,t;if(!this.options)return;let r=null!==(e=this.options.maxReconnectAttempts)&&void 0!==e?e:1/0;if(this.retryCount>=r)return;this.reconnectTimer&&clearTimeout(this.reconnectTimer);let n=null!==(t=this.options.reconnectInterval)&&void 0!==t?t:3e3;this.reconnectTimer=setTimeout(()=>{this.retryCount++,this.establishConnection()},n)}disconnect(){this.shouldReconnect=!1,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.updateState("disconnected")}getState(){return this.state}isConnected(){return"connected"===this.state}getLastError(){return this.lastError}getRetryCount(){return this.retryCount}reconnect(){this.retryCount++,this.shouldReconnect=!0,this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.establishConnection()}updateState(e){var t,r;this.state=e,null===(r=this.options)||void 0===r||null===(t=r.onStateChange)||void 0===t||t.call(r,e)}constructor(){this.eventSource=null,this.state="disconnected",this.retryCount=0,this.lastError=null,this.reconnectTimer=null,this.options=null,this.shouldReconnect=!0}}function o(e){let{url:t,onMessage:r,onError:o,reconnectInterval:i=3e3,maxReconnectAttempts:a=1/0,enabled:l=!0,withCredentials:c=!1}=e,[d,u]=(0,n.useState)(null),[h,x]=(0,n.useState)("disconnected"),[m,p]=(0,n.useState)(null),[f,v]=(0,n.useState)(0),g=(0,n.useRef)(null),j=(0,n.useCallback)(e=>{u(e),null==r||r(e)},[r]),y=(0,n.useCallback)(e=>{x(e),"connected"===e&&v(0)},[]),S=(0,n.useCallback)(e=>{p(e),"number"==typeof e.retryCount&&v(e.retryCount),null==o||o(e)},[o]),b=(0,n.useCallback)(()=>{g.current&&(g.current.reconnect(),v(g.current.getRetryCount()))},[]),Z=(0,n.useCallback)(()=>{g.current&&g.current.disconnect()},[]);return(0,n.useEffect)(()=>{if(!l){g.current&&(g.current.disconnect(),g.current=null);return}return g.current||(g.current=new s),g.current.connect({url:t,onMessage:j,onStateChange:y,onError:S,reconnectInterval:i,maxReconnectAttempts:a,withCredentials:c}),()=>{g.current&&(g.current.disconnect(),g.current=null)}},[t,l,i,a,c,j,y,S]),{data:d,isConnected:"connected"===h,state:h,error:m,retryCount:f,reconnect:b,disconnect:Z}}},59104:function(e,t,r){"use strict";r.d(t,{d:function(){return o}});var n=r(35106),s=r(93757);function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onStatusChange:t,enabled:r=!0,reconnectInterval:o=3e3}=e,[i,a]=(0,n.useState)({}),l=(0,n.useCallback)(e=>{if("server-status"===e.type){let{serverName:r,status:n,health:s,timestamp:o}=e.data;a(e=>({...e,[r]:{status:n,health:s,timestamp:o}})),null==t||t(r,n,s)}},[t]),{isConnected:c,reconnect:d,retryCount:u}=(0,s.D)({url:"/api/sse/servers-status",onMessage:l,enabled:r,reconnectInterval:o}),h=(0,n.useCallback)(e=>i[e]||null,[i]);return(0,n.useEffect)(()=>{r||a({})},[r]),{statusMap:i,getServerStatus:h,isConnected:c,reconnect:d,retryCount:u}}}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,521,5511,7359,880,1658,6909,6727,1854,2666,3669,2757,1744],function(){return e(e.s=49726)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[224],{49726:function(e,t,r){Promise.resolve().then(r.bind(r,7854))},7854:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return en}});var n=r(94655),s=r(35106),o=r(31358),i=r(7281),a=r(30417),l=r(81071),c=r(93017),d=r(69899),u=r(31317),h=r(76492),x=r(32366),m=r(78067),p=r(84840),f=r(97436),v=r(52082),g=r(89923),j=r(10297),y=r(42431),S=r(628),b=r(41565),Z=r(25935),C=r(79983),k=r(25333),w=r(95511),T=r(5501),E=r(93315),R=r(27171),I=r(96292);let P=e=>{switch(e){case"running":return"success";case"stopped":case"exited":case"not_created":return"error";case"created":return"warning";default:return"default"}},M=e=>{switch(e){case"running":return"Running";case"stopped":case"exited":return"Stopped";case"not_created":return"Not Created";case"created":return"Created";default:return e||"Unknown"}},O=e=>{if(!e)return"-";let t=e.split(",").map(e=>e.trim());return t.find(e=>e.endsWith(".local"))||t[0]||"-"};function F(e){var t;let{server:r,statusOverride:s,onClick:o,onStart:a,onStop:l,loading:c=!1}=e,d=(null==s?void 0:s.status)||r.status,h=(e,t)=>{e.stopPropagation(),t(r.name)},x="running"===d,m="stopped"===d||"exited"===d||"not_created"===d,p=O(r.hostname),f=(null===(t=r.hostname)||void 0===t?void 0:t.split(",").map(e=>e.trim()))||[];return(0,n.jsxs)(S.Z,{role:"article",onClick:()=>{o&&o(r.name)},sx:{cursor:o?"pointer":"default",transition:"all 0.2s",height:180,display:"flex",flexDirection:"column","&:hover":o?{transform:"translateY(-2px)",boxShadow:4}:{}},children:[(0,n.jsxs)(b.Z,{sx:{flex:1,pb:1},children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,n.jsx)(u.Z,{variant:"h6",component:"h3",sx:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,mr:1},children:r.name}),(0,n.jsx)(k.Z,{label:M(d),size:"small",color:P(d),sx:{fontWeight:500,minWidth:70}})]}),(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.5},children:[(0,n.jsx)(I.Z,{sx:{fontSize:16,color:"text.secondary"}}),(0,n.jsx)(w.Z,{title:f.length>1?f.join("\n"):"",arrow:!0,children:(0,n.jsxs)(u.Z,{variant:"body2",color:"text.secondary",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[p,f.length>1&&" (+".concat(f.length-1,")")]})})]}),(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,n.jsx)(R.Z,{sx:{fontSize:16,color:"text.secondary"}}),(0,n.jsx)(u.Z,{variant:"body2",color:"text.secondary",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.container})]})]}),(0,n.jsxs)(Z.Z,{sx:{justifyContent:"flex-end",px:2,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:[m&&a&&(0,n.jsx)(C.Z,{"aria-label":"Start server",color:"success",onClick:e=>h(e,a),disabled:c,size:"small",children:(0,n.jsx)(T.Z,{})}),x&&l&&(0,n.jsx)(C.Z,{"aria-label":"Stop server",color:"error",onClick:e=>h(e,l),disabled:c,size:"small",children:(0,n.jsx)(E.Z,{})}),!m&&!x&&(0,n.jsx)(i.Z,{sx:{height:34}})]})]})}function L(e){let{servers:t,statusMap:r={},onServerClick:o,onStart:l,onStop:c,onCreate:d,loadingServers:h=[]}=e,[m,S]=(0,s.useState)(""),[b,Z]=(0,s.useState)("all"),C=(0,s.useMemo)(()=>t.filter(e=>{if(m&&!e.name.toLowerCase().includes(m.toLowerCase()))return!1;let t=r[e.name],n=(null==t?void 0:t.status)||e.status;return("running"!==b||"running"===n)&&("stopped"!==b||"stopped"===n||"exited"===n||"not_created"===n)}),[t,r,m,b]);return 0===t.length?(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"400px",gap:2},children:[(0,n.jsx)(u.Z,{variant:"h6",color:"text.secondary",children:"No servers found"}),d&&(0,n.jsx)(a.Z,{variant:"contained",startIcon:(0,n.jsx)(x.Z,{}),onClick:d,children:"Create Server"})]}):(0,n.jsxs)(i.Z,{children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},gap:2,mb:3,alignItems:{xs:"stretch",sm:"center"},justifyContent:"space-between"},children:[(0,n.jsxs)(j.Z,{value:b,exclusive:!0,onChange:(e,t)=>{null!==t&&Z(t)},size:"small",sx:{flexShrink:0},children:[(0,n.jsx)(g.Z,{value:"all",children:"All"}),(0,n.jsx)(g.Z,{value:"running",children:"Running"}),(0,n.jsx)(g.Z,{value:"stopped",children:"Stopped"})]}),(0,n.jsx)(f.Z,{size:"small",placeholder:"Search servers...",value:m,onChange:e=>S(e.target.value),InputProps:{startAdornment:(0,n.jsx)(v.Z,{position:"start",children:(0,n.jsx)(y.Z,{})})},sx:{flexGrow:{xs:1,sm:0},minWidth:{sm:300}}})]}),(0,n.jsxs)(u.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:[C.length," ",1===C.length?"server":"servers"]}),0===C.length?(0,n.jsx)(i.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"200px",gap:2},children:(0,n.jsx)(u.Z,{variant:"h6",color:"text.secondary",children:"No servers found"})}):(0,n.jsx)(p.ZP,{container:!0,spacing:2,children:C.map(e=>(0,n.jsx)(p.ZP,{item:!0,xs:12,sm:6,md:4,children:(0,n.jsx)(F,{server:e,statusOverride:r[e.name],onClick:o,onStart:l,onStop:c,loading:h.includes(e.name)})},e.name))})]})}var W=r(99770),A=r(62508),N=r(5682),z=r(76678),D=r(7178),_=r(40064),G=r(45547),V=r(4405),q=r(73383),U=r(82285),H=r(13609),J=r(46207),$=r(43436),B=r(87716);let Y=["VANILLA","PAPER","FABRIC","FORGE","NEOFORGE"],K=["","forge","fabric","neoforge","quilt"],Q={name:"",type:"PAPER",version:"1.21.1",memory:"4G",autoStart:!1,sudoPassword:""},X=[{key:"initializing",label:"Initializing"},{key:"creating",label:"Creating"},{key:"configuring",label:"Configuring"},{key:"starting",label:"Starting"}];function ee(e){let t,{open:r,onClose:o,onSubmit:d,loading:h=!1,status:x="idle",progress:m=0,message:p=""}=e,[v,y]=(0,s.useState)("standard"),[S,b]=(0,s.useState)(Q),[Z,C]=(0,s.useState)({}),[k,w]=(0,s.useState)(!1),T=(0,s.useRef)(null),E=(0,s.useRef)(null),R=X.findIndex(e=>e.key===x),I="idle"!==x&&"completed"!==x&&"error"!==x;(0,s.useEffect)(()=>{r||(y("standard"),b(Q),C({}),w(!1))},[r]);let P=e=>e?/^[a-z0-9-]+$/.test(e)?null:"Only lowercase letters, numbers, and hyphens are allowed":"Server name is required",M=e=>e?null:"Modpack slug is required",O=e=>t=>{let r=t.target.value;b(t=>({...t,[e]:r})),"memory"===e&&w(!0),Z[e]&&C(t=>({...t,[e]:""}))};return(0,n.jsx)(W.Z,{open:r,onClose:I?void 0:o,maxWidth:"sm",fullWidth:!0,children:(0,n.jsxs)("form",{onSubmit:e=>{e.preventDefault(),C({});let t=P(S.name);if(t){C({name:t});return}if("modpack"===v){let e=M(S.modpack||"");if(e){C({modpack:e});return}}let r={name:S.name,memory:S.memory,autoStart:S.autoStart,sudoPassword:S.sudoPassword};"standard"===v?(r.type=S.type,r.version=S.version):(r.type="MODRINTH",r.modpack=S.modpack,S.modpackVersion&&(r.modpackVersion=S.modpackVersion),S.modLoader&&(r.modLoader=S.modLoader)),d(r)},children:[(0,n.jsx)(A.Z,{children:"completed"===x?(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,n.jsx)(J.Z,{color:"success"}),"Server Created Successfully"]}):"error"===x?(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,n.jsx)($.Z,{color:"error"}),"Creation Failed"]}):"Create New Server"}),(0,n.jsx)(N.Z,{children:I||"completed"===x||"error"===x?(0,n.jsxs)(i.Z,{sx:{py:2},children:[(0,n.jsx)(q.Z,{activeStep:R,alternativeLabel:!0,sx:{mb:3},children:X.map(e=>(0,n.jsx)(U.Z,{children:(0,n.jsx)(H.Z,{children:e.label})},e.key))}),I&&(0,n.jsxs)(i.Z,{sx:{mb:3},children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",justifyContent:"space-between",mb:1},children:[(0,n.jsx)(u.Z,{variant:"body2",color:"text.secondary",children:p}),(0,n.jsxs)(u.Z,{variant:"body2",color:"text.secondary",children:[m,"%"]})]}),(0,n.jsx)(V.Z,{variant:"determinate",value:m})]}),"completed"===x&&(0,n.jsx)(u.Z,{color:"success.main",sx:{textAlign:"center"},children:p}),"error"===x&&(0,n.jsx)(u.Z,{color:"error.main",sx:{textAlign:"center"},children:p})]}):(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2,pt:1},children:[(0,n.jsx)(i.Z,{ref:E,role:"status","aria-live":"polite",sx:{position:"absolute",left:"-10000px",width:"1px",height:"1px",overflow:"hidden"}}),(0,n.jsx)(f.Z,{label:"Server Name",value:S.name,onChange:O("name"),error:!!Z.name,helperText:Z.name||"Only lowercase letters, numbers, and hyphens",fullWidth:!0,autoFocus:!0,disabled:I}),(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2},children:[(0,n.jsx)(u.Z,{variant:"subtitle2",color:"text.secondary",children:"Server Type"}),(0,n.jsxs)(j.Z,{value:v,exclusive:!0,onChange:(e,t)=>{null!==t&&(y(t),E.current&&(E.current.textContent="".concat("standard"===t?"Standard Server":"Modpack"," category selected")),k||b(e=>({...e,memory:"standard"===t?"4G":"6G"})),setTimeout(()=>{"modpack"===t&&T.current&&T.current.focus()},300))},"aria-label":"Server category",fullWidth:!0,disabled:I,children:[(0,n.jsx)(g.Z,{value:"standard","aria-label":"Standard Server",children:"Standard Server"}),(0,n.jsx)(g.Z,{value:"modpack","aria-label":"Modpack",children:"Modpack"})]}),(0,n.jsx)(B.Z,{in:"standard"===v,unmountOnExit:!0,children:(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[(0,n.jsx)(f.Z,{label:"Server Type",select:!0,value:S.type,onChange:O("type"),fullWidth:!0,disabled:I,children:Y.map(e=>(0,n.jsx)(D.Z,{value:e,children:e},e))}),(0,n.jsx)(f.Z,{label:"Minecraft Version",value:S.version,onChange:O("version"),helperText:"e.g., 1.21.1, 1.20.4, latest",fullWidth:!0,disabled:I})]})}),(0,n.jsx)(B.Z,{in:"modpack"===v,unmountOnExit:!0,children:(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[(0,n.jsx)(l.Z,{severity:"info",children:"Minecraft version is automatically determined by the modpack"}),(0,n.jsx)(f.Z,{label:"Modpack Slug",value:S.modpack||"",onChange:O("modpack"),error:!!Z.modpack,helperText:Z.modpack||"e.g., cobblemon, adrenaserver (from modrinth.com/modpacks/SLUG)",fullWidth:!0,disabled:I,inputRef:T}),(0,n.jsxs)(f.Z,{label:"Mod Loader",select:!0,value:S.modLoader||"",onChange:O("modLoader"),helperText:"Leave empty to auto-detect from modpack",fullWidth:!0,disabled:I,children:[(0,n.jsx)(D.Z,{value:"",children:"Auto-detect"}),K.filter(e=>e).map(e=>(0,n.jsx)(D.Z,{value:e,children:e},e))]}),(0,n.jsx)(f.Z,{label:"Modpack Version",value:S.modpackVersion||"",onChange:O("modpackVersion"),helperText:"Leave empty for latest",fullWidth:!0,disabled:I})]})})]}),(0,n.jsx)(f.Z,{label:"Memory",value:S.memory,onChange:O("memory"),helperText:"e.g., 4G, 8G, 16G",fullWidth:!0,disabled:I}),(0,n.jsx)(f.Z,{label:"Sudo Password",type:"password",value:S.sudoPassword||"",onChange:O("sudoPassword"),helperText:"Required for mDNS hostname registration (avahi)",fullWidth:!0,disabled:I}),(0,n.jsx)(_.Z,{control:(0,n.jsx)(G.Z,{checked:S.autoStart||!1,onChange:(t="autoStart",e=>{b(r=>({...r,[t]:e.target.checked}))}),disabled:I}),label:"Auto-start after creation"})]})}),(0,n.jsx)(z.Z,{sx:{px:3,pb:2},children:"completed"===x||"error"===x?(0,n.jsx)(a.Z,{onClick:o,variant:"contained",fullWidth:!0,children:"Close"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.Z,{onClick:o,disabled:I,children:"Cancel"}),(0,n.jsx)(a.Z,{type:"submit",variant:"contained",disabled:I,startIcon:I?(0,n.jsx)(c.Z,{size:16}):null,children:I?"Creating...":"Create"})]})})]})})}var et=r(92666),er=r(59104);function en(){var e,t;let r=(0,o.x)(),[p,f]=(0,s.useState)(!1),[v,g]=(0,s.useState)([]),{data:j,isLoading:y,error:S}=(0,et.x$)(),{statusMap:b}=(0,er.d)(),Z=(0,et.jM)(),C=(0,et.Aw)(),k=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onSuccess:t,onError:r,onProgress:n}=e,[o,i]=(0,s.useState)("idle"),[a,l]=(0,s.useState)(0),[c,d]=(0,s.useState)(""),[u,h]=(0,s.useState)(null),x=(0,s.useRef)(null),m=(0,s.useRef)(""),p=(0,s.useCallback)(()=>{i("idle"),l(0),d(""),h(null),x.current&&(x.current.close(),x.current=null)},[]),f=(0,s.useCallback)((e,t,r)=>{i(e),d(t),l(r),null==n||n(e,t,r)},[n]),v=(0,s.useCallback)(async e=>{if("idle"===o||"completed"===o||"error"===o){h(null),f("initializing","Initializing server creation...",0),m.current=e.name,x.current&&x.current.close();try{let r=await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){let e=await r.text();throw Error(e||"Server creation failed: ".concat(r.statusText))}await r.json(),f("creating","Creating server configuration...",25),await new Promise(e=>setTimeout(e,500)),f("configuring","Configuring Docker compose...",50),await new Promise(e=>setTimeout(e,500)),f("starting","Starting server container...",75),await new Promise(e=>setTimeout(e,500)),f("completed","Server created successfully!",100),null==t||t(e.name)}catch(t){let e=t instanceof Error?t.message:"Unknown error occurred";i("error"),h(e),d("Server creation failed"),null==r||r(e)}}},[o,f,t,r]);return(0,s.useEffect)(()=>()=>{x.current&&(x.current.close(),x.current=null)},[]),{status:o,progress:a,message:c,error:u,isCreating:"idle"!==o&&"completed"!==o&&"error"!==o,createServer:v,reset:p}}({onSuccess:()=>{f(!1)},onError:e=>{console.error("Failed to create server:",e)}}),w=async e=>{g(t=>[...t,e]);try{await Z.mutateAsync(e)}catch(e){console.error("Failed to start server:",e)}finally{g(t=>t.filter(t=>t!==e))}},T=async e=>{g(t=>[...t,e]);try{await C.mutateAsync(e)}catch(e){console.error("Failed to stop server:",e)}finally{g(t=>t.filter(t=>t!==e))}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(d.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,h.Fq)(e.palette.info.main,.1)," 0%, ").concat((0,h.Fq)(e.palette.primary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,h.Fq)(e.palette.info.main,.2)),display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,n.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"info.main",color:"info.contrastText"},children:(0,n.jsx)(m.Z,{sx:{fontSize:32}})}),(0,n.jsxs)(i.Z,{children:[(0,n.jsx)(u.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Servers"}),(0,n.jsx)(u.Z,{variant:"body1",color:"text.secondary",children:"Manage your Minecraft servers"})]})]}),(0,n.jsx)(a.Z,{variant:"contained",startIcon:(0,n.jsx)(x.Z,{}),onClick:()=>f(!0),size:"large",children:"Create Server"})]}),S&&(0,n.jsxs)(l.Z,{severity:"error",sx:{mb:3},children:["Failed to load servers: ",S.message]}),k.error&&(0,n.jsxs)(l.Z,{severity:"error",sx:{mb:3},children:["Failed to create server: ",k.error]}),Z.isError&&(0,n.jsxs)(l.Z,{severity:"error",sx:{mb:3},children:["Failed to start server: ",null===(e=Z.error)||void 0===e?void 0:e.message]}),C.isError&&(0,n.jsxs)(l.Z,{severity:"error",sx:{mb:3},children:["Failed to stop server: ",null===(t=C.error)||void 0===t?void 0:t.message]}),y?(0,n.jsx)(i.Z,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,n.jsx)(c.Z,{})}):(0,n.jsx)(L,{servers:(null==j?void 0:j.servers)||[],statusMap:b,onServerClick:e=>{r.push("/servers/".concat(encodeURIComponent(e)))},onStart:w,onStop:T,onCreate:()=>f(!0),loadingServers:v}),(0,n.jsx)(ee,{open:p,onClose:()=>{f(!1),k.reset()},onSubmit:e=>{k.createServer(e)},loading:k.isCreating,status:k.status,progress:k.progress,message:k.message})]})}},3454:function(e,t,r){"use strict";r.d(t,{LoadingProvider:function(){return l},startLoading:function(){return c},stopLoading:function(){return d}});var n=r(94655),s=r(35106),o=r(74228),i=r(31477),a=r.n(i);function l(e){let{children:t}=e,r=(0,o.usePathname)(),i=(0,o.useSearchParams)();return(0,s.useEffect)(()=>{a().done()},[r,i]),(0,n.jsx)(n.Fragment,{children:t})}function c(){a().start()}function d(){a().done()}a().configure({showSpinner:!1,speed:300,minimum:.1})},8690:function(e,t,r){"use strict";r.d(t,{Av:function(){return n.startLoading}});var n=r(3454)},31358:function(e,t,r){"use strict";r.d(t,{x:function(){return i}});var n=r(74228),s=r(35106),o=r(8690);function i(){let e=(0,n.useRouter)(),t=(0,s.useCallback)((t,r)=>{(0,o.Av)(),e.push(t,r)},[e]),r=(0,s.useCallback)((t,r)=>{(0,o.Av)(),e.replace(t,r)},[e]);return(0,s.useMemo)(()=>({...e,push:t,replace:r}),[e,t,r])}},93757:function(e,t,r){"use strict";r.d(t,{D:function(){return o}});var n=r(35106);class s{connect(e){this.options=e,this.shouldReconnect=!0,this.establishConnection()}establishConnection(){this.options&&(this.updateState("connecting"),this.eventSource&&this.eventSource.close(),this.eventSource=new EventSource(this.options.url,{withCredentials:this.options.withCredentials||!1}),this.eventSource.onopen=()=>{this.updateState("connected"),this.retryCount=0,this.lastError=null},this.eventSource.onmessage=e=>{if(!e.data.startsWith(":"))try{var t,r;let n=JSON.parse(e.data);null===(r=this.options)||void 0===r||null===(t=r.onMessage)||void 0===t||t.call(r,n)}catch(e){console.warn("Failed to parse SSE message:",e)}},this.eventSource.onerror=()=>{var e,t;let r={message:"SSE connection error",code:"CONNECTION_ERROR",retryCount:this.retryCount,timestamp:new Date};this.lastError=r,this.updateState("error"),null===(t=this.options)||void 0===t||null===(e=t.onError)||void 0===e||e.call(t,r),this.shouldReconnect&&this.scheduleReconnect()})}scheduleReconnect(){var e,t;if(!this.options)return;let r=null!==(e=this.options.maxReconnectAttempts)&&void 0!==e?e:1/0;if(this.retryCount>=r)return;this.reconnectTimer&&clearTimeout(this.reconnectTimer);let n=null!==(t=this.options.reconnectInterval)&&void 0!==t?t:3e3;this.reconnectTimer=setTimeout(()=>{this.retryCount++,this.establishConnection()},n)}disconnect(){this.shouldReconnect=!1,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.updateState("disconnected")}getState(){return this.state}isConnected(){return"connected"===this.state}getLastError(){return this.lastError}getRetryCount(){return this.retryCount}reconnect(){this.retryCount++,this.shouldReconnect=!0,this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.establishConnection()}updateState(e){var t,r;this.state=e,null===(r=this.options)||void 0===r||null===(t=r.onStateChange)||void 0===t||t.call(r,e)}constructor(){this.eventSource=null,this.state="disconnected",this.retryCount=0,this.lastError=null,this.reconnectTimer=null,this.options=null,this.shouldReconnect=!0}}function o(e){let{url:t,onMessage:r,onError:o,reconnectInterval:i=3e3,maxReconnectAttempts:a=1/0,enabled:l=!0,withCredentials:c=!1}=e,[d,u]=(0,n.useState)(null),[h,x]=(0,n.useState)("disconnected"),[m,p]=(0,n.useState)(null),[f,v]=(0,n.useState)(0),g=(0,n.useRef)(null),j=(0,n.useCallback)(e=>{u(e),null==r||r(e)},[r]),y=(0,n.useCallback)(e=>{x(e),"connected"===e&&v(0)},[]),S=(0,n.useCallback)(e=>{p(e),"number"==typeof e.retryCount&&v(e.retryCount),null==o||o(e)},[o]),b=(0,n.useCallback)(()=>{g.current&&(g.current.reconnect(),v(g.current.getRetryCount()))},[]),Z=(0,n.useCallback)(()=>{g.current&&g.current.disconnect()},[]);return(0,n.useEffect)(()=>{if(!l){g.current&&(g.current.disconnect(),g.current=null);return}return g.current||(g.current=new s),g.current.connect({url:t,onMessage:j,onStateChange:y,onError:S,reconnectInterval:i,maxReconnectAttempts:a,withCredentials:c}),()=>{g.current&&(g.current.disconnect(),g.current=null)}},[t,l,i,a,c,j,y,S]),{data:d,isConnected:"connected"===h,state:h,error:m,retryCount:f,reconnect:b,disconnect:Z}}},59104:function(e,t,r){"use strict";r.d(t,{d:function(){return o}});var n=r(35106),s=r(93757);function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onStatusChange:t,enabled:r=!0,reconnectInterval:o=3e3}=e,[i,a]=(0,n.useState)({}),l=(0,n.useCallback)(e=>{if("server-status"===e.type){let{serverName:r,status:n,health:s,timestamp:o}=e.data;a(e=>({...e,[r]:{status:n,health:s,timestamp:o}})),null==t||t(r,n,s)}},[t]),{isConnected:c,reconnect:d,retryCount:u}=(0,s.D)({url:"/api/sse/servers-status",onMessage:l,enabled:r,reconnectInterval:o}),h=(0,n.useCallback)(e=>i[e]||null,[i]);return(0,n.useEffect)(()=>{r||a({})},[r]),{statusMap:i,getServerStatus:h,isConnected:c,reconnect:d,retryCount:u}}}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,2538,5511,880,1658,6909,6727,190,5386,2666,3669,2757,1744],function(){return e(e.s=49726)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4978],{70861:function(e,s,n){Promise.resolve().then(n.bind(n,32539))},87739:function(e,s,n){"use strict";var t=n(8091);s.Z=void 0;var r=t(n(66758)),c=n(94655);s.Z=(0,r.default)((0,c.jsx)("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings")},32539:function(e,s,n){"use strict";n.r(s),n.d(s,{default:function(){return h}});var t=n(94655),r=n(35106),c=n(7281),o=n(84840),i=n(31317),l=n(37530),a=n(81071),u=n(87739),d=n(57965);function h(){let[e,s]=(0,r.useState)({open:!1,message:"",severity:"success"}),n=e=>{s({open:!0,message:e,severity:"success"})},h=e=>{s({open:!0,message:e,severity:"error"})},x=()=>{s(e=>({...e,open:!1}))};return(0,t.jsxs)(c.Z,{children:[(0,t.jsxs)(c.Z,{sx:{display:"flex",alignItems:"center",gap:1.5,mb:4},children:[(0,t.jsx)(u.Z,{sx:{fontSize:32},color:"primary"}),(0,t.jsx)(i.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Settings"})]}),(0,t.jsxs)(o.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(o.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(d.zd,{onSuccess:n,onError:h})}),(0,t.jsx)(o.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(d.eE,{})}),(0,t.jsx)(o.ZP,{item:!0,xs:12,children:(0,t.jsx)(d.ms,{onSuccess:n,onError:h})})]}),(0,t.jsx)(l.Z,{open:e.open,autoHideDuration:6e3,onClose:x,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,t.jsx)(a.Z,{onClose:x,severity:e.severity,variant:"filled",sx:{width:"100%"},children:e.message})})]})}},42936:function(e,s,n){"use strict";async function t(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={...s.headers};s.body&&(n["Content-Type"]="application/json");let t=await fetch(e,{...s,headers:n});if(!t.ok){let e=await t.json().catch(()=>({error:"UnknownError",message:t.statusText})),s=Error(e.message);throw s.statusCode=t.status,s.code=e.error,s}return t.json()}n.d(s,{SC:function(){return t}})}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,2538,5511,2542,2844,9951,5381,4596,7965,3669,2757,1744],function(){return e(e.s=70861)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7701],{6199:function(e,s,n){Promise.resolve().then(n.bind(n,36405))},33104:function(e,s,n){"use strict";var l=n(8091);s.Z=void 0;var r=l(n(66758)),t=n(94655);s.Z=(0,r.default)([(0,t.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),(0,t.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"AccessTime")},21111:function(e,s,n){"use strict";var l=n(8091);s.Z=void 0;var r=l(n(66758)),t=n(94655);s.Z=(0,r.default)((0,t.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}),"Delete")},97812:function(e,s,n){"use strict";var l=n(8091);s.Z=void 0;var r=l(n(66758)),t=n(94655);s.Z=(0,r.default)((0,t.jsx)("path",{d:"M17 7h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.43-.98 2.63-2.31 2.98l1.46 1.46C20.88 15.61 22 13.95 22 12c0-2.76-2.24-5-5-5m-1 4h-2.19l2 2H16zM2 4.27l3.11 3.11C3.29 8.12 2 9.91 2 12c0 2.76 2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1 0-1.59 1.21-2.9 2.76-3.07L8.73 11H8v2h2.73L13 15.27V17h1.73l4.01 4L20 19.74 3.27 3z"}),"LinkOff")},84974:function(e,s,n){"use strict";var l=n(8091);s.Z=void 0;var r=l(n(66758)),t=n(94655);s.Z=(0,r.default)((0,t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39"}),"Public")},36405:function(e,s,n){"use strict";n.r(s),n.d(s,{default:function(){return _}});var l=n(94655),r=n(35106),t=n(7281),i=n(30417),a=n(81071),o=n(93017),d=n(69899),c=n(31317),x=n(99770),h=n(62508),u=n(5682),m=n(76678),j=n(97436),Z=n(76492),v=n(32366),f=n(84974),p=n(84840),g=n(52082),y=n(89923),b=n(10297),w=n(42431),C=n(628),S=n(41565),k=n(25935),W=n(79983),z=n(25333),L=n(95511),D=n(96292),I=n(97812),A=n(21111),F=n(78067),M=n(33104);function P(e){let{world:s,onAssign:n,onRelease:r,onDelete:i,loading:a=!1}=e,o=(e,n)=>{e.stopPropagation(),n(s.name)};return(0,l.jsxs)(C.Z,{role:"article",sx:{transition:"all 0.2s",height:200,display:"flex",flexDirection:"column","&:hover":{transform:"translateY(-2px)",boxShadow:4}},children:[(0,l.jsxs)(S.Z,{sx:{flex:1,pb:1},children:[(0,l.jsxs)(t.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,l.jsx)(c.Z,{variant:"h6",component:"h3",sx:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,mr:1},children:s.name}),(0,l.jsx)(z.Z,{label:s.isLocked?"Locked":"Available",size:"small",color:s.isLocked?"warning":"success",sx:{fontWeight:500,minWidth:80}})]}),(0,l.jsxs)(t.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.5},children:[(0,l.jsx)(F.Z,{sx:{fontSize:16,color:"text.secondary"}}),(0,l.jsx)(c.Z,{variant:"body2",color:"text.secondary",children:s.size||"Unknown size"})]}),s.isLocked&&s.lockedBy&&(0,l.jsxs)(t.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.5},children:[(0,l.jsx)(D.Z,{sx:{fontSize:16,color:"text.secondary"}}),(0,l.jsx)(L.Z,{title:"Assigned to ".concat(s.lockedBy),arrow:!0,children:(0,l.jsx)(c.Z,{variant:"body2",color:"text.secondary",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.lockedBy})})]}),(0,l.jsxs)(t.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,l.jsx)(M.Z,{sx:{fontSize:16,color:"text.secondary"}}),(0,l.jsx)(c.Z,{variant:"body2",color:"text.secondary",children:(e=>{if(!e)return"-";try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch(s){return e}})(s.lastModified)})]})]}),(0,l.jsxs)(k.Z,{sx:{justifyContent:"flex-end",px:2,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:[!s.isLocked&&n&&(0,l.jsx)(L.Z,{title:"Assign to server",arrow:!0,children:(0,l.jsx)(W.Z,{"aria-label":"Assign world",color:"primary",onClick:e=>o(e,n),disabled:a,size:"small",children:(0,l.jsx)(D.Z,{})})}),s.isLocked&&r&&(0,l.jsx)(L.Z,{title:"Release from server",arrow:!0,children:(0,l.jsx)(W.Z,{"aria-label":"Release world",color:"warning",onClick:e=>o(e,r),disabled:a,size:"small",children:(0,l.jsx)(I.Z,{})})}),i&&(0,l.jsx)(L.Z,{title:"Delete world",arrow:!0,children:(0,l.jsx)(W.Z,{"aria-label":"Delete world",color:"error",onClick:e=>o(e,i),disabled:a,size:"small",children:(0,l.jsx)(A.Z,{})})})]})]})}function E(e){let{worlds:s,onAssign:n,onRelease:a,onDelete:o,onCreate:d,loadingWorlds:x=[]}=e,[h,u]=(0,r.useState)(""),[m,Z]=(0,r.useState)("all"),f=(0,r.useMemo)(()=>s.filter(e=>(!h||!!e.name.toLowerCase().includes(h.toLowerCase()))&&("available"!==m||!e.isLocked)&&("locked"!==m||!!e.isLocked)),[s,h,m]);return 0===s.length?(0,l.jsxs)(t.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"400px",gap:2},children:[(0,l.jsx)(c.Z,{variant:"h6",color:"text.secondary",children:"No worlds found"}),d&&(0,l.jsx)(i.Z,{variant:"contained",startIcon:(0,l.jsx)(v.Z,{}),onClick:d,children:"Create World"})]}):(0,l.jsxs)(t.Z,{children:[(0,l.jsxs)(t.Z,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},gap:2,mb:3,alignItems:{xs:"stretch",sm:"center"},justifyContent:"space-between"},children:[(0,l.jsxs)(b.Z,{value:m,exclusive:!0,onChange:(e,s)=>{null!==s&&Z(s)},size:"small",sx:{flexShrink:0},children:[(0,l.jsx)(y.Z,{value:"all",children:"All"}),(0,l.jsx)(y.Z,{value:"available",children:"Available"}),(0,l.jsx)(y.Z,{value:"locked",children:"Locked"})]}),(0,l.jsx)(j.Z,{size:"small",placeholder:"Search worlds...",value:h,onChange:e=>u(e.target.value),InputProps:{startAdornment:(0,l.jsx)(g.Z,{position:"start",children:(0,l.jsx)(w.Z,{})})},sx:{flexGrow:{xs:1,sm:0},minWidth:{sm:300}}})]}),(0,l.jsxs)(c.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:[f.length," ",1===f.length?"world":"worlds"]}),0===f.length?(0,l.jsx)(t.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"200px",gap:2},children:(0,l.jsx)(c.Z,{variant:"h6",color:"text.secondary",children:"No worlds found"})}):(0,l.jsx)(p.ZP,{container:!0,spacing:2,children:f.map(e=>(0,l.jsx)(p.ZP,{item:!0,xs:12,sm:6,md:4,children:(0,l.jsx)(P,{world:e,onAssign:n,onRelease:a,onDelete:o,loading:x.includes(e.name)})},e.name))})]})}let H={name:"",seed:""};function N(e){let{open:s,onClose:n,onSubmit:a,loading:d=!1}=e,[c,Z]=(0,r.useState)(H),[v,f]=(0,r.useState)({});(0,r.useEffect)(()=>{s||(Z(H),f({}))},[s]);let p=e=>e?/^[a-z0-9-]+$/.test(e)?null:"Only lowercase letters, numbers, and hyphens are allowed":"World name is required",g=e=>s=>{let n=s.target.value;Z(s=>({...s,[e]:n})),v[e]&&f(s=>({...s,[e]:""}))};return(0,l.jsx)(x.Z,{open:s,onClose:d?void 0:n,maxWidth:"sm",fullWidth:!0,children:(0,l.jsxs)("form",{onSubmit:e=>{e.preventDefault(),f({});let s=p(c.name);if(s){f({name:s});return}a({name:c.name,...c.seed?{seed:c.seed}:{}})},children:[(0,l.jsx)(h.Z,{children:"Create New World"}),(0,l.jsx)(u.Z,{children:(0,l.jsxs)(t.Z,{sx:{display:"flex",flexDirection:"column",gap:2,pt:1},children:[(0,l.jsx)(j.Z,{label:"World Name",value:c.name,onChange:g("name"),error:!!v.name,helperText:v.name||"Only lowercase letters, numbers, and hyphens",fullWidth:!0,autoFocus:!0,disabled:d}),(0,l.jsx)(j.Z,{label:"Seed (optional)",value:c.seed||"",onChange:g("seed"),helperText:"Leave empty for a random seed",fullWidth:!0,disabled:d})]})}),(0,l.jsxs)(m.Z,{sx:{px:3,pb:2},children:[(0,l.jsx)(i.Z,{onClick:n,disabled:d,children:"Cancel"}),(0,l.jsx)(i.Z,{type:"submit",variant:"contained",disabled:d,startIcon:d?(0,l.jsx)(o.Z,{size:16}):null,children:d?"Creating...":"Create"})]})]})})}var T=n(7178),O=n(92666);function R(e){let{open:s,worldName:n,onClose:d,onSubmit:Z,loading:v=!1}=e,[f,p]=(0,r.useState)(""),{data:g,isLoading:y}=(0,O.x$)();(0,r.useEffect)(()=>{s||p("")},[s]);let b=(null==g?void 0:g.servers)||[],w=b.filter(e=>"running"!==e.status),C=b.filter(e=>"running"===e.status);return(0,l.jsx)(x.Z,{open:s,onClose:v?void 0:d,maxWidth:"sm",fullWidth:!0,children:(0,l.jsxs)("form",{onSubmit:e=>{e.preventDefault(),f&&Z(n,f)},children:[(0,l.jsxs)(h.Z,{children:["Assign World: ",n]}),(0,l.jsx)(u.Z,{children:(0,l.jsx)(t.Z,{sx:{display:"flex",flexDirection:"column",gap:2,pt:1},children:y?(0,l.jsx)(t.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,l.jsx)(o.Z,{})}):0===b.length?(0,l.jsx)(c.Z,{color:"text.secondary",children:"No servers available. Create a server first."}):(0,l.jsxs)(l.Fragment,{children:[0===w.length&&C.length>0&&(0,l.jsx)(a.Z,{severity:"warning",children:"All servers are currently running. It is recommended to assign worlds to stopped servers."}),(0,l.jsxs)(j.Z,{label:"Select Server",select:!0,value:f,onChange:e=>p(e.target.value),fullWidth:!0,disabled:v,helperText:"Select a server to assign this world to",children:[w.length>0&&(0,l.jsx)(T.Z,{disabled:!0,children:(0,l.jsx)(c.Z,{variant:"caption",color:"text.secondary",children:"Available Servers"})}),w.map(e=>(0,l.jsx)(T.Z,{value:e.name,children:e.name},e.name)),C.length>0&&(0,l.jsx)(T.Z,{disabled:!0,children:(0,l.jsx)(c.Z,{variant:"caption",color:"text.secondary",children:"Running Servers (not recommended)"})}),C.map(e=>(0,l.jsx)(T.Z,{value:e.name,children:e.name},e.name))]})]})})}),(0,l.jsxs)(m.Z,{sx:{px:3,pb:2},children:[(0,l.jsx)(i.Z,{onClick:d,disabled:v,children:"Cancel"}),(0,l.jsx)(i.Z,{type:"submit",variant:"contained",disabled:v||!f||y,startIcon:v?(0,l.jsx)(o.Z,{size:16}):null,children:v?"Assigning...":"Assign"})]})]})})}function _(){var e,s,n,p;let[g,y]=(0,r.useState)(!1),[b,w]=(0,r.useState)(null),[C,S]=(0,r.useState)(null),[k,W]=(0,r.useState)(""),[z,L]=(0,r.useState)([]),{data:D,isLoading:I,error:A}=(0,O.Sr)(),F=(0,O.hy)(),M=(0,O.nq)(),P=(0,O.g2)(),H=(0,O.Fv)(),T=async e=>{L(s=>[...s,e]);try{await P.mutateAsync({worldName:e})}catch(e){console.error("Failed to release world:",e)}finally{L(s=>s.filter(s=>s!==e))}};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(d.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,Z.Fq)(e.palette.success.main,.1)," 0%, ").concat((0,Z.Fq)(e.palette.primary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,Z.Fq)(e.palette.success.main,.2)),display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,l.jsxs)(t.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,l.jsx)(t.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"success.main",color:"success.contrastText"},children:(0,l.jsx)(f.Z,{sx:{fontSize:32}})}),(0,l.jsxs)(t.Z,{children:[(0,l.jsx)(c.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Worlds"}),(0,l.jsx)(c.Z,{variant:"body1",color:"text.secondary",children:"Manage your Minecraft worlds"})]})]}),(0,l.jsx)(i.Z,{variant:"contained",startIcon:(0,l.jsx)(v.Z,{}),onClick:()=>y(!0),size:"large",children:"Create World"})]}),A&&(0,l.jsxs)(a.Z,{severity:"error",sx:{mb:3},children:["Failed to load worlds: ",A.message]}),F.isError&&(0,l.jsxs)(a.Z,{severity:"error",sx:{mb:3},children:["Failed to create world: ",null===(e=F.error)||void 0===e?void 0:e.message]}),M.isError&&(0,l.jsxs)(a.Z,{severity:"error",sx:{mb:3},children:["Failed to assign world: ",null===(s=M.error)||void 0===s?void 0:s.message]}),P.isError&&(0,l.jsxs)(a.Z,{severity:"error",sx:{mb:3},children:["Failed to release world: ",null===(n=P.error)||void 0===n?void 0:n.message]}),H.isError&&(0,l.jsxs)(a.Z,{severity:"error",sx:{mb:3},children:["Failed to delete world: ",null===(p=H.error)||void 0===p?void 0:p.message]}),I?(0,l.jsx)(t.Z,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,l.jsx)(o.Z,{})}):(0,l.jsx)(E,{worlds:(null==D?void 0:D.worlds)||[],onAssign:e=>w(e),onRelease:T,onDelete:e=>{S(e),W("")},onCreate:()=>y(!0),loadingWorlds:z}),(0,l.jsx)(N,{open:g,onClose:()=>{y(!1),F.reset()},onSubmit:e=>{F.mutate(e,{onSuccess:()=>{y(!1)}})},loading:F.isPending}),(0,l.jsx)(R,{open:!!b,worldName:b||"",onClose:()=>w(null),onSubmit:(e,s)=>{L(s=>[...s,e]),M.mutate({worldName:e,serverName:s},{onSuccess:()=>{w(null)},onSettled:()=>{L(s=>s.filter(s=>s!==e))}})},loading:M.isPending}),(0,l.jsxs)(x.Z,{open:!!C,onClose:()=>{S(null),W("")},maxWidth:"sm",fullWidth:!0,children:[(0,l.jsx)(h.Z,{children:"Delete World"}),(0,l.jsxs)(u.Z,{children:[(0,l.jsxs)(c.Z,{sx:{mb:2},children:["This action cannot be undone. Type ",(0,l.jsx)("strong",{children:C})," to confirm deletion."]}),(0,l.jsx)(j.Z,{label:"World name",value:k,onChange:e=>W(e.target.value),fullWidth:!0,autoFocus:!0})]}),(0,l.jsxs)(m.Z,{sx:{px:3,pb:2},children:[(0,l.jsx)(i.Z,{onClick:()=>{S(null),W("")},children:"Cancel"}),(0,l.jsx)(i.Z,{variant:"contained",color:"error",onClick:()=>{C&&k===C&&(L(e=>[...e,C]),H.mutate({name:C,force:!0},{onSuccess:()=>{S(null),W("")},onSettled:()=>{L(e=>e.filter(e=>e!==C))}}))},disabled:k!==C||H.isPending,startIcon:H.isPending?(0,l.jsx)(o.Z,{size:16}):null,children:H.isPending?"Deleting...":"Delete"})]})]})]})}}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,2538,5511,880,6909,190,2666,3669,2757,1744],function(){return e(e.s=6199)}),_N_E=e.O()}]);