@minecraft-docker/mcctl-console 2.18.0 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/.next/standalone/package.json +1 -1
  2. package/.next/standalone/platform/services/mcctl-console/.next/BUILD_ID +1 -1
  3. package/.next/standalone/platform/services/mcctl-console/.next/app-build-manifest.json +59 -59
  4. package/.next/standalone/platform/services/mcctl-console/.next/app-path-routes-manifest.json +1 -1
  5. package/.next/standalone/platform/services/mcctl-console/.next/build-manifest.json +2 -2
  6. package/.next/standalone/platform/services/mcctl-console/.next/prerender-manifest.json +1 -1
  7. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/admin/users/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/audit-logs/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/backups/page_client-reference-manifest.js +1 -1
  10. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/dashboard/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/players/page_client-reference-manifest.js +1 -1
  12. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/routing/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/console/page_client-reference-manifest.js +1 -1
  14. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page.js +1 -1
  15. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/page_client-reference-manifest.js +1 -1
  17. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/settings/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/worlds/page_client-reference-manifest.js +1 -1
  19. package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found.html +1 -1
  21. package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found.rsc +1 -1
  22. package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.html +1 -1
  23. package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.rsc +3 -3
  24. package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.html +1 -1
  25. package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.rsc +3 -3
  26. package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.html +1 -1
  27. package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.rsc +3 -3
  28. package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.html +1 -1
  29. package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.rsc +1 -1
  30. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login/page_client-reference-manifest.js +1 -1
  31. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.html +1 -1
  32. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.rsc +1 -1
  33. package/.next/standalone/platform/services/mcctl-console/.next/server/app/page_client-reference-manifest.js +1 -1
  34. package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.html +1 -1
  35. package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.rsc +2 -2
  36. package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.html +1 -1
  37. package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.rsc +2 -2
  38. package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.html +1 -1
  39. package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.rsc +2 -2
  40. package/.next/standalone/platform/services/mcctl-console/.next/server/app/settings.html +1 -1
  41. package/.next/standalone/platform/services/mcctl-console/.next/server/app/settings.rsc +2 -2
  42. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup/page_client-reference-manifest.js +1 -1
  43. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.html +1 -1
  44. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.rsc +1 -1
  45. package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.html +1 -1
  46. package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.rsc +2 -2
  47. package/.next/standalone/platform/services/mcctl-console/.next/server/app-paths-manifest.json +24 -24
  48. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/354.js +1 -1
  49. package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/5841.js +1 -1
  50. package/.next/standalone/platform/services/mcctl-console/.next/server/middleware-manifest.json +5 -5
  51. package/.next/standalone/platform/services/mcctl-console/.next/server/pages/404.html +1 -1
  52. package/.next/standalone/platform/services/mcctl-console/.next/server/pages/500.html +1 -1
  53. package/.next/standalone/platform/services/mcctl-console/.next/server/server-reference-manifest.json +1 -1
  54. package/.next/{static/chunks/6831-3fe5e1273ac38e5f.js → standalone/platform/services/mcctl-console/.next/static/chunks/6831-81d20c7bc7bd1e76.js} +1 -1
  55. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/9443-94798e3709b6aeba.js +1 -0
  56. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/layout-06fb39812ec76869.js +1 -0
  57. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/page-8476d9ad7e0424d2.js +1 -0
  58. package/.next/standalone/platform/services/mcctl-console/package.json +1 -1
  59. package/.next/{standalone/platform/services/mcctl-console/.next/static/chunks/6831-3fe5e1273ac38e5f.js → static/chunks/6831-81d20c7bc7bd1e76.js} +1 -1
  60. package/.next/static/chunks/9443-94798e3709b6aeba.js +1 -0
  61. package/.next/static/chunks/app/(main)/layout-06fb39812ec76869.js +1 -0
  62. package/.next/static/chunks/app/(main)/servers/[name]/page-8476d9ad7e0424d2.js +1 -0
  63. package/package.json +2 -2
  64. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2019-01a1009a77c3dccd.js +0 -1
  65. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/layout-25723393b563b0b5.js +0 -1
  66. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/page-09665a800696c8a9.js +0 -1
  67. package/.next/static/chunks/2019-01a1009a77c3dccd.js +0 -1
  68. package/.next/static/chunks/app/(main)/layout-25723393b563b0b5.js +0 -1
  69. package/.next/static/chunks/app/(main)/servers/[name]/page-09665a800696c8a9.js +0 -1
  70. /package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/audit-logs/{page-4b9a4dac74fde96c.js → page-fc2d6a6546ca0f2c.js} +0 -0
  71. /package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/dashboard/{page-77b32d45e2f64eec.js → page-037cd01d812a444a.js} +0 -0
  72. /package/.next/standalone/platform/services/mcctl-console/.next/static/{SmXwR-3YjO6r8-VonFLXc → pstO25F485_2xYibtTFJO}/_buildManifest.js +0 -0
  73. /package/.next/standalone/platform/services/mcctl-console/.next/static/{SmXwR-3YjO6r8-VonFLXc → pstO25F485_2xYibtTFJO}/_ssgManifest.js +0 -0
  74. /package/.next/static/chunks/app/(main)/audit-logs/{page-4b9a4dac74fde96c.js → page-fc2d6a6546ca0f2c.js} +0 -0
  75. /package/.next/static/chunks/app/(main)/dashboard/{page-77b32d45e2f64eec.js → page-037cd01d812a444a.js} +0 -0
  76. /package/.next/static/{SmXwR-3YjO6r8-VonFLXc → pstO25F485_2xYibtTFJO}/_buildManifest.js +0 -0
  77. /package/.next/static/{SmXwR-3YjO6r8-VonFLXc → pstO25F485_2xYibtTFJO}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4095],{16387:function(e,r,t){Promise.resolve().then(t.bind(t,6453))},6453:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return B}});var n=t(94655),a=t(35106),i=t(7281),s=t(74228),l=t(46725),o=t(56275),c=t(62108),d=t(79983),h=t(31317),x=t(62142),m=t(90158),u=t(58347),p=t(49954),f=t(17820),g=t(73424),b=t(61505),j=t(71185),y=t(76176),v=t(27171),Z=t(35847),w=t(29983),C=t(80620),k=t(84974),S=t(34675),P=t(85480),z=t(64779);function I(e){return(0,n.jsxs)(z.Z,{...e,viewBox:"0 0 32 32",children:[(0,n.jsx)("rect",{width:"32",height:"32",fill:"#5DA840"}),(0,n.jsx)("rect",{x:"4",y:"8",width:"8",height:"8",fill:"#000"}),(0,n.jsx)("rect",{x:"20",y:"8",width:"8",height:"8",fill:"#000"}),(0,n.jsx)("rect",{x:"12",y:"16",width:"8",height:"4",fill:"#000"}),(0,n.jsx)("rect",{x:"8",y:"20",width:"16",height:"8",fill:"#000"}),(0,n.jsx)("rect",{x:"8",y:"28",width:"4",height:"4",fill:"#000"}),(0,n.jsx)("rect",{x:"20",y:"28",width:"4",height:"4",fill:"#000"}),(0,n.jsx)("rect",{x:"0",y:"0",width:"4",height:"4",fill:"#4A9030",opacity:"0.5"}),(0,n.jsx)("rect",{x:"8",y:"4",width:"4",height:"4",fill:"#4A9030",opacity:"0.5"}),(0,n.jsx)("rect",{x:"24",y:"0",width:"4",height:"4",fill:"#4A9030",opacity:"0.5"}),(0,n.jsx)("rect",{x:"28",y:"8",width:"4",height:"4",fill:"#4A9030",opacity:"0.5"}),(0,n.jsx)("rect",{x:"0",y:"24",width:"4",height:"4",fill:"#4A9030",opacity:"0.5"})]})}var W=t(8690),A=t(6986);let D=[{label:"Dashboard",href:"/dashboard",icon:(0,n.jsx)(y.Z,{})},{label:"Servers",href:"/servers",icon:(0,n.jsx)(v.Z,{})},{label:"Worlds",href:"/worlds",icon:(0,n.jsx)(k.Z,{})},{label:"Players",href:"/players",icon:(0,n.jsx)(Z.Z,{})},{label:"Audit",href:"/audit-logs",icon:(0,n.jsx)(C.Z,{})},{label:"Backups",href:"/backups",icon:(0,n.jsx)(S.Z,{})},{label:"Routing",href:"/routing",icon:(0,n.jsx)(w.Z,{})}];function T(e){let{mobileOpen:r,onMenuToggle:t}=e,a=(0,s.usePathname)(),{data:y}=(0,A.kP)(),v=e=>"/dashboard"===e?"/dashboard"===a||"/"===a:a.startsWith(e);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.Z,{position:"fixed",elevation:0,sx:{backgroundColor:"background.paper",borderBottom:"1px solid",borderColor:"divider",zIndex:e=>e.zIndex.drawer+1},children:(0,n.jsxs)(c.Z,{sx:{maxWidth:"1400px",width:"100%",mx:"auto",px:{xs:2,sm:3}},children:[(0,n.jsx)(d.Z,{color:"inherit","aria-label":"open menu",edge:"start",onClick:t,sx:{mr:2,display:{md:"none"}},children:(0,n.jsx)(b.Z,{})}),(0,n.jsxs)(l.default,{href:"/",style:{textDecoration:"none",display:"flex",alignItems:"center"},children:[(0,n.jsx)(I,{sx:{fontSize:28,color:"primary.main",mr:1}}),(0,n.jsx)(h.Z,{variant:"h6",component:"span",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,color:"common.white",letterSpacing:"0.05em",fontSize:"1.1rem"},children:"Minecraft Console"})]}),(0,n.jsx)(i.Z,{component:"nav",sx:{display:{xs:"none",md:"flex"},alignItems:"center",gap:1,ml:4,flex:1},children:D.map(e=>{let r=v(e.href);return(0,n.jsx)(l.default,{href:e.href,style:{textDecoration:"none"},onClick:()=>!r&&(0,W.Av)(),children:(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1,borderRadius:2,color:r?"primary.main":"text.secondary",backgroundColor:r?"action.selected":"transparent",transition:"all 0.2s ease","&:hover":{backgroundColor:"action.hover",color:r?"primary.main":"text.primary"}},children:[(0,n.jsx)(i.Z,{component:"span",sx:{display:"flex",alignItems:"center","& svg":{fontSize:20}},children:e.icon}),(0,n.jsx)(h.Z,{variant:"body2",sx:{fontWeight:r?600:400},children:e.label})]})},e.href)})}),(0,n.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:(0,n.jsx)(P.Ie,{})})]})}),(0,n.jsx)(x.ZP,{variant:"temporary",anchor:"left",open:r,onClose:t,ModalProps:{keepMounted:!0},sx:{display:{xs:"block",md:"none"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:280,backgroundColor:"background.paper"}},children:(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:2,minHeight:64,borderBottom:"1px solid",borderColor:"divider"},children:[(0,n.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,n.jsx)(I,{sx:{fontSize:24,color:"primary.main",mr:1}}),(0,n.jsx)(h.Z,{variant:"h6",component:"span",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,color:"primary.main",letterSpacing:"0.05em",fontSize:"1rem"},children:"Minecraft Console"})]}),(0,n.jsx)(d.Z,{onClick:t,"aria-label":"close menu",children:(0,n.jsx)(j.Z,{})})]}),(0,n.jsx)(m.Z,{sx:{flex:1,px:1,py:2},children:D.map(e=>{let r=v(e.href);return(0,n.jsx)(u.ZP,{disablePadding:!0,sx:{mb:.5},children:(0,n.jsxs)(p.Z,{component:l.default,href:e.href,onClick:()=>{t(),r||(0,W.Av)()},"aria-current":r?"page":void 0,sx:{borderRadius:2,backgroundColor:r?"action.selected":"transparent","&:hover":{backgroundColor:"action.hover"}},children:[(0,n.jsx)(f.Z,{sx:{color:r?"primary.main":"text.secondary",minWidth:40},children:e.icon}),(0,n.jsx)(g.Z,{primary:e.label,primaryTypographyProps:{fontWeight:r?600:400,color:r?"primary.main":"text.primary"}})]})},e.href)})})]})})]})}var _=t(67337),q=t(41261),E=t(69123),M=t(75845),R=t(43880);function L(e){return(0,n.jsx)(z.Z,{...e,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M13.983 11.078h2.119a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.119a.185.185 0 00-.185.185v1.888c0 .102.083.185.185.185m-2.954-5.43h2.118a.186.186 0 00.186-.186V3.574a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.186m0 2.716h2.118a.187.187 0 00.186-.186V6.29a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.887c0 .102.082.185.185.186m-2.93 0h2.12a.186.186 0 00.184-.186V6.29a.185.185 0 00-.185-.185H8.1a.185.185 0 00-.185.185v1.887c0 .102.083.185.185.186m-2.964 0h2.119a.186.186 0 00.185-.186V6.29a.185.185 0 00-.185-.185H5.136a.186.186 0 00-.186.185v1.887c0 .102.084.185.186.186m5.893 2.715h2.118a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m-2.93 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.083.185.185.185m-2.964 0h2.119a.185.185 0 00.185-.185V9.006a.185.185 0 00-.184-.186h-2.12a.186.186 0 00-.186.186v1.887c0 .102.084.185.186.185m-2.92 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.082.185.185.185M23.763 9.89c-.065-.051-.672-.51-1.954-.51-.338.001-.676.03-1.01.087-.248-1.7-1.653-2.53-1.716-2.566l-.344-.199-.226.327c-.284.438-.49.922-.612 1.43-.23.97-.09 1.882.403 2.661-.595.332-1.55.413-1.744.42H.751a.751.751 0 00-.75.748 11.376 11.376 0 00.692 4.062c.545 1.428 1.355 2.48 2.41 3.124 1.18.723 3.1 1.137 5.275 1.137.983.003 1.963-.086 2.93-.266a12.248 12.248 0 003.823-1.389c.98-.567 1.86-1.288 2.61-2.136 1.252-1.418 1.998-2.997 2.553-4.4h.221c1.372 0 2.215-.549 2.68-1.009.309-.293.55-.65.707-1.046l.098-.288z"})})}let U=[{title:"Resources",links:[{label:"Getting Started",href:"https://minecraft-server-manager.readthedocs.io/en/latest/getting-started/",external:!0},{label:"Configuration",href:"https://minecraft-server-manager.readthedocs.io/en/latest/configuration/",external:!0},{label:"Troubleshooting",href:"https://minecraft-server-manager.readthedocs.io/en/latest/troubleshooting/",external:!0}]},{title:"Documentation",links:[{label:"CLI Commands",href:"https://minecraft-server-manager.readthedocs.io/en/latest/cli/",external:!0},{label:"API Reference",href:"https://minecraft-server-manager.readthedocs.io/en/latest/console/",external:!0},{label:"itzg Reference",href:"https://minecraft-server-manager.readthedocs.io/en/latest/itzg-reference/",external:!0}]},{title:"Community",links:[{label:"GitHub",href:"https://github.com/smallmiro/minecraft-server-manager",external:!0},{label:"Issues",href:"https://github.com/smallmiro/minecraft-server-manager/issues",external:!0},{label:"Q&A / Support",href:"https://github.com/smallmiro/minecraft-server-manager/discussions/categories/q-a",external:!0},{label:"Ideas / Feature Requests",href:"https://github.com/smallmiro/minecraft-server-manager/discussions/categories/ideas",external:!0}]},{title:"About",links:[{label:"License",href:"https://github.com/smallmiro/minecraft-server-manager/blob/main/LICENSE",external:!0},{label:"Docker Hub",href:"https://hub.docker.com/r/itzg/minecraft-server",external:!0}]}];function H(){let e=new Date().getFullYear();return(0,n.jsx)(i.Z,{component:"footer",sx:{backgroundColor:"background.paper",borderTop:"1px solid",borderColor:"divider",mt:"auto"},children:(0,n.jsxs)(_.Z,{maxWidth:"lg",sx:{py:6},children:[(0,n.jsx)(i.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(4, 1fr)"},gap:4,mb:4},children:U.map(e=>(0,n.jsxs)(i.Z,{children:[(0,n.jsx)(h.Z,{variant:"subtitle2",sx:{fontWeight:600,color:"text.primary",mb:2},children:e.title}),(0,n.jsx)(i.Z,{component:"ul",sx:{listStyle:"none",p:0,m:0},children:e.links.map(e=>(0,n.jsx)(i.Z,{component:"li",sx:{mb:1},children:(0,n.jsx)(q.Z,{href:e.href,target:e.external?"_blank":void 0,rel:e.external?"noopener noreferrer":void 0,underline:"hover",sx:{color:"text.secondary",fontSize:"0.875rem",transition:"color 0.2s ease","&:hover":{color:"primary.main"}},children:e.label})},e.label))})]},e.title))}),(0,n.jsx)(E.Z,{sx:{mb:3}}),(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},justifyContent:"space-between",alignItems:{xs:"flex-start",sm:"center"},gap:2},children:[(0,n.jsxs)(h.Z,{variant:"body2",sx:{color:"text.tertiary"},children:[e," \xa9"," ",(0,n.jsx)(q.Z,{href:"https://github.com/smallmiro/minecraft-server-manager",target:"_blank",rel:"noopener noreferrer",underline:"hover",sx:{color:"primary.main"},children:"Minecraft Server Management Console"})]}),(0,n.jsxs)(i.Z,{sx:{display:"flex",gap:2},children:[(0,n.jsx)(q.Z,{href:"https://github.com/smallmiro/minecraft-server-manager",target:"_blank",rel:"noopener noreferrer","aria-label":"GitHub",sx:{color:"text.secondary",transition:"color 0.2s ease","&:hover":{color:"text.primary"}},children:(0,n.jsx)(M.Z,{fontSize:"small"})}),(0,n.jsx)(q.Z,{href:"https://minecraft-server-manager.readthedocs.io/",target:"_blank",rel:"noopener noreferrer","aria-label":"Documentation",sx:{color:"text.secondary",transition:"color 0.2s ease","&:hover":{color:"text.primary"}},children:(0,n.jsx)(R.Z,{fontSize:"small"})}),(0,n.jsx)(q.Z,{href:"https://hub.docker.com/r/itzg/minecraft-server",target:"_blank",rel:"noopener noreferrer","aria-label":"Docker Hub",sx:{color:"text.secondary",transition:"color 0.2s ease","&:hover":{color:"text.primary"}},children:(0,n.jsx)(L,{fontSize:"small"})})]})]})]})})}function B(e){let{children:r}=e,[t,s]=(0,a.useState)(!1);return(0,n.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh",backgroundColor:"background.default"},children:[(0,n.jsx)(T,{mobileOpen:t,onMenuToggle:()=>{s(!t)}}),(0,n.jsx)(i.Z,{component:"main",sx:{flexGrow:1,display:"flex",flexDirection:"column",pt:{xs:"".concat(88,"px"),sm:"".concat(96,"px")},pb:{xs:3,sm:4},px:{xs:2,sm:3,md:4},maxWidth:"1400px",width:"100%",mx:"auto"},children:r}),(0,n.jsx)(H,{})]})}},85480:function(e,r,t){"use strict";t.d(r,{U0:function(){return u},WS:function(){return p},Ie:function(){return I}});var n=t(94655),a=t(35106),i=t(7281),s=t(81071),l=t(97436),o=t(52082),c=t(79983),d=t(30417),h=t(36848),x=t(554),m=t(6986);function u(e){let{onSuccess:r}=e,[t,u]=(0,a.useState)(""),[p,f]=(0,a.useState)(""),[g,b]=(0,a.useState)(!1),[j,y]=(0,a.useState)({}),[v,Z]=(0,a.useState)(null),[w,C]=(0,a.useState)(!1),k=()=>{let e={};return t?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)||(e.email="Invalid email address"):e.email="Email is required",p||(e.password="Password is required"),y(e),0===Object.keys(e).length},S=async e=>{if(e.preventDefault(),Z(null),k()){C(!0);try{let e=await m.cg.email({email:t,password:p});if(e.error){Z(e.error.message||"Invalid credentials"),C(!1);return}r&&r()}catch(e){Z("An unexpected error occurred. Please try again."),C(!1)}}};return(0,n.jsxs)(i.Z,{component:"form",onSubmit:S,sx:{display:"flex",flexDirection:"column",gap:2},children:[v&&(0,n.jsx)(s.Z,{severity:"error",onClose:()=>Z(null),children:v}),(0,n.jsx)(l.Z,{label:"Email",type:"email",value:t,onChange:e=>u(e.target.value),error:!!j.email,helperText:j.email,disabled:w,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Password",type:g?"text":"password",value:p,onChange:e=>f(e.target.value),error:!!j.password,helperText:j.password,disabled:w,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(c.Z,{"aria-label":"toggle password visibility",onClick:()=>{b(!g)},edge:"end",children:g?(0,n.jsx)(h.Z,{}):(0,n.jsx)(x.Z,{})})})}}),(0,n.jsx)(d.Z,{type:"submit",variant:"contained",color:"primary",disabled:w,fullWidth:!0,size:"large",children:w?"Signing in...":"Sign In"})]})}function p(e){let{onSuccess:r}=e,[t,u]=(0,a.useState)(""),[p,f]=(0,a.useState)(""),[g,b]=(0,a.useState)(""),[j,y]=(0,a.useState)(""),[v,Z]=(0,a.useState)(!1),[w,C]=(0,a.useState)(!1),[k,S]=(0,a.useState)({}),[P,z]=(0,a.useState)(null),[I,W]=(0,a.useState)(!1),A=()=>{let e={};return t||(e.name="Name is required"),p?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p)||(e.email="Invalid email address"):e.email="Email is required",g?g.length<8&&(e.password="Password must be at least 8 characters"):e.password="Password is required",j?g!==j&&(e.confirmPassword="Passwords do not match"):e.confirmPassword="Please confirm your password",S(e),0===Object.keys(e).length},D=async e=>{if(e.preventDefault(),z(null),A()){W(!0);try{let e=await m.y1.email({email:p,password:g,name:t});if(e.error){z(e.error.message||"Registration failed"),W(!1);return}r&&r()}catch(e){z("An unexpected error occurred. Please try again."),W(!1)}}};return(0,n.jsxs)(i.Z,{component:"form",onSubmit:D,sx:{display:"flex",flexDirection:"column",gap:2},children:[P&&(0,n.jsx)(s.Z,{severity:"error",onClose:()=>z(null),children:P}),(0,n.jsx)(l.Z,{label:"Name",type:"text",value:t,onChange:e=>u(e.target.value),error:!!k.name,helperText:k.name,disabled:I,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Email",type:"email",value:p,onChange:e=>f(e.target.value),error:!!k.email,helperText:k.email,disabled:I,fullWidth:!0,required:!0}),(0,n.jsx)(l.Z,{label:"Password",type:v?"text":"password",value:g,onChange:e=>b(e.target.value),error:!!k.password,helperText:k.password,disabled:I,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(c.Z,{"aria-label":"toggle password visibility",onClick:()=>{Z(!v)},edge:"end",children:v?(0,n.jsx)(h.Z,{}):(0,n.jsx)(x.Z,{})})})}}),(0,n.jsx)(l.Z,{label:"Confirm Password",type:w?"text":"password",value:j,onChange:e=>y(e.target.value),error:!!k.confirmPassword,helperText:k.confirmPassword,disabled:I,fullWidth:!0,required:!0,InputProps:{endAdornment:(0,n.jsx)(o.Z,{position:"end",children:(0,n.jsx)(c.Z,{"aria-label":"toggle password visibility",onClick:()=>{C(!w)},edge:"end",children:w?(0,n.jsx)(h.Z,{}):(0,n.jsx)(x.Z,{})})})}}),(0,n.jsx)(d.Z,{type:"submit",variant:"contained",color:"primary",disabled:I,fullWidth:!0,size:"large",children:I?"Creating account...":"Sign Up"})]})}var f=t(74228),g=t(93017),b=t(86702),j=t(88812),y=t(31317),v=t(25333),Z=t(69123),w=t(7178),C=t(17820),k=t(73424),S=t(25169),P=t(41094),z=t(78319);function I(){let e=(0,f.useRouter)(),{data:r,isPending:t}=(0,m.kP)(),[s,l]=(0,a.useState)(null),o=()=>{l(null)},h=async()=>{o(),await (0,m.w7)(),e.push("/login")};if(t)return(0,n.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(g.Z,{size:24})});if(!(null==r?void 0:r.user))return(0,n.jsx)(d.Z,{variant:"contained",color:"primary",onClick:()=>{e.push("/login")},children:"Sign In"});let{user:x}=r,u=((e,r)=>{if(e){let r=e.split(" ");return r.length>=2?"".concat(r[0][0]).concat(r[1][0]).toUpperCase():e.substring(0,2).toUpperCase()}return r?r[0].toUpperCase():"?"})(x.name,x.email);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.Z,{onClick:e=>{l(e.currentTarget)},"aria-label":"user menu",children:(0,n.jsx)(b.Z,{sx:{bgcolor:"primary.main"},children:u})}),(0,n.jsxs)(j.Z,{anchorEl:s,open:!!s,onClose:o,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{mt:1},children:[(0,n.jsxs)(i.Z,{sx:{px:2,py:1.5,minWidth:200},children:[(0,n.jsx)(y.Z,{variant:"subtitle1",fontWeight:"600",children:x.name||"User"}),(0,n.jsx)(y.Z,{variant:"body2",color:"text.secondary",children:x.email}),"admin"===x.role&&(0,n.jsx)(v.Z,{label:"Admin",size:"small",color:"primary",sx:{mt:1}})]}),(0,n.jsx)(Z.Z,{}),"admin"===x.role&&(0,n.jsxs)(w.Z,{onClick:()=>{o(),e.push("/admin/users")},children:[(0,n.jsx)(C.Z,{children:(0,n.jsx)(S.Z,{fontSize:"small"})}),(0,n.jsx)(k.Z,{children:"Users"})]}),(0,n.jsxs)(w.Z,{onClick:()=>{o(),e.push("/settings")},children:[(0,n.jsx)(C.Z,{children:(0,n.jsx)(P.Z,{fontSize:"small"})}),(0,n.jsx)(k.Z,{children:"Settings"})]}),(0,n.jsxs)(w.Z,{onClick:h,children:[(0,n.jsx)(C.Z,{children:(0,n.jsx)(z.Z,{fontSize:"small"})}),(0,n.jsx)(k.Z,{children:"Logout"})]})]})]})}},3454:function(e,r,t){"use strict";t.d(r,{LoadingProvider:function(){return o},startLoading:function(){return c},stopLoading:function(){return d}});var n=t(94655),a=t(35106),i=t(74228),s=t(31477),l=t.n(s);function o(e){let{children:r}=e,t=(0,i.usePathname)(),s=(0,i.useSearchParams)();return(0,a.useEffect)(()=>{l().done()},[t,s]),(0,n.jsx)(n.Fragment,{children:r})}function c(){l().start()}function d(){l().done()}l().configure({showSpinner:!1,speed:300,minimum:.1})},8690:function(e,r,t){"use strict";t.d(r,{Av:function(){return n.startLoading}});var n=t(3454)},6986:function(e,r,t){"use strict";t.d(r,{Cp:function(){return x},Nq:function(){return h},cg:function(){return l},kP:function(){return d},w7:function(){return o},y1:function(){return c},zB:function(){return m}});var n=t(77054),a=t(61648),i=t(35016);let s=(0,n.X)({baseURL:i.env.NEXT_PUBLIC_BETTER_AUTH_URL||"",plugins:[(0,a.zB)()]}),{signIn:l,signOut:o,signUp:c,useSession:d,updateUser:h,changePassword:x}=s,m=s.admin}},function(e){e.O(0,[6812,9760,5004,7296,7436,1071,2542,55,4219,8347,4848,1400,5560,3669,2757,1744],function(){return e(e.s=16387)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[278,2666],{59616:function(e,t,n){Promise.resolve().then(n.bind(n,91329))},91329:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return re}});var r=n(94655),s=n(35106),i=n(74228),a=n(31358),l=n(7281),o=n(30417),c=n(79983),d=n(81071),u=n(93017),x=n(10721),h=n(628),p=n(41565),m=n(31317),f=n(88812),y=n(7178),v=n(17820),g=n(73424),j=n(99770),b=n(62508),Z=n(5682),C=n(76678),S=n(97436),w=n(84840),k=n(76492),R=n(10117),I=n(5501),P=n(37809),T=n(21111),z=n(17978),F=n(89573),W=n(96292),D=n(33104),N=n(25333),A=n(52082),O=n(69123),L=n(83855),M=n(44059),q=n(71185),E=n(30165),U=n(97293),B=n(11259),K=n(66615),V=n(89161),H=n(34071),Q=n(4405);function G(e){let{value:t,unit:n,label:s,icon:i,progress:a,progressMax:o,color:c="#1bd96a"}=e;return(0,r.jsxs)(h.Z,{"data-testid":"resource-stat-card",sx:{p:2.5,bgcolor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:3},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:2},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"baseline",gap:.75,flexWrap:"wrap",minWidth:0},children:[(0,r.jsx)(m.Z,{variant:"h4",component:"span",sx:{fontWeight:700,color:"text.primary",letterSpacing:"-0.5px"},children:t}),(0,r.jsx)(m.Z,{variant:"body2",component:"span",sx:{color:"text.secondary",fontWeight:500},children:n})]}),(0,r.jsx)(l.Z,{sx:{color:"text.secondary",flexShrink:0},children:i})]}),(0,r.jsx)(m.Z,{variant:"body2",sx:{color:"text.secondary",fontWeight:500,mt:.5},children:s}),(0,r.jsx)(Q.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(c," 0%, ").concat(c,"cc 100%)")}}})]})}var J=n(163),_=n(73660),$=n(29793),X=n(75726),Y=n(62328),ee=n(89923),et=n(10297),en=n(46725),er=n(26577),es=n(83765),ei=n(84509),ea=n(82925);function el(e){var t,n;let{serverName:i}=e,[a,c]=(0,s.useState)({limit:25,offset:0}),{data:d,isLoading:u,error:x,refetch:h}=(0,ei.HZ)(i,{limit:a.limit,extraParams:{offset:a.offset,action:a.action,status:a.status}}),p=e=>{c(t=>({...t,action:e||void 0,offset:0}))},m="/audit-logs?targetType=server&targetName=".concat(encodeURIComponent(i));return(0,r.jsxs)(l.Z,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},gap:2,mb:2,alignItems:{sm:"center"}},children:[(0,r.jsxs)($.Z,{size:"small",sx:{minWidth:140},children:[(0,r.jsx)(X.Z,{children:"Action"}),(0,r.jsxs)(Y.Z,{value:a.action||"",label:"Action",onChange:e=>p(e.target.value||void 0),children:[(0,r.jsx)(y.Z,{value:"",children:"All Actions"}),ea.Xn.map(e=>(0,r.jsx)(y.Z,{value:e,children:ea.n3[e]||e},e))]})]}),(0,r.jsxs)(et.Z,{value:a.status||"",exclusive:!0,onChange:(e,t)=>{c(e=>({...e,status:t||void 0,offset:0}))},size:"small",children:[(0,r.jsx)(ee.Z,{value:"","aria-label":"All statuses",children:"All"}),(0,r.jsx)(ee.Z,{value:"success","aria-label":"Success only",children:"Success"}),(0,r.jsx)(ee.Z,{value:"failure","aria-label":"Failure only",children:"Failure"})]})]}),(0,r.jsx)(es.x,{logs:null!==(t=null==d?void 0:d.logs)&&void 0!==t?t:[],total:null!==(n=null==d?void 0:d.total)&&void 0!==n?n:0,isLoading:u,error:x,filters:a,onFiltersChange:e=>{c(e)},onRetry:()=>h(),hideTargetColumn:!0,rowsPerPageOptions:[25,50]}),(0,r.jsx)(l.Z,{sx:{mt:2,textAlign:"center"},children:(0,r.jsx)(o.Z,{component:en.default,href:m,size:"small",endIcon:(0,r.jsx)(er.Z,{}),sx:{textTransform:"none"},children:"View Full History"})})]})}var eo=n(37530),ec=n(84420),ed=n(46121),eu=n(84775),ex=n(92666),eh=n(70115),ep=n(70603),em=n(32366),ef=n(5942),ey=n(25523);function ev(e){let{serverName:t}=e,{data:n,isLoading:i}=(0,ex.Js)(t),a=(0,ex.Bx)(),[x,f]=(0,s.useState)([]),[y,v]=(0,s.useState)(!1),[g,j]=(0,s.useState)(!1),[b,Z]=(0,s.useState)(""),[C,w]=(0,s.useState)(""),[k,R]=(0,s.useState)(!1),[I,P]=(0,s.useState)({open:!1,message:"",severity:"success"});(0,s.useEffect)(()=>{(null==n?void 0:n.customHostnames)&&(f(n.customHostnames),v(!1),R(!1))},[n]);let z=e=>{let t=e.trim().toLowerCase();return t?t.length>253?"Domain exceeds 253 characters":/^[a-z0-9]([a-z0-9\-.]*[a-z0-9])?$/.test(t)?t.endsWith(".local")?"Cannot use .local system domain":t.endsWith(".nip.io")?"Cannot use .nip.io system domain":x.includes(t)?"Domain already exists":"":"Invalid domain format":"Domain cannot be empty"},F=()=>{let e=b.trim().toLowerCase(),t=z(e);if(t){w(t);return}f(t=>[...t,e]),Z(""),w(""),j(!1),v(!0)},W=e=>{f(t=>t.filter(t=>t!==e)),v(!0)},D=async()=>{try{await a.mutateAsync({serverName:t,customHostnames:x}),v(!1),R(!0),P({open:!0,message:"Hostnames saved. Container recreation required to apply changes.",severity:"warning"})}catch(e){P({open:!0,message:e instanceof Error?e.message:"Failed to save hostnames",severity:"error"})}},A=()=>{j(!1),Z(""),w("")};return i?(0,r.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,r.jsx)(p.Z,{children:(0,r.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,r.jsx)(u.Z,{size:24})})})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1},children:[(0,r.jsx)(ey.Z,{color:"primary"}),(0,r.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Hostnames / Domains"})]}),(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Manage hostnames used by mc-router to route connections to this server."}),(0,r.jsx)(O.Z,{sx:{mb:3}}),(null==n?void 0:n.systemHostnames)&&n.systemHostnames.length>0&&(0,r.jsxs)(l.Z,{sx:{mb:3},children:[(0,r.jsx)(m.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1},children:"System Hostnames (read-only)"}),(0,r.jsx)(eh.Z,{direction:"row",flexWrap:"wrap",gap:1,children:n.systemHostnames.map(e=>(0,r.jsx)(N.Z,{icon:(0,r.jsx)(ep.Z,{sx:{fontSize:16}}),label:e.hostname,title:e.description,variant:"outlined",color:"default",size:"small"},e.hostname))})]}),(0,r.jsxs)(l.Z,{sx:{mb:2},children:[(0,r.jsx)(m.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1},children:"Custom Domains"}),0===x.length&&!g&&(0,r.jsx)(m.Z,{variant:"body2",color:"text.disabled",sx:{mb:1},children:"No custom domains configured."}),(0,r.jsx)(eh.Z,{spacing:1,children:x.map(e=>(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:.5,px:1.5,borderRadius:1,bgcolor:"action.hover"},children:[(0,r.jsx)(m.Z,{variant:"body2",children:e}),(0,r.jsx)(c.Z,{size:"small",color:"error",onClick:()=>W(e),title:"Remove domain",children:(0,r.jsx)(T.Z,{fontSize:"small"})})]},e))}),g?(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"flex-start",gap:1,mt:1},children:[(0,r.jsx)(S.Z,{size:"small",placeholder:"e.g. play.example.com",value:b,onChange:e=>{Z(e.target.value),w("")},onKeyDown:e=>{"Enter"===e.key&&F(),"Escape"===e.key&&A()},error:!!C,helperText:C,autoFocus:!0,sx:{flex:1}}),(0,r.jsx)(o.Z,{size:"small",variant:"contained",onClick:F,children:"Add"}),(0,r.jsx)(c.Z,{size:"small",onClick:A,children:(0,r.jsx)(q.Z,{fontSize:"small"})})]}):(0,r.jsx)(o.Z,{size:"small",startIcon:(0,r.jsx)(em.Z,{}),onClick:()=>j(!0),sx:{mt:1},children:"Add Domain"})]}),k&&(0,r.jsxs)(d.Z,{severity:"warning",sx:{mb:2},children:["Container recreation is required for hostname changes to take effect. Run ",(0,r.jsx)("code",{children:"docker compose up -d"})," or restart the server from the dashboard."]}),(0,r.jsx)(l.Z,{sx:{display:"flex",justifyContent:"flex-end"},children:(0,r.jsx)(o.Z,{variant:"contained",size:"small",startIcon:(0,r.jsx)(ef.Z,{}),onClick:D,disabled:!y||a.isPending,children:a.isPending?"Saving...":"Save Hostnames"})})]})}),(0,r.jsx)(eo.Z,{open:I.open,autoHideDuration:6e3,onClose:()=>P({...I,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,r.jsx)(d.Z,{onClose:()=>P({...I,open:!1}),severity:I.severity,sx:{width:"100%"},children:I.message})})]})}var eg=n(87716),ej=n(81960),eb=n(40064),eZ=n(38393),eC=n(28058),eS=n(42730);function ew(e){var t;let{field:n,value:i,onChange:a}=e,[o,d]=(0,s.useState)(!1),u=null!==(t=n.columns)&&void 0!==t?t:6;return(0,r.jsx)(w.ZP,{item:!0,xs:12,sm:u,children:(()=>{var e,t,s,u,x,h;switch(n.type){case"boolean":return(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(eb.Z,{control:(0,r.jsx)(eZ.Z,{checked:null!=i&&i,onChange:e=>a(n.key,e.target.checked)}),label:n.label}),n.helperText&&(0,r.jsx)(m.Z,{variant:"caption",color:"text.secondary",sx:{ml:4,display:"block"},children:n.helperText})]});case"select":return(0,r.jsxs)($.Z,{fullWidth:!0,size:"small",children:[(0,r.jsx)(X.Z,{children:n.label}),(0,r.jsx)(Y.Z,{value:null!==(u=null!=i?i:null===(t=n.options)||void 0===t?void 0:null===(e=t[0])||void 0===e?void 0:e.value)&&void 0!==u?u:"",label:n.label,onChange:e=>a(n.key,e.target.value),children:null===(s=n.options)||void 0===s?void 0:s.map(e=>(0,r.jsx)(y.Z,{value:e.value,children:e.label},e.value))})]});case"number":return(0,r.jsx)(S.Z,{fullWidth:!0,size:"small",type:"number",label:n.label,value:null!=i?i:"",onChange:e=>{let t=e.target.value;a(n.key,""===t?void 0:parseInt(t,10))},inputProps:{min:null===(x=n.validation)||void 0===x?void 0:x.min,max:null===(h=n.validation)||void 0===h?void 0:h.max},helperText:n.helperText,InputProps:n.unit?{endAdornment:(0,r.jsx)(A.Z,{position:"end",children:(0,r.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:n.unit})})}:void 0});case"password":return(0,r.jsx)(S.Z,{fullWidth:!0,size:"small",type:o?"text":"password",label:n.label,value:null!=i?i:"",onChange:e=>a(n.key,e.target.value),helperText:n.helperText,InputProps:{endAdornment:(0,r.jsx)(A.Z,{position:"end",children:(0,r.jsx)(c.Z,{size:"small",onClick:()=>d(!o),edge:"end",children:o?(0,r.jsx)(eS.Z,{fontSize:"small"}):(0,r.jsx)(eC.Z,{fontSize:"small"})})})}});default:return(0,r.jsx)(S.Z,{fullWidth:!0,size:"small",label:n.label,value:null!=i?i:"",onChange:e=>a(n.key,e.target.value),helperText:n.helperText})}})()})}function ek(e){let{section:t,values:n,onChange:i}=e,[a,c]=(0,s.useState)(!1),d=t.icon,u=t.advancedFields.length;return(0,r.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,r.jsxs)(p.Z,{sx:{p:3},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1.5,mb:1},children:[(0,r.jsx)(d,{sx:{fontSize:22,color:"primary.main"}}),(0,r.jsx)(m.Z,{variant:"h6",fontWeight:600,children:t.title})]}),(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:t.description}),(0,r.jsx)(O.Z,{sx:{mb:3}}),(0,r.jsx)(w.ZP,{container:!0,spacing:2.5,children:t.essentialFields.map(e=>(0,r.jsx)(ew,{field:e,value:n[e.key],onChange:i},e.key))}),u>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.Z,{fullWidth:!0,variant:"text",onClick:()=>c(!a),endIcon:(0,r.jsx)(ej.Z,{sx:{transform:a?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s"}}),sx:{mt:2.5,justifyContent:"flex-start",color:"text.secondary",textTransform:"none",py:1,"&:hover":{bgcolor:"action.hover"}},children:[a?"Hide":"Show"," Advanced Settings (",u,")"]}),(0,r.jsx)(eg.Z,{in:a,timeout:300,children:(0,r.jsx)(l.Z,{sx:{pt:2,borderTop:"1px dashed",borderColor:"divider"},children:(0,r.jsx)(w.ZP,{container:!0,spacing:2.5,children:t.advancedFields.map(e=>(0,r.jsx)(ew,{field:e,value:n[e.key],onChange:i},e.key))})})})]})]})})}var eR=n(12550);function eI(e){let{hasChanges:t,changedCount:n,hasRestartChanges:s,restartFields:i=[],isSaving:a,onSave:c,onDiscard:d}=e;return(0,r.jsx)(eR.Z,{direction:"up",in:t,mountOnEnter:!0,unmountOnExit:!0,children:(0,r.jsxs)(l.Z,{sx:{position:"sticky",bottom:0,zIndex:1100,bgcolor:"background.paper",borderTop:2,borderColor:"primary.main",px:{xs:2,sm:3},py:2,mx:{xs:-2,sm:-3},mb:{xs:-2,sm:-3},boxShadow:"0 -4px 20px rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:1},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[s&&(0,r.jsx)(eu.Z,{sx:{color:"warning.main",fontSize:20}}),(0,r.jsxs)(m.Z,{variant:"body2",fontWeight:600,children:[n," unsaved change",1!==n?"s":""]}),s&&(0,r.jsxs)(m.Z,{variant:"caption",color:"warning.main",children:["(",i.length>0?i.join(", "):"some fields"," require restart)"]})]}),(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:1},children:[(0,r.jsx)(o.Z,{variant:"text",color:"inherit",onClick:d,disabled:a,children:"Discard"}),(0,r.jsx)(o.Z,{variant:"contained",startIcon:a?(0,r.jsx)(u.Z,{size:16,color:"inherit"}):(0,r.jsx)(ef.Z,{}),onClick:c,disabled:a,children:a?"Saving...":"Save Changes (".concat(n,")")})]})]})})}var eP=n(90158),eT=n(58347);function ez(e){let{open:t,changedFields:n,onSaveOnly:s,onSaveAndRestart:i,onCancel:a}=e;return(0,r.jsxs)(j.Z,{open:t,onClose:a,maxWidth:"sm",fullWidth:!0,children:[(0,r.jsx)(b.Z,{children:(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,r.jsx)(eu.Z,{color:"warning"}),(0,r.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Restart Required"})]})}),(0,r.jsxs)(Z.Z,{children:[(0,r.jsx)(m.Z,{variant:"body1",gutterBottom:!0,children:"The following changes require a server restart to take effect:"}),(0,r.jsx)(eP.Z,{dense:!0,children:n.map(e=>(0,r.jsx)(eT.ZP,{sx:{py:0},children:(0,r.jsx)(g.Z,{primary:e,primaryTypographyProps:{variant:"body2"}})},e))})]}),(0,r.jsxs)(C.Z,{children:[(0,r.jsx)(o.Z,{onClick:a,color:"inherit",children:"Cancel"}),(0,r.jsx)(o.Z,{onClick:s,variant:"outlined",children:"Save Only"}),(0,r.jsx)(o.Z,{onClick:i,variant:"contained",color:"warning",children:"Save & Restart"})]})]})}var eF=n(1217),eW=n(84974),eD=n(23482),eN=n(61244),eA=n(87739),eO=n(3509),eL=n(44945);let eM=[{id:"gameplay",icon:eF.Z,title:"Gameplay",description:"Core game rules and player experience settings.",essentialFields:[{key:"difficulty",label:"Difficulty",type:"select",options:[{value:"peaceful",label:"Peaceful"},{value:"easy",label:"Easy"},{value:"normal",label:"Normal"},{value:"hard",label:"Hard"}]},{key:"gameMode",label:"Game Mode",type:"select",options:[{value:"survival",label:"Survival"},{value:"creative",label:"Creative"},{value:"adventure",label:"Adventure"},{value:"spectator",label:"Spectator"}]},{key:"maxPlayers",label:"Max Players",type:"number",validation:{min:1,max:1e3}},{key:"pvp",label:"Enable PvP",type:"boolean",helperText:"Allow players to damage each other"}],advancedFields:[{key:"forceGamemode",label:"Force Game Mode",type:"boolean",helperText:"Force game mode when players join"},{key:"hardcore",label:"Hardcore",type:"boolean",helperText:"One life only - world deleted on death"},{key:"allowFlight",label:"Allow Flight",type:"boolean",helperText:"Allow flight in survival mode"},{key:"allowNether",label:"Allow Nether",type:"boolean",helperText:"Enable Nether portal access"},{key:"enableCommandBlock",label:"Command Blocks",type:"boolean",helperText:"Enable command block functionality"},{key:"spawnProtection",label:"Spawn Protection",type:"number",helperText:"Radius around spawn (0 = disabled)",unit:"blocks",validation:{min:0,max:256}},{key:"spawnAnimals",label:"Spawn Animals",type:"boolean",helperText:"Spawn passive mobs (cows, pigs, etc.)"},{key:"spawnMonsters",label:"Spawn Monsters",type:"boolean",helperText:"Spawn hostile mobs (zombies, creepers, etc.)"},{key:"spawnNpcs",label:"Spawn NPCs",type:"boolean",helperText:"Spawn villagers and wandering traders"}]},{id:"world",icon:eW.Z,title:"World",description:"World generation and server identity settings.",essentialFields:[{key:"motd",label:"MOTD (Message of the Day)",type:"string",helperText:"Displayed in the server list",columns:12},{key:"level",label:"World Name",type:"string",helperText:"Save folder name",restartRequired:!0},{key:"levelType",label:"Level Type",type:"select",restartRequired:!0,options:[{value:"default",label:"Default"},{value:"flat",label:"Flat"},{value:"largeBiomes",label:"Large Biomes"},{value:"amplified",label:"Amplified"},{value:"buffet",label:"Buffet"}]},{key:"seed",label:"World Seed",type:"string",helperText:"Only affects new world generation",restartRequired:!0}],advancedFields:[{key:"generateStructures",label:"Generate Structures",type:"boolean",helperText:"Generate villages, temples, etc."},{key:"maxWorldSize",label:"Max World Size",type:"number",unit:"blocks",helperText:"Maximum world radius",validation:{min:1,max:29999984}},{key:"icon",label:"Server Icon URL",type:"string",helperText:"64x64 PNG image URL",columns:12}]},{id:"security",icon:eD.Z,title:"Security",description:"Authentication and access control settings.",essentialFields:[{key:"onlineMode",label:"Online Mode (Mojang Auth)",type:"boolean",helperText:"Disable to allow cracked clients (not recommended)",restartRequired:!0},{key:"enableWhitelist",label:"Enable Whitelist",type:"boolean",helperText:"Only whitelisted players can join",restartRequired:!0}],advancedFields:[{key:"enforceWhitelist",label:"Enforce Whitelist",type:"boolean",helperText:"Kick non-whitelisted players already online",restartRequired:!0},{key:"enforceSecureProfile",label:"Enforce Secure Profile",type:"boolean",helperText:"Require signed chat messages from players",restartRequired:!0}]},{id:"performance",icon:E.Z,title:"Performance & JVM",description:"Memory, view distance, and JVM optimization settings.",essentialFields:[{key:"memory",label:"Memory",type:"string",helperText:"e.g., 2G, 4G, 8G",restartRequired:!0},{key:"useAikarFlags",label:"Aikar's Flags",type:"boolean",helperText:"Optimized GC flags for Paper/Spigot",restartRequired:!0},{key:"viewDistance",label:"View Distance",type:"number",unit:"chunks",validation:{min:2,max:32}}],advancedFields:[{key:"simulationDistance",label:"Simulation Distance",type:"number",unit:"chunks",validation:{min:3,max:32}},{key:"maxTickTime",label:"Max Tick Time",type:"number",unit:"ms",helperText:"-1 to disable watchdog",validation:{min:-1}},{key:"initMemory",label:"Initial Heap",type:"string",helperText:"e.g., 1G (overrides Memory)",restartRequired:!0},{key:"maxMemory",label:"Max Heap",type:"string",helperText:"e.g., 8G (overrides Memory)",restartRequired:!0},{key:"jvmXxOpts",label:"JVM -XX Options",type:"string",helperText:"Additional -XX JVM flags",restartRequired:!0,columns:12}]},{id:"autopause",icon:eN.Z,title:"Auto-pause / Auto-stop",description:"Automatically pause or stop when no players are connected.",essentialFields:[{key:"enableAutopause",label:"Enable Auto-pause",type:"boolean",helperText:"Pause process when no players connected",restartRequired:!0},{key:"autopauseTimeoutEst",label:"Pause Timeout",type:"number",unit:"seconds",helperText:"Wait time after last player leaves",validation:{min:0}}],advancedFields:[{key:"autopauseTimeoutInit",label:"Init Timeout",type:"number",unit:"seconds",helperText:"Timeout after start without connections",validation:{min:0}},{key:"autopausePeriod",label:"Check Period",type:"number",unit:"seconds",helperText:"Status check interval",validation:{min:1}},{key:"enableAutostop",label:"Enable Auto-stop",type:"boolean",helperText:"Stop container when no players connected",restartRequired:!0},{key:"autostopTimeoutEst",label:"Stop Timeout",type:"number",unit:"seconds",helperText:"Wait time before stopping container",validation:{min:0}},{key:"pauseWhenEmptySeconds",label:"Native Pause Delay (MC 1.21.2+)",type:"number",unit:"seconds",helperText:"Seconds to wait before native pause when empty (0 = disable). Requires MC 1.21.2+.",restartRequired:!0,validation:{min:0}}]},{id:"system",icon:eA.Z,title:"System",description:"Timezone, resource pack, RCON, and container settings.",essentialFields:[{key:"tz",label:"Timezone",type:"string",helperText:"e.g., Asia/Seoul, UTC",restartRequired:!0},{key:"resourcePack",label:"Resource Pack URL",type:"string",helperText:"Direct download URL for resource pack",columns:12},{key:"enableRcon",label:"Enable RCON",type:"boolean",helperText:"Remote server console access",restartRequired:!0}],advancedFields:[{key:"resourcePackSha1",label:"Resource Pack SHA1",type:"string",helperText:"40-character hex checksum",columns:12},{key:"resourcePackEnforce",label:"Enforce Resource Pack",type:"boolean",helperText:"Kick players who decline"},{key:"resourcePackPrompt",label:"Resource Pack Prompt",type:"string",helperText:"Custom message for resource pack dialog",columns:12},{key:"rconPassword",label:"RCON Password",type:"password",restartRequired:!0},{key:"rconPort",label:"RCON Port",type:"number",validation:{min:1024,max:65535},restartRequired:!0},{key:"stopDuration",label:"Stop Timeout",type:"number",unit:"seconds",helperText:"Graceful shutdown wait time",restartRequired:!0,validation:{min:0}},{key:"uid",label:"User ID (UID)",type:"number",helperText:"Container process UID",restartRequired:!0,validation:{min:0}},{key:"gid",label:"Group ID (GID)",type:"number",helperText:"Container process GID",restartRequired:!0,validation:{min:0}}]},{id:"remoteAccess",icon:eO.Z,title:"Remote Access",description:"WebSocket console and SSH access configuration.",essentialFields:[{key:"websocketConsole",label:"Enable WebSocket Console",type:"boolean",helperText:"Expose a browser-accessible console via WebSocket",restartRequired:!0},{key:"enableSsh",label:"Enable SSH Console",type:"boolean",helperText:"SSH console access on port 2222",restartRequired:!0}],advancedFields:[{key:"websocketAddress",label:"WebSocket Bind Address",type:"string",helperText:"e.g., 0.0.0.0:80",columns:12},{key:"websocketPassword",label:"WebSocket Password",type:"password",helperText:"Leave blank to use RCON password"},{key:"websocketDisableAuthentication",label:"Disable WebSocket Auth",type:"boolean",helperText:"Allow unauthenticated WebSocket connections (not recommended)"},{key:"websocketAllowedOrigins",label:"Allowed Origins",type:"string",helperText:"Comma-separated allowed origins (e.g., https://example.com)",columns:12},{key:"websocketLogBufferSize",label:"Log Buffer Size",type:"number",helperText:"Number of log lines kept in history",validation:{min:1}}]},{id:"config-repos",icon:eL.Z,title:"Configuration Repositories",description:"Git repository URLs for server configuration templates (applied at startup).",essentialFields:[{key:"serverPropertiesRepoUrl",label:"server.properties Repository URL",type:"string",helperText:"Git repository URL for base server.properties template",restartRequired:!0,columns:12},{key:"paperConfigRepo",label:"Paper Config Repository URL",type:"string",helperText:"Git repository URL for Paper optimized configuration",restartRequired:!0,columns:12},{key:"pufferfishConfigRepo",label:"Pufferfish Config Repository URL",type:"string",helperText:"Git repository URL for Pufferfish configuration",restartRequired:!0,columns:12},{key:"purpurConfigRepo",label:"Purpur Config Repository URL",type:"string",helperText:"Git repository URL for Purpur configuration",restartRequired:!0,columns:12}],advancedFields:[]}],eq=["memory","initMemory","maxMemory","useAikarFlags","jvmXxOpts","onlineMode","enableWhitelist","enforceWhitelist","enforceSecureProfile","level","seed","levelType","enableAutopause","enableAutostop","enableRcon","rconPassword","rconPort","tz","uid","gid","stopDuration"];function eE(e){let{serverName:t,isRunning:n}=e,{data:i,isLoading:a}=(0,ex.iC)(t),c=(0,ex.MH)(),x=(0,ex.gx)(),f=(0,ex._I)(),[y,v]=(0,s.useState)({}),[g,w]=(0,s.useState)({}),[k,R]=(0,s.useState)(!1),[I,P]=(0,s.useState)(""),[T,z]=(0,s.useState)(!1),[F,W]=(0,s.useState)({open:!1,message:"",severity:"info"});(0,s.useEffect)(()=>{(null==i?void 0:i.config)&&(v(i.config),w(i.config))},[i]);let D=(0,s.useMemo)(()=>{let e=[];for(let t of Object.keys(y))y[t]!==g[t]&&e.push(t);for(let t of Object.keys(g))y[t]===g[t]||e.includes(t)||e.push(t);return e},[y,g]),N=D.length>0,A=D.filter(e=>eq.includes(e)),L=A.length>0,M=(0,s.useCallback)((e,t)=>{v(n=>({...n,[e]:t}))},[]),q=(0,s.useCallback)(()=>{v(g)},[g]),E=(0,s.useCallback)(async e=>{try{let r=await c.mutateAsync({serverName:t,config:y});if(w(r.config),v(r.config),e&&n)try{await f.mutateAsync(t),W({open:!0,message:"Settings saved. Server is restarting...",severity:"warning"})}catch(e){W({open:!0,message:"Settings saved, but server restart failed. Please restart manually.",severity:"error"})}else W({open:!0,message:r.restartRequired?"Settings saved. Restart required for some changes to take effect.":"Settings saved successfully.",severity:r.restartRequired?"warning":"success"})}catch(e){W({open:!0,message:e instanceof Error?e.message:"Failed to save settings",severity:"error"})}finally{z(!1)}},[y,t,n,c,f]),U=(0,s.useCallback)(()=>{L&&n?z(!0):E(!1)},[L,n,E]),B=async()=>{if("RESET"!==I){W({open:!0,message:"Please type RESET to confirm",severity:"warning"});return}try{await x.mutateAsync(t),W({open:!0,message:"World reset successfully",severity:"success"}),R(!1),P("")}catch(e){W({open:!0,message:e instanceof Error?e.message:"Failed to reset world",severity:"error"})}};return a?(0,r.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,r.jsx)(u.Z,{})}):(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(ev,{serverName:t}),eM.map(e=>(0,r.jsx)(ek,{section:e,values:y,onChange:M},e.id)),(0,r.jsx)(h.Z,{sx:{borderRadius:3,borderColor:"error.main",borderWidth:1,borderStyle:"solid"},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,color:"error",children:"Danger Zone"}),(0,r.jsx)(O.Z,{sx:{mb:3}}),(0,r.jsxs)(l.Z,{sx:{mb:3},children:[(0,r.jsx)(m.Z,{variant:"subtitle1",fontWeight:600,gutterBottom:!0,children:"Reset World"}),(0,r.jsx)(m.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,r.jsx)(o.Z,{variant:"outlined",color:"error",startIcon:(0,r.jsx)(eu.Z,{}),onClick:()=>R(!0),disabled:n,children:"Reset World"}),n&&(0,r.jsx)(m.Z,{variant:"caption",color:"text.secondary",sx:{ml:2},children:"Stop the server first"})]})]})}),(0,r.jsx)(eI,{hasChanges:N,changedCount:D.length,hasRestartChanges:L,restartFields:A,isSaving:c.isPending,onSave:U,onDiscard:q}),(0,r.jsx)(ez,{open:T,changedFields:A,onSaveOnly:()=>E(!1),onSaveAndRestart:()=>E(!0),onCancel:()=>z(!1)}),(0,r.jsxs)(j.Z,{open:k,onClose:()=>R(!1),maxWidth:"sm",fullWidth:!0,children:[(0,r.jsx)(b.Z,{children:(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,r.jsx)(ec.Z,{color:"error"}),(0,r.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Reset World"})]})}),(0,r.jsxs)(Z.Z,{children:[(0,r.jsxs)(m.Z,{variant:"body1",gutterBottom:!0,children:["This will permanently delete the world for ",(0,r.jsx)("strong",{children:t})," and generate a new one."]}),(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",gutterBottom:!0,children:"This action cannot be undone. All player progress and builds will be lost."}),(0,r.jsx)(S.Z,{fullWidth:!0,label:"Type RESET to confirm",value:I,onChange:e=>P(e.target.value),sx:{mt:3},autoFocus:!0})]}),(0,r.jsxs)(C.Z,{children:[(0,r.jsx)(o.Z,{onClick:()=>R(!1),children:"Cancel"}),(0,r.jsx)(o.Z,{variant:"contained",color:"error",onClick:B,disabled:"RESET"!==I||x.isPending,startIcon:x.isPending?(0,r.jsx)(u.Z,{size:16}):(0,r.jsx)(ed.Z,{}),children:x.isPending?"Resetting...":"Reset World"})]})]}),(0,r.jsx)(eo.Z,{open:F.open,autoHideDuration:6e3,onClose:()=>W({...F,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,r.jsx)(d.Z,{onClose:()=>W({...F,open:!1}),severity:F.severity,sx:{width:"100%"},children:F.message})})]})}var eU=n(86702),eB=n(47606),eK=n(407),eV=n(56056),eH=n(11597),eQ=n(59602);let eG={admin:{label:"Owner",color:"primary",variant:"filled"},manage:{label:"Operator",color:"info",variant:"outlined"},view:{label:"Viewer",color:"default",variant:"outlined"}};function eJ(e){let{permission:t,size:n="medium"}=e,s=eG[t];return(0,r.jsx)(N.Z,{label:s.label,color:s.color,variant:s.variant,size:n})}var e_=n(99046),e$=n(68038),eX=n(34080),eY=n(39181),e0=n(98324),e1=n(58919),e2=n(20367),e3=n(42936);function e6(e){var t,n;let{open:i,onClose:a,serverId:c}=e,[x,h]=(0,s.useState)(""),[p,f]=(0,s.useState)(null),[y,v]=(0,s.useState)("view"),{data:g,isLoading:w}=(n={enabled:i},(0,e0.a)({queryKey:["users","search",x],queryFn:()=>(0,e3.SC)("/api/users?q=".concat(encodeURIComponent(x))),enabled:(null==n?void 0:n.enabled)!==!1&&x.length>=2,staleTime:3e4})),k=function(){let e=(0,e1.NL)();return(0,e2.D)({mutationFn:e=>(0,e3.SC)("/api/user-servers",{method:"POST",body:JSON.stringify(e)}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["user-servers",n.serverId]}),e.invalidateQueries({queryKey:["user-servers"]})}})}(),R=(0,s.useMemo)(()=>{var e;return null!==(e=null==g?void 0:g.users)&&void 0!==e?e:[]},[g]),I=()=>{h(""),f(null),v("view"),k.reset(),a()};return(0,r.jsxs)(j.Z,{open:i,onClose:I,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:3}},children:[(0,r.jsx)(b.Z,{sx:{fontWeight:600},children:"Add User Access"}),(0,r.jsxs)(Z.Z,{sx:{display:"flex",flexDirection:"column",gap:3,pt:"8px !important"},children:[k.isError&&(0,r.jsx)(d.Z,{severity:"error",sx:{mb:1},children:(null===(t=k.error)||void 0===t?void 0:t.message)||"Failed to grant access"}),(0,r.jsx)(e_.Z,{options:R,getOptionLabel:e=>e.name||e.email,isOptionEqualToValue:(e,t)=>e.id===t.id,value:p,onChange:(e,t)=>f(t),inputValue:x,onInputChange:(e,t)=>h(t),loading:w,filterOptions:e=>e,noOptionsText:x.length<2?"Type at least 2 characters":"No users found",renderInput:e=>(0,r.jsx)(S.Z,{...e,label:"Search User",placeholder:"Search by name or email...",InputProps:{...e.InputProps,endAdornment:(0,r.jsxs)(r.Fragment,{children:[w&&(0,r.jsx)(u.Z,{size:20}),e.InputProps.endAdornment]})}}),renderOption:(e,t)=>{var n,s,i;let{key:a,...o}=e;return(0,r.jsxs)(l.Z,{component:"li",...o,sx:{display:"flex",gap:1.5,py:1},children:[(0,r.jsx)(eU.Z,{src:null!==(i=t.image)&&void 0!==i?i:void 0,sx:{width:32,height:32,bgcolor:"primary.main",fontSize:14},children:((null===(n=t.name)||void 0===n?void 0:n[0])||(null===(s=t.email)||void 0===s?void 0:s[0])||"?").toUpperCase()}),(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(m.Z,{variant:"body2",fontWeight:500,children:t.name||"Unknown"}),(0,r.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:t.email})]})]},a)}}),(0,r.jsxs)($.Z,{children:[(0,r.jsx)(e$.Z,{sx:{fontWeight:500,mb:1},children:"Permission Level"}),(0,r.jsxs)(eX.Z,{value:y,onChange:e=>v(e.target.value),children:[(0,r.jsx)(eb.Z,{value:"view",control:(0,r.jsx)(eY.Z,{size:"small"}),label:(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(m.Z,{variant:"body2",fontWeight:500,children:"Viewer"}),(0,r.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:"Can view server status and logs"})]})}),(0,r.jsx)(eb.Z,{value:"manage",control:(0,r.jsx)(eY.Z,{size:"small"}),label:(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(m.Z,{variant:"body2",fontWeight:500,children:"Operator"}),(0,r.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:"Can start, stop, and configure the server"})]})}),(0,r.jsx)(eb.Z,{value:"admin",control:(0,r.jsx)(eY.Z,{size:"small"}),label:(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(m.Z,{variant:"body2",fontWeight:500,children:"Owner"}),(0,r.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:"Full control including managing other users"})]})})]})]})]}),(0,r.jsxs)(C.Z,{sx:{px:3,pb:2},children:[(0,r.jsx)(o.Z,{onClick:I,color:"inherit",children:"Cancel"}),(0,r.jsx)(o.Z,{onClick:()=>{p&&k.mutate({userId:p.id,serverId:c,permission:y},{onSuccess:I})},variant:"contained",disabled:!p||k.isPending,sx:{borderRadius:2},children:k.isPending?"Adding...":"Add User"})]})]})}function e4(e){var t,n;let{serverId:i}=e,{data:a,isLoading:u,error:j}=(0,e0.a)({queryKey:["user-servers",i],queryFn:()=>(0,e3.SC)("/api/user-servers?serverId=".concat(encodeURIComponent(i))),enabled:!!i}),b=function(){let e=(0,e1.NL)();return(0,e2.D)({mutationFn:e=>{let{id:t,permission:n}=e;return(0,e3.SC)("/api/user-servers/".concat(encodeURIComponent(t)),{method:"PATCH",body:JSON.stringify({permission:n})})},onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),Z=function(){let e=(0,e1.NL)();return(0,e2.D)({mutationFn:e=>(0,e3.SC)("/api/user-servers/".concat(encodeURIComponent(e)),{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),[C,S]=(0,s.useState)(!1),[w,k]=(0,s.useState)(null),[R,I]=(0,s.useState)(null),T=(e,t)=>{k(e.currentTarget),I(t)},z=()=>{k(null),I(null)},F=e=>{if(!R||R.permission===e){z();return}b.mutate({id:R.id,permission:e},{onSettled:z})},W=null!==(t=null==a?void 0:a.users.filter(e=>"admin"===e.permission).length)&&void 0!==t?t:0,D=(null==R?void 0:R.permission)==="admin"&&W<=1;if(u)return(0,r.jsx)(h.Z,{sx:{borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,r.jsx)(x.Z,{variant:"text",width:"30%",height:32}),(0,r.jsx)(x.Z,{variant:"rounded",width:120,height:36,sx:{borderRadius:2}})]}),(0,r.jsx)(O.Z,{sx:{mb:2}}),[0,1,2].map(e=>(0,r.jsxs)(l.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:40,height:40}),(0,r.jsxs)(l.Z,{sx:{flex:1},children:[(0,r.jsx)(x.Z,{variant:"text",width:"40%"}),(0,r.jsx)(x.Z,{variant:"text",width:"60%"})]}),(0,r.jsx)(x.Z,{variant:"rounded",width:80,height:28,sx:{borderRadius:10}}),(0,r.jsx)(x.Z,{variant:"circular",width:32,height:32})]},e))]})});if(j)return(0,r.jsxs)(d.Z,{severity:"error",children:["Failed to load access list: ",j.message]});let N=null!==(n=null==a?void 0:a.users)&&void 0!==n?n:[];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(h.Z,{sx:{borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,r.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Server Access"}),(0,r.jsx)(o.Z,{variant:"contained",size:"small",startIcon:(0,r.jsx)(eB.Z,{}),onClick:()=>S(!0),sx:{borderRadius:2},children:"Add User"})]}),(0,r.jsx)(O.Z,{sx:{mb:1}}),0===N.length?(0,r.jsx)(l.Z,{sx:{py:4,textAlign:"center"},children:(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:"No users have been granted access to this server yet."})}):N.map(e=>{var t,n,s,i,a,o,d,u;return(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:[(0,r.jsx)(eU.Z,{src:null!==(u=null===(t=e.user)||void 0===t?void 0:t.image)&&void 0!==u?u:void 0,sx:{width:40,height:40,bgcolor:"primary.main",fontSize:16},children:((null===(s=e.user)||void 0===s?void 0:null===(n=s.name)||void 0===n?void 0:n[0])||(null===(a=e.user)||void 0===a?void 0:null===(i=a.email)||void 0===i?void 0:i[0])||"?").toUpperCase()}),(0,r.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,r.jsx)(m.Z,{variant:"body2",fontWeight:500,noWrap:!0,children:(null===(o=e.user)||void 0===o?void 0:o.name)||"Unknown User"}),(0,r.jsx)(m.Z,{variant:"caption",color:"text.secondary",noWrap:!0,children:(null===(d=e.user)||void 0===d?void 0:d.email)||e.userId})]}),(0,r.jsx)(eJ,{permission:e.permission,size:"small"}),(0,r.jsx)(c.Z,{size:"small",onClick:t=>T(t,e),sx:{color:"text.secondary"},children:(0,r.jsx)(P.Z,{fontSize:"small"})})]},e.id)}),(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mt:2,pt:1},children:[(0,r.jsx)(eQ.Z,{sx:{fontSize:16,color:"text.disabled"}}),(0,r.jsx)(m.Z,{variant:"caption",color:"text.disabled",children:"Only platform admins and server owners can manage access."})]})]})}),(0,r.jsxs)(f.Z,{anchorEl:w,open:!!w,onClose:z,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,children:[(0,r.jsxs)(y.Z,{onClick:()=>F("admin"),disabled:(null==R?void 0:R.permission)==="admin",children:[(0,r.jsx)(v.Z,{children:(0,r.jsx)(eK.Z,{fontSize:"small"})}),(0,r.jsx)(g.Z,{children:"Change to Owner"})]}),(0,r.jsxs)(y.Z,{onClick:()=>F("manage"),disabled:(null==R?void 0:R.permission)==="manage"||D,children:[(0,r.jsx)(v.Z,{children:(0,r.jsx)(eV.Z,{fontSize:"small"})}),(0,r.jsx)(g.Z,{children:"Change to Operator"})]}),(0,r.jsxs)(y.Z,{onClick:()=>F("view"),disabled:(null==R?void 0:R.permission)==="view"||D,children:[(0,r.jsx)(v.Z,{children:(0,r.jsx)(eC.Z,{fontSize:"small"})}),(0,r.jsx)(g.Z,{children:"Change to Viewer"})]}),(0,r.jsx)(O.Z,{}),(0,r.jsxs)(y.Z,{onClick:()=>{R&&Z.mutate(R.id,{onSettled:z})},disabled:D,sx:{color:"error.main"},children:[(0,r.jsx)(v.Z,{children:(0,r.jsx)(eH.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,r.jsx)(g.Z,{children:"Remove Access"})]})]}),(0,r.jsx)(e6,{open:C,onClose:()=>S(!1),serverId:i})]})}var e5=n(37228),e8=n(97511);function e7(e){let{label:t,value:n,copyText:s}=e;return(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",py:1},children:[(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:t}),(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(m.Z,{variant:"body2",sx:{color:s?"text.primary":"text.secondary",wordBreak:"break-all"},children:n}),s&&(0,r.jsx)(e8.q,{text:s,size:16})]})]})}function e9(e){let{serverName:t,hostname:n}=e,{data:s,isLoading:i}=(0,e5.UW)();if(i)return(0,r.jsx)(h.Z,{sx:{borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsx)(x.Z,{variant:"text",width:"40%",height:28,sx:{mb:1}}),(0,r.jsx)(x.Z,{variant:"rectangular",height:1,sx:{mb:2}}),(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,r.jsx)(x.Z,{variant:"text",width:"30%"}),(0,r.jsx)(x.Z,{variant:"text",width:"40%"})]}),(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,r.jsx)(x.Z,{variant:"text",width:"30%"}),(0,r.jsx)(x.Z,{variant:"text",width:"40%"})]})]})});let a=(null==s?void 0:s.enabled)&&s.servers.length>0,o=null==s?void 0:s.servers.find(e=>e.serverName===t),c=(null==o?void 0:o.playitDomain)||"Not configured",d=!!(null==o?void 0:o.playitDomain);return(0,r.jsx)(h.Z,{sx:{borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Connection"}),(0,r.jsx)(O.Z,{sx:{mb:2}}),(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",py:1,gap:1},children:[(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{flexShrink:0},children:"LAN Address"}),n?(0,r.jsx)(l.Z,{sx:{minWidth:0},children:(0,r.jsx)(e8.h,{hostname:n,portSuffix:25565,color:"text.primary",showCopyButton:!0})}):(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:"Not configured"})]}),a&&(0,r.jsx)(e7,{label:"External Address",value:c,copyText:d?c:void 0})]})})}var te=n(95511),tt=n(42431),tn=n(76777),tr=n(15761),ts=n(9078);function ti(e){return e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):String(e)}function ta(e){let{slug:t,detail:n,isLoading:s,onRemove:i,isRemoving:a}=e;return s?(0,r.jsx)(h.Z,{variant:"outlined",sx:{borderRadius:2},children:(0,r.jsx)(p.Z,{sx:{py:1.5,px:2,"&:last-child":{pb:1.5}},children:(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:1.5,alignItems:"flex-start"},children:[(0,r.jsx)(x.Z,{variant:"rounded",width:40,height:40}),(0,r.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,r.jsx)(x.Z,{variant:"text",width:"40%",height:24}),(0,r.jsx)(x.Z,{variant:"text",width:"80%",height:20}),(0,r.jsx)(x.Z,{variant:"text",width:"30%",height:16})]})]})})}):n?(0,r.jsx)(h.Z,{variant:"outlined",sx:{borderRadius:2},children:(0,r.jsx)(p.Z,{sx:{py:1.5,px:2,"&:last-child":{pb:1.5}},children:(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:1.5,alignItems:"flex-start"},children:[(0,r.jsx)(eU.Z,{src:n.iconUrl||void 0,variant:"rounded",sx:{width:40,height:40,bgcolor:"action.hover"},children:(0,r.jsx)(tn.Z,{})}),(0,r.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,r.jsx)(m.Z,{variant:"subtitle2",noWrap:!0,children:n.title}),(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",ml:1,flexShrink:0},children:[(0,r.jsx)(te.Z,{title:"View on Modrinth",children:(0,r.jsx)(c.Z,{size:"small",href:n.sourceUrl,target:"_blank",rel:"noopener noreferrer",component:"a",children:(0,r.jsx)(ts.Z,{fontSize:"small"})})}),(0,r.jsx)(te.Z,{title:"Remove",children:(0,r.jsx)(c.Z,{size:"small",onClick:()=>i(t),disabled:a,color:"error",children:(0,r.jsx)(T.Z,{fontSize:"small"})})})]})]}),(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mt:.25,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:n.description}),(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.25},children:[(0,r.jsx)(tr.Z,{sx:{fontSize:14,color:"text.disabled"}}),(0,r.jsx)(m.Z,{variant:"caption",color:"text.disabled",children:ti(n.downloads)})]}),n.author&&(0,r.jsxs)(m.Z,{variant:"caption",color:"text.disabled",children:["by ",n.author]})]})]})]})})}):(0,r.jsx)(h.Z,{variant:"outlined",sx:{borderRadius:2},children:(0,r.jsx)(p.Z,{sx:{py:1.5,px:2,"&:last-child":{pb:1.5}},children:(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:1.5,alignItems:"center"},children:[(0,r.jsx)(eU.Z,{variant:"rounded",sx:{width:40,height:40,bgcolor:"action.hover"},children:(0,r.jsx)(tn.Z,{})}),(0,r.jsx)(l.Z,{sx:{flex:1,minWidth:0},children:(0,r.jsx)(m.Z,{variant:"subtitle2",noWrap:!0,children:t})}),(0,r.jsx)(te.Z,{title:"View on Modrinth",children:(0,r.jsx)(c.Z,{size:"small",href:"https://modrinth.com/mod/".concat(t),target:"_blank",rel:"noopener noreferrer",component:"a",children:(0,r.jsx)(ts.Z,{fontSize:"small"})})}),(0,r.jsx)(te.Z,{title:"Remove",children:(0,r.jsx)(c.Z,{size:"small",onClick:()=>i(t),disabled:a,color:"error",children:(0,r.jsx)(T.Z,{fontSize:"small"})})})]})})})}function tl(e){let{serverName:t}=e,{data:n,isLoading:i,error:a}=(0,e0.a)({queryKey:["servers",t,"mods"],queryFn:()=>(0,e3.SC)("/api/servers/".concat(encodeURIComponent(t),"/mods")),enabled:!!t}),x=function(){let e=(0,e1.NL)();return(0,e2.D)({mutationFn:e=>{let{serverName:t,slugs:n,source:r}=e;return(0,e3.SC)("/api/servers/".concat(encodeURIComponent(t),"/mods"),{method:"POST",body:JSON.stringify({slugs:n,source:r})})},onSuccess:(t,n)=>{let{serverName:r}=n;e.invalidateQueries({queryKey:["servers",r,"mods"]})}})}(),f=function(){let e=(0,e1.NL)();return(0,e2.D)({mutationFn:e=>{let{serverName:t,slug:n}=e;return(0,e3.SC)("/api/servers/".concat(encodeURIComponent(t),"/mods/").concat(encodeURIComponent(n)),{method:"DELETE"})},onSuccess:(t,n)=>{let{serverName:r}=n;e.invalidateQueries({queryKey:["servers",r,"mods"]})}})}(),[y,v]=(0,s.useState)(!1),[g,C]=(0,s.useState)(""),[w,k]=(0,s.useState)(""),[R,I]=(0,s.useState)(!1),[P,T]=(0,s.useState)({open:!1,message:"",severity:"info"}),{data:z,isLoading:F}=function(e,t){let n=new URLSearchParams;return e&&n.set("q",e),(null==t?void 0:t.limit)!=null&&n.set("limit",String(t.limit)),(null==t?void 0:t.offset)!=null&&n.set("offset",String(t.offset)),(0,e0.a)({queryKey:["mods","search",e,null==t?void 0:t.limit,null==t?void 0:t.offset],queryFn:()=>(0,e3.SC)("/api/mods/search?".concat(n)),enabled:(null==t?void 0:t.enabled)!==!1&&!!e.trim()})}(w,{limit:10,enabled:y&&w.length>0}),W=new Set;if(null==n?void 0:n.mods)for(let e of Object.values(n.mods))for(let t of e)W.add(t);let D=Array.from(W),{data:N,isLoading:L}=function(e,t){let n=e.slice().sort().join(","),r=new URLSearchParams;return n&&r.set("slugs",n),(null==t?void 0:t.source)&&r.set("source",t.source),(0,e0.a)({queryKey:["mods","projects",n,null==t?void 0:t.source],queryFn:()=>(0,e3.SC)("/api/mods/projects?".concat(r)),enabled:(null==t?void 0:t.enabled)!==!1&&e.length>0,staleTime:3e5,gcTime:18e5})}(D,{enabled:D.length>0});(0,s.useEffect)(()=>{let e=setTimeout(()=>{k(g)},300);return()=>clearTimeout(e)},[g]);let M=(0,s.useCallback)(async e=>{try{await f.mutateAsync({serverName:t,slug:e}),I(!0),T({open:!0,message:"Removed ".concat(e),severity:"success"})}catch(e){T({open:!0,message:e instanceof Error?e.message:"Failed to remove mod",severity:"error"})}},[f,t]),E=(0,s.useCallback)(async e=>{try{await x.mutateAsync({serverName:t,slugs:[e]}),I(!0),T({open:!0,message:"Added ".concat(e),severity:"success"})}catch(e){T({open:!0,message:e instanceof Error?e.message:"Failed to add mod",severity:"error"})}},[x,t]);if(i)return(0,r.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:6},children:(0,r.jsx)(u.Z,{})});if(a)return(0,r.jsxs)(d.Z,{severity:"error",sx:{mt:2},children:["Failed to load mods: ",a.message]});let U=W.size>0;return(0,r.jsxs)(l.Z,{children:[R&&(0,r.jsx)(d.Z,{severity:"info",sx:{mb:2},children:"Restart the server to apply mod changes."}),(0,r.jsx)(h.Z,{sx:{borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,r.jsx)(m.Z,{variant:"h6",fontWeight:600,children:"Installed Mods"}),(0,r.jsx)(o.Z,{variant:"contained",size:"small",startIcon:(0,r.jsx)(em.Z,{}),onClick:()=>{C(""),k(""),v(!0)},children:"Add Mods"})]}),(0,r.jsx)(O.Z,{sx:{mb:2}}),U?Object.entries(n.mods).map(e=>{let[t,n]=e;return(0,r.jsxs)(l.Z,{sx:{mb:2},children:[(0,r.jsx)(m.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1,textTransform:"capitalize"},children:t}),(0,r.jsx)(l.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:n.map(e=>{var t;return(0,r.jsx)(ta,{slug:e,detail:null==N?void 0:null===(t=N.projects)||void 0===t?void 0:t[e],isLoading:L,onRemove:M,isRemoving:f.isPending},e)})})]},t)}):(0,r.jsxs)(l.Z,{sx:{textAlign:"center",py:4},children:[(0,r.jsx)(tn.Z,{sx:{fontSize:48,color:"text.disabled",mb:1}}),(0,r.jsx)(m.Z,{variant:"body1",color:"text.secondary",children:"No mods installed"}),(0,r.jsx)(m.Z,{variant:"body2",color:"text.disabled",sx:{mt:.5},children:'Click "Add Mods" to search and install mods from Modrinth'})]})]})}),(0,r.jsxs)(j.Z,{open:y,onClose:()=>v(!1),maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{minHeight:400}},children:[(0,r.jsxs)(b.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Search Mods",(0,r.jsx)(c.Z,{onClick:()=>v(!1),size:"small",children:(0,r.jsx)(q.Z,{})})]}),(0,r.jsxs)(Z.Z,{children:[(0,r.jsx)(S.Z,{fullWidth:!0,autoFocus:!0,placeholder:"Search Modrinth...",value:g,onChange:e=>C(e.target.value),InputProps:{startAdornment:(0,r.jsx)(A.Z,{position:"start",children:(0,r.jsx)(tt.Z,{})})},sx:{mb:2}}),F&&(0,r.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,r.jsx)(u.Z,{size:28})}),!F&&z&&0===z.hits.length&&w&&(0,r.jsxs)(m.Z,{variant:"body2",color:"text.secondary",sx:{textAlign:"center",py:4},children:['No mods found for "',w,'"']}),!F&&z&&z.hits.length>0&&(0,r.jsx)(l.Z,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:z.hits.map(e=>{let t=W.has(e.slug);return(0,r.jsx)(h.Z,{variant:"outlined",sx:{borderRadius:2},children:(0,r.jsx)(p.Z,{sx:{py:1.5,px:2,"&:last-child":{pb:1.5}},children:(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:1.5,alignItems:"flex-start"},children:[(0,r.jsx)(eU.Z,{src:e.iconUrl||void 0,variant:"rounded",sx:{width:40,height:40,bgcolor:"action.hover"},children:(0,r.jsx)(tn.Z,{})}),(0,r.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,r.jsx)(m.Z,{variant:"subtitle2",noWrap:!0,children:e.title}),(0,r.jsx)(o.Z,{size:"small",variant:t?"outlined":"contained",disabled:t||x.isPending,onClick:()=>E(e.slug),sx:{ml:1,minWidth:80,flexShrink:0},children:t?"Installed":"Add"})]}),(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mt:.25,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:e.description}),(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.25},children:[(0,r.jsx)(tr.Z,{sx:{fontSize:14,color:"text.disabled"}}),(0,r.jsx)(m.Z,{variant:"caption",color:"text.disabled",children:ti(e.downloads)})]}),e.author&&(0,r.jsxs)(m.Z,{variant:"caption",color:"text.disabled",children:["by ",e.author]})]})]})]})})},e.slug)})})]})]}),(0,r.jsx)(eo.Z,{open:P.open,autoHideDuration:4e3,onClose:()=>T(e=>({...e,open:!1})),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:(0,r.jsx)(d.Z,{onClose:()=>T(e=>({...e,open:!1})),severity:P.severity,variant:"filled",children:P.message})})]})}function to(e,t){return(0,e0.a)({queryKey:["servers",e,"files","content",t],queryFn:()=>{let n=new URLSearchParams({path:t});return(0,e3.SC)("/api/servers/".concat(encodeURIComponent(e),"/files/read?").concat(n))},enabled:!!e&&!!t})}function tc(e){let t=(0,e1.NL)();return(0,e2.D)({mutationFn:t=>{let{path:n,content:r}=t,s=new URLSearchParams({path:n});return(0,e3.SC)("/api/servers/".concat(encodeURIComponent(e),"/files/write?").concat(s),{method:"PUT",body:JSON.stringify({content:r})})},onSuccess:()=>{t.invalidateQueries({queryKey:["servers",e,"files"]})}})}var td=n(26138),tu=n(41261),tx=n(49368);function th(e){let{path:t,onNavigate:n}=e,s=t.split("/").filter(Boolean);return(0,r.jsxs)(td.Z,{sx:{mb:1},children:[(0,r.jsxs)(tu.Z,{component:"button",underline:"hover",color:"inherit",onClick:()=>n("/"),sx:{display:"flex",alignItems:"center",gap:.5,cursor:"pointer"},children:[(0,r.jsx)(tx.Z,{sx:{fontSize:18}}),"root"]}),s.map((e,t)=>{let i=t===s.length-1,a="/"+s.slice(0,t+1).join("/");return i?(0,r.jsx)(m.Z,{color:"text.primary",sx:{fontWeight:500},children:e},a):(0,r.jsx)(tu.Z,{component:"button",underline:"hover",color:"inherit",onClick:()=>n(a),sx:{cursor:"pointer"},children:e},a)})]})}var tp=n(23907),tm=n(69366),tf=n(14895);let ty=/[/\\]/,tv=/\.\./;function tg(e){let{open:t,existingNames:n,isPending:i,onConfirm:a,onClose:l}=e,[c,d]=(0,s.useState)(""),u=(0,s.useMemo)(()=>c.trim()?ty.test(c)?"Name cannot contain / or \\":tv.test(c)?'Name cannot contain ".."':c.startsWith(".")?'Name cannot start with "."':null:"Folder name cannot be empty",[c]),x=(0,s.useMemo)(()=>n.some(e=>e.toLowerCase()===c.trim().toLowerCase()),[c,n]),h=!u&&!x&&!!c.trim(),p=(0,s.useCallback)(()=>{h&&(a(c.trim()),d(""))},[h,c,a]),m=(0,s.useCallback)(()=>{d(""),l()},[l]);return(0,r.jsxs)(j.Z,{open:t,onClose:m,maxWidth:"xs",fullWidth:!0,children:[(0,r.jsx)(b.Z,{children:"Create New Folder"}),(0,r.jsx)(Z.Z,{children:(0,r.jsx)(S.Z,{autoFocus:!0,fullWidth:!0,label:"Folder name",value:c,onChange:e=>d(e.target.value),onKeyDown:e=>"Enter"===e.key&&p(),error:!!u&&c.length>0||x,helperText:c.length>0&&u||(x?'"'.concat(c.trim(),'" already exists'):void 0),sx:{mt:1}})}),(0,r.jsxs)(C.Z,{children:[(0,r.jsx)(o.Z,{onClick:m,children:"Cancel"}),(0,r.jsx)(o.Z,{onClick:p,variant:"contained",disabled:i||!h,children:"Create"})]})]})}function tj(e){let{searchQuery:t,onSearchChange:n,onCreateFolder:i,onUpload:a,onRefresh:c,existingNames:d,disabled:u}=e,[x,h]=(0,s.useState)(!1);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:1,alignItems:"center",mb:2,flexWrap:"wrap"},children:[(0,r.jsx)(S.Z,{size:"small",placeholder:"Search files...",value:t,onChange:e=>n(e.target.value),InputProps:{startAdornment:(0,r.jsx)(A.Z,{position:"start",children:(0,r.jsx)(tt.Z,{sx:{fontSize:20,color:"text.secondary"}})})},sx:{minWidth:200,flex:{xs:"1 1 100%",sm:"0 1 auto"}}}),(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:1,ml:"auto"},children:[(0,r.jsx)(o.Z,{size:"small",startIcon:(0,r.jsx)(tf.Z,{}),onClick:a,disabled:u,children:"Upload"}),(0,r.jsx)(o.Z,{size:"small",startIcon:(0,r.jsx)(tp.Z,{}),onClick:()=>h(!0),disabled:u,children:"New Folder"}),(0,r.jsx)(o.Z,{size:"small",startIcon:(0,r.jsx)(tm.Z,{}),onClick:c,disabled:u,children:"Refresh"})]})]}),(0,r.jsx)(tg,{open:x,existingNames:d,isPending:!!u,onConfirm:e=>{i(e),h(!1)},onClose:()=>h(!1)})]})}var tb=n(21138),tZ=n(84811),tC=n(47001),tS=n(53281),tw=n(11254),tk=n(70366),tR=n(53325),tI=n(32579),tP=n(97589),tT=n(18644),tz=n(7837),tF=n(94358),tW=n(45813),tD=n(26559);function tN(e){var t;return["yml","yaml","json","properties","toml","cfg","conf","ini","txt","md","log","xml","sh","bat","csv"].includes((null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())||"")}function tA(e){var t;let{file:n,currentPath:i,onNavigate:a,onAction:o}=e,[d,u]=(0,s.useState)(null),x=()=>{"directory"===n.type?a("/"===i?"/".concat(n.name):"".concat(i,"/").concat(n.name)):tN(n.name)&&o("open")};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(tk.Z,{hover:!0,sx:{cursor:"directory"===n.type||tN(n.name)?"pointer":"default"},onClick:x,children:[(0,r.jsx)(tC.Z,{children:(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[function(e){var t;if("directory"===e.type)return(0,r.jsx)(tR.Z,{sx:{color:"#FFB74D"}});let n=(null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase())||"";return["yml","yaml","json","properties","toml","cfg","conf","ini","txt","md"].includes(n)?(0,r.jsx)(tP.Z,{sx:{color:"#42A5F5"}}):"jar"===n?(0,r.jsx)(tT.Z,{sx:{color:"#AB47BC"}}):"log"===n?(0,r.jsx)(tz.Z,{sx:{color:"#78909C"}}):["dat","dat_old","mca","nbt","lock"].includes(n)?(0,r.jsx)(tF.Z,{sx:{color:"#8D6E63"}}):(0,r.jsx)(tI.Z,{sx:{color:"#90A4AE"}})}(n),(0,r.jsx)(m.Z,{variant:"body2",sx:{fontWeight:"directory"===n.type?500:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.name})]})}),(0,r.jsx)(tC.Z,{sx:{display:{xs:"none",sm:"table-cell"}},children:(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:"directory"===n.type?"-":0===(t=n.size)?"-":t<1024?"".concat(t," B"):t<1048576?"".concat((t/1024).toFixed(1)," KB"):t<1073741824?"".concat((t/1024/1024).toFixed(1)," MB"):"".concat((t/1024/1024/1024).toFixed(1)," GB")})}),(0,r.jsx)(tC.Z,{sx:{display:{xs:"none",md:"table-cell"}},children:(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:new Date(n.modifiedAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})}),(0,r.jsx)(tC.Z,{children:(0,r.jsx)(c.Z,{size:"small",onClick:e=>{e.stopPropagation(),u(e.currentTarget)},children:(0,r.jsx)(P.Z,{fontSize:"small"})})})]}),(0,r.jsxs)(f.Z,{anchorEl:d,open:!!d,onClose:()=>u(null),children:["directory"===n.type&&(0,r.jsxs)(y.Z,{onClick:()=>{u(null),x()},children:[(0,r.jsx)(v.Z,{children:(0,r.jsx)(ts.Z,{fontSize:"small"})}),(0,r.jsx)(g.Z,{children:"Open"})]}),"file"===n.type&&tN(n.name)&&(0,r.jsxs)(y.Z,{onClick:()=>{u(null),o("open")},children:[(0,r.jsx)(v.Z,{children:(0,r.jsx)(tW.Z,{fontSize:"small"})}),(0,r.jsx)(g.Z,{children:"Edit"})]}),"file"===n.type&&(0,r.jsxs)(y.Z,{onClick:()=>{u(null),o("download")},children:[(0,r.jsx)(v.Z,{children:(0,r.jsx)(tr.Z,{fontSize:"small"})}),(0,r.jsx)(g.Z,{children:"Download"})]}),(0,r.jsxs)(y.Z,{onClick:()=>{u(null),o("rename")},children:[(0,r.jsx)(v.Z,{children:(0,r.jsx)(tD.Z,{fontSize:"small"})}),(0,r.jsx)(g.Z,{children:"Rename"})]}),(0,r.jsxs)(y.Z,{onClick:()=>{u(null),o("delete")},sx:{color:"error.main"},children:[(0,r.jsx)(v.Z,{children:(0,r.jsx)(T.Z,{fontSize:"small",color:"error"})}),(0,r.jsx)(g.Z,{children:"Delete"})]})]})]})}function tO(e){let{files:t,currentPath:n,onNavigate:s,onFileAction:i,searchQuery:a}=e,o=a?t.filter(e=>e.name.toLowerCase().includes(a.toLowerCase())):t;return 0===o.length?(0,r.jsxs)(l.Z,{sx:{textAlign:"center",py:6},children:[(0,r.jsx)(tR.Z,{sx:{fontSize:48,color:"text.disabled",mb:1}}),(0,r.jsx)(m.Z,{variant:"body1",color:"text.secondary",children:a?"No matching files found":"This directory is empty"})]}):(0,r.jsx)(tS.Z,{children:(0,r.jsxs)(tb.Z,{size:"small",children:[(0,r.jsx)(tw.Z,{children:(0,r.jsxs)(tk.Z,{children:[(0,r.jsx)(tC.Z,{sx:{fontWeight:600},children:"Name"}),(0,r.jsx)(tC.Z,{sx:{fontWeight:600,width:100,display:{xs:"none",sm:"table-cell"}},children:"Size"}),(0,r.jsx)(tC.Z,{sx:{fontWeight:600,width:160,display:{xs:"none",md:"table-cell"}},children:"Modified"}),(0,r.jsx)(tC.Z,{sx:{width:48}})]})}),(0,r.jsx)(tZ.Z,{children:o.map(e=>(0,r.jsx)(tA,{file:e,currentPath:n,onNavigate:s,onAction:t=>i(t,e)},e.name))})]})})}var tL=n(35308),tM=n(66349),tq=n(45328),tE=n(41648),tU=n(29944),tB=n(75134),tK=n(19341),tV=n(36074),tH=n(66546);function tQ(e){let{language:t,fileSize:n,line:s,col:i,dirty:a}=e;return(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,px:2,py:.5,bgcolor:"grey.100",borderTop:1,borderColor:"divider",fontSize:"0.75rem",color:"text.secondary",flexWrap:"wrap",minHeight:28},children:[(0,r.jsx)(m.Z,{variant:"caption",sx:{fontWeight:500},children:t}),(0,r.jsx)(m.Z,{variant:"caption",children:n<1024?"".concat(n," B"):n<1048576?"".concat((n/1024).toFixed(1)," KB"):"".concat((n/1024/1024).toFixed(1)," MB")}),(0,r.jsx)(m.Z,{variant:"caption",children:"UTF-8"}),(0,r.jsxs)(m.Z,{variant:"caption",children:["Ln ",s,", Col ",i]}),(0,r.jsx)(l.Z,{sx:{flex:1}}),a&&(0,r.jsx)(m.Z,{variant:"caption",sx:{color:"warning.main",fontWeight:600},children:"Modified"})]})}function tG(e){var t;let{serverName:n,filePath:i,onBack:a}=e,x=(0,s.useRef)(null),f=(0,s.useRef)(null),[y,v]=(0,s.useState)(!1),[g,b]=(0,s.useState)({line:1,col:1}),[Z,C]=(0,s.useState)(!1),S=i.split("/").pop()||"",{data:w,isLoading:k,error:I}=to(n,i),P=tc(n),T=(0,s.useCallback)(()=>{if(!f.current||!i)return;let e=f.current.state.doc.toString();P.mutate({path:i,content:e},{onSuccess:()=>v(!1)})},[i,P]),z=(0,s.useCallback)(()=>{y?C(!0):a()},[y,a]),F=(0,s.useCallback)(()=>{C(!1),v(!1),a()},[a]);(0,s.useEffect)(()=>{if(!x.current||!w)return;f.current&&(f.current.destroy(),f.current=null);let e=tL.$f.of([{key:"Mod-s",run:()=>(setTimeout(()=>{if(!f.current||!i)return;let e=f.current.state.doc.toString();P.mutate({path:i,content:e},{onSuccess:()=>v(!1)})},0),!0),preventDefault:!0}]),t=tL.tk.updateListener.of(e=>{if(e.docChanged&&v(!0),e.selectionSet||e.docChanged){let t=e.state.selection.main.head,n=e.state.doc.lineAt(t);b({line:n.number,col:t-n.from+1})}}),n=tM.yy.create({doc:w.content,extensions:[(0,tL.Eu)(),(0,tL.ZO)(),(0,tL.AE)(),(0,tq.m8)(),(0,tE.mi)(),(0,tL.Uw)(),(0,tL.Zs)(),(0,tE.nY)(),(0,tE.n$)(),(0,tU.sW)(),(0,tE.nF)(tE.R_,{fallback:!0}),tH.vk,function(e){var t;switch((null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())||""){case"json":return(0,tB.AV)();case"yml":case"yaml":return(0,tK.rV)();case"xml":case"html":return(0,tV.Ls)();default:return[]}}(S),e,tL.$f.of([...tq.wQ,...tq.f$,...tU.Lp,tq.oc]),t,tL.tk.lineWrapping,tL.tk.theme({"&":{height:"100%",fontSize:"13px"},".cm-scroller":{overflow:"auto"},".cm-content":{fontFamily:'"Fira Code", "Cascadia Code", "JetBrains Mono", "Consolas", monospace'},".cm-gutters":{fontFamily:'"Fira Code", "Cascadia Code", "JetBrains Mono", "Consolas", monospace'}})]}),r=new tL.tk({state:n,parent:x.current});return f.current=r,()=>{r.destroy(),f.current=null}},[w,S,i]);let W=w&&w.size>5242880;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(h.Z,{sx:{borderRadius:3,display:"flex",flexDirection:"column",minHeight:600},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1,borderBottom:1,borderColor:"divider"},children:[(0,r.jsx)(c.Z,{size:"small",onClick:z,"aria-label":"back",children:(0,r.jsx)(R.Z,{})}),(0,r.jsx)(tP.Z,{sx:{color:"primary.main"}}),(0,r.jsxs)(m.Z,{variant:"subtitle1",sx:{fontWeight:600,flex:1},noWrap:!0,children:[S,y&&" *"]}),(0,r.jsx)(o.Z,{size:"small",variant:"contained",startIcon:P.isPending?(0,r.jsx)(u.Z,{size:16,color:"inherit"}):(0,r.jsx)(ef.Z,{}),onClick:T,disabled:!y||P.isPending,children:"Save"})]}),(0,r.jsxs)(p.Z,{sx:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",p:0,"&:last-child":{pb:0}},children:[k&&(0,r.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center",flex:1},children:(0,r.jsx)(u.Z,{})}),I&&(0,r.jsxs)(d.Z,{severity:"error",sx:{m:2},children:["Failed to load file: ",I.message]}),W&&(0,r.jsxs)(d.Z,{severity:"warning",sx:{m:2},children:["This file is too large to edit (",(w.size/1024/1024).toFixed(1)," MB). Maximum editable size is 5 MB."]}),P.isError&&(0,r.jsxs)(d.Z,{severity:"error",sx:{m:2},children:["Failed to save: ",P.error.message]}),P.isSuccess&&!y&&(0,r.jsx)(d.Z,{severity:"success",sx:{m:2},children:"File saved successfully."}),w&&!W&&(0,r.jsx)(l.Z,{ref:x,sx:{flex:1,overflow:"hidden"}}),w&&!W&&(0,r.jsx)(tQ,{language:{json:"JSON",yml:"YAML",yaml:"YAML",xml:"XML",html:"HTML",properties:"Properties",toml:"TOML",cfg:"Config",conf:"Config",ini:"INI",txt:"Plain Text",md:"Markdown",log:"Log",sh:"Shell",bat:"Batch",csv:"CSV"}[(null===(t=S.split(".").pop())||void 0===t?void 0:t.toLowerCase())||""]||"Plain Text",fileSize:w.size,line:g.line,col:g.col,dirty:y})]})]}),(0,r.jsx)(j.Z,{open:Z,onClose:()=>C(!1),maxWidth:"xs",fullWidth:!0,children:(0,r.jsxs)(l.Z,{sx:{p:3},children:[(0,r.jsx)(m.Z,{variant:"h6",gutterBottom:!0,children:"Unsaved Changes"}),(0,r.jsxs)(m.Z,{variant:"body2",color:"text.secondary",sx:{mb:3},children:["You have unsaved changes in ",(0,r.jsx)("strong",{children:S}),". Do you want to discard them?"]}),(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[(0,r.jsx)(o.Z,{onClick:()=>C(!1),children:"Cancel"}),(0,r.jsx)(o.Z,{onClick:F,color:"error",variant:"contained",children:"Discard"})]})]})})]})}var tJ=n(65087);let t_=new Set(["world","world_nether","world_the_end","server.jar","server.properties","plugins","mods"]);function t$(e){var t;let{target:n,isPending:i,onConfirm:a,onClose:l}=e,[c,u]=(0,s.useState)(""),x=!!n&&(t=n.name,t_.has(t.toLowerCase())),h=(null==n?void 0:n.type)==="directory",p=!x||c===(null==n?void 0:n.name);(0,s.useEffect)(()=>{n||u("")},[n]);let m=(0,s.useCallback)(()=>{p&&a()},[p,a]);return(0,r.jsxs)(j.Z,{open:!!n,onClose:l,maxWidth:"xs",fullWidth:!0,children:[(0,r.jsxs)(b.Z,{children:["Delete ",h?"Folder":"File"]}),(0,r.jsxs)(Z.Z,{children:[(0,r.jsxs)(tJ.Z,{children:["Are you sure you want to delete ",(0,r.jsx)("strong",{children:null==n?void 0:n.name}),"?",h&&" This will delete all contents inside."," ","This action cannot be undone."]}),x&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(d.Z,{severity:"warning",sx:{mt:2},children:[(0,r.jsx)("strong",{children:null==n?void 0:n.name})," is a critical server ",h?"folder":"file",". Deleting it may break your server."]}),(0,r.jsx)(S.Z,{autoFocus:!0,fullWidth:!0,label:'Type "'.concat(null==n?void 0:n.name,'" to confirm'),value:c,onChange:e=>u(e.target.value),onKeyDown:e=>"Enter"===e.key&&m(),placeholder:null==n?void 0:n.name,sx:{mt:2},error:c.length>0&&c!==(null==n?void 0:n.name)})]})]}),(0,r.jsxs)(C.Z,{children:[(0,r.jsx)(o.Z,{onClick:l,children:"Cancel"}),(0,r.jsx)(o.Z,{onClick:m,color:"error",variant:"contained",disabled:i||!p,children:"Delete"})]})]})}let tX=/[/\\]/,tY=/\.\./;function t0(e){let t=e.lastIndexOf(".");return t>0?e.slice(t):""}function t1(e){let{target:t,existingNames:n,isPending:i,onConfirm:a,onClose:l}=e,[c,u]=(0,s.useState)("");(0,s.useEffect)(()=>{t&&u(t.name)},[t]);let x=(0,s.useMemo)(()=>c.trim()?tX.test(c)?"Name cannot contain / or \\":tY.test(c)?'Name cannot contain ".."':c.startsWith(".")?'Name cannot start with "."':null:"Name cannot be empty",[c]),h=(0,s.useMemo)(()=>n.some(e=>e!==(null==t?void 0:t.name)&&e.toLowerCase()===c.trim().toLowerCase()),[c,null==t?void 0:t.name,n]),p=(0,s.useMemo)(()=>!!t&&"directory"!==t.type&&t0(t.name)!==t0(c),[t,c]),m=c.trim()===(null==t?void 0:t.name),f=!x&&!h&&!m&&!!c.trim(),y=(0,s.useCallback)(()=>{f&&a(c.trim())},[f,c,a]);return(0,r.jsxs)(j.Z,{open:!!t,onClose:l,maxWidth:"xs",fullWidth:!0,children:[(0,r.jsx)(b.Z,{children:"Rename"}),(0,r.jsxs)(Z.Z,{children:[(0,r.jsx)(S.Z,{autoFocus:!0,fullWidth:!0,label:"New name",value:c,onChange:e=>u(e.target.value),onKeyDown:e=>"Enter"===e.key&&y(),error:!!x||h,helperText:x||(h?'"'.concat(c.trim(),'" already exists'):void 0),sx:{mt:1}}),p&&!x&&!h&&(0,r.jsx)(d.Z,{severity:"warning",sx:{mt:2},children:"Changing the file extension may make the file unusable."})]}),(0,r.jsxs)(C.Z,{children:[(0,r.jsx)(o.Z,{onClick:l,children:"Cancel"}),(0,r.jsx)(o.Z,{onClick:y,variant:"contained",disabled:i||!f,children:"Rename"})]})]})}var t2=n(75946),t3=n(35847),t6=n(397),t4=n(61650),t5=n(73729),t8=n(41189);let t7={whitelist:{label:"Whitelist Manager",icon:(0,r.jsx)(t3.Z,{sx:{color:"primary.main"}})},ops:{label:"Operators Manager",icon:(0,r.jsx)(eK.Z,{sx:{color:"primary.main"}})},bans:{label:"Ban List Manager",icon:(0,r.jsx)(t6.Z,{sx:{color:"primary.main"}})}};function t9(e){let{serverName:t,editorType:n,filePath:s,onBack:i,onSwitchToRaw:a}=e,d=t7[n];return(0,r.jsxs)(h.Z,{sx:{borderRadius:3,display:"flex",flexDirection:"column",minHeight:600},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1,borderBottom:1,borderColor:"divider"},children:[(0,r.jsx)(c.Z,{size:"small",onClick:i,"aria-label":"back",children:(0,r.jsx)(R.Z,{})}),d.icon,(0,r.jsx)(m.Z,{variant:"subtitle1",sx:{fontWeight:600,flex:1},noWrap:!0,children:d.label}),s&&(0,r.jsx)(o.Z,{size:"small",startIcon:(0,r.jsx)(t2.Z,{}),onClick:()=>{i(),a(s)},children:"Raw View"})]}),(0,r.jsxs)(p.Z,{sx:{flex:1,overflow:"auto",p:{xs:1,sm:2},"&:last-child":{pb:2}},children:["whitelist"===n&&(0,r.jsx)(t4.Z,{serverName:t}),"ops"===n&&(0,r.jsx)(t5.d,{serverName:t}),"bans"===n&&(0,r.jsx)(t8.Z,{serverName:t})]})]})}var ne=n(22041),nt=n(72147),nn=n(66561),nr=n(12795),ns=n(96407),ni=n(90117),na=n(8352);let nl={gameplay:{label:"Gameplay",description:"Game rules, player limits, and core mechanics"},world:{label:"World Generation",description:"World settings, level name, and generation options"},network:{label:"Network & Security",description:"Ports, authentication, RCON, and query settings"},performance:{label:"Performance",description:"View distance, tick settings, and compression"},advanced:{label:"Advanced",description:"Other server properties"}},no=["gameplay","world","network","performance","advanced"],nc=[{key:"gamemode",type:"enum",category:"gameplay",label:"Game Mode",description:"Default game mode for new players",defaultValue:"survival",options:[{value:"survival",label:"Survival"},{value:"creative",label:"Creative"},{value:"adventure",label:"Adventure"},{value:"spectator",label:"Spectator"}]},{key:"difficulty",type:"enum",category:"gameplay",label:"Difficulty",description:"Server difficulty level",defaultValue:"easy",options:[{value:"peaceful",label:"Peaceful"},{value:"easy",label:"Easy"},{value:"normal",label:"Normal"},{value:"hard",label:"Hard"}]},{key:"hardcore",type:"boolean",category:"gameplay",label:"Hardcore",description:"Players are set to spectator mode on death",defaultValue:"false"},{key:"pvp",type:"boolean",category:"gameplay",label:"PvP",description:"Allow player vs player combat",defaultValue:"true"},{key:"max-players",type:"number",category:"gameplay",label:"Max Players",description:"Maximum number of players on the server",defaultValue:"20",min:0,max:2147483647},{key:"force-gamemode",type:"boolean",category:"gameplay",label:"Force Game Mode",description:"Force players to join in the default game mode",defaultValue:"false"},{key:"allow-flight",type:"boolean",category:"gameplay",label:"Allow Flight",description:"Allow players to use flight in survival mode",defaultValue:"false"},{key:"spawn-protection",type:"number",category:"gameplay",label:"Spawn Protection",description:"Radius of spawn protection area (0 = disabled)",defaultValue:"16",min:0,max:65536},{key:"spawn-animals",type:"boolean",category:"gameplay",label:"Spawn Animals",description:"Allow animals to spawn naturally",defaultValue:"true"},{key:"spawn-monsters",type:"boolean",category:"gameplay",label:"Spawn Monsters",description:"Allow hostile mobs to spawn naturally",defaultValue:"true"},{key:"spawn-npcs",type:"boolean",category:"gameplay",label:"Spawn NPCs",description:"Allow villagers to spawn",defaultValue:"true"},{key:"allow-nether",type:"boolean",category:"gameplay",label:"Allow Nether",description:"Allow players to travel to the Nether",defaultValue:"true"},{key:"enable-command-block",type:"boolean",category:"gameplay",label:"Enable Command Blocks",description:"Allow command blocks to be used",defaultValue:"false"},{key:"player-idle-timeout",type:"number",category:"gameplay",label:"Player Idle Timeout",description:"Kick idle players after N minutes (0 = disabled)",defaultValue:"0",min:0,max:2147483647},{key:"level-name",type:"string",category:"world",label:"Level Name",description:"Name of the world folder",defaultValue:"world"},{key:"level-seed",type:"string",category:"world",label:"Level Seed",description:"Seed for world generation (blank = random)",defaultValue:""},{key:"level-type",type:"enum",category:"world",label:"Level Type",description:"World generation type",defaultValue:"minecraft\\:normal",options:[{value:"minecraft\\:normal",label:"Normal"},{value:"minecraft\\:flat",label:"Flat"},{value:"minecraft\\:large_biomes",label:"Large Biomes"},{value:"minecraft\\:amplified",label:"Amplified"},{value:"minecraft\\:single_biome_surface",label:"Single Biome"}]},{key:"generate-structures",type:"boolean",category:"world",label:"Generate Structures",description:"Generate villages, temples, and other structures",defaultValue:"true"},{key:"max-world-size",type:"number",category:"world",label:"Max World Size",description:"Maximum world border radius in blocks",defaultValue:"29999984",min:1,max:29999984},{key:"generator-settings",type:"string",category:"world",label:"Generator Settings",description:"Custom world generator settings (JSON)",defaultValue:"{}"},{key:"motd",type:"string",category:"world",label:"MOTD",description:"Message displayed in the server list",defaultValue:"A Minecraft Server"},{key:"server-port",type:"readonly",category:"network",label:"Server Port",description:"Port the server listens on (cannot be changed at runtime)",defaultValue:"25565"},{key:"server-ip",type:"readonly",category:"network",label:"Server IP",description:"IP address to bind to (blank = all interfaces)",defaultValue:""},{key:"online-mode",type:"boolean",category:"network",label:"Online Mode",description:"Authenticate players with Mojang servers",defaultValue:"true"},{key:"white-list",type:"boolean",category:"network",label:"Whitelist",description:"Only allow whitelisted players to join",defaultValue:"false"},{key:"enforce-whitelist",type:"boolean",category:"network",label:"Enforce Whitelist",description:"Kick non-whitelisted players when whitelist is reloaded",defaultValue:"false"},{key:"enforce-secure-profile",type:"boolean",category:"network",label:"Enforce Secure Profile",description:"Require players to have a signed key from Mojang",defaultValue:"true"},{key:"enable-rcon",type:"boolean",category:"network",label:"Enable RCON",description:"Enable remote console access",defaultValue:"false"},{key:"rcon.port",type:"number",category:"network",label:"RCON Port",description:"Port for RCON connections",defaultValue:"25575",min:1,max:65535},{key:"rcon.password",type:"string",category:"network",label:"RCON Password",description:"Password for RCON authentication",defaultValue:""},{key:"enable-query",type:"boolean",category:"network",label:"Enable Query",description:"Enable GameSpy4 protocol server listener",defaultValue:"false"},{key:"query.port",type:"number",category:"network",label:"Query Port",description:"Port for query protocol",defaultValue:"25565",min:1,max:65535},{key:"enable-status",type:"boolean",category:"network",label:"Enable Status",description:"Show server in the server list",defaultValue:"true"},{key:"prevent-proxy-connections",type:"boolean",category:"network",label:"Prevent Proxy Connections",description:"Block VPN/proxy connections (requires online-mode)",defaultValue:"false"},{key:"hide-online-players",type:"boolean",category:"network",label:"Hide Online Players",description:"Hide player count and list in server status",defaultValue:"false"},{key:"view-distance",type:"number",category:"performance",label:"View Distance",description:"Render distance in chunks sent to players",defaultValue:"10",min:3,max:32},{key:"simulation-distance",type:"number",category:"performance",label:"Simulation Distance",description:"Distance in chunks for entity simulation",defaultValue:"10",min:3,max:32},{key:"max-tick-time",type:"number",category:"performance",label:"Max Tick Time",description:"Maximum tick duration before watchdog crash (ms, -1 = disabled)",defaultValue:"60000",min:-1,max:2147483647},{key:"network-compression-threshold",type:"number",category:"performance",label:"Network Compression Threshold",description:"Minimum packet size to compress (bytes, -1 = disabled)",defaultValue:"256",min:-1,max:2147483647},{key:"max-chained-neighbor-updates",type:"number",category:"performance",label:"Max Chained Neighbor Updates",description:"Limit for chained block updates (-1 = unlimited)",defaultValue:"1000000",min:-1,max:2147483647},{key:"rate-limit",type:"number",category:"performance",label:"Rate Limit",description:"Max packets per second before kick (0 = disabled)",defaultValue:"0",min:0,max:2147483647},{key:"entity-broadcast-range-percentage",type:"number",category:"performance",label:"Entity Broadcast Range",description:"Percentage of default entity visibility range",defaultValue:"100",min:10,max:1e3},{key:"resource-pack",type:"string",category:"advanced",label:"Resource Pack URL",description:"URL of the server resource pack",defaultValue:""},{key:"resource-pack-sha1",type:"string",category:"advanced",label:"Resource Pack SHA1",description:"SHA1 hash of the resource pack file",defaultValue:""},{key:"require-resource-pack",type:"boolean",category:"advanced",label:"Require Resource Pack",description:"Kick players who decline the resource pack",defaultValue:"false"},{key:"resource-pack-prompt",type:"string",category:"advanced",label:"Resource Pack Prompt",description:"Custom message shown when asking to download resource pack",defaultValue:""},{key:"function-permission-level",type:"enum",category:"advanced",label:"Function Permission Level",description:"OP level required to execute functions",defaultValue:"2",options:[{value:"1",label:"Level 1 - Moderator"},{value:"2",label:"Level 2 - Gamemaster"},{value:"3",label:"Level 3 - Admin"},{value:"4",label:"Level 4 - Owner"}]},{key:"op-permission-level",type:"enum",category:"advanced",label:"OP Permission Level",description:"Default OP level for new operators",defaultValue:"4",options:[{value:"1",label:"Level 1 - Moderator"},{value:"2",label:"Level 2 - Gamemaster"},{value:"3",label:"Level 3 - Admin"},{value:"4",label:"Level 4 - Owner"}]},{key:"text-filtering-config",type:"string",category:"advanced",label:"Text Filtering Config",description:"Text filtering configuration file",defaultValue:""},{key:"log-ips",type:"boolean",category:"advanced",label:"Log IPs",description:"Log player IP addresses in the server log",defaultValue:"true"},{key:"broadcast-console-to-ops",type:"boolean",category:"advanced",label:"Broadcast Console to OPs",description:"Send console output to all OPs",defaultValue:"true"},{key:"broadcast-rcon-to-ops",type:"boolean",category:"advanced",label:"Broadcast RCON to OPs",description:"Send RCON output to all OPs",defaultValue:"true"},{key:"sync-chunk-writes",type:"boolean",category:"advanced",label:"Sync Chunk Writes",description:"Synchronize chunk writes for data safety",defaultValue:"true"},{key:"enable-jmx-monitoring",type:"boolean",category:"advanced",label:"Enable JMX Monitoring",description:"Expose JMX metrics for monitoring",defaultValue:"false"},{key:"use-native-transport",type:"boolean",category:"advanced",label:"Use Native Transport",description:"Use Linux-specific packet optimizations",defaultValue:"true"},{key:"initial-enabled-packs",type:"string",category:"advanced",label:"Initial Enabled Packs",description:"Comma-separated list of initially enabled data packs",defaultValue:"vanilla"},{key:"initial-disabled-packs",type:"string",category:"advanced",label:"Initial Disabled Packs",description:"Comma-separated list of initially disabled data packs",defaultValue:""}];nc.map(e=>[e.key,e]);let nd=(0,r.jsx)(N.Z,{label:"modified",size:"small",color:"warning",variant:"outlined"});function nu(e){let{schema:t,value:n,onChange:s,isChanged:i}=e,a=i?{"& .MuiInputBase-root":{bgcolor:"action.selected"}}:void 0,o=i?(0,r.jsx)(A.Z,{position:"end",children:nd}):void 0;switch(t.type){case"boolean":return(0,r.jsxs)(l.Z,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,r.jsx)(eb.Z,{control:(0,r.jsx)(eZ.Z,{checked:"true"===n,onChange:e=>s(t.key,e.target.checked?"true":"false"),size:"small"}),label:t.label,sx:{mr:0}}),i&&nd]}),(0,r.jsx)(m.Z,{variant:"caption",color:"text.secondary",sx:{ml:"48px",display:"block",mt:-.5},children:t.description})]});case"enum":var c;return(0,r.jsx)(S.Z,{select:!0,fullWidth:!0,size:"small",label:t.label,helperText:t.description,value:n,onChange:e=>s(t.key,e.target.value),InputProps:{endAdornment:o},sx:a,children:null===(c=t.options)||void 0===c?void 0:c.map(e=>(0,r.jsx)(y.Z,{value:e.value,children:e.label},e.value))});case"number":return(0,r.jsx)(S.Z,{fullWidth:!0,size:"small",type:"number",label:t.label,helperText:t.description,value:n,onChange:e=>s(t.key,e.target.value),inputProps:{min:t.min,max:t.max},InputProps:{endAdornment:o},sx:a});case"readonly":return(0,r.jsx)(S.Z,{fullWidth:!0,size:"small",label:t.label,helperText:t.description,value:n,disabled:!0,InputProps:{endAdornment:(0,r.jsx)(A.Z,{position:"end",children:(0,r.jsx)(N.Z,{label:"readonly",size:"small",variant:"outlined"})})}});default:return(0,r.jsx)(S.Z,{fullWidth:!0,size:"small",label:t.label,helperText:t.description,value:n,onChange:e=>s(t.key,e.target.value),InputProps:{endAdornment:o},sx:a})}}function nx(e){let{serverName:t}=e,n="/server.properties",{data:i,isLoading:a,error:c}=to(t,n),x=tc(t),[h,p]=(0,s.useState)({}),[f,y]=(0,s.useState)({}),[v,g]=(0,s.useState)("");(0,s.useEffect)(()=>{if(!(null==i?void 0:i.content))return;let e=function(e){let t={};for(let n of e.split("\n")){let e=n.trim();if(!e||e.startsWith("#"))continue;let r=e.indexOf("=");if(-1===r)continue;let s=e.substring(0,r).trim(),i=e.substring(r+1).trim();t[s]=i}return t}(i.content);p(e),y(e),x.reset()},[i]);let j=(0,s.useCallback)((e,t)=>{p(n=>({...n,[e]:t}))},[]),b=(0,s.useMemo)(()=>{let e=[];for(let t of Object.keys(h))h[t]!==f[t]&&e.push(t);return e},[h,f]),Z=(0,s.useCallback)(()=>{if(!(null==i?void 0:i.content))return;let e=function(e,t){let n=e.split("\n"),r=new Set,s=n.map(e=>{let n=e.trim();if(!n||n.startsWith("#"))return e;let s=n.indexOf("=");if(-1===s)return e;let i=n.substring(0,s).trim();return(r.add(i),i in t)?"".concat(i,"=").concat(t[i]):e});for(let[e,n]of Object.entries(t))r.has(e)||s.push("".concat(e,"=").concat(n));return s.join("\n")}(i.content,h);x.mutate({path:n,content:e},{onSuccess:()=>{y({...h})}})},[i,h,x]),C=(0,s.useCallback)(()=>{p({...f})},[f]),k=(0,s.useMemo)(()=>{let e=v.toLowerCase(),t={gameplay:[],world:[],network:[],performance:[],advanced:[]};for(let n of nc)(!e||n.key.toLowerCase().includes(e)||n.label.toLowerCase().includes(e)||n.description.toLowerCase().includes(e))&&t[n.category].push(n);let n=new Set(nc.map(e=>e.key));for(let r of Object.keys(h))!n.has(r)&&(!e||r.toLowerCase().includes(e))&&t.advanced.push({key:r,type:"string",category:"advanced",label:r,description:"Custom property (not in standard schema)",defaultValue:""});return t},[v,h]);return a?(0,r.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center",py:8},children:(0,r.jsx)(u.Z,{})}):c?(0,r.jsxs)(d.Z,{severity:"error",sx:{m:2},children:["Failed to load server.properties: ",c.message]}):(0,r.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,r.jsx)(d.Z,{severity:"warning",icon:(0,r.jsx)(na.Z,{}),sx:{mx:2,mt:2,mb:1},children:(0,r.jsxs)(m.Z,{variant:"body2",children:[(0,r.jsx)("strong",{children:"Warning:"})," Changes are applied directly to the running server file. For persistent settings that survive server recreation, use the ",(0,r.jsx)("strong",{children:"Options"})," tab."]})}),(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1},children:[(0,r.jsx)(S.Z,{size:"small",placeholder:"Search properties...",value:v,onChange:e=>g(e.target.value),InputProps:{startAdornment:(0,r.jsx)(A.Z,{position:"start",children:(0,r.jsx)(tt.Z,{fontSize:"small"})})},sx:{flex:1,maxWidth:400}}),(0,r.jsx)(l.Z,{sx:{flex:1}}),b.length>0&&(0,r.jsx)(N.Z,{label:"".concat(b.length," changed"),color:"warning",size:"small"}),(0,r.jsx)(o.Z,{size:"small",startIcon:(0,r.jsx)(ni.Z,{}),onClick:C,disabled:0===b.length,children:"Discard"}),(0,r.jsx)(o.Z,{size:"small",variant:"contained",startIcon:x.isPending?(0,r.jsx)(u.Z,{size:16,color:"inherit"}):(0,r.jsx)(ef.Z,{}),onClick:Z,disabled:0===b.length||x.isPending,children:"Save"})]}),x.isError&&(0,r.jsxs)(d.Z,{severity:"error",sx:{mx:2,mb:1},children:["Failed to save: ",x.error.message]}),x.isSuccess&&0===b.length&&(0,r.jsx)(d.Z,{severity:"success",sx:{mx:2,mb:1},children:"File saved successfully."}),(0,r.jsx)(l.Z,{sx:{flex:1,overflow:"auto",px:2,pb:2},children:no.map(e=>{let t=k[e];if(0===t.length)return null;let n=nl[e],s=t.filter(e=>b.includes(e.key)).length;return(0,r.jsxs)(nn.Z,{defaultExpanded:"advanced"!==e,disableGutters:!0,children:[(0,r.jsx)(nr.Z,{expandIcon:(0,r.jsx)(ej.Z,{}),children:(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%"},children:[(0,r.jsx)(m.Z,{variant:"subtitle1",sx:{fontWeight:600},children:n.label}),(0,r.jsxs)(m.Z,{variant:"caption",color:"text.secondary",children:["(",t.length,")"]}),s>0&&(0,r.jsx)(N.Z,{label:"".concat(s," modified"),size:"small",color:"warning",variant:"outlined"})]})}),(0,r.jsxs)(ns.Z,{children:[(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:n.description}),(0,r.jsx)(w.ZP,{container:!0,spacing:2,children:t.map(e=>{var t;let n=null!==(t=h[e.key])&&void 0!==t?t:e.defaultValue,s=b.includes(e.key);return(0,r.jsx)(w.ZP,{item:!0,xs:12,sm:"boolean"===e.type?6:12,children:(0,r.jsx)(nu,{schema:e,value:n,onChange:j,isChanged:s})},e.key)})})]})]},e)})})]})}let nh=(0,s.forwardRef)(function(e,t){let{serverName:n,filePath:i,onDirtyChange:a}=e,o=(0,s.useRef)(null),c=(0,s.useRef)(null),[x,h]=(0,s.useState)(!1),[p,m]=(0,s.useState)({line:1,col:1}),{data:f,isLoading:y,error:v}=to(n,i),g=tc(n),j=(0,s.useCallback)(()=>{if(!c.current)return;let e=c.current.state.doc.toString();g.mutate({path:i,content:e},{onSuccess:()=>{h(!1),a(!1)}})},[i,g,a]);return((0,s.useImperativeHandle)(t,()=>({save:j,isDirty:()=>x}),[j,x]),(0,s.useEffect)(()=>{a(x)},[x,a]),(0,s.useEffect)(()=>{if(!o.current||!f)return;c.current&&(c.current.destroy(),c.current=null);let e=tL.$f.of([{key:"Mod-s",run:()=>(setTimeout(()=>{if(!c.current)return;let e=c.current.state.doc.toString();g.mutate({path:i,content:e},{onSuccess:()=>{h(!1),a(!1)}})},0),!0),preventDefault:!0}]),t=tL.tk.updateListener.of(e=>{if(e.docChanged&&h(!0),e.selectionSet||e.docChanged){let t=e.state.selection.main.head,n=e.state.doc.lineAt(t);m({line:n.number,col:t-n.from+1})}}),n=tM.yy.create({doc:f.content,extensions:[(0,tL.Eu)(),(0,tL.ZO)(),(0,tL.AE)(),(0,tq.m8)(),(0,tE.mi)(),(0,tL.Uw)(),(0,tL.Zs)(),(0,tE.nY)(),(0,tE.n$)(),(0,tU.sW)(),(0,tE.nF)(tE.R_,{fallback:!0}),tH.vk,e,tL.$f.of([...tq.wQ,...tq.f$,...tU.Lp,tq.oc]),t,tL.tk.lineWrapping,tL.tk.theme({"&":{height:"100%",fontSize:"13px"},".cm-scroller":{overflow:"auto"},".cm-content":{fontFamily:'"Fira Code", "Cascadia Code", "JetBrains Mono", "Consolas", monospace'},".cm-gutters":{fontFamily:'"Fira Code", "Cascadia Code", "JetBrains Mono", "Consolas", monospace'}})]}),r=new tL.tk({state:n,parent:o.current});return c.current=r,()=>{r.destroy(),c.current=null}},[f,i]),y)?(0,r.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center",flex:1},children:(0,r.jsx)(u.Z,{})}):v?(0,r.jsxs)(d.Z,{severity:"error",sx:{m:2},children:["Failed to load file: ",v.message]}):(0,r.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},children:[g.isError&&(0,r.jsxs)(d.Z,{severity:"error",sx:{mx:2,mt:1},children:["Failed to save: ",g.error.message]}),g.isSuccess&&!x&&(0,r.jsx)(d.Z,{severity:"success",sx:{mx:2,mt:1},children:"File saved successfully."}),f&&(0,r.jsx)(l.Z,{ref:o,sx:{flex:1,overflow:"hidden"}}),f&&(0,r.jsx)(tQ,{language:"Properties",fileSize:f.size,line:p.line,col:p.col,dirty:x})]})});function np(e){let{serverName:t,onBack:n}=e,[i,a]=(0,s.useState)("form"),[d,u]=(0,s.useState)(!1),[x,f]=(0,s.useState)(null),y=(0,s.useRef)(null),v=(0,s.useCallback)((e,t)=>{t&&t!==i&&("raw"===i&&d?f("form"):a(t))},[i,d]),g=(0,s.useCallback)(()=>{"raw"===i&&d?f("back"):n()},[i,d,n]),b=(0,s.useCallback)(()=>{f(null),u(!1),"back"===x?n():"form"===x&&a("form")},[x,n]),Z=(0,s.useCallback)(()=>{var e;null===(e=y.current)||void 0===e||e.save()},[]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(h.Z,{sx:{borderRadius:3,display:"flex",flexDirection:"column",minHeight:600},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1,borderBottom:1,borderColor:"divider"},children:[(0,r.jsx)(c.Z,{size:"small",onClick:g,"aria-label":"back",children:(0,r.jsx)(R.Z,{})}),(0,r.jsx)(ne.Z,{sx:{color:"primary.main"}}),(0,r.jsx)(m.Z,{variant:"subtitle1",sx:{fontWeight:600,flex:1},noWrap:!0,children:"server.properties"}),(0,r.jsxs)(et.Z,{value:i,exclusive:!0,onChange:v,size:"small",children:[(0,r.jsxs)(ee.Z,{value:"form",children:[(0,r.jsx)(nt.Z,{fontSize:"small",sx:{mr:.5}}),"Form"]}),(0,r.jsxs)(ee.Z,{value:"raw",children:[(0,r.jsx)(t2.Z,{fontSize:"small",sx:{mr:.5}}),"Raw"]})]}),"raw"===i&&(0,r.jsx)(o.Z,{size:"small",variant:"contained",startIcon:(0,r.jsx)(ef.Z,{}),onClick:Z,disabled:!d,children:"Save"})]}),(0,r.jsx)(p.Z,{sx:{flex:1,overflow:"auto",p:0,"&:last-child":{pb:0}},children:"form"===i?(0,r.jsx)(nx,{serverName:t}):(0,r.jsx)(l.Z,{sx:{display:"flex",flexDirection:"column",height:"100%",minHeight:500},children:(0,r.jsx)(nh,{ref:y,serverName:t,filePath:"/server.properties",onDirtyChange:u})})})]}),(0,r.jsx)(j.Z,{open:null!==x,onClose:()=>f(null),maxWidth:"xs",fullWidth:!0,children:(0,r.jsxs)(l.Z,{sx:{p:3},children:[(0,r.jsx)(m.Z,{variant:"h6",gutterBottom:!0,children:"Unsaved Changes"}),(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mb:3},children:"You have unsaved changes in the raw editor. Do you want to discard them?"}),(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[(0,r.jsx)(o.Z,{onClick:()=>f(null),children:"Cancel"}),(0,r.jsx)(o.Z,{onClick:b,color:"error",variant:"contained",children:"Discard"})]})]})})]})}var nm=n(91606);function nf(e){return e<1024?"".concat(e," B"):e<1048576?"".concat((e/1024).toFixed(1)," KB"):e<1073741824?"".concat((e/1024/1024).toFixed(1)," MB"):"".concat((e/1024/1024/1024).toFixed(1)," GB")}function ny(e){let{open:t,isPending:n,onUpload:i,onClose:a}=e,[u,x]=(0,s.useState)([]),[h,p]=(0,s.useState)(!1),f=(0,s.useRef)(null);(0,s.useEffect)(()=>{t&&(x([]),p(!1))},[t]);let y=u.filter(e=>e.size>104857600),S=(0,s.useCallback)(e=>{let t=Array.from(e);x(e=>{let n=new Set(e.map(e=>e.name));return[...e,...t.filter(e=>!n.has(e.name))]})},[]),w=(0,s.useCallback)(e=>{x(t=>t.filter(t=>t.name!==e))},[]),k=(0,s.useCallback)(e=>{e.preventDefault(),p(!1),e.dataTransfer.files.length&&S(e.dataTransfer.files)},[S]),R=(0,s.useCallback)(()=>{u.length>0&&0===y.length&&i(u)},[u,y,i]),I=(0,s.useCallback)(()=>{n||(x([]),a())},[n,a]);return(0,r.jsxs)(j.Z,{open:t,onClose:I,maxWidth:"sm",fullWidth:!0,children:[(0,r.jsx)(b.Z,{children:"Upload Files"}),(0,r.jsxs)(Z.Z,{children:[(0,r.jsxs)(l.Z,{onDragOver:e=>{e.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:k,onClick:()=>{var e;return null===(e=f.current)||void 0===e?void 0:e.click()},sx:{border:"2px dashed",borderColor:h?"primary.main":"divider",borderRadius:2,p:4,textAlign:"center",cursor:"pointer",bgcolor:h?"action.hover":"transparent",transition:"all 0.2s","&:hover":{borderColor:"primary.main",bgcolor:"action.hover"}},children:[(0,r.jsx)(nm.Z,{sx:{fontSize:48,color:"text.secondary",mb:1}}),(0,r.jsx)(m.Z,{variant:"body1",color:"text.secondary",children:"Drag & drop files here, or click to browse"}),(0,r.jsxs)(m.Z,{variant:"caption",color:"text.secondary",children:["Max ",nf(104857600)," per file"]})]}),(0,r.jsx)("input",{ref:f,type:"file",multiple:!0,hidden:!0,onChange:e=>{var t;(null===(t=e.target.files)||void 0===t?void 0:t.length)&&(S(e.target.files),e.target.value="")}}),u.length>0&&(0,r.jsx)(eP.Z,{dense:!0,sx:{mt:2},children:u.map(e=>(0,r.jsxs)(eT.ZP,{secondaryAction:(0,r.jsx)(c.Z,{edge:"end",size:"small",onClick:()=>w(e.name),disabled:n,children:(0,r.jsx)(T.Z,{fontSize:"small"})}),children:[(0,r.jsx)(v.Z,{children:(0,r.jsx)(tI.Z,{})}),(0,r.jsx)(g.Z,{primary:e.name,secondary:nf(e.size),primaryTypographyProps:{noWrap:!0,color:e.size>104857600?"error":"text.primary"}})]},e.name))}),y.length>0&&(0,r.jsx)(d.Z,{severity:"error",sx:{mt:1},children:1===y.length?'"'.concat(y[0].name,'" exceeds the ').concat(nf(104857600)," limit"):"".concat(y.length," files exceed the ").concat(nf(104857600)," limit")}),n&&(0,r.jsx)(Q.Z,{sx:{mt:2}})]}),(0,r.jsxs)(C.Z,{children:[(0,r.jsx)(o.Z,{onClick:I,disabled:n,children:"Cancel"}),(0,r.jsxs)(o.Z,{onClick:R,variant:"contained",startIcon:(0,r.jsx)(nm.Z,{}),disabled:n||0===u.length||y.length>0,children:["Upload ",u.length>0?"(".concat(u.length,")"):""]})]})]})}function nv(e){let{serverName:t}=e,[n,i]=(0,s.useState)("/"),[a,l]=(0,s.useState)(""),[o,c]=(0,s.useState)({open:!1,message:"",severity:"info"}),[u,m]=(0,s.useState)(null),[f,y]=(0,s.useState)(null),[v,g]=(0,s.useState)(null),[j,b]=(0,s.useState)(null),[Z,C]=(0,s.useState)(null),[S,w]=(0,s.useState)(null),[k,R]=(0,s.useState)(!1),{data:I,isLoading:P,error:T,refetch:z}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";return(0,e0.a)({queryKey:["servers",e,"files",t],queryFn:()=>{let n=new URLSearchParams({path:t});return(0,e3.SC)("/api/servers/".concat(encodeURIComponent(e),"/files?").concat(n))},enabled:!!e})}(t,n),F=function(e){let t=(0,e1.NL)();return(0,e2.D)({mutationFn:t=>{let{path:n}=t,r=new URLSearchParams({path:n});return(0,e3.SC)("/api/servers/".concat(encodeURIComponent(e),"/files?").concat(r),{method:"DELETE"})},onSuccess:()=>{t.invalidateQueries({queryKey:["servers",e,"files"]})}})}(t),W=function(e){let t=(0,e1.NL)();return(0,e2.D)({mutationFn:t=>{let{path:n}=t,r=new URLSearchParams({path:n});return(0,e3.SC)("/api/servers/".concat(encodeURIComponent(e),"/files/mkdir?").concat(r),{method:"POST"})},onSuccess:()=>{t.invalidateQueries({queryKey:["servers",e,"files"]})}})}(t),D=function(e){let t=(0,e1.NL)();return(0,e2.D)({mutationFn:t=>{let{oldPath:n,newPath:r}=t;return(0,e3.SC)("/api/servers/".concat(encodeURIComponent(e),"/files/rename"),{method:"POST",body:JSON.stringify({oldPath:n,newPath:r})})},onSuccess:()=>{t.invalidateQueries({queryKey:["servers",e,"files"]})}})}(t),N=function(e){let t=(0,e1.NL)();return(0,e2.D)({mutationFn:async t=>{let{path:n,files:r}=t,s=new FormData;for(let e of r)s.append("files",e);let i=new URLSearchParams({path:n}),a=await fetch("/api/servers/".concat(encodeURIComponent(e),"/files/upload?").concat(i),{method:"POST",body:s});if(!a.ok){let e=await a.json().catch(()=>({error:"UnknownError",message:a.statusText})),t=Error(e.message);throw t.statusCode=a.status,t.code=e.error,t}return a.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["servers",e,"files"]})}})}(t),A=(0,s.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"success";c({open:!0,message:e,severity:t})},[]),O=(0,s.useCallback)(e=>{i(e),l("")},[]),L=(0,s.useCallback)(e=>{let t="/"===n?"/".concat(e):"".concat(n,"/").concat(e);W.mutate({path:t},{onSuccess:()=>A('Folder "'.concat(e,'" created')),onError:e=>A(e.message,"error")})},[n,W,A]),M=(0,s.useCallback)((e,r)=>{switch(e){case"delete":m(r);break;case"rename":y(r);break;case"download":!function(e,t){let n=new URLSearchParams({path:t}),r="/api/servers/".concat(encodeURIComponent(e),"/files/download?").concat(n),s=document.createElement("a");s.href=r,s.download="",document.body.appendChild(s),s.click(),document.body.removeChild(s)}(t,"/"===n?"/".concat(r.name):"".concat(n,"/").concat(r.name));break;case"open":{let e="/"===n?"/".concat(r.name):"".concat(n,"/").concat(r.name);if("/"===n&&"server.properties"===r.name)w(e);else{let t="/"===n?function(e){switch(e){case"whitelist.json":return"whitelist";case"ops.json":return"ops";case"banned-players.json":return"bans";default:return null}}(r.name):null;t?(b(t),C(e)):g(e)}}}},[n,t]),q=(0,s.useCallback)(e=>{N.mutate({path:n,files:e},{onSuccess:e=>{A("".concat(e.files.length," file(s) uploaded")),R(!1)},onError:e=>{A(e.message,"error")}})},[n,N,A]),E=(0,s.useCallback)(()=>{if(!u)return;let e="/"===n?"/".concat(u.name):"".concat(n,"/").concat(u.name);F.mutate({path:e},{onSuccess:()=>{A('"'.concat(u.name,'" deleted')),m(null)},onError:e=>{A(e.message,"error"),m(null)}})},[u,n,F,A]),U=(0,s.useCallback)(e=>{if(!f)return;let t="/"===n?"/".concat(f.name):"".concat(n,"/").concat(f.name),r="/"===n?"/".concat(e):"".concat(n,"/").concat(e);D.mutate({oldPath:t,newPath:r},{onSuccess:()=>{A('Renamed to "'.concat(e,'"')),y(null)},onError:e=>{A(e.message,"error"),y(null)}})},[f,n,D,A]),B=(0,s.useMemo)(()=>((null==I?void 0:I.files)||[]).map(e=>e.name),[null==I?void 0:I.files]);return P?(0,r.jsx)(h.Z,{sx:{borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsx)(x.Z,{variant:"text",width:300,height:32,sx:{mb:2}}),(0,r.jsx)(x.Z,{variant:"rectangular",height:40,sx:{mb:2}}),[1,2,3,4,5].map(e=>(0,r.jsx)(x.Z,{variant:"rectangular",height:48,sx:{mb:.5}},e))]})}):T?(0,r.jsxs)(d.Z,{severity:"error",sx:{borderRadius:3},children:["Failed to load files: ",T.message]}):S?(0,r.jsx)(np,{serverName:t,onBack:()=>w(null)}):v?(0,r.jsx)(tG,{serverName:t,filePath:v,onBack:()=>g(null)}):j?(0,r.jsx)(t9,{serverName:t,editorType:j,filePath:Z,onBack:()=>{b(null),C(null)},onSwitchToRaw:e=>{b(null),C(null),g(e)}}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(h.Z,{sx:{borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsx)(th,{path:n,onNavigate:O}),(0,r.jsx)(tj,{searchQuery:a,onSearchChange:l,onCreateFolder:L,onUpload:()=>R(!0),onRefresh:()=>z(),existingNames:B,disabled:W.isPending}),(0,r.jsx)(tO,{files:(null==I?void 0:I.files)||[],currentPath:n,onNavigate:O,onFileAction:M,searchQuery:a})]})}),(0,r.jsx)(t$,{target:u,isPending:F.isPending,onConfirm:E,onClose:()=>m(null)}),(0,r.jsx)(t1,{target:f,existingNames:B,isPending:D.isPending,onConfirm:U,onClose:()=>y(null)}),(0,r.jsx)(ny,{open:k,isPending:N.isPending,onUpload:q,onClose:()=>R(!1)}),(0,r.jsx)(eo.Z,{open:o.open,autoHideDuration:4e3,onClose:()=>c(e=>({...e,open:!1})),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:(0,r.jsx)(d.Z,{onClose:()=>c(e=>({...e,open:!1})),severity:o.severity,variant:"filled",children:o.message})})]})}var ng=n(73517),nj=n(86071),nb=n(41980),nZ=n(28116),nC=n(6516),nS=n(84728),nw=n(99777),nk=n(97731),nR=n(72205),nI=n(69899),nP=n(47254),nT=n(43214);function nz(e){let{status:t}=e;switch(t){case"added":return(0,r.jsx)(ng.Z,{fontSize:"small",sx:{color:"success.main"}});case"modified":return(0,r.jsx)(nP.Z,{fontSize:"small",sx:{color:"warning.main"}});case"deleted":return(0,r.jsx)(nT.Z,{fontSize:"small",sx:{color:"error.main"}})}}function nF(e){let{changes:t}=e;return 0===t.length?(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:"No configuration changes will be applied."}):(0,r.jsx)(nI.Z,{variant:"outlined",sx:{maxHeight:200,overflow:"auto",bgcolor:"background.default"},children:(0,r.jsx)(eP.Z,{dense:!0,disablePadding:!0,children:t.map(e=>(0,r.jsxs)(eT.ZP,{sx:{py:.5},children:[(0,r.jsx)(v.Z,{sx:{minWidth:32},children:(0,r.jsx)(nz,{status:e.status})}),(0,r.jsx)(g.Z,{primary:(0,r.jsx)(m.Z,{variant:"body2",component:"span",sx:{fontFamily:"monospace",fontSize:"0.8rem"},children:e.path}),secondary:function(e){switch(e.status){case"added":return"will be added";case"modified":return"will be modified";case"deleted":return"will be deleted"}}(e),secondaryTypographyProps:{variant:"caption"}})]},e.path))})})}var nW=n(45547);function nD(e){let{serverName:t,isServerRunning:n,createSafetySnapshot:s,onCreateSafetySnapshotChange:i}=e;return(0,r.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[(0,r.jsx)(eb.Z,{control:(0,r.jsx)(nW.Z,{checked:s,onChange:e=>i(e.target.checked),size:"small"}),label:(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(m.Z,{variant:"body2",children:"Create safety snapshot before restoring (recommended)"}),(0,r.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:"A backup of the current configuration will be saved before applying changes"})]}),sx:{alignItems:"flex-start",ml:0}}),n&&(0,r.jsx)(d.Z,{severity:"warning",sx:{py:.5},children:(0,r.jsxs)(m.Z,{variant:"body2",children:["Server ",(0,r.jsx)("strong",{children:t})," is currently running. A restart may be required for configuration changes to take effect."]})})]})}function nN(e){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(e))}function nA(e){let{open:t,serverName:n,snapshot:i,currentSnapshotId:a,isServerRunning:c=!1,onClose:x,onSuccess:h}=e,[p,f]=(0,s.useState)(!0),[y,v]=(0,s.useState)(null),[g,S]=(0,s.useState)(""),{mutate:w,isPending:k}=function(){let e=(0,e1.NL)();return(0,e2.D)({mutationFn:e=>{var t,n;let{serverName:r,snapshotId:s,options:i}=e;return(0,e3.SC)("/api/servers/".concat(encodeURIComponent(r),"/config-snapshots/").concat(encodeURIComponent(s),"/restore"),{method:"POST",body:JSON.stringify({createSnapshotBeforeRestore:null===(t=null==i?void 0:i.createSnapshotBeforeRestore)||void 0===t||t,force:null!==(n=null==i?void 0:i.force)&&void 0!==n&&n})})},onSuccess:(t,n)=>{let{serverName:r}=n;e.invalidateQueries({queryKey:["config-snapshots","list",r]}),e.invalidateQueries({queryKey:["servers",r]}),e.invalidateQueries({queryKey:["servers",r,"config"]})}})}(),{data:R,isLoading:I}=(0,nR.m)(null!=a?a:"",i.id,{enabled:t&&!!a}),P=(0,s.useCallback)(()=>{S(""),v(null),w({serverName:n,snapshotId:i.id,options:{createSnapshotBeforeRestore:p,force:c}},{onSuccess:e=>{v(e),null==h||h(e)},onError:e=>{S(e.message||"Failed to restore configuration")}})},[n,i.id,p,c,w,h]),T=(0,s.useCallback)(()=>{k||(S(""),v(null),f(!0),x())},[k,x]),z=(0,s.useCallback)(()=>{v(null),f(!0),x()},[x]);return(0,r.jsxs)(j.Z,{open:t,onClose:T,maxWidth:"sm",fullWidth:!0,"aria-labelledby":"config-restore-dialog-title",children:[(0,r.jsxs)(b.Z,{id:"config-restore-dialog-title",sx:{display:"flex",alignItems:"center",gap:1},children:[(0,r.jsx)(na.Z,{color:"warning"}),"Restore Configuration"]}),(0,r.jsx)(O.Z,{}),(0,r.jsxs)(Z.Z,{sx:{pt:2},children:[y&&(0,r.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"column",gap:2},children:[(0,r.jsxs)(d.Z,{severity:"success",children:[(0,r.jsx)(nw.Z,{children:"Configuration restored successfully"}),(0,r.jsxs)(m.Z,{variant:"body2",children:["Server ",(0,r.jsx)("strong",{children:n})," has been restored to the snapshot from"," ",nN(i.createdAt),"."]}),y.safetySnapshot&&(0,r.jsxs)(m.Z,{variant:"body2",sx:{mt:.5},children:["Safety snapshot created: ID"," ",(0,r.jsxs)("code",{children:[y.safetySnapshot.id.substring(0,8),"..."]})]})]}),c&&(0,r.jsx)(d.Z,{severity:"info",children:"Restart the server for changes to take effect."})]}),!y&&(0,r.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"column",gap:2},children:[(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:"Server"}),(0,r.jsx)(m.Z,{variant:"body1",sx:{fontWeight:"medium"},children:n})]}),(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:"Restore to"}),(0,r.jsx)(m.Z,{variant:"body1",sx:{fontWeight:"medium"},children:i.description?'"'.concat(i.description,'"'):"Unnamed snapshot"}),(0,r.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:nN(i.createdAt)})]}),a&&(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mb:1},children:"The following changes will be applied:"}),I?(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,r.jsx)(u.Z,{size:16}),(0,r.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:"Loading changes..."})]}):R?(0,r.jsx)(nF,{changes:R.changes}):null]}),!a&&(0,r.jsxs)(d.Z,{severity:"info",children:["All configuration files in this snapshot will be restored.",i.files.length>0&&(0,r.jsxs)(m.Z,{variant:"body2",sx:{mt:.5},children:[i.files.length," file(s) will be applied."]})]}),g&&(0,r.jsx)(d.Z,{severity:"error",children:g}),(0,r.jsx)(O.Z,{}),(0,r.jsx)(nD,{serverName:n,isServerRunning:c,createSafetySnapshot:p,onCreateSafetySnapshotChange:f})]})]}),(0,r.jsx)(O.Z,{}),(0,r.jsx)(C.Z,{sx:{px:2,py:1.5},children:y?(0,r.jsx)(o.Z,{onClick:z,variant:"contained",children:"Close"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{onClick:T,disabled:k,children:"Cancel"}),(0,r.jsx)(o.Z,{onClick:P,variant:"contained",color:"warning",disabled:k,startIcon:k?(0,r.jsx)(u.Z,{size:16,color:"inherit"}):(0,r.jsx)(nk.Z,{}),children:k?"Restoring...":"Restore Configuration"})]})})]})}var nO=n(54211),nL=n(19127),nM=n(65626),nq=n(21200);function nE(e){let{snapshot:t,compareMode:n,isSelectedForCompare:i,hasPredecessor:a,isDeleting:d=!1,onViewDiff:x,onRestore:h,onDelete:p,onToggleCompareSelect:m}=e,[f,y]=(0,s.useState)(!1);return n?(0,r.jsx)(te.Z,{title:i?"Remove from comparison":"Select for comparison",placement:"top",children:(0,r.jsx)(c.Z,{size:"small",onClick:()=>m(t),color:i?"primary":"default","aria-label":i?"Remove from comparison":"Select for comparison",children:i?(0,r.jsx)(nq.Z,{fontSize:"small"}):(0,r.jsx)(nM.Z,{fontSize:"small"})})}):(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[a&&(0,r.jsx)(te.Z,{title:"View diff from previous snapshot",placement:"top",children:(0,r.jsx)(c.Z,{size:"small",onClick:()=>x(t),"aria-label":"View diff",children:(0,r.jsx)(nj.Z,{fontSize:"small"})})}),(0,r.jsx)(te.Z,{title:"Restore to this snapshot",placement:"top",children:(0,r.jsx)(c.Z,{size:"small",onClick:()=>h(t),"aria-label":"Restore snapshot",children:(0,r.jsx)(nk.Z,{fontSize:"small"})})}),(0,r.jsx)(te.Z,{title:f?"Click again to confirm delete":"Delete snapshot",placement:"top",children:(0,r.jsx)("span",{children:(0,r.jsx)(o.Z,{size:"small",variant:f?"contained":"text",color:"error",onClick:()=>{if(!f){y(!0),setTimeout(()=>y(!1),3e3);return}p(t),y(!1)},disabled:d,startIcon:d?(0,r.jsx)(u.Z,{size:14,color:"inherit"}):(0,r.jsx)(nL.Z,{fontSize:"small"}),sx:{minWidth:0,px:f?1:.5,fontSize:12,lineHeight:1},"aria-label":f?"Confirm delete":"Delete snapshot",children:f?"Confirm":""})})})]})}function nU(e){var t,n;let{snapshot:s,isFirst:i,isLast:a,compareMode:o,isSelectedForCompare:c,isDeleting:d=!1,onViewDiff:u,onRestore:x,onDelete:h,onToggleCompareSelect:p}=e,f=(0,L.Z)(),y=!!s.scheduleId;return(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:2,position:"relative",opacity:d?.5:1,transition:"opacity 0.2s"},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0,width:20},children:[(0,r.jsx)(l.Z,{sx:{width:2,height:12,bgcolor:i?"transparent":(0,k.Fq)(f.palette.primary.main,.3)}}),(0,r.jsx)(l.Z,{sx:{width:12,height:12,borderRadius:"50%",bgcolor:c?"primary.main":(0,k.Fq)(f.palette.primary.main,.5),border:"2px solid",borderColor:c?"primary.dark":"primary.main",flexShrink:0,boxShadow:c?"0 0 8px ".concat((0,k.Fq)(f.palette.primary.main,.6)):"none",transition:"all 0.2s"}}),(0,r.jsx)(l.Z,{sx:{width:2,flex:1,minHeight:16,bgcolor:a?"transparent":(0,k.Fq)(f.palette.primary.main,.3)}})]}),(0,r.jsxs)(l.Z,{sx:{flex:1,mb:1,pb:1,borderRadius:2,border:"1px solid",borderColor:c?(0,k.Fq)(f.palette.primary.main,.5):"divider",bgcolor:c?(0,k.Fq)(f.palette.primary.main,.05):"background.paper",px:2,py:1.5,transition:"border-color 0.2s, background-color 0.2s",cursor:o?"pointer":"default","&:hover":o?{borderColor:(0,k.Fq)(f.palette.primary.main,.4),bgcolor:(0,k.Fq)(f.palette.primary.main,.03)}:void 0},onClick:o?()=>p(s):void 0,children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:1,mb:.5},children:[(0,r.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[(0,r.jsx)(m.Z,{variant:"caption",sx:{color:"text.secondary",fontFamily:"monospace",flexShrink:0},children:(t=s.createdAt,new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(t)))}),y&&(0,r.jsx)(N.Z,{icon:(0,r.jsx)(nO.Z,{}),label:"Scheduled",size:"small",variant:"outlined",color:"default",sx:{height:20,fontSize:11,"& .MuiChip-icon":{fontSize:12}}})]}),(0,r.jsx)(m.Z,{variant:"body2",sx:{fontWeight:500,mt:.25,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.description||(0,r.jsx)(l.Z,{component:"span",sx:{color:"text.disabled",fontStyle:"italic"},children:"No description"})})]}),(0,r.jsx)(l.Z,{onClick:e=>e.stopPropagation(),children:(0,r.jsx)(nE,{snapshot:s,compareMode:o,isSelectedForCompare:c,hasPredecessor:!i,isDeleting:d,onViewDiff:u,onRestore:x,onDelete:h,onToggleCompareSelect:p})})]}),(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5,mt:.5},children:[(0,r.jsx)(nb.Z,{sx:{fontSize:14,color:"text.disabled"}}),(0,r.jsxs)(m.Z,{variant:"caption",color:"text.secondary",children:[0===(n=s.files.length)?"No files":"".concat(n," file").concat(1!==n?"s":""),i&&s.files.length>0&&" — initial snapshot"]})]})]})]})}function nB(e){let{snapshots:t,total:n,hasNextPage:s,isFetchingNextPage:i,compareMode:a,selectedForCompare:c,deletingIds:d,onViewDiff:x,onRestore:h,onDelete:p,onToggleCompareSelect:f,onLoadMore:y}=e,v=function(e){let t=new Map;for(let n of e){let e=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(new Date(n.createdAt));t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(e=>{let[t,n]=e;return{label:t,items:n}})}(t),g=new Set(c.map(e=>e.id)),j=0;return(0,r.jsxs)(l.Z,{children:[v.map((e,n)=>(0,r.jsxs)(l.Z,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1.5,mb:1.5,mt:n>0?2:0},children:[(0,r.jsx)(O.Z,{sx:{flex:1}}),(0,r.jsx)(m.Z,{variant:"caption",sx:{color:"text.secondary",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",flexShrink:0},children:e.label}),(0,r.jsx)(O.Z,{sx:{flex:1}})]}),e.items.map(e=>{let n=j;return j++,(0,r.jsx)(nU,{snapshot:e,isFirst:n===t.length-1,isLast:0===n,compareMode:a,isSelectedForCompare:g.has(e.id),isDeleting:d.has(e.id),onViewDiff:x,onRestore:h,onDelete:p,onToggleCompareSelect:f},e.id)})]},e.label)),s&&(0,r.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",mt:2},children:(0,r.jsx)(o.Z,{onClick:y,disabled:i,startIcon:i?(0,r.jsx)(u.Z,{size:16,color:"inherit"}):(0,r.jsx)(ej.Z,{}),variant:"outlined",size:"small",children:i?"Loading...":"Load More (".concat(n-t.length," remaining)")})})]})}function nK(e){return e.substring(0,8)}function nV(e){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(e))}function nH(e){let{selectedSnapshots:t,onCompare:n,onCancelCompare:s}=e,i=t.length;return(0,r.jsxs)(nI.Z,{elevation:4,sx:{position:"sticky",top:16,zIndex:10,px:2,py:1.5,mb:2,borderRadius:2,border:"1px solid",borderColor:"primary.main",bgcolor:"background.paper",display:"flex",alignItems:"center",gap:2,flexWrap:"wrap"},children:[(0,r.jsx)(nj.Z,{color:"primary",fontSize:"small"}),(0,r.jsxs)(l.Z,{sx:{flex:1},children:[(0,r.jsx)(m.Z,{variant:"body2",sx:{fontWeight:600},children:"Compare mode"}),0===i&&(0,r.jsx)(m.Z,{variant:"caption",color:"text.secondary",children:"Select two snapshots to compare"}),1===i&&(0,r.jsxs)(m.Z,{variant:"caption",color:"text.secondary",children:[nV(t[0].createdAt)," selected — select one more"]}),2===i&&(0,r.jsxs)(m.Z,{variant:"caption",color:"text.secondary",children:[nV(t[0].createdAt)," (",nK(t[0].id),")"," vs ",nV(t[1].createdAt)," (",nK(t[1].id),")"]})]}),(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:1},children:[(0,r.jsx)(o.Z,{size:"small",variant:"contained",startIcon:(0,r.jsx)(nj.Z,{}),onClick:n,disabled:2!==i,children:"View Diff"}),(0,r.jsx)(o.Z,{size:"small",variant:"outlined",startIcon:(0,r.jsx)(q.Z,{}),onClick:s,color:"inherit",children:"Cancel"})]})]})}function nQ(e){var t,n,i;let{serverName:a,isServerRunning:c=!1}=e,{data:x,isLoading:h,isError:p,error:f,hasNextPage:y,isFetchingNextPage:v,fetchNextPage:g}=(0,nZ.N)({queryKey:["config-snapshots","list",a],queryFn:e=>{let{pageParam:t=0}=e;return(0,e3.SC)("/api/servers/".concat(encodeURIComponent(a),"/config-snapshots?limit=").concat(10,"&offset=").concat(t))},initialPageParam:0,getNextPageParam:(e,t)=>{var n;let r=t.reduce((e,t)=>{var n,r;return e+(null!==(r=null==t?void 0:null===(n=t.snapshots)||void 0===n?void 0:n.length)&&void 0!==r?r:0)},0);if(!(r>=(null!==(n=null==e?void 0:e.total)&&void 0!==n?n:0)))return r},enabled:!!a,staleTime:3e4,refetchInterval:6e4}),j=function(){let e=(0,e1.NL)();return(0,e2.D)({mutationFn:e=>{let{serverName:t,snapshotId:n}=e;return(0,e3.SC)("/api/servers/".concat(encodeURIComponent(t),"/config-snapshots/").concat(encodeURIComponent(n)),{method:"DELETE"})},onSuccess:(t,n)=>{let{serverName:r}=n;e.invalidateQueries({queryKey:["config-snapshots","list",r]}),e.invalidateQueries({queryKey:["config-snapshots"]})}})}(),b=(0,s.useMemo)(()=>{var e;return null!==(e=null==x?void 0:x.pages.flatMap(e=>{var t;return null!==(t=null==e?void 0:e.snapshots)&&void 0!==t?t:[]}))&&void 0!==e?e:[]},[x]),Z=null!==(n=null==x?void 0:null===(t=x.pages[0])||void 0===t?void 0:t.total)&&void 0!==n?n:0,[C,S]=(0,s.useState)(!1),[w,k]=(0,s.useState)(!1),[R,I]=(0,s.useState)(null),[P,T]=(0,s.useState)(null),[z,F]=(0,s.useState)(!1),[W,D]=(0,s.useState)(null),[N,A]=(0,s.useState)(!1),[O,L]=(0,s.useState)([]),[M,q]=(0,s.useState)(new Set),E=(0,s.useCallback)(e=>{let t=b.findIndex(t=>t.id===e.id);t<0||t>=b.length-1||(I(b[t+1]),T(e),k(!0))},[b]),U=(0,s.useCallback)(e=>{D(e),F(!0)},[]),B=(0,s.useCallback)(e=>{q(t=>new Set(t).add(e.id)),j.mutate({serverName:a,snapshotId:e.id},{onSettled:()=>{q(t=>{let n=new Set(t);return n.delete(e.id),n})}})},[a,j]),K=(0,s.useCallback)(e=>{L(t=>t.find(t=>t.id===e.id)?t.filter(t=>t.id!==e.id):t.length>=2?[t[1],e]:[...t,e])},[]),V=(0,s.useCallback)(()=>{if(2!==O.length)return;let e=[...O].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime());I(e[0]),T(e[1]),k(!0)},[O]),H=(0,s.useCallback)(()=>{A(!1),L([])},[]),Q=(0,s.useCallback)(()=>{k(!1),I(null),T(null)},[]),G=b.length>0?b[0].id:void 0;return h?(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",py:8,gap:2},children:[(0,r.jsx)(u.Z,{size:24}),(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:"Loading config history..."})]}):p?(0,r.jsxs)(d.Z,{severity:"error",sx:{mt:1},children:["Failed to load config history: ",null!==(i=null==f?void 0:f.message)&&void 0!==i?i:"Unknown error"]}):(0,r.jsxs)(l.Z,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2,gap:1,flexWrap:"wrap"},children:[(0,r.jsx)(m.Z,{variant:"h6",sx:{fontWeight:600},children:"Config History"}),(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:1},children:[b.length>=2&&!N&&(0,r.jsx)(o.Z,{size:"small",variant:"outlined",startIcon:(0,r.jsx)(nj.Z,{}),onClick:()=>A(!0),children:"Compare"}),(0,r.jsx)(o.Z,{size:"small",variant:"contained",startIcon:(0,r.jsx)(ng.Z,{}),onClick:()=>S(!0),children:"Create Snapshot"})]})]}),N&&(0,r.jsx)(nH,{selectedSnapshots:O,onCompare:V,onCancelCompare:H}),0===b.length&&(0,r.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",py:8,gap:1.5,color:"text.secondary"},children:[(0,r.jsx)(nb.Z,{sx:{fontSize:48,opacity:.3}}),(0,r.jsx)(m.Z,{variant:"body1",sx:{fontWeight:500},children:"No config snapshots yet"}),(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",textAlign:"center",children:"Create a snapshot to save the current server configuration."}),(0,r.jsx)(o.Z,{variant:"contained",size:"small",startIcon:(0,r.jsx)(ng.Z,{}),onClick:()=>S(!0),sx:{mt:1},children:"Create First Snapshot"})]}),b.length>0&&(0,r.jsx)(nB,{snapshots:b,total:Z,hasNextPage:!!y,isFetchingNextPage:v,compareMode:N,selectedForCompare:O,deletingIds:M,onViewDiff:E,onRestore:U,onDelete:B,onToggleCompareSelect:K,onLoadMore:g}),(0,r.jsx)(nC.e,{open:C,onClose:()=>S(!1),serverNames:[a],defaultServer:a}),w&&R&&P&&(0,r.jsx)(nS.YN,{open:w,onClose:Q,snapshotA:R,snapshotB:P,onRestoreA:e=>{Q(),D(e),F(!0)}}),z&&W&&(0,r.jsx)(nA,{open:z,serverName:a,snapshot:W,currentSnapshotId:G,isServerRunning:c,onClose:()=>{F(!1),D(null)}})]})}var nG=n(33402),nJ=n(60097),n_=n(45420),n$=n(56831),nX=n(12063),nY=n(88978);function n0(e){var t;let{serverName:n}=e,[i,a]=(0,s.useState)("config-snapshots"),{data:o}=(0,ex.mj)(),c=null!==(t=null==o?void 0:o.configured)&&void 0!==t&&t;return(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(l.Z,{sx:{borderBottom:1,borderColor:"divider",mb:3},children:(0,r.jsxs)(nG.Z,{value:i,onChange:(e,t)=>a(t),"aria-label":"Server backup tabs",children:[(0,r.jsx)(nJ.Z,{value:"config-snapshots",label:"Config Snapshots",icon:(0,r.jsx)(n_.Z,{}),iconPosition:"start",sx:{textTransform:"none",fontWeight:"medium"}}),(0,r.jsx)(nJ.Z,{value:"world-backups",label:"World Backups",icon:(0,r.jsx)(nm.Z,{}),iconPosition:"start",sx:{textTransform:"none",fontWeight:"medium"}})]})}),"config-snapshots"===i&&(0,r.jsx)(n2,{serverName:n}),"world-backups"===i&&(0,r.jsx)(n1,{configured:c})]})}function n1(e){let{configured:t}=e;return(0,r.jsxs)(eh.Z,{spacing:3,children:[(0,r.jsx)(l.Z,{sx:{display:"flex",justifyContent:"flex-end"},children:(0,r.jsx)(n$.JZ,{disabled:!t})}),(0,r.jsx)(n$.Xj,{}),(0,r.jsx)(n$.Ff,{}),t&&(0,r.jsx)(n$.zO,{})]})}function n2(e){var t,n,i;let{serverName:a}=e,{data:c,isLoading:d,error:u}=(0,nX.m)(a,5,0),{data:x}=(0,nY.F$)(a),h=null!==(t=null==x?void 0:x.schedules)&&void 0!==t?t:[],p=null!==(n=null==c?void 0:c.snapshots)&&void 0!==n?n:[],f=null!==(i=null==c?void 0:c.total)&&void 0!==i?i:0,y=h.find(e=>e.serverName===a),[v,g]=(0,s.useState)(!1),[j,b]=(0,s.useState)(!1),[Z,C]=(0,s.useState)(!1),S=(0,s.useMemo)(()=>p.length<2?{snapshotA:null,snapshotB:null}:{snapshotA:p[1],snapshotB:p[0]},[p]);return d?(0,r.jsx)(m.Z,{color:"text.secondary",children:"Loading config snapshots..."}):u?(0,r.jsx)(m.Z,{color:"error",children:"Failed to load config snapshots"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"flex-end",gap:1,mb:2},children:[(0,r.jsx)(o.Z,{variant:"outlined",size:"small",startIcon:(0,r.jsx)(eA.Z,{}),onClick:()=>b(!0),children:"Manage Schedules"}),(0,r.jsx)(o.Z,{variant:"contained",size:"small",startIcon:(0,r.jsx)(ng.Z,{}),onClick:()=>g(!0),children:"Create Snapshot"})]}),(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Config snapshots capture server configuration files (server.properties, config.env, etc.) for versioning, comparison, and restore operations."}),(0,r.jsx)(n$.Dm,{serverName:a,snapshots:p,totalCount:f,schedule:y,onViewHistory:()=>{f>=2&&p.length>=2&&C(!0)},onCreateSnapshot:()=>g(!0),onViewDiff:()=>C(!0)}),(0,r.jsx)(n$.ed,{open:v,onClose:()=>g(!1),serverNames:[a],defaultServer:a}),(0,r.jsx)(n$.zg,{open:j,onClose:()=>b(!1),serverNames:[a],filterServerName:a}),Z&&S.snapshotA&&S.snapshotB&&(0,r.jsx)(nS.YN,{open:Z,onClose:()=>C(!1),snapshotA:S.snapshotA,snapshotB:S.snapshotB})]})}let n3=["Overview","Activity","Mods","Files","Config History","Backups","Access","Options"];function n6(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 n4(e){var t,n,i,a,d;let{server:u,onSendCommand:x}=e,[f,y]=(0,s.useState)("Overview"),[v,g]=(0,s.useState)(""),[b,C]=(0,s.useState)(!0),[R,I]=(0,s.useState)(!1),P=(0,s.useRef)(null),T=(0,L.Z)(),z=(0,M.Z)(T.breakpoints.down("sm"));(0,s.useEffect)(()=>{"Overview"!==f&&I(!1)},[f]);let{logs:F,isConnected:W}=(0,J.Y)({serverName:u.name}),D=(0,s.useMemo)(()=>F.filter(e=>!e.includes("RCON Listener")&&!e.includes("RCON Client")&&!e.includes("RconClient")),[F]);(0,s.useEffect)(()=>{P.current&&b&&(P.current.scrollTop=P.current.scrollHeight)},[D,b]);let Q=async()=>{v.trim()&&x&&(await x(v.trim()),g(""))},$=null!==(a=null===(t=u.stats)||void 0===t?void 0:t.cpuPercent)&&void 0!==a?a:0;(null===(n=u.stats)||void 0===n?void 0:n.memoryUsage)&&u.stats.memoryUsage,function(e){if(!e)return;let t=e.match(/^(\d+)\s*(M|G)?$/i);if(t)parseInt(t[1],10),(t[2]||"M").toUpperCase()}(u.memory);let X=null!==(d=null===(i=u.stats)||void 0===i?void 0:i.memoryPercent)&&void 0!==d?d:0;return(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5,mb:3},children:n3.map(e=>(0,r.jsx)(o.Z,{onClick:()=>y(e),sx:{px:2,py:1,borderRadius:5,fontSize:14,fontWeight:500,textTransform:"none",bgcolor:f===e?"primary.main":"transparent",color:f===e?"#0a0e14":"text.secondary","&:hover":{bgcolor:f===e?"primary.main":(0,k.Fq)("#1bd96a",.1)}},children:e},e))}),(0,r.jsxs)(l.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, 1fr)"},gap:2,mb:2.5},children:[(0,r.jsx)(G,{value:"".concat($.toFixed(2),"%"),unit:"/ 100%",label:"CPU usage",icon:(0,r.jsx)(E.Z,{sx:{fontSize:28}}),progress:$,progressMax:100,color:"#1bd96a"}),(0,r.jsx)(G,{value:"".concat(X.toFixed(2),"%"),unit:"/ 100%",label:"Memory usage",icon:(0,r.jsx)(U.Z,{sx:{fontSize:28}}),progress:X,progressMax:100,color:"#1bd96a"}),(0,r.jsx)(G,{value:u.worldSize||"0 B",unit:"/ 10 GB",label:"World size",icon:(0,r.jsx)(B.Z,{sx:{fontSize:28}}),progress:function(e){if(!e)return 0;let t=e.match(/^([\d.]+)\s*(B|KB|MB|MiB|GB|GiB)?$/i);if(!t)return 0;let n=parseFloat(t[1]);switch((t[2]||"B").toUpperCase()){case"GB":case"GIB":return 1024*n;case"MB":case"MIB":return n;case"KB":return n/1024;default:return n/1048576}}(u.worldSize),progressMax:10240,color:"#1bd96a"})]}),"Overview"===f&&(0,r.jsxs)(h.Z,{sx:{bgcolor:"background.paper",borderRadius:3,border:"1px solid",borderColor:"divider",overflow:"hidden"},children:[(0,r.jsxs)(l.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,r.jsx)(m.Z,{variant:"h6",sx:{fontWeight:700,color:"text.primary"},children:"Console"}),(0,r.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,r.jsxs)(l.Z,{sx:{position:"relative"},children:[(0,r.jsx)(l.Z,{ref:P,onScroll:()=>{if(!P.current)return;let{scrollTop:e,scrollHeight:t,clientHeight:n}=P.current;C(t-e-n<30)},sx:{height:{xs:240,sm:360},overflowY:"auto",px:2.5,py:2,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===D.length?(0,r.jsx)(m.Z,{sx:{color:"text.secondary",textAlign:"center",py:8},children:"Waiting for logs..."}):D.map((e,t)=>{let n=function(e){let t=n6(e).match(/\[(\d{2}:\d{2}:\d{2})\]\s*\[([^/]+)\/(\w+)\]:\s*(.+)/);return t?{time:t[1],thread:t[2],level:t[3]||"INFO",msg:t[4]}:null}(e);return n?(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,r.jsxs)(l.Z,{component:"span",sx:{color:"#4a4d60"},children:["[",n.time,"]"]}),(0,r.jsxs)(l.Z,{component:"span",sx:{color:"#4a4d60"},children:["\xa0[",n.thread,"/",(0,r.jsx)(l.Z,{component:"span",sx:{color:"WARN"===n.level?"#e8a848":"#6b6e80"},children:n.level}),"]:\xa0"]}),(0,r.jsx)(l.Z,{component:"span",sx:{color:"WARN"===n.level?"#c4a45a":"#b4b6c4"},children:n.msg})]},t):(0,r.jsx)(l.Z,{sx:{color:"#b4b6c4"},children:n6(e)},t)})}),(0,r.jsx)(c.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,r.jsx)(K.Z,{sx:{fontSize:18}})}),!b&&(0,r.jsx)(c.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,r.jsx)(V.Z,{sx:{fontSize:18}})})]}),(0,r.jsx)(l.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,r.jsx)(S.Z,{fullWidth:!0,size:"small",placeholder:"Send a command",value:v,onChange:e=>g(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Q())},disabled:!W,InputProps:{startAdornment:(0,r.jsx)(A.Z,{position:"start",children:(0,r.jsx)(H.Z,{sx:{fontSize:16,color:"#999"}})}),sx:{bgcolor:"#13141c",borderRadius:2,fontSize:14,"& .MuiOutlinedInput-notchedOutline":{borderColor:"#2a2d3e"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#3a3d4e"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"}}}})})]}),"Overview"===f&&(0,r.jsxs)(w.ZP,{container:!0,spacing:3,sx:{mt:1},children:[(0,r.jsx)(w.ZP,{item:!0,xs:12,md:6,children:(0,r.jsx)(h.Z,{sx:{borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Information"}),(0,r.jsx)(O.Z,{sx:{mb:2}}),(0,r.jsx)(n5,{label:"Name",value:u.name}),(0,r.jsx)(n5,{label:"Container",value:u.container}),(0,r.jsx)(n5,{label:"Hostname",value:u.hostname?(0,r.jsx)(e8.h,{hostname:u.hostname,color:"text.primary"}):void 0}),(0,r.jsx)(n5,{label:"Type",value:u.type}),(0,r.jsx)(n5,{label:"Version",value:u.version}),(0,r.jsx)(n5,{label:"Memory",value:u.memory}),(0,r.jsx)(n5,{label:"Uptime",value:u.uptime||function(e){if(!e||e<0)return"0s";let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?"".concat(t,"h ").concat(n,"m"):n>0?"".concat(n,"m ").concat(r,"s"):"".concat(r,"s")}(u.uptimeSeconds)})]})})}),(0,r.jsx)(w.ZP,{item:!0,xs:12,md:6,children:(0,r.jsx)(h.Z,{sx:{borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Players"}),(0,r.jsx)(O.Z,{sx:{mb:2}}),u.players?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n5,{label:"Online",value:"".concat(u.players.online," / ").concat(u.players.max)}),u.players.players&&u.players.players.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{mt:2,mb:1},children:"Online Players"}),(0,r.jsx)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:u.players.players.map(e=>(0,r.jsx)(N.Z,{label:e,size:"small"},e))})]})]}):(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:"Player information unavailable"})]})})}),(0,r.jsx)(w.ZP,{item:!0,xs:12,md:6,children:(0,r.jsx)(e9,{serverName:u.name,hostname:u.hostname})})]}),"Activity"===f&&(0,r.jsx)(l.Z,{sx:{mt:3},children:(0,r.jsx)(h.Z,{sx:{borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsx)(m.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Activity"}),(0,r.jsx)(O.Z,{sx:{mb:2}}),(0,r.jsx)(el,{serverName:u.name})]})})}),"Mods"===f&&(0,r.jsx)(l.Z,{sx:{mt:3},children:(0,r.jsx)(tl,{serverName:u.name})}),"Files"===f&&(0,r.jsx)(l.Z,{sx:{mt:3},children:(0,r.jsx)(nv,{serverName:u.name})}),"Config History"===f&&(0,r.jsx)(l.Z,{sx:{mt:3},children:(0,r.jsx)(nQ,{serverName:u.name,isServerRunning:"running"===u.status})}),"Backups"===f&&(0,r.jsx)(l.Z,{sx:{mt:3},children:(0,r.jsx)(n0,{serverName:u.name})}),"Access"===f&&(0,r.jsx)(l.Z,{sx:{mt:3},children:(0,r.jsx)(e4,{serverId:u.name})}),"Options"===f&&(0,r.jsx)(l.Z,{sx:{mt:3},children:(0,r.jsx)(eE,{serverName:u.name,isRunning:"running"===u.status})}),"Overview"===f&&(0,r.jsxs)(j.Z,{open:R,onClose:()=>I(!1),maxWidth:"xl",fullWidth:!0,fullScreen:z,PaperProps:{sx:{height:z?"100vh":"90vh",bgcolor:"background.paper"}},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",p:2,borderBottom:1,borderColor:"divider"},children:[(0,r.jsxs)(m.Z,{variant:"h6",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,letterSpacing:"0.05em"},children:["Console - ",u.name]}),(0,r.jsx)(c.Z,{onClick:()=>I(!1),"aria-label":"Close console",children:(0,r.jsx)(q.Z,{})})]}),(0,r.jsx)(Z.Z,{sx:{p:0,display:"flex",flexDirection:"column"},children:(0,r.jsx)(_.K,{serverName:u.name})})]})]})}function n5(e){let{label:t,value:n}=e;return n?(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,r.jsx)(m.Z,{variant:"body2",color:"text.secondary",children:t}),(0,r.jsx)(m.Z,{variant:"body2",component:"div",sx:{fontWeight:500},children:n})]}):null}var n8=n(93757);function n7(){return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]})}function n9(){return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M21 2v6h-6"}),(0,r.jsx)("path",{d:"M3 12a9 9 0 0115.36-6.36L21 8"}),(0,r.jsx)("path",{d:"M3 22v-6h6"}),(0,r.jsx)("path",{d:"M21 12a9 9 0 01-15.36 6.36L3 16"})]})}function re(){var e,t,n,N;let A=(0,i.useParams)(),O=(0,a.x)(),L=decodeURIComponent(A.name),{data:M,isLoading:q,error:E}=(0,ex.Hy)(L),{status:U,health:B}=function(e){let{serverName:t,onStatusChange:n,enabled:r=!0,reconnectInterval:i=3e3}=e,[a,l]=(0,s.useState)(null),[o,c]=(0,s.useState)(null);(0,s.useEffect)(()=>{l(null),c(null)},[t]);let d=(0,s.useCallback)(e=>{if("server-status"===e.type){let t=e.data.status,r=e.data.health;l(t),c(r),null==n||n(t,r)}},[n]),{isConnected:u,reconnect:x,retryCount:h}=(0,n8.D)({url:"/api/sse/servers/".concat(encodeURIComponent(t),"/status"),onMessage:d,enabled:r,reconnectInterval:i});return{status:a,health:o,isConnected:u,reconnect:x,retryCount:h}}({serverName:L,enabled:!!L}),[K,V]=(0,s.useState)(null),[H,Q]=(0,s.useState)(!1),[G,J]=(0,s.useState)(""),_=(0,ex.jM)(),$=(0,ex.Aw)(),X=(0,ex._I)(),Y=(0,ex.Hq)(),ee=async()=>{try{await _.mutateAsync(L)}catch(e){console.error("Failed to start server:",e)}},et=async()=>{try{await $.mutateAsync(L)}catch(e){console.error("Failed to stop server:",e)}},en=async()=>{try{await X.mutateAsync(L)}catch(e){console.error("Failed to restart server:",e)}},er=async e=>{try{await fetch("/api/servers/".concat(encodeURIComponent(L),"/exec"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})})}catch(e){console.error("Failed to send command:",e)}},es=U||(null==M?void 0:M.server.status),ei=_.isPending||$.isPending||X.isPending,ea=null==M?void 0:M.server;return(0,r.jsxs)(r.Fragment,{children:[E&&(0,r.jsxs)(d.Z,{severity:"error",sx:{mb:3},children:["Failed to load server: ",E.message]}),_.isError&&(0,r.jsxs)(d.Z,{severity:"error",sx:{mb:3},children:["Failed to start server: ",null===(e=_.error)||void 0===e?void 0:e.message]}),$.isError&&(0,r.jsxs)(d.Z,{severity:"error",sx:{mb:3},children:["Failed to stop server: ",null===(t=$.error)||void 0===t?void 0:t.message]}),X.isError&&(0,r.jsxs)(d.Z,{severity:"error",sx:{mb:3},children:["Failed to restart server: ",null===(n=X.error)||void 0===n?void 0:n.message]}),Y.isError&&(0,r.jsxs)(d.Z,{severity:"error",sx:{mb:3},children:["Failed to delete server: ",null===(N=Y.error)||void 0===N?void 0:N.message]}),q?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,r.jsx)(x.Z,{variant:"rounded",width:64,height:64,sx:{borderRadius:3,flexShrink:0}}),(0,r.jsxs)(l.Z,{sx:{flex:1},children:[(0,r.jsx)(x.Z,{variant:"text",width:80,height:18,sx:{mb:.5}}),(0,r.jsx)(x.Z,{variant:"text",width:"40%",height:40}),(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:2,mt:.75},children:[(0,r.jsx)(x.Z,{variant:"text",width:100}),(0,r.jsx)(x.Z,{variant:"text",width:60}),(0,r.jsx)(x.Z,{variant:"text",width:140}),(0,r.jsx)(x.Z,{variant:"text",width:50})]})]}),(0,r.jsxs)(l.Z,{sx:{display:"flex",gap:1,flexShrink:0},children:[(0,r.jsx)(x.Z,{variant:"rounded",width:90,height:40,sx:{borderRadius:2}}),(0,r.jsx)(x.Z,{variant:"rounded",width:36,height:36,sx:{borderRadius:2}})]})]}),(0,r.jsx)(l.Z,{sx:{display:"flex",gap:.5,mb:3},children:[80,70,65,50,65,65].map((e,t)=>(0,r.jsx)(x.Z,{variant:"rounded",width:e,height:36,sx:{borderRadius:5}},t))}),(0,r.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,r.jsx)(h.Z,{sx:{borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1.5},children:[(0,r.jsx)(x.Z,{variant:"text",width:"50%"}),(0,r.jsx)(x.Z,{variant:"circular",width:28,height:28})]}),(0,r.jsx)(x.Z,{variant:"text",width:"60%",height:36}),(0,r.jsx)(x.Z,{variant:"rounded",width:"100%",height:6,sx:{borderRadius:3,mt:1}})]})},e))}),(0,r.jsxs)(h.Z,{sx:{borderRadius:3,border:"1px solid",borderColor:"divider"},children:[(0,r.jsxs)(l.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,r.jsx)(x.Z,{variant:"text",width:80,height:28}),(0,r.jsx)(x.Z,{variant:"circular",width:10,height:10})]}),(0,r.jsx)(x.Z,{variant:"rectangular",height:360,sx:{bgcolor:"#0a0a0a"}}),(0,r.jsx)(l.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,r.jsx)(x.Z,{variant:"rounded",width:"100%",height:40,sx:{borderRadius:2}})})]}),(0,r.jsxs)(w.ZP,{container:!0,spacing:3,sx:{mt:1},children:[(0,r.jsx)(w.ZP,{item:!0,xs:12,md:6,children:(0,r.jsx)(h.Z,{sx:{borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsx)(x.Z,{variant:"text",width:"40%",height:28,sx:{mb:1}}),(0,r.jsx)(x.Z,{variant:"rectangular",height:1,sx:{mb:2}}),[0,1,2,3,4,5,6].map(e=>(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,r.jsx)(x.Z,{variant:"text",width:"30%"}),(0,r.jsx)(x.Z,{variant:"text",width:"40%"})]},e))]})})}),(0,r.jsx)(w.ZP,{item:!0,xs:12,md:6,children:(0,r.jsx)(h.Z,{sx:{borderRadius:3},children:(0,r.jsxs)(p.Z,{children:[(0,r.jsx)(x.Z,{variant:"text",width:"30%",height:28,sx:{mb:1}}),(0,r.jsx)(x.Z,{variant:"rectangular",height:1,sx:{mb:2}}),(0,r.jsxs)(l.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,r.jsx)(x.Z,{variant:"text",width:"25%"}),(0,r.jsx)(x.Z,{variant:"text",width:"20%"})]})]})})})]})]}):ea?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,r.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 t=e.toUpperCase();return["PAPER","SPIGOT","BUKKIT","PURPUR"].includes(t)?"\uD83D\uDD0C":["FORGE","NEOFORGE","FABRIC","QUILT"].includes(t)?"\uD83D\uDD27":"\uD83C\uDFAE"}(ea.type)}),(0,r.jsxs)(l.Z,{sx:{flex:1},children:[(0,r.jsxs)(m.Z,{onClick:()=>O.push("/servers"),sx:{fontSize:12,color:"primary.main",cursor:"pointer",mb:.25,display:"flex",alignItems:"center",gap:.5,"&:hover":{textDecoration:"underline"}},children:[(0,r.jsx)(R.Z,{sx:{fontSize:14}})," All servers"]}),(0,r.jsx)(m.Z,{variant:"h4",component:"h1",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,color:"text.primary",letterSpacing:"0.5px",m:0,textTransform:"uppercase"},children:L}),(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:0,mt:.75,flexWrap:"wrap",fontSize:13,color:"text.secondary"},children:[ea.version&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,r.jsx)(z.Z,{sx:{fontSize:14}}),"Minecraft ",ea.version]}),(0,r.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.type&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,r.jsx)(F.Z,{sx:{fontSize:14}}),ea.type]}),(0,r.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.hostname&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,r.jsx)(W.Z,{sx:{fontSize:14}}),(0,r.jsx)(e8.h,{hostname:ea.hostname,fontSize:13})]}),(0,r.jsx)(l.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,r.jsx)(D.Z,{sx:{fontSize:14}}),ea.uptime||function(e){if(!e||e<0)return"0s";let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?"".concat(t,"h ").concat(n,"m"):n>0?"".concat(n,"m ").concat(r,"s"):"".concat(r,"s")}(ea.uptimeSeconds)||"0s"]})]})]}),(0,r.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:1.25,flexShrink:0},children:[("stopped"===es||"exited"===es||"not_created"===es)&&(0,r.jsx)(o.Z,{variant:"contained",color:"success",startIcon:ei?(0,r.jsx)(u.Z,{size:16,color:"inherit"}):(0,r.jsx)(I.Z,{}),onClick:ee,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:600},children:"Start"}),"running"===es&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{variant:"outlined",startIcon:ei?(0,r.jsx)(u.Z,{size:16}):(0,r.jsx)(n7,{}),onClick:et,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:500,borderColor:"divider",color:"text.secondary","&:hover":{borderColor:"text.secondary",bgcolor:(0,k.Fq)("#fff",.05)}},children:"Stop"}),(0,r.jsx)(o.Z,{variant:"contained",startIcon:ei?(0,r.jsx)(u.Z,{size:16,color:"inherit"}):(0,r.jsx)(n9,{}),onClick:en,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,r.jsx)(c.Z,{onClick:e=>V(e.currentTarget),sx:{width:36,height:36,borderRadius:2,border:"1px solid",borderColor:"divider",color:"text.secondary"},children:(0,r.jsx)(P.Z,{sx:{fontSize:18}})}),(0,r.jsx)(f.Z,{anchorEl:K,open:!!K,onClose:()=>V(null),children:(0,r.jsxs)(y.Z,{onClick:()=>{V(null),Q(!0),J("")},sx:{color:"error.main"},children:[(0,r.jsx)(v.Z,{children:(0,r.jsx)(T.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,r.jsx)(g.Z,{children:"Delete Server"})]})})]})]}),(0,r.jsx)(n4,{server:ea,onSendCommand:er})]}):(0,r.jsx)(d.Z,{severity:"warning",children:"Server not found"}),(0,r.jsxs)(j.Z,{open:H,onClose:()=>{Q(!1),J("")},maxWidth:"sm",fullWidth:!0,children:[(0,r.jsx)(b.Z,{children:"Delete Server"}),(0,r.jsxs)(Z.Z,{children:[(0,r.jsxs)(m.Z,{sx:{mb:2},children:["This action cannot be undone. Type ",(0,r.jsx)("strong",{children:L})," to confirm deletion."]}),(0,r.jsx)(S.Z,{label:"Server name",value:G,onChange:e=>J(e.target.value),fullWidth:!0,autoFocus:!0})]}),(0,r.jsxs)(C.Z,{sx:{px:3,pb:2},children:[(0,r.jsx)(o.Z,{onClick:()=>{Q(!1),J("")},children:"Cancel"}),(0,r.jsx)(o.Z,{variant:"contained",color:"error",onClick:()=>{G===L&&Y.mutate({name:L,force:!0},{onSuccess:()=>{O.push("/servers")}})},disabled:G!==L||Y.isPending,startIcon:Y.isPending?(0,r.jsx)(u.Z,{size:16}):null,children:Y.isPending?"Deleting...":"Delete"})]})]})]})}},56813:function(e,t,n){"use strict";n.d(t,{I:function(){return a}});var r=n(94655),s=n(25333),i=n(82925);function a(e){let{action:t,size:n="small"}=e,a=i.Lu[t]||"default",l=i.n3[t]||t;return(0,r.jsx)(s.Z,{label:l,color:a,size:n,variant:"filled",sx:{fontWeight:600,fontSize:"small"===n?"0.7rem":"0.8rem"}})}},26892:function(e,t,n){"use strict";n.d(t,{c:function(){return l}});var r=n(94655),s=n(25333),i=n(46207),a=n(43436);function l(e){let{status:t,size:n="small"}=e;return(0,r.jsx)(s.Z,{icon:"success"===t?(0,r.jsx)(i.Z,{}):(0,r.jsx)(a.Z,{}),label:"success"===t?"OK":"Error",color:"success"===t?"success":"error",size:n,variant:"outlined",sx:{fontWeight:500,fontSize:"small"===n?"0.7rem":"0.8rem"}})}},83765:function(e,t,n){"use strict";n.d(t,{x:function(){return z}});var r=n(94655),s=n(35106),i=n(7281),a=n(21138),l=n(84811),o=n(47001),c=n(53281),d=n(11254),u=n(70366),x=n(6406),h=n(69899),p=n(31317),m=n(95511),f=n(10721),y=n(81071),v=n(30417),g=n(25333),j=n(87716),b=n(79983),Z=n(89161),C=n(60236),S=n(27171),w=n(30114),k=n(69178),R=n(46725),I=n(56813),P=n(26892);function T(e){var t,n;let{log:c,onClick:d,hideTargetColumn:x}=e,[h,f]=(0,s.useState)("failure"===c.status),v=c.details&&Object.keys(c.details).length>0,k="failure"===c.status&&c.errorMessage,T=v||k,z=(t=c.targetType,n=c.targetName,"server"===t?"/servers/".concat(encodeURIComponent(n)):"player"===t?"/players":null);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(u.Z,{hover:!0,sx:{cursor:"pointer","&:last-child td, &:last-child th":{border:0}},onClick:()=>null==d?void 0:d(c),tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),null==d||d(c))},role:"button","aria-label":"".concat(c.action," by ").concat(c.actor," on ").concat(c.targetName),children:[(0,r.jsx)(o.Z,{padding:"checkbox",sx:{width:48},children:T&&(0,r.jsx)(b.Z,{size:"small",onClick:e=>{e.stopPropagation(),f(!h)},"aria-label":h?"Collapse details":"Expand details",children:h?(0,r.jsx)(C.Z,{}):(0,r.jsx)(Z.Z,{})})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(m.Z,{title:function(e){let t=new Date(e);return 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(t)}(c.timestamp),arrow:!0,children:(0,r.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:function(e){let t=new Date,n=new Date(e),r=Math.floor((t.getTime()-n.getTime())/1e3),s=Math.floor(r/60),i=Math.floor(s/60),a=Math.floor(i/24);return r<60?"just now":s<60?"".concat(s,"m ago"):i<24?"".concat(i,"h ago"):a<7?"".concat(a,"d ago"):new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(n)}(c.timestamp)})})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(I.I,{action:c.action})}),(0,r.jsx)(o.Z,{children:c.actor.startsWith("cli:")?(0,r.jsx)(g.Z,{label:c.actor.replace("cli:",""),size:"small",variant:"outlined",sx:{fontSize:"0.75rem"}}):(0,r.jsx)(p.Z,{variant:"body2",children:c.actor.replace("api:","")})}),!x&&(0,r.jsx)(o.Z,{children:(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center"},children:[function(e){switch(e){case"server":return(0,r.jsx)(S.Z,{sx:{fontSize:16,mr:.5,color:"text.secondary"}});case"player":return(0,r.jsx)(w.Z,{sx:{fontSize:16,mr:.5,color:"text.secondary"}});default:return null}}(c.targetType),z?(0,r.jsx)(R.default,{href:z,style:{textDecoration:"none"},onClick:e=>e.stopPropagation(),children:(0,r.jsx)(p.Z,{variant:"body2",sx:{color:"primary.main","&:hover":{textDecoration:"underline"}},children:c.targetName})}):(0,r.jsx)(p.Z,{variant:"body2",children:c.targetName})]})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(P.c,{status:c.status})})]}),T&&(0,r.jsx)(u.Z,{children:(0,r.jsx)(o.Z,{sx:{py:0},colSpan:x?5:6,children:(0,r.jsx)(j.Z,{in:h,timeout:"auto",unmountOnExit:!0,children:(0,r.jsxs)(i.Z,{sx:{py:2,px:2},children:[k&&(0,r.jsx)(y.Z,{severity:"error",sx:{mb:2},children:c.errorMessage}),v&&(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(p.Z,{variant:"caption",color:"text.secondary",sx:{mb:1,display:"block"},children:"Details"}),(0,r.jsx)(a.Z,{size:"small",sx:{width:"auto"},children:(0,r.jsx)(l.Z,{children:Object.entries(c.details).map(e=>{let[t,n]=e;return(0,r.jsxs)(u.Z,{children:[(0,r.jsx)(o.Z,{sx:{fontWeight:600,color:"text.secondary",border:"none",py:.5,pl:0},children:t}),(0,r.jsx)(o.Z,{sx:{border:"none",py:.5},children:String(n)})]},t)})})})]})]})})})})]})}function z(e){let{logs:t,total:n,isLoading:s,error:i,filters:m,onFiltersChange:g,onRowClick:j,onRetry:b,hideTargetColumn:Z,rowsPerPageOptions:C=[25,50,100]}=e,S=Math.floor((m.offset||0)/(m.limit||50)),w=m.limit||50;return s?(0,r.jsx)(h.Z,{children:(0,r.jsx)(c.Z,{children:(0,r.jsxs)(a.Z,{children:[(0,r.jsx)(d.Z,{children:(0,r.jsxs)(u.Z,{children:[(0,r.jsx)(o.Z,{padding:"checkbox"}),(0,r.jsx)(o.Z,{children:"Timestamp"}),(0,r.jsx)(o.Z,{children:"Action"}),(0,r.jsx)(o.Z,{children:"Actor"}),!Z&&(0,r.jsx)(o.Z,{children:"Target"}),(0,r.jsx)(o.Z,{children:"Status"})]})}),(0,r.jsx)(l.Z,{children:[void 0,void 0,void 0,void 0,void 0].map((e,t)=>(0,r.jsxs)(u.Z,{children:[(0,r.jsx)(o.Z,{padding:"checkbox"}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(f.Z,{variant:"text",width:80})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(f.Z,{variant:"rounded",width:70,height:24})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(f.Z,{variant:"text",width:60})}),!Z&&(0,r.jsx)(o.Z,{children:(0,r.jsx)(f.Z,{variant:"text",width:100})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(f.Z,{variant:"rounded",width:50,height:24})})]},t))})]})})}):i?(0,r.jsx)(y.Z,{severity:"error",action:b&&(0,r.jsx)(v.Z,{color:"inherit",size:"small",onClick:b,children:"Retry"}),children:i.message||"Failed to load audit logs"}):0===t.length?(0,r.jsxs)(h.Z,{sx:{p:6,textAlign:"center"},children:[(0,r.jsx)(k.Z,{sx:{fontSize:64,color:"text.disabled",mb:2}}),(0,r.jsx)(p.Z,{variant:"h6",color:"text.secondary",gutterBottom:!0,children:"No audit logs found"}),(0,r.jsx)(p.Z,{variant:"body2",color:"text.disabled",sx:{mb:2},children:"Try adjusting your filters or check back later."}),(0,r.jsx)(v.Z,{variant:"outlined",size:"small",onClick:()=>g({limit:m.limit,sort:m.sort}),children:"Reset Filters"})]}):(0,r.jsxs)(h.Z,{children:[(0,r.jsx)(c.Z,{sx:{overflowX:"auto"},children:(0,r.jsxs)(a.Z,{size:"small",children:[(0,r.jsx)(d.Z,{children:(0,r.jsxs)(u.Z,{children:[(0,r.jsx)(o.Z,{padding:"checkbox",sx:{width:48}}),(0,r.jsx)(o.Z,{sx:{fontWeight:600,whiteSpace:"nowrap"},children:"Timestamp"}),(0,r.jsx)(o.Z,{sx:{fontWeight:600},children:"Action"}),(0,r.jsx)(o.Z,{sx:{fontWeight:600},children:"Actor"}),!Z&&(0,r.jsx)(o.Z,{sx:{fontWeight:600},children:"Target"}),(0,r.jsx)(o.Z,{sx:{fontWeight:600},children:"Status"})]})}),(0,r.jsx)(l.Z,{children:t.map(e=>(0,r.jsx)(T,{log:e,onClick:j,hideTargetColumn:Z},e.id))})]})}),(0,r.jsx)(x.Z,{component:"div",count:n,page:S,onPageChange:(e,t)=>{g({...m,offset:t*w})},rowsPerPage:w,onRowsPerPageChange:e=>{let t=parseInt(e.target.value,10);g({...m,limit:t,offset:0})},rowsPerPageOptions:C,"aria-label":"Audit log pagination"})]})}},97511:function(e,t,n){"use strict";n.d(t,{q:function(){return o},h:function(){return p}});var r=n(94655),s=n(35106),i=n(79983),a=n(10449),l=n(24559);function o(e){let{text:t,size:n=14}=e,[o,c]=(0,s.useState)(!1),d=async e=>{e.stopPropagation();try{await navigator.clipboard.writeText(t),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){}};return(0,r.jsx)(i.Z,{size:"small",onClick:d,sx:{ml:.5,p:.25,color:o?"success.main":"text.secondary","&:hover":{bgcolor:"action.hover"}},"aria-label":o?"Copied":"Copy to clipboard",children:o?(0,r.jsx)(l.Z,{sx:{fontSize:n}}):(0,r.jsx)(a.Z,{sx:{fontSize:n}})})}var c=n(7281),d=n(31317),u=n(25333),x=n(93300);function h(e){return e?e.split(",").map(e=>e.trim()).filter(Boolean):[]}function p(e){let{hostname:t,portSuffix:n,color:i="text.secondary",fontSize:a,showCopyButton:l=!1}=e,[p,m]=(0,s.useState)(null),f=h(t),y=function(e){let t=h(e);return 0===t.length?"-":t.find(e=>e.endsWith(".local"))||t[0]}(t),v=e=>n?"".concat(e,":").concat(n):e;return 0===f.length?(0,r.jsx)(c.Z,{component:"span",sx:{color:i,fontSize:a,display:"inline"},children:"-"}):1===f.length?(0,r.jsxs)(c.Z,{component:"span",sx:{display:"inline-flex",alignItems:"center"},children:[(0,r.jsx)(c.Z,{component:"span",sx:{color:i,fontSize:a,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v(y)}),l&&(0,r.jsx)(o,{text:v(y)})]}):(0,r.jsxs)(c.Z,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75,minWidth:0},children:[(0,r.jsx)(c.Z,{component:"span",sx:{color:i,fontSize:a,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v(y)}),(0,r.jsx)(u.Z,{label:"+".concat(f.length-1),size:"small",onClick:e=>{e.stopPropagation(),m(e.currentTarget)},sx:{height:20,fontSize:11,cursor:"pointer","& .MuiChip-label":{px:.75}}}),(0,r.jsx)(x.ZP,{open:!!p,anchorEl:p,onClose:()=>{m(null)},onClick:e=>e.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:(0,r.jsx)(c.Z,{sx:{p:1.5,minWidth:200},children:f.map(e=>(0,r.jsxs)(c.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:.5},children:[(0,r.jsx)(d.Z,{variant:"body2",sx:{fontSize:12},children:v(e)}),(0,r.jsx)(o,{text:v(e)})]},e))})})]})}},3454:function(e,t,n){"use strict";n.d(t,{LoadingProvider:function(){return o},startLoading:function(){return c},stopLoading:function(){return d}});var r=n(94655),s=n(35106),i=n(74228),a=n(31477),l=n.n(a);function o(e){let{children:t}=e,n=(0,i.usePathname)(),a=(0,i.useSearchParams)();return(0,s.useEffect)(()=>{l().done()},[n,a]),(0,r.jsx)(r.Fragment,{children:t})}function c(){l().start()}function d(){l().done()}l().configure({showSpinner:!1,speed:300,minimum:.1})},8690:function(e,t,n){"use strict";n.d(t,{Av:function(){return r.startLoading}});var r=n(3454)},73660:function(e,t,n){"use strict";n.d(t,{K:function(){return R}});var r=n(94655),s=n(35106),i=n(18844),a=n.n(i),l=n(7281),o=n(69899),c=n(97436),d=n(30417),u=n(90829),x=n(79983),h=n(31317),p=n(25333),m=n(40064),f=n(45547),y=n(70115),v=n(69123),g=n(93017),j=n(11141),b=n(19127),Z=n(69366),C=n(163);let S=[{label:"say",template:"say "},{label:"give",template:"give "},{label:"tp",template:"tp "},{label:"gamemode",template:"gamemode "}],w=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"}}),k=(0,s.memo)(function(e){let{log:t}=e,n=(0,s.useMemo)(()=>(function(e){let t=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 w.toHtml(t)})(t),[t]);return(0,r.jsx)(l.Z,{sx:{py:.25,whiteSpace:"pre-wrap",wordBreak:"break-all","& span":{}},dangerouslySetInnerHTML:{__html:n}})});function R(e){let{serverName:t}=e,[n,i]=(0,s.useState)(""),[a,w]=(0,s.useState)([]),[R,I]=(0,s.useState)(-1),[P,T]=(0,s.useState)("ALL"),[z,F]=(0,s.useState)(!0),[W,D]=(0,s.useState)(!0),[N,A]=(0,s.useState)(!1),O=(0,s.useRef)(null),L=(0,s.useRef)(null),{logs:M,isConnected:q,clearLogs:E,reconnect:U,retryCount:B}=(0,C.Y)({serverName:t}),K=(0,s.useMemo)(()=>{let e=M;return W&&(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},[M,P,W]);(0,s.useEffect)(()=>{z&&L.current&&(L.current.scrollTop=L.current.scrollHeight)},[K,z]);let V=(0,s.useCallback)(async()=>{let e=n.trim();if(e&&!N){A(!0);try{w(t=>[...t,e]),I(-1),await fetch("/api/servers/".concat(encodeURIComponent(t),"/exec"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})}),i("")}catch(e){console.error("Failed to execute command:",e)}finally{A(!1)}}},[n,t,N]),H=(0,s.useCallback)(e=>{if("Enter"===e.key)e.preventDefault(),V();else if("ArrowUp"===e.key){if(e.preventDefault(),0===a.length)return;let t=-1===R?a.length-1:Math.max(0,R-1);I(t),i(a[t])}else if("ArrowDown"===e.key){if(e.preventDefault(),-1===R)return;let t=R+1;t>=a.length?(I(-1),i("")):(I(t),i(a[t]))}},[a,R,V]),Q=(0,s.useCallback)(e=>{var t;i(e),null===(t=O.current)||void 0===t||t.focus()},[]),G=q?{text:"Connected",color:"success"}:B>0?{text:"Disconnected (Retry ".concat(B,")"),color:"warning"}:{text:"Disconnected",color:"error"};return(0,r.jsxs)(o.Z,{"data-testid":"server-console",sx:{display:"flex",flexDirection:"column",height:"100%",minHeight:400},children:[(0,r.jsxs)(l.Z,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",px:2,py:1,gap:1,borderBottom:1,borderColor:"divider"},children:[(0,r.jsxs)(y.Z,{direction:"row",spacing:1,alignItems:"center",children:[(0,r.jsx)(h.Z,{variant:"subtitle2",children:"Console"}),(0,r.jsx)(p.Z,{"data-testid":"connection-status",label:G.text,color:G.color,size:"small"})]}),(0,r.jsxs)(y.Z,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:[(0,r.jsx)(u.Z,{size:"small",variant:"outlined",children:["ALL","INFO","WARN","ERROR"].map(e=>(0,r.jsx)(d.Z,{onClick:()=>T(e),variant:P===e?"contained":"outlined",children:e},e))}),(0,r.jsx)(m.Z,{control:(0,r.jsx)(f.Z,{checked:z,onChange:e=>F(e.target.checked),size:"small",inputProps:{"aria-label":"Auto-scroll"}}),label:"Auto-scroll"}),(0,r.jsx)(m.Z,{control:(0,r.jsx)(f.Z,{checked:W,onChange:e=>D(e.target.checked),size:"small",inputProps:{"aria-label":"Hide RCON"}}),label:"Hide RCON"}),(0,r.jsx)(x.Z,{size:"small",onClick:E,"aria-label":"Clear logs",title:"Clear logs",children:(0,r.jsx)(b.Z,{})}),!q&&(0,r.jsx)(d.Z,{size:"small",startIcon:(0,r.jsx)(Z.Z,{}),onClick:U,"aria-label":"Reconnect",children:"Reconnect"})]})]}),(0,r.jsx)(l.Z,{ref:L,sx:{flex:1,overflow:"auto",bgcolor:"#1a1a1a",p:1,fontSize:"0.85rem"},children:0===K.length?(0,r.jsx)(h.Z,{color:"text.secondary",sx:{textAlign:"center",py:4,color:"#666"},children:"Waiting for logs..."}):K.map((e,t)=>(0,r.jsx)(k,{log:e},t))}),(0,r.jsx)(v.Z,{}),(0,r.jsx)(l.Z,{sx:{px:2,py:1,bgcolor:"background.default"},children:(0,r.jsxs)(y.Z,{direction:"row",spacing:1,children:[(0,r.jsx)(h.Z,{variant:"caption",color:"text.secondary",sx:{alignSelf:"center"},children:"Quick:"}),S.map(e=>(0,r.jsx)(d.Z,{size:"small",variant:"outlined",onClick:()=>Q(e.template),children:e.label},e.label))]})}),(0,r.jsx)(v.Z,{}),(0,r.jsxs)(l.Z,{sx:{display:"flex",p:1,gap:1},children:[(0,r.jsx)(c.Z,{inputRef:O,fullWidth:!0,size:"small",placeholder:"Enter command...",value:n,onChange:e=>i(e.target.value),onKeyDown:H,disabled:!q||N,InputProps:{}}),(0,r.jsx)(d.Z,{variant:"contained",onClick:V,disabled:!n.trim()||!q||N,startIcon:N?(0,r.jsx)(g.Z,{size:16}):(0,r.jsx)(j.Z,{}),"aria-label":"Send command",children:"Send"})]})]})}},42936:function(e,t,n){"use strict";async function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={...t.headers};t.body&&(n["Content-Type"]="application/json");let r=await fetch(e,{...t,headers:n});if(!r.ok){let e=await r.json().catch(()=>({error:"UnknownError",message:r.statusText})),t=Error(e.message);throw t.statusCode=r.status,t.code=e.error,t}return r.json()}n.d(t,{SC:function(){return r}})},31358:function(e,t,n){"use strict";n.d(t,{x:function(){return a}});var r=n(74228),s=n(35106),i=n(8690);function a(){let e=(0,r.useRouter)(),t=(0,s.useCallback)((t,n)=>{(0,i.Av)(),e.push(t,n)},[e]),n=(0,s.useCallback)((t,n)=>{(0,i.Av)(),e.replace(t,n)},[e]);return(0,s.useMemo)(()=>({...e,push:t,replace:n}),[e,t,n])}},84509:function(e,t,n){"use strict";n.d(t,{DM:function(){return a},HZ:function(){return o},VM:function(){return l},hT:function(){return i},oL:function(){return c}});var r=n(98324),s=n(42936);function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=function(e){let t=new URLSearchParams;e.action&&t.set("action",e.action),e.actor&&t.set("actor",e.actor),e.targetType&&t.set("targetType",e.targetType),e.targetName&&t.set("targetName",e.targetName),e.status&&t.set("status",e.status),e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),void 0!==e.limit&&t.set("limit",String(e.limit)),void 0!==e.offset&&t.set("offset",String(e.offset)),e.sort&&t.set("sort",e.sort);let n=t.toString();return n?"?".concat(n):""}(e);return(0,r.a)({queryKey:["audit-logs",e],queryFn:()=>(0,s.SC)("/api/audit-logs".concat(n)),enabled:(null==t?void 0:t.enabled)!==!1})}function a(e){return(0,r.a)({queryKey:["audit-logs","stats"],queryFn:()=>(0,s.SC)("/api/audit-logs/stats"),enabled:(null==e?void 0:e.enabled)!==!1,refetchInterval:3e4})}function l(e,t){return(0,r.a)({queryKey:["audit-logs",e],queryFn:()=>(0,s.SC)("/api/audit-logs/".concat(encodeURIComponent(e))),enabled:(null==t?void 0:t.enabled)!==!1&&!!e})}function o(e,t){var n;return i({targetType:"server",targetName:e,limit:null!==(n=null==t?void 0:t.limit)&&void 0!==n?n:20,...null==t?void 0:t.extraParams},{enabled:(null==t?void 0:t.enabled)!==!1&&!!e})}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return i({limit:e,sort:"timestamp:desc"})}},92666:function(e,t,n){"use strict";n.d(t,{$t:function(){return w},Aw:function(){return u},Bx:function(){return Z},CA:function(){return T},Fv:function(){return y},Hq:function(){return c},Hy:function(){return o},JV:function(){return F},Js:function(){return b},Ll:function(){return A},MH:function(){return g},S0:function(){return O},Sr:function(){return h},Yo:function(){return D},_I:function(){return x},c1:function(){return z},c5:function(){return k},d:function(){return I},g2:function(){return f},gx:function(){return j},hy:function(){return p},iC:function(){return v},jM:function(){return d},mj:function(){return S},nq:function(){return m},nv:function(){return C},ox:function(){return W},s8:function(){return R},tT:function(){return P},x$:function(){return l},zF:function(){return N}});var r=n(98324),s=n(58919),i=n(20367),a=n(42936);function l(){return(0,r.a)({queryKey:["servers"],queryFn:()=>(0,a.SC)("/api/servers"),refetchInterval:6e4})}function o(e,t){return(0,r.a)({queryKey:["servers",e],queryFn:()=>(0,a.SC)("/api/servers/".concat(encodeURIComponent(e))),enabled:(null==t?void 0:t.enabled)!==!1&&!!e,refetchInterval:3e4})}function c(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{name:t,force:n}=e;return(0,a.SC)("/api/servers/".concat(encodeURIComponent(t)).concat(n?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["servers"]})}})}function d(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,a.SC)("/api/servers/".concat(encodeURIComponent(e),"/start"),{method:"POST"}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",n]})}})}function u(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,a.SC)("/api/servers/".concat(encodeURIComponent(e),"/stop"),{method:"POST"}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",n]})}})}function x(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,a.SC)("/api/servers/".concat(encodeURIComponent(e),"/restart"),{method:"POST"}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["servers"]}),e.invalidateQueries({queryKey:["servers",n]})}})}function h(){return(0,r.a)({queryKey:["worlds"],queryFn:()=>(0,a.SC)("/api/worlds"),refetchInterval:3e4})}function p(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,a.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:t,serverName:n}=e;return(0,a.SC)("/api/worlds/".concat(encodeURIComponent(t),"/assign"),{method:"POST",body:JSON.stringify({serverName:n})})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}function f(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{worldName:t,force:n}=e;return(0,a.SC)("/api/worlds/".concat(encodeURIComponent(t),"/release").concat(n?"?force=true":""),{method:"POST"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function y(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{name:t,force:n}=e;return(0,a.SC)("/api/worlds/".concat(encodeURIComponent(t)).concat(n?"?force=true":""),{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]})}})}function v(e,t){return(0,r.a)({queryKey:["servers",e,"config"],queryFn:()=>(0,a.SC)("/api/servers/".concat(encodeURIComponent(e),"/config")),enabled:(null==t?void 0:t.enabled)!==!1&&!!e})}function g(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{serverName:t,config:n}=e;return(0,a.SC)("/api/servers/".concat(encodeURIComponent(t),"/config"),{method:"PATCH",body:JSON.stringify(n)})},onSuccess:(t,n)=>{let{serverName:r}=n;e.invalidateQueries({queryKey:["servers",r,"config"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function j(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,a.SC)("/api/servers/".concat(encodeURIComponent(e),"/world/reset"),{method:"POST"}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["servers",n]}),e.invalidateQueries({queryKey:["worlds"]})}})}function b(e,t){return(0,r.a)({queryKey:["servers",e,"hostnames"],queryFn:()=>(0,a.SC)("/api/servers/".concat(encodeURIComponent(e),"/hostnames")),enabled:(null==t?void 0:t.enabled)!==!1&&!!e})}function Z(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{serverName:t,customHostnames:n}=e;return(0,a.SC)("/api/servers/".concat(encodeURIComponent(t),"/hostnames"),{method:"PUT",body:JSON.stringify({customHostnames:n})})},onSuccess:(t,n)=>{let{serverName:r}=n;e.invalidateQueries({queryKey:["servers",r,"hostnames"]}),e.invalidateQueries({queryKey:["servers",r]})}})}function C(){return(0,r.a)({queryKey:["router-status"],queryFn:()=>(0,a.SC)("/api/router/status"),refetchInterval:3e4})}function S(){return(0,r.a)({queryKey:["backup-status"],queryFn:()=>(0,a.SC)("/api/backup"),refetchInterval:6e4})}function w(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return(0,r.a)({queryKey:["backup-history",e],queryFn:()=>(0,a.SC)("/api/backup/history?limit=".concat(e)),refetchInterval:6e4})}function k(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{message:t}=e;return(0,a.SC)("/api/backup",{method:"POST",body:JSON.stringify({message:t})})},onSuccess:()=>{e.invalidateQueries({queryKey:["backup-status"]}),e.invalidateQueries({queryKey:["backup-history"]})}})}function R(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,a.SC)("/api/backup/restore",{method:"POST",body:JSON.stringify({commitHash:e})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worlds"]}),e.invalidateQueries({queryKey:["servers"]})}})}function I(){return(0,r.a)({queryKey:["backup-schedules"],queryFn:()=>(0,a.SC)("/api/backup/schedules"),refetchInterval:6e4})}function P(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,a.SC)("/api/backup/schedules",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e.invalidateQueries({queryKey:["backup-schedules"]})}})}function T(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{id:t,data:n}=e;return(0,a.SC)("/api/backup/schedules/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify(n)})},onSuccess:()=>{e.invalidateQueries({queryKey:["backup-schedules"]})}})}function z(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{id:t,enabled:n}=e;return(0,a.SC)("/api/backup/schedules/".concat(encodeURIComponent(t),"/toggle"),{method:"PATCH",body:JSON.stringify({enabled:n})})},onSuccess:()=>{e.invalidateQueries({queryKey:["backup-schedules"]})}})}function F(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>(0,a.SC)("/api/backup/schedules/".concat(encodeURIComponent(e)),{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["backup-schedules"]})}})}function W(e){return(0,r.a)({queryKey:["servers",e,"whitelist"],queryFn:()=>(0,a.SC)("/api/players/whitelist?server=".concat(encodeURIComponent(e))),enabled:!!e})}function D(e){return(0,r.a)({queryKey:["servers",e,"whitelist-status"],queryFn:()=>(0,a.SC)("/api/players/whitelist/status?server=".concat(encodeURIComponent(e))),enabled:!!e})}function N(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{serverName:t,enabled:n}=e;return(0,a.SC)("/api/players/whitelist/status",{method:"PUT",body:JSON.stringify({server:t,enabled:n})})},onSuccess:(t,n)=>{let{serverName:r}=n;e.invalidateQueries({queryKey:["servers",r,"whitelist-status"]}),e.invalidateQueries({queryKey:["servers",r,"whitelist"]})}})}function A(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{serverName:t,player:n}=e;return(0,a.SC)("/api/players/whitelist",{method:"POST",body:JSON.stringify({server:t,player:n})})},onSuccess:(t,n)=>{let{serverName:r}=n;e.invalidateQueries({queryKey:["servers",r,"whitelist"]})}})}function O(){let e=(0,s.NL)();return(0,i.D)({mutationFn:e=>{let{serverName:t,player:n}=e;return(0,a.SC)("/api/players/whitelist?player=".concat(encodeURIComponent(n),"&server=").concat(encodeURIComponent(t)),{method:"DELETE"})},onSuccess:(t,n)=>{let{serverName:r}=n;e.invalidateQueries({queryKey:["servers",r,"whitelist"]})}})}},37228:function(e,t,n){"use strict";n.d(t,{Bc:function(){return o},N$:function(){return c},UW:function(){return l}});var r=n(98324),s=n(58919),i=n(20367),a=n(42936);function l(){return(0,r.a)({queryKey:["playit-status"],queryFn:()=>(0,a.SC)("/api/playit/status"),refetchInterval:3e4})}function o(){let e=(0,s.NL)();return(0,i.D)({mutationFn:()=>(0,a.SC)("/api/playit/start",{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["playit-status"]})}})}function c(){let e=(0,s.NL)();return(0,i.D)({mutationFn:()=>(0,a.SC)("/api/playit/stop",{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["playit-status"]})}})}},93757:function(e,t,n){"use strict";n.d(t,{D:function(){return i}});var r=n(35106);class s{connect(e){this.options=e,this.shouldReconnect=!0,this.establishConnection()}establishConnection(){this.options&&(this.updateState("connecting"),this.eventSource&&this.eventSource.close(),this.eventSource=new EventSource(this.options.url,{withCredentials:this.options.withCredentials||!1}),this.eventSource.onopen=()=>{this.updateState("connected"),this.retryCount=0,this.lastError=null},this.eventSource.onmessage=e=>{if(!e.data.startsWith(":"))try{var t,n;let r=JSON.parse(e.data);null===(n=this.options)||void 0===n||null===(t=n.onMessage)||void 0===t||t.call(n,r)}catch(e){console.warn("Failed to parse SSE message:",e)}},this.eventSource.onerror=()=>{var e,t;let n={message:"SSE connection error",code:"CONNECTION_ERROR",retryCount:this.retryCount,timestamp:new Date};this.lastError=n,this.updateState("error"),null===(t=this.options)||void 0===t||null===(e=t.onError)||void 0===e||e.call(t,n),this.shouldReconnect&&this.scheduleReconnect()})}scheduleReconnect(){var e,t;if(!this.options)return;let n=null!==(e=this.options.maxReconnectAttempts)&&void 0!==e?e:1/0;if(this.retryCount>=n)return;this.reconnectTimer&&clearTimeout(this.reconnectTimer);let r=null!==(t=this.options.reconnectInterval)&&void 0!==t?t:3e3;this.reconnectTimer=setTimeout(()=>{this.retryCount++,this.establishConnection()},r)}disconnect(){this.shouldReconnect=!1,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.updateState("disconnected")}getState(){return this.state}isConnected(){return"connected"===this.state}getLastError(){return this.lastError}getRetryCount(){return this.retryCount}reconnect(){this.retryCount++,this.shouldReconnect=!0,this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.establishConnection()}updateState(e){var t,n;this.state=e,null===(n=this.options)||void 0===n||null===(t=n.onStateChange)||void 0===t||t.call(n,e)}constructor(){this.eventSource=null,this.state="disconnected",this.retryCount=0,this.lastError=null,this.reconnectTimer=null,this.options=null,this.shouldReconnect=!0}}function i(e){let{url:t,onMessage:n,onError:i,reconnectInterval:a=3e3,maxReconnectAttempts:l=1/0,enabled:o=!0,withCredentials:c=!1}=e,[d,u]=(0,r.useState)(null),[x,h]=(0,r.useState)("disconnected"),[p,m]=(0,r.useState)(null),[f,y]=(0,r.useState)(0),v=(0,r.useRef)(null),g=(0,r.useCallback)(e=>{u(e),null==n||n(e)},[n]),j=(0,r.useCallback)(e=>{h(e),"connected"===e&&y(0)},[]),b=(0,r.useCallback)(e=>{m(e),"number"==typeof e.retryCount&&y(e.retryCount),null==i||i(e)},[i]),Z=(0,r.useCallback)(()=>{v.current&&(v.current.reconnect(),y(v.current.getRetryCount()))},[]),C=(0,r.useCallback)(()=>{v.current&&v.current.disconnect()},[]);return(0,r.useEffect)(()=>{if(!o){v.current&&(v.current.disconnect(),v.current=null);return}return v.current||(v.current=new s),v.current.connect({url:t,onMessage:g,onStateChange:j,onError:b,reconnectInterval:a,maxReconnectAttempts:l,withCredentials:c}),()=>{v.current&&(v.current.disconnect(),v.current=null)}},[t,o,a,l,c,g,j,b]),{data:d,isConnected:"connected"===x,state:x,error:p,retryCount:f,reconnect:Z,disconnect:C}}},163:function(e,t,n){"use strict";n.d(t,{Y:function(){return i}});var r=n(35106),s=n(93757);function i(e){let{serverName:t,maxLines:n=500,enabled:i=!0,reconnectInterval:a=3e3}=e,[l,o]=(0,r.useState)([]);(0,r.useEffect)(()=>{o([])},[t]);let c=(0,r.useCallback)(e=>{let t;"server-log"===e.type?t=e.data.log:"log"in e&&"string"==typeof e.log&&(t=e.log),t&&o(e=>{let r=[...e,t];return r.length>n?r.slice(r.length-n):r})},[n]),{isConnected:d,reconnect:u,retryCount:x}=(0,s.D)({url:"/api/sse/servers/".concat(encodeURIComponent(t),"/logs"),onMessage:c,enabled:i,reconnectInterval:a});return{logs:l,isConnected:d,clearLogs:(0,r.useCallback)(()=>{o([])},[]),reconnect:u,retryCount:x}}},82925:function(e,t,n){"use strict";n.d(t,{KK:function(){return l},Lu:function(){return r},Xn:function(){return a},n3:function(){return s},xg:function(){return i}});let r={"server.create":"success","server.delete":"error","server.start":"info","server.stop":"warning","server.restart":"secondary","player.whitelist.add":"success","player.whitelist.remove":"warning","player.ban":"error","player.unban":"success","player.op":"info","player.deop":"warning","player.kick":"error","audit.purge":"default"},s={"server.create":"Create","server.delete":"Delete","server.start":"Start","server.stop":"Stop","server.restart":"Restart","player.whitelist.add":"Whitelist Add","player.whitelist.remove":"Whitelist Remove","player.ban":"Ban","player.unban":"Unban","player.op":"Op","player.deop":"Deop","player.kick":"Kick","audit.purge":"Purge"},i=["server.create","server.delete","server.start","server.stop","server.restart","player.whitelist.add","player.whitelist.remove","player.ban","player.unban","player.op","player.deop","player.kick","audit.purge"],a=["server.create","server.delete","server.start","server.stop","server.restart"],l=["player.whitelist.add","player.whitelist.remove","player.ban","player.unban","player.op","player.deop","player.kick"]}},function(e){e.O(0,[8206,6812,9760,5004,7296,7436,1071,540,9986,2538,5511,3938,55,2844,4219,4920,8347,4302,4841,4848,1658,6727,7195,3724,9443,6831,5498,3669,2757,1744],function(){return e(e.s=59616)}),_N_E=e.O()}]);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft-docker/mcctl-console",
3
- "version": "2.18.0",
3
+ "version": "2.20.0",
4
4
  "description": "Web management console for Docker Minecraft servers",
5
5
  "bin": {
6
6
  "mcctl-console": "bin/start.js"