@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.
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/BUILD_ID +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/app-build-manifest.json +59 -59
- package/.next/standalone/platform/services/mcctl-console/.next/app-path-routes-manifest.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/build-manifest.json +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/prerender-manifest.json +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/admin/users/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/audit-logs/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/backups/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/dashboard/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/players/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/routing/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/console/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/servers/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/(main)/worlds/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/audit-logs.rsc +3 -3
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/backups.rsc +3 -3
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/dashboard.rsc +3 -3
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/index.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/login.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/players.rsc +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/routing.rsc +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/servers.rsc +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/settings.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/settings.rsc +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup/page_client-reference-manifest.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/signup.rsc +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/app/worlds.rsc +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/server/app-paths-manifest.json +24 -24
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/354.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/chunks/5841.js +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/middleware-manifest.json +5 -5
- package/.next/standalone/platform/services/mcctl-console/.next/server/pages/404.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/pages/500.html +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/server/server-reference-manifest.json +1 -1
- package/.next/{static/chunks/6831-3fe5e1273ac38e5f.js → standalone/platform/services/mcctl-console/.next/static/chunks/6831-81d20c7bc7bd1e76.js} +1 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/9443-94798e3709b6aeba.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/layout-06fb39812ec76869.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/page-8476d9ad7e0424d2.js +1 -0
- package/.next/standalone/platform/services/mcctl-console/package.json +1 -1
- package/.next/{standalone/platform/services/mcctl-console/.next/static/chunks/6831-3fe5e1273ac38e5f.js → static/chunks/6831-81d20c7bc7bd1e76.js} +1 -1
- package/.next/static/chunks/9443-94798e3709b6aeba.js +1 -0
- package/.next/static/chunks/app/(main)/layout-06fb39812ec76869.js +1 -0
- package/.next/static/chunks/app/(main)/servers/[name]/page-8476d9ad7e0424d2.js +1 -0
- package/package.json +2 -2
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/2019-01a1009a77c3dccd.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/layout-25723393b563b0b5.js +0 -1
- package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/servers/[name]/page-09665a800696c8a9.js +0 -1
- package/.next/static/chunks/2019-01a1009a77c3dccd.js +0 -1
- package/.next/static/chunks/app/(main)/layout-25723393b563b0b5.js +0 -1
- package/.next/static/chunks/app/(main)/servers/[name]/page-09665a800696c8a9.js +0 -1
- /package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/audit-logs/{page-4b9a4dac74fde96c.js → page-fc2d6a6546ca0f2c.js} +0 -0
- /package/.next/standalone/platform/services/mcctl-console/.next/static/chunks/app/(main)/dashboard/{page-77b32d45e2f64eec.js → page-037cd01d812a444a.js} +0 -0
- /package/.next/standalone/platform/services/mcctl-console/.next/static/{SmXwR-3YjO6r8-VonFLXc → pstO25F485_2xYibtTFJO}/_buildManifest.js +0 -0
- /package/.next/standalone/platform/services/mcctl-console/.next/static/{SmXwR-3YjO6r8-VonFLXc → pstO25F485_2xYibtTFJO}/_ssgManifest.js +0 -0
- /package/.next/static/chunks/app/(main)/audit-logs/{page-4b9a4dac74fde96c.js → page-fc2d6a6546ca0f2c.js} +0 -0
- /package/.next/static/chunks/app/(main)/dashboard/{page-77b32d45e2f64eec.js → page-037cd01d812a444a.js} +0 -0
- /package/.next/static/{SmXwR-3YjO6r8-VonFLXc → pstO25F485_2xYibtTFJO}/_buildManifest.js +0 -0
- /package/.next/static/{SmXwR-3YjO6r8-VonFLXc → pstO25F485_2xYibtTFJO}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6831],{6516:function(e,n,t){t.d(n,{e:function(){return Z}});var s=t(94655),a=t(35106),l=t(99770),i=t(62508),r=t(5682),o=t(76678),c=t(30417),d=t(97436),u=t(29793),h=t(75726),x=t(62328),m=t(7178),p=t(81071),f=t(93017),j=t(7281),g=t(12063);function Z(e){var n;let{open:t,onClose:Z,serverNames:v,defaultServer:y}=e,[b,C]=(0,a.useState)(y||""),[S,k]=(0,a.useState)(""),w=(0,g.t)(),z=async()=>{if(b)try{await w.mutateAsync({serverName:b,description:S.trim()||void 0}),D()}catch(e){}},D=()=>{w.isPending||(C(y||""),k(""),w.reset(),Z())};return(0,s.jsxs)(l.Z,{open:t,onClose:D,maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(i.Z,{children:"Create Config Snapshot"}),(0,s.jsx)(r.Z,{children:(0,s.jsxs)(j.Z,{sx:{display:"flex",flexDirection:"column",gap:2,mt:1},children:[(0,s.jsxs)(u.Z,{fullWidth:!0,required:!0,children:[(0,s.jsx)(h.Z,{children:"Server"}),(0,s.jsx)(x.Z,{value:b,onChange:e=>C(e.target.value),label:"Server",disabled:w.isPending||!!y,children:v.map(e=>(0,s.jsx)(m.Z,{value:e,children:e},e))})]}),(0,s.jsx)(d.Z,{label:"Description (optional)",value:S,onChange:e=>k(e.target.value),placeholder:"e.g., Before modpack update",fullWidth:!0,disabled:w.isPending}),w.isError&&(0,s.jsx)(p.Z,{severity:"error",children:(null===(n=w.error)||void 0===n?void 0:n.message)||"Failed to create snapshot"}),w.isPending&&(0,s.jsx)(p.Z,{severity:"info",icon:(0,s.jsx)(f.Z,{size:20}),children:"Creating snapshot... This may take a moment."})]})}),(0,s.jsxs)(o.Z,{children:[(0,s.jsx)(c.Z,{onClick:D,disabled:w.isPending,children:"Cancel"}),(0,s.jsx)(c.Z,{onClick:z,variant:"contained",disabled:!b||w.isPending,children:w.isPending?"Creating...":"Create Snapshot"})]})]})}},84728:function(e,n,t){t.d(n,{YN:function(){return V}});var s=t(94655),a=t(35106),l=t(30417),i=t(99770),r=t(62508),o=t(5682),c=t(76678),d=t(7281),u=t(31317),h=t(81071),x=t(93017),m=t(79983),p=t(69123),f=t(44059),j=t(83855),g=t(71185),Z=t(97731),v=t(86071),y=t(72205),b=t(90158),C=t(49954),S=t(17820),k=t(73424),w=t(95511),z=t(73517),D=t(47254),A=t(43214);function B(e){let{changes:n,selectedFile:t,onSelectFile:l}=e,i=(0,a.useCallback)((e,t,s)=>{"ArrowUp"===e.key&&s>0?(e.preventDefault(),l(n[s-1].path)):"ArrowDown"===e.key&&s<n.length-1?(e.preventDefault(),l(n[s+1].path)):("Enter"===e.key||" "===e.key)&&(e.preventDefault(),l(t))},[n,l]);return 0===n.length?(0,s.jsx)(d.Z,{sx:{p:2},children:(0,s.jsx)(u.Z,{variant:"body2",color:"text.secondary",children:"No changes"})}):(0,s.jsxs)(d.Z,{sx:{height:"100%",overflow:"auto",borderRight:1,borderColor:"divider"},role:"tree","aria-label":"Changed files",children:[(0,s.jsxs)(u.Z,{variant:"caption",sx:{display:"block",px:2,py:1,color:"text.secondary",fontWeight:"medium",letterSpacing:"0.08em",textTransform:"uppercase",borderBottom:1,borderColor:"divider",bgcolor:"background.paper"},children:["Changed Files (",n.length,")"]}),(0,s.jsx)(b.Z,{dense:!0,disablePadding:!0,role:"group",children:n.map((e,n)=>{let a=function(e){switch(e){case"added":return{icon:(0,s.jsx)(z.Z,{fontSize:"small"}),color:"success.main",label:"Added"};case"modified":return{icon:(0,s.jsx)(D.Z,{fontSize:"small"}),color:"warning.main",label:"Modified"};case"deleted":return{icon:(0,s.jsx)(A.Z,{fontSize:"small"}),color:"error.main",label:"Deleted"}}}(e.status),r=function(e){let n=e.split("/");return n[n.length-1]}(e.path),o=function(e){let n=e.split("/");return n.length<=1?"":n.slice(0,-1).join("/")}(e.path),c=t===e.path;return(0,s.jsx)(w.Z,{title:"".concat(a.label,": ").concat(e.path),placement:"right",children:(0,s.jsxs)(C.Z,{selected:c,onClick:()=>l(e.path),onKeyDown:t=>i(t,e.path,n),role:"treeitem","aria-selected":c,"aria-label":"".concat(e.path," - ").concat(a.label),sx:{py:.75,"&.Mui-selected":{bgcolor:"action.selected"}},children:[(0,s.jsx)(S.Z,{sx:{minWidth:32,color:a.color},children:a.icon}),(0,s.jsx)(k.Z,{primary:r,secondary:o||void 0,primaryTypographyProps:{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.8rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},secondaryTypographyProps:{variant:"caption",sx:{fontFamily:"monospace",fontSize:"0.7rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}})]})},e.path)})})]})}var P=t(20876),F=t(25333);let I=(0,P.default)(()=>t.e(271).then(t.bind(t,40271)),{loadableGenerated:{webpack:()=>[null]},ssr:!1});function W(e){var n,t;let{change:a,viewMode:l,fileRef:i}=e,r="added"===a.status?"":null!==(n=a.oldContent)&&void 0!==n?n:"",o="deleted"===a.status?"":null!==(t=a.newContent)&&void 0!==t?t:"";return(0,s.jsxs)(d.Z,{ref:i,sx:{mb:3},"data-file-path":a.path,id:"diff-file-".concat(a.path.replace(/[^a-zA-Z0-9]/g,"-")),children:[(0,s.jsxs)(d.Z,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1,bgcolor:"background.default",borderTop:1,borderBottom:1,borderColor:"divider",position:"sticky",top:0,zIndex:1},children:[function(e){switch(e){case"added":return(0,s.jsx)(z.Z,{fontSize:"small",sx:{color:"success.main"}});case"modified":return(0,s.jsx)(D.Z,{fontSize:"small",sx:{color:"warning.main"}});case"deleted":return(0,s.jsx)(A.Z,{fontSize:"small",sx:{color:"error.main"}})}}(a.status),(0,s.jsx)(u.Z,{variant:"body2",sx:{fontFamily:"monospace",fontWeight:"bold",flex:1},children:a.path}),(0,s.jsx)(F.Z,{label:function(e){switch(e){case"added":return"added";case"modified":return"modified";case"deleted":return"deleted"}}(a.status),size:"small",color:function(e){switch(e){case"added":return"success";case"modified":return"warning";case"deleted":return"error"}}(a.status),variant:"outlined"})]}),(0,s.jsx)(d.Z,{sx:{fontSize:"0.8rem",overflow:"auto"},children:(0,s.jsx)(I,{oldValue:r,newValue:o,splitView:"split"===l,useDarkTheme:!0,hideLineNumbers:!1,showDiffOnly:!0,styles:{variables:{dark:{diffViewerBackground:"#1a1a1a",addedBackground:"#1a3a1a",addedColor:"#4caf50",removedBackground:"#3a1a1a",removedColor:"#f44336",wordAddedBackground:"#2d5a2d",wordRemovedBackground:"#5a2d2d",emptyLineBackground:"#1a1a1a",gutterBackground:"#111",gutterColor:"#555",codeFoldBackground:"#111",codeFoldGutterBackground:"#111"}}}})})]})}function T(e){let{changes:n,selectedFile:t,viewMode:l}=e,i=(0,a.useRef)(new Map),r=(0,a.useRef)(null);return((0,a.useEffect)(()=>{if(t&&i.current.has(t)){let e=i.current.get(t);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})}},[t]),0===n.length)?(0,s.jsx)(d.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",p:4},children:(0,s.jsx)(u.Z,{variant:"body1",color:"text.secondary",children:"No differences between these snapshots"})}):(0,s.jsx)(d.Z,{ref:r,sx:{height:"100%",overflow:"auto","& table":{width:"100%"}},children:n.map((e,t)=>(0,s.jsxs)(d.Z,{children:[(0,s.jsx)(W,{change:e,viewMode:l,fileRef:n=>{n?i.current.set(e.path,n):i.current.delete(e.path)}}),t<n.length-1&&(0,s.jsx)(p.Z,{})]},e.path))})}var E=t(89923),N=t(10297),R=t(98874),M=t(23345);function q(e){let{value:n,onChange:t}=e;return(0,s.jsxs)(N.Z,{value:n,exclusive:!0,onChange:(e,n)=>{null!==n&&t(n)},"aria-label":"Diff view mode",size:"small",children:[(0,s.jsx)(w.Z,{title:"Unified diff view",children:(0,s.jsx)(E.Z,{value:"unified","aria-label":"Unified view",children:(0,s.jsx)(R.Z,{fontSize:"small"})})}),(0,s.jsx)(w.Z,{title:"Side-by-side diff view",children:(0,s.jsx)(E.Z,{value:"split","aria-label":"Split view",children:(0,s.jsx)(M.Z,{fontSize:"small"})})})]})}var L=t(32366),U=t(45813),H=t(21111);function O(e){let{summary:n}=e,{added:t,modified:a,deleted:l}=n;return 0===t+a+l?(0,s.jsx)(d.Z,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1,borderTop:1,borderColor:"divider",bgcolor:"background.paper"},children:(0,s.jsx)(u.Z,{variant:"body2",color:"text.secondary",children:"No differences found between snapshots"})}):(0,s.jsxs)(d.Z,{sx:{display:"flex",alignItems:"center",gap:1.5,px:2,py:1,borderTop:1,borderColor:"divider",bgcolor:"background.paper",flexWrap:"wrap"},role:"status","aria-label":"Summary: ".concat(t," added, ").concat(a," modified, ").concat(l," deleted"),children:[(0,s.jsx)(u.Z,{variant:"caption",color:"text.secondary",sx:{fontWeight:"medium"},children:"Summary:"}),a>0&&(0,s.jsx)(F.Z,{icon:(0,s.jsx)(U.Z,{sx:{fontSize:"0.875rem"}}),label:"".concat(a," modified"),size:"small",sx:{bgcolor:"warning.dark",color:"warning.contrastText","& .MuiChip-icon":{color:"warning.contrastText"}}}),t>0&&(0,s.jsx)(F.Z,{icon:(0,s.jsx)(L.Z,{sx:{fontSize:"0.875rem"}}),label:"".concat(t," added"),size:"small",sx:{bgcolor:"success.dark",color:"success.contrastText","& .MuiChip-icon":{color:"success.contrastText"}}}),l>0&&(0,s.jsx)(F.Z,{icon:(0,s.jsx)(H.Z,{sx:{fontSize:"0.875rem"}}),label:"".concat(l," deleted"),size:"small",sx:{bgcolor:"error.dark",color:"error.contrastText","& .MuiChip-icon":{color:"error.contrastText"}}})]})}function K(e){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(e))}function V(e){var n;let{open:t,snapshotA:b,snapshotB:C,onClose:S,onRestoreA:k}=e,w=(0,j.Z)(),z=(0,f.Z)(w.breakpoints.down("md")),[D,A]=(0,a.useState)(void 0),[P,F]=(0,a.useState)("unified"),{data:I,isLoading:W,isError:E,error:N}=(0,y.m)(b.id,C.id,{enabled:t});(0,a.useEffect)(()=>{t&&(A(void 0),F("unified"))},[t,z]),(0,a.useEffect)(()=>{(null==I?void 0:I.changes)&&I.changes.length>0&&!D&&A(I.changes[0].path)},[I,D]);let R=(0,a.useCallback)(e=>{"Escape"===e.key&&S()},[S]);(0,a.useEffect)(()=>{if(t)return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[t,R]);let M=(0,a.useCallback)(e=>{A(e)},[]),L=(0,a.useCallback)(()=>{null==k||k(b),S()},[k,b,S]);return(0,s.jsxs)(i.Z,{open:t,onClose:S,maxWidth:"xl",fullWidth:!0,fullScreen:z,"aria-labelledby":"config-diff-dialog-title",PaperProps:{sx:{height:z?"100%":"90vh",maxHeight:z?"100%":"90vh",display:"flex",flexDirection:"column"}},children:[(0,s.jsxs)(r.Z,{id:"config-diff-dialog-title",sx:{display:"flex",alignItems:"center",gap:1,pb:1,flexShrink:0},children:[(0,s.jsx)(v.Z,{color:"primary"}),(0,s.jsxs)(d.Z,{sx:{flex:1},children:[(0,s.jsx)(u.Z,{variant:"h6",component:"span",children:"Config Diff"}),(0,s.jsxs)(u.Z,{variant:"body2",color:"text.secondary",sx:{display:"block",mt:.25},children:["Snapshot A: ",K(b.createdAt),(0,s.jsx)(d.Z,{component:"span",sx:{mx:1},children:"vs"}),"Snapshot B: ",K(C.createdAt)]})]}),(0,s.jsx)(q,{value:P,onChange:F}),(0,s.jsx)(m.Z,{onClick:S,"aria-label":"Close diff dialog",size:"small",sx:{ml:1},children:(0,s.jsx)(g.Z,{})})]}),(0,s.jsx)(p.Z,{}),(0,s.jsxs)(o.Z,{sx:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column",p:0},children:[W&&(0,s.jsxs)(d.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",flex:1,gap:2},children:[(0,s.jsx)(x.Z,{size:24}),(0,s.jsx)(u.Z,{variant:"body2",color:"text.secondary",children:"Loading diff..."})]}),E&&(0,s.jsx)(d.Z,{sx:{p:2},children:(0,s.jsxs)(h.Z,{severity:"error",children:["Failed to load diff: ",null!==(n=null==N?void 0:N.message)&&void 0!==n?n:"Unknown error"]})}),I&&(0,s.jsxs)(d.Z,{sx:{flex:1,display:"flex",flexDirection:{xs:"column",md:"row"},overflow:"hidden"},children:[(0,s.jsx)(d.Z,{sx:{width:{xs:"100%",md:220},flexShrink:0,height:{xs:"auto",md:"100%"},maxHeight:{xs:160,md:"none"},overflow:"auto"},children:(0,s.jsx)(B,{changes:I.changes,selectedFile:D,onSelectFile:M})}),(0,s.jsx)(p.Z,{orientation:z?"horizontal":"vertical"}),(0,s.jsx)(d.Z,{sx:{flex:1,overflow:"auto"},children:(0,s.jsx)(T,{changes:I.changes,selectedFile:D,viewMode:P})})]})]}),I&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p.Z,{}),(0,s.jsx)(O,{summary:I.summary})]}),(0,s.jsx)(p.Z,{}),(0,s.jsxs)(c.Z,{sx:{px:2,py:1.5,flexShrink:0},children:[k&&(0,s.jsx)(l.Z,{onClick:L,variant:"outlined",color:"warning",startIcon:(0,s.jsx)(Z.Z,{}),disabled:W,children:"Restore to Snapshot A"}),(0,s.jsx)(d.Z,{sx:{flex:1}}),(0,s.jsx)(l.Z,{onClick:S,variant:"contained",children:"Close"})]})]})}},56831:function(e,n,t){t.d(n,{zO:function(){return P},Fb:function(){return et},JZ:function(){return W},Ff:function(){return G},Xj:function(){return h},zg:function(){return eZ},Dm:function(){return ed},gE:function(){return ey},ed:function(){return eh.e}});var s=t(94655),a=t(628),l=t(41565),i=t(31317),r=t(7281),o=t(25333),c=t(46207),d=t(43436),u=t(92666);function h(){let{data:e,isLoading:n,error:t}=(0,u.mj)();if(n)return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup Status"}),(0,s.jsx)(i.Z,{color:"text.secondary",children:"Loading..."})]})});if(t)return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup Status"}),(0,s.jsx)(i.Z,{color:"error",children:"Failed to load backup status"})]})});let{configured:h,lastBackup:x,repository:m}=e||{};return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,s.jsx)(i.Z,{variant:"h6",children:"Backup Status"}),(0,s.jsx)(o.Z,{icon:h?(0,s.jsx)(c.Z,{}):(0,s.jsx)(d.Z,{}),label:h?"Configured":"Not Configured",color:h?"success":"error",size:"small"})]}),h?(0,s.jsxs)(r.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:[m&&(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Repository"}),(0,s.jsx)(i.Z,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.875rem"},children:m})]}),x&&(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Last Backup"}),(0,s.jsx)(i.Z,{variant:"body2",children:function(e){let n=new Date,t=new Date(e),s=Math.floor((n.getTime()-t.getTime())/6e4),a=Math.floor(s/60);return s<1?"just now":s<60?"".concat(s," minutes ago"):a<24?"".concat(a," hours ago"):"".concat(Math.floor(a/24)," days ago")}(x)})]}),!x&&(0,s.jsx)(i.Z,{variant:"body2",color:"text.secondary",children:"No backups yet"})]}):(0,s.jsx)(i.Z,{variant:"body2",color:"text.secondary",children:"GitHub backup is not configured. Please configure BACKUP_REPO_URL in your environment."})]})})}var x=t(35106),m=t(21138),p=t(84811),f=t(47001),j=t(53281),g=t(11254),Z=t(70366),v=t(79983),y=t(97731),b=t(30417),C=t(99770),S=t(76678),k=t(5682),w=t(65087),z=t(62508),D=t(81071),A=t(93017);function B(e){var n;let{open:t,commit:a,onClose:l}=e,{mutate:o,isPending:c}=(0,u.s8)(),[d,h]=(0,x.useState)(""),[m,p]=(0,x.useState)(""),f=()=>{c||(h(""),p(""),l())};return(0,s.jsxs)(C.Z,{open:t,onClose:f,maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(z.Z,{children:"Restore Backup"}),(0,s.jsxs)(k.Z,{children:[(0,s.jsx)(D.Z,{severity:"warning",sx:{mb:2},children:"This will restore all worlds from the selected backup. Current world data will be overwritten."}),d&&(0,s.jsx)(D.Z,{severity:"success",sx:{mb:2},children:d}),m&&(0,s.jsx)(D.Z,{severity:"error",sx:{mb:2},children:m}),(0,s.jsx)(w.Z,{sx:{mb:2},children:"Are you sure you want to restore from this backup?"}),(0,s.jsxs)(r.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:[(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Commit Hash"}),(0,s.jsx)(i.Z,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.875rem"},children:a.hash})]}),(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Date"}),(0,s.jsx)(i.Z,{variant:"body2",children:(n=a.date,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(n)))})]}),(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Message"}),(0,s.jsx)(i.Z,{variant:"body2",children:a.message})]}),(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Author"}),(0,s.jsx)(i.Z,{variant:"body2",children:a.author})]})]})]}),(0,s.jsxs)(S.Z,{children:[(0,s.jsx)(b.Z,{onClick:f,disabled:c,children:"Cancel"}),(0,s.jsx)(b.Z,{onClick:()=>{h(""),p(""),o(a.hash,{onSuccess:()=>{h("Backup restored successfully from ".concat(a.hash.substring(0,7))),setTimeout(()=>{l()},2e3)},onError:e=>{p("Failed to restore backup: ".concat(e.message))}})},variant:"contained",color:"warning",disabled:c,startIcon:c?(0,s.jsx)(A.Z,{size:16}):(0,s.jsx)(y.Z,{}),children:c?"Restoring...":"Restore"})]})]})}function P(){let{data:e,isLoading:n,error:t}=(0,u.$t)(20),[r,c]=(0,x.useState)(null),d=e=>{c(e)};if(n)return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),(0,s.jsx)(i.Z,{color:"text.secondary",children:"Loading..."})]})});if(t)return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),(0,s.jsx)(i.Z,{color:"error",children:"Failed to load backup history"})]})});let h=(null==e?void 0:e.commits)||[];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),0===h.length?(0,s.jsx)(i.Z,{color:"text.secondary",children:"No backup history available"}):(0,s.jsx)(j.Z,{children:(0,s.jsxs)(m.Z,{children:[(0,s.jsx)(g.Z,{children:(0,s.jsxs)(Z.Z,{children:[(0,s.jsx)(f.Z,{children:"Commit"}),(0,s.jsx)(f.Z,{children:"Date"}),(0,s.jsx)(f.Z,{children:"Message"}),(0,s.jsx)(f.Z,{children:"Author"}),(0,s.jsx)(f.Z,{align:"right",children:"Actions"})]})}),(0,s.jsx)(p.Z,{children:h.map(e=>{var n;return(0,s.jsxs)(Z.Z,{children:[(0,s.jsx)(f.Z,{children:(0,s.jsx)(o.Z,{label:e.hash.substring(0,7),size:"small",variant:"outlined",sx:{fontFamily:"monospace"}})}),(0,s.jsx)(f.Z,{children:(0,s.jsx)(i.Z,{variant:"body2",children:(n=e.date,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(n)))})}),(0,s.jsx)(f.Z,{children:(0,s.jsx)(i.Z,{variant:"body2",children:e.message})}),(0,s.jsx)(f.Z,{children:(0,s.jsx)(i.Z,{variant:"body2",color:"text.secondary",children:e.author})}),(0,s.jsx)(f.Z,{align:"right",children:(0,s.jsx)(v.Z,{size:"small",color:"primary",onClick:()=>d(e),title:"Restore this backup",children:(0,s.jsx)(y.Z,{})})})]},e.hash)})})]})})]})}),r&&(0,s.jsx)(B,{open:!!r,commit:r,onClose:()=>{c(null)}})]})}var F=t(97436),I=t(34675);function W(e){let{disabled:n}=e,[t,a]=(0,x.useState)(!1),[l,i]=(0,x.useState)(""),[r,o]=(0,x.useState)(""),[c,d]=(0,x.useState)(""),{mutate:h,isPending:m}=(0,u.c5)(),p=()=>{m||(a(!1),i(""),o(""),d(""))};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(b.Z,{variant:"contained",startIcon:(0,s.jsx)(I.Z,{}),onClick:()=>{a(!0),o(""),d(""),i("Backup ".concat(new Date().toISOString().split("T")[0]))},disabled:n||m,children:"Push Backup"}),(0,s.jsxs)(C.Z,{open:t,onClose:p,maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(z.Z,{children:"Push Backup"}),(0,s.jsxs)(k.Z,{children:[r&&(0,s.jsx)(D.Z,{severity:"success",sx:{mb:2},children:r}),c&&(0,s.jsx)(D.Z,{severity:"error",sx:{mb:2},children:c}),(0,s.jsx)(F.Z,{autoFocus:!0,margin:"dense",label:"Commit Message",type:"text",fullWidth:!0,variant:"outlined",value:l,onChange:e=>i(e.target.value),disabled:m,helperText:"Optional message describing this backup"})]}),(0,s.jsxs)(S.Z,{children:[(0,s.jsx)(b.Z,{onClick:p,disabled:m,children:"Cancel"}),(0,s.jsx)(b.Z,{onClick:()=>{o(""),d(""),h({message:l||void 0},{onSuccess:e=>{o(e.commitHash?"Backup pushed successfully (".concat(e.commitHash.substring(0,7),")"):"Backup pushed successfully"),setTimeout(()=>{p()},2e3)},onError:e=>{d("Failed to push backup: ".concat(e.message))}})},variant:"contained",disabled:m,startIcon:m?(0,s.jsx)(A.Z,{size:16}):(0,s.jsx)(I.Z,{}),children:m?"Pushing...":"Push"})]})]})]})}var T=t(38393),E=t(70115),N=t(95511),R=t(69123),M=t(32366),q=t(45813),L=t(21111),U=t(54211),H=t(29793),O=t(75726),K=t(62328),V=t(7178);let $=[{label:"Every hour",value:"0 * * * *"},{label:"Every 6 hours",value:"0 */6 * * *"},{label:"Every 12 hours",value:"0 */12 * * *"},{label:"Daily at 3 AM",value:"0 3 * * *"},{label:"Weekly (Sunday 3 AM)",value:"0 3 * * 0"},{label:"Custom",value:"custom"}];function J(e){let{open:n,schedule:t,onClose:a}=e,l=(0,u.tT)(),c=(0,u.CA)(),d=!!t,[h,m]=(0,x.useState)(""),[p,f]=(0,x.useState)(""),[j,g]=(0,x.useState)(""),[Z,v]=(0,x.useState)(""),[y,w]=(0,x.useState)(""),[A,B]=(0,x.useState)("");(0,x.useEffect)(()=>{if(n){if(t){var e,s,a,l;m(t.name);let n=$.find(e=>e.value===t.cronExpression);n?(f(n.value),g("")):(f("custom"),g(t.cronExpression)),v(null!==(a=null===(e=t.retentionPolicy.maxCount)||void 0===e?void 0:e.toString())&&void 0!==a?a:""),w(null!==(l=null===(s=t.retentionPolicy.maxAgeDays)||void 0===s?void 0:s.toString())&&void 0!==l?l:"")}else m(""),f("0 3 * * *"),g(""),v("10"),w("30");B("")}},[n,t]);let P=()=>"custom"===p?j.trim():p,I=async()=>{B("");let e=P();if(!h.trim()){B("Name is required");return}if(!e){B("Cron expression is required");return}try{d&&t?await c.mutateAsync({id:t.id,data:{name:h.trim(),cron:e,...Z?{maxCount:parseInt(Z,10)}:{},...y?{maxAgeDays:parseInt(y,10)}:{}}}):await l.mutateAsync({name:h.trim(),cron:e,...Z?{maxCount:parseInt(Z,10)}:{},...y?{maxAgeDays:parseInt(y,10)}:{},enabled:!0}),a()}catch(e){B(e.message||"Failed to save schedule")}},W=l.isPending||c.isPending;return(0,s.jsxs)(C.Z,{open:n,onClose:a,maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(z.Z,{children:d?"Edit Backup Schedule":"Create Backup Schedule"}),(0,s.jsx)(k.Z,{children:(0,s.jsxs)(E.Z,{spacing:2.5,sx:{mt:1},children:[A&&(0,s.jsx)(D.Z,{severity:"error",onClose:()=>B(""),children:A}),(0,s.jsx)(F.Z,{label:"Schedule Name",value:h,onChange:e=>m(e.target.value),fullWidth:!0,required:!0,placeholder:"e.g., Daily backup, Hourly snapshot",autoFocus:!0}),(0,s.jsxs)(H.Z,{fullWidth:!0,children:[(0,s.jsx)(O.Z,{children:"Schedule Frequency"}),(0,s.jsx)(K.Z,{value:p,onChange:e=>f(e.target.value),label:"Schedule Frequency",children:$.map(e=>(0,s.jsxs)(V.Z,{value:e.value,children:[e.label,"custom"!==e.value&&(0,s.jsx)(o.Z,{label:e.value,size:"small",variant:"outlined",sx:{ml:1,fontFamily:"monospace",fontSize:"0.75rem"}})]},e.value))})]}),"custom"===p&&(0,s.jsx)(F.Z,{label:"Cron Expression",value:j,onChange:e=>g(e.target.value),fullWidth:!0,required:!0,placeholder:"e.g., 0 */6 * * *",helperText:"Format: minute hour day-of-month month day-of-week",InputProps:{sx:{fontFamily:"monospace"}}}),(0,s.jsx)(i.Z,{variant:"subtitle2",color:"text.secondary",sx:{mt:1},children:"Retention Policy (optional)"}),(0,s.jsxs)(r.Z,{sx:{display:"flex",gap:2},children:[(0,s.jsx)(F.Z,{label:"Max Backup Count",type:"number",value:Z,onChange:e=>v(e.target.value),fullWidth:!0,placeholder:"e.g., 10",inputProps:{min:1},helperText:"Keep at most N backups"}),(0,s.jsx)(F.Z,{label:"Max Age (days)",type:"number",value:y,onChange:e=>w(e.target.value),fullWidth:!0,placeholder:"e.g., 30",inputProps:{min:1},helperText:"Delete backups older than N days"})]})]})}),(0,s.jsxs)(S.Z,{children:[(0,s.jsx)(b.Z,{onClick:a,disabled:W,children:"Cancel"}),(0,s.jsx)(b.Z,{onClick:I,variant:"contained",disabled:W,children:W?"Saving...":d?"Update":"Create"})]})]})}function Q(e){let n=new Date,t=new Date(e),s=Math.floor((n.getTime()-t.getTime())/6e4),a=Math.floor(s/60);return s<1?"just now":s<60?"".concat(s,"m ago"):a<24?"".concat(a,"h ago"):"".concat(Math.floor(a/24),"d ago")}function _(e){let{schedule:n,onEdit:t,onDelete:a,onToggle:l,toggleLoading:u}=e;return(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:1.5,px:1,"&:hover":{bgcolor:"action.hover",borderRadius:1}},children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:2,flex:1,minWidth:0},children:[(0,s.jsx)(U.Z,{color:n.enabled?"primary":"disabled"}),(0,s.jsxs)(r.Z,{sx:{minWidth:0},children:[(0,s.jsx)(i.Z,{variant:"body1",fontWeight:"medium",noWrap:!0,children:n.name}),(0,s.jsxs)(i.Z,{variant:"caption",color:"text.secondary",noWrap:!0,children:[n.cronHumanReadable," (",n.cronExpression,")"]})]})]}),(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0},children:[n.lastRunStatus&&(0,s.jsx)(N.Z,{title:n.lastRunMessage?"".concat(n.lastRunAt?Q(n.lastRunAt):"",": ").concat(n.lastRunMessage):n.lastRunAt?Q(n.lastRunAt):"",children:(0,s.jsx)(o.Z,{icon:"success"===n.lastRunStatus?(0,s.jsx)(c.Z,{sx:{fontSize:16}}):(0,s.jsx)(d.Z,{sx:{fontSize:16}}),label:"success"===n.lastRunStatus?"OK":"Failed",size:"small",color:"success"===n.lastRunStatus?"success":"error",variant:"outlined"})}),(n.retentionPolicy.maxCount||n.retentionPolicy.maxAgeDays)&&(0,s.jsx)(N.Z,{title:[n.retentionPolicy.maxCount&&"Max ".concat(n.retentionPolicy.maxCount," backups"),n.retentionPolicy.maxAgeDays&&"Max ".concat(n.retentionPolicy.maxAgeDays," days")].filter(Boolean).join(", "),children:(0,s.jsx)(o.Z,{label:"Retention",size:"small",variant:"outlined",color:"info"})}),(0,s.jsx)(N.Z,{title:n.enabled?"Disable schedule":"Enable schedule",children:(0,s.jsx)(T.Z,{size:"small",checked:n.enabled,onChange:(e,t)=>l(n,t),disabled:u})}),(0,s.jsx)(N.Z,{title:"Edit schedule",children:(0,s.jsx)(v.Z,{size:"small",onClick:()=>t(n),children:(0,s.jsx)(q.Z,{fontSize:"small"})})}),(0,s.jsx)(N.Z,{title:"Delete schedule",children:(0,s.jsx)(v.Z,{size:"small",color:"error",onClick:()=>a(n),children:(0,s.jsx)(L.Z,{fontSize:"small"})})})]})]})}function G(){var e;let{data:n,isLoading:t,error:o}=(0,u.d)(),c=(0,u.c1)(),d=(0,u.JV)(),[h,m]=(0,x.useState)(!1),[p,f]=(0,x.useState)(null),[j,g]=(0,x.useState)(!1),[Z,v]=(0,x.useState)(null),y=e=>{f(e),m(!0)},w=e=>{v(e),g(!0)},A=async()=>{if(Z)try{await d.mutateAsync(Z.id)}catch(e){}g(!1),v(null)},B=(e,n)=>{c.mutate({id:e.id,enabled:n})};if(t)return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup Schedules"}),(0,s.jsx)(i.Z,{color:"text.secondary",children:"Loading..."})]})});if(o)return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup Schedules"}),(0,s.jsx)(D.Z,{severity:"error",children:"Failed to load backup schedules"})]})});let P=null!==(e=null==n?void 0:n.schedules)&&void 0!==e?e:[];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",children:"Backup Schedules"}),(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Automated cron-based backup scheduling"})]}),(0,s.jsx)(b.Z,{variant:"contained",size:"small",startIcon:(0,s.jsx)(M.Z,{}),onClick:()=>{f(null),m(!0)},children:"Add Schedule"})]}),0===P.length?(0,s.jsxs)(r.Z,{sx:{textAlign:"center",py:4},children:[(0,s.jsx)(U.Z,{sx:{fontSize:48,color:"text.disabled",mb:1}}),(0,s.jsx)(i.Z,{color:"text.secondary",children:"No backup schedules configured"}),(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Create a schedule to automatically back up your worlds"})]}):(0,s.jsx)(E.Z,{divider:(0,s.jsx)(R.Z,{}),children:P.map(e=>(0,s.jsx)(_,{schedule:e,onEdit:y,onDelete:w,onToggle:B,toggleLoading:c.isPending},e.id))})]})}),(0,s.jsx)(J,{open:h,schedule:p,onClose:()=>{m(!1),f(null)}}),(0,s.jsxs)(C.Z,{open:j,onClose:()=>g(!1),children:[(0,s.jsx)(z.Z,{children:"Delete Backup Schedule"}),(0,s.jsx)(k.Z,{children:(0,s.jsxs)(i.Z,{children:['Are you sure you want to delete the schedule "',null==Z?void 0:Z.name,'"? This action cannot be undone.']})}),(0,s.jsxs)(S.Z,{children:[(0,s.jsx)(b.Z,{onClick:()=>g(!1),children:"Cancel"}),(0,s.jsx)(b.Z,{onClick:A,color:"error",variant:"contained",disabled:d.isPending,children:d.isPending?"Deleting...":"Delete"})]})]})]})}var Y=t(33402),X=t(60097),ee=t(91606),en=t(45420);function et(e){let{value:n,onChange:t}=e;return(0,s.jsx)(r.Z,{sx:{borderBottom:1,borderColor:"divider",mb:3},children:(0,s.jsxs)(Y.Z,{value:n,onChange:(e,n)=>t(n),"aria-label":"Backup management tabs",children:[(0,s.jsx)(X.Z,{value:"world-backups",label:"World Backups",icon:(0,s.jsx)(ee.Z,{}),iconPosition:"start",sx:{textTransform:"none",fontWeight:"medium"}}),(0,s.jsx)(X.Z,{value:"config-snapshots",label:"Config Snapshots",icon:(0,s.jsx)(en.Z,{}),iconPosition:"start",sx:{textTransform:"none",fontWeight:"medium"}})]})})}var es=t(73517),ea=t(87739),el=t(12063),ei=t(88978),er=t(27171),eo=t(80620),ec=t(86071);function ed(e){let{serverName:n,snapshots:t,totalCount:d,schedule:u,onViewHistory:h,onCreateSnapshot:x,onViewDiff:m}=e,p=t.length>0?t[0]:null,f=t.length>=2;return(0,s.jsx)(a.Z,{variant:"outlined",sx:{"&:hover":{borderColor:"primary.main"}},children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(r.Z,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:1.5,mb:1},children:[(0,s.jsx)(er.Z,{color:"primary"}),(0,s.jsx)(i.Z,{variant:"h6",component:"h3",fontWeight:"bold",children:n})]})}),(0,s.jsxs)(E.Z,{direction:"row",spacing:2,sx:{mb:2,flexWrap:"wrap",gap:1},children:[p?(0,s.jsx)(N.Z,{title:"Latest: ".concat(new Date(p.createdAt).toLocaleString()),children:(0,s.jsx)(o.Z,{icon:(0,s.jsx)(eo.Z,{sx:{fontSize:16}}),label:"Latest: ".concat(function(e){let n=new Date,t=new Date(e),s=Math.floor((n.getTime()-t.getTime())/6e4),a=Math.floor(s/60),l=Math.floor(a/24);return s<1?"just now":s<60?"".concat(s,"m ago"):a<24?"".concat(a,"h ago"):l<30?"".concat(l,"d ago"):t.toLocaleDateString()}(p.createdAt)),size:"small",variant:"outlined"})}):(0,s.jsx)(o.Z,{label:"No snapshots yet",size:"small",variant:"outlined",color:"default"}),p&&(0,s.jsx)(o.Z,{label:"".concat(p.files.length," files"),size:"small",variant:"outlined",color:"info"}),(0,s.jsx)(o.Z,{label:"".concat(d," snapshot").concat(1!==d?"s":""," total"),size:"small",variant:"outlined"}),u?(0,s.jsx)(N.Z,{title:"Schedule: ".concat(u.name," (").concat(u.cronExpression,")"),children:(0,s.jsx)(o.Z,{icon:u.enabled?(0,s.jsx)(c.Z,{sx:{fontSize:16}}):(0,s.jsx)(U.Z,{sx:{fontSize:16}}),label:u.enabled?"Schedule: Active":"Schedule: Paused",size:"small",variant:"outlined",color:u.enabled?"success":"default"})}):(0,s.jsx)(o.Z,{label:"No schedule",size:"small",variant:"outlined",color:"default"})]}),(0,s.jsxs)(E.Z,{direction:"row",spacing:1,children:[(0,s.jsx)(b.Z,{size:"small",variant:"outlined",startIcon:(0,s.jsx)(eo.Z,{}),onClick:()=>h(n),disabled:0===d,children:"View History"}),(0,s.jsx)(b.Z,{size:"small",variant:"outlined",startIcon:(0,s.jsx)(es.Z,{}),onClick:()=>x(n),children:"Create Snapshot"}),f&&(0,s.jsx)(b.Z,{size:"small",variant:"outlined",startIcon:(0,s.jsx)(ec.Z,{}),onClick:()=>m(n),children:"View Diff"})]})]})})}function eu(e){let{servers:n,snapshotsByServer:t,schedules:a,isLoading:l,error:o,onViewHistory:c,onCreateSnapshot:d,onViewDiff:u}=e,h=(0,x.useMemo)(()=>n.map(e=>{var n,s;let l=t.get(e.name),i=a.find(n=>n.serverName===e.name);return{serverName:e.name,snapshots:null!==(n=null==l?void 0:l.snapshots)&&void 0!==n?n:[],totalCount:null!==(s=null==l?void 0:l.total)&&void 0!==s?s:0,schedule:i}}),[n,t,a]);return l?(0,s.jsx)(r.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,s.jsx)(A.Z,{})}):o?(0,s.jsxs)(D.Z,{severity:"error",children:["Failed to load config snapshots: ",o.message]}):0===n.length?(0,s.jsxs)(r.Z,{sx:{textAlign:"center",py:6},children:[(0,s.jsx)(en.Z,{sx:{fontSize:48,color:"text.disabled",mb:1}}),(0,s.jsx)(i.Z,{color:"text.secondary",children:"No servers found"}),(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Create a server to start taking config snapshots"})]}):(0,s.jsx)(E.Z,{spacing:2,children:h.map(e=>(0,s.jsx)(ed,{serverName:e.serverName,snapshots:e.snapshots,totalCount:e.totalCount,schedule:e.schedule,onViewHistory:c,onCreateSnapshot:d,onViewDiff:u},e.serverName))})}var eh=t(6516),ex=t(62142),em=t(71185);function ep(e){let{schedule:n,onEdit:t,onDelete:a,onToggle:l,toggleLoading:u}=e;return(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:1.5,px:1,"&:hover":{bgcolor:"action.hover",borderRadius:1}},children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:2,flex:1,minWidth:0},children:[(0,s.jsx)(U.Z,{color:n.enabled?"primary":"disabled"}),(0,s.jsxs)(r.Z,{sx:{minWidth:0},children:[(0,s.jsx)(i.Z,{variant:"body2",fontWeight:"medium",noWrap:!0,children:n.name}),(0,s.jsxs)(i.Z,{variant:"caption",color:"text.secondary",noWrap:!0,children:[n.serverName," | ",n.cronExpression," | Retain: ",n.retentionCount]})]})]}),(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:1,flexShrink:0},children:[n.lastRunStatus&&(0,s.jsx)(N.Z,{title:n.lastRunAt?"Last run: ".concat(function(e){let n=new Date,t=new Date(e),s=Math.floor((n.getTime()-t.getTime())/6e4),a=Math.floor(s/60);return s<1?"just now":s<60?"".concat(s,"m ago"):a<24?"".concat(a,"h ago"):"".concat(Math.floor(a/24),"d ago")}(n.lastRunAt)," (").concat(n.lastRunStatus,")"):n.lastRunStatus,children:(0,s.jsx)(o.Z,{icon:"success"===n.lastRunStatus?(0,s.jsx)(c.Z,{sx:{fontSize:16}}):(0,s.jsx)(d.Z,{sx:{fontSize:16}}),label:"success"===n.lastRunStatus?"OK":"Failed",size:"small",color:"success"===n.lastRunStatus?"success":"error",variant:"outlined"})}),(0,s.jsx)(N.Z,{title:n.enabled?"Disable schedule":"Enable schedule",children:(0,s.jsx)(T.Z,{size:"small",checked:n.enabled,onChange:(e,t)=>l(n,t),disabled:u})}),(0,s.jsx)(N.Z,{title:"Edit schedule",children:(0,s.jsx)(v.Z,{size:"small",onClick:()=>t(n),children:(0,s.jsx)(q.Z,{fontSize:"small"})})}),(0,s.jsx)(N.Z,{title:"Delete schedule",children:(0,s.jsx)(v.Z,{size:"small",color:"error",onClick:()=>a(n),children:(0,s.jsx)(L.Z,{fontSize:"small"})})})]})]})}function ef(e){let{schedules:n,onEdit:t,onDelete:a,onToggle:l,toggleLoading:o}=e;return 0===n.length?(0,s.jsxs)(r.Z,{sx:{textAlign:"center",py:3},children:[(0,s.jsx)(U.Z,{sx:{fontSize:40,color:"text.disabled",mb:1}}),(0,s.jsx)(i.Z,{color:"text.secondary",variant:"body2",children:"No config snapshot schedules configured"})]}):(0,s.jsx)(E.Z,{divider:(0,s.jsx)(R.Z,{}),children:n.map(e=>(0,s.jsx)(ep,{schedule:e,onEdit:t,onDelete:a,onToggle:l,toggleLoading:o},e.id))})}let ej=[{label:"Every hour",value:"0 * * * *"},{label:"Every 6 hours",value:"0 */6 * * *"},{label:"Daily at midnight",value:"0 0 * * *"},{label:"Daily at 3 AM",value:"0 3 * * *"},{label:"Weekly (Sunday midnight)",value:"0 0 * * 0"},{label:"Custom",value:""}];function eg(e){var n;let{serverNames:t,editingSchedule:a,onSubmit:l,onUpdate:o,onCancel:c,isSubmitting:d,error:u}=e,h=!!a,[m,p]=(0,x.useState)((null==a?void 0:a.serverName)||""),[f,j]=(0,x.useState)((null==a?void 0:a.name)||""),[g,Z]=(0,x.useState)(""),[v,y]=(0,x.useState)((null==a?void 0:a.cronExpression)||"0 0 * * *"),[C,S]=(0,x.useState)(null!==(n=null==a?void 0:a.retentionCount)&&void 0!==n?n:10);(0,x.useEffect)(()=>{let e=ej.find(e=>e.value===v);Z(e?e.value:"")},[v]),(0,x.useEffect)(()=>{a?(p(a.serverName),j(a.name),y(a.cronExpression),S(a.retentionCount)):(p(""),j(""),y("0 0 * * *"),S(10))},[a]);let k=e=>{Z(e),e&&y(e)},w=(h||m)&&f.trim()&&v.trim();return(0,s.jsxs)(r.Z,{sx:{display:"flex",flexDirection:"column",gap:2},children:[(0,s.jsx)(i.Z,{variant:"subtitle2",color:"text.secondary",children:h?"Edit Schedule":"Create New Schedule"}),!h&&(0,s.jsxs)(H.Z,{fullWidth:!0,size:"small",required:!0,children:[(0,s.jsx)(O.Z,{children:"Server"}),(0,s.jsx)(K.Z,{value:m,onChange:e=>p(e.target.value),label:"Server",disabled:d,children:t.map(e=>(0,s.jsx)(V.Z,{value:e,children:e},e))})]}),(0,s.jsx)(F.Z,{label:"Schedule Name",value:f,onChange:e=>j(e.target.value),placeholder:"e.g., Daily config backup",size:"small",fullWidth:!0,required:!0,disabled:d}),(0,s.jsxs)(H.Z,{fullWidth:!0,size:"small",children:[(0,s.jsx)(O.Z,{children:"Cron Preset"}),(0,s.jsx)(K.Z,{value:g,onChange:e=>k(e.target.value),label:"Cron Preset",disabled:d,children:ej.map(e=>(0,s.jsx)(V.Z,{value:e.value,children:e.label},e.label))})]}),(0,s.jsx)(F.Z,{label:"Cron Expression",value:v,onChange:e=>y(e.target.value),placeholder:"0 0 * * *",size:"small",fullWidth:!0,required:!0,disabled:d,helperText:"Standard cron format: minute hour day month weekday"}),(0,s.jsx)(F.Z,{label:"Retention Count",type:"number",value:C,onChange:e=>S(Math.max(1,parseInt(e.target.value)||1)),size:"small",fullWidth:!0,disabled:d,helperText:"Maximum number of scheduled snapshots to keep per server",inputProps:{min:1,max:100}}),u&&(0,s.jsx)(D.Z,{severity:"error",sx:{py:0},children:u}),(0,s.jsxs)(r.Z,{sx:{display:"flex",gap:1,justifyContent:"flex-end"},children:[(0,s.jsx)(b.Z,{size:"small",onClick:c,disabled:d,children:"Cancel"}),(0,s.jsx)(b.Z,{size:"small",variant:"contained",onClick:()=>{h&&o?o({name:f.trim(),cronExpression:v,retentionCount:C}):l({serverName:m,name:f.trim(),cronExpression:v,retentionCount:C})},disabled:!w||d,children:d?"Saving...":h?"Update":"Create"})]})]})}function eZ(e){var n,t,a;let{open:l,onClose:o,serverNames:c,filterServerName:d}=e,{data:u,isLoading:h,error:m}=(0,ei.F$)(d),p=(0,ei.wh)(),f=(0,ei.Uw)(),j=(0,ei.DW)(),g=(0,ei.$C)(),[Z,y]=(0,x.useState)(!1),[w,B]=(0,x.useState)(null),[P,F]=(0,x.useState)(!1),[I,W]=(0,x.useState)(null),T=null!==(a=null==u?void 0:u.schedules)&&void 0!==a?a:[],E=async()=>{if(I)try{await g.mutateAsync(I.id)}catch(e){}F(!1),W(null)},N=async e=>{try{await p.mutateAsync({serverName:e.serverName,name:e.name,cronExpression:e.cronExpression,retentionCount:e.retentionCount}),y(!1)}catch(e){}},q=async e=>{if(w)try{await f.mutateAsync({id:w.id,data:e}),y(!1),B(null)}catch(e){}},L=(null===(n=p.error)||void 0===n?void 0:n.message)||(null===(t=f.error)||void 0===t?void 0:t.message)||null;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ex.ZP,{anchor:"right",open:l,onClose:o,PaperProps:{sx:{width:{xs:"100%",sm:480},p:3}},children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,s.jsx)(i.Z,{variant:"h6",fontWeight:"bold",children:"Config Snapshot Schedules"}),(0,s.jsx)(v.Z,{onClick:o,size:"small",children:(0,s.jsx)(em.Z,{})})]}),(0,s.jsx)(R.Z,{sx:{mb:2}}),!Z&&(0,s.jsx)(b.Z,{variant:"outlined",startIcon:(0,s.jsx)(M.Z,{}),onClick:()=>{B(null),y(!0)},fullWidth:!0,sx:{mb:2},children:"Add Schedule"}),Z&&(0,s.jsxs)(r.Z,{sx:{mb:2},children:[(0,s.jsx)(eg,{serverNames:c,editingSchedule:w,onSubmit:N,onUpdate:q,onCancel:()=>{y(!1),B(null),p.reset(),f.reset()},isSubmitting:p.isPending||f.isPending,error:L}),(0,s.jsx)(R.Z,{sx:{mt:2}})]}),h?(0,s.jsx)(r.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,s.jsx)(A.Z,{})}):m?(0,s.jsx)(D.Z,{severity:"error",children:"Failed to load schedules"}):(0,s.jsx)(ef,{schedules:T,onEdit:e=>{B(e),y(!0)},onDelete:e=>{W(e),F(!0)},onToggle:(e,n)=>{j.mutate({id:e.id,enabled:n})},toggleLoading:j.isPending})]}),(0,s.jsxs)(C.Z,{open:P,onClose:()=>F(!1),children:[(0,s.jsx)(z.Z,{children:"Delete Config Snapshot Schedule"}),(0,s.jsx)(k.Z,{children:(0,s.jsxs)(i.Z,{children:['Are you sure you want to delete the schedule "',null==I?void 0:I.name,'"? Existing snapshots created by this schedule will be preserved.']})}),(0,s.jsxs)(S.Z,{children:[(0,s.jsx)(b.Z,{onClick:()=>F(!1),children:"Cancel"}),(0,s.jsx)(b.Z,{onClick:E,color:"error",variant:"contained",disabled:g.isPending,children:g.isPending?"Deleting...":"Delete"})]})]})]})}var ev=t(84728);function ey(){var e,n;let{data:t,isLoading:a}=(0,u.x$)(),l=null!==(e=null==t?void 0:t.servers)&&void 0!==e?e:[],o=l.map(e=>e.name),{snapshotsByServer:c,isLoading:d,error:h}=function(e){var n;let t=e.map(e=>({name:e,query:(0,el.m)(e,5,0,{enabled:!!e})})),s=t.some(e=>e.query.isLoading),a=(null===(n=t.find(e=>e.query.error))||void 0===n?void 0:n.query.error)||null;return{snapshotsByServer:(0,x.useMemo)(()=>{let e=new Map;for(let n of t)n.query.data&&e.set(n.name,{snapshots:n.query.data.snapshots,total:n.query.data.total});return e},[t]),isLoading:s,error:a}}(o),{data:m}=(0,ei.F$)(),p=null!==(n=null==m?void 0:m.schedules)&&void 0!==n?n:[],[f,j]=(0,x.useState)(!1),[g,Z]=(0,x.useState)(void 0),[v,y]=(0,x.useState)(!1),[C,S]=(0,x.useState)(!1),[k,w]=(0,x.useState)(""),z=(0,x.useMemo)(()=>{if(!k)return{snapshotA:null,snapshotB:null};let e=c.get(k);return!e||e.snapshots.length<2?{snapshotA:null,snapshotB:null}:{snapshotA:e.snapshots[1],snapshotB:e.snapshots[0]}},[k,c]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",justifyContent:"flex-end",gap:1,mb:2},children:[(0,s.jsx)(b.Z,{variant:"outlined",size:"small",startIcon:(0,s.jsx)(ea.Z,{}),onClick:()=>y(!0),children:"Manage Schedules"}),(0,s.jsx)(b.Z,{variant:"contained",size:"small",startIcon:(0,s.jsx)(es.Z,{}),onClick:()=>{Z(void 0),j(!0)},children:"Create Snapshot"})]}),(0,s.jsx)(i.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,s.jsx)(eu,{servers:l,snapshotsByServer:c,schedules:p,isLoading:a||d,error:h,onViewHistory:e=>{let n=c.get(e);n&&n.snapshots.length>0&&(w(e),S(!0))},onCreateSnapshot:e=>{Z(e),j(!0)},onViewDiff:e=>{w(e),S(!0)}}),(0,s.jsx)(eh.e,{open:f,onClose:()=>{j(!1),Z(void 0)},serverNames:o,defaultServer:g}),(0,s.jsx)(eZ,{open:v,onClose:()=>y(!1),serverNames:o}),C&&z.snapshotA&&z.snapshotB&&(0,s.jsx)(ev.YN,{open:C,onClose:()=>{S(!1),w("")},snapshotA:z.snapshotA,snapshotB:z.snapshotB})]})}},72205:function(e,n,t){t.d(n,{m:function(){return l}});var s=t(98324),a=t(42936);function l(e,n,t){return(0,s.a)({queryKey:["config-snapshots","diff",e,n],queryFn:()=>(0,a.SC)("/api/config-snapshots/".concat(encodeURIComponent(e),"/diff/").concat(encodeURIComponent(n))),enabled:(null==t?void 0:t.enabled)!==!1&&!!e&&!!n,staleTime:3e5})}},88978:function(e,n,t){t.d(n,{$C:function(){return u},DW:function(){return d},F$:function(){return r},Uw:function(){return c},wh:function(){return o}});var s=t(98324),a=t(58919),l=t(20367),i=t(42936);function r(e){let n=e?"?serverName=".concat(encodeURIComponent(e)):"";return(0,s.a)({queryKey:["config-snapshot-schedules",e||"all"],queryFn:()=>(0,i.SC)("/api/config-snapshot-schedules".concat(n)),refetchInterval:6e4})}function o(){let e=(0,a.NL)();return(0,l.D)({mutationFn:e=>(0,i.SC)("/api/config-snapshot-schedules",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config-snapshot-schedules"]})}})}function c(){let e=(0,a.NL)();return(0,l.D)({mutationFn:e=>{let{id:n,data:t}=e;return(0,i.SC)("/api/config-snapshot-schedules/".concat(encodeURIComponent(n)),{method:"PUT",body:JSON.stringify(t)})},onSuccess:()=>{e.invalidateQueries({queryKey:["config-snapshot-schedules"]})}})}function d(){let e=(0,a.NL)();return(0,l.D)({mutationFn:e=>{let{id:n,enabled:t}=e;return(0,i.SC)("/api/config-snapshot-schedules/".concat(encodeURIComponent(n),"/toggle"),{method:"PATCH",body:JSON.stringify({enabled:t})})},onSuccess:()=>{e.invalidateQueries({queryKey:["config-snapshot-schedules"]})}})}function u(){let e=(0,a.NL)();return(0,l.D)({mutationFn:e=>(0,i.SC)("/api/config-snapshot-schedules/".concat(encodeURIComponent(e)),{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["config-snapshot-schedules"]})}})}},12063:function(e,n,t){t.d(n,{m:function(){return r},t:function(){return o}});var s=t(98324),a=t(58919),l=t(20367),i=t(42936);function r(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3?arguments[3]:void 0;return(0,s.a)({queryKey:["config-snapshots","list",e,n,t],queryFn:()=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e),"/config-snapshots?limit=").concat(n,"&offset=").concat(t)),enabled:(null==a?void 0:a.enabled)!==!1&&!!e,refetchInterval:6e4})}function o(){let e=(0,a.NL)();return(0,l.D)({mutationFn:e=>{let{serverName:n,description:t}=e;return(0,i.SC)("/api/servers/".concat(encodeURIComponent(n),"/config-snapshots"),{method:"POST",body:JSON.stringify({description:t})})},onSuccess:(n,t)=>{let{serverName:s}=t;e.invalidateQueries({queryKey:["config-snapshots","list",s]}),e.invalidateQueries({queryKey:["config-snapshots"]})}})}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6831],{6516:function(e,n,t){t.d(n,{e:function(){return Z}});var s=t(94655),a=t(35106),l=t(99770),i=t(62508),r=t(5682),o=t(76678),c=t(30417),d=t(97436),u=t(29793),h=t(75726),x=t(62328),m=t(7178),p=t(81071),f=t(93017),j=t(7281),g=t(12063);function Z(e){var n;let{open:t,onClose:Z,serverNames:v,defaultServer:y}=e,[b,C]=(0,a.useState)(y||""),[S,k]=(0,a.useState)(""),w=(0,g.t)(),z=async()=>{if(b)try{await w.mutateAsync({serverName:b,description:S.trim()||void 0}),D()}catch(e){}},D=()=>{w.isPending||(C(y||""),k(""),w.reset(),Z())};return(0,s.jsxs)(l.Z,{open:t,onClose:D,maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(i.Z,{children:"Create Config Snapshot"}),(0,s.jsx)(r.Z,{children:(0,s.jsxs)(j.Z,{sx:{display:"flex",flexDirection:"column",gap:2,mt:1},children:[(0,s.jsxs)(u.Z,{fullWidth:!0,required:!0,children:[(0,s.jsx)(h.Z,{children:"Server"}),(0,s.jsx)(x.Z,{value:b,onChange:e=>C(e.target.value),label:"Server",disabled:w.isPending||!!y,children:v.map(e=>(0,s.jsx)(m.Z,{value:e,children:e},e))})]}),(0,s.jsx)(d.Z,{label:"Description (optional)",value:S,onChange:e=>k(e.target.value),placeholder:"e.g., Before modpack update",fullWidth:!0,disabled:w.isPending}),w.isError&&(0,s.jsx)(p.Z,{severity:"error",children:(null===(n=w.error)||void 0===n?void 0:n.message)||"Failed to create snapshot"}),w.isPending&&(0,s.jsx)(p.Z,{severity:"info",icon:(0,s.jsx)(f.Z,{size:20}),children:"Creating snapshot... This may take a moment."})]})}),(0,s.jsxs)(o.Z,{children:[(0,s.jsx)(c.Z,{onClick:D,disabled:w.isPending,children:"Cancel"}),(0,s.jsx)(c.Z,{onClick:z,variant:"contained",disabled:!b||w.isPending,children:w.isPending?"Creating...":"Create Snapshot"})]})]})}},84728:function(e,n,t){t.d(n,{YN:function(){return V}});var s=t(94655),a=t(35106),l=t(30417),i=t(99770),r=t(62508),o=t(5682),c=t(76678),d=t(7281),u=t(31317),h=t(81071),x=t(93017),m=t(79983),p=t(69123),f=t(44059),j=t(83855),g=t(71185),Z=t(97731),v=t(86071),y=t(72205),b=t(90158),C=t(49954),S=t(17820),k=t(73424),w=t(95511),z=t(73517),D=t(47254),A=t(43214);function B(e){let{changes:n,selectedFile:t,onSelectFile:l}=e,i=(0,a.useCallback)((e,t,s)=>{"ArrowUp"===e.key&&s>0?(e.preventDefault(),l(n[s-1].path)):"ArrowDown"===e.key&&s<n.length-1?(e.preventDefault(),l(n[s+1].path)):("Enter"===e.key||" "===e.key)&&(e.preventDefault(),l(t))},[n,l]);return 0===n.length?(0,s.jsx)(d.Z,{sx:{p:2},children:(0,s.jsx)(u.Z,{variant:"body2",color:"text.secondary",children:"No changes"})}):(0,s.jsxs)(d.Z,{sx:{height:"100%",overflow:"auto",borderRight:1,borderColor:"divider"},role:"tree","aria-label":"Changed files",children:[(0,s.jsxs)(u.Z,{variant:"caption",sx:{display:"block",px:2,py:1,color:"text.secondary",fontWeight:"medium",letterSpacing:"0.08em",textTransform:"uppercase",borderBottom:1,borderColor:"divider",bgcolor:"background.paper"},children:["Changed Files (",n.length,")"]}),(0,s.jsx)(b.Z,{dense:!0,disablePadding:!0,role:"group",children:n.map((e,n)=>{let a=function(e){switch(e){case"added":return{icon:(0,s.jsx)(z.Z,{fontSize:"small"}),color:"success.main",label:"Added"};case"modified":return{icon:(0,s.jsx)(D.Z,{fontSize:"small"}),color:"warning.main",label:"Modified"};case"deleted":return{icon:(0,s.jsx)(A.Z,{fontSize:"small"}),color:"error.main",label:"Deleted"}}}(e.status),r=function(e){let n=e.split("/");return n[n.length-1]}(e.path),o=function(e){let n=e.split("/");return n.length<=1?"":n.slice(0,-1).join("/")}(e.path),c=t===e.path;return(0,s.jsx)(w.Z,{title:"".concat(a.label,": ").concat(e.path),placement:"right",children:(0,s.jsxs)(C.Z,{selected:c,onClick:()=>l(e.path),onKeyDown:t=>i(t,e.path,n),role:"treeitem","aria-selected":c,"aria-label":"".concat(e.path," - ").concat(a.label),sx:{py:.75,"&.Mui-selected":{bgcolor:"action.selected"}},children:[(0,s.jsx)(S.Z,{sx:{minWidth:32,color:a.color},children:a.icon}),(0,s.jsx)(k.Z,{primary:r,secondary:o||void 0,primaryTypographyProps:{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.8rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},secondaryTypographyProps:{variant:"caption",sx:{fontFamily:"monospace",fontSize:"0.7rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}})]})},e.path)})})]})}var P=t(20876),F=t(25333);let I=(0,P.default)(()=>t.e(271).then(t.bind(t,40271)),{loadableGenerated:{webpack:()=>[null]},ssr:!1});function W(e){var n,t;let{change:a,viewMode:l,fileRef:i}=e,r="added"===a.status?"":null!==(n=a.oldContent)&&void 0!==n?n:"",o="deleted"===a.status?"":null!==(t=a.newContent)&&void 0!==t?t:"";return(0,s.jsxs)(d.Z,{ref:i,sx:{mb:3},"data-file-path":a.path,id:"diff-file-".concat(a.path.replace(/[^a-zA-Z0-9]/g,"-")),children:[(0,s.jsxs)(d.Z,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1,bgcolor:"background.default",borderTop:1,borderBottom:1,borderColor:"divider",position:"sticky",top:0,zIndex:1},children:[function(e){switch(e){case"added":return(0,s.jsx)(z.Z,{fontSize:"small",sx:{color:"success.main"}});case"modified":return(0,s.jsx)(D.Z,{fontSize:"small",sx:{color:"warning.main"}});case"deleted":return(0,s.jsx)(A.Z,{fontSize:"small",sx:{color:"error.main"}})}}(a.status),(0,s.jsx)(u.Z,{variant:"body2",sx:{fontFamily:"monospace",fontWeight:"bold",flex:1},children:a.path}),(0,s.jsx)(F.Z,{label:function(e){switch(e){case"added":return"added";case"modified":return"modified";case"deleted":return"deleted"}}(a.status),size:"small",color:function(e){switch(e){case"added":return"success";case"modified":return"warning";case"deleted":return"error"}}(a.status),variant:"outlined"})]}),(0,s.jsx)(d.Z,{sx:{fontSize:"0.8rem",overflow:"auto"},children:(0,s.jsx)(I,{oldValue:r,newValue:o,splitView:"split"===l,useDarkTheme:!0,hideLineNumbers:!1,showDiffOnly:!0,styles:{variables:{dark:{diffViewerBackground:"#1a1a1a",addedBackground:"#1a3a1a",addedColor:"#4caf50",removedBackground:"#3a1a1a",removedColor:"#f44336",wordAddedBackground:"#2d5a2d",wordRemovedBackground:"#5a2d2d",emptyLineBackground:"#1a1a1a",gutterBackground:"#111",gutterColor:"#555",codeFoldBackground:"#111",codeFoldGutterBackground:"#111"}}}})})]})}function T(e){let{changes:n,selectedFile:t,viewMode:l}=e,i=(0,a.useRef)(new Map),r=(0,a.useRef)(null);return((0,a.useEffect)(()=>{if(t&&i.current.has(t)){let e=i.current.get(t);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})}},[t]),0===n.length)?(0,s.jsx)(d.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",p:4},children:(0,s.jsx)(u.Z,{variant:"body1",color:"text.secondary",children:"No differences between these snapshots"})}):(0,s.jsx)(d.Z,{ref:r,sx:{height:"100%",overflow:"auto","& table":{width:"100%"}},children:n.map((e,t)=>(0,s.jsxs)(d.Z,{children:[(0,s.jsx)(W,{change:e,viewMode:l,fileRef:n=>{n?i.current.set(e.path,n):i.current.delete(e.path)}}),t<n.length-1&&(0,s.jsx)(p.Z,{})]},e.path))})}var E=t(89923),N=t(10297),R=t(98874),M=t(23345);function q(e){let{value:n,onChange:t}=e;return(0,s.jsxs)(N.Z,{value:n,exclusive:!0,onChange:(e,n)=>{null!==n&&t(n)},"aria-label":"Diff view mode",size:"small",children:[(0,s.jsx)(w.Z,{title:"Unified diff view",children:(0,s.jsx)(E.Z,{value:"unified","aria-label":"Unified view",children:(0,s.jsx)(R.Z,{fontSize:"small"})})}),(0,s.jsx)(w.Z,{title:"Side-by-side diff view",children:(0,s.jsx)(E.Z,{value:"split","aria-label":"Split view",children:(0,s.jsx)(M.Z,{fontSize:"small"})})})]})}var L=t(32366),U=t(45813),H=t(21111);function O(e){let{summary:n}=e,{added:t,modified:a,deleted:l}=n;return 0===t+a+l?(0,s.jsx)(d.Z,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1,borderTop:1,borderColor:"divider",bgcolor:"background.paper"},children:(0,s.jsx)(u.Z,{variant:"body2",color:"text.secondary",children:"No differences found between snapshots"})}):(0,s.jsxs)(d.Z,{sx:{display:"flex",alignItems:"center",gap:1.5,px:2,py:1,borderTop:1,borderColor:"divider",bgcolor:"background.paper",flexWrap:"wrap"},role:"status","aria-label":"Summary: ".concat(t," added, ").concat(a," modified, ").concat(l," deleted"),children:[(0,s.jsx)(u.Z,{variant:"caption",color:"text.secondary",sx:{fontWeight:"medium"},children:"Summary:"}),a>0&&(0,s.jsx)(F.Z,{icon:(0,s.jsx)(U.Z,{sx:{fontSize:"0.875rem"}}),label:"".concat(a," modified"),size:"small",sx:{bgcolor:"warning.dark",color:"warning.contrastText","& .MuiChip-icon":{color:"warning.contrastText"}}}),t>0&&(0,s.jsx)(F.Z,{icon:(0,s.jsx)(L.Z,{sx:{fontSize:"0.875rem"}}),label:"".concat(t," added"),size:"small",sx:{bgcolor:"success.dark",color:"success.contrastText","& .MuiChip-icon":{color:"success.contrastText"}}}),l>0&&(0,s.jsx)(F.Z,{icon:(0,s.jsx)(H.Z,{sx:{fontSize:"0.875rem"}}),label:"".concat(l," deleted"),size:"small",sx:{bgcolor:"error.dark",color:"error.contrastText","& .MuiChip-icon":{color:"error.contrastText"}}})]})}function K(e){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(e))}function V(e){var n;let{open:t,snapshotA:b,snapshotB:C,onClose:S,onRestoreA:k}=e,w=(0,j.Z)(),z=(0,f.Z)(w.breakpoints.down("md")),[D,A]=(0,a.useState)(void 0),[P,F]=(0,a.useState)("unified"),{data:I,isLoading:W,isError:E,error:N}=(0,y.m)(b.id,C.id,{enabled:t});(0,a.useEffect)(()=>{t&&(A(void 0),F("unified"))},[t,z]),(0,a.useEffect)(()=>{(null==I?void 0:I.changes)&&I.changes.length>0&&!D&&A(I.changes[0].path)},[I,D]);let R=(0,a.useCallback)(e=>{"Escape"===e.key&&S()},[S]);(0,a.useEffect)(()=>{if(t)return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[t,R]);let M=(0,a.useCallback)(e=>{A(e)},[]),L=(0,a.useCallback)(()=>{null==k||k(b),S()},[k,b,S]);return(0,s.jsxs)(i.Z,{open:t,onClose:S,maxWidth:"xl",fullWidth:!0,fullScreen:z,"aria-labelledby":"config-diff-dialog-title",PaperProps:{sx:{height:z?"100%":"90vh",maxHeight:z?"100%":"90vh",display:"flex",flexDirection:"column"}},children:[(0,s.jsxs)(r.Z,{id:"config-diff-dialog-title",sx:{display:"flex",alignItems:"center",gap:1,pb:1,flexShrink:0},children:[(0,s.jsx)(v.Z,{color:"primary"}),(0,s.jsxs)(d.Z,{sx:{flex:1},children:[(0,s.jsx)(u.Z,{variant:"h6",component:"span",children:"Config Diff"}),(0,s.jsxs)(u.Z,{variant:"body2",color:"text.secondary",sx:{display:"block",mt:.25},children:["Snapshot A: ",K(b.createdAt),(0,s.jsx)(d.Z,{component:"span",sx:{mx:1},children:"vs"}),"Snapshot B: ",K(C.createdAt)]})]}),(0,s.jsx)(q,{value:P,onChange:F}),(0,s.jsx)(m.Z,{onClick:S,"aria-label":"Close diff dialog",size:"small",sx:{ml:1},children:(0,s.jsx)(g.Z,{})})]}),(0,s.jsx)(p.Z,{}),(0,s.jsxs)(o.Z,{sx:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column",p:0},children:[W&&(0,s.jsxs)(d.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",flex:1,gap:2},children:[(0,s.jsx)(x.Z,{size:24}),(0,s.jsx)(u.Z,{variant:"body2",color:"text.secondary",children:"Loading diff..."})]}),E&&(0,s.jsx)(d.Z,{sx:{p:2},children:(0,s.jsxs)(h.Z,{severity:"error",children:["Failed to load diff: ",null!==(n=null==N?void 0:N.message)&&void 0!==n?n:"Unknown error"]})}),I&&(0,s.jsxs)(d.Z,{sx:{flex:1,display:"flex",flexDirection:{xs:"column",md:"row"},overflow:"hidden"},children:[(0,s.jsx)(d.Z,{sx:{width:{xs:"100%",md:220},flexShrink:0,height:{xs:"auto",md:"100%"},maxHeight:{xs:160,md:"none"},overflow:"auto"},children:(0,s.jsx)(B,{changes:I.changes,selectedFile:D,onSelectFile:M})}),(0,s.jsx)(p.Z,{orientation:z?"horizontal":"vertical"}),(0,s.jsx)(d.Z,{sx:{flex:1,overflow:"auto"},children:(0,s.jsx)(T,{changes:I.changes,selectedFile:D,viewMode:P})})]})]}),I&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p.Z,{}),(0,s.jsx)(O,{summary:I.summary})]}),(0,s.jsx)(p.Z,{}),(0,s.jsxs)(c.Z,{sx:{px:2,py:1.5,flexShrink:0},children:[k&&(0,s.jsx)(l.Z,{onClick:L,variant:"outlined",color:"warning",startIcon:(0,s.jsx)(Z.Z,{}),disabled:W,children:"Restore to Snapshot A"}),(0,s.jsx)(d.Z,{sx:{flex:1}}),(0,s.jsx)(l.Z,{onClick:S,variant:"contained",children:"Close"})]})]})}},56831:function(e,n,t){t.d(n,{zO:function(){return P},Fb:function(){return et},JZ:function(){return W},Ff:function(){return G},Xj:function(){return h},zg:function(){return eZ},Dm:function(){return ed},gE:function(){return ey},ed:function(){return eh.e}});var s=t(94655),a=t(628),l=t(41565),i=t(31317),r=t(7281),o=t(25333),c=t(46207),d=t(43436),u=t(92666);function h(){let{data:e,isLoading:n,error:t}=(0,u.mj)();if(n)return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup Status"}),(0,s.jsx)(i.Z,{color:"text.secondary",children:"Loading..."})]})});if(t)return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup Status"}),(0,s.jsx)(i.Z,{color:"error",children:"Failed to load backup status"})]})});let{configured:h,lastBackup:x,repository:m}=e||{};return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,s.jsx)(i.Z,{variant:"h6",children:"Backup Status"}),(0,s.jsx)(o.Z,{icon:h?(0,s.jsx)(c.Z,{}):(0,s.jsx)(d.Z,{}),label:h?"Configured":"Not Configured",color:h?"success":"error",size:"small"})]}),h?(0,s.jsxs)(r.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:[m&&(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Repository"}),(0,s.jsx)(i.Z,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.875rem"},children:m})]}),x&&(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Last Backup"}),(0,s.jsx)(i.Z,{variant:"body2",children:function(e){let n=new Date,t=new Date(e),s=Math.floor((n.getTime()-t.getTime())/6e4),a=Math.floor(s/60);return s<1?"just now":s<60?"".concat(s," minutes ago"):a<24?"".concat(a," hours ago"):"".concat(Math.floor(a/24)," days ago")}(x)})]}),!x&&(0,s.jsx)(i.Z,{variant:"body2",color:"text.secondary",children:"No backups yet"})]}):(0,s.jsx)(i.Z,{variant:"body2",color:"text.secondary",children:"GitHub backup is not configured. Please configure BACKUP_REPO_URL in your environment."})]})})}var x=t(35106),m=t(21138),p=t(84811),f=t(47001),j=t(53281),g=t(11254),Z=t(70366),v=t(79983),y=t(97731),b=t(30417),C=t(99770),S=t(76678),k=t(5682),w=t(65087),z=t(62508),D=t(81071),A=t(93017);function B(e){var n;let{open:t,commit:a,onClose:l}=e,{mutate:o,isPending:c}=(0,u.s8)(),[d,h]=(0,x.useState)(""),[m,p]=(0,x.useState)(""),f=()=>{c||(h(""),p(""),l())};return(0,s.jsxs)(C.Z,{open:t,onClose:f,maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(z.Z,{children:"Restore Backup"}),(0,s.jsxs)(k.Z,{children:[(0,s.jsx)(D.Z,{severity:"warning",sx:{mb:2},children:"This will restore all worlds from the selected backup. Current world data will be overwritten."}),d&&(0,s.jsx)(D.Z,{severity:"success",sx:{mb:2},children:d}),m&&(0,s.jsx)(D.Z,{severity:"error",sx:{mb:2},children:m}),(0,s.jsx)(w.Z,{sx:{mb:2},children:"Are you sure you want to restore from this backup?"}),(0,s.jsxs)(r.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:[(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Commit Hash"}),(0,s.jsx)(i.Z,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.875rem"},children:a.hash})]}),(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Date"}),(0,s.jsx)(i.Z,{variant:"body2",children:(n=a.date,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(n)))})]}),(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Message"}),(0,s.jsx)(i.Z,{variant:"body2",children:a.message})]}),(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Author"}),(0,s.jsx)(i.Z,{variant:"body2",children:a.author})]})]})]}),(0,s.jsxs)(S.Z,{children:[(0,s.jsx)(b.Z,{onClick:f,disabled:c,children:"Cancel"}),(0,s.jsx)(b.Z,{onClick:()=>{h(""),p(""),o(a.hash,{onSuccess:()=>{h("Backup restored successfully from ".concat(a.hash.substring(0,7))),setTimeout(()=>{l()},2e3)},onError:e=>{p("Failed to restore backup: ".concat(e.message))}})},variant:"contained",color:"warning",disabled:c,startIcon:c?(0,s.jsx)(A.Z,{size:16}):(0,s.jsx)(y.Z,{}),children:c?"Restoring...":"Restore"})]})]})}function P(){let{data:e,isLoading:n,error:t}=(0,u.$t)(20),[r,c]=(0,x.useState)(null),d=e=>{c(e)};if(n)return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),(0,s.jsx)(i.Z,{color:"text.secondary",children:"Loading..."})]})});if(t)return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),(0,s.jsx)(i.Z,{color:"error",children:"Failed to load backup history"})]})});let h=(null==e?void 0:e.commits)||[];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup History"}),0===h.length?(0,s.jsx)(i.Z,{color:"text.secondary",children:"No backup history available"}):(0,s.jsx)(j.Z,{children:(0,s.jsxs)(m.Z,{children:[(0,s.jsx)(g.Z,{children:(0,s.jsxs)(Z.Z,{children:[(0,s.jsx)(f.Z,{children:"Commit"}),(0,s.jsx)(f.Z,{children:"Date"}),(0,s.jsx)(f.Z,{children:"Message"}),(0,s.jsx)(f.Z,{children:"Author"}),(0,s.jsx)(f.Z,{align:"right",children:"Actions"})]})}),(0,s.jsx)(p.Z,{children:h.map(e=>{var n;return(0,s.jsxs)(Z.Z,{children:[(0,s.jsx)(f.Z,{children:(0,s.jsx)(o.Z,{label:e.hash.substring(0,7),size:"small",variant:"outlined",sx:{fontFamily:"monospace"}})}),(0,s.jsx)(f.Z,{children:(0,s.jsx)(i.Z,{variant:"body2",children:(n=e.date,new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(n)))})}),(0,s.jsx)(f.Z,{children:(0,s.jsx)(i.Z,{variant:"body2",children:e.message})}),(0,s.jsx)(f.Z,{children:(0,s.jsx)(i.Z,{variant:"body2",color:"text.secondary",children:e.author})}),(0,s.jsx)(f.Z,{align:"right",children:(0,s.jsx)(v.Z,{size:"small",color:"primary",onClick:()=>d(e),title:"Restore this backup",children:(0,s.jsx)(y.Z,{})})})]},e.hash)})})]})})]})}),r&&(0,s.jsx)(B,{open:!!r,commit:r,onClose:()=>{c(null)}})]})}var F=t(97436),I=t(34675);function W(e){let{disabled:n}=e,[t,a]=(0,x.useState)(!1),[l,i]=(0,x.useState)(""),[r,o]=(0,x.useState)(""),[c,d]=(0,x.useState)(""),{mutate:h,isPending:m}=(0,u.c5)(),p=()=>{m||(a(!1),i(""),o(""),d(""))};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(b.Z,{variant:"contained",startIcon:(0,s.jsx)(I.Z,{}),onClick:()=>{a(!0),o(""),d(""),i("Backup ".concat(new Date().toISOString().split("T")[0]))},disabled:n||m,children:"Push Backup"}),(0,s.jsxs)(C.Z,{open:t,onClose:p,maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(z.Z,{children:"Push Backup"}),(0,s.jsxs)(k.Z,{children:[r&&(0,s.jsx)(D.Z,{severity:"success",sx:{mb:2},children:r}),c&&(0,s.jsx)(D.Z,{severity:"error",sx:{mb:2},children:c}),(0,s.jsx)(F.Z,{autoFocus:!0,margin:"dense",label:"Commit Message",type:"text",fullWidth:!0,variant:"outlined",value:l,onChange:e=>i(e.target.value),disabled:m,helperText:"Optional message describing this backup"})]}),(0,s.jsxs)(S.Z,{children:[(0,s.jsx)(b.Z,{onClick:p,disabled:m,children:"Cancel"}),(0,s.jsx)(b.Z,{onClick:()=>{o(""),d(""),h({message:l||void 0},{onSuccess:e=>{o(e.commitHash?"Backup pushed successfully (".concat(e.commitHash.substring(0,7),")"):"Backup pushed successfully"),setTimeout(()=>{p()},2e3)},onError:e=>{d("Failed to push backup: ".concat(e.message))}})},variant:"contained",disabled:m,startIcon:m?(0,s.jsx)(A.Z,{size:16}):(0,s.jsx)(I.Z,{}),children:m?"Pushing...":"Push"})]})]})]})}var T=t(38393),E=t(70115),N=t(95511),R=t(69123),M=t(32366),q=t(45813),L=t(21111),U=t(54211),H=t(29793),O=t(75726),K=t(62328),V=t(7178);let $=[{label:"Every hour",value:"0 * * * *"},{label:"Every 6 hours",value:"0 */6 * * *"},{label:"Every 12 hours",value:"0 */12 * * *"},{label:"Daily at 3 AM",value:"0 3 * * *"},{label:"Weekly (Sunday 3 AM)",value:"0 3 * * 0"},{label:"Custom",value:"custom"}];function J(e){let{open:n,schedule:t,onClose:a}=e,l=(0,u.tT)(),c=(0,u.CA)(),d=!!t,[h,m]=(0,x.useState)(""),[p,f]=(0,x.useState)(""),[j,g]=(0,x.useState)(""),[Z,v]=(0,x.useState)(""),[y,w]=(0,x.useState)(""),[A,B]=(0,x.useState)("");(0,x.useEffect)(()=>{if(n){if(t){var e,s,a,l;m(t.name);let n=$.find(e=>e.value===t.cronExpression);n?(f(n.value),g("")):(f("custom"),g(t.cronExpression)),v(null!==(a=null===(e=t.retentionPolicy.maxCount)||void 0===e?void 0:e.toString())&&void 0!==a?a:""),w(null!==(l=null===(s=t.retentionPolicy.maxAgeDays)||void 0===s?void 0:s.toString())&&void 0!==l?l:"")}else m(""),f("0 3 * * *"),g(""),v("10"),w("30");B("")}},[n,t]);let P=()=>"custom"===p?j.trim():p,I=async()=>{B("");let e=P();if(!h.trim()){B("Name is required");return}if(!e){B("Cron expression is required");return}try{d&&t?await c.mutateAsync({id:t.id,data:{name:h.trim(),cron:e,...Z?{maxCount:parseInt(Z,10)}:{},...y?{maxAgeDays:parseInt(y,10)}:{}}}):await l.mutateAsync({name:h.trim(),cron:e,...Z?{maxCount:parseInt(Z,10)}:{},...y?{maxAgeDays:parseInt(y,10)}:{},enabled:!0}),a()}catch(e){B(e.message||"Failed to save schedule")}},W=l.isPending||c.isPending;return(0,s.jsxs)(C.Z,{open:n,onClose:a,maxWidth:"sm",fullWidth:!0,children:[(0,s.jsx)(z.Z,{children:d?"Edit Backup Schedule":"Create Backup Schedule"}),(0,s.jsx)(k.Z,{children:(0,s.jsxs)(E.Z,{spacing:2.5,sx:{mt:1},children:[A&&(0,s.jsx)(D.Z,{severity:"error",onClose:()=>B(""),children:A}),(0,s.jsx)(F.Z,{label:"Schedule Name",value:h,onChange:e=>m(e.target.value),fullWidth:!0,required:!0,placeholder:"e.g., Daily backup, Hourly snapshot",autoFocus:!0}),(0,s.jsxs)(H.Z,{fullWidth:!0,children:[(0,s.jsx)(O.Z,{children:"Schedule Frequency"}),(0,s.jsx)(K.Z,{value:p,onChange:e=>f(e.target.value),label:"Schedule Frequency",children:$.map(e=>(0,s.jsxs)(V.Z,{value:e.value,children:[e.label,"custom"!==e.value&&(0,s.jsx)(o.Z,{label:e.value,size:"small",variant:"outlined",sx:{ml:1,fontFamily:"monospace",fontSize:"0.75rem"}})]},e.value))})]}),"custom"===p&&(0,s.jsx)(F.Z,{label:"Cron Expression",value:j,onChange:e=>g(e.target.value),fullWidth:!0,required:!0,placeholder:"e.g., 0 */6 * * *",helperText:"Format: minute hour day-of-month month day-of-week",InputProps:{sx:{fontFamily:"monospace"}}}),(0,s.jsx)(i.Z,{variant:"subtitle2",color:"text.secondary",sx:{mt:1},children:"Retention Policy (optional)"}),(0,s.jsxs)(r.Z,{sx:{display:"flex",gap:2},children:[(0,s.jsx)(F.Z,{label:"Max Backup Count",type:"number",value:Z,onChange:e=>v(e.target.value),fullWidth:!0,placeholder:"e.g., 10",inputProps:{min:1},helperText:"Keep at most N backups"}),(0,s.jsx)(F.Z,{label:"Max Age (days)",type:"number",value:y,onChange:e=>w(e.target.value),fullWidth:!0,placeholder:"e.g., 30",inputProps:{min:1},helperText:"Delete backups older than N days"})]})]})}),(0,s.jsxs)(S.Z,{children:[(0,s.jsx)(b.Z,{onClick:a,disabled:W,children:"Cancel"}),(0,s.jsx)(b.Z,{onClick:I,variant:"contained",disabled:W,children:W?"Saving...":d?"Update":"Create"})]})]})}function Q(e){let n=new Date,t=new Date(e),s=Math.floor((n.getTime()-t.getTime())/6e4),a=Math.floor(s/60);return s<1?"just now":s<60?"".concat(s,"m ago"):a<24?"".concat(a,"h ago"):"".concat(Math.floor(a/24),"d ago")}function _(e){let{schedule:n,onEdit:t,onDelete:a,onToggle:l,toggleLoading:u}=e;return(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:1.5,px:1,"&:hover":{bgcolor:"action.hover",borderRadius:1}},children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:2,flex:1,minWidth:0},children:[(0,s.jsx)(U.Z,{color:n.enabled?"primary":"disabled"}),(0,s.jsxs)(r.Z,{sx:{minWidth:0},children:[(0,s.jsx)(i.Z,{variant:"body1",fontWeight:"medium",noWrap:!0,children:n.name}),(0,s.jsxs)(i.Z,{variant:"caption",color:"text.secondary",noWrap:!0,children:[n.cronHumanReadable," (",n.cronExpression,")"]})]})]}),(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0},children:[n.lastRunStatus&&(0,s.jsx)(N.Z,{title:n.lastRunMessage?"".concat(n.lastRunAt?Q(n.lastRunAt):"",": ").concat(n.lastRunMessage):n.lastRunAt?Q(n.lastRunAt):"",children:(0,s.jsx)(o.Z,{icon:"success"===n.lastRunStatus?(0,s.jsx)(c.Z,{sx:{fontSize:16}}):(0,s.jsx)(d.Z,{sx:{fontSize:16}}),label:"success"===n.lastRunStatus?"OK":"Failed",size:"small",color:"success"===n.lastRunStatus?"success":"error",variant:"outlined"})}),(n.retentionPolicy.maxCount||n.retentionPolicy.maxAgeDays)&&(0,s.jsx)(N.Z,{title:[n.retentionPolicy.maxCount&&"Max ".concat(n.retentionPolicy.maxCount," backups"),n.retentionPolicy.maxAgeDays&&"Max ".concat(n.retentionPolicy.maxAgeDays," days")].filter(Boolean).join(", "),children:(0,s.jsx)(o.Z,{label:"Retention",size:"small",variant:"outlined",color:"info"})}),(0,s.jsx)(N.Z,{title:n.enabled?"Disable schedule":"Enable schedule",children:(0,s.jsx)(T.Z,{size:"small",checked:n.enabled,onChange:(e,t)=>l(n,t),disabled:u})}),(0,s.jsx)(N.Z,{title:"Edit schedule",children:(0,s.jsx)(v.Z,{size:"small",onClick:()=>t(n),children:(0,s.jsx)(q.Z,{fontSize:"small"})})}),(0,s.jsx)(N.Z,{title:"Delete schedule",children:(0,s.jsx)(v.Z,{size:"small",color:"error",onClick:()=>a(n),children:(0,s.jsx)(L.Z,{fontSize:"small"})})})]})]})}function G(){var e;let{data:n,isLoading:t,error:o}=(0,u.d)(),c=(0,u.c1)(),d=(0,u.JV)(),[h,m]=(0,x.useState)(!1),[p,f]=(0,x.useState)(null),[j,g]=(0,x.useState)(!1),[Z,v]=(0,x.useState)(null),y=e=>{f(e),m(!0)},w=e=>{v(e),g(!0)},A=async()=>{if(Z)try{await d.mutateAsync(Z.id)}catch(e){}g(!1),v(null)},B=(e,n)=>{c.mutate({id:e.id,enabled:n})};if(t)return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup Schedules"}),(0,s.jsx)(i.Z,{color:"text.secondary",children:"Loading..."})]})});if(o)return(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",gutterBottom:!0,children:"Backup Schedules"}),(0,s.jsx)(D.Z,{severity:"error",children:"Failed to load backup schedules"})]})});let P=null!==(e=null==n?void 0:n.schedules)&&void 0!==e?e:[];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.Z,{children:(0,s.jsxs)(l.Z,{children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(i.Z,{variant:"h6",children:"Backup Schedules"}),(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Automated cron-based backup scheduling"})]}),(0,s.jsx)(b.Z,{variant:"contained",size:"small",startIcon:(0,s.jsx)(M.Z,{}),onClick:()=>{f(null),m(!0)},children:"Add Schedule"})]}),0===P.length?(0,s.jsxs)(r.Z,{sx:{textAlign:"center",py:4},children:[(0,s.jsx)(U.Z,{sx:{fontSize:48,color:"text.disabled",mb:1}}),(0,s.jsx)(i.Z,{color:"text.secondary",children:"No backup schedules configured"}),(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Create a schedule to automatically back up your worlds"})]}):(0,s.jsx)(E.Z,{divider:(0,s.jsx)(R.Z,{}),children:P.map(e=>(0,s.jsx)(_,{schedule:e,onEdit:y,onDelete:w,onToggle:B,toggleLoading:c.isPending},e.id))})]})}),(0,s.jsx)(J,{open:h,schedule:p,onClose:()=>{m(!1),f(null)}}),(0,s.jsxs)(C.Z,{open:j,onClose:()=>g(!1),children:[(0,s.jsx)(z.Z,{children:"Delete Backup Schedule"}),(0,s.jsx)(k.Z,{children:(0,s.jsxs)(i.Z,{children:['Are you sure you want to delete the schedule "',null==Z?void 0:Z.name,'"? This action cannot be undone.']})}),(0,s.jsxs)(S.Z,{children:[(0,s.jsx)(b.Z,{onClick:()=>g(!1),children:"Cancel"}),(0,s.jsx)(b.Z,{onClick:A,color:"error",variant:"contained",disabled:d.isPending,children:d.isPending?"Deleting...":"Delete"})]})]})]})}var Y=t(33402),X=t(60097),ee=t(91606),en=t(45420);function et(e){let{value:n,onChange:t}=e;return(0,s.jsx)(r.Z,{sx:{borderBottom:1,borderColor:"divider",mb:3},children:(0,s.jsxs)(Y.Z,{value:n,onChange:(e,n)=>t(n),"aria-label":"Backup management tabs",children:[(0,s.jsx)(X.Z,{value:"world-backups",label:"World Backups",icon:(0,s.jsx)(ee.Z,{}),iconPosition:"start",sx:{textTransform:"none",fontWeight:"medium"}}),(0,s.jsx)(X.Z,{value:"config-snapshots",label:"Config Snapshots",icon:(0,s.jsx)(en.Z,{}),iconPosition:"start",sx:{textTransform:"none",fontWeight:"medium"}})]})})}var es=t(73517),ea=t(87739),el=t(12063),ei=t(88978),er=t(27171),eo=t(80620),ec=t(86071);function ed(e){let{serverName:n,snapshots:t,totalCount:d,schedule:u,onViewHistory:h,onCreateSnapshot:x,onViewDiff:m}=e,p=t.length>0?t[0]:null,f=t.length>=2;return(0,s.jsx)(a.Z,{variant:"outlined",sx:{"&:hover":{borderColor:"primary.main"}},children:(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(r.Z,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:1.5,mb:1},children:[(0,s.jsx)(er.Z,{color:"primary"}),(0,s.jsx)(i.Z,{variant:"h6",component:"h3",fontWeight:"bold",children:n})]})}),(0,s.jsxs)(E.Z,{direction:"row",spacing:2,sx:{mb:2,flexWrap:"wrap",gap:1},children:[p?(0,s.jsx)(N.Z,{title:"Latest: ".concat(new Date(p.createdAt).toLocaleString()),children:(0,s.jsx)(o.Z,{icon:(0,s.jsx)(eo.Z,{sx:{fontSize:16}}),label:"Latest: ".concat(function(e){let n=new Date,t=new Date(e),s=Math.floor((n.getTime()-t.getTime())/6e4),a=Math.floor(s/60),l=Math.floor(a/24);return s<1?"just now":s<60?"".concat(s,"m ago"):a<24?"".concat(a,"h ago"):l<30?"".concat(l,"d ago"):t.toLocaleDateString()}(p.createdAt)),size:"small",variant:"outlined"})}):(0,s.jsx)(o.Z,{label:"No snapshots yet",size:"small",variant:"outlined",color:"default"}),p&&(0,s.jsx)(o.Z,{label:"".concat(p.files.length," files"),size:"small",variant:"outlined",color:"info"}),(0,s.jsx)(o.Z,{label:"".concat(d," snapshot").concat(1!==d?"s":""," total"),size:"small",variant:"outlined"}),u?(0,s.jsx)(N.Z,{title:"Schedule: ".concat(u.name," (").concat(u.cronExpression,")"),children:(0,s.jsx)(o.Z,{icon:u.enabled?(0,s.jsx)(c.Z,{sx:{fontSize:16}}):(0,s.jsx)(U.Z,{sx:{fontSize:16}}),label:u.enabled?"Schedule: Active":"Schedule: Paused",size:"small",variant:"outlined",color:u.enabled?"success":"default"})}):(0,s.jsx)(o.Z,{label:"No schedule",size:"small",variant:"outlined",color:"default"})]}),(0,s.jsxs)(E.Z,{direction:"row",spacing:1,children:[(0,s.jsx)(N.Z,{title:d<2?"Need at least 2 snapshots to compare history":"",arrow:!0,children:(0,s.jsx)("span",{children:(0,s.jsx)(b.Z,{size:"small",variant:"outlined",startIcon:(0,s.jsx)(eo.Z,{}),onClick:()=>h(n),disabled:d<2,children:"View History"})})}),(0,s.jsx)(b.Z,{size:"small",variant:"outlined",startIcon:(0,s.jsx)(es.Z,{}),onClick:()=>x(n),children:"Create Snapshot"}),f&&(0,s.jsx)(b.Z,{size:"small",variant:"outlined",startIcon:(0,s.jsx)(ec.Z,{}),onClick:()=>m(n),children:"View Diff"})]})]})})}function eu(e){let{servers:n,snapshotsByServer:t,schedules:a,isLoading:l,error:o,onViewHistory:c,onCreateSnapshot:d,onViewDiff:u}=e,h=(0,x.useMemo)(()=>n.map(e=>{var n,s;let l=t.get(e.name),i=a.find(n=>n.serverName===e.name);return{serverName:e.name,snapshots:null!==(n=null==l?void 0:l.snapshots)&&void 0!==n?n:[],totalCount:null!==(s=null==l?void 0:l.total)&&void 0!==s?s:0,schedule:i}}),[n,t,a]);return l?(0,s.jsx)(r.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,s.jsx)(A.Z,{})}):o?(0,s.jsxs)(D.Z,{severity:"error",children:["Failed to load config snapshots: ",o.message]}):0===n.length?(0,s.jsxs)(r.Z,{sx:{textAlign:"center",py:6},children:[(0,s.jsx)(en.Z,{sx:{fontSize:48,color:"text.disabled",mb:1}}),(0,s.jsx)(i.Z,{color:"text.secondary",children:"No servers found"}),(0,s.jsx)(i.Z,{variant:"caption",color:"text.secondary",children:"Create a server to start taking config snapshots"})]}):(0,s.jsx)(E.Z,{spacing:2,children:h.map(e=>(0,s.jsx)(ed,{serverName:e.serverName,snapshots:e.snapshots,totalCount:e.totalCount,schedule:e.schedule,onViewHistory:c,onCreateSnapshot:d,onViewDiff:u},e.serverName))})}var eh=t(6516),ex=t(62142),em=t(71185);function ep(e){let{schedule:n,onEdit:t,onDelete:a,onToggle:l,toggleLoading:u}=e;return(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:1.5,px:1,"&:hover":{bgcolor:"action.hover",borderRadius:1}},children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:2,flex:1,minWidth:0},children:[(0,s.jsx)(U.Z,{color:n.enabled?"primary":"disabled"}),(0,s.jsxs)(r.Z,{sx:{minWidth:0},children:[(0,s.jsx)(i.Z,{variant:"body2",fontWeight:"medium",noWrap:!0,children:n.name}),(0,s.jsxs)(i.Z,{variant:"caption",color:"text.secondary",noWrap:!0,children:[n.serverName," | ",n.cronExpression," | Retain: ",n.retentionCount]})]})]}),(0,s.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:1,flexShrink:0},children:[n.lastRunStatus&&(0,s.jsx)(N.Z,{title:n.lastRunAt?"Last run: ".concat(function(e){let n=new Date,t=new Date(e),s=Math.floor((n.getTime()-t.getTime())/6e4),a=Math.floor(s/60);return s<1?"just now":s<60?"".concat(s,"m ago"):a<24?"".concat(a,"h ago"):"".concat(Math.floor(a/24),"d ago")}(n.lastRunAt)," (").concat(n.lastRunStatus,")"):n.lastRunStatus,children:(0,s.jsx)(o.Z,{icon:"success"===n.lastRunStatus?(0,s.jsx)(c.Z,{sx:{fontSize:16}}):(0,s.jsx)(d.Z,{sx:{fontSize:16}}),label:"success"===n.lastRunStatus?"OK":"Failed",size:"small",color:"success"===n.lastRunStatus?"success":"error",variant:"outlined"})}),(0,s.jsx)(N.Z,{title:n.enabled?"Disable schedule":"Enable schedule",children:(0,s.jsx)(T.Z,{size:"small",checked:n.enabled,onChange:(e,t)=>l(n,t),disabled:u})}),(0,s.jsx)(N.Z,{title:"Edit schedule",children:(0,s.jsx)(v.Z,{size:"small",onClick:()=>t(n),children:(0,s.jsx)(q.Z,{fontSize:"small"})})}),(0,s.jsx)(N.Z,{title:"Delete schedule",children:(0,s.jsx)(v.Z,{size:"small",color:"error",onClick:()=>a(n),children:(0,s.jsx)(L.Z,{fontSize:"small"})})})]})]})}function ef(e){let{schedules:n,onEdit:t,onDelete:a,onToggle:l,toggleLoading:o}=e;return 0===n.length?(0,s.jsxs)(r.Z,{sx:{textAlign:"center",py:3},children:[(0,s.jsx)(U.Z,{sx:{fontSize:40,color:"text.disabled",mb:1}}),(0,s.jsx)(i.Z,{color:"text.secondary",variant:"body2",children:"No config snapshot schedules configured"})]}):(0,s.jsx)(E.Z,{divider:(0,s.jsx)(R.Z,{}),children:n.map(e=>(0,s.jsx)(ep,{schedule:e,onEdit:t,onDelete:a,onToggle:l,toggleLoading:o},e.id))})}let ej=[{label:"Every hour",value:"0 * * * *"},{label:"Every 6 hours",value:"0 */6 * * *"},{label:"Daily at midnight",value:"0 0 * * *"},{label:"Daily at 3 AM",value:"0 3 * * *"},{label:"Weekly (Sunday midnight)",value:"0 0 * * 0"},{label:"Custom",value:""}];function eg(e){var n;let{serverNames:t,editingSchedule:a,onSubmit:l,onUpdate:o,onCancel:c,isSubmitting:d,error:u}=e,h=!!a,[m,p]=(0,x.useState)((null==a?void 0:a.serverName)||""),[f,j]=(0,x.useState)((null==a?void 0:a.name)||""),[g,Z]=(0,x.useState)(""),[v,y]=(0,x.useState)((null==a?void 0:a.cronExpression)||"0 0 * * *"),[C,S]=(0,x.useState)(null!==(n=null==a?void 0:a.retentionCount)&&void 0!==n?n:10);(0,x.useEffect)(()=>{let e=ej.find(e=>e.value===v);Z(e?e.value:"")},[v]),(0,x.useEffect)(()=>{a?(p(a.serverName),j(a.name),y(a.cronExpression),S(a.retentionCount)):(p(""),j(""),y("0 0 * * *"),S(10))},[a]);let k=e=>{Z(e),e&&y(e)},w=(h||m)&&f.trim()&&v.trim();return(0,s.jsxs)(r.Z,{sx:{display:"flex",flexDirection:"column",gap:2},children:[(0,s.jsx)(i.Z,{variant:"subtitle2",color:"text.secondary",children:h?"Edit Schedule":"Create New Schedule"}),!h&&(0,s.jsxs)(H.Z,{fullWidth:!0,size:"small",required:!0,children:[(0,s.jsx)(O.Z,{children:"Server"}),(0,s.jsx)(K.Z,{value:m,onChange:e=>p(e.target.value),label:"Server",disabled:d,children:t.map(e=>(0,s.jsx)(V.Z,{value:e,children:e},e))})]}),(0,s.jsx)(F.Z,{label:"Schedule Name",value:f,onChange:e=>j(e.target.value),placeholder:"e.g., Daily config backup",size:"small",fullWidth:!0,required:!0,disabled:d}),(0,s.jsxs)(H.Z,{fullWidth:!0,size:"small",children:[(0,s.jsx)(O.Z,{children:"Cron Preset"}),(0,s.jsx)(K.Z,{value:g,onChange:e=>k(e.target.value),label:"Cron Preset",disabled:d,children:ej.map(e=>(0,s.jsx)(V.Z,{value:e.value,children:e.label},e.label))})]}),(0,s.jsx)(F.Z,{label:"Cron Expression",value:v,onChange:e=>y(e.target.value),placeholder:"0 0 * * *",size:"small",fullWidth:!0,required:!0,disabled:d,helperText:"Standard cron format: minute hour day month weekday"}),(0,s.jsx)(F.Z,{label:"Retention Count",type:"number",value:C,onChange:e=>S(Math.max(1,parseInt(e.target.value)||1)),size:"small",fullWidth:!0,disabled:d,helperText:"Maximum number of scheduled snapshots to keep per server",inputProps:{min:1,max:100}}),u&&(0,s.jsx)(D.Z,{severity:"error",sx:{py:0},children:u}),(0,s.jsxs)(r.Z,{sx:{display:"flex",gap:1,justifyContent:"flex-end"},children:[(0,s.jsx)(b.Z,{size:"small",onClick:c,disabled:d,children:"Cancel"}),(0,s.jsx)(b.Z,{size:"small",variant:"contained",onClick:()=>{h&&o?o({name:f.trim(),cronExpression:v,retentionCount:C}):l({serverName:m,name:f.trim(),cronExpression:v,retentionCount:C})},disabled:!w||d,children:d?"Saving...":h?"Update":"Create"})]})]})}function eZ(e){var n,t,a;let{open:l,onClose:o,serverNames:c,filterServerName:d}=e,{data:u,isLoading:h,error:m}=(0,ei.F$)(d),p=(0,ei.wh)(),f=(0,ei.Uw)(),j=(0,ei.DW)(),g=(0,ei.$C)(),[Z,y]=(0,x.useState)(!1),[w,B]=(0,x.useState)(null),[P,F]=(0,x.useState)(!1),[I,W]=(0,x.useState)(null),T=null!==(a=null==u?void 0:u.schedules)&&void 0!==a?a:[],E=async()=>{if(I)try{await g.mutateAsync(I.id)}catch(e){}F(!1),W(null)},N=async e=>{try{await p.mutateAsync({serverName:e.serverName,name:e.name,cronExpression:e.cronExpression,retentionCount:e.retentionCount}),y(!1)}catch(e){}},q=async e=>{if(w)try{await f.mutateAsync({id:w.id,data:e}),y(!1),B(null)}catch(e){}},L=(null===(n=p.error)||void 0===n?void 0:n.message)||(null===(t=f.error)||void 0===t?void 0:t.message)||null;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ex.ZP,{anchor:"right",open:l,onClose:o,PaperProps:{sx:{width:{xs:"100%",sm:480},p:3}},children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,s.jsx)(i.Z,{variant:"h6",fontWeight:"bold",children:"Config Snapshot Schedules"}),(0,s.jsx)(v.Z,{onClick:o,size:"small",children:(0,s.jsx)(em.Z,{})})]}),(0,s.jsx)(R.Z,{sx:{mb:2}}),!Z&&(0,s.jsx)(b.Z,{variant:"outlined",startIcon:(0,s.jsx)(M.Z,{}),onClick:()=>{B(null),y(!0)},fullWidth:!0,sx:{mb:2},children:"Add Schedule"}),Z&&(0,s.jsxs)(r.Z,{sx:{mb:2},children:[(0,s.jsx)(eg,{serverNames:c,editingSchedule:w,onSubmit:N,onUpdate:q,onCancel:()=>{y(!1),B(null),p.reset(),f.reset()},isSubmitting:p.isPending||f.isPending,error:L}),(0,s.jsx)(R.Z,{sx:{mt:2}})]}),h?(0,s.jsx)(r.Z,{sx:{display:"flex",justifyContent:"center",py:4},children:(0,s.jsx)(A.Z,{})}):m?(0,s.jsx)(D.Z,{severity:"error",children:"Failed to load schedules"}):(0,s.jsx)(ef,{schedules:T,onEdit:e=>{B(e),y(!0)},onDelete:e=>{W(e),F(!0)},onToggle:(e,n)=>{j.mutate({id:e.id,enabled:n})},toggleLoading:j.isPending})]}),(0,s.jsxs)(C.Z,{open:P,onClose:()=>F(!1),children:[(0,s.jsx)(z.Z,{children:"Delete Config Snapshot Schedule"}),(0,s.jsx)(k.Z,{children:(0,s.jsxs)(i.Z,{children:['Are you sure you want to delete the schedule "',null==I?void 0:I.name,'"? Existing snapshots created by this schedule will be preserved.']})}),(0,s.jsxs)(S.Z,{children:[(0,s.jsx)(b.Z,{onClick:()=>F(!1),children:"Cancel"}),(0,s.jsx)(b.Z,{onClick:E,color:"error",variant:"contained",disabled:g.isPending,children:g.isPending?"Deleting...":"Delete"})]})]})]})}var ev=t(84728);function ey(){var e,n;let{data:t,isLoading:a}=(0,u.x$)(),l=null!==(e=null==t?void 0:t.servers)&&void 0!==e?e:[],o=l.map(e=>e.name),{snapshotsByServer:c,isLoading:d,error:h}=function(e){var n;let t=e.map(e=>({name:e,query:(0,el.m)(e,5,0,{enabled:!!e})})),s=t.some(e=>e.query.isLoading),a=(null===(n=t.find(e=>e.query.error))||void 0===n?void 0:n.query.error)||null;return{snapshotsByServer:(0,x.useMemo)(()=>{let e=new Map;for(let n of t)n.query.data&&e.set(n.name,{snapshots:n.query.data.snapshots,total:n.query.data.total});return e},[t]),isLoading:s,error:a}}(o),{data:m}=(0,ei.F$)(),p=null!==(n=null==m?void 0:m.schedules)&&void 0!==n?n:[],[f,j]=(0,x.useState)(!1),[g,Z]=(0,x.useState)(void 0),[v,y]=(0,x.useState)(!1),[C,S]=(0,x.useState)(!1),[k,w]=(0,x.useState)(""),z=(0,x.useMemo)(()=>{if(!k)return{snapshotA:null,snapshotB:null};let e=c.get(k);return!e||e.snapshots.length<2?{snapshotA:null,snapshotB:null}:{snapshotA:e.snapshots[1],snapshotB:e.snapshots[0]}},[k,c]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(r.Z,{sx:{display:"flex",justifyContent:"flex-end",gap:1,mb:2},children:[(0,s.jsx)(b.Z,{variant:"outlined",size:"small",startIcon:(0,s.jsx)(ea.Z,{}),onClick:()=>y(!0),children:"Manage Schedules"}),(0,s.jsx)(b.Z,{variant:"contained",size:"small",startIcon:(0,s.jsx)(es.Z,{}),onClick:()=>{Z(void 0),j(!0)},children:"Create Snapshot"})]}),(0,s.jsx)(i.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,s.jsx)(eu,{servers:l,snapshotsByServer:c,schedules:p,isLoading:a||d,error:h,onViewHistory:e=>{let n=c.get(e);n&&n.snapshots.length>0&&(w(e),S(!0))},onCreateSnapshot:e=>{Z(e),j(!0)},onViewDiff:e=>{w(e),S(!0)}}),(0,s.jsx)(eh.e,{open:f,onClose:()=>{j(!1),Z(void 0)},serverNames:o,defaultServer:g}),(0,s.jsx)(eZ,{open:v,onClose:()=>y(!1),serverNames:o}),C&&z.snapshotA&&z.snapshotB&&(0,s.jsx)(ev.YN,{open:C,onClose:()=>{S(!1),w("")},snapshotA:z.snapshotA,snapshotB:z.snapshotB})]})}},72205:function(e,n,t){t.d(n,{m:function(){return l}});var s=t(98324),a=t(42936);function l(e,n,t){return(0,s.a)({queryKey:["config-snapshots","diff",e,n],queryFn:()=>(0,a.SC)("/api/config-snapshots/".concat(encodeURIComponent(e),"/diff/").concat(encodeURIComponent(n))),enabled:(null==t?void 0:t.enabled)!==!1&&!!e&&!!n,staleTime:3e5})}},88978:function(e,n,t){t.d(n,{$C:function(){return u},DW:function(){return d},F$:function(){return r},Uw:function(){return c},wh:function(){return o}});var s=t(98324),a=t(58919),l=t(20367),i=t(42936);function r(e){let n=e?"?serverName=".concat(encodeURIComponent(e)):"";return(0,s.a)({queryKey:["config-snapshot-schedules",e||"all"],queryFn:()=>(0,i.SC)("/api/config-snapshot-schedules".concat(n)),refetchInterval:6e4})}function o(){let e=(0,a.NL)();return(0,l.D)({mutationFn:e=>(0,i.SC)("/api/config-snapshot-schedules",{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config-snapshot-schedules"]})}})}function c(){let e=(0,a.NL)();return(0,l.D)({mutationFn:e=>{let{id:n,data:t}=e;return(0,i.SC)("/api/config-snapshot-schedules/".concat(encodeURIComponent(n)),{method:"PUT",body:JSON.stringify(t)})},onSuccess:()=>{e.invalidateQueries({queryKey:["config-snapshot-schedules"]})}})}function d(){let e=(0,a.NL)();return(0,l.D)({mutationFn:e=>{let{id:n,enabled:t}=e;return(0,i.SC)("/api/config-snapshot-schedules/".concat(encodeURIComponent(n),"/toggle"),{method:"PATCH",body:JSON.stringify({enabled:t})})},onSuccess:()=>{e.invalidateQueries({queryKey:["config-snapshot-schedules"]})}})}function u(){let e=(0,a.NL)();return(0,l.D)({mutationFn:e=>(0,i.SC)("/api/config-snapshot-schedules/".concat(encodeURIComponent(e)),{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["config-snapshot-schedules"]})}})}},12063:function(e,n,t){t.d(n,{m:function(){return r},t:function(){return o}});var s=t(98324),a=t(58919),l=t(20367),i=t(42936);function r(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3?arguments[3]:void 0;return(0,s.a)({queryKey:["config-snapshots","list",e,n,t],queryFn:()=>(0,i.SC)("/api/servers/".concat(encodeURIComponent(e),"/config-snapshots?limit=").concat(n,"&offset=").concat(t)),enabled:(null==a?void 0:a.enabled)!==!1&&!!e,refetchInterval:6e4})}function o(){let e=(0,a.NL)();return(0,l.D)({mutationFn:e=>{let{serverName:n,description:t}=e;return(0,i.SC)("/api/servers/".concat(encodeURIComponent(n),"/config-snapshots"),{method:"POST",body:JSON.stringify({description:t})})},onSuccess:(n,t)=>{let{serverName:s}=t;e.invalidateQueries({queryKey:["config-snapshots","list",s]}),e.invalidateQueries({queryKey:["config-snapshots"]})}})}}}]);
|