@minecraft-docker/mcctl-console 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/BUILD_ID +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/app-build-manifest.json +84 -72
- package/.next/standalone/platform/services/mcctl-console/.next/app-path-routes-manifest.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/build-manifest.json +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/prerender-manifest.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/admin/users/page.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/admin/users/page.js.nft.json +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/admin/users/page_client-reference-manifest.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/audit-logs/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/audit-logs/page.js.nft.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/audit-logs/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/backups/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/backups/page.js.nft.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/backups/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/dashboard/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/dashboard/page.js.nft.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/dashboard/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/players/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/players/page.js.nft.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/players/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/routing/page.js +1 -51
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/routing/page.js.nft.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/routing/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/console/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/console/page.js.nft.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/console/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page.js.nft.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/page.js.nft.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/settings/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/settings/page.js.nft.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/worlds/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/worlds/page.js.nft.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/worlds/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.rsc +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.rsc +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.rsc +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/login/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/login/page.js.nft.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.rsc +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.rsc +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.rsc +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/settings.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/settings.rsc +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup/page.js.nft.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.rsc +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app-paths-manifest.json +15 -15
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/1080.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/1314.js +54 -0
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/4533.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/5019.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/5068.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/701.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/8243.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/8847.js +74 -0
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/8913.js +51 -0
- package/.next/standalone/platform/services/mcctl-console/.next/server/middleware-manifest.json +5 -5
- package/.next/standalone/platform/services/mcctl-console/.next/server/next-font-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/next-font-manifest.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/pages/404.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/pages/500.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/{1189-60aed59c0e82a63d.js → 1189-9b2b752dc97065ac.js} +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/1854-71dbad60b363e57e.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2777-90cc701b41e837af.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/4668-f487c5c564e045d6.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/521-a5b59e2a19c8dd4f.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/5511-7a419d84918a8d64.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/{6479-82b21daf8e380c4d.js → 6479-f31fbc0f2cf7ddd0.js} +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/7359-45760f0e0e93f86b.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/8558-4356df5e91ec7f4c.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/892-a0f20ea0df618c15.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/admin/layout-a902566886bf412c.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/{admin/users/page-f45f3cd30725a718.js → (main)/admin/users/page-48f4e3bdef6c2202.js} +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/audit-logs/{page-b879c927081e59a2.js → page-21b37416096d3cfc.js} +1 -1
- package/.next/{static/chunks/app/(main)/backups/page-7a59c9269da2d63e.js → standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/backups/page-a8606e93b4994f33.js} +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/dashboard/{page-d2d8cd0c7a0a54ec.js → page-fe3321721ddfe2a7.js} +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/players/page-5bbed669a03279a3.js +1 -0
- package/.next/{static/chunks/app/(main)/routing/page-909690ecbe76f31c.js → standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/routing/page-ee0b47f2cc2bc235.js} +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/{page-96518534b90deb1c.js → page-b8d4a08a748e882d.js} +1 -1
- package/.next/{static/chunks/app/(main)/servers/page-c35bb5a99e6ff107.js → standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/page-e47f9c34ab4e890d.js} +1 -1
- package/.next/{static/chunks/app/(main)/settings/page-a805f639e14a10b0.js → standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/settings/page-dac4b25dde7b0719.js} +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/worlds/page-7e2bc35fda11d7c4.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/package.json +1 -1
- package/.next/static/chunks/{1189-60aed59c0e82a63d.js → 1189-9b2b752dc97065ac.js} +1 -1
- package/.next/static/chunks/1854-71dbad60b363e57e.js +1 -0
- package/.next/static/chunks/2777-90cc701b41e837af.js +1 -0
- package/.next/static/chunks/4668-f487c5c564e045d6.js +1 -0
- package/.next/static/chunks/521-a5b59e2a19c8dd4f.js +1 -0
- package/.next/static/chunks/5511-7a419d84918a8d64.js +1 -0
- package/.next/static/chunks/{6479-82b21daf8e380c4d.js → 6479-f31fbc0f2cf7ddd0.js} +1 -1
- package/.next/static/chunks/7359-45760f0e0e93f86b.js +1 -0
- package/.next/static/chunks/8558-4356df5e91ec7f4c.js +1 -0
- package/.next/static/chunks/892-a0f20ea0df618c15.js +1 -0
- package/.next/static/chunks/app/(main)/admin/layout-a902566886bf412c.js +1 -0
- package/.next/static/chunks/app/{admin/users/page-f45f3cd30725a718.js → (main)/admin/users/page-48f4e3bdef6c2202.js} +1 -1
- package/.next/static/chunks/app/(main)/audit-logs/{page-b879c927081e59a2.js → page-21b37416096d3cfc.js} +1 -1
- package/.next/{standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/backups/page-7a59c9269da2d63e.js → static/chunks/app/(main)/backups/page-a8606e93b4994f33.js} +1 -1
- package/.next/static/chunks/app/(main)/dashboard/{page-d2d8cd0c7a0a54ec.js → page-fe3321721ddfe2a7.js} +1 -1
- package/.next/static/chunks/app/(main)/players/page-5bbed669a03279a3.js +1 -0
- package/.next/{standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/routing/page-909690ecbe76f31c.js → static/chunks/app/(main)/routing/page-ee0b47f2cc2bc235.js} +1 -1
- package/.next/static/chunks/app/(main)/servers/[name]/{page-96518534b90deb1c.js → page-b8d4a08a748e882d.js} +1 -1
- package/.next/{standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/page-c35bb5a99e6ff107.js → static/chunks/app/(main)/servers/page-e47f9c34ab4e890d.js} +1 -1
- package/.next/{standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/settings/page-a805f639e14a10b0.js → static/chunks/app/(main)/settings/page-dac4b25dde7b0719.js} +1 -1
- package/.next/static/chunks/app/(main)/worlds/page-7e2bc35fda11d7c4.js +1 -0
- package/package.json +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/admin/users/page.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/admin/users/page.js.nft.json +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/admin/users/page_client-reference-manifest.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/admin/users.html +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/admin/users.meta +0 -5
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/admin/users.rsc +0 -12
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/3029.js +0 -51
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/3048.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/6231.js +0 -74
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/7057.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/7453.js +0 -54
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/8165.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/9250.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/190-9ecdd3c2ad7fadef.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/4597-a66229d37b05fea9.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/5386-a568e84580b1d208.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/6571-0d9e629a91d9f630.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/7073-46594e6380fdda11.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/7782-0f287c9ab0566879.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/787-91c6946656342fe4.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/8625-b235421f69a178fb.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/9810-e8bf0b092d80a553.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/players/page-724151791dd69b93.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/worlds/page-704a3dafb5b8ec15.js +0 -1
- package/.next/static/chunks/190-9ecdd3c2ad7fadef.js +0 -1
- package/.next/static/chunks/4597-a66229d37b05fea9.js +0 -1
- package/.next/static/chunks/5386-a568e84580b1d208.js +0 -1
- package/.next/static/chunks/6571-0d9e629a91d9f630.js +0 -1
- package/.next/static/chunks/7073-46594e6380fdda11.js +0 -1
- package/.next/static/chunks/7782-0f287c9ab0566879.js +0 -1
- package/.next/static/chunks/787-91c6946656342fe4.js +0 -1
- package/.next/static/chunks/8625-b235421f69a178fb.js +0 -1
- package/.next/static/chunks/9810-e8bf0b092d80a553.js +0 -1
- package/.next/static/chunks/app/(main)/players/page-724151791dd69b93.js +0 -1
- package/.next/static/chunks/app/(main)/worlds/page-704a3dafb5b8ec15.js +0 -1
- /package/.next/standalone/platform/services/mcctl-console/.next/static/{lF2Ag_PdEMco5HscTAFVZ → qKkyAhVhtEF8ACV2o3pRc}/_buildManifest.js +0 -0
- /package/.next/standalone/platform/services/mcctl-console/.next/static/{lF2Ag_PdEMco5HscTAFVZ → qKkyAhVhtEF8ACV2o3pRc}/_ssgManifest.js +0 -0
- /package/.next/static/{lF2Ag_PdEMco5HscTAFVZ → qKkyAhVhtEF8ACV2o3pRc}/_buildManifest.js +0 -0
- /package/.next/static/{lF2Ag_PdEMco5HscTAFVZ → qKkyAhVhtEF8ACV2o3pRc}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6302],{1366:function(e,n,t){Promise.resolve().then(t.bind(t,6643))},6643:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return P}});var r=t(94655),s=t(31317),i=t(7281),o=t(69899),a=t(70115),c=t(76492),u=t(91606),l=t(628),d=t(41565),h=t(25333),x=t(46207),y=t(43436),m=t(92666);function j(){let{data:e,isLoading:n,error:t}=(0,m.mj)();if(n)return(0,r.jsx)(l.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(s.Z,{variant:"h6",gutterBottom:!0,children:"Backup Status"}),(0,r.jsx)(s.Z,{color:"text.secondary",children:"Loading..."})]})});if(t)return(0,r.jsx)(l.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(s.Z,{variant:"h6",gutterBottom:!0,children:"Backup Status"}),(0,r.jsx)(s.Z,{color:"error",children:"Failed to load backup status"})]})});let{configured:o,lastBackup:a,repository:c}=e||{};return(0,r.jsx)(l.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,r.jsx)(s.Z,{variant:"h6",children:"Backup Status"}),(0,r.jsx)(h.Z,{icon:o?(0,r.jsx)(x.Z,{}):(0,r.jsx)(y.Z,{}),label:o?"Configured":"Not Configured",color:o?"success":"error",size:"small"})]}),o?(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:[c&&(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",children:"Repository"}),(0,r.jsx)(s.Z,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.875rem"},children:c})]}),a&&(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",children:"Last Backup"}),(0,r.jsx)(s.Z,{variant:"body2",children:function(e){let n=new Date,t=new Date(e),r=Math.floor((n.getTime()-t.getTime())/6e4),s=Math.floor(r/60);return r<1?"just now":r<60?"".concat(r," minutes ago"):s<24?"".concat(s," hours ago"):"".concat(Math.floor(s/24)," days ago")}(a)})]}),!a&&(0,r.jsx)(s.Z,{variant:"body2",color:"text.secondary",children:"No backups yet"})]}):(0,r.jsx)(s.Z,{variant:"body2",color:"text.secondary",children:"GitHub backup is not configured. Please configure BACKUP_REPO_URL in your environment."})]})})}var f=t(35106),p=t(21138),v=t(84811),Z=t(47001),g=t(53281),b=t(11254),S=t(70366),C=t(79983),k=t(97731),w=t(30417),q=t(99770),F=t(76678),I=t(5682),K=t(65087),D=t(62508),T=t(81071),N=t(93017);function B(e){var n;let{open:t,commit:o,onClose:a}=e,{mutate:c,isPending:u}=(0,m.s8)(),[l,d]=(0,f.useState)(""),[h,x]=(0,f.useState)(""),y=()=>{u||(d(""),x(""),a())};return(0,r.jsxs)(q.Z,{open:t,onClose:y,maxWidth:"sm",fullWidth:!0,children:[(0,r.jsx)(D.Z,{children:"Restore Backup"}),(0,r.jsxs)(I.Z,{children:[(0,r.jsx)(T.Z,{severity:"warning",sx:{mb:2},children:"This will restore all worlds from the selected backup. Current world data will be overwritten."}),l&&(0,r.jsx)(T.Z,{severity:"success",sx:{mb:2},children:l}),h&&(0,r.jsx)(T.Z,{severity:"error",sx:{mb:2},children:h}),(0,r.jsx)(K.Z,{sx:{mb:2},children:"Are you sure you want to restore from this backup?"}),(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:[(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",children:"Commit Hash"}),(0,r.jsx)(s.Z,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.875rem"},children:o.hash})]}),(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",children:"Date"}),(0,r.jsx)(s.Z,{variant:"body2",children:(n=o.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(n)))})]}),(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",children:"Message"}),(0,r.jsx)(s.Z,{variant:"body2",children:o.message})]}),(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",children:"Author"}),(0,r.jsx)(s.Z,{variant:"body2",children:o.author})]})]})]}),(0,r.jsxs)(F.Z,{children:[(0,r.jsx)(w.Z,{onClick:y,disabled:u,children:"Cancel"}),(0,r.jsx)(w.Z,{onClick:()=>{d(""),x(""),c(o.hash,{onSuccess:()=>{d("Backup restored successfully from ".concat(o.hash.substring(0,7))),setTimeout(()=>{a()},2e3)},onError:e=>{x("Failed to restore backup: ".concat(e.message))}})},variant:"contained",color:"warning",disabled:u,startIcon:u?(0,r.jsx)(N.Z,{size:16}):(0,r.jsx)(k.Z,{}),children:u?"Restoring...":"Restore"})]})]})}function Q(){let{data:e,isLoading:n,error:t}=(0,m.$t)(20),[i,o]=(0,f.useState)(null),a=e=>{o(e)};if(n)return(0,r.jsx)(l.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(s.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),(0,r.jsx)(s.Z,{color:"text.secondary",children:"Loading..."})]})});if(t)return(0,r.jsx)(l.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(s.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),(0,r.jsx)(s.Z,{color:"error",children:"Failed to load backup history"})]})});let c=(null==e?void 0:e.commits)||[];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(s.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),0===c.length?(0,r.jsx)(s.Z,{color:"text.secondary",children:"No backup history available"}):(0,r.jsx)(g.Z,{children:(0,r.jsxs)(p.Z,{children:[(0,r.jsx)(b.Z,{children:(0,r.jsxs)(S.Z,{children:[(0,r.jsx)(Z.Z,{children:"Commit"}),(0,r.jsx)(Z.Z,{children:"Date"}),(0,r.jsx)(Z.Z,{children:"Message"}),(0,r.jsx)(Z.Z,{children:"Author"}),(0,r.jsx)(Z.Z,{align:"right",children:"Actions"})]})}),(0,r.jsx)(v.Z,{children:c.map(e=>{var n;return(0,r.jsxs)(S.Z,{children:[(0,r.jsx)(Z.Z,{children:(0,r.jsx)(h.Z,{label:e.hash.substring(0,7),size:"small",variant:"outlined",sx:{fontFamily:"monospace"}})}),(0,r.jsx)(Z.Z,{children:(0,r.jsx)(s.Z,{variant:"body2",children:(n=e.date,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(n)))})}),(0,r.jsx)(Z.Z,{children:(0,r.jsx)(s.Z,{variant:"body2",children:e.message})}),(0,r.jsx)(Z.Z,{children:(0,r.jsx)(s.Z,{variant:"body2",color:"text.secondary",children:e.author})}),(0,r.jsx)(Z.Z,{align:"right",children:(0,r.jsx)(C.Z,{size:"small",color:"primary",onClick:()=>a(e),title:"Restore this backup",children:(0,r.jsx)(k.Z,{})})})]},e.hash)})})]})})]})}),i&&(0,r.jsx)(B,{open:!!i,commit:i,onClose:()=>{o(null)}})]})}var R=t(97436),O=t(34675);function L(e){let{disabled:n}=e,[t,s]=(0,f.useState)(!1),[i,o]=(0,f.useState)(""),[a,c]=(0,f.useState)(""),[u,l]=(0,f.useState)(""),{mutate:d,isPending:h}=(0,m.c5)(),x=()=>{h||(s(!1),o(""),c(""),l(""))};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w.Z,{variant:"contained",startIcon:(0,r.jsx)(O.Z,{}),onClick:()=>{s(!0),c(""),l(""),o("Backup ".concat(new Date().toISOString().split("T")[0]))},disabled:n||h,children:"Push Backup"}),(0,r.jsxs)(q.Z,{open:t,onClose:x,maxWidth:"sm",fullWidth:!0,children:[(0,r.jsx)(D.Z,{children:"Push Backup"}),(0,r.jsxs)(I.Z,{children:[a&&(0,r.jsx)(T.Z,{severity:"success",sx:{mb:2},children:a}),u&&(0,r.jsx)(T.Z,{severity:"error",sx:{mb:2},children:u}),(0,r.jsx)(R.Z,{autoFocus:!0,margin:"dense",label:"Commit Message",type:"text",fullWidth:!0,variant:"outlined",value:i,onChange:e=>o(e.target.value),disabled:h,helperText:"Optional message describing this backup"})]}),(0,r.jsxs)(F.Z,{children:[(0,r.jsx)(w.Z,{onClick:x,disabled:h,children:"Cancel"}),(0,r.jsx)(w.Z,{onClick:()=>{c(""),l(""),d({message:i||void 0},{onSuccess:e=>{c(e.commitHash?"Backup pushed successfully (".concat(e.commitHash.substring(0,7),")"):"Backup pushed successfully"),setTimeout(()=>{x()},2e3)},onError:e=>{l("Failed to push backup: ".concat(e.message))}})},variant:"contained",disabled:h,startIcon:h?(0,r.jsx)(N.Z,{size:16}):(0,r.jsx)(O.Z,{}),children:h?"Pushing...":"Push"})]})]})]})}function P(){var e;let{data:n}=(0,m.mj)(),t=null!==(e=null==n?void 0:n.configured)&&void 0!==e&&e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.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,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,r.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"secondary.main",color:"secondary.contrastText"},children:(0,r.jsx)(u.Z,{sx:{fontSize:32}})}),(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Backups"}),(0,r.jsx)(s.Z,{variant:"body1",color:"text.secondary",children:"Manage world backups and restore points"})]})]}),(0,r.jsx)(L,{disabled:!t})]}),(0,r.jsxs)(a.Z,{spacing:3,children:[(0,r.jsx)(j,{}),t&&(0,r.jsx)(Q,{})]})]})}},42936:function(e,n,t){"use strict";async function r(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={...n.headers};n.body&&(t["Content-Type"]="application/json");let r=await fetch(e,{...n,headers:t});if(!r.ok){let e=await r.json().catch(()=>({error:"UnknownError",message:r.statusText})),n=Error(e.message);throw n.statusCode=r.status,n.code=e.error,n}return r.json()}t.d(n,{SC:function(){return r}})},92666:function(e,n,t){"use strict";t.d(n,{$t:function(){return S},Aw:function(){return d},Fv:function(){return f},Hq:function(){return u},Hy:function(){return c},MH:function(){return v},Sr:function(){return x},_I:function(){return h},c5:function(){return C},g2:function(){return j},gx:function(){return Z},hy:function(){return y},iC:function(){return p},jM:function(){return l},mj:function(){return b},nq:function(){return m},nv:function(){return g},s8:function(){return k},x$:function(){return a}});var r=t(5632),s=t(58919),i=t(20367),o=t(42936);function a(){return(0,r.a)({queryKey:["servers"],queryFn:()=>(0,o.SC)("/api/servers"),refetchInterval:6e4})}function c(e,n){return(0,r.a)({queryKey:["servers",e],queryFn:()=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e))),enabled:(null==n?void 0:n.enabled)!==!1&&!!e,refetchInterval:3e4})}function u(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{name:n,force:t}=e;return(0,o.SC)("/api/servers/".concat(encodeURIComponent(n)).concat(t?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["servers"]})}})}function l(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/start"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function d(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/stop"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function h(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/restart"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function x(){return(0,r.a)({queryKey:["worlds"],queryFn:()=>(0,o.SC)("/api/worlds"),refetchInterval:3e4})}function y(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/worlds",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function m(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{worldName:n,serverName:t}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n),"/assign"),{method:"POST",body:JSON.stringify({serverName:t})})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}function j(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{worldName:n,force:t}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n),"/release").concat(t?"?force=true":""),{method:"POST"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function f(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{name:n,force:t}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n)).concat(t?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function p(e,n){return(0,r.a)({queryKey:["servers",e,"config"],queryFn:()=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/config")),enabled:(null==n?void 0:n.enabled)!==!1&&!!e})}function v(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{serverName:n,config:t}=e;return(0,o.SC)("/api/servers/".concat(encodeURIComponent(n),"/config"),{method:"PATCH",body:JSON.stringify(t)})},onSuccess:(n,t)=>{let{serverName:r}=t;e.invalidateQueries({queryKey:["servers",r,"config"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function Z(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/world/reset"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers",t]}),e.invalidateQueries({queryKey:["worlds"]})}})}function g(){return(0,r.a)({queryKey:["router-status"],queryFn:()=>(0,o.SC)("/api/router/status"),refetchInterval:3e4})}function b(){return(0,r.a)({queryKey:["backup-status"],queryFn:()=>(0,o.SC)("/api/backup"),refetchInterval:6e4})}function S(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return(0,r.a)({queryKey:["backup-history",e],queryFn:()=>(0,o.SC)("/api/backup/history?limit=".concat(e)),refetchInterval:6e4})}function C(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{message:n}=e;return(0,o.SC)("/api/backup",{method:"POST",body:JSON.stringify({message:n})})},onSuccess:()=>{e.invalidateQueries({queryKey:["backup-status"]}),e.invalidateQueries({queryKey:["backup-history"]})}})}function k(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/backup/restore",{method:"POST",body:JSON.stringify({commitHash:e})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,880,9654,8625,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,n,t){Promise.resolve().then(t.bind(t,6643))},6643:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return P}});var r=t(94655),s=t(31317),i=t(7281),o=t(69899),a=t(70115),c=t(76492),u=t(91606),l=t(628),d=t(41565),h=t(25333),x=t(46207),y=t(43436),m=t(92666);function j(){let{data:e,isLoading:n,error:t}=(0,m.mj)();if(n)return(0,r.jsx)(l.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(s.Z,{variant:"h6",gutterBottom:!0,children:"Backup Status"}),(0,r.jsx)(s.Z,{color:"text.secondary",children:"Loading..."})]})});if(t)return(0,r.jsx)(l.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(s.Z,{variant:"h6",gutterBottom:!0,children:"Backup Status"}),(0,r.jsx)(s.Z,{color:"error",children:"Failed to load backup status"})]})});let{configured:o,lastBackup:a,repository:c}=e||{};return(0,r.jsx)(l.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,r.jsx)(s.Z,{variant:"h6",children:"Backup Status"}),(0,r.jsx)(h.Z,{icon:o?(0,r.jsx)(x.Z,{}):(0,r.jsx)(y.Z,{}),label:o?"Configured":"Not Configured",color:o?"success":"error",size:"small"})]}),o?(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:[c&&(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",children:"Repository"}),(0,r.jsx)(s.Z,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.875rem"},children:c})]}),a&&(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",children:"Last Backup"}),(0,r.jsx)(s.Z,{variant:"body2",children:function(e){let n=new Date,t=new Date(e),r=Math.floor((n.getTime()-t.getTime())/6e4),s=Math.floor(r/60);return r<1?"just now":r<60?"".concat(r," minutes ago"):s<24?"".concat(s," hours ago"):"".concat(Math.floor(s/24)," days ago")}(a)})]}),!a&&(0,r.jsx)(s.Z,{variant:"body2",color:"text.secondary",children:"No backups yet"})]}):(0,r.jsx)(s.Z,{variant:"body2",color:"text.secondary",children:"GitHub backup is not configured. Please configure BACKUP_REPO_URL in your environment."})]})})}var f=t(35106),p=t(21138),v=t(84811),Z=t(47001),g=t(53281),b=t(11254),S=t(70366),C=t(79983),k=t(97731),w=t(30417),q=t(99770),F=t(76678),I=t(5682),K=t(65087),D=t(62508),T=t(81071),N=t(93017);function B(e){var n;let{open:t,commit:o,onClose:a}=e,{mutate:c,isPending:u}=(0,m.s8)(),[l,d]=(0,f.useState)(""),[h,x]=(0,f.useState)(""),y=()=>{u||(d(""),x(""),a())};return(0,r.jsxs)(q.Z,{open:t,onClose:y,maxWidth:"sm",fullWidth:!0,children:[(0,r.jsx)(D.Z,{children:"Restore Backup"}),(0,r.jsxs)(I.Z,{children:[(0,r.jsx)(T.Z,{severity:"warning",sx:{mb:2},children:"This will restore all worlds from the selected backup. Current world data will be overwritten."}),l&&(0,r.jsx)(T.Z,{severity:"success",sx:{mb:2},children:l}),h&&(0,r.jsx)(T.Z,{severity:"error",sx:{mb:2},children:h}),(0,r.jsx)(K.Z,{sx:{mb:2},children:"Are you sure you want to restore from this backup?"}),(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:[(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",children:"Commit Hash"}),(0,r.jsx)(s.Z,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.875rem"},children:o.hash})]}),(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",children:"Date"}),(0,r.jsx)(s.Z,{variant:"body2",children:(n=o.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(n)))})]}),(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",children:"Message"}),(0,r.jsx)(s.Z,{variant:"body2",children:o.message})]}),(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"caption",color:"text.secondary",children:"Author"}),(0,r.jsx)(s.Z,{variant:"body2",children:o.author})]})]})]}),(0,r.jsxs)(F.Z,{children:[(0,r.jsx)(w.Z,{onClick:y,disabled:u,children:"Cancel"}),(0,r.jsx)(w.Z,{onClick:()=>{d(""),x(""),c(o.hash,{onSuccess:()=>{d("Backup restored successfully from ".concat(o.hash.substring(0,7))),setTimeout(()=>{a()},2e3)},onError:e=>{x("Failed to restore backup: ".concat(e.message))}})},variant:"contained",color:"warning",disabled:u,startIcon:u?(0,r.jsx)(N.Z,{size:16}):(0,r.jsx)(k.Z,{}),children:u?"Restoring...":"Restore"})]})]})}function Q(){let{data:e,isLoading:n,error:t}=(0,m.$t)(20),[i,o]=(0,f.useState)(null),a=e=>{o(e)};if(n)return(0,r.jsx)(l.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(s.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),(0,r.jsx)(s.Z,{color:"text.secondary",children:"Loading..."})]})});if(t)return(0,r.jsx)(l.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(s.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),(0,r.jsx)(s.Z,{color:"error",children:"Failed to load backup history"})]})});let c=(null==e?void 0:e.commits)||[];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(s.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),0===c.length?(0,r.jsx)(s.Z,{color:"text.secondary",children:"No backup history available"}):(0,r.jsx)(g.Z,{children:(0,r.jsxs)(p.Z,{children:[(0,r.jsx)(b.Z,{children:(0,r.jsxs)(S.Z,{children:[(0,r.jsx)(Z.Z,{children:"Commit"}),(0,r.jsx)(Z.Z,{children:"Date"}),(0,r.jsx)(Z.Z,{children:"Message"}),(0,r.jsx)(Z.Z,{children:"Author"}),(0,r.jsx)(Z.Z,{align:"right",children:"Actions"})]})}),(0,r.jsx)(v.Z,{children:c.map(e=>{var n;return(0,r.jsxs)(S.Z,{children:[(0,r.jsx)(Z.Z,{children:(0,r.jsx)(h.Z,{label:e.hash.substring(0,7),size:"small",variant:"outlined",sx:{fontFamily:"monospace"}})}),(0,r.jsx)(Z.Z,{children:(0,r.jsx)(s.Z,{variant:"body2",children:(n=e.date,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(n)))})}),(0,r.jsx)(Z.Z,{children:(0,r.jsx)(s.Z,{variant:"body2",children:e.message})}),(0,r.jsx)(Z.Z,{children:(0,r.jsx)(s.Z,{variant:"body2",color:"text.secondary",children:e.author})}),(0,r.jsx)(Z.Z,{align:"right",children:(0,r.jsx)(C.Z,{size:"small",color:"primary",onClick:()=>a(e),title:"Restore this backup",children:(0,r.jsx)(k.Z,{})})})]},e.hash)})})]})})]})}),i&&(0,r.jsx)(B,{open:!!i,commit:i,onClose:()=>{o(null)}})]})}var R=t(97436),O=t(34675);function L(e){let{disabled:n}=e,[t,s]=(0,f.useState)(!1),[i,o]=(0,f.useState)(""),[a,c]=(0,f.useState)(""),[u,l]=(0,f.useState)(""),{mutate:d,isPending:h}=(0,m.c5)(),x=()=>{h||(s(!1),o(""),c(""),l(""))};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w.Z,{variant:"contained",startIcon:(0,r.jsx)(O.Z,{}),onClick:()=>{s(!0),c(""),l(""),o("Backup ".concat(new Date().toISOString().split("T")[0]))},disabled:n||h,children:"Push Backup"}),(0,r.jsxs)(q.Z,{open:t,onClose:x,maxWidth:"sm",fullWidth:!0,children:[(0,r.jsx)(D.Z,{children:"Push Backup"}),(0,r.jsxs)(I.Z,{children:[a&&(0,r.jsx)(T.Z,{severity:"success",sx:{mb:2},children:a}),u&&(0,r.jsx)(T.Z,{severity:"error",sx:{mb:2},children:u}),(0,r.jsx)(R.Z,{autoFocus:!0,margin:"dense",label:"Commit Message",type:"text",fullWidth:!0,variant:"outlined",value:i,onChange:e=>o(e.target.value),disabled:h,helperText:"Optional message describing this backup"})]}),(0,r.jsxs)(F.Z,{children:[(0,r.jsx)(w.Z,{onClick:x,disabled:h,children:"Cancel"}),(0,r.jsx)(w.Z,{onClick:()=>{c(""),l(""),d({message:i||void 0},{onSuccess:e=>{c(e.commitHash?"Backup pushed successfully (".concat(e.commitHash.substring(0,7),")"):"Backup pushed successfully"),setTimeout(()=>{x()},2e3)},onError:e=>{l("Failed to push backup: ".concat(e.message))}})},variant:"contained",disabled:h,startIcon:h?(0,r.jsx)(N.Z,{size:16}):(0,r.jsx)(O.Z,{}),children:h?"Pushing...":"Push"})]})]})]})}function P(){var e;let{data:n}=(0,m.mj)(),t=null!==(e=null==n?void 0:n.configured)&&void 0!==e&&e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.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,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,r.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"secondary.main",color:"secondary.contrastText"},children:(0,r.jsx)(u.Z,{sx:{fontSize:32}})}),(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(s.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Backups"}),(0,r.jsx)(s.Z,{variant:"body1",color:"text.secondary",children:"Manage world backups and restore points"})]})]}),(0,r.jsx)(L,{disabled:!t})]}),(0,r.jsxs)(a.Z,{spacing:3,children:[(0,r.jsx)(j,{}),t&&(0,r.jsx)(Q,{})]})]})}},42936:function(e,n,t){"use strict";async function r(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={...n.headers};n.body&&(t["Content-Type"]="application/json");let r=await fetch(e,{...n,headers:t});if(!r.ok){let e=await r.json().catch(()=>({error:"UnknownError",message:r.statusText})),n=Error(e.message);throw n.statusCode=r.status,n.code=e.error,n}return r.json()}t.d(n,{SC:function(){return r}})},92666:function(e,n,t){"use strict";t.d(n,{$t:function(){return S},Aw:function(){return d},Fv:function(){return f},Hq:function(){return u},Hy:function(){return c},MH:function(){return v},Sr:function(){return x},_I:function(){return h},c5:function(){return C},g2:function(){return j},gx:function(){return Z},hy:function(){return y},iC:function(){return p},jM:function(){return l},mj:function(){return b},nq:function(){return m},nv:function(){return g},s8:function(){return k},x$:function(){return a}});var r=t(5632),s=t(58919),i=t(20367),o=t(42936);function a(){return(0,r.a)({queryKey:["servers"],queryFn:()=>(0,o.SC)("/api/servers"),refetchInterval:6e4})}function c(e,n){return(0,r.a)({queryKey:["servers",e],queryFn:()=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e))),enabled:(null==n?void 0:n.enabled)!==!1&&!!e,refetchInterval:3e4})}function u(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{name:n,force:t}=e;return(0,o.SC)("/api/servers/".concat(encodeURIComponent(n)).concat(t?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["servers"]})}})}function l(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/start"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function d(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/stop"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function h(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/restart"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function x(){return(0,r.a)({queryKey:["worlds"],queryFn:()=>(0,o.SC)("/api/worlds"),refetchInterval:3e4})}function y(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/worlds",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function m(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{worldName:n,serverName:t}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n),"/assign"),{method:"POST",body:JSON.stringify({serverName:t})})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}function j(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{worldName:n,force:t}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n),"/release").concat(t?"?force=true":""),{method:"POST"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function f(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{name:n,force:t}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n)).concat(t?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function p(e,n){return(0,r.a)({queryKey:["servers",e,"config"],queryFn:()=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/config")),enabled:(null==n?void 0:n.enabled)!==!1&&!!e})}function v(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{serverName:n,config:t}=e;return(0,o.SC)("/api/servers/".concat(encodeURIComponent(n),"/config"),{method:"PATCH",body:JSON.stringify(t)})},onSuccess:(n,t)=>{let{serverName:r}=t;e.invalidateQueries({queryKey:["servers",r,"config"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function Z(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/world/reset"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers",t]}),e.invalidateQueries({queryKey:["worlds"]})}})}function g(){return(0,r.a)({queryKey:["router-status"],queryFn:()=>(0,o.SC)("/api/router/status"),refetchInterval:3e4})}function b(){return(0,r.a)({queryKey:["backup-status"],queryFn:()=>(0,o.SC)("/api/backup"),refetchInterval:6e4})}function S(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return(0,r.a)({queryKey:["backup-history",e],queryFn:()=>(0,o.SC)("/api/backup/history?limit=".concat(e)),refetchInterval:6e4})}function C(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{message:n}=e;return(0,o.SC)("/api/backup",{method:"POST",body:JSON.stringify({message:n})})},onSuccess:()=>{e.invalidateQueries({queryKey:["backup-status"]}),e.invalidateQueries({queryKey:["backup-history"]})}})}function k(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,o.SC)("/api/backup/restore",{method:"POST",body:JSON.stringify({commitHash:e})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,7359,880,9654,892,3669,2757,1744],function(){return e(e.s=1366)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2248],{12121:function(e,t,s){Promise.resolve().then(s.bind(s,61714))},61714:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return R}});var r=s(94655),i=s(69899),n=s(76492),a=s(7281),l=s(31317),o=s(84840),c=s(628),d=s(41565),x=s(10721),h=s(25065),m=s(91179),j=s(11767),u=s(53832),p=s(30164),Z=s(92666),g=s(59104);function f(e){let{title:t,value:s,icon:i,color:n="primary",description:o}=e,x={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:x[n]}},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)(l.Z,{variant:"body2",color:"text.secondary",sx:{fontWeight:500},children:t}),i&&(0,r.jsx)(a.Z,{sx:{color:x[n],opacity:.8},children:i})]}),(0,r.jsx)(l.Z,{variant:"h3",component:"div",sx:{fontWeight:700,color:"text.primary",mb:o?1:0},children:s}),o&&(0,r.jsx)(l.Z,{variant:"caption",color:"text.secondary",children:o})]})})}var v=s(98406),y=s(93017),b=s(25333),w=s(46725),C=s(8690),S=s(31358);function z(e){let{servers:t,statusMap:s={},isLoading:i,maxItems:n,showViewAll:o=!1,onServerClick:x}=e,h=(0,S.x)(),m=n?t.slice(0,n):t,j=e=>{x?x(e):h.push("/servers/".concat(e))},u=e=>{switch(e){case"running":return"success";case"stopped":case"exited":return"error";case"created":return"warning";default:return"default"}},p=e=>{switch(e){case"healthy":return"success";case"unhealthy":return"error";case"starting":return"warning";default:return"default"}};return i?(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(v.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)(y.Z,{})})})]}):0===t.length?(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(v.Z,{title:"Servers"}),(0,r.jsx)(d.Z,{children:(0,r.jsx)(l.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)(v.Z,{title:"Servers",action:o&&t.length>(n||0)?(0,r.jsxs)(w.default,{href:"/servers",onClick:()=>(0,C.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:m.map(e=>{let t=s[e.name],i=(null==t?void 0:t.status)||e.status,n=(null==t?void 0:t.health)||e.health;return(0,r.jsx)(a.Z,{role:"button",onClick:()=>j(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)(l.Z,{variant:"subtitle1",fontWeight:600,children:e.name}),(0,r.jsx)(l.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:i,color:u(i),size:"small"}),"none"!==n&&(0,r.jsx)(b.Z,{label:n,color:p(n),size:"small",variant:"outlined"})]})]})},e.name)})})})]})}var k=s(35106),P=s(41261);function A(e){let{maxVersions:t=2,title:s="Recent Updates"}=e,[i,n]=(0,k.useState)([]),[o,h]=(0,k.useState)(!0),[m,j]=(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 s=await e.json(),r=atob(s.content),i=function(e,t){let s=[],r=e.split("\n"),i=null,n="added";for(let e of r){let r=e.match(/^## \[([^\]]+)\] - (\d{4}-\d{2}-\d{2})/);if(r){if(i&&(s.push(i),s.length>=t))break;i={version:r[1],date:r[2],items:[]};continue}let a=e.match(/^### (Added|Fixed|Changed)/i);if(a){n=a[1].toLowerCase();continue}let l=e.match(/^- \*\*([^*]+)\*\*\s*[-–]?\s*(.*)$/);l&&i&&i.items.push({type:n,message:l[1].trim()})}return i&&s.length<t&&s.push(i),s}(r,t);n(i)}catch(e){j(e instanceof Error?e.message:"Unknown error")}finally{h(!1)}})()},[t]),o)?(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(v.Z,{title:s}),(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(x.Z,{variant:"text",width:"60%",height:28}),(0,r.jsx)(x.Z,{variant:"text",width:"80%"}),(0,r.jsx)(x.Z,{variant:"text",width:"70%"}),(0,r.jsxs)(a.Z,{sx:{mt:2},children:[(0,r.jsx)(x.Z,{variant:"text",width:"60%",height:28}),(0,r.jsx)(x.Z,{variant:"text",width:"75%"})]})]})]}):m?(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(v.Z,{title:s}),(0,r.jsx)(d.Z,{children:(0,r.jsx)(l.Z,{color:"text.secondary",align:"center",children:"Unable to load updates"})})]}):(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(v.Z,{title:s,action:(0,r.jsx)(P.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:i.map((e,t)=>{let s=e.items.filter(e=>"added"===e.type),n=e.items.filter(e=>"fixed"===e.type),o=e.items.filter(e=>"changed"===e.type);return(0,r.jsxs)(a.Z,{sx:{mb:t<i.length-1?2.5:0,pb:t<i.length-1?2:0,borderBottom:t<i.length-1?"1px solid":"none",borderColor:"divider"},children:[(0,r.jsxs)(l.Z,{variant:"subtitle2",sx:{fontWeight:600,color:"primary.main",mb:1},children:["[",e.version,"] - ",e.date]}),s.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}}),s.map((e,t)=>(0,r.jsxs)(l.Z,{variant:"body2",sx:{color:"text.secondary",pl:1},children:["• ",e.message]},t))]}),n.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}}),n.map((e,t)=>(0,r.jsxs)(l.Z,{variant:"body2",sx:{color:"text.secondary",pl:1},children:["• ",e.message]},t))]}),o.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}}),o.map((e,t)=>(0,r.jsxs)(l.Z,{variant:"body2",sx:{color:"text.secondary",pl:1},children:["• ",e.message]},t))]})]},e.version)})})]})}var I=s(30417),F=s(90158),T=s(58347),D=s(73424),E=s(95511),N=s(26577),W=s(56813),L=s(26892),M=s(84509);function O(e){var t;let{maxItems:s=5}=e,{data:i,isLoading:n,error:o}=(0,M.oL)(s),h=null!==(t=null==i?void 0:i.logs)&&void 0!==t?t:[];return(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(v.Z,{title:"Recent Activity",action:(0,r.jsx)(I.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:n?(0,r.jsx)(F.Z,{sx:{py:0},children:[...Array(s)].map((e,t)=>(0,r.jsx)(T.ZP,{sx:{px:0,py:1.5},children:(0,r.jsx)(D.Z,{primary:(0,r.jsxs)(a.Z,{sx:{display:"flex",gap:1},children:[(0,r.jsx)(x.Z,{variant:"rounded",width:60,height:24}),(0,r.jsx)(x.Z,{variant:"text",width:80}),(0,r.jsx)(x.Z,{variant:"text",width:60})]}),secondary:(0,r.jsx)(x.Z,{variant:"text",width:50})})},t))}):o?(0,r.jsx)(l.Z,{color:"text.secondary",align:"center",children:"Failed to load recent activity"}):0===h.length?(0,r.jsx)(l.Z,{color:"text.secondary",align:"center",sx:{py:2},children:"No recent activity"}):(0,r.jsx)(F.Z,{sx:{py:0},children:h.map(e=>{var t;return(0,r.jsx)(T.ZP,{sx:{px:0,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:(0,r.jsx)(D.Z,{primary:(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[(0,r.jsx)(W.I,{action:e.action,size:"small"}),(0,r.jsx)(l.Z,{variant:"body2",sx:{fontWeight:500},children:e.targetName}),(0,r.jsxs)(l.Z,{variant:"body2",color:"text.secondary",children:["by ",e.actor.replace("api:","").replace("cli:","")]}),"failure"===e.status&&(0,r.jsx)(L.c,{status:e.status,size:"small"})]}),secondary:(0,r.jsx)(E.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)(l.Z,{variant:"caption",component:"span",color:"text.disabled",children:function(e){let t=new Date,s=new Date(e),r=Math.floor((t.getTime()-s.getTime())/6e4),i=Math.floor(r/60);return r<1?"just now":r<60?"".concat(r,"m ago"):i<24?"".concat(i,"h ago"):"".concat(Math.floor(i/24),"d ago")}(e.timestamp)})})})},e.id)})})})]})}function R(){let{data:e,isLoading:t}=(0,Z.x$)(),{data:s,isLoading:v}=(0,Z.Sr)(),{statusMap:y}=(0,g.d)(),b=t||v,w=(null==e?void 0:e.total)||0,C=(null==e?void 0:e.servers.filter(e=>{let t=y[e.name];return"running"===((null==t?void 0:t.status)||e.status)}).length)||0,S=(null==s?void 0:s.total)||0;return b?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,n.Fq)(e.palette.secondary.main,.1)," 0%, ").concat((0,n.Fq)(e.palette.primary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,n.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)(l.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Dashboard"}),(0,r.jsx)(l.Z,{variant:"body1",color:"text.secondary",children:"Overview of your Minecraft server infrastructure"})]})]})}),(0,r.jsx)(o.ZP,{container:!0,spacing:3,sx:{mb:4},children:[0,1,2,3].map(e=>(0,r.jsx)(o.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)(x.Z,{variant:"text",width:"60%"}),(0,r.jsx)(x.Z,{variant:"circular",width:32,height:32})]}),(0,r.jsx)(x.Z,{variant:"text",width:"40%",height:48}),(0,r.jsx)(x.Z,{variant:"text",width:"70%"})]})})},e))}),(0,r.jsxs)(o.ZP,{container:!0,spacing:3,children:[(0,r.jsx)(o.ZP,{item:!0,xs:12,lg:7,children:(0,r.jsx)(c.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(x.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)(x.Z,{variant:"circular",width:10,height:10}),(0,r.jsx)(x.Z,{variant:"text",width:"25%"}),(0,r.jsx)(x.Z,{variant:"rounded",width:60,height:24,sx:{ml:"auto"}})]},e))]})})}),(0,r.jsx)(o.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)(x.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)(x.Z,{variant:"circular",width:24,height:24}),(0,r.jsxs)(a.Z,{sx:{flex:1},children:[(0,r.jsx)(x.Z,{variant:"text",width:"80%"}),(0,r.jsx)(x.Z,{variant:"text",width:"50%"})]})]},e))]})}),(0,r.jsx)(c.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(x.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)(x.Z,{variant:"text",width:"60%"}),(0,r.jsx)(x.Z,{variant:"text",width:"90%"})]},e))]})})]})})]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,n.Fq)(e.palette.secondary.main,.1)," 0%, ").concat((0,n.Fq)(e.palette.primary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,n.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)(l.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Dashboard"}),(0,r.jsx)(l.Z,{variant:"body1",color:"text.secondary",children:"Overview of your Minecraft server infrastructure"})]})]})}),(0,r.jsxs)(o.ZP,{container:!0,spacing:3,sx:{mb:4},children:[(0,r.jsx)(o.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,r.jsx)(f,{title:"Total Servers",value:w,icon:(0,r.jsx)(m.Z,{fontSize:"large"}),color:"primary",description:"All configured servers"})}),(0,r.jsx)(o.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,r.jsx)(f,{title:"Online Servers",value:C,icon:(0,r.jsx)(j.Z,{fontSize:"large"}),color:"success",description:"Currently running"})}),(0,r.jsx)(o.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,r.jsx)(f,{title:"Total Players",value:0,icon:(0,r.jsx)(u.Z,{fontSize:"large"}),color:"info",description:"Across all servers"})}),(0,r.jsx)(o.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,r.jsx)(f,{title:"Total Worlds",value:S,icon:(0,r.jsx)(p.Z,{fontSize:"large"}),color:"secondary",description:"Available worlds"})})]}),(0,r.jsxs)(o.ZP,{container:!0,spacing:3,children:[(0,r.jsx)(o.ZP,{item:!0,xs:12,lg:7,children:(0,r.jsx)(z,{servers:(null==e?void 0:e.servers)||[],statusMap:y,isLoading:t,maxItems:5,showViewAll:!0})}),(0,r.jsx)(o.ZP,{item:!0,xs:12,lg:5,children:(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,r.jsx)(O,{maxItems:5}),(0,r.jsx)(A,{maxVersions:2})]})})]})]})}},59104:function(e,t,s){"use strict";s.d(t,{d:function(){return n}});var r=s(35106),i=s(93757);function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onStatusChange:t,enabled:s=!0,reconnectInterval:n=3e3}=e,[a,l]=(0,r.useState)({}),o=(0,r.useCallback)(e=>{if("server-status"===e.type){let{serverName:s,status:r,health:i,timestamp:n}=e.data;l(e=>({...e,[s]:{status:r,health:i,timestamp:n}})),null==t||t(s,r,i)}},[t]),{isConnected:c,reconnect:d,retryCount:x}=(0,i.D)({url:"/api/sse/servers-status",onMessage:o,enabled:s,reconnectInterval:n}),h=(0,r.useCallback)(e=>a[e]||null,[a]);return(0,r.useEffect)(()=>{s||l({})},[s]),{statusMap:a,getServerStatus:h,isConnected:c,reconnect:d,retryCount:x}}}},function(e){e.O(0,[6812,9760,6758,1668,540,4416,9810,7073,55,8347,4597,2537,3669,2757,1744],function(){return e(e.s=12121)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2248],{12121:function(e,t,s){Promise.resolve().then(s.bind(s,61714))},61714:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return R}});var r=s(94655),i=s(69899),n=s(76492),a=s(7281),l=s(31317),o=s(84840),c=s(628),d=s(41565),x=s(10721),h=s(25065),m=s(91179),j=s(11767),u=s(53832),p=s(30164),Z=s(92666),g=s(59104);function f(e){let{title:t,value:s,icon:i,color:n="primary",description:o}=e,x={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:x[n]}},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)(l.Z,{variant:"body2",color:"text.secondary",sx:{fontWeight:500},children:t}),i&&(0,r.jsx)(a.Z,{sx:{color:x[n],opacity:.8},children:i})]}),(0,r.jsx)(l.Z,{variant:"h3",component:"div",sx:{fontWeight:700,color:"text.primary",mb:o?1:0},children:s}),o&&(0,r.jsx)(l.Z,{variant:"caption",color:"text.secondary",children:o})]})})}var v=s(98406),y=s(93017),b=s(25333),w=s(46725),C=s(8690),S=s(31358);function z(e){let{servers:t,statusMap:s={},isLoading:i,maxItems:n,showViewAll:o=!1,onServerClick:x}=e,h=(0,S.x)(),m=n?t.slice(0,n):t,j=e=>{x?x(e):h.push("/servers/".concat(e))},u=e=>{switch(e){case"running":return"success";case"stopped":case"exited":return"error";case"created":return"warning";default:return"default"}},p=e=>{switch(e){case"healthy":return"success";case"unhealthy":return"error";case"starting":return"warning";default:return"default"}};return i?(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(v.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)(y.Z,{})})})]}):0===t.length?(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(v.Z,{title:"Servers"}),(0,r.jsx)(d.Z,{children:(0,r.jsx)(l.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)(v.Z,{title:"Servers",action:o&&t.length>(n||0)?(0,r.jsxs)(w.default,{href:"/servers",onClick:()=>(0,C.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:m.map(e=>{let t=s[e.name],i=(null==t?void 0:t.status)||e.status,n=(null==t?void 0:t.health)||e.health;return(0,r.jsx)(a.Z,{role:"button",onClick:()=>j(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)(l.Z,{variant:"subtitle1",fontWeight:600,children:e.name}),(0,r.jsx)(l.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:i,color:u(i),size:"small"}),"none"!==n&&(0,r.jsx)(b.Z,{label:n,color:p(n),size:"small",variant:"outlined"})]})]})},e.name)})})})]})}var k=s(35106),P=s(41261);function A(e){let{maxVersions:t=2,title:s="Recent Updates"}=e,[i,n]=(0,k.useState)([]),[o,h]=(0,k.useState)(!0),[m,j]=(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 s=await e.json(),r=atob(s.content),i=function(e,t){let s=[],r=e.split("\n"),i=null,n="added";for(let e of r){let r=e.match(/^## \[([^\]]+)\] - (\d{4}-\d{2}-\d{2})/);if(r){if(i&&(s.push(i),s.length>=t))break;i={version:r[1],date:r[2],items:[]};continue}let a=e.match(/^### (Added|Fixed|Changed)/i);if(a){n=a[1].toLowerCase();continue}let l=e.match(/^- \*\*([^*]+)\*\*\s*[-–]?\s*(.*)$/);l&&i&&i.items.push({type:n,message:l[1].trim()})}return i&&s.length<t&&s.push(i),s}(r,t);n(i)}catch(e){j(e instanceof Error?e.message:"Unknown error")}finally{h(!1)}})()},[t]),o)?(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(v.Z,{title:s}),(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(x.Z,{variant:"text",width:"60%",height:28}),(0,r.jsx)(x.Z,{variant:"text",width:"80%"}),(0,r.jsx)(x.Z,{variant:"text",width:"70%"}),(0,r.jsxs)(a.Z,{sx:{mt:2},children:[(0,r.jsx)(x.Z,{variant:"text",width:"60%",height:28}),(0,r.jsx)(x.Z,{variant:"text",width:"75%"})]})]})]}):m?(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(v.Z,{title:s}),(0,r.jsx)(d.Z,{children:(0,r.jsx)(l.Z,{color:"text.secondary",align:"center",children:"Unable to load updates"})})]}):(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(v.Z,{title:s,action:(0,r.jsx)(P.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:i.map((e,t)=>{let s=e.items.filter(e=>"added"===e.type),n=e.items.filter(e=>"fixed"===e.type),o=e.items.filter(e=>"changed"===e.type);return(0,r.jsxs)(a.Z,{sx:{mb:t<i.length-1?2.5:0,pb:t<i.length-1?2:0,borderBottom:t<i.length-1?"1px solid":"none",borderColor:"divider"},children:[(0,r.jsxs)(l.Z,{variant:"subtitle2",sx:{fontWeight:600,color:"primary.main",mb:1},children:["[",e.version,"] - ",e.date]}),s.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}}),s.map((e,t)=>(0,r.jsxs)(l.Z,{variant:"body2",sx:{color:"text.secondary",pl:1},children:["• ",e.message]},t))]}),n.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}}),n.map((e,t)=>(0,r.jsxs)(l.Z,{variant:"body2",sx:{color:"text.secondary",pl:1},children:["• ",e.message]},t))]}),o.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}}),o.map((e,t)=>(0,r.jsxs)(l.Z,{variant:"body2",sx:{color:"text.secondary",pl:1},children:["• ",e.message]},t))]})]},e.version)})})]})}var I=s(30417),F=s(90158),T=s(58347),D=s(73424),E=s(95511),N=s(26577),W=s(56813),L=s(26892),M=s(84509);function O(e){var t;let{maxItems:s=5}=e,{data:i,isLoading:n,error:o}=(0,M.oL)(s),h=null!==(t=null==i?void 0:i.logs)&&void 0!==t?t:[];return(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(v.Z,{title:"Recent Activity",action:(0,r.jsx)(I.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:n?(0,r.jsx)(F.Z,{sx:{py:0},children:[...Array(s)].map((e,t)=>(0,r.jsx)(T.ZP,{sx:{px:0,py:1.5},children:(0,r.jsx)(D.Z,{primary:(0,r.jsxs)(a.Z,{sx:{display:"flex",gap:1},children:[(0,r.jsx)(x.Z,{variant:"rounded",width:60,height:24}),(0,r.jsx)(x.Z,{variant:"text",width:80}),(0,r.jsx)(x.Z,{variant:"text",width:60})]}),secondary:(0,r.jsx)(x.Z,{variant:"text",width:50})})},t))}):o?(0,r.jsx)(l.Z,{color:"text.secondary",align:"center",children:"Failed to load recent activity"}):0===h.length?(0,r.jsx)(l.Z,{color:"text.secondary",align:"center",sx:{py:2},children:"No recent activity"}):(0,r.jsx)(F.Z,{sx:{py:0},children:h.map(e=>{var t;return(0,r.jsx)(T.ZP,{sx:{px:0,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:(0,r.jsx)(D.Z,{primary:(0,r.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[(0,r.jsx)(W.I,{action:e.action,size:"small"}),(0,r.jsx)(l.Z,{variant:"body2",sx:{fontWeight:500},children:e.targetName}),(0,r.jsxs)(l.Z,{variant:"body2",color:"text.secondary",children:["by ",e.actor.replace("api:","").replace("cli:","")]}),"failure"===e.status&&(0,r.jsx)(L.c,{status:e.status,size:"small"})]}),secondary:(0,r.jsx)(E.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)(l.Z,{variant:"caption",component:"span",color:"text.disabled",children:function(e){let t=new Date,s=new Date(e),r=Math.floor((t.getTime()-s.getTime())/6e4),i=Math.floor(r/60);return r<1?"just now":r<60?"".concat(r,"m ago"):i<24?"".concat(i,"h ago"):"".concat(Math.floor(i/24),"d ago")}(e.timestamp)})})})},e.id)})})})]})}function R(){let{data:e,isLoading:t}=(0,Z.x$)(),{data:s,isLoading:v}=(0,Z.Sr)(),{statusMap:y}=(0,g.d)(),b=t||v,w=(null==e?void 0:e.total)||0,C=(null==e?void 0:e.servers.filter(e=>{let t=y[e.name];return"running"===((null==t?void 0:t.status)||e.status)}).length)||0,S=(null==s?void 0:s.total)||0;return b?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,n.Fq)(e.palette.secondary.main,.1)," 0%, ").concat((0,n.Fq)(e.palette.primary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,n.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)(l.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Dashboard"}),(0,r.jsx)(l.Z,{variant:"body1",color:"text.secondary",children:"Overview of your Minecraft server infrastructure"})]})]})}),(0,r.jsx)(o.ZP,{container:!0,spacing:3,sx:{mb:4},children:[0,1,2,3].map(e=>(0,r.jsx)(o.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)(x.Z,{variant:"text",width:"60%"}),(0,r.jsx)(x.Z,{variant:"circular",width:32,height:32})]}),(0,r.jsx)(x.Z,{variant:"text",width:"40%",height:48}),(0,r.jsx)(x.Z,{variant:"text",width:"70%"})]})})},e))}),(0,r.jsxs)(o.ZP,{container:!0,spacing:3,children:[(0,r.jsx)(o.ZP,{item:!0,xs:12,lg:7,children:(0,r.jsx)(c.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(x.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)(x.Z,{variant:"circular",width:10,height:10}),(0,r.jsx)(x.Z,{variant:"text",width:"25%"}),(0,r.jsx)(x.Z,{variant:"rounded",width:60,height:24,sx:{ml:"auto"}})]},e))]})})}),(0,r.jsx)(o.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)(x.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)(x.Z,{variant:"circular",width:24,height:24}),(0,r.jsxs)(a.Z,{sx:{flex:1},children:[(0,r.jsx)(x.Z,{variant:"text",width:"80%"}),(0,r.jsx)(x.Z,{variant:"text",width:"50%"})]})]},e))]})}),(0,r.jsx)(c.Z,{children:(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(x.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)(x.Z,{variant:"text",width:"60%"}),(0,r.jsx)(x.Z,{variant:"text",width:"90%"})]},e))]})})]})})]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,n.Fq)(e.palette.secondary.main,.1)," 0%, ").concat((0,n.Fq)(e.palette.primary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,n.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)(l.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Dashboard"}),(0,r.jsx)(l.Z,{variant:"body1",color:"text.secondary",children:"Overview of your Minecraft server infrastructure"})]})]})}),(0,r.jsxs)(o.ZP,{container:!0,spacing:3,sx:{mb:4},children:[(0,r.jsx)(o.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,r.jsx)(f,{title:"Total Servers",value:w,icon:(0,r.jsx)(m.Z,{fontSize:"large"}),color:"primary",description:"All configured servers"})}),(0,r.jsx)(o.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,r.jsx)(f,{title:"Online Servers",value:C,icon:(0,r.jsx)(j.Z,{fontSize:"large"}),color:"success",description:"Currently running"})}),(0,r.jsx)(o.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,r.jsx)(f,{title:"Total Players",value:0,icon:(0,r.jsx)(u.Z,{fontSize:"large"}),color:"info",description:"Across all servers"})}),(0,r.jsx)(o.ZP,{item:!0,xs:12,sm:6,md:3,children:(0,r.jsx)(f,{title:"Total Worlds",value:S,icon:(0,r.jsx)(p.Z,{fontSize:"large"}),color:"secondary",description:"Available worlds"})})]}),(0,r.jsxs)(o.ZP,{container:!0,spacing:3,children:[(0,r.jsx)(o.ZP,{item:!0,xs:12,lg:7,children:(0,r.jsx)(z,{servers:(null==e?void 0:e.servers)||[],statusMap:y,isLoading:t,maxItems:5,showViewAll:!0})}),(0,r.jsx)(o.ZP,{item:!0,xs:12,lg:5,children:(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,r.jsx)(O,{maxItems:5}),(0,r.jsx)(A,{maxVersions:2})]})})]})]})}},59104:function(e,t,s){"use strict";s.d(t,{d:function(){return n}});var r=s(35106),i=s(93757);function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onStatusChange:t,enabled:s=!0,reconnectInterval:n=3e3}=e,[a,l]=(0,r.useState)({}),o=(0,r.useCallback)(e=>{if("server-status"===e.type){let{serverName:s,status:r,health:i,timestamp:n}=e.data;l(e=>({...e,[s]:{status:r,health:i,timestamp:n}})),null==t||t(s,r,i)}},[t]),{isConnected:c,reconnect:d,retryCount:x}=(0,i.D)({url:"/api/sse/servers-status",onMessage:o,enabled:s,reconnectInterval:n}),h=(0,r.useCallback)(e=>a[e]||null,[a]);return(0,r.useEffect)(()=>{s||l({})},[s]),{statusMap:a,getServerStatus:h,isConnected:c,reconnect:d,retryCount:x}}}},function(e){e.O(0,[6812,9760,6758,1668,540,4416,521,5511,7359,55,8347,2777,2537,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,r,n){Promise.resolve().then(n.bind(n,79875))},397:function(e,r,n){"use strict";var t=n(8091);r.Z=void 0;var a=t(n(66758)),s=n(94655);r.Z=(0,a.default)((0,s.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block")},45813:function(e,r,n){"use strict";var t=n(8091);r.Z=void 0;var a=t(n(66758)),s=n(94655);r.Z=(0,a.default)((0,s.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Edit")},69366:function(e,r,n){"use strict";var t=n(8091);r.Z=void 0;var a=t(n(66758)),s=n(94655);r.Z=(0,a.default)((0,s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh")},65087:function(e,r,n){"use strict";n.d(r,{Z:function(){return j}});var t=n(32324),a=n(81500),s=n(35106),o=n(70316),i=n(65951),l=n(34519),c=n(15651),d=n(28057),u=n(31317),h=n(11379),p=n(9049);function y(e){return(0,p.ZP)("MuiDialogContentText",e)}(0,h.Z)("MuiDialogContentText",["root"]);var x=n(94655);let m=["children","className"],v=e=>{let{classes:r}=e,n=(0,i.Z)({root:["root"]},y,r);return(0,a.Z)({},r,n)},f=(0,l.ZP)(u.Z,{shouldForwardProp:e=>(0,c.Z)(e)||"classes"===e,name:"MuiDialogContentText",slot:"Root",overridesResolver:(e,r)=>r.root})({});var j=s.forwardRef(function(e,r){let n=(0,d.i)({props:e,name:"MuiDialogContentText"}),{className:s}=n,i=(0,t.Z)(n,m),l=v(i);return(0,x.jsx)(f,(0,a.Z)({component:"p",variant:"body1",color:"text.secondary",ref:r,ownerState:i,className:(0,o.Z)(l.root,s)},n,{classes:l}))})},73424:function(e,r,n){"use strict";var t=n(32324),a=n(81500),s=n(35106),o=n(70316),i=n(65951),l=n(31317),c=n(75084),d=n(28057),u=n(34519),h=n(64769),p=n(94655);let y=["children","className","disableTypography","inset","primary","primaryTypographyProps","secondary","secondaryTypographyProps"],x=e=>{let{classes:r,inset:n,primary:t,secondary:a,dense:s}=e;return(0,i.Z)({root:["root",n&&"inset",s&&"dense",t&&a&&"multiline"],primary:["primary"],secondary:["secondary"]},h.L,r)},m=(0,u.ZP)("div",{name:"MuiListItemText",slot:"Root",overridesResolver:(e,r)=>{let{ownerState:n}=e;return[{["& .".concat(h.Z.primary)]:r.primary},{["& .".concat(h.Z.secondary)]:r.secondary},r.root,n.inset&&r.inset,n.primary&&n.secondary&&r.multiline,n.dense&&r.dense]}})(e=>{let{ownerState:r}=e;return(0,a.Z)({flex:"1 1 auto",minWidth:0,marginTop:4,marginBottom:4},r.primary&&r.secondary&&{marginTop:6,marginBottom:6},r.inset&&{paddingLeft:56})}),v=s.forwardRef(function(e,r){let n=(0,d.i)({props:e,name:"MuiListItemText"}),{children:i,className:u,disableTypography:h=!1,inset:v=!1,primary:f,primaryTypographyProps:j,secondary:Z,secondaryTypographyProps:b}=n,g=(0,t.Z)(n,y),{dense:C}=s.useContext(c.Z),S=null!=f?f:i,w=Z,k=(0,a.Z)({},n,{disableTypography:h,inset:v,primary:!!S,secondary:!!w,dense:C}),I=x(k);return null==S||S.type===l.Z||h||(S=(0,p.jsx)(l.Z,(0,a.Z)({variant:C?"body2":"body1",className:I.primary,component:null!=j&&j.variant?void 0:"span",display:"block"},j,{children:S}))),null==w||w.type===l.Z||h||(w=(0,p.jsx)(l.Z,(0,a.Z)({variant:"body2",className:I.secondary,color:"text.secondary",display:"block"},b,{children:w}))),(0,p.jsxs)(m,(0,a.Z)({className:(0,o.Z)(I.root,u),ownerState:k,ref:r},g,{children:[S,w]}))});r.Z=v},64769:function(e,r,n){"use strict";n.d(r,{L:function(){return s}});var t=n(11379),a=n(9049);function s(e){return(0,a.ZP)("MuiListItemText",e)}let o=(0,t.Z)("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]);r.Z=o},79875:function(e,r,n){"use strict";n.r(r),n.d(r,{default:function(){return eC}});var t=n(94655),a=n(35106),s=n(7281),o=n(31317),i=n(84840),l=n(33402),c=n(60097),d=n(29793),u=n(75726),h=n(62328),p=n(7178),y=n(69899),x=n(76492),m=n(35847),v=n(628),f=n(41565),j=n(90158),Z=n(58347),b=n(73424),g=n(32324),C=n(81500),S=n(70316),w=n(65951),k=n(75084),I=n(34519),E=n(28057),F=n(11379),P=n(9049);function L(e){return(0,P.ZP)("MuiListItemAvatar",e)}(0,F.Z)("MuiListItemAvatar",["root","alignItemsFlexStart"]);let N=["className"],T=e=>{let{alignItems:r,classes:n}=e;return(0,w.Z)({root:["root","flex-start"===r&&"alignItemsFlexStart"]},L,n)},R=(0,I.ZP)("div",{name:"MuiListItemAvatar",slot:"Root",overridesResolver:(e,r)=>{let{ownerState:n}=e;return[r.root,"flex-start"===n.alignItems&&r.alignItemsFlexStart]}})(e=>{let{ownerState:r}=e;return(0,C.Z)({minWidth:56,flexShrink:0},"flex-start"===r.alignItems&&{marginTop:8})}),D=a.forwardRef(function(e,r){let n=(0,E.i)({props:e,name:"MuiListItemAvatar"}),{className:s}=n,o=(0,g.Z)(n,N),i=a.useContext(k.Z),l=(0,C.Z)({},n,{alignItems:i.alignItems}),c=T(l);return(0,t.jsx)(R,(0,C.Z)({className:(0,S.Z)(c.root,s),ownerState:l,ref:r},o))});var O=n(86702),q=n(79983),K=n(30417),A=n(25333),U=n(99770),M=n(62508),W=n(5682),B=n(65087),Q=n(76678),z=n(97436),J=n(93017),_=n(81071),H=n(66561),$=n(12795),G=n(96407),V=n(69366),Y=n(11597),X=n(81960),ee=n(30114);function er(e){let{onPlayerKicked:r}=e,[n,i]=(0,a.useState)(!0),[l,c]=(0,a.useState)(null),[d,u]=(0,a.useState)([]),[h,p]=(0,a.useState)(!1),[y,x]=(0,a.useState)(null),[m,g]=(0,a.useState)(""),[C,S]=(0,a.useState)(!1),w=(0,a.useCallback)(async()=>{i(!0),c(null);try{let e=await fetch("/api/players");if(!e.ok)throw Error("Failed to fetch players");let r=await e.json();u(r.servers)}catch(e){c("Failed to load players"),console.error("Error fetching players:",e)}finally{i(!1)}},[]);(0,a.useEffect)(()=>{w()},[w]);let k=(e,r)=>{x({player:e,server:r}),g(""),p(!0)},I=async()=>{if(y){S(!0);try{if(!(await fetch("/api/players/kick",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({player:y.player.name,server:y.server,reason:m||"Kicked by administrator"})})).ok)throw Error("Failed to kick player");p(!1),x(null),null==r||r(y.player,y.server),await w()}catch(e){console.error("Error kicking player:",e)}finally{S(!1)}}},E=d.some(e=>e.players.length>0);return(0,t.jsx)(v.Z,{"data-testid":"player-list",children:(0,t.jsxs)(f.Z,{children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(o.Z,{variant:"h6",children:"Online Players"}),(0,t.jsx)(q.Z,{onClick:w,disabled:n,"aria-label":"Refresh",children:(0,t.jsx)(V.Z,{})})]}),n&&(0,t.jsx)(s.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,t.jsx)(J.Z,{})}),l&&(0,t.jsx)(_.Z,{severity:"error",sx:{mb:2},children:l}),!n&&!l&&!E&&(0,t.jsx)(o.Z,{color:"text.secondary",sx:{textAlign:"center",py:4},children:"No players online"}),!n&&!l&&E&&(0,t.jsx)(s.Z,{children:d.map(e=>(0,t.jsxs)(H.Z,{defaultExpanded:e.players.length>0,children:[(0,t.jsx)($.Z,{expandIcon:(0,t.jsx)(X.Z,{}),children:(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:2,width:"100%"},children:[(0,t.jsx)(o.Z,{variant:"subtitle1",sx:{fontWeight:500},children:e.name}),(0,t.jsx)(A.Z,{label:"".concat(e.players.length," player").concat(1!==e.players.length?"s":""),size:"small",color:e.players.length>0?"success":"default"})]})}),(0,t.jsx)(G.Z,{children:0===e.players.length?(0,t.jsx)(o.Z,{color:"text.secondary",sx:{fontStyle:"italic"},children:"No players online on this server"}):(0,t.jsx)(j.Z,{dense:!0,children:e.players.map(r=>(0,t.jsxs)(Z.ZP,{secondaryAction:(0,t.jsx)(q.Z,{edge:"end","aria-label":"Kick player",onClick:()=>k(r,e.name),color:"error",children:(0,t.jsx)(Y.Z,{})}),children:[(0,t.jsx)(D,{children:(0,t.jsx)(O.Z,{src:"https://mc-heads.net/avatar/".concat(r.uuid,"/40"),alt:r.name,children:(0,t.jsx)(ee.Z,{})})}),(0,t.jsx)(b.Z,{primary:r.name,secondary:r.uuid.substring(0,8)+"..."})]},r.uuid))})})]},e.name))}),(0,t.jsxs)(U.Z,{open:h,onClose:()=>p(!1),children:[(0,t.jsx)(M.Z,{children:"Kick Player"}),(0,t.jsxs)(W.Z,{children:[(0,t.jsxs)(B.Z,{children:["Are you sure you want to kick ",null==y?void 0:y.player.name," from ",null==y?void 0:y.server,"?"]}),(0,t.jsx)(z.Z,{autoFocus:!0,margin:"dense",label:"Reason (optional)",fullWidth:!0,variant:"outlined",value:m,onChange:e=>g(e.target.value),placeholder:"Kicked by administrator"})]}),(0,t.jsxs)(Q.Z,{children:[(0,t.jsx)(K.Z,{onClick:()=>p(!1),disabled:C,children:"Cancel"}),(0,t.jsx)(K.Z,{onClick:I,color:"error",variant:"contained",disabled:C,"aria-label":"Confirm kick",children:C?(0,t.jsx)(J.Z,{size:20}):"Confirm"})]})]})]})})}var en=n(70115),et=n(21111),ea=n(47606);function es(e){let{serverName:r}=e,[n,i]=(0,a.useState)(!0),[l,c]=(0,a.useState)(null),[d,u]=(0,a.useState)([]),[h,p]=(0,a.useState)(),[y,x]=(0,a.useState)(""),[m,g]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),w=(0,a.useCallback)(async()=>{i(!0),c(null);try{let e=await fetch("/api/players/whitelist?server=".concat(encodeURIComponent(r)));if(!e.ok)throw Error("Failed to fetch whitelist");let n=await e.json();u(n.players),p(n.source)}catch(e){c("Failed to load whitelist"),console.error("Error fetching whitelist:",e)}finally{i(!1)}},[r]);(0,a.useEffect)(()=>{w()},[w]);let k=async()=>{if(y.trim()){g(!0),c(null);try{if(!(await fetch("/api/players/whitelist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({player:y.trim(),server:r})})).ok)throw Error("Failed to add player");x(""),await w()}catch(e){c("Failed to add player to whitelist"),console.error("Error adding player:",e)}finally{g(!1)}}},I=async e=>{S(e),c(null);try{if(!(await fetch("/api/players/whitelist?player=".concat(encodeURIComponent(e),"&server=").concat(encodeURIComponent(r)),{method:"DELETE"})).ok)throw Error("Failed to remove player");await w()}catch(e){c("Failed to remove player from whitelist"),console.error("Error removing player:",e)}finally{S(null)}};return(0,t.jsx)(v.Z,{"data-testid":"whitelist-manager",children:(0,t.jsxs)(f.Z,{children:[(0,t.jsx)(o.Z,{variant:"h6",gutterBottom:!0,children:"Whitelist"}),l&&(0,t.jsx)(_.Z,{severity:"error",sx:{mb:2},children:l}),!n&&h&&"rcon"!==h&&(0,t.jsxs)(_.Z,{severity:"info",sx:{mb:2},children:["Server is offline. Showing data from ","config"===h?"config.env":"whitelist.json",". Changes will apply on next server start."]}),(0,t.jsxs)(en.Z,{direction:"row",spacing:1,sx:{mb:2},children:[(0,t.jsx)(z.Z,{size:"small",placeholder:"Player name",value:y,onChange:e=>x(e.target.value),onKeyDown:e=>{"Enter"===e.key&&k()},disabled:m,fullWidth:!0}),(0,t.jsx)(K.Z,{variant:"contained",onClick:k,disabled:!y.trim()||m,startIcon:m?(0,t.jsx)(J.Z,{size:16}):(0,t.jsx)(ea.Z,{}),"aria-label":"Add player to whitelist",children:"Add"})]}),n&&(0,t.jsx)(s.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,t.jsx)(J.Z,{})}),!n&&0===d.length&&(0,t.jsx)(o.Z,{color:"text.secondary",sx:{textAlign:"center",py:4},children:"No players whitelisted"}),!n&&d.length>0&&(0,t.jsx)(j.Z,{dense:!0,children:d.map(e=>(0,t.jsxs)(Z.ZP,{secondaryAction:(0,t.jsx)(q.Z,{edge:"end","aria-label":"Remove from whitelist",onClick:()=>I(e.name),disabled:C===e.name,color:"error",children:C===e.name?(0,t.jsx)(J.Z,{size:20}):(0,t.jsx)(et.Z,{})}),children:[(0,t.jsx)(D,{children:(0,t.jsx)(O.Z,{src:e.uuid?"https://mc-heads.net/avatar/".concat(e.uuid,"/40"):void 0,alt:e.name,children:(0,t.jsx)(ee.Z,{})})}),(0,t.jsx)(b.Z,{primary:e.name,secondary:e.uuid?e.uuid.substring(0,8)+"...":"UUID not available"})]},e.uuid||e.name))})]})})}var eo=n(35694),ei=n(37809),el=n(407),ec=n(45813);let ed={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 eu(e){let{level:r,showIcon:n=!1,compact:a=!1,size:o="medium",variant:i="filled"}=e,l=ed[r];if(!l)return null;let c=a?r.toString():"Level ".concat(r," - ").concat(l.label),d=n?(0,t.jsx)(s.Z,{component:"span",sx:{mr:.5},children:l.icon}):void 0;return(0,t.jsx)(A.Z,{label:(0,t.jsxs)(t.Fragment,{children:[d,c]}),color:l.color,size:o,variant:i})}var eh=n(68038),ep=n(34080),ey=n(40064),ex=n(39181);let em=[{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 ev(e){let{value:r,onChange:n,label:a,disabled:i=!1}=e;return(0,t.jsxs)(d.Z,{component:"fieldset",fullWidth:!0,disabled:i,children:[a&&(0,t.jsx)(eh.Z,{component:"legend",sx:{mb:1},children:a}),(0,t.jsx)(ep.Z,{value:r,onChange:e=>{n(parseInt(e.target.value,10))},children:em.map(e=>(0,t.jsx)(ey.Z,{value:e.value,control:(0,t.jsx)(ex.Z,{}),label:(0,t.jsxs)(s.Z,{children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,t.jsx)(o.Z,{component:"span",children:e.icon}),(0,t.jsx)(o.Z,{component:"span",fontWeight:"medium",children:e.label})]}),(0,t.jsx)(o.Z,{variant:"body2",color:"text.secondary",sx:{ml:4},children:e.description})]}),sx:{alignItems:"flex-start",py:1}},e.value))})]})}function ef(e){let{serverName:r}=e,[n,i]=(0,a.useState)(!0),[l,c]=(0,a.useState)(null),[d,u]=(0,a.useState)([]),[h,y]=(0,a.useState)(),[x,m]=(0,a.useState)(""),[g,C]=(0,a.useState)(!1),[S,w]=(0,a.useState)(null),[k,I]=(0,a.useState)(!1),[E,F]=(0,a.useState)(4),[P,L]=(0,a.useState)(!1),[N,T]=(0,a.useState)(null),[R,A]=(0,a.useState)(4),[B,H]=(0,a.useState)(!1),[$,G]=(0,a.useState)(null),[V,Y]=(0,a.useState)(null),X=(0,a.useCallback)(async()=>{i(!0),c(null);try{let e=await fetch("/api/players/op?server=".concat(encodeURIComponent(r)));if(!e.ok)throw Error("Failed to fetch operators");let n=await e.json();u(n.operators),y(n.source)}catch(e){c("Failed to load operators"),console.error("Error fetching operators:",e)}finally{i(!1)}},[r]);(0,a.useEffect)(()=>{X()},[X]);let ee=async()=>{if(x.trim()){C(!0),c(null);try{if(!(await fetch("/api/players/op",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({player:x.trim(),server:r,level:E})})).ok)throw Error("Failed to add operator");m(""),F(4),I(!1),await X()}catch(e){c("Failed to add operator"),console.error("Error adding operator:",e)}finally{C(!1)}}},er=async e=>{w(e),c(null),G(null),Y(null);try{if(!(await fetch("/api/players/op?player=".concat(encodeURIComponent(e),"&server=").concat(encodeURIComponent(r)),{method:"DELETE"})).ok)throw Error("Failed to remove operator");await X()}catch(e){c("Failed to remove operator"),console.error("Error removing operator:",e)}finally{w(null)}},en=async()=>{if(N){H(!0),c(null);try{if(!(await fetch("/api/players/op/".concat(encodeURIComponent(N.name),"?server=").concat(encodeURIComponent(r)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({level:R})})).ok)throw Error("Failed to change operator level");L(!1),T(null),await X()}catch(e){c("Failed to change operator level"),console.error("Error changing operator level:",e)}finally{H(!1)}}},es=(e,r)=>{G(e.currentTarget),Y(r)},ed=()=>{G(null),Y(null)};return(0,t.jsxs)(v.Z,{"data-testid":"op-manager",children:[(0,t.jsxs)(f.Z,{children:[(0,t.jsx)(o.Z,{variant:"h6",gutterBottom:!0,children:"Operators"}),l&&(0,t.jsx)(_.Z,{severity:"error",sx:{mb:2},children:l}),!n&&h&&"rcon"!==h&&(0,t.jsxs)(_.Z,{severity:"info",sx:{mb:2},children:["Server is offline. Showing data from ","config"===h?"config.env":"ops.json",". Changes will apply on next server start."]}),(0,t.jsx)(s.Z,{sx:{mb:2},children:(0,t.jsx)(K.Z,{variant:"contained",onClick:()=>I(!0),startIcon:(0,t.jsx)(ea.Z,{}),"aria-label":"Add operator",fullWidth:!0,children:"Add Operator"})}),n&&(0,t.jsx)(s.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,t.jsx)(J.Z,{})}),!n&&0===d.length&&(0,t.jsx)(o.Z,{color:"text.secondary",sx:{textAlign:"center",py:4},children:"No operators configured"}),!n&&d.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Z,{dense:!0,children:d.map(e=>(0,t.jsxs)(Z.ZP,{secondaryAction:(0,t.jsx)(q.Z,{edge:"end","aria-label":"Operator actions",onClick:r=>es(r,e),disabled:S===e.name,children:S===e.name?(0,t.jsx)(J.Z,{size:20}):(0,t.jsx)(ei.Z,{})}),children:[(0,t.jsx)(D,{children:(0,t.jsx)(O.Z,{src:e.uuid?"https://mc-heads.net/avatar/".concat(e.uuid,"/40"):void 0,alt:e.name,sx:{bgcolor:"warning.main"},children:(0,t.jsx)(el.Z,{})})}),(0,t.jsx)(b.Z,{primary:(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[(0,t.jsx)(o.Z,{component:"span",children:e.name}),(0,t.jsx)(eu,{level:e.level,showIcon:!0,size:"small"})]}),secondary:e.uuid?e.uuid.substring(0,8)+"...":"UUID not available"})]},e.uuid||e.name))}),(0,t.jsxs)(eo.Z,{anchorEl:$,open:!!$,onClose:ed,children:[(0,t.jsxs)(p.Z,{onClick:()=>{V&&(T(V),A(V.level),L(!0),ed())},children:[(0,t.jsx)(ec.Z,{sx:{mr:1},fontSize:"small"}),"Change Level"]}),(0,t.jsxs)(p.Z,{onClick:()=>V&&er(V.name),children:[(0,t.jsx)(et.Z,{sx:{mr:1},fontSize:"small",color:"error"}),"Remove OP"]})]})]})]}),(0,t.jsxs)(U.Z,{open:k,onClose:()=>!g&&I(!1),maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(M.Z,{children:"Add Operator"}),(0,t.jsxs)(W.Z,{children:[(0,t.jsx)(z.Z,{autoFocus:!0,margin:"dense",label:"Player Name",placeholder:"Enter player name",fullWidth:!0,value:x,onChange:e=>m(e.target.value),disabled:g,sx:{mb:2}}),(0,t.jsx)(ev,{value:E,onChange:F,label:"OP Level",disabled:g})]}),(0,t.jsxs)(Q.Z,{children:[(0,t.jsx)(K.Z,{onClick:()=>I(!1),disabled:g,children:"Cancel"}),(0,t.jsx)(K.Z,{variant:"contained",onClick:ee,disabled:!x.trim()||g,startIcon:g?(0,t.jsx)(J.Z,{size:16}):void 0,children:g?"Adding...":"Add OP"})]})]}),(0,t.jsxs)(U.Z,{open:P,onClose:()=>!B&&L(!1),maxWidth:"sm",fullWidth:!0,children:[(0,t.jsxs)(M.Z,{children:["Change OP Level - ",null==N?void 0:N.name]}),(0,t.jsx)(W.Z,{children:N&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:["Current: Level ",N.level," (",N.role,")"]}),(0,t.jsx)(ev,{value:R,onChange:A,label:"New Level",disabled:B})]})}),(0,t.jsxs)(Q.Z,{children:[(0,t.jsx)(K.Z,{onClick:()=>L(!1),disabled:B,children:"Cancel"}),(0,t.jsx)(K.Z,{variant:"contained",onClick:en,disabled:B||R===(null==N?void 0:N.level),startIcon:B?(0,t.jsx)(J.Z,{size:16}):void 0,children:B?"Saving...":"Save Changes"})]})]})]})}var ej=n(397);function eZ(e){let{serverName:r}=e,[n,i]=(0,a.useState)(!0),[l,c]=(0,a.useState)(null),[d,u]=(0,a.useState)([]),[h,p]=(0,a.useState)(),[y,x]=(0,a.useState)(!1),[m,g]=(0,a.useState)({player:"",reason:""}),[C,S]=(0,a.useState)(!1),[w,k]=(0,a.useState)(null),I=(0,a.useCallback)(async()=>{i(!0),c(null);try{let e=await fetch("/api/players/ban?server=".concat(encodeURIComponent(r)));if(!e.ok)throw Error("Failed to fetch bans");let n=await e.json();u(n.players),p(n.source)}catch(e){c("Failed to load ban list"),console.error("Error fetching bans:",e)}finally{i(!1)}},[r]);(0,a.useEffect)(()=>{I()},[I]);let E=()=>{x(!1),g({player:"",reason:""})},F=async()=>{if(m.player.trim()){S(!0),c(null);try{if(!(await fetch("/api/players/ban",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({player:m.player.trim(),reason:m.reason.trim()||"Banned by administrator",server:r})})).ok)throw Error("Failed to ban player");E(),await I()}catch(e){c("Failed to ban player"),console.error("Error banning player:",e)}finally{S(!1)}}},P=async e=>{k(e),c(null);try{if(!(await fetch("/api/players/ban?player=".concat(encodeURIComponent(e),"&server=").concat(encodeURIComponent(r)),{method:"DELETE"})).ok)throw Error("Failed to unban player");await I()}catch(e){c("Failed to unban player"),console.error("Error unbanning player:",e)}finally{k(null)}},L=e=>{try{return new Date(e).toLocaleDateString()}catch(r){return e}};return(0,t.jsx)(v.Z,{"data-testid":"ban-manager",children:(0,t.jsxs)(f.Z,{children:[(0,t.jsxs)(s.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(o.Z,{variant:"h6",children:"Ban List"}),(0,t.jsx)(K.Z,{variant:"outlined",color:"error",startIcon:(0,t.jsx)(ej.Z,{}),onClick:()=>{g({player:"",reason:""}),x(!0)},"aria-label":"Ban player",children:"Ban Player"})]}),l&&(0,t.jsx)(_.Z,{severity:"error",sx:{mb:2},children:l}),!n&&h&&"rcon"!==h&&(0,t.jsxs)(_.Z,{severity:"info",sx:{mb:2},children:["Server is offline. Showing data from ","config"===h?"config.env":"banned-players.json",". Changes will apply on next server start."]}),n&&(0,t.jsx)(s.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,t.jsx)(J.Z,{})}),!n&&0===d.length&&(0,t.jsx)(o.Z,{color:"text.secondary",sx:{textAlign:"center",py:4},children:"No players banned"}),!n&&d.length>0&&(0,t.jsx)(j.Z,{dense:!0,children:d.map(e=>(0,t.jsxs)(Z.ZP,{secondaryAction:(0,t.jsx)(q.Z,{edge:"end","aria-label":"Unban player",onClick:()=>P(e.name),disabled:w===e.name,color:"success",children:w===e.name?(0,t.jsx)(J.Z,{size:20}):(0,t.jsx)(et.Z,{})}),children:[(0,t.jsx)(D,{children:(0,t.jsx)(O.Z,{src:e.uuid?"https://mc-heads.net/avatar/".concat(e.uuid,"/40"):void 0,alt:e.name,sx:{bgcolor:"error.main"},children:(0,t.jsx)(ee.Z,{})})}),(0,t.jsx)(b.Z,{primary:e.name,secondary:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{component:"span",variant:"body2",color:"text.secondary",children:["Reason: ",e.reason||"No reason specified"]}),(0,t.jsx)("br",{}),(0,t.jsxs)(o.Z,{component:"span",variant:"caption",color:"text.secondary",children:["Banned: ",L(e.created)," by ",e.source||"Unknown"]})]})})]},e.uuid||e.name))}),(0,t.jsxs)(U.Z,{open:y,onClose:E,maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(M.Z,{children:"Ban Player"}),(0,t.jsx)(W.Z,{children:(0,t.jsxs)(en.Z,{spacing:2,sx:{mt:1},children:[(0,t.jsx)(z.Z,{label:"Player Name",placeholder:"Enter player name",value:m.player,onChange:e=>g({...m,player:e.target.value}),fullWidth:!0,required:!0}),(0,t.jsx)(z.Z,{label:"Reason",placeholder:"Banned by administrator",value:m.reason,onChange:e=>g({...m,reason:e.target.value}),fullWidth:!0,multiline:!0,rows:2})]})}),(0,t.jsxs)(Q.Z,{children:[(0,t.jsx)(K.Z,{onClick:E,disabled:C,children:"Cancel"}),(0,t.jsx)(K.Z,{onClick:F,color:"error",variant:"contained",disabled:!m.player.trim()||C,startIcon:C?(0,t.jsx)(J.Z,{size:16}):(0,t.jsx)(ej.Z,{}),children:"Ban"})]})]})]})})}var eb=n(92666);function eg(e){let{children:r,value:n,index:a}=e;return(0,t.jsx)("div",{role:"tabpanel",hidden:n!==a,children:n===a&&(0,t.jsx)(s.Z,{sx:{py:3},children:r})})}function eC(){let[e,r]=(0,a.useState)(0),[n,v]=(0,a.useState)(""),{data:f,isLoading:j}=(0,eb.x$)(),Z=null==f?void 0:f.servers;return(0,a.useEffect)(()=>{!n&&Z&&Z.length>0&&v(Z[0].name)},[Z,n]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,x.Fq)(e.palette.info.main,.1)," 0%, ").concat((0,x.Fq)(e.palette.secondary.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,x.Fq)(e.palette.info.main,.2))},children:(0,t.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,t.jsx)(s.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"info.main",color:"info.contrastText"},children:(0,t.jsx)(m.Z,{sx:{fontSize:32}})}),(0,t.jsxs)(s.Z,{children:[(0,t.jsx)(o.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Player Management"}),(0,t.jsx)(o.Z,{variant:"body1",color:"text.secondary",children:"Manage players, whitelist, operators, and bans across your servers"})]})]})}),(0,t.jsx)(s.Z,{sx:{mb:3},children:(0,t.jsxs)(d.Z,{sx:{minWidth:200},children:[(0,t.jsx)(u.Z,{id:"server-select-label",children:"Server"}),(0,t.jsx)(h.Z,{labelId:"server-select-label",value:n,label:"Server",onChange:e=>v(e.target.value),disabled:j,children:null==Z?void 0:Z.map(e=>(0,t.jsx)(p.Z,{value:e.name,children:e.name},e.name))})]})}),(0,t.jsx)(s.Z,{sx:{borderBottom:1,borderColor:"divider"},children:(0,t.jsxs)(l.Z,{value:e,onChange:(e,n)=>{r(n)},"aria-label":"Player management tabs",children:[(0,t.jsx)(c.Z,{label:"Online Players"}),(0,t.jsx)(c.Z,{label:"Whitelist",disabled:!n}),(0,t.jsx)(c.Z,{label:"Operators",disabled:!n}),(0,t.jsx)(c.Z,{label:"Ban List",disabled:!n})]})}),(0,t.jsx)(eg,{value:e,index:0,children:(0,t.jsx)(er,{})}),(0,t.jsx)(eg,{value:e,index:1,children:n&&(0,t.jsxs)(i.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(i.ZP,{item:!0,xs:12,md:8,children:(0,t.jsx)(es,{serverName:n})}),(0,t.jsx)(i.ZP,{item:!0,xs:12,md:4,children:(0,t.jsxs)(s.Z,{sx:{p:2,bgcolor:"background.paper",borderRadius:1},children:[(0,t.jsx)(o.Z,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"About Whitelist"}),(0,t.jsx)(o.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,t.jsx)(eg,{value:e,index:2,children:n&&(0,t.jsxs)(i.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(i.ZP,{item:!0,xs:12,md:8,children:(0,t.jsx)(ef,{serverName:n})}),(0,t.jsx)(i.ZP,{item:!0,xs:12,md:4,children:(0,t.jsxs)(s.Z,{sx:{p:2,bgcolor:"background.paper",borderRadius:1},children:[(0,t.jsx)(o.Z,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"About Operators"}),(0,t.jsx)(o.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,t.jsxs)(s.Z,{sx:{mt:2},children:[(0,t.jsx)(o.Z,{variant:"caption",color:"text.secondary",component:"div",children:"Level 1: Can bypass spawn protection"}),(0,t.jsx)(o.Z,{variant:"caption",color:"text.secondary",component:"div",children:"Level 2: Can use /clear, /gamemode, etc."}),(0,t.jsx)(o.Z,{variant:"caption",color:"text.secondary",component:"div",children:"Level 3: Can use /ban, /kick, /op, etc."}),(0,t.jsx)(o.Z,{variant:"caption",color:"text.secondary",component:"div",children:"Level 4: Can use /stop, full access"})]})]})})]})}),(0,t.jsx)(eg,{value:e,index:3,children:n&&(0,t.jsxs)(i.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(i.ZP,{item:!0,xs:12,md:8,children:(0,t.jsx)(eZ,{serverName:n})}),(0,t.jsx)(i.ZP,{item:!0,xs:12,md:4,children:(0,t.jsxs)(s.Z,{sx:{p:2,bgcolor:"background.paper",borderRadius:1},children:[(0,t.jsx)(o.Z,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"About Bans"}),(0,t.jsx)(o.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."})]})})]})})]})}},42936:function(e,r,n){"use strict";async function t(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={...r.headers};r.body&&(n["Content-Type"]="application/json");let t=await fetch(e,{...r,headers:n});if(!t.ok){let e=await t.json().catch(()=>({error:"UnknownError",message:t.statusText})),r=Error(e.message);throw r.statusCode=t.status,r.code=e.error,r}return t.json()}n.d(r,{SC:function(){return t}})},92666:function(e,r,n){"use strict";n.d(r,{$t:function(){return C},Aw:function(){return u},Fv:function(){return v},Hq:function(){return c},Hy:function(){return l},MH:function(){return j},Sr:function(){return p},_I:function(){return h},c5:function(){return S},g2:function(){return m},gx:function(){return Z},hy:function(){return y},iC:function(){return f},jM:function(){return d},mj:function(){return g},nq:function(){return x},nv:function(){return b},s8:function(){return w},x$:function(){return i}});var t=n(5632),a=n(58919),s=n(20367),o=n(42936);function i(){return(0,t.a)({queryKey:["servers"],queryFn:()=>(0,o.SC)("/api/servers"),refetchInterval:6e4})}function l(e,r){return(0,t.a)({queryKey:["servers",e],queryFn:()=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e))),enabled:(null==r?void 0:r.enabled)!==!1&&!!e,refetchInterval:3e4})}function c(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>{let{name:r,force:n}=e;return(0,o.SC)("/api/servers/".concat(encodeURIComponent(r)).concat(n?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["servers"]})}})}function d(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/start"),{method:"POST"}),onSuccess:(r,n)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",n]})}})}function u(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/stop"),{method:"POST"}),onSuccess:(r,n)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",n]})}})}function h(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/restart"),{method:"POST"}),onSuccess:(r,n)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",n]})}})}function p(){return(0,t.a)({queryKey:["worlds"],queryFn:()=>(0,o.SC)("/api/worlds"),refetchInterval:3e4})}function y(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/worlds",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function x(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>{let{worldName:r,serverName:n}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(r),"/assign"),{method:"POST",body:JSON.stringify({serverName:n})})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}function m(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>{let{worldName:r,force:n}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(r),"/release").concat(n?"?force=true":""),{method:"POST"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function v(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>{let{name:r,force:n}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(r)).concat(n?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function f(e,r){return(0,t.a)({queryKey:["servers",e,"config"],queryFn:()=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/config")),enabled:(null==r?void 0:r.enabled)!==!1&&!!e})}function j(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>{let{serverName:r,config:n}=e;return(0,o.SC)("/api/servers/".concat(encodeURIComponent(r),"/config"),{method:"PATCH",body:JSON.stringify(n)})},onSuccess:(r,n)=>{let{serverName:t}=n;e.invalidateQueries({queryKey:["servers",t,"config"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function Z(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/world/reset"),{method:"POST"}),onSuccess:(r,n)=>{e.invalidateQueries({queryKey:["servers",n]}),e.invalidateQueries({queryKey:["worlds"]})}})}function b(){return(0,t.a)({queryKey:["router-status"],queryFn:()=>(0,o.SC)("/api/router/status"),refetchInterval:3e4})}function g(){return(0,t.a)({queryKey:["backup-status"],queryFn:()=>(0,o.SC)("/api/backup"),refetchInterval:6e4})}function C(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return(0,t.a)({queryKey:["backup-history",e],queryFn:()=>(0,o.SC)("/api/backup/history?limit=".concat(e)),refetchInterval:6e4})}function S(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>{let{message:r}=e;return(0,o.SC)("/api/backup",{method:"POST",body:JSON.stringify({message:r})})},onSuccess:()=>{e.invalidateQueries({queryKey:["backup-status"]}),e.invalidateQueries({queryKey:["backup-history"]})}})}function w(){let e=(0,a.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/backup/restore",{method:"POST",body:JSON.stringify({commitHash:e})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,521,7359,880,6857,8347,1658,5381,4474,8558,3669,2757,1744],function(){return e(e.s=31809)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[148],{61943:function(e,n,t){Promise.resolve().then(t.bind(t,34488))},34488:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return p}});var r=t(94655),i=t(7281),s=t(84840),o=t(31317),a=t(10721),u=t(81071),c=t(628),l=t(41565),d=t(69899),h=t(76492),x=t(29983),y=t(92666),f=t(11189);function v(e){let{rows:n}=e;return(0,r.jsx)(c.Z,{children:(0,r.jsxs)(l.Z,{children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[(0,r.jsx)(a.Z,{variant:"circular",width:24,height:24}),(0,r.jsx)(a.Z,{variant:"text",width:"50%",height:32})]}),[...Array(n)].map((e,n)=>(0,r.jsxs)(i.Z,{sx:{display:"flex",justifyContent:"space-between",py:.75},children:[(0,r.jsx)(a.Z,{variant:"text",width:"35%"}),(0,r.jsx)(a.Z,{variant:"text",width:"40%"})]},n))]})})}function m(){return(0,r.jsx)(c.Z,{sx:{height:"100%"},children:(0,r.jsxs)(l.Z,{children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[(0,r.jsx)(a.Z,{variant:"circular",width:24,height:24}),(0,r.jsx)(a.Z,{variant:"text",width:"40%",height:32}),(0,r.jsxs)(i.Z,{sx:{ml:"auto",display:"flex",gap:1},children:[(0,r.jsx)(a.Z,{variant:"rounded",width:70,height:24}),(0,r.jsx)(a.Z,{variant:"rounded",width:70,height:24})]})]}),(0,r.jsx)(a.Z,{variant:"text",width:"30%",sx:{mt:3,mb:1}}),[0,1].map(e=>(0,r.jsxs)(i.Z,{sx:{border:1,borderColor:"divider",p:2,"&:not(:last-child)":{borderBottom:0}},children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.5},children:[(0,r.jsx)(a.Z,{variant:"circular",width:10,height:10}),(0,r.jsx)(a.Z,{variant:"text",width:"25%"}),(0,r.jsx)(a.Z,{variant:"text",width:"15%"}),(0,r.jsx)(a.Z,{variant:"text",width:"10%",sx:{ml:"auto"}})]}),[0,1,2].map(e=>(0,r.jsx)(a.Z,{variant:"text",width:"70%",sx:{ml:2.5}},e))]},e))]})})}function p(){let{data:e,isLoading:n,error:t}=(0,y.nv)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,h.Fq)(e.palette.warning.main,.1)," 0%, ").concat((0,h.Fq)(e.palette.info.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,h.Fq)(e.palette.warning.main,.2))},children:(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,r.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"warning.main",color:"warning.contrastText"},children:(0,r.jsx)(x.Z,{sx:{fontSize:32}})}),(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(o.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Routing"}),(0,r.jsx)(o.Z,{variant:"body1",color:"text.secondary",children:"Server routing and network configuration"})]})]})}),t&&(0,r.jsxs)(u.Z,{severity:"error",sx:{mb:3},children:["Failed to load router status: ",t.message]}),n?(0,r.jsxs)(s.ZP,{container:!0,spacing:3,children:[(0,r.jsx)(s.ZP,{item:!0,xs:12,md:4,children:(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,r.jsx)(v,{rows:4}),(0,r.jsx)(v,{rows:4}),(0,r.jsx)(v,{rows:1})]})}),(0,r.jsx)(s.ZP,{item:!0,xs:12,md:8,children:(0,r.jsx)(m,{})})]}):(null==e?void 0:e.router)?(0,r.jsxs)(s.ZP,{container:!0,spacing:3,children:[(0,r.jsx)(s.ZP,{item:!0,xs:12,md:4,children:(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,r.jsx)(f.hI,{router:e.router}),(0,r.jsx)(f.SB,{router:e.router}),(0,r.jsx)(f.E4,{avahi:e.avahi})]})}),(0,r.jsx)(s.ZP,{item:!0,xs:12,md:8,children:(0,r.jsx)(f.Ik,{router:e.router})})]}):null]})}},42936:function(e,n,t){"use strict";async function r(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={...n.headers};n.body&&(t["Content-Type"]="application/json");let r=await fetch(e,{...n,headers:t});if(!r.ok){let e=await r.json().catch(()=>({error:"UnknownError",message:r.statusText})),n=Error(e.message);throw n.statusCode=r.status,n.code=e.error,n}return r.json()}t.d(n,{SC:function(){return r}})},92666:function(e,n,t){"use strict";t.d(n,{$t:function(){return C},Aw:function(){return d},Fv:function(){return m},Hq:function(){return c},Hy:function(){return u},MH:function(){return j},Sr:function(){return x},_I:function(){return h},c5:function(){return Z},g2:function(){return v},gx:function(){return g},hy:function(){return y},iC:function(){return p},jM:function(){return l},mj:function(){return w},nq:function(){return f},nv:function(){return S},s8:function(){return q},x$:function(){return a}});var r=t(5632),i=t(58919),s=t(20367),o=t(42936);function a(){return(0,r.a)({queryKey:["servers"],queryFn:()=>(0,o.SC)("/api/servers"),refetchInterval:6e4})}function u(e,n){return(0,r.a)({queryKey:["servers",e],queryFn:()=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e))),enabled:(null==n?void 0:n.enabled)!==!1&&!!e,refetchInterval:3e4})}function c(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>{let{name:n,force:t}=e;return(0,o.SC)("/api/servers/".concat(encodeURIComponent(n)).concat(t?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["servers"]})}})}function l(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/start"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function d(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/stop"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function h(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/restart"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function x(){return(0,r.a)({queryKey:["worlds"],queryFn:()=>(0,o.SC)("/api/worlds"),refetchInterval:3e4})}function y(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/worlds",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function f(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>{let{worldName:n,serverName:t}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n),"/assign"),{method:"POST",body:JSON.stringify({serverName:t})})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}function v(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>{let{worldName:n,force:t}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n),"/release").concat(t?"?force=true":""),{method:"POST"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function m(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>{let{name:n,force:t}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n)).concat(t?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function p(e,n){return(0,r.a)({queryKey:["servers",e,"config"],queryFn:()=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/config")),enabled:(null==n?void 0:n.enabled)!==!1&&!!e})}function j(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>{let{serverName:n,config:t}=e;return(0,o.SC)("/api/servers/".concat(encodeURIComponent(n),"/config"),{method:"PATCH",body:JSON.stringify(t)})},onSuccess:(n,t)=>{let{serverName:r}=t;e.invalidateQueries({queryKey:["servers",r,"config"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function g(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/world/reset"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers",t]}),e.invalidateQueries({queryKey:["worlds"]})}})}function S(){return(0,r.a)({queryKey:["router-status"],queryFn:()=>(0,o.SC)("/api/router/status"),refetchInterval:3e4})}function w(){return(0,r.a)({queryKey:["backup-status"],queryFn:()=>(0,o.SC)("/api/backup"),refetchInterval:6e4})}function C(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return(0,r.a)({queryKey:["backup-history",e],queryFn:()=>(0,o.SC)("/api/backup/history?limit=".concat(e)),refetchInterval:6e4})}function Z(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>{let{message:n}=e;return(0,o.SC)("/api/backup",{method:"POST",body:JSON.stringify({message:n})})},onSuccess:()=>{e.invalidateQueries({queryKey:["backup-status"]}),e.invalidateQueries({queryKey:["backup-history"]})}})}function q(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/backup/restore",{method:"POST",body:JSON.stringify({commitHash:e})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[148],{61943:function(e,n,t){Promise.resolve().then(t.bind(t,34488))},34488:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return p}});var r=t(94655),i=t(7281),s=t(84840),o=t(31317),a=t(10721),u=t(81071),c=t(628),l=t(41565),d=t(69899),h=t(76492),x=t(29983),y=t(92666),f=t(11189);function v(e){let{rows:n}=e;return(0,r.jsx)(c.Z,{children:(0,r.jsxs)(l.Z,{children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[(0,r.jsx)(a.Z,{variant:"circular",width:24,height:24}),(0,r.jsx)(a.Z,{variant:"text",width:"50%",height:32})]}),[...Array(n)].map((e,n)=>(0,r.jsxs)(i.Z,{sx:{display:"flex",justifyContent:"space-between",py:.75},children:[(0,r.jsx)(a.Z,{variant:"text",width:"35%"}),(0,r.jsx)(a.Z,{variant:"text",width:"40%"})]},n))]})})}function m(){return(0,r.jsx)(c.Z,{sx:{height:"100%"},children:(0,r.jsxs)(l.Z,{children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[(0,r.jsx)(a.Z,{variant:"circular",width:24,height:24}),(0,r.jsx)(a.Z,{variant:"text",width:"40%",height:32}),(0,r.jsxs)(i.Z,{sx:{ml:"auto",display:"flex",gap:1},children:[(0,r.jsx)(a.Z,{variant:"rounded",width:70,height:24}),(0,r.jsx)(a.Z,{variant:"rounded",width:70,height:24})]})]}),(0,r.jsx)(a.Z,{variant:"text",width:"30%",sx:{mt:3,mb:1}}),[0,1].map(e=>(0,r.jsxs)(i.Z,{sx:{border:1,borderColor:"divider",p:2,"&:not(:last-child)":{borderBottom:0}},children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.5},children:[(0,r.jsx)(a.Z,{variant:"circular",width:10,height:10}),(0,r.jsx)(a.Z,{variant:"text",width:"25%"}),(0,r.jsx)(a.Z,{variant:"text",width:"15%"}),(0,r.jsx)(a.Z,{variant:"text",width:"10%",sx:{ml:"auto"}})]}),[0,1,2].map(e=>(0,r.jsx)(a.Z,{variant:"text",width:"70%",sx:{ml:2.5}},e))]},e))]})})}function p(){let{data:e,isLoading:n,error:t}=(0,y.nv)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.Z,{elevation:0,sx:{mb:4,p:3,background:e=>"linear-gradient(135deg, ".concat((0,h.Fq)(e.palette.warning.main,.1)," 0%, ").concat((0,h.Fq)(e.palette.info.main,.1)," 100%)"),borderRadius:2,border:e=>"1px solid ".concat((0,h.Fq)(e.palette.warning.main,.2))},children:(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,r.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:56,height:56,borderRadius:2,bgcolor:"warning.main",color:"warning.contrastText"},children:(0,r.jsx)(x.Z,{sx:{fontSize:32}})}),(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(o.Z,{variant:"h4",component:"h1",fontWeight:"bold",children:"Routing"}),(0,r.jsx)(o.Z,{variant:"body1",color:"text.secondary",children:"Server routing and network configuration"})]})]})}),t&&(0,r.jsxs)(u.Z,{severity:"error",sx:{mb:3},children:["Failed to load router status: ",t.message]}),n?(0,r.jsxs)(s.ZP,{container:!0,spacing:3,children:[(0,r.jsx)(s.ZP,{item:!0,xs:12,md:4,children:(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,r.jsx)(v,{rows:4}),(0,r.jsx)(v,{rows:4}),(0,r.jsx)(v,{rows:1})]})}),(0,r.jsx)(s.ZP,{item:!0,xs:12,md:8,children:(0,r.jsx)(m,{})})]}):(null==e?void 0:e.router)?(0,r.jsxs)(s.ZP,{container:!0,spacing:3,children:[(0,r.jsx)(s.ZP,{item:!0,xs:12,md:4,children:(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,r.jsx)(f.hI,{router:e.router}),(0,r.jsx)(f.SB,{router:e.router}),(0,r.jsx)(f.E4,{avahi:e.avahi})]})}),(0,r.jsx)(s.ZP,{item:!0,xs:12,md:8,children:(0,r.jsx)(f.Ik,{router:e.router})})]}):null]})}},42936:function(e,n,t){"use strict";async function r(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={...n.headers};n.body&&(t["Content-Type"]="application/json");let r=await fetch(e,{...n,headers:t});if(!r.ok){let e=await r.json().catch(()=>({error:"UnknownError",message:r.statusText})),n=Error(e.message);throw n.statusCode=r.status,n.code=e.error,n}return r.json()}t.d(n,{SC:function(){return r}})},92666:function(e,n,t){"use strict";t.d(n,{$t:function(){return C},Aw:function(){return d},Fv:function(){return m},Hq:function(){return c},Hy:function(){return u},MH:function(){return j},Sr:function(){return x},_I:function(){return h},c5:function(){return Z},g2:function(){return v},gx:function(){return g},hy:function(){return y},iC:function(){return p},jM:function(){return l},mj:function(){return w},nq:function(){return f},nv:function(){return S},s8:function(){return q},x$:function(){return a}});var r=t(5632),i=t(58919),s=t(20367),o=t(42936);function a(){return(0,r.a)({queryKey:["servers"],queryFn:()=>(0,o.SC)("/api/servers"),refetchInterval:6e4})}function u(e,n){return(0,r.a)({queryKey:["servers",e],queryFn:()=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e))),enabled:(null==n?void 0:n.enabled)!==!1&&!!e,refetchInterval:3e4})}function c(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>{let{name:n,force:t}=e;return(0,o.SC)("/api/servers/".concat(encodeURIComponent(n)).concat(t?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["servers"]})}})}function l(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/start"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function d(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/stop"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function h(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/restart"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",t]})}})}function x(){return(0,r.a)({queryKey:["worlds"],queryFn:()=>(0,o.SC)("/api/worlds"),refetchInterval:3e4})}function y(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/worlds",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function f(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>{let{worldName:n,serverName:t}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n),"/assign"),{method:"POST",body:JSON.stringify({serverName:t})})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}function v(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>{let{worldName:n,force:t}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n),"/release").concat(t?"?force=true":""),{method:"POST"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function m(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>{let{name:n,force:t}=e;return(0,o.SC)("/api/worlds/".concat(encodeURIComponent(n)).concat(t?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function p(e,n){return(0,r.a)({queryKey:["servers",e,"config"],queryFn:()=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/config")),enabled:(null==n?void 0:n.enabled)!==!1&&!!e})}function j(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>{let{serverName:n,config:t}=e;return(0,o.SC)("/api/servers/".concat(encodeURIComponent(n),"/config"),{method:"PATCH",body:JSON.stringify(t)})},onSuccess:(n,t)=>{let{serverName:r}=t;e.invalidateQueries({queryKey:["servers",r,"config"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function g(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/servers/".concat(encodeURIComponent(e),"/world/reset"),{method:"POST"}),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["servers",t]}),e.invalidateQueries({queryKey:["worlds"]})}})}function S(){return(0,r.a)({queryKey:["router-status"],queryFn:()=>(0,o.SC)("/api/router/status"),refetchInterval:3e4})}function w(){return(0,r.a)({queryKey:["backup-status"],queryFn:()=>(0,o.SC)("/api/backup"),refetchInterval:6e4})}function C(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return(0,r.a)({queryKey:["backup-history",e],queryFn:()=>(0,o.SC)("/api/backup/history?limit=".concat(e)),refetchInterval:6e4})}function Z(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>{let{message:n}=e;return(0,o.SC)("/api/backup",{method:"POST",body:JSON.stringify({message:n})})},onSuccess:()=>{e.invalidateQueries({queryKey:["backup-status"]}),e.invalidateQueries({queryKey:["backup-history"]})}})}function q(){let e=(0,i.NL)();return(0,s.D)({mutationFn:e=>(0,o.SC)("/api/backup/restore",{method:"POST",body:JSON.stringify({commitHash:e})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,521,5511,2542,7359,9654,5381,4668,1189,3669,2757,1744],function(){return e(e.s=61943)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[278],{59616:function(e,r,s){Promise.resolve().then(s.bind(s,41517))},41517:function(e,r,s){"use strict";s.r(r),s.d(r,{default:function(){return eL}});var t=s(94655),n=s(35106),i=s(74228),a=s(31358),l=s(7281),o=s(30417),d=s(79983),c=s(81071),x=s(93017),h=s(10721),u=s(628),m=s(41565),p=s(31317),j=s(35694),g=s(7178),v=s(17820),Z=s(73424),f=s(99770),b=s(62508),y=s(5682),C=s(76678),w=s(97436),S=s(84840),R=s(76492),k=s(10117),I=s(5501),P=s(37809),z=s(21111),W=s(17978),F=s(89573),O=s(96292),A=s(33104),M=s(25333),T=s(52082),D=s(69123),E=s(71185),B=s(30165),N=s(97293),U=s(11259),L=s(66615),H=s(89161),q=s(34071),K=s(4405);function G(e){let{value:r,unit:s,label:n,icon:i,progress:a,progressMax:o,color:d="#1bd96a"}=e;return(0,t.jsxs)(u.Z,{"data-testid":"resource-stat-card",sx:{p:2.5,bgcolor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:3},children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:2},children:[(0,t.jsxs)(l.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)(l.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/o*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 _=s(163),J=s(73660),V=s(90158),Q=s(58347),Y=s(95511),$=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)(l.Z,{children:[void 0,void 0,void 0,void 0,void 0].map((e,r)=>(0,t.jsxs)(l.Z,{sx:{display:"flex",gap:2,py:1.5},children:[(0,t.jsx)(h.Z,{variant:"rounded",width:60,height:24}),(0,t.jsx)(h.Z,{variant:"text",width:"60%"}),(0,t.jsx)(h.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)(l.Z,{children:[(0,t.jsx)(V.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)(l.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)(Y.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)(l.Z,{sx:{mt:2,textAlign:"center"},children:(0,t.jsx)(o.Z,{component:$.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),el=s(40064),eo=s(38393),ed=s(37530),ec=s(5942),ex=s(84420),eh=s(46121),eu=s(84775),em=s(92666);function ep(e){var r,s;let{serverName:i,isRunning:a}=e,{data:d,isLoading:h}=(0,em.iC)(i),j=(0,em.MH)(),v=(0,em.gx)(),[Z,R]=(0,n.useState)({}),[k,I]=(0,n.useState)(!1),[P,z]=(0,n.useState)(!1),[W,F]=(0,n.useState)(!1),[O,A]=(0,n.useState)(""),[M,T]=(0,n.useState)({open:!1,message:"",severity:"info"});(0,n.useEffect)(()=>{(null==d?void 0:d.config)&&R(d.config)},[d]);let E=(e,r)=>{R(s=>({...s,[e]:r})),I(!0),("memory"===e||"useAikarFlags"===e)&&z(!0)},B=async()=>{try{let e=await j.mutateAsync({serverName:i,config:Z});T({open:!0,message:e.restartRequired?"Settings saved. Restart required for some changes to take effect.":"Settings saved successfully.",severity:e.restartRequired?"warning":"success"}),I(!1),z(!1)}catch(e){T({open:!0,message:e instanceof Error?e.message:"Failed to save settings",severity:"error"})}},N=async()=>{if("RESET"!==O){T({open:!0,message:"Please type RESET to confirm",severity:"warning"});return}try{await v.mutateAsync(i),T({open:!0,message:"World reset successfully",severity:"success"}),F(!1),A("")}catch(e){T({open:!0,message:e instanceof Error?e.message:"Failed to reset world",severity:"error"})}};return h?(0,t.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,t.jsx)(x.Z,{})}):(0,t.jsxs)(l.Z,{children:[P&&(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)(u.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)(D.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=>E("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=>E("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=>E("difficulty",e.target.value),children:[(0,t.jsx)(g.Z,{value:"peaceful",children:"Peaceful"}),(0,t.jsx)(g.Z,{value:"easy",children:"Easy"}),(0,t.jsx)(g.Z,{value:"normal",children:"Normal"}),(0,t.jsx)(g.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=>E("gameMode",e.target.value),children:[(0,t.jsx)(g.Z,{value:"survival",children:"Survival"}),(0,t.jsx)(g.Z,{value:"creative",children:"Creative"}),(0,t.jsx)(g.Z,{value:"adventure",children:"Adventure"}),(0,t.jsx)(g.Z,{value:"spectator",children:"Spectator"})]})]})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(el.Z,{control:(0,t.jsx)(eo.Z,{checked:null===(r=Z.pvp)||void 0===r||r,onChange:e=>E("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=>E("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=>E("spawnProtection",parseInt(e.target.value,10)),inputProps:{min:0,max:128}})})]})]})}),(0,t.jsx)(u.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)(D.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=>E("memory",e.target.value),helperText:"Format: 4G, 8G, etc."})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(el.Z,{control:(0,t.jsx)(eo.Z,{checked:null!==(s=Z.useAikarFlags)&&void 0!==s&&s,onChange:e=>E("useAikarFlags",e.target.checked)}),label:"Use Aikar's Flags (Optimized GC)"})})]})]})}),(0,t.jsx)(l.Z,{sx:{display:"flex",justifyContent:"flex-end",mb:3},children:(0,t.jsx)(o.Z,{variant:"contained",size:"large",startIcon:(0,t.jsx)(ec.Z,{}),onClick:B,disabled:!k||j.isPending,sx:{px:4},children:j.isPending?"Saving...":"Save Changes"})}),(0,t.jsx)(u.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)(D.Z,{sx:{mb:3}}),(0,t.jsxs)(l.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)(o.Z,{variant:"outlined",color:"error",startIcon:(0,t.jsx)(eu.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)(f.Z,{open:W,onClose:()=>F(!1),maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(b.Z,{children:(0,t.jsxs)(l.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)(y.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:O,onChange:e=>A(e.target.value),sx:{mt:3},autoFocus:!0})]}),(0,t.jsxs)(C.Z,{children:[(0,t.jsx)(o.Z,{onClick:()=>F(!1),children:"Cancel"}),(0,t.jsx)(o.Z,{variant:"contained",color:"error",onClick:N,disabled:"RESET"!==O||v.isPending,startIcon:v.isPending?(0,t.jsx)(x.Z,{size:16}):(0,t.jsx)(eh.Z,{}),children:v.isPending?"Resetting...":"Reset World"})]})]}),(0,t.jsx)(ed.Z,{open:M.open,autoHideDuration:6e3,onClose:()=>T({...M,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,t.jsx)(c.Z,{onClose:()=>T({...M,open:!1}),severity:M.severity,sx:{width:"100%"},children:M.message})})]})}var ej=s(86702),eg=s(47606),ev=s(407),eZ=s(56056),ef=s(28058),eb=s(11597),ey=s(59602);let eC={admin:{label:"Owner",color:"primary",variant:"filled"},manage:{label:"Operator",color:"info",variant:"outlined"},view:{label:"Viewer",color:"default",variant:"outlined"}};function ew(e){let{permission:r,size:s="medium"}=e,n=eC[r];return(0,t.jsx)(M.Z,{label:n.label,color:n.color,variant:n.variant,size:s})}var eS=s(99046),eR=s(68038),ek=s(34080),eI=s(39181),eP=s(5632),ez=s(58919),eW=s(20367),eF=s(42936);function eO(e){var r,s;let{open:i,onClose:a,serverId:d}=e,[h,u]=(0,n.useState)(""),[m,j]=(0,n.useState)(null),[g,v]=(0,n.useState)("view"),{data:Z,isLoading:S}=(s={enabled:i},(0,eP.a)({queryKey:["users","search",h],queryFn:()=>(0,eF.SC)("/api/users?q=".concat(encodeURIComponent(h))),enabled:(null==s?void 0:s.enabled)!==!1&&h.length>=2,staleTime:3e4})),R=function(){let e=(0,ez.NL)();return(0,eW.D)({mutationFn:e=>(0,eF.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"]})}})}(),k=(0,n.useMemo)(()=>{var e;return null!==(e=null==Z?void 0:Z.users)&&void 0!==e?e:[]},[Z]),I=()=>{u(""),j(null),v("view"),R.reset(),a()};return(0,t.jsxs)(f.Z,{open:i,onClose:I,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:3}},children:[(0,t.jsx)(b.Z,{sx:{fontWeight:600},children:"Add User Access"}),(0,t.jsxs)(y.Z,{sx:{display:"flex",flexDirection:"column",gap:3,pt:"8px !important"},children:[R.isError&&(0,t.jsx)(c.Z,{severity:"error",sx:{mb:1},children:(null===(r=R.error)||void 0===r?void 0:r.message)||"Failed to grant access"}),(0,t.jsx)(eS.Z,{options:k,getOptionLabel:e=>e.name||e.email,isOptionEqualToValue:(e,r)=>e.id===r.id,value:m,onChange:(e,r)=>j(r),inputValue:h,onInputChange:(e,r)=>u(r),loading:S,filterOptions:e=>e,noOptionsText:h.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,...o}=e;return(0,t.jsxs)(l.Z,{component:"li",...o,sx:{display:"flex",gap:1.5,py:1},children:[(0,t.jsx)(ej.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)(l.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)(eR.Z,{sx:{fontWeight:500,mb:1},children:"Permission Level"}),(0,t.jsxs)(ek.Z,{value:g,onChange:e=>v(e.target.value),children:[(0,t.jsx)(el.Z,{value:"view",control:(0,t.jsx)(eI.Z,{size:"small"}),label:(0,t.jsxs)(l.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)(el.Z,{value:"manage",control:(0,t.jsx)(eI.Z,{size:"small"}),label:(0,t.jsxs)(l.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)(el.Z,{value:"admin",control:(0,t.jsx)(eI.Z,{size:"small"}),label:(0,t.jsxs)(l.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)(o.Z,{onClick:I,color:"inherit",children:"Cancel"}),(0,t.jsx)(o.Z,{onClick:()=>{m&&R.mutate({userId:m.id,serverId:d,permission:g},{onSuccess:I})},variant:"contained",disabled:!m||R.isPending,sx:{borderRadius:2},children:R.isPending?"Adding...":"Add User"})]})]})}function eA(e){var r,s;let{serverId:i}=e,{data:a,isLoading:x,error:f}=(0,eP.a)({queryKey:["user-servers",i],queryFn:()=>(0,eF.SC)("/api/user-servers?serverId=".concat(encodeURIComponent(i))),enabled:!!i}),b=function(){let e=(0,ez.NL)();return(0,eW.D)({mutationFn:e=>{let{id:r,permission:s}=e;return(0,eF.SC)("/api/user-servers/".concat(encodeURIComponent(r)),{method:"PATCH",body:JSON.stringify({permission:s})})},onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),y=function(){let e=(0,ez.NL)();return(0,eW.D)({mutationFn:e=>(0,eF.SC)("/api/user-servers/".concat(encodeURIComponent(e)),{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),[C,w]=(0,n.useState)(!1),[S,R]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),z=(e,r)=>{R(e.currentTarget),I(r)},W=()=>{R(null),I(null)},F=e=>{if(!k||k.permission===e){W();return}b.mutate({id:k.id,permission:e},{onSettled:W})},O=null!==(r=null==a?void 0:a.users.filter(e=>"admin"===e.permission).length)&&void 0!==r?r:0,A=(null==k?void 0:k.permission)==="admin"&&O<=1;if(x)return(0,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(h.Z,{variant:"text",width:"30%",height:32}),(0,t.jsx)(h.Z,{variant:"rounded",width:120,height:36,sx:{borderRadius:2}})]}),(0,t.jsx)(D.Z,{sx:{mb:2}}),[0,1,2].map(e=>(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,borderBottom:"1px solid",borderColor:"divider"},children:[(0,t.jsx)(h.Z,{variant:"circular",width:40,height:40}),(0,t.jsxs)(l.Z,{sx:{flex:1},children:[(0,t.jsx)(h.Z,{variant:"text",width:"40%"}),(0,t.jsx)(h.Z,{variant:"text",width:"60%"})]}),(0,t.jsx)(h.Z,{variant:"rounded",width:80,height:28,sx:{borderRadius:10}}),(0,t.jsx)(h.Z,{variant:"circular",width:32,height:32})]},e))]})});if(f)return(0,t.jsxs)(c.Z,{severity:"error",children:["Failed to load access list: ",f.message]});let M=null!==(s=null==a?void 0:a.users)&&void 0!==s?s:[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(l.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)(o.Z,{variant:"contained",size:"small",startIcon:(0,t.jsx)(eg.Z,{}),onClick:()=>w(!0),sx:{borderRadius:2},children:"Add User"})]}),(0,t.jsx)(D.Z,{sx:{mb:1}}),0===M.length?(0,t.jsx)(l.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."})}):M.map(e=>{var r,s,n,i,a,o,c,x;return(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:[(0,t.jsx)(ej.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)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,noWrap:!0,children:(null===(o=e.user)||void 0===o?void 0:o.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)(ew,{permission:e.permission,size:"small"}),(0,t.jsx)(d.Z,{size:"small",onClick:r=>z(r,e),sx:{color:"text.secondary"},children:(0,t.jsx)(P.Z,{fontSize:"small"})})]},e.id)}),(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mt:2,pt:1},children:[(0,t.jsx)(ey.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)(j.Z,{anchorEl:S,open:!!S,onClose:W,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,children:[(0,t.jsxs)(g.Z,{onClick:()=>F("admin"),disabled:(null==k?void 0:k.permission)==="admin",children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(ev.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Owner"})]}),(0,t.jsxs)(g.Z,{onClick:()=>F("manage"),disabled:(null==k?void 0:k.permission)==="manage"||A,children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(eZ.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Operator"})]}),(0,t.jsxs)(g.Z,{onClick:()=>F("view"),disabled:(null==k?void 0:k.permission)==="view"||A,children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(ef.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Viewer"})]}),(0,t.jsx)(D.Z,{}),(0,t.jsxs)(g.Z,{onClick:()=>{k&&y.mutate(k.id,{onSettled:W})},disabled:A,sx:{color:"error.main"},children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(eb.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,t.jsx)(Z.Z,{children:"Remove Access"})]})]}),(0,t.jsx)(eO,{open:C,onClose:()=>w(!1),serverId:i})]})}let eM=["Overview","Activity","Content","Files","Backups","Access","Options"];function eT(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 eD(e){var r,s,i,a,c;let{server:x,onSendCommand:h}=e,[j,g]=(0,n.useState)("Overview"),[v,Z]=(0,n.useState)(""),[b,C]=(0,n.useState)(!0),[k,I]=(0,n.useState)(!1),P=(0,n.useRef)(null),{logs:z,isConnected:W}=(0,_.Y)({serverName:x.name}),F=(0,n.useMemo)(()=>z.filter(e=>!e.includes("RCON Listener")&&!e.includes("RCON Client")&&!e.includes("RconClient")),[z]);(0,n.useEffect)(()=>{P.current&&b&&(P.current.scrollTop=P.current.scrollHeight)},[F,b]);let O=async()=>{v.trim()&&h&&(await h(v.trim()),Z(""))},A=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)(l.Z,{children:[(0,t.jsx)(l.Z,{sx:{display:"flex",gap:.5,mb:3},children:eM.map(e=>(0,t.jsx)(o.Z,{onClick:()=>g(e),sx:{px:2,py:1,borderRadius:5,fontSize:14,fontWeight:500,textTransform:"none",bgcolor:j===e?"primary.main":"transparent",color:j===e?"#0a0e14":"text.secondary","&:hover":{bgcolor:j===e?"primary.main":(0,R.Fq)("#1bd96a",.1)}},children:e},e))}),(0,t.jsxs)(l.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, 1fr)"},gap:2,mb:2.5},children:[(0,t.jsx)(G,{value:"".concat(A.toFixed(2),"%"),unit:"/ 100%",label:"CPU usage",icon:(0,t.jsx)(B.Z,{sx:{fontSize:28}}),progress:A,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)(u.Z,{sx:{bgcolor:"background.paper",borderRadius:3,border:"1px solid",borderColor:"divider",overflow:"hidden"},children:[(0,t.jsxs)(l.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)(l.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)(l.Z,{sx:{position:"relative"},children:[(0,t.jsx)(l.Z,{ref:P,onScroll:()=>{if(!P.current)return;let{scrollTop:e,scrollHeight:r,clientHeight:s}=P.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=eT(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)(l.Z,{sx:{display:"flex",gap:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,t.jsxs)(l.Z,{component:"span",sx:{color:"#4a4d60"},children:["[",s.time,"]"]}),(0,t.jsxs)(l.Z,{component:"span",sx:{color:"#4a4d60"},children:["\xa0[",s.thread,"/",(0,t.jsx)(l.Z,{component:"span",sx:{color:"WARN"===s.level?"#e8a848":"#6b6e80"},children:s.level}),"]:\xa0"]}),(0,t.jsx)(l.Z,{component:"span",sx:{color:"WARN"===s.level?"#c4a45a":"#b4b6c4"},children:s.msg})]},r):(0,t.jsx)(l.Z,{sx:{color:"#b4b6c4"},children:eT(e)},r)})}),(0,t.jsx)(d.Z,{onClick:()=>I(!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)(L.Z,{sx:{fontSize:18}})}),!b&&(0,t.jsx)(d.Z,{onClick:()=>{P.current&&P.current.scrollTo({top:P.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)(H.Z,{sx:{fontSize:18}})})]}),(0,t.jsx)(l.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:v,onChange:e=>Z(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),O())},disabled:!W,InputProps:{startAdornment:(0,t.jsx)(T.Z,{position:"start",children:(0,t.jsx)(q.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"===j&&(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)(u.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)(D.Z,{sx:{mb:2}}),(0,t.jsx)(eE,{label:"Name",value:x.name}),(0,t.jsx)(eE,{label:"Container",value:x.container}),(0,t.jsx)(eE,{label:"Hostname",value:x.hostname}),(0,t.jsx)(eE,{label:"Type",value:x.type}),(0,t.jsx)(eE,{label:"Version",value:x.version}),(0,t.jsx)(eE,{label:"Memory",value:x.memory}),(0,t.jsx)(eE,{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)(u.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)(D.Z,{sx:{mb:2}}),x.players?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eE,{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)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:x.players.list.map(e=>(0,t.jsx)(M.Z,{label:e,size:"small"},e))})]})]}):(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",children:"Player information unavailable"})]})})})]}),"Activity"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(u.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)(D.Z,{sx:{mb:2}}),(0,t.jsx)(et,{serverName:x.name})]})})}),"Content"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"Content management coming soon"})}),"Files"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"File browser coming soon"})}),"Backups"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"Backup management coming soon"})}),"Access"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(eA,{serverId:x.name})}),"Options"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(ep,{serverName:x.name,isRunning:"running"===x.status})}),(0,t.jsxs)(f.Z,{open:k,onClose:()=>I(!1),maxWidth:"xl",fullWidth:!0,PaperProps:{sx:{height:"90vh",bgcolor:"background.paper"}},children:[(0,t.jsxs)(l.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:()=>I(!1),children:(0,t.jsx)(E.Z,{})})]}),(0,t.jsx)(y.Z,{sx:{p:0,display:"flex",flexDirection:"column"},children:(0,t.jsx)(J.K,{serverName:x.name})})]})]})}function eE(e){let{label:r,value:s}=e;return s?(0,t.jsxs)(l.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 eB=s(93757);function eN(){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 eU(){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 eL(){var e,r,s,M;let T=(0,i.useParams)(),D=(0,a.x)(),E=decodeURIComponent(T.name),{data:B,isLoading:N,error:U}=(0,em.Hy)(E),{status:L,health:H}=function(e){let{serverName:r,onStatusChange:s,enabled:t=!0,reconnectInterval:i=3e3}=e,[a,l]=(0,n.useState)(null),[o,d]=(0,n.useState)(null);(0,n.useEffect)(()=>{l(null),d(null)},[r]);let c=(0,n.useCallback)(e=>{if("server-status"===e.type){let r=e.data.status,t=e.data.health;l(r),d(t),null==s||s(r,t)}},[s]),{isConnected:x,reconnect:h,retryCount:u}=(0,eB.D)({url:"/api/sse/servers/".concat(encodeURIComponent(r),"/status"),onMessage:c,enabled:t,reconnectInterval:i});return{status:a,health:o,isConnected:x,reconnect:h,retryCount:u}}({serverName:E,enabled:!!E}),[q,K]=(0,n.useState)(null),[G,_]=(0,n.useState)(!1),[J,V]=(0,n.useState)(""),Q=(0,em.jM)(),Y=(0,em.Aw)(),$=(0,em._I)(),X=(0,em.Hq)(),ee=async()=>{try{await Q.mutateAsync(E)}catch(e){console.error("Failed to start server:",e)}},er=async()=>{try{await Y.mutateAsync(E)}catch(e){console.error("Failed to stop server:",e)}},es=async()=>{try{await $.mutateAsync(E)}catch(e){console.error("Failed to restart server:",e)}},et=async e=>{try{await fetch("/api/servers/".concat(encodeURIComponent(E),"/exec"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})})}catch(e){console.error("Failed to send command:",e)}},en=L||(null==B?void 0:B.server.status),ei=Q.isPending||Y.isPending||$.isPending,ea=null==B?void 0:B.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]}),Y.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to stop server: ",null===(r=Y.error)||void 0===r?void 0:r.message]}),$.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to restart server: ",null===(s=$.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===(M=X.error)||void 0===M?void 0:M.message]}),N?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,t.jsx)(h.Z,{variant:"rounded",width:64,height:64,sx:{borderRadius:3,flexShrink:0}}),(0,t.jsxs)(l.Z,{sx:{flex:1},children:[(0,t.jsx)(h.Z,{variant:"text",width:80,height:18,sx:{mb:.5}}),(0,t.jsx)(h.Z,{variant:"text",width:"40%",height:40}),(0,t.jsxs)(l.Z,{sx:{display:"flex",gap:2,mt:.75},children:[(0,t.jsx)(h.Z,{variant:"text",width:100}),(0,t.jsx)(h.Z,{variant:"text",width:60}),(0,t.jsx)(h.Z,{variant:"text",width:140}),(0,t.jsx)(h.Z,{variant:"text",width:50})]})]}),(0,t.jsxs)(l.Z,{sx:{display:"flex",gap:1,flexShrink:0},children:[(0,t.jsx)(h.Z,{variant:"rounded",width:90,height:40,sx:{borderRadius:2}}),(0,t.jsx)(h.Z,{variant:"rounded",width:36,height:36,sx:{borderRadius:2}})]})]}),(0,t.jsx)(l.Z,{sx:{display:"flex",gap:.5,mb:3},children:[80,70,65,50,65,65].map((e,r)=>(0,t.jsx)(h.Z,{variant:"rounded",width:e,height:36,sx:{borderRadius:5}},r))}),(0,t.jsx)(l.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)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1.5},children:[(0,t.jsx)(h.Z,{variant:"text",width:"50%"}),(0,t.jsx)(h.Z,{variant:"circular",width:28,height:28})]}),(0,t.jsx)(h.Z,{variant:"text",width:"60%",height:36}),(0,t.jsx)(h.Z,{variant:"rounded",width:"100%",height:6,sx:{borderRadius:3,mt:1}})]})},e))}),(0,t.jsxs)(u.Z,{sx:{borderRadius:3,border:"1px solid",borderColor:"divider"},children:[(0,t.jsxs)(l.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,t.jsx)(h.Z,{variant:"text",width:80,height:28}),(0,t.jsx)(h.Z,{variant:"circular",width:10,height:10})]}),(0,t.jsx)(h.Z,{variant:"rectangular",height:360,sx:{bgcolor:"#0a0a0a"}}),(0,t.jsx)(l.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,t.jsx)(h.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)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(h.Z,{variant:"text",width:"40%",height:28,sx:{mb:1}}),(0,t.jsx)(h.Z,{variant:"rectangular",height:1,sx:{mb:2}}),[0,1,2,3,4,5,6].map(e=>(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(h.Z,{variant:"text",width:"30%"}),(0,t.jsx)(h.Z,{variant:"text",width:"40%"})]},e))]})})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(h.Z,{variant:"text",width:"30%",height:28,sx:{mb:1}}),(0,t.jsx)(h.Z,{variant:"rectangular",height:1,sx:{mb:2}}),(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(h.Z,{variant:"text",width:"25%"}),(0,t.jsx)(h.Z,{variant:"text",width:"20%"})]})]})})})]})]}):ea?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,t.jsx)(l.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)(l.Z,{sx:{flex:1},children:[(0,t.jsxs)(p.Z,{onClick:()=>D.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)(k.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:E}),(0,t.jsxs)(l.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)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(W.Z,{sx:{fontSize:14}}),"Minecraft ",ea.version]}),(0,t.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.type&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(F.Z,{sx:{fontSize:14}}),ea.type]}),(0,t.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.hostname&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(O.Z,{sx:{fontSize:14}}),ea.hostname]}),(0,t.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(A.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)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1.25,flexShrink:0},children:[("stopped"===en||"exited"===en||"not_created"===en)&&(0,t.jsx)(o.Z,{variant:"contained",color:"success",startIcon:ei?(0,t.jsx)(x.Z,{size:16,color:"inherit"}):(0,t.jsx)(I.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)(o.Z,{variant:"outlined",startIcon:ei?(0,t.jsx)(x.Z,{size:16}):(0,t.jsx)(eN,{}),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,R.Fq)("#fff",.05)}},children:"Stop"}),(0,t.jsx)(o.Z,{variant:"contained",startIcon:ei?(0,t.jsx)(x.Z,{size:16,color:"inherit"}):(0,t.jsx)(eU,{}),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)(P.Z,{sx:{fontSize:18}})}),(0,t.jsx)(j.Z,{anchorEl:q,open:!!q,onClose:()=>K(null),children:(0,t.jsxs)(g.Z,{onClick:()=>{K(null),_(!0),V("")},sx:{color:"error.main"},children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(z.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,t.jsx)(Z.Z,{children:"Delete Server"})]})})]})]}),(0,t.jsx)(eD,{server:ea,onSendCommand:et})]}):(0,t.jsx)(c.Z,{severity:"warning",children:"Server not found"}),(0,t.jsxs)(f.Z,{open:G,onClose:()=>{_(!1),V("")},maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(b.Z,{children:"Delete Server"}),(0,t.jsxs)(y.Z,{children:[(0,t.jsxs)(p.Z,{sx:{mb:2},children:["This action cannot be undone. Type ",(0,t.jsx)("strong",{children:E})," to confirm deletion."]}),(0,t.jsx)(w.Z,{label:"Server name",value:J,onChange:e=>V(e.target.value),fullWidth:!0,autoFocus:!0})]}),(0,t.jsxs)(C.Z,{sx:{px:3,pb:2},children:[(0,t.jsx)(o.Z,{onClick:()=>{_(!1),V("")},children:"Cancel"}),(0,t.jsx)(o.Z,{variant:"contained",color:"error",onClick:()=>{J===E&&X.mutate({name:E,force:!0},{onSuccess:()=>{D.push("/servers")}})},disabled:J!==E||X.isPending,startIcon:X.isPending?(0,t.jsx)(x.Z,{size:16}):null,children:X.isPending?"Deleting...":"Delete"})]})]})]})}},73660:function(e,r,s){"use strict";s.d(r,{K:function(){return k}});var t=s(94655),n=s(35106),i=s(18844),a=s.n(i),l=s(7281),o=s(69899),d=s(97436),c=s(30417),x=s(90829),h=s(79983),u=s(31317),m=s(25333),p=s(40064),j=s(45547),g=s(70115),v=s(69123),Z=s(93017),f=s(11141),b=s(19127),y=s(69366),C=s(163);let w=[{label:"say",template:"say "},{label:"give",template:"give "},{label:"tp",template:"tp "},{label:"gamemode",template:"gamemode "}],S=new(a())({fg:"#aaa",bg:"#000",newline:!1,escapeXML:!0,colors:{0:"#000000",1:"#cc0000",2:"#4e9a06",3:"#c4a000",4:"#3465a4",5:"#75507b",6:"#06989a",7:"#d3d7cf",8:"#555753",9:"#ef2929",10:"#8ae234",11:"#fce94f",12:"#729fcf",13:"#ad7fa8",14:"#34e2e2",15:"#eeeeec"}}),R=(0,n.memo)(function(e){let{log:r}=e,s=(0,n.useMemo)(()=>(function(e){let r=e.replace(/\x1b\[\?[\d;]*[a-zA-Z]/g,"").replace(/\x1b\[[0-9;]*[KJH]/g,"").replace(/\x1b=/g,"").replace(/\[\?[\d;]*[a-zA-Z]/g,"").replace(/\[[0-9;]*[KJH]/g,"").replace(/\[m/g,"").replace(/\[(\d+)m/g,"\x1b[$1m").replace(/>\.\.\.\.\r?/g,"").replace(/\r/g,"");return S.toHtml(r)})(r),[r]);return(0,t.jsx)(l.Z,{sx:{py:.25,whiteSpace:"pre-wrap",wordBreak:"break-all","& span":{}},dangerouslySetInnerHTML:{__html:s}})});function k(e){let{serverName:r}=e,[s,i]=(0,n.useState)(""),[a,S]=(0,n.useState)([]),[k,I]=(0,n.useState)(-1),[P,z]=(0,n.useState)("ALL"),[W,F]=(0,n.useState)(!0),[O,A]=(0,n.useState)(!0),[M,T]=(0,n.useState)(!1),D=(0,n.useRef)(null),E=(0,n.useRef)(null),{logs:B,isConnected:N,clearLogs:U,reconnect:L,retryCount:H}=(0,C.Y)({serverName:r}),q=(0,n.useMemo)(()=>{let e=B;return O&&(e=e.filter(e=>!e.includes("RCON Listener")&&!e.includes("RCON Client")&&!e.includes("RconClient"))),"ALL"!==P&&(e=e.filter(e=>(e.includes("/ERROR]")||e.includes("/ERROR:")?"ERROR":e.includes("/WARN]")||e.includes("/WARN:")?"WARN":(e.includes("/INFO]")||e.includes("/INFO:"),"INFO"))===P)),e},[B,P,O]);(0,n.useEffect)(()=>{W&&E.current&&(E.current.scrollTop=E.current.scrollHeight)},[q,W]);let K=(0,n.useCallback)(async()=>{let e=s.trim();if(e&&!M){T(!0);try{S(r=>[...r,e]),I(-1),await fetch("/api/servers/".concat(encodeURIComponent(r),"/exec"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})}),i("")}catch(e){console.error("Failed to execute command:",e)}finally{T(!1)}}},[s,r,M]),G=(0,n.useCallback)(e=>{if("Enter"===e.key)e.preventDefault(),K();else if("ArrowUp"===e.key){if(e.preventDefault(),0===a.length)return;let r=-1===k?a.length-1:Math.max(0,k-1);I(r),i(a[r])}else if("ArrowDown"===e.key){if(e.preventDefault(),-1===k)return;let r=k+1;r>=a.length?(I(-1),i("")):(I(r),i(a[r]))}},[a,k,K]),_=(0,n.useCallback)(e=>{var r;i(e),null===(r=D.current)||void 0===r||r.focus()},[]),J=N?{text:"Connected",color:"success"}:H>0?{text:"Disconnected (Retry ".concat(H,")"),color:"warning"}:{text:"Disconnected",color:"error"};return(0,t.jsxs)(o.Z,{"data-testid":"server-console",sx:{display:"flex",flexDirection:"column",height:"100%",minHeight:400},children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1,borderBottom:1,borderColor:"divider"},children:[(0,t.jsxs)(g.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,t.jsx)(u.Z,{variant:"subtitle2",children:"Console"}),(0,t.jsx)(m.Z,{"data-testid":"connection-status",label:J.text,color:J.color,size:"small"})]}),(0,t.jsxs)(g.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,t.jsx)(x.Z,{size:"small",variant:"outlined",children:["ALL","INFO","WARN","ERROR"].map(e=>(0,t.jsx)(c.Z,{onClick:()=>z(e),variant:P===e?"contained":"outlined",children:e},e))}),(0,t.jsx)(p.Z,{control:(0,t.jsx)(j.Z,{checked:W,onChange:e=>F(e.target.checked),size:"small",inputProps:{"aria-label":"Auto-scroll"}}),label:"Auto-scroll"}),(0,t.jsx)(p.Z,{control:(0,t.jsx)(j.Z,{checked:O,onChange:e=>A(e.target.checked),size:"small",inputProps:{"aria-label":"Hide RCON"}}),label:"Hide RCON"}),(0,t.jsx)(h.Z,{size:"small",onClick:U,"aria-label":"Clear logs",title:"Clear logs",children:(0,t.jsx)(b.Z,{})}),!N&&(0,t.jsx)(c.Z,{size:"small",startIcon:(0,t.jsx)(y.Z,{}),onClick:L,"aria-label":"Reconnect",children:"Reconnect"})]})]}),(0,t.jsx)(l.Z,{ref:E,sx:{flex:1,overflow:"auto",bgcolor:"#1a1a1a",p:1,fontFamily:"monospace",fontSize:"0.85rem"},children:0===q.length?(0,t.jsx)(u.Z,{color:"text.secondary",sx:{textAlign:"center",py:4,color:"#666"},children:"Waiting for logs..."}):q.map((e,r)=>(0,t.jsx)(R,{log:e},r))}),(0,t.jsx)(v.Z,{}),(0,t.jsx)(l.Z,{sx:{px:2,py:1,bgcolor:"background.default"},children:(0,t.jsxs)(g.Z,{direction:"row",spacing:1,children:[(0,t.jsx)(u.Z,{variant:"caption",color:"text.secondary",sx:{alignSelf:"center"},children:"Quick:"}),w.map(e=>(0,t.jsx)(c.Z,{size:"small",variant:"outlined",onClick:()=>_(e.template),children:e.label},e.label))]})}),(0,t.jsx)(v.Z,{}),(0,t.jsxs)(l.Z,{sx:{display:"flex",p:1,gap:1},children:[(0,t.jsx)(d.Z,{inputRef:D,fullWidth:!0,size:"small",placeholder:"Enter command...",value:s,onChange:e=>i(e.target.value),onKeyDown:G,disabled:!N||M,InputProps:{sx:{fontFamily:"monospace"}}}),(0,t.jsx)(c.Z,{variant:"contained",onClick:K,disabled:!s.trim()||!N||M,startIcon:M?(0,t.jsx)(Z.Z,{size:16}):(0,t.jsx)(f.Z,{}),"aria-label":"Send command",children:"Send"})]})]})}},163:function(e,r,s){"use strict";s.d(r,{Y:function(){return i}});var t=s(35106),n=s(93757);function i(e){let{serverName:r,maxLines:s=500,enabled:i=!0,reconnectInterval:a=3e3}=e,[l,o]=(0,t.useState)([]);(0,t.useEffect)(()=>{o([])},[r]);let d=(0,t.useCallback)(e=>{let r;"server-log"===e.type?r=e.data.log:"log"in e&&"string"==typeof e.log&&(r=e.log),r&&o(e=>{let t=[...e,r];return t.length>s?t.slice(t.length-s):t})},[s]),{isConnected:c,reconnect:x,retryCount:h}=(0,n.D)({url:"/api/sse/servers/".concat(encodeURIComponent(r),"/logs"),onMessage:d,enabled:i,reconnectInterval:a});return{logs:l,isConnected:c,clearLogs:(0,t.useCallback)(()=>{o([])},[]),reconnect:x,retryCount:h}}}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,9810,7073,880,55,6857,8347,1658,1544,6727,6357,787,1721,3489,2537,3669,2757,1744],function(){return e(e.s=59616)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[278],{59616:function(e,r,s){Promise.resolve().then(s.bind(s,41517))},41517:function(e,r,s){"use strict";s.r(r),s.d(r,{default:function(){return eL}});var t=s(94655),n=s(35106),i=s(74228),a=s(31358),l=s(7281),o=s(30417),d=s(79983),c=s(81071),x=s(93017),h=s(10721),u=s(628),m=s(41565),p=s(31317),j=s(35694),g=s(7178),v=s(17820),Z=s(73424),f=s(99770),b=s(62508),y=s(5682),C=s(76678),w=s(97436),S=s(84840),R=s(76492),k=s(10117),I=s(5501),P=s(37809),z=s(21111),W=s(17978),F=s(89573),O=s(96292),A=s(33104),M=s(25333),T=s(52082),D=s(69123),E=s(71185),B=s(30165),N=s(97293),U=s(11259),L=s(66615),H=s(89161),q=s(34071),K=s(4405);function G(e){let{value:r,unit:s,label:n,icon:i,progress:a,progressMax:o,color:d="#1bd96a"}=e;return(0,t.jsxs)(u.Z,{"data-testid":"resource-stat-card",sx:{p:2.5,bgcolor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:3},children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:2},children:[(0,t.jsxs)(l.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)(l.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/o*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 _=s(163),J=s(73660),V=s(90158),Q=s(58347),Y=s(95511),$=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)(l.Z,{children:[void 0,void 0,void 0,void 0,void 0].map((e,r)=>(0,t.jsxs)(l.Z,{sx:{display:"flex",gap:2,py:1.5},children:[(0,t.jsx)(h.Z,{variant:"rounded",width:60,height:24}),(0,t.jsx)(h.Z,{variant:"text",width:"60%"}),(0,t.jsx)(h.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)(l.Z,{children:[(0,t.jsx)(V.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)(l.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)(Y.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)(l.Z,{sx:{mt:2,textAlign:"center"},children:(0,t.jsx)(o.Z,{component:$.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),el=s(40064),eo=s(38393),ed=s(37530),ec=s(5942),ex=s(84420),eh=s(46121),eu=s(84775),em=s(92666);function ep(e){var r,s;let{serverName:i,isRunning:a}=e,{data:d,isLoading:h}=(0,em.iC)(i),j=(0,em.MH)(),v=(0,em.gx)(),[Z,R]=(0,n.useState)({}),[k,I]=(0,n.useState)(!1),[P,z]=(0,n.useState)(!1),[W,F]=(0,n.useState)(!1),[O,A]=(0,n.useState)(""),[M,T]=(0,n.useState)({open:!1,message:"",severity:"info"});(0,n.useEffect)(()=>{(null==d?void 0:d.config)&&R(d.config)},[d]);let E=(e,r)=>{R(s=>({...s,[e]:r})),I(!0),("memory"===e||"useAikarFlags"===e)&&z(!0)},B=async()=>{try{let e=await j.mutateAsync({serverName:i,config:Z});T({open:!0,message:e.restartRequired?"Settings saved. Restart required for some changes to take effect.":"Settings saved successfully.",severity:e.restartRequired?"warning":"success"}),I(!1),z(!1)}catch(e){T({open:!0,message:e instanceof Error?e.message:"Failed to save settings",severity:"error"})}},N=async()=>{if("RESET"!==O){T({open:!0,message:"Please type RESET to confirm",severity:"warning"});return}try{await v.mutateAsync(i),T({open:!0,message:"World reset successfully",severity:"success"}),F(!1),A("")}catch(e){T({open:!0,message:e instanceof Error?e.message:"Failed to reset world",severity:"error"})}};return h?(0,t.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,t.jsx)(x.Z,{})}):(0,t.jsxs)(l.Z,{children:[P&&(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)(u.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)(D.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=>E("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=>E("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=>E("difficulty",e.target.value),children:[(0,t.jsx)(g.Z,{value:"peaceful",children:"Peaceful"}),(0,t.jsx)(g.Z,{value:"easy",children:"Easy"}),(0,t.jsx)(g.Z,{value:"normal",children:"Normal"}),(0,t.jsx)(g.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=>E("gameMode",e.target.value),children:[(0,t.jsx)(g.Z,{value:"survival",children:"Survival"}),(0,t.jsx)(g.Z,{value:"creative",children:"Creative"}),(0,t.jsx)(g.Z,{value:"adventure",children:"Adventure"}),(0,t.jsx)(g.Z,{value:"spectator",children:"Spectator"})]})]})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(el.Z,{control:(0,t.jsx)(eo.Z,{checked:null===(r=Z.pvp)||void 0===r||r,onChange:e=>E("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=>E("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=>E("spawnProtection",parseInt(e.target.value,10)),inputProps:{min:0,max:128}})})]})]})}),(0,t.jsx)(u.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)(D.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=>E("memory",e.target.value),helperText:"Format: 4G, 8G, etc."})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(el.Z,{control:(0,t.jsx)(eo.Z,{checked:null!==(s=Z.useAikarFlags)&&void 0!==s&&s,onChange:e=>E("useAikarFlags",e.target.checked)}),label:"Use Aikar's Flags (Optimized GC)"})})]})]})}),(0,t.jsx)(l.Z,{sx:{display:"flex",justifyContent:"flex-end",mb:3},children:(0,t.jsx)(o.Z,{variant:"contained",size:"large",startIcon:(0,t.jsx)(ec.Z,{}),onClick:B,disabled:!k||j.isPending,sx:{px:4},children:j.isPending?"Saving...":"Save Changes"})}),(0,t.jsx)(u.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)(D.Z,{sx:{mb:3}}),(0,t.jsxs)(l.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)(o.Z,{variant:"outlined",color:"error",startIcon:(0,t.jsx)(eu.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)(f.Z,{open:W,onClose:()=>F(!1),maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(b.Z,{children:(0,t.jsxs)(l.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)(y.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:O,onChange:e=>A(e.target.value),sx:{mt:3},autoFocus:!0})]}),(0,t.jsxs)(C.Z,{children:[(0,t.jsx)(o.Z,{onClick:()=>F(!1),children:"Cancel"}),(0,t.jsx)(o.Z,{variant:"contained",color:"error",onClick:N,disabled:"RESET"!==O||v.isPending,startIcon:v.isPending?(0,t.jsx)(x.Z,{size:16}):(0,t.jsx)(eh.Z,{}),children:v.isPending?"Resetting...":"Reset World"})]})]}),(0,t.jsx)(ed.Z,{open:M.open,autoHideDuration:6e3,onClose:()=>T({...M,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,t.jsx)(c.Z,{onClose:()=>T({...M,open:!1}),severity:M.severity,sx:{width:"100%"},children:M.message})})]})}var ej=s(86702),eg=s(47606),ev=s(407),eZ=s(56056),ef=s(28058),eb=s(11597),ey=s(59602);let eC={admin:{label:"Owner",color:"primary",variant:"filled"},manage:{label:"Operator",color:"info",variant:"outlined"},view:{label:"Viewer",color:"default",variant:"outlined"}};function ew(e){let{permission:r,size:s="medium"}=e,n=eC[r];return(0,t.jsx)(M.Z,{label:n.label,color:n.color,variant:n.variant,size:s})}var eS=s(99046),eR=s(68038),ek=s(34080),eI=s(39181),eP=s(5632),ez=s(58919),eW=s(20367),eF=s(42936);function eO(e){var r,s;let{open:i,onClose:a,serverId:d}=e,[h,u]=(0,n.useState)(""),[m,j]=(0,n.useState)(null),[g,v]=(0,n.useState)("view"),{data:Z,isLoading:S}=(s={enabled:i},(0,eP.a)({queryKey:["users","search",h],queryFn:()=>(0,eF.SC)("/api/users?q=".concat(encodeURIComponent(h))),enabled:(null==s?void 0:s.enabled)!==!1&&h.length>=2,staleTime:3e4})),R=function(){let e=(0,ez.NL)();return(0,eW.D)({mutationFn:e=>(0,eF.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"]})}})}(),k=(0,n.useMemo)(()=>{var e;return null!==(e=null==Z?void 0:Z.users)&&void 0!==e?e:[]},[Z]),I=()=>{u(""),j(null),v("view"),R.reset(),a()};return(0,t.jsxs)(f.Z,{open:i,onClose:I,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:3}},children:[(0,t.jsx)(b.Z,{sx:{fontWeight:600},children:"Add User Access"}),(0,t.jsxs)(y.Z,{sx:{display:"flex",flexDirection:"column",gap:3,pt:"8px !important"},children:[R.isError&&(0,t.jsx)(c.Z,{severity:"error",sx:{mb:1},children:(null===(r=R.error)||void 0===r?void 0:r.message)||"Failed to grant access"}),(0,t.jsx)(eS.Z,{options:k,getOptionLabel:e=>e.name||e.email,isOptionEqualToValue:(e,r)=>e.id===r.id,value:m,onChange:(e,r)=>j(r),inputValue:h,onInputChange:(e,r)=>u(r),loading:S,filterOptions:e=>e,noOptionsText:h.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,...o}=e;return(0,t.jsxs)(l.Z,{component:"li",...o,sx:{display:"flex",gap:1.5,py:1},children:[(0,t.jsx)(ej.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)(l.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)(eR.Z,{sx:{fontWeight:500,mb:1},children:"Permission Level"}),(0,t.jsxs)(ek.Z,{value:g,onChange:e=>v(e.target.value),children:[(0,t.jsx)(el.Z,{value:"view",control:(0,t.jsx)(eI.Z,{size:"small"}),label:(0,t.jsxs)(l.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)(el.Z,{value:"manage",control:(0,t.jsx)(eI.Z,{size:"small"}),label:(0,t.jsxs)(l.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)(el.Z,{value:"admin",control:(0,t.jsx)(eI.Z,{size:"small"}),label:(0,t.jsxs)(l.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)(o.Z,{onClick:I,color:"inherit",children:"Cancel"}),(0,t.jsx)(o.Z,{onClick:()=>{m&&R.mutate({userId:m.id,serverId:d,permission:g},{onSuccess:I})},variant:"contained",disabled:!m||R.isPending,sx:{borderRadius:2},children:R.isPending?"Adding...":"Add User"})]})]})}function eA(e){var r,s;let{serverId:i}=e,{data:a,isLoading:x,error:f}=(0,eP.a)({queryKey:["user-servers",i],queryFn:()=>(0,eF.SC)("/api/user-servers?serverId=".concat(encodeURIComponent(i))),enabled:!!i}),b=function(){let e=(0,ez.NL)();return(0,eW.D)({mutationFn:e=>{let{id:r,permission:s}=e;return(0,eF.SC)("/api/user-servers/".concat(encodeURIComponent(r)),{method:"PATCH",body:JSON.stringify({permission:s})})},onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),y=function(){let e=(0,ez.NL)();return(0,eW.D)({mutationFn:e=>(0,eF.SC)("/api/user-servers/".concat(encodeURIComponent(e)),{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),[C,w]=(0,n.useState)(!1),[S,R]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),z=(e,r)=>{R(e.currentTarget),I(r)},W=()=>{R(null),I(null)},F=e=>{if(!k||k.permission===e){W();return}b.mutate({id:k.id,permission:e},{onSettled:W})},O=null!==(r=null==a?void 0:a.users.filter(e=>"admin"===e.permission).length)&&void 0!==r?r:0,A=(null==k?void 0:k.permission)==="admin"&&O<=1;if(x)return(0,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(h.Z,{variant:"text",width:"30%",height:32}),(0,t.jsx)(h.Z,{variant:"rounded",width:120,height:36,sx:{borderRadius:2}})]}),(0,t.jsx)(D.Z,{sx:{mb:2}}),[0,1,2].map(e=>(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,borderBottom:"1px solid",borderColor:"divider"},children:[(0,t.jsx)(h.Z,{variant:"circular",width:40,height:40}),(0,t.jsxs)(l.Z,{sx:{flex:1},children:[(0,t.jsx)(h.Z,{variant:"text",width:"40%"}),(0,t.jsx)(h.Z,{variant:"text",width:"60%"})]}),(0,t.jsx)(h.Z,{variant:"rounded",width:80,height:28,sx:{borderRadius:10}}),(0,t.jsx)(h.Z,{variant:"circular",width:32,height:32})]},e))]})});if(f)return(0,t.jsxs)(c.Z,{severity:"error",children:["Failed to load access list: ",f.message]});let M=null!==(s=null==a?void 0:a.users)&&void 0!==s?s:[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(l.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)(o.Z,{variant:"contained",size:"small",startIcon:(0,t.jsx)(eg.Z,{}),onClick:()=>w(!0),sx:{borderRadius:2},children:"Add User"})]}),(0,t.jsx)(D.Z,{sx:{mb:1}}),0===M.length?(0,t.jsx)(l.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."})}):M.map(e=>{var r,s,n,i,a,o,c,x;return(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:[(0,t.jsx)(ej.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)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,noWrap:!0,children:(null===(o=e.user)||void 0===o?void 0:o.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)(ew,{permission:e.permission,size:"small"}),(0,t.jsx)(d.Z,{size:"small",onClick:r=>z(r,e),sx:{color:"text.secondary"},children:(0,t.jsx)(P.Z,{fontSize:"small"})})]},e.id)}),(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mt:2,pt:1},children:[(0,t.jsx)(ey.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)(j.Z,{anchorEl:S,open:!!S,onClose:W,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,children:[(0,t.jsxs)(g.Z,{onClick:()=>F("admin"),disabled:(null==k?void 0:k.permission)==="admin",children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(ev.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Owner"})]}),(0,t.jsxs)(g.Z,{onClick:()=>F("manage"),disabled:(null==k?void 0:k.permission)==="manage"||A,children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(eZ.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Operator"})]}),(0,t.jsxs)(g.Z,{onClick:()=>F("view"),disabled:(null==k?void 0:k.permission)==="view"||A,children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(ef.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Viewer"})]}),(0,t.jsx)(D.Z,{}),(0,t.jsxs)(g.Z,{onClick:()=>{k&&y.mutate(k.id,{onSettled:W})},disabled:A,sx:{color:"error.main"},children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(eb.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,t.jsx)(Z.Z,{children:"Remove Access"})]})]}),(0,t.jsx)(eO,{open:C,onClose:()=>w(!1),serverId:i})]})}let eM=["Overview","Activity","Content","Files","Backups","Access","Options"];function eT(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 eD(e){var r,s,i,a,c;let{server:x,onSendCommand:h}=e,[j,g]=(0,n.useState)("Overview"),[v,Z]=(0,n.useState)(""),[b,C]=(0,n.useState)(!0),[k,I]=(0,n.useState)(!1),P=(0,n.useRef)(null),{logs:z,isConnected:W}=(0,_.Y)({serverName:x.name}),F=(0,n.useMemo)(()=>z.filter(e=>!e.includes("RCON Listener")&&!e.includes("RCON Client")&&!e.includes("RconClient")),[z]);(0,n.useEffect)(()=>{P.current&&b&&(P.current.scrollTop=P.current.scrollHeight)},[F,b]);let O=async()=>{v.trim()&&h&&(await h(v.trim()),Z(""))},A=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)(l.Z,{children:[(0,t.jsx)(l.Z,{sx:{display:"flex",gap:.5,mb:3},children:eM.map(e=>(0,t.jsx)(o.Z,{onClick:()=>g(e),sx:{px:2,py:1,borderRadius:5,fontSize:14,fontWeight:500,textTransform:"none",bgcolor:j===e?"primary.main":"transparent",color:j===e?"#0a0e14":"text.secondary","&:hover":{bgcolor:j===e?"primary.main":(0,R.Fq)("#1bd96a",.1)}},children:e},e))}),(0,t.jsxs)(l.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, 1fr)"},gap:2,mb:2.5},children:[(0,t.jsx)(G,{value:"".concat(A.toFixed(2),"%"),unit:"/ 100%",label:"CPU usage",icon:(0,t.jsx)(B.Z,{sx:{fontSize:28}}),progress:A,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)(u.Z,{sx:{bgcolor:"background.paper",borderRadius:3,border:"1px solid",borderColor:"divider",overflow:"hidden"},children:[(0,t.jsxs)(l.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)(l.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)(l.Z,{sx:{position:"relative"},children:[(0,t.jsx)(l.Z,{ref:P,onScroll:()=>{if(!P.current)return;let{scrollTop:e,scrollHeight:r,clientHeight:s}=P.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=eT(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)(l.Z,{sx:{display:"flex",gap:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,t.jsxs)(l.Z,{component:"span",sx:{color:"#4a4d60"},children:["[",s.time,"]"]}),(0,t.jsxs)(l.Z,{component:"span",sx:{color:"#4a4d60"},children:["\xa0[",s.thread,"/",(0,t.jsx)(l.Z,{component:"span",sx:{color:"WARN"===s.level?"#e8a848":"#6b6e80"},children:s.level}),"]:\xa0"]}),(0,t.jsx)(l.Z,{component:"span",sx:{color:"WARN"===s.level?"#c4a45a":"#b4b6c4"},children:s.msg})]},r):(0,t.jsx)(l.Z,{sx:{color:"#b4b6c4"},children:eT(e)},r)})}),(0,t.jsx)(d.Z,{onClick:()=>I(!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)(L.Z,{sx:{fontSize:18}})}),!b&&(0,t.jsx)(d.Z,{onClick:()=>{P.current&&P.current.scrollTo({top:P.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)(H.Z,{sx:{fontSize:18}})})]}),(0,t.jsx)(l.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:v,onChange:e=>Z(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),O())},disabled:!W,InputProps:{startAdornment:(0,t.jsx)(T.Z,{position:"start",children:(0,t.jsx)(q.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"===j&&(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)(u.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)(D.Z,{sx:{mb:2}}),(0,t.jsx)(eE,{label:"Name",value:x.name}),(0,t.jsx)(eE,{label:"Container",value:x.container}),(0,t.jsx)(eE,{label:"Hostname",value:x.hostname}),(0,t.jsx)(eE,{label:"Type",value:x.type}),(0,t.jsx)(eE,{label:"Version",value:x.version}),(0,t.jsx)(eE,{label:"Memory",value:x.memory}),(0,t.jsx)(eE,{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)(u.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)(D.Z,{sx:{mb:2}}),x.players?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eE,{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)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:x.players.list.map(e=>(0,t.jsx)(M.Z,{label:e,size:"small"},e))})]})]}):(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",children:"Player information unavailable"})]})})})]}),"Activity"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(u.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)(D.Z,{sx:{mb:2}}),(0,t.jsx)(et,{serverName:x.name})]})})}),"Content"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"Content management coming soon"})}),"Files"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"File browser coming soon"})}),"Backups"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"Backup management coming soon"})}),"Access"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(eA,{serverId:x.name})}),"Options"===j&&(0,t.jsx)(l.Z,{sx:{mt:3},children:(0,t.jsx)(ep,{serverName:x.name,isRunning:"running"===x.status})}),(0,t.jsxs)(f.Z,{open:k,onClose:()=>I(!1),maxWidth:"xl",fullWidth:!0,PaperProps:{sx:{height:"90vh",bgcolor:"background.paper"}},children:[(0,t.jsxs)(l.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:()=>I(!1),children:(0,t.jsx)(E.Z,{})})]}),(0,t.jsx)(y.Z,{sx:{p:0,display:"flex",flexDirection:"column"},children:(0,t.jsx)(J.K,{serverName:x.name})})]})]})}function eE(e){let{label:r,value:s}=e;return s?(0,t.jsxs)(l.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 eB=s(93757);function eN(){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 eU(){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 eL(){var e,r,s,M;let T=(0,i.useParams)(),D=(0,a.x)(),E=decodeURIComponent(T.name),{data:B,isLoading:N,error:U}=(0,em.Hy)(E),{status:L,health:H}=function(e){let{serverName:r,onStatusChange:s,enabled:t=!0,reconnectInterval:i=3e3}=e,[a,l]=(0,n.useState)(null),[o,d]=(0,n.useState)(null);(0,n.useEffect)(()=>{l(null),d(null)},[r]);let c=(0,n.useCallback)(e=>{if("server-status"===e.type){let r=e.data.status,t=e.data.health;l(r),d(t),null==s||s(r,t)}},[s]),{isConnected:x,reconnect:h,retryCount:u}=(0,eB.D)({url:"/api/sse/servers/".concat(encodeURIComponent(r),"/status"),onMessage:c,enabled:t,reconnectInterval:i});return{status:a,health:o,isConnected:x,reconnect:h,retryCount:u}}({serverName:E,enabled:!!E}),[q,K]=(0,n.useState)(null),[G,_]=(0,n.useState)(!1),[J,V]=(0,n.useState)(""),Q=(0,em.jM)(),Y=(0,em.Aw)(),$=(0,em._I)(),X=(0,em.Hq)(),ee=async()=>{try{await Q.mutateAsync(E)}catch(e){console.error("Failed to start server:",e)}},er=async()=>{try{await Y.mutateAsync(E)}catch(e){console.error("Failed to stop server:",e)}},es=async()=>{try{await $.mutateAsync(E)}catch(e){console.error("Failed to restart server:",e)}},et=async e=>{try{await fetch("/api/servers/".concat(encodeURIComponent(E),"/exec"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})})}catch(e){console.error("Failed to send command:",e)}},en=L||(null==B?void 0:B.server.status),ei=Q.isPending||Y.isPending||$.isPending,ea=null==B?void 0:B.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]}),Y.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to stop server: ",null===(r=Y.error)||void 0===r?void 0:r.message]}),$.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to restart server: ",null===(s=$.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===(M=X.error)||void 0===M?void 0:M.message]}),N?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,t.jsx)(h.Z,{variant:"rounded",width:64,height:64,sx:{borderRadius:3,flexShrink:0}}),(0,t.jsxs)(l.Z,{sx:{flex:1},children:[(0,t.jsx)(h.Z,{variant:"text",width:80,height:18,sx:{mb:.5}}),(0,t.jsx)(h.Z,{variant:"text",width:"40%",height:40}),(0,t.jsxs)(l.Z,{sx:{display:"flex",gap:2,mt:.75},children:[(0,t.jsx)(h.Z,{variant:"text",width:100}),(0,t.jsx)(h.Z,{variant:"text",width:60}),(0,t.jsx)(h.Z,{variant:"text",width:140}),(0,t.jsx)(h.Z,{variant:"text",width:50})]})]}),(0,t.jsxs)(l.Z,{sx:{display:"flex",gap:1,flexShrink:0},children:[(0,t.jsx)(h.Z,{variant:"rounded",width:90,height:40,sx:{borderRadius:2}}),(0,t.jsx)(h.Z,{variant:"rounded",width:36,height:36,sx:{borderRadius:2}})]})]}),(0,t.jsx)(l.Z,{sx:{display:"flex",gap:.5,mb:3},children:[80,70,65,50,65,65].map((e,r)=>(0,t.jsx)(h.Z,{variant:"rounded",width:e,height:36,sx:{borderRadius:5}},r))}),(0,t.jsx)(l.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)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1.5},children:[(0,t.jsx)(h.Z,{variant:"text",width:"50%"}),(0,t.jsx)(h.Z,{variant:"circular",width:28,height:28})]}),(0,t.jsx)(h.Z,{variant:"text",width:"60%",height:36}),(0,t.jsx)(h.Z,{variant:"rounded",width:"100%",height:6,sx:{borderRadius:3,mt:1}})]})},e))}),(0,t.jsxs)(u.Z,{sx:{borderRadius:3,border:"1px solid",borderColor:"divider"},children:[(0,t.jsxs)(l.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,t.jsx)(h.Z,{variant:"text",width:80,height:28}),(0,t.jsx)(h.Z,{variant:"circular",width:10,height:10})]}),(0,t.jsx)(h.Z,{variant:"rectangular",height:360,sx:{bgcolor:"#0a0a0a"}}),(0,t.jsx)(l.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,t.jsx)(h.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)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(h.Z,{variant:"text",width:"40%",height:28,sx:{mb:1}}),(0,t.jsx)(h.Z,{variant:"rectangular",height:1,sx:{mb:2}}),[0,1,2,3,4,5,6].map(e=>(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(h.Z,{variant:"text",width:"30%"}),(0,t.jsx)(h.Z,{variant:"text",width:"40%"})]},e))]})})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(u.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(h.Z,{variant:"text",width:"30%",height:28,sx:{mb:1}}),(0,t.jsx)(h.Z,{variant:"rectangular",height:1,sx:{mb:2}}),(0,t.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(h.Z,{variant:"text",width:"25%"}),(0,t.jsx)(h.Z,{variant:"text",width:"20%"})]})]})})})]})]}):ea?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,t.jsx)(l.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)(l.Z,{sx:{flex:1},children:[(0,t.jsxs)(p.Z,{onClick:()=>D.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)(k.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:E}),(0,t.jsxs)(l.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)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(W.Z,{sx:{fontSize:14}}),"Minecraft ",ea.version]}),(0,t.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.type&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(F.Z,{sx:{fontSize:14}}),ea.type]}),(0,t.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.hostname&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(O.Z,{sx:{fontSize:14}}),ea.hostname]}),(0,t.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(A.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)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1.25,flexShrink:0},children:[("stopped"===en||"exited"===en||"not_created"===en)&&(0,t.jsx)(o.Z,{variant:"contained",color:"success",startIcon:ei?(0,t.jsx)(x.Z,{size:16,color:"inherit"}):(0,t.jsx)(I.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)(o.Z,{variant:"outlined",startIcon:ei?(0,t.jsx)(x.Z,{size:16}):(0,t.jsx)(eN,{}),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,R.Fq)("#fff",.05)}},children:"Stop"}),(0,t.jsx)(o.Z,{variant:"contained",startIcon:ei?(0,t.jsx)(x.Z,{size:16,color:"inherit"}):(0,t.jsx)(eU,{}),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)(P.Z,{sx:{fontSize:18}})}),(0,t.jsx)(j.Z,{anchorEl:q,open:!!q,onClose:()=>K(null),children:(0,t.jsxs)(g.Z,{onClick:()=>{K(null),_(!0),V("")},sx:{color:"error.main"},children:[(0,t.jsx)(v.Z,{children:(0,t.jsx)(z.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,t.jsx)(Z.Z,{children:"Delete Server"})]})})]})]}),(0,t.jsx)(eD,{server:ea,onSendCommand:et})]}):(0,t.jsx)(c.Z,{severity:"warning",children:"Server not found"}),(0,t.jsxs)(f.Z,{open:G,onClose:()=>{_(!1),V("")},maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(b.Z,{children:"Delete Server"}),(0,t.jsxs)(y.Z,{children:[(0,t.jsxs)(p.Z,{sx:{mb:2},children:["This action cannot be undone. Type ",(0,t.jsx)("strong",{children:E})," to confirm deletion."]}),(0,t.jsx)(w.Z,{label:"Server name",value:J,onChange:e=>V(e.target.value),fullWidth:!0,autoFocus:!0})]}),(0,t.jsxs)(C.Z,{sx:{px:3,pb:2},children:[(0,t.jsx)(o.Z,{onClick:()=>{_(!1),V("")},children:"Cancel"}),(0,t.jsx)(o.Z,{variant:"contained",color:"error",onClick:()=>{J===E&&X.mutate({name:E,force:!0},{onSuccess:()=>{D.push("/servers")}})},disabled:J!==E||X.isPending,startIcon:X.isPending?(0,t.jsx)(x.Z,{size:16}):null,children:X.isPending?"Deleting...":"Delete"})]})]})]})}},73660:function(e,r,s){"use strict";s.d(r,{K:function(){return k}});var t=s(94655),n=s(35106),i=s(18844),a=s.n(i),l=s(7281),o=s(69899),d=s(97436),c=s(30417),x=s(90829),h=s(79983),u=s(31317),m=s(25333),p=s(40064),j=s(45547),g=s(70115),v=s(69123),Z=s(93017),f=s(11141),b=s(19127),y=s(69366),C=s(163);let w=[{label:"say",template:"say "},{label:"give",template:"give "},{label:"tp",template:"tp "},{label:"gamemode",template:"gamemode "}],S=new(a())({fg:"#aaa",bg:"#000",newline:!1,escapeXML:!0,colors:{0:"#000000",1:"#cc0000",2:"#4e9a06",3:"#c4a000",4:"#3465a4",5:"#75507b",6:"#06989a",7:"#d3d7cf",8:"#555753",9:"#ef2929",10:"#8ae234",11:"#fce94f",12:"#729fcf",13:"#ad7fa8",14:"#34e2e2",15:"#eeeeec"}}),R=(0,n.memo)(function(e){let{log:r}=e,s=(0,n.useMemo)(()=>(function(e){let r=e.replace(/\x1b\[\?[\d;]*[a-zA-Z]/g,"").replace(/\x1b\[[0-9;]*[KJH]/g,"").replace(/\x1b=/g,"").replace(/\[\?[\d;]*[a-zA-Z]/g,"").replace(/\[[0-9;]*[KJH]/g,"").replace(/\[m/g,"").replace(/\[(\d+)m/g,"\x1b[$1m").replace(/>\.\.\.\.\r?/g,"").replace(/\r/g,"");return S.toHtml(r)})(r),[r]);return(0,t.jsx)(l.Z,{sx:{py:.25,whiteSpace:"pre-wrap",wordBreak:"break-all","& span":{}},dangerouslySetInnerHTML:{__html:s}})});function k(e){let{serverName:r}=e,[s,i]=(0,n.useState)(""),[a,S]=(0,n.useState)([]),[k,I]=(0,n.useState)(-1),[P,z]=(0,n.useState)("ALL"),[W,F]=(0,n.useState)(!0),[O,A]=(0,n.useState)(!0),[M,T]=(0,n.useState)(!1),D=(0,n.useRef)(null),E=(0,n.useRef)(null),{logs:B,isConnected:N,clearLogs:U,reconnect:L,retryCount:H}=(0,C.Y)({serverName:r}),q=(0,n.useMemo)(()=>{let e=B;return O&&(e=e.filter(e=>!e.includes("RCON Listener")&&!e.includes("RCON Client")&&!e.includes("RconClient"))),"ALL"!==P&&(e=e.filter(e=>(e.includes("/ERROR]")||e.includes("/ERROR:")?"ERROR":e.includes("/WARN]")||e.includes("/WARN:")?"WARN":(e.includes("/INFO]")||e.includes("/INFO:"),"INFO"))===P)),e},[B,P,O]);(0,n.useEffect)(()=>{W&&E.current&&(E.current.scrollTop=E.current.scrollHeight)},[q,W]);let K=(0,n.useCallback)(async()=>{let e=s.trim();if(e&&!M){T(!0);try{S(r=>[...r,e]),I(-1),await fetch("/api/servers/".concat(encodeURIComponent(r),"/exec"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})}),i("")}catch(e){console.error("Failed to execute command:",e)}finally{T(!1)}}},[s,r,M]),G=(0,n.useCallback)(e=>{if("Enter"===e.key)e.preventDefault(),K();else if("ArrowUp"===e.key){if(e.preventDefault(),0===a.length)return;let r=-1===k?a.length-1:Math.max(0,k-1);I(r),i(a[r])}else if("ArrowDown"===e.key){if(e.preventDefault(),-1===k)return;let r=k+1;r>=a.length?(I(-1),i("")):(I(r),i(a[r]))}},[a,k,K]),_=(0,n.useCallback)(e=>{var r;i(e),null===(r=D.current)||void 0===r||r.focus()},[]),J=N?{text:"Connected",color:"success"}:H>0?{text:"Disconnected (Retry ".concat(H,")"),color:"warning"}:{text:"Disconnected",color:"error"};return(0,t.jsxs)(o.Z,{"data-testid":"server-console",sx:{display:"flex",flexDirection:"column",height:"100%",minHeight:400},children:[(0,t.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1,borderBottom:1,borderColor:"divider"},children:[(0,t.jsxs)(g.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,t.jsx)(u.Z,{variant:"subtitle2",children:"Console"}),(0,t.jsx)(m.Z,{"data-testid":"connection-status",label:J.text,color:J.color,size:"small"})]}),(0,t.jsxs)(g.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,t.jsx)(x.Z,{size:"small",variant:"outlined",children:["ALL","INFO","WARN","ERROR"].map(e=>(0,t.jsx)(c.Z,{onClick:()=>z(e),variant:P===e?"contained":"outlined",children:e},e))}),(0,t.jsx)(p.Z,{control:(0,t.jsx)(j.Z,{checked:W,onChange:e=>F(e.target.checked),size:"small",inputProps:{"aria-label":"Auto-scroll"}}),label:"Auto-scroll"}),(0,t.jsx)(p.Z,{control:(0,t.jsx)(j.Z,{checked:O,onChange:e=>A(e.target.checked),size:"small",inputProps:{"aria-label":"Hide RCON"}}),label:"Hide RCON"}),(0,t.jsx)(h.Z,{size:"small",onClick:U,"aria-label":"Clear logs",title:"Clear logs",children:(0,t.jsx)(b.Z,{})}),!N&&(0,t.jsx)(c.Z,{size:"small",startIcon:(0,t.jsx)(y.Z,{}),onClick:L,"aria-label":"Reconnect",children:"Reconnect"})]})]}),(0,t.jsx)(l.Z,{ref:E,sx:{flex:1,overflow:"auto",bgcolor:"#1a1a1a",p:1,fontFamily:"monospace",fontSize:"0.85rem"},children:0===q.length?(0,t.jsx)(u.Z,{color:"text.secondary",sx:{textAlign:"center",py:4,color:"#666"},children:"Waiting for logs..."}):q.map((e,r)=>(0,t.jsx)(R,{log:e},r))}),(0,t.jsx)(v.Z,{}),(0,t.jsx)(l.Z,{sx:{px:2,py:1,bgcolor:"background.default"},children:(0,t.jsxs)(g.Z,{direction:"row",spacing:1,children:[(0,t.jsx)(u.Z,{variant:"caption",color:"text.secondary",sx:{alignSelf:"center"},children:"Quick:"}),w.map(e=>(0,t.jsx)(c.Z,{size:"small",variant:"outlined",onClick:()=>_(e.template),children:e.label},e.label))]})}),(0,t.jsx)(v.Z,{}),(0,t.jsxs)(l.Z,{sx:{display:"flex",p:1,gap:1},children:[(0,t.jsx)(d.Z,{inputRef:D,fullWidth:!0,size:"small",placeholder:"Enter command...",value:s,onChange:e=>i(e.target.value),onKeyDown:G,disabled:!N||M,InputProps:{sx:{fontFamily:"monospace"}}}),(0,t.jsx)(c.Z,{variant:"contained",onClick:K,disabled:!s.trim()||!N||M,startIcon:M?(0,t.jsx)(Z.Z,{size:16}):(0,t.jsx)(f.Z,{}),"aria-label":"Send command",children:"Send"})]})]})}},163:function(e,r,s){"use strict";s.d(r,{Y:function(){return i}});var t=s(35106),n=s(93757);function i(e){let{serverName:r,maxLines:s=500,enabled:i=!0,reconnectInterval:a=3e3}=e,[l,o]=(0,t.useState)([]);(0,t.useEffect)(()=>{o([])},[r]);let d=(0,t.useCallback)(e=>{let r;"server-log"===e.type?r=e.data.log:"log"in e&&"string"==typeof e.log&&(r=e.log),r&&o(e=>{let t=[...e,r];return t.length>s?t.slice(t.length-s):t})},[s]),{isConnected:c,reconnect:x,retryCount:h}=(0,n.D)({url:"/api/sse/servers/".concat(encodeURIComponent(r),"/logs"),onMessage:d,enabled:i,reconnectInterval:a});return{logs:l,isConnected:c,clearLogs:(0,t.useCallback)(()=>{o([])},[]),reconnect:x,retryCount:h}}}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,521,5511,7359,880,55,6857,8347,1658,1544,6727,6357,1721,8558,3489,2537,3669,2757,1744],function(){return e(e.s=59616)}),_N_E=e.O()}]);
|