@minecraft-docker/mcctl-console 2.4.1 → 2.5.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 (64) 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 +45 -45
  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/api/players/route.js +1 -1
  23. package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.html +1 -1
  24. package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.rsc +1 -1
  25. package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.html +1 -1
  26. package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.rsc +1 -1
  27. package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.html +1 -1
  28. package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.rsc +1 -1
  29. package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.html +1 -1
  30. package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.rsc +1 -1
  31. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login/page_client-reference-manifest.js +1 -1
  32. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.html +1 -1
  33. package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.rsc +1 -1
  34. package/.next/standalone/platform/services/mcctl-console/.next/server/app/page_client-reference-manifest.js +1 -1
  35. package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.html +1 -1
  36. package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.rsc +1 -1
  37. package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.html +1 -1
  38. package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.rsc +1 -1
  39. package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.html +1 -1
  40. package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.rsc +1 -1
  41. package/.next/standalone/platform/services/mcctl-console/.next/server/app/settings.html +1 -1
  42. package/.next/standalone/platform/services/mcctl-console/.next/server/app/settings.rsc +1 -1
  43. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup/page_client-reference-manifest.js +1 -1
  44. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.html +1 -1
  45. package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.rsc +1 -1
  46. package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.html +1 -1
  47. package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.rsc +1 -1
  48. package/.next/standalone/platform/services/mcctl-console/.next/server/app-paths-manifest.json +20 -20
  49. package/.next/standalone/platform/services/mcctl-console/.next/server/middleware-manifest.json +5 -5
  50. package/.next/standalone/platform/services/mcctl-console/.next/server/next-font-manifest.js +1 -1
  51. package/.next/standalone/platform/services/mcctl-console/.next/server/next-font-manifest.json +1 -1
  52. package/.next/standalone/platform/services/mcctl-console/.next/server/pages/404.html +1 -1
  53. package/.next/standalone/platform/services/mcctl-console/.next/server/pages/500.html +1 -1
  54. package/.next/standalone/platform/services/mcctl-console/.next/server/server-reference-manifest.json +1 -1
  55. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/page-b5a8d2d603b92812.js +1 -0
  56. package/.next/standalone/platform/services/mcctl-console/package.json +1 -1
  57. package/.next/static/chunks/app/(main)/servers/[name]/page-b5a8d2d603b92812.js +1 -0
  58. package/package.json +2 -2
  59. package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/page-c4822f1e941923cd.js +0 -1
  60. package/.next/static/chunks/app/(main)/servers/[name]/page-c4822f1e941923cd.js +0 -1
  61. /package/.next/standalone/platform/services/mcctl-console/.next/static/{410QNMogV71xOxsRe568N → UT1hqjjvqYlP0_6fAgVvi}/_buildManifest.js +0 -0
  62. /package/.next/standalone/platform/services/mcctl-console/.next/static/{410QNMogV71xOxsRe568N → UT1hqjjvqYlP0_6fAgVvi}/_ssgManifest.js +0 -0
  63. /package/.next/static/{410QNMogV71xOxsRe568N → UT1hqjjvqYlP0_6fAgVvi}/_buildManifest.js +0 -0
  64. /package/.next/static/{410QNMogV71xOxsRe568N → UT1hqjjvqYlP0_6fAgVvi}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[278],{59616:function(e,r,s){Promise.resolve().then(s.bind(s,55816))},55816:function(e,r,s){"use strict";s.r(r),s.d(r,{default:function(){return e6}});var t=s(94655),n=s(35106),i=s(74228),a=s(31358),o=s(7281),l=s(30417),d=s(79983),c=s(81071),x=s(93017),u=s(10721),h=s(628),m=s(41565),p=s(31317),j=s(35694),v=s(7178),g=s(17820),Z=s(73424),y=s(99770),f=s(62508),b=s(5682),C=s(76678),w=s(97436),S=s(84840),k=s(76492),I=s(10117),R=s(5501),z=s(37809),P=s(21111),W=s(17978),F=s(89573),T=s(96292),A=s(33104),D=s(25333),M=s(52082),O=s(69123),E=s(71185),N=s(30165),B=s(97293),U=s(11259),q=s(66615),L=s(89161),K=s(34071),H=s(4405);function G(e){let{value:r,unit:s,label:n,icon:i,progress:a,progressMax:l,color:d="#1bd96a"}=e;return(0,t.jsxs)(h.Z,{"data-testid":"resource-stat-card",sx:{p:2.5,bgcolor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:3},children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:2},children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"baseline",gap:.75,flexWrap:"wrap",minWidth:0},children:[(0,t.jsx)(p.Z,{variant:"h4",component:"span",sx:{fontWeight:700,color:"text.primary",fontFamily:"'JetBrains Mono', 'Fira Code', monospace",letterSpacing:"-0.5px"},children:r}),(0,t.jsx)(p.Z,{variant:"body2",component:"span",sx:{color:"text.secondary",fontWeight:500},children:s})]}),(0,t.jsx)(o.Z,{sx:{color:"text.secondary",flexShrink:0},children:i})]}),(0,t.jsx)(p.Z,{variant:"body2",sx:{color:"text.secondary",fontWeight:500,mt:.5},children:n}),(0,t.jsx)(H.Z,{variant:"determinate",value:Math.min(a/l*100,100),sx:{mt:1,height:6,borderRadius:1.5,bgcolor:"#2a2d3a","& .MuiLinearProgress-bar":{borderRadius:1.5,background:"linear-gradient(90deg, ".concat(d," 0%, ").concat(d,"cc 100%)")}}})]})}var Q=s(163),V=s(73660),J=s(90158),_=s(58347),$=s(95511),Y=s(46725),X=s(26577),ee=s(56813),er=s(26892),es=s(84509);function et(e){var r;let{serverName:s}=e,{data:n,isLoading:i,error:a}=(0,es.HZ)(s,{limit:20});if(i)return(0,t.jsx)(o.Z,{children:[void 0,void 0,void 0,void 0,void 0].map((e,r)=>(0,t.jsxs)(o.Z,{sx:{display:"flex",gap:2,py:1.5},children:[(0,t.jsx)(u.Z,{variant:"rounded",width:60,height:24}),(0,t.jsx)(u.Z,{variant:"text",width:"60%"}),(0,t.jsx)(u.Z,{variant:"text",width:50})]},r))});if(a)return(0,t.jsxs)(c.Z,{severity:"error",children:["Failed to load activity: ",a.message]});let d=null!==(r=null==n?void 0:n.logs)&&void 0!==r?r:[];if(0===d.length)return(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{py:4,textAlign:"center"},children:"No activity recorded for this server yet."});let x="/audit-logs?targetType=server&targetName=".concat(encodeURIComponent(s));return(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(J.Z,{sx:{py:0},children:d.map(e=>{var r;return(0,t.jsx)(_.ZP,{sx:{px:0,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:(0,t.jsx)(Z.Z,{primary:(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,t.jsx)(ee.I,{action:e.action,size:"small"}),(0,t.jsxs)(p.Z,{variant:"body2",color:"text.secondary",children:["by ",e.actor.replace("api:","").replace("cli:","")]}),(0,t.jsx)(er.c,{status:e.status,size:"small"})]}),secondary:(0,t.jsx)($.Z,{title:(r=e.timestamp,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"}).format(new Date(r))),arrow:!0,children:(0,t.jsx)(p.Z,{variant:"caption",component:"span",color:"text.disabled",children:function(e){let r=new Date,s=new Date(e),t=Math.floor((r.getTime()-s.getTime())/6e4),n=Math.floor(t/60);return t<1?"just now":t<60?"".concat(t,"m ago"):n<24?"".concat(n,"h ago"):"".concat(Math.floor(n/24),"d ago")}(e.timestamp)})})})},e.id)})}),(0,t.jsx)(o.Z,{sx:{mt:2,textAlign:"center"},children:(0,t.jsx)(l.Z,{component:Y.default,href:x,size:"small",endIcon:(0,t.jsx)(X.Z,{}),sx:{textTransform:"none"},children:"View Full History"})})]})}var en=s(62328),ei=s(29793),ea=s(75726),eo=s(40064),el=s(38393),ed=s(37530),ec=s(5942),ex=s(84420),eu=s(46121),eh=s(84775),em=s(92666),ep=s(70115),ej=s(70603),ev=s(32366),eg=s(25523);function eZ(e){let{serverName:r}=e,{data:s,isLoading:i}=(0,em.Js)(r),a=(0,em.Bx)(),[u,j]=(0,n.useState)([]),[v,g]=(0,n.useState)(!1),[Z,y]=(0,n.useState)(!1),[f,b]=(0,n.useState)(""),[C,S]=(0,n.useState)(""),[k,I]=(0,n.useState)(!1),[R,z]=(0,n.useState)({open:!1,message:"",severity:"success"});(0,n.useEffect)(()=>{(null==s?void 0:s.customHostnames)&&(j(s.customHostnames),g(!1),I(!1))},[s]);let W=e=>{let r=e.trim().toLowerCase();return r?r.length>253?"Domain exceeds 253 characters":/^[a-z0-9]([a-z0-9\-.]*[a-z0-9])?$/.test(r)?r.endsWith(".local")?"Cannot use .local system domain":r.endsWith(".nip.io")?"Cannot use .nip.io system domain":u.includes(r)?"Domain already exists":"":"Invalid domain format":"Domain cannot be empty"},F=()=>{let e=f.trim().toLowerCase(),r=W(e);if(r){S(r);return}j(r=>[...r,e]),b(""),S(""),y(!1),g(!0)},T=e=>{j(r=>r.filter(r=>r!==e)),g(!0)},A=async()=>{try{await a.mutateAsync({serverName:r,customHostnames:u}),g(!1),I(!0),z({open:!0,message:"Hostnames saved. Container recreation required to apply changes.",severity:"warning"})}catch(e){z({open:!0,message:e instanceof Error?e.message:"Failed to save hostnames",severity:"error"})}},M=()=>{y(!1),b(""),S("")};return i?(0,t.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,t.jsx)(m.Z,{children:(0,t.jsx)(o.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,t.jsx)(x.Z,{size:24})})})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:1},children:[(0,t.jsx)(eg.Z,{color:"primary"}),(0,t.jsx)(p.Z,{variant:"h6",fontWeight:600,children:"Hostnames / Domains"})]}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Manage hostnames used by mc-router to route connections to this server."}),(0,t.jsx)(O.Z,{sx:{mb:3}}),(null==s?void 0:s.systemHostnames)&&s.systemHostnames.length>0&&(0,t.jsxs)(o.Z,{sx:{mb:3},children:[(0,t.jsx)(p.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1},children:"System Hostnames (read-only)"}),(0,t.jsx)(ep.Z,{direction:"row",flexWrap:"wrap",gap:1,children:s.systemHostnames.map(e=>(0,t.jsx)(D.Z,{icon:(0,t.jsx)(ej.Z,{sx:{fontSize:16}}),label:e.hostname,title:e.description,variant:"outlined",color:"default",size:"small"},e.hostname))})]}),(0,t.jsxs)(o.Z,{sx:{mb:2},children:[(0,t.jsx)(p.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1},children:"Custom Domains"}),0===u.length&&!Z&&(0,t.jsx)(p.Z,{variant:"body2",color:"text.disabled",sx:{mb:1},children:"No custom domains configured."}),(0,t.jsx)(ep.Z,{spacing:1,children:u.map(e=>(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:.5,px:1.5,borderRadius:1,bgcolor:"action.hover"},children:[(0,t.jsx)(p.Z,{variant:"body2",fontFamily:"monospace",children:e}),(0,t.jsx)(d.Z,{size:"small",color:"error",onClick:()=>T(e),title:"Remove domain",children:(0,t.jsx)(P.Z,{fontSize:"small"})})]},e))}),Z?(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"flex-start",gap:1,mt:1},children:[(0,t.jsx)(w.Z,{size:"small",placeholder:"e.g. play.example.com",value:f,onChange:e=>{b(e.target.value),S("")},onKeyDown:e=>{"Enter"===e.key&&F(),"Escape"===e.key&&M()},error:!!C,helperText:C,autoFocus:!0,sx:{flex:1}}),(0,t.jsx)(l.Z,{size:"small",variant:"contained",onClick:F,children:"Add"}),(0,t.jsx)(d.Z,{size:"small",onClick:M,children:(0,t.jsx)(E.Z,{fontSize:"small"})})]}):(0,t.jsx)(l.Z,{size:"small",startIcon:(0,t.jsx)(ev.Z,{}),onClick:()=>y(!0),sx:{mt:1},children:"Add Domain"})]}),k&&(0,t.jsxs)(c.Z,{severity:"warning",sx:{mb:2},children:["Container recreation is required for hostname changes to take effect. Run ",(0,t.jsx)("code",{children:"docker compose up -d"})," or restart the server from the dashboard."]}),(0,t.jsx)(o.Z,{sx:{display:"flex",justifyContent:"flex-end"},children:(0,t.jsx)(l.Z,{variant:"contained",size:"small",startIcon:(0,t.jsx)(ec.Z,{}),onClick:A,disabled:!v||a.isPending,children:a.isPending?"Saving...":"Save Hostnames"})})]})}),(0,t.jsx)(ed.Z,{open:R.open,autoHideDuration:6e3,onClose:()=>z({...R,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,t.jsx)(c.Z,{onClose:()=>z({...R,open:!1}),severity:R.severity,sx:{width:"100%"},children:R.message})})]})}function ey(e){var r,s;let{serverName:i,isRunning:a}=e,{data:d,isLoading:u}=(0,em.iC)(i),j=(0,em.MH)(),g=(0,em.gx)(),[Z,k]=(0,n.useState)({}),[I,R]=(0,n.useState)(!1),[z,P]=(0,n.useState)(!1),[W,F]=(0,n.useState)(!1),[T,A]=(0,n.useState)(""),[D,M]=(0,n.useState)({open:!1,message:"",severity:"info"});(0,n.useEffect)(()=>{(null==d?void 0:d.config)&&k(d.config)},[d]);let E=(e,r)=>{k(s=>({...s,[e]:r})),R(!0),("memory"===e||"useAikarFlags"===e)&&P(!0)},N=async()=>{try{let e=await j.mutateAsync({serverName:i,config:Z});M({open:!0,message:e.restartRequired?"Settings saved. Restart required for some changes to take effect.":"Settings saved successfully.",severity:e.restartRequired?"warning":"success"}),R(!1),P(!1)}catch(e){M({open:!0,message:e instanceof Error?e.message:"Failed to save settings",severity:"error"})}},B=async()=>{if("RESET"!==T){M({open:!0,message:"Please type RESET to confirm",severity:"warning"});return}try{await g.mutateAsync(i),M({open:!0,message:"World reset successfully",severity:"success"}),F(!1),A("")}catch(e){M({open:!0,message:e instanceof Error?e.message:"Failed to reset world",severity:"error"})}};return u?(0,t.jsx)(o.Z,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,t.jsx)(x.Z,{})}):(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(eZ,{serverName:i}),z&&(0,t.jsx)(c.Z,{severity:"warning",icon:(0,t.jsx)(ex.Z,{}),sx:{mb:3},children:"Performance settings require a server restart to take effect."}),(0,t.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Properties"}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"These settings can be changed without restarting the server."}),(0,t.jsx)(O.Z,{sx:{mb:3}}),(0,t.jsxs)(S.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(S.ZP,{item:!0,xs:12,children:(0,t.jsx)(w.Z,{fullWidth:!0,label:"MOTD (Message of the Day)",value:Z.motd||"",onChange:e=>E("motd",e.target.value),helperText:"The message displayed in the server list"})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(w.Z,{fullWidth:!0,type:"number",label:"Max Players",value:Z.maxPlayers||20,onChange:e=>E("maxPlayers",parseInt(e.target.value,10)),inputProps:{min:1,max:100}})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsxs)(ei.Z,{fullWidth:!0,children:[(0,t.jsx)(ea.Z,{children:"Difficulty"}),(0,t.jsxs)(en.Z,{value:Z.difficulty||"normal",label:"Difficulty",onChange:e=>E("difficulty",e.target.value),children:[(0,t.jsx)(v.Z,{value:"peaceful",children:"Peaceful"}),(0,t.jsx)(v.Z,{value:"easy",children:"Easy"}),(0,t.jsx)(v.Z,{value:"normal",children:"Normal"}),(0,t.jsx)(v.Z,{value:"hard",children:"Hard"})]})]})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsxs)(ei.Z,{fullWidth:!0,children:[(0,t.jsx)(ea.Z,{children:"Game Mode"}),(0,t.jsxs)(en.Z,{value:Z.gameMode||"survival",label:"Game Mode",onChange:e=>E("gameMode",e.target.value),children:[(0,t.jsx)(v.Z,{value:"survival",children:"Survival"}),(0,t.jsx)(v.Z,{value:"creative",children:"Creative"}),(0,t.jsx)(v.Z,{value:"adventure",children:"Adventure"}),(0,t.jsx)(v.Z,{value:"spectator",children:"Spectator"})]})]})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(eo.Z,{control:(0,t.jsx)(el.Z,{checked:null===(r=Z.pvp)||void 0===r||r,onChange:e=>E("pvp",e.target.checked)}),label:"Enable PvP"})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(w.Z,{fullWidth:!0,type:"number",label:"View Distance (chunks)",value:Z.viewDistance||10,onChange:e=>E("viewDistance",parseInt(e.target.value,10)),inputProps:{min:3,max:32}})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(w.Z,{fullWidth:!0,type:"number",label:"Spawn Protection (blocks)",value:Z.spawnProtection||16,onChange:e=>E("spawnProtection",parseInt(e.target.value,10)),inputProps:{min:0,max:128}})})]})]})}),(0,t.jsx)(h.Z,{sx:{mb:3,borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Performance Settings"}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"These settings require a server restart to take effect."}),(0,t.jsx)(O.Z,{sx:{mb:3}}),(0,t.jsxs)(S.ZP,{container:!0,spacing:3,children:[(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(w.Z,{fullWidth:!0,label:"Memory Allocation",value:Z.memory||"4G",onChange:e=>E("memory",e.target.value),helperText:"Format: 4G, 8G, etc."})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,sm:6,children:(0,t.jsx)(eo.Z,{control:(0,t.jsx)(el.Z,{checked:null!==(s=Z.useAikarFlags)&&void 0!==s&&s,onChange:e=>E("useAikarFlags",e.target.checked)}),label:"Use Aikar's Flags (Optimized GC)"})})]})]})}),(0,t.jsx)(o.Z,{sx:{display:"flex",justifyContent:"flex-end",mb:3},children:(0,t.jsx)(l.Z,{variant:"contained",size:"large",startIcon:(0,t.jsx)(ec.Z,{}),onClick:N,disabled:!I||j.isPending,sx:{px:4},children:j.isPending?"Saving...":"Save Changes"})}),(0,t.jsx)(h.Z,{sx:{borderRadius:3,borderColor:"error.main",borderWidth:1,borderStyle:"solid"},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,color:"error",children:"Danger Zone"}),(0,t.jsx)(O.Z,{sx:{mb:3}}),(0,t.jsxs)(o.Z,{sx:{mb:3},children:[(0,t.jsx)(p.Z,{variant:"subtitle1",fontWeight:600,gutterBottom:!0,children:"Reset World"}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"This will permanently delete the current world and generate a new one. This action cannot be undone."}),(0,t.jsx)(l.Z,{variant:"outlined",color:"error",startIcon:(0,t.jsx)(eh.Z,{}),onClick:()=>F(!0),disabled:a,children:"Reset World"}),a&&(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",sx:{ml:2},children:"Stop the server first"})]})]})}),(0,t.jsxs)(y.Z,{open:W,onClose:()=>F(!1),maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(f.Z,{children:(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,t.jsx)(ex.Z,{color:"error"}),(0,t.jsx)(p.Z,{variant:"h6",fontWeight:600,children:"Reset World"})]})}),(0,t.jsxs)(b.Z,{children:[(0,t.jsxs)(p.Z,{variant:"body1",gutterBottom:!0,children:["This will permanently delete the world for ",(0,t.jsx)("strong",{children:i})," and generate a new one."]}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",gutterBottom:!0,children:"This action cannot be undone. All player progress and builds will be lost."}),(0,t.jsx)(w.Z,{fullWidth:!0,label:"Type RESET to confirm",value:T,onChange:e=>A(e.target.value),sx:{mt:3},autoFocus:!0})]}),(0,t.jsxs)(C.Z,{children:[(0,t.jsx)(l.Z,{onClick:()=>F(!1),children:"Cancel"}),(0,t.jsx)(l.Z,{variant:"contained",color:"error",onClick:B,disabled:"RESET"!==T||g.isPending,startIcon:g.isPending?(0,t.jsx)(x.Z,{size:16}):(0,t.jsx)(eu.Z,{}),children:g.isPending?"Resetting...":"Reset World"})]})]}),(0,t.jsx)(ed.Z,{open:D.open,autoHideDuration:6e3,onClose:()=>M({...D,open:!1}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:(0,t.jsx)(c.Z,{onClose:()=>M({...D,open:!1}),severity:D.severity,sx:{width:"100%"},children:D.message})})]})}var ef=s(86702),eb=s(47606),eC=s(407),ew=s(56056),eS=s(28058),ek=s(11597),eI=s(59602);let eR={admin:{label:"Owner",color:"primary",variant:"filled"},manage:{label:"Operator",color:"info",variant:"outlined"},view:{label:"Viewer",color:"default",variant:"outlined"}};function ez(e){let{permission:r,size:s="medium"}=e,n=eR[r];return(0,t.jsx)(D.Z,{label:n.label,color:n.color,variant:n.variant,size:s})}var eP=s(99046),eW=s(68038),eF=s(34080),eT=s(39181),eA=s(5632),eD=s(58919),eM=s(20367),eO=s(42936);function eE(e){var r,s;let{open:i,onClose:a,serverId:d}=e,[u,h]=(0,n.useState)(""),[m,j]=(0,n.useState)(null),[v,g]=(0,n.useState)("view"),{data:Z,isLoading:S}=(s={enabled:i},(0,eA.a)({queryKey:["users","search",u],queryFn:()=>(0,eO.SC)("/api/users?q=".concat(encodeURIComponent(u))),enabled:(null==s?void 0:s.enabled)!==!1&&u.length>=2,staleTime:3e4})),k=function(){let e=(0,eD.NL)();return(0,eM.D)({mutationFn:e=>(0,eO.SC)("/api/user-servers",{method:"POST",body:JSON.stringify(e)}),onSuccess:(r,s)=>{e.invalidateQueries({queryKey:["user-servers",s.serverId]}),e.invalidateQueries({queryKey:["user-servers"]})}})}(),I=(0,n.useMemo)(()=>{var e;return null!==(e=null==Z?void 0:Z.users)&&void 0!==e?e:[]},[Z]),R=()=>{h(""),j(null),g("view"),k.reset(),a()};return(0,t.jsxs)(y.Z,{open:i,onClose:R,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:3}},children:[(0,t.jsx)(f.Z,{sx:{fontWeight:600},children:"Add User Access"}),(0,t.jsxs)(b.Z,{sx:{display:"flex",flexDirection:"column",gap:3,pt:"8px !important"},children:[k.isError&&(0,t.jsx)(c.Z,{severity:"error",sx:{mb:1},children:(null===(r=k.error)||void 0===r?void 0:r.message)||"Failed to grant access"}),(0,t.jsx)(eP.Z,{options:I,getOptionLabel:e=>e.name||e.email,isOptionEqualToValue:(e,r)=>e.id===r.id,value:m,onChange:(e,r)=>j(r),inputValue:u,onInputChange:(e,r)=>h(r),loading:S,filterOptions:e=>e,noOptionsText:u.length<2?"Type at least 2 characters":"No users found",renderInput:e=>(0,t.jsx)(w.Z,{...e,label:"Search User",placeholder:"Search by name or email...",InputProps:{...e.InputProps,endAdornment:(0,t.jsxs)(t.Fragment,{children:[S&&(0,t.jsx)(x.Z,{size:20}),e.InputProps.endAdornment]})}}),renderOption:(e,r)=>{var s,n,i;let{key:a,...l}=e;return(0,t.jsxs)(o.Z,{component:"li",...l,sx:{display:"flex",gap:1.5,py:1},children:[(0,t.jsx)(ef.Z,{src:null!==(i=r.image)&&void 0!==i?i:void 0,sx:{width:32,height:32,bgcolor:"primary.main",fontSize:14},children:((null===(s=r.name)||void 0===s?void 0:s[0])||(null===(n=r.email)||void 0===n?void 0:n[0])||"?").toUpperCase()}),(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,children:r.name||"Unknown"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",children:r.email})]})]},a)}}),(0,t.jsxs)(ei.Z,{children:[(0,t.jsx)(eW.Z,{sx:{fontWeight:500,mb:1},children:"Permission Level"}),(0,t.jsxs)(eF.Z,{value:v,onChange:e=>g(e.target.value),children:[(0,t.jsx)(eo.Z,{value:"view",control:(0,t.jsx)(eT.Z,{size:"small"}),label:(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,children:"Viewer"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",children:"Can view server status and logs"})]})}),(0,t.jsx)(eo.Z,{value:"manage",control:(0,t.jsx)(eT.Z,{size:"small"}),label:(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,children:"Operator"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",children:"Can start, stop, and configure the server"})]})}),(0,t.jsx)(eo.Z,{value:"admin",control:(0,t.jsx)(eT.Z,{size:"small"}),label:(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,children:"Owner"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",children:"Full control including managing other users"})]})})]})]})]}),(0,t.jsxs)(C.Z,{sx:{px:3,pb:2},children:[(0,t.jsx)(l.Z,{onClick:R,color:"inherit",children:"Cancel"}),(0,t.jsx)(l.Z,{onClick:()=>{m&&k.mutate({userId:m.id,serverId:d,permission:v},{onSuccess:R})},variant:"contained",disabled:!m||k.isPending,sx:{borderRadius:2},children:k.isPending?"Adding...":"Add User"})]})]})}function eN(e){var r,s;let{serverId:i}=e,{data:a,isLoading:x,error:y}=(0,eA.a)({queryKey:["user-servers",i],queryFn:()=>(0,eO.SC)("/api/user-servers?serverId=".concat(encodeURIComponent(i))),enabled:!!i}),f=function(){let e=(0,eD.NL)();return(0,eM.D)({mutationFn:e=>{let{id:r,permission:s}=e;return(0,eO.SC)("/api/user-servers/".concat(encodeURIComponent(r)),{method:"PATCH",body:JSON.stringify({permission:s})})},onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),b=function(){let e=(0,eD.NL)();return(0,eM.D)({mutationFn:e=>(0,eO.SC)("/api/user-servers/".concat(encodeURIComponent(e)),{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["user-servers"]})}})}(),[C,w]=(0,n.useState)(!1),[S,k]=(0,n.useState)(null),[I,R]=(0,n.useState)(null),P=(e,r)=>{k(e.currentTarget),R(r)},W=()=>{k(null),R(null)},F=e=>{if(!I||I.permission===e){W();return}f.mutate({id:I.id,permission:e},{onSettled:W})},T=null!==(r=null==a?void 0:a.users.filter(e=>"admin"===e.permission).length)&&void 0!==r?r:0,A=(null==I?void 0:I.permission)==="admin"&&T<=1;if(x)return(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(u.Z,{variant:"text",width:"30%",height:32}),(0,t.jsx)(u.Z,{variant:"rounded",width:120,height:36,sx:{borderRadius:2}})]}),(0,t.jsx)(O.Z,{sx:{mb:2}}),[0,1,2].map(e=>(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,borderBottom:"1px solid",borderColor:"divider"},children:[(0,t.jsx)(u.Z,{variant:"circular",width:40,height:40}),(0,t.jsxs)(o.Z,{sx:{flex:1},children:[(0,t.jsx)(u.Z,{variant:"text",width:"40%"}),(0,t.jsx)(u.Z,{variant:"text",width:"60%"})]}),(0,t.jsx)(u.Z,{variant:"rounded",width:80,height:28,sx:{borderRadius:10}}),(0,t.jsx)(u.Z,{variant:"circular",width:32,height:32})]},e))]})});if(y)return(0,t.jsxs)(c.Z,{severity:"error",children:["Failed to load access list: ",y.message]});let D=null!==(s=null==a?void 0:a.users)&&void 0!==s?s:[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(p.Z,{variant:"h6",fontWeight:600,children:"Server Access"}),(0,t.jsx)(l.Z,{variant:"contained",size:"small",startIcon:(0,t.jsx)(eb.Z,{}),onClick:()=>w(!0),sx:{borderRadius:2},children:"Add User"})]}),(0,t.jsx)(O.Z,{sx:{mb:1}}),0===D.length?(0,t.jsx)(o.Z,{sx:{py:4,textAlign:"center"},children:(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",children:"No users have been granted access to this server yet."})}):D.map(e=>{var r,s,n,i,a,l,c,x;return(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:2,py:1.5,"&:not(:last-child)":{borderBottom:"1px solid",borderColor:"divider"}},children:[(0,t.jsx)(ef.Z,{src:null!==(x=null===(r=e.user)||void 0===r?void 0:r.image)&&void 0!==x?x:void 0,sx:{width:40,height:40,bgcolor:"primary.main",fontSize:16},children:((null===(n=e.user)||void 0===n?void 0:null===(s=n.name)||void 0===s?void 0:s[0])||(null===(a=e.user)||void 0===a?void 0:null===(i=a.email)||void 0===i?void 0:i[0])||"?").toUpperCase()}),(0,t.jsxs)(o.Z,{sx:{flex:1,minWidth:0},children:[(0,t.jsx)(p.Z,{variant:"body2",fontWeight:500,noWrap:!0,children:(null===(l=e.user)||void 0===l?void 0:l.name)||"Unknown User"}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.secondary",noWrap:!0,children:(null===(c=e.user)||void 0===c?void 0:c.email)||e.userId})]}),(0,t.jsx)(ez,{permission:e.permission,size:"small"}),(0,t.jsx)(d.Z,{size:"small",onClick:r=>P(r,e),sx:{color:"text.secondary"},children:(0,t.jsx)(z.Z,{fontSize:"small"})})]},e.id)}),(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:1,mt:2,pt:1},children:[(0,t.jsx)(eI.Z,{sx:{fontSize:16,color:"text.disabled"}}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.disabled",children:"Only platform admins and server owners can manage access."})]})]})}),(0,t.jsxs)(j.Z,{anchorEl:S,open:!!S,onClose:W,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,children:[(0,t.jsxs)(v.Z,{onClick:()=>F("admin"),disabled:(null==I?void 0:I.permission)==="admin",children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(eC.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Owner"})]}),(0,t.jsxs)(v.Z,{onClick:()=>F("manage"),disabled:(null==I?void 0:I.permission)==="manage"||A,children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(ew.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Operator"})]}),(0,t.jsxs)(v.Z,{onClick:()=>F("view"),disabled:(null==I?void 0:I.permission)==="view"||A,children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(eS.Z,{fontSize:"small"})}),(0,t.jsx)(Z.Z,{children:"Change to Viewer"})]}),(0,t.jsx)(O.Z,{}),(0,t.jsxs)(v.Z,{onClick:()=>{I&&b.mutate(I.id,{onSettled:W})},disabled:A,sx:{color:"error.main"},children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(ek.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,t.jsx)(Z.Z,{children:"Remove Access"})]})]}),(0,t.jsx)(eE,{open:C,onClose:()=>w(!1),serverId:i})]})}var eB=s(10449),eU=s(24559),eq=s(37228);function eL(e){let{text:r}=e,[s,i]=(0,n.useState)(!1),a=async()=>{try{await navigator.clipboard.writeText(r),i(!0),setTimeout(()=>i(!1),2e3)}catch(e){console.error("Failed to copy:",e)}};return(0,t.jsx)(d.Z,{size:"small",onClick:a,sx:{ml:1,color:s?"success.main":"text.secondary","&:hover":{bgcolor:"action.hover"}},"aria-label":s?"Copied":"Copy to clipboard",children:s?(0,t.jsx)(eU.Z,{sx:{fontSize:16}}):(0,t.jsx)(eB.Z,{sx:{fontSize:16}})})}function eK(e){let{label:r,value:s,copyText:n}=e;return(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",py:1},children:[(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",children:r}),(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,t.jsx)(p.Z,{variant:"body2",sx:{fontFamily:n?"monospace":"inherit",color:n?"text.primary":"text.secondary"},children:s}),n&&(0,t.jsx)(eL,{text:n})]})]})}function eH(e){let{serverName:r,hostname:s}=e,{data:n,isLoading:i}=(0,eq.UW)();if(i)return(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(u.Z,{variant:"text",width:"40%",height:28,sx:{mb:1}}),(0,t.jsx)(u.Z,{variant:"rectangular",height:1,sx:{mb:2}}),(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(u.Z,{variant:"text",width:"30%"}),(0,t.jsx)(u.Z,{variant:"text",width:"40%"})]}),(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(u.Z,{variant:"text",width:"30%"}),(0,t.jsx)(u.Z,{variant:"text",width:"40%"})]})]})});let a=s?"".concat(s,":25565"):"Not configured",l=(null==n?void 0:n.enabled)&&n.servers.length>0,d=null==n?void 0:n.servers.find(e=>e.serverName===r),c=(null==d?void 0:d.playitDomain)||"Not configured",x=!!(null==d?void 0:d.playitDomain);return(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Connection"}),(0,t.jsx)(O.Z,{sx:{mb:2}}),(0,t.jsx)(eK,{label:"LAN Address",value:a,copyText:s?a:void 0}),l&&(0,t.jsx)(eK,{label:"External Address",value:c,copyText:x?c:void 0})]})})}var eG=s(42431),eQ=s(76777),eV=s(15761);function eJ(e){let{serverName:r}=e,{data:s,isLoading:i,error:a}=(0,eA.a)({queryKey:["servers",r,"mods"],queryFn:()=>(0,eO.SC)("/api/servers/".concat(encodeURIComponent(r),"/mods")),enabled:!!r}),u=function(){let e=(0,eD.NL)();return(0,eM.D)({mutationFn:e=>{let{serverName:r,slugs:s,source:t}=e;return(0,eO.SC)("/api/servers/".concat(encodeURIComponent(r),"/mods"),{method:"POST",body:JSON.stringify({slugs:s,source:t})})},onSuccess:(r,s)=>{let{serverName:t}=s;e.invalidateQueries({queryKey:["servers",t,"mods"]})}})}(),j=function(){let e=(0,eD.NL)();return(0,eM.D)({mutationFn:e=>{let{serverName:r,slug:s}=e;return(0,eO.SC)("/api/servers/".concat(encodeURIComponent(r),"/mods/").concat(encodeURIComponent(s)),{method:"DELETE"})},onSuccess:(r,s)=>{let{serverName:t}=s;e.invalidateQueries({queryKey:["servers",t,"mods"]})}})}(),[v,g]=(0,n.useState)(!1),[Z,C]=(0,n.useState)(""),[S,k]=(0,n.useState)(""),[I,R]=(0,n.useState)(!1),[z,W]=(0,n.useState)({open:!1,message:"",severity:"info"}),{data:F,isLoading:T}=function(e,r){let s=new URLSearchParams;return e&&s.set("q",e),(null==r?void 0:r.limit)!=null&&s.set("limit",String(r.limit)),(null==r?void 0:r.offset)!=null&&s.set("offset",String(r.offset)),(0,eA.a)({queryKey:["mods","search",e,null==r?void 0:r.limit,null==r?void 0:r.offset],queryFn:()=>(0,eO.SC)("/api/mods/search?".concat(s)),enabled:(null==r?void 0:r.enabled)!==!1&&!!e.trim()})}(S,{limit:10,enabled:v&&S.length>0});(0,n.useEffect)(()=>{let e=setTimeout(()=>{k(Z)},300);return()=>clearTimeout(e)},[Z]);let A=(0,n.useCallback)(async e=>{try{await j.mutateAsync({serverName:r,slug:e}),R(!0),W({open:!0,message:"Removed ".concat(e),severity:"success"})}catch(e){W({open:!0,message:e instanceof Error?e.message:"Failed to remove mod",severity:"error"})}},[j,r]),N=(0,n.useCallback)(async e=>{try{await u.mutateAsync({serverName:r,slugs:[e]}),R(!0),W({open:!0,message:"Added ".concat(e),severity:"success"})}catch(e){W({open:!0,message:e instanceof Error?e.message:"Failed to add mod",severity:"error"})}},[u,r]),B=new Set;if(null==s?void 0:s.mods)for(let e of Object.values(s.mods))for(let r of e)B.add(r);if(i)return(0,t.jsx)(o.Z,{sx:{display:"flex",justifyContent:"center",py:6},children:(0,t.jsx)(x.Z,{})});if(a)return(0,t.jsxs)(c.Z,{severity:"error",sx:{mt:2},children:["Failed to load mods: ",a.message]});let U=B.size>0;return(0,t.jsxs)(o.Z,{children:[I&&(0,t.jsx)(c.Z,{severity:"info",sx:{mb:2},children:"Restart the server to apply mod changes."}),(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,t.jsx)(p.Z,{variant:"h6",fontWeight:600,children:"Installed Mods"}),(0,t.jsx)(l.Z,{variant:"contained",size:"small",startIcon:(0,t.jsx)(ev.Z,{}),onClick:()=>{C(""),k(""),g(!0)},children:"Add Mods"})]}),(0,t.jsx)(O.Z,{sx:{mb:2}}),U?Object.entries(s.mods).map(e=>{let[r,s]=e;return(0,t.jsxs)(o.Z,{sx:{mb:2},children:[(0,t.jsx)(p.Z,{variant:"subtitle2",color:"text.secondary",sx:{mb:1,textTransform:"capitalize"},children:r}),(0,t.jsx)(o.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:s.map(e=>(0,t.jsx)(D.Z,{label:e,icon:(0,t.jsx)(eQ.Z,{}),onDelete:()=>A(e),deleteIcon:(0,t.jsx)(P.Z,{}),variant:"outlined"},e))})]},r)}):(0,t.jsxs)(o.Z,{sx:{textAlign:"center",py:4},children:[(0,t.jsx)(eQ.Z,{sx:{fontSize:48,color:"text.disabled",mb:1}}),(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"No mods installed"}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.disabled",sx:{mt:.5},children:'Click "Add Mods" to search and install mods from Modrinth'})]})]})}),(0,t.jsxs)(y.Z,{open:v,onClose:()=>g(!1),maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{minHeight:400}},children:[(0,t.jsxs)(f.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Search Mods",(0,t.jsx)(d.Z,{onClick:()=>g(!1),size:"small",children:(0,t.jsx)(E.Z,{})})]}),(0,t.jsxs)(b.Z,{children:[(0,t.jsx)(w.Z,{fullWidth:!0,autoFocus:!0,placeholder:"Search Modrinth...",value:Z,onChange:e=>C(e.target.value),InputProps:{startAdornment:(0,t.jsx)(M.Z,{position:"start",children:(0,t.jsx)(eG.Z,{})})},sx:{mb:2}}),T&&(0,t.jsx)(o.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,t.jsx)(x.Z,{size:28})}),!T&&F&&0===F.hits.length&&S&&(0,t.jsxs)(p.Z,{variant:"body2",color:"text.secondary",sx:{textAlign:"center",py:4},children:['No mods found for "',S,'"']}),!T&&F&&F.hits.length>0&&(0,t.jsx)(o.Z,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:F.hits.map(e=>{var r;let s=B.has(e.slug);return(0,t.jsx)(h.Z,{variant:"outlined",sx:{borderRadius:2},children:(0,t.jsx)(m.Z,{sx:{py:1.5,px:2,"&:last-child":{pb:1.5}},children:(0,t.jsxs)(o.Z,{sx:{display:"flex",gap:1.5,alignItems:"flex-start"},children:[(0,t.jsx)(ef.Z,{src:e.iconUrl||void 0,variant:"rounded",sx:{width:40,height:40,bgcolor:"action.hover"},children:(0,t.jsx)(eQ.Z,{})}),(0,t.jsxs)(o.Z,{sx:{flex:1,minWidth:0},children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,t.jsx)(p.Z,{variant:"subtitle2",noWrap:!0,children:e.title}),(0,t.jsx)(l.Z,{size:"small",variant:s?"outlined":"contained",disabled:s||u.isPending,onClick:()=>N(e.slug),sx:{ml:1,minWidth:80,flexShrink:0},children:s?"Installed":"Add"})]}),(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mt:.25,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:e.description}),(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:1,mt:.5},children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:.25},children:[(0,t.jsx)(eV.Z,{sx:{fontSize:14,color:"text.disabled"}}),(0,t.jsx)(p.Z,{variant:"caption",color:"text.disabled",children:(r=e.downloads)>=1e6?"".concat((r/1e6).toFixed(1),"M"):r>=1e3?"".concat((r/1e3).toFixed(1),"K"):String(r)})]}),e.author&&(0,t.jsxs)(p.Z,{variant:"caption",color:"text.disabled",children:["by ",e.author]})]})]})]})})},e.slug)})})]})]}),(0,t.jsx)(ed.Z,{open:z.open,autoHideDuration:4e3,onClose:()=>W(e=>({...e,open:!1})),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:(0,t.jsx)(c.Z,{onClose:()=>W(e=>({...e,open:!1})),severity:z.severity,variant:"filled",children:z.message})})]})}let e_=["Overview","Activity","Mods","Files","Backups","Access","Options"];function e$(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 eY(e){var r,s,i,a,c;let{server:x,onSendCommand:u}=e,[j,v]=(0,n.useState)("Overview"),[g,Z]=(0,n.useState)(""),[f,C]=(0,n.useState)(!0),[I,R]=(0,n.useState)(!1),z=(0,n.useRef)(null),{logs:P,isConnected:W}=(0,Q.Y)({serverName:x.name}),F=(0,n.useMemo)(()=>P.filter(e=>!e.includes("RCON Listener")&&!e.includes("RCON Client")&&!e.includes("RconClient")),[P]);(0,n.useEffect)(()=>{z.current&&f&&(z.current.scrollTop=z.current.scrollHeight)},[F,f]);let T=async()=>{g.trim()&&u&&(await u(g.trim()),Z(""))},A=null!==(a=null===(r=x.stats)||void 0===r?void 0:r.cpuPercent)&&void 0!==a?a:0;(null===(s=x.stats)||void 0===s?void 0:s.memoryUsage)&&x.stats.memoryUsage,function(e){if(!e)return;let r=e.match(/^(\d+)\s*(M|G)?$/i);if(r)parseInt(r[1],10),(r[2]||"M").toUpperCase()}(x.memory);let H=null!==(c=null===(i=x.stats)||void 0===i?void 0:i.memoryPercent)&&void 0!==c?c:0;return(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(o.Z,{sx:{display:"flex",gap:.5,mb:3},children:e_.map(e=>(0,t.jsx)(l.Z,{onClick:()=>v(e),sx:{px:2,py:1,borderRadius:5,fontSize:14,fontWeight:500,textTransform:"none",bgcolor:j===e?"primary.main":"transparent",color:j===e?"#0a0e14":"text.secondary","&:hover":{bgcolor:j===e?"primary.main":(0,k.Fq)("#1bd96a",.1)}},children:e},e))}),(0,t.jsxs)(o.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, 1fr)"},gap:2,mb:2.5},children:[(0,t.jsx)(G,{value:"".concat(A.toFixed(2),"%"),unit:"/ 100%",label:"CPU usage",icon:(0,t.jsx)(N.Z,{sx:{fontSize:28}}),progress:A,progressMax:100,color:"#1bd96a"}),(0,t.jsx)(G,{value:"".concat(H.toFixed(2),"%"),unit:"/ 100%",label:"Memory usage",icon:(0,t.jsx)(B.Z,{sx:{fontSize:28}}),progress:H,progressMax:100,color:"#1bd96a"}),(0,t.jsx)(G,{value:x.worldSize||"0 B",unit:"/ 10 GB",label:"World size",icon:(0,t.jsx)(U.Z,{sx:{fontSize:28}}),progress:function(e){if(!e)return 0;let r=e.match(/^([\d.]+)\s*(B|KB|MB|MiB|GB|GiB)?$/i);if(!r)return 0;let s=parseFloat(r[1]);switch((r[2]||"B").toUpperCase()){case"GB":case"GIB":return 1024*s;case"MB":case"MIB":return s;case"KB":return s/1024;default:return s/1048576}}(x.worldSize),progressMax:10240,color:"#1bd96a"})]}),(0,t.jsxs)(h.Z,{sx:{bgcolor:"background.paper",borderRadius:3,border:"1px solid",borderColor:"divider",overflow:"hidden"},children:[(0,t.jsxs)(o.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,t.jsx)(p.Z,{variant:"h6",sx:{fontWeight:700,color:"text.primary"},children:"Console"}),(0,t.jsx)(o.Z,{sx:{width:10,height:10,borderRadius:"50%",bgcolor:W?"primary.main":"error.main",boxShadow:W?"0 0 8px rgba(27, 217, 106, 0.4)":"0 0 8px rgba(239, 68, 68, 0.4)"}})]}),(0,t.jsxs)(o.Z,{sx:{position:"relative"},children:[(0,t.jsx)(o.Z,{ref:z,onScroll:()=>{if(!z.current)return;let{scrollTop:e,scrollHeight:r,clientHeight:s}=z.current;C(r-e-s<30)},sx:{height:360,overflowY:"auto",px:2.5,py:2,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace",fontSize:13,lineHeight:1.85,color:"#b4b6c4",bgcolor:"#0a0a0a",scrollbarWidth:"thin",scrollbarColor:"#3a3d4e #0a0a0a","&::-webkit-scrollbar":{width:8},"&::-webkit-scrollbar-track":{bgcolor:"#0a0a0a"},"&::-webkit-scrollbar-thumb":{bgcolor:"#3a3d4e",borderRadius:4}},children:0===F.length?(0,t.jsx)(p.Z,{sx:{color:"text.secondary",textAlign:"center",py:8},children:"Waiting for logs..."}):F.map((e,r)=>{let s=function(e){let r=e$(e).match(/\[(\d{2}:\d{2}:\d{2})\]\s*\[([^/]+)\/(\w+)\]:\s*(.+)/);return r?{time:r[1],thread:r[2],level:r[3]||"INFO",msg:r[4]}:null}(e);return s?(0,t.jsxs)(o.Z,{sx:{display:"flex",gap:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,t.jsxs)(o.Z,{component:"span",sx:{color:"#4a4d60"},children:["[",s.time,"]"]}),(0,t.jsxs)(o.Z,{component:"span",sx:{color:"#4a4d60"},children:["\xa0[",s.thread,"/",(0,t.jsx)(o.Z,{component:"span",sx:{color:"WARN"===s.level?"#e8a848":"#6b6e80"},children:s.level}),"]:\xa0"]}),(0,t.jsx)(o.Z,{component:"span",sx:{color:"WARN"===s.level?"#c4a45a":"#b4b6c4"},children:s.msg})]},r):(0,t.jsx)(o.Z,{sx:{color:"#b4b6c4"},children:e$(e)},r)})}),(0,t.jsx)(d.Z,{onClick:()=>R(!0),sx:{position:"absolute",top:12,right:12,width:36,height:36,borderRadius:2,bgcolor:"#282a3a",border:"1px solid #3a3d4e",color:"#8b8da0","&:hover":{bgcolor:"#313440"}},children:(0,t.jsx)(q.Z,{sx:{fontSize:18}})}),!f&&(0,t.jsx)(d.Z,{onClick:()=>{z.current&&z.current.scrollTo({top:z.current.scrollHeight,behavior:"smooth"})},sx:{position:"absolute",bottom:12,right:12,width:36,height:36,borderRadius:2,bgcolor:"#282a3a",border:"1px solid #3a3d4e",color:"#8b8da0","&:hover":{bgcolor:"#313440"}},children:(0,t.jsx)(L.Z,{sx:{fontSize:18}})})]}),(0,t.jsx)(o.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,t.jsx)(w.Z,{fullWidth:!0,size:"small",placeholder:"Send a command",value:g,onChange:e=>Z(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),T())},disabled:!W,InputProps:{startAdornment:(0,t.jsx)(M.Z,{position:"start",children:(0,t.jsx)(K.Z,{sx:{fontSize:16,color:"#999"}})}),sx:{bgcolor:"#13141c",borderRadius:2,fontFamily:"'JetBrains Mono', 'Fira Code', monospace",fontSize:14,"& .MuiOutlinedInput-notchedOutline":{borderColor:"#2a2d3e"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#3a3d4e"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"}}}})})]}),"Overview"===j&&(0,t.jsxs)(S.ZP,{container:!0,spacing:3,sx:{mt:1},children:[(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Information"}),(0,t.jsx)(O.Z,{sx:{mb:2}}),(0,t.jsx)(eX,{label:"Name",value:x.name}),(0,t.jsx)(eX,{label:"Container",value:x.container}),(0,t.jsx)(eX,{label:"Hostname",value:x.hostname}),(0,t.jsx)(eX,{label:"Type",value:x.type}),(0,t.jsx)(eX,{label:"Version",value:x.version}),(0,t.jsx)(eX,{label:"Memory",value:x.memory}),(0,t.jsx)(eX,{label:"Uptime",value:x.uptime||function(e){if(!e||e<0)return"0s";let r=Math.floor(e/3600),s=Math.floor(e%3600/60),t=e%60;return r>0?"".concat(r,"h ").concat(s,"m"):s>0?"".concat(s,"m ").concat(t,"s"):"".concat(t,"s")}(x.uptimeSeconds)})]})})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Players"}),(0,t.jsx)(O.Z,{sx:{mb:2}}),x.players?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eX,{label:"Online",value:"".concat(x.players.online," / ").concat(x.players.max)}),x.players.list&&x.players.list.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",sx:{mt:2,mb:1},children:"Online Players"}),(0,t.jsx)(o.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:x.players.list.map(e=>(0,t.jsx)(D.Z,{label:e,size:"small"},e))})]})]}):(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",children:"Player information unavailable"})]})})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(eH,{serverName:x.name,hostname:x.hostname})})]}),"Activity"===j&&(0,t.jsx)(o.Z,{sx:{mt:3},children:(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(p.Z,{variant:"h6",gutterBottom:!0,fontWeight:600,children:"Server Activity"}),(0,t.jsx)(O.Z,{sx:{mb:2}}),(0,t.jsx)(et,{serverName:x.name})]})})}),"Mods"===j&&(0,t.jsx)(o.Z,{sx:{mt:3},children:(0,t.jsx)(eJ,{serverName:x.name})}),"Files"===j&&(0,t.jsx)(o.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"File browser coming soon"})}),"Backups"===j&&(0,t.jsx)(o.Z,{sx:{mt:3},children:(0,t.jsx)(p.Z,{variant:"body1",color:"text.secondary",children:"Backup management coming soon"})}),"Access"===j&&(0,t.jsx)(o.Z,{sx:{mt:3},children:(0,t.jsx)(eN,{serverId:x.name})}),"Options"===j&&(0,t.jsx)(o.Z,{sx:{mt:3},children:(0,t.jsx)(ey,{serverName:x.name,isRunning:"running"===x.status})}),(0,t.jsxs)(y.Z,{open:I,onClose:()=>R(!1),maxWidth:"xl",fullWidth:!0,PaperProps:{sx:{height:"90vh",bgcolor:"background.paper"}},children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",p:2,borderBottom:1,borderColor:"divider"},children:[(0,t.jsxs)(p.Z,{variant:"h6",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,letterSpacing:"0.05em"},children:["Console - ",x.name]}),(0,t.jsx)(d.Z,{onClick:()=>R(!1),children:(0,t.jsx)(E.Z,{})})]}),(0,t.jsx)(b.Z,{sx:{p:0,display:"flex",flexDirection:"column"},children:(0,t.jsx)(V.K,{serverName:x.name})})]})]})}function eX(e){let{label:r,value:s}=e;return s?(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(p.Z,{variant:"body2",color:"text.secondary",children:r}),(0,t.jsx)(p.Z,{variant:"body2",sx:{fontWeight:500},children:s})]}):null}var e0=s(93757);function e1(){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]})}function e2(){return(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M21 2v6h-6"}),(0,t.jsx)("path",{d:"M3 12a9 9 0 0115.36-6.36L21 8"}),(0,t.jsx)("path",{d:"M3 22v-6h6"}),(0,t.jsx)("path",{d:"M21 12a9 9 0 01-15.36 6.36L3 16"})]})}function e6(){var e,r,s,D;let M=(0,i.useParams)(),O=(0,a.x)(),E=decodeURIComponent(M.name),{data:N,isLoading:B,error:U}=(0,em.Hy)(E),{status:q,health:L}=function(e){let{serverName:r,onStatusChange:s,enabled:t=!0,reconnectInterval:i=3e3}=e,[a,o]=(0,n.useState)(null),[l,d]=(0,n.useState)(null);(0,n.useEffect)(()=>{o(null),d(null)},[r]);let c=(0,n.useCallback)(e=>{if("server-status"===e.type){let r=e.data.status,t=e.data.health;o(r),d(t),null==s||s(r,t)}},[s]),{isConnected:x,reconnect:u,retryCount:h}=(0,e0.D)({url:"/api/sse/servers/".concat(encodeURIComponent(r),"/status"),onMessage:c,enabled:t,reconnectInterval:i});return{status:a,health:l,isConnected:x,reconnect:u,retryCount:h}}({serverName:E,enabled:!!E}),[K,H]=(0,n.useState)(null),[G,Q]=(0,n.useState)(!1),[V,J]=(0,n.useState)(""),_=(0,em.jM)(),$=(0,em.Aw)(),Y=(0,em._I)(),X=(0,em.Hq)(),ee=async()=>{try{await _.mutateAsync(E)}catch(e){console.error("Failed to start server:",e)}},er=async()=>{try{await $.mutateAsync(E)}catch(e){console.error("Failed to stop server:",e)}},es=async()=>{try{await Y.mutateAsync(E)}catch(e){console.error("Failed to restart server:",e)}},et=async e=>{try{await fetch("/api/servers/".concat(encodeURIComponent(E),"/exec"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})})}catch(e){console.error("Failed to send command:",e)}},en=q||(null==N?void 0:N.server.status),ei=_.isPending||$.isPending||Y.isPending,ea=null==N?void 0:N.server;return(0,t.jsxs)(t.Fragment,{children:[U&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to load server: ",U.message]}),_.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to start server: ",null===(e=_.error)||void 0===e?void 0:e.message]}),$.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to stop server: ",null===(r=$.error)||void 0===r?void 0:r.message]}),Y.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to restart server: ",null===(s=Y.error)||void 0===s?void 0:s.message]}),X.isError&&(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:3},children:["Failed to delete server: ",null===(D=X.error)||void 0===D?void 0:D.message]}),B?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,t.jsx)(u.Z,{variant:"rounded",width:64,height:64,sx:{borderRadius:3,flexShrink:0}}),(0,t.jsxs)(o.Z,{sx:{flex:1},children:[(0,t.jsx)(u.Z,{variant:"text",width:80,height:18,sx:{mb:.5}}),(0,t.jsx)(u.Z,{variant:"text",width:"40%",height:40}),(0,t.jsxs)(o.Z,{sx:{display:"flex",gap:2,mt:.75},children:[(0,t.jsx)(u.Z,{variant:"text",width:100}),(0,t.jsx)(u.Z,{variant:"text",width:60}),(0,t.jsx)(u.Z,{variant:"text",width:140}),(0,t.jsx)(u.Z,{variant:"text",width:50})]})]}),(0,t.jsxs)(o.Z,{sx:{display:"flex",gap:1,flexShrink:0},children:[(0,t.jsx)(u.Z,{variant:"rounded",width:90,height:40,sx:{borderRadius:2}}),(0,t.jsx)(u.Z,{variant:"rounded",width:36,height:36,sx:{borderRadius:2}})]})]}),(0,t.jsx)(o.Z,{sx:{display:"flex",gap:.5,mb:3},children:[80,70,65,50,65,65].map((e,r)=>(0,t.jsx)(u.Z,{variant:"rounded",width:e,height:36,sx:{borderRadius:5}},r))}),(0,t.jsx)(o.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(3, 1fr)"},gap:2,mb:2.5},children:[0,1,2].map(e=>(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1.5},children:[(0,t.jsx)(u.Z,{variant:"text",width:"50%"}),(0,t.jsx)(u.Z,{variant:"circular",width:28,height:28})]}),(0,t.jsx)(u.Z,{variant:"text",width:"60%",height:36}),(0,t.jsx)(u.Z,{variant:"rounded",width:"100%",height:6,sx:{borderRadius:3,mt:1}})]})},e))}),(0,t.jsxs)(h.Z,{sx:{borderRadius:3,border:"1px solid",borderColor:"divider"},children:[(0,t.jsxs)(o.Z,{sx:{px:3,py:2,borderBottom:"1px solid",borderColor:"divider",display:"flex",alignItems:"center",gap:1.25},children:[(0,t.jsx)(u.Z,{variant:"text",width:80,height:28}),(0,t.jsx)(u.Z,{variant:"circular",width:10,height:10})]}),(0,t.jsx)(u.Z,{variant:"rectangular",height:360,sx:{bgcolor:"#0a0a0a"}}),(0,t.jsx)(o.Z,{sx:{px:2.5,py:1.5,borderTop:"1px solid",borderColor:"divider"},children:(0,t.jsx)(u.Z,{variant:"rounded",width:"100%",height:40,sx:{borderRadius:2}})})]}),(0,t.jsxs)(S.ZP,{container:!0,spacing:3,sx:{mt:1},children:[(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(u.Z,{variant:"text",width:"40%",height:28,sx:{mb:1}}),(0,t.jsx)(u.Z,{variant:"rectangular",height:1,sx:{mb:2}}),[0,1,2,3,4,5,6].map(e=>(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(u.Z,{variant:"text",width:"30%"}),(0,t.jsx)(u.Z,{variant:"text",width:"40%"})]},e))]})})}),(0,t.jsx)(S.ZP,{item:!0,xs:12,md:6,children:(0,t.jsx)(h.Z,{sx:{borderRadius:3},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(u.Z,{variant:"text",width:"30%",height:28,sx:{mb:1}}),(0,t.jsx)(u.Z,{variant:"rectangular",height:1,sx:{mb:2}}),(0,t.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"space-between",py:1},children:[(0,t.jsx)(u.Z,{variant:"text",width:"25%"}),(0,t.jsx)(u.Z,{variant:"text",width:"20%"})]})]})})})]})]}):ea?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2.5},children:[(0,t.jsx)(o.Z,{sx:{width:64,height:64,borderRadius:3,overflow:"hidden",bgcolor:"background.paper",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"1px solid",borderColor:"divider",fontSize:36},children:function(e){if(!e)return"\uD83C\uDFAE";let r=e.toUpperCase();return["PAPER","SPIGOT","BUKKIT","PURPUR"].includes(r)?"\uD83D\uDD0C":["FORGE","NEOFORGE","FABRIC","QUILT"].includes(r)?"\uD83D\uDD27":"\uD83C\uDFAE"}(ea.type)}),(0,t.jsxs)(o.Z,{sx:{flex:1},children:[(0,t.jsxs)(p.Z,{onClick:()=>O.push("/servers"),sx:{fontSize:12,color:"primary.main",cursor:"pointer",mb:.25,display:"flex",alignItems:"center",gap:.5,"&:hover":{textDecoration:"underline"}},children:[(0,t.jsx)(I.Z,{sx:{fontSize:14}})," All servers"]}),(0,t.jsx)(p.Z,{variant:"h4",component:"h1",sx:{fontFamily:'"Minecraft", sans-serif',fontWeight:400,color:"text.primary",letterSpacing:"0.5px",m:0,textTransform:"uppercase"},children:E}),(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:0,mt:.75,flexWrap:"wrap",fontSize:13,color:"text.secondary"},children:[ea.version&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(W.Z,{sx:{fontSize:14}}),"Minecraft ",ea.version]}),(0,t.jsx)(o.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.type&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(F.Z,{sx:{fontSize:14}}),ea.type]}),(0,t.jsx)(o.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),ea.hostname&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(T.Z,{sx:{fontSize:14}}),ea.hostname]}),(0,t.jsx)(o.Z,{component:"span",sx:{mx:1.25,color:"#3a3d4e"},children:"|"})]}),(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,t.jsx)(A.Z,{sx:{fontSize:14}}),ea.uptime||function(e){if(!e||e<0)return"0s";let r=Math.floor(e/3600),s=Math.floor(e%3600/60),t=e%60;return r>0?"".concat(r,"h ").concat(s,"m"):s>0?"".concat(s,"m ").concat(t,"s"):"".concat(t,"s")}(ea.uptimeSeconds)||"0s"]})]})]}),(0,t.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:1.25,flexShrink:0},children:[("stopped"===en||"exited"===en||"not_created"===en)&&(0,t.jsx)(l.Z,{variant:"contained",color:"success",startIcon:ei?(0,t.jsx)(x.Z,{size:16,color:"inherit"}):(0,t.jsx)(R.Z,{}),onClick:ee,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:600},children:"Start"}),"running"===en&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.Z,{variant:"outlined",startIcon:ei?(0,t.jsx)(x.Z,{size:16}):(0,t.jsx)(e1,{}),onClick:er,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:500,borderColor:"divider",color:"text.secondary","&:hover":{borderColor:"text.secondary",bgcolor:(0,k.Fq)("#fff",.05)}},children:"Stop"}),(0,t.jsx)(l.Z,{variant:"contained",startIcon:ei?(0,t.jsx)(x.Z,{size:16,color:"inherit"}):(0,t.jsx)(e2,{}),onClick:es,disabled:ei,sx:{px:2,py:1,borderRadius:2,fontSize:14,fontWeight:600,bgcolor:"primary.main",color:"#0a0e14","&:hover":{bgcolor:"primary.dark"}},children:"Restart"})]}),(0,t.jsx)(d.Z,{onClick:e=>H(e.currentTarget),sx:{width:36,height:36,borderRadius:2,border:"1px solid",borderColor:"divider",color:"text.secondary"},children:(0,t.jsx)(z.Z,{sx:{fontSize:18}})}),(0,t.jsx)(j.Z,{anchorEl:K,open:!!K,onClose:()=>H(null),children:(0,t.jsxs)(v.Z,{onClick:()=>{H(null),Q(!0),J("")},sx:{color:"error.main"},children:[(0,t.jsx)(g.Z,{children:(0,t.jsx)(P.Z,{fontSize:"small",sx:{color:"error.main"}})}),(0,t.jsx)(Z.Z,{children:"Delete Server"})]})})]})]}),(0,t.jsx)(eY,{server:ea,onSendCommand:et})]}):(0,t.jsx)(c.Z,{severity:"warning",children:"Server not found"}),(0,t.jsxs)(y.Z,{open:G,onClose:()=>{Q(!1),J("")},maxWidth:"sm",fullWidth:!0,children:[(0,t.jsx)(f.Z,{children:"Delete Server"}),(0,t.jsxs)(b.Z,{children:[(0,t.jsxs)(p.Z,{sx:{mb:2},children:["This action cannot be undone. Type ",(0,t.jsx)("strong",{children:E})," to confirm deletion."]}),(0,t.jsx)(w.Z,{label:"Server name",value:V,onChange:e=>J(e.target.value),fullWidth:!0,autoFocus:!0})]}),(0,t.jsxs)(C.Z,{sx:{px:3,pb:2},children:[(0,t.jsx)(l.Z,{onClick:()=>{Q(!1),J("")},children:"Cancel"}),(0,t.jsx)(l.Z,{variant:"contained",color:"error",onClick:()=>{V===E&&X.mutate({name:E,force:!0},{onSuccess:()=>{O.push("/servers")}})},disabled:V!==E||X.isPending,startIcon:X.isPending?(0,t.jsx)(x.Z,{size:16}):null,children:X.isPending?"Deleting...":"Delete"})]})]})]})}},56813:function(e,r,s){"use strict";s.d(r,{I:function(){return a}});var t=s(94655),n=s(25333),i=s(82925);function a(e){let{action:r,size:s="small"}=e,a=i.Lu[r]||"default",o=i.n3[r]||r;return(0,t.jsx)(n.Z,{label:o,color:a,size:s,variant:"filled",sx:{fontWeight:600,fontSize:"small"===s?"0.7rem":"0.8rem"}})}},26892:function(e,r,s){"use strict";s.d(r,{c:function(){return o}});var t=s(94655),n=s(25333),i=s(46207),a=s(43436);function o(e){let{status:r,size:s="small"}=e;return(0,t.jsx)(n.Z,{icon:"success"===r?(0,t.jsx)(i.Z,{}):(0,t.jsx)(a.Z,{}),label:"success"===r?"OK":"Error",color:"success"===r?"success":"error",size:s,variant:"outlined",sx:{fontWeight:500,fontSize:"small"===s?"0.7rem":"0.8rem"}})}},84509:function(e,r,s){"use strict";s.d(r,{DM:function(){return a},HZ:function(){return l},VM:function(){return o},hT:function(){return i},oL:function(){return d}});var t=s(5632),n=s(42936);function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,s=function(e){let r=new URLSearchParams;e.action&&r.set("action",e.action),e.actor&&r.set("actor",e.actor),e.targetType&&r.set("targetType",e.targetType),e.targetName&&r.set("targetName",e.targetName),e.status&&r.set("status",e.status),e.from&&r.set("from",e.from),e.to&&r.set("to",e.to),void 0!==e.limit&&r.set("limit",String(e.limit)),void 0!==e.offset&&r.set("offset",String(e.offset)),e.sort&&r.set("sort",e.sort);let s=r.toString();return s?"?".concat(s):""}(e);return(0,t.a)({queryKey:["audit-logs",e],queryFn:()=>(0,n.SC)("/api/audit-logs".concat(s)),enabled:(null==r?void 0:r.enabled)!==!1})}function a(e){return(0,t.a)({queryKey:["audit-logs","stats"],queryFn:()=>(0,n.SC)("/api/audit-logs/stats"),enabled:(null==e?void 0:e.enabled)!==!1,refetchInterval:3e4})}function o(e,r){return(0,t.a)({queryKey:["audit-logs",e],queryFn:()=>(0,n.SC)("/api/audit-logs/".concat(encodeURIComponent(e))),enabled:(null==r?void 0:r.enabled)!==!1&&!!e})}function l(e,r){var s;return i({targetType:"server",targetName:e,limit:null!==(s=null==r?void 0:r.limit)&&void 0!==s?s:20},{enabled:(null==r?void 0:r.enabled)!==!1&&!!e})}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return i({limit:e,sort:"timestamp:desc"})}},37228:function(e,r,s){"use strict";s.d(r,{Bc:function(){return l},N$:function(){return d},UW:function(){return o}});var t=s(5632),n=s(58919),i=s(20367),a=s(42936);function o(){return(0,t.a)({queryKey:["playit-status"],queryFn:()=>(0,a.SC)("/api/playit/status"),refetchInterval:3e4})}function l(){let e=(0,n.NL)();return(0,i.D)({mutationFn:()=>(0,a.SC)("/api/playit/start",{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["playit-status"]})}})}function d(){let e=(0,n.NL)();return(0,i.D)({mutationFn:()=>(0,a.SC)("/api/playit/stop",{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["playit-status"]})}})}},82925:function(e,r,s){"use strict";s.d(r,{KK:function(){return o},Lu:function(){return t},Xn:function(){return a},n3:function(){return n},xg:function(){return i}});let t={"server.create":"success","server.delete":"error","server.start":"info","server.stop":"warning","server.restart":"secondary","player.whitelist.add":"success","player.whitelist.remove":"warning","player.ban":"error","player.unban":"success","player.op":"info","player.deop":"warning","player.kick":"error","audit.purge":"default"},n={"server.create":"Create","server.delete":"Delete","server.start":"Start","server.stop":"Stop","server.restart":"Restart","player.whitelist.add":"Whitelist Add","player.whitelist.remove":"Whitelist Remove","player.ban":"Ban","player.unban":"Unban","player.op":"Op","player.deop":"Deop","player.kick":"Kick","audit.purge":"Purge"},i=["server.create","server.delete","server.start","server.stop","server.restart","player.whitelist.add","player.whitelist.remove","player.ban","player.unban","player.op","player.deop","player.kick","audit.purge"],a=["server.create","server.delete","server.start","server.stop","server.restart"],o=["player.whitelist.add","player.whitelist.remove","player.ban","player.unban","player.op","player.deop","player.kick"]}},function(e){e.O(0,[6812,9760,6758,680,1668,7436,1071,540,4416,2538,5511,880,55,7727,8347,1658,9951,6727,6645,4219,4596,4682,2666,5787,3669,2757,1744],function(){return e(e.s=59616)}),_N_E=e.O()}]);