import{u as h,r as d,t as e,j as s,O as f,c as g,$ as j,e as y,v as N,f as C}from"./index-iQt3bUih.js";function w({client:p,instanceId:u,file:a,health:l,running:n,onResolved:o}){h();const[r,c]=d.useState(!1),[x,i]=d.useState(null),m=a==="world"?e("世界設定檔(PalWorldSettings.ini)"):e("效能設定檔(Engine.ini)"),b=async()=>{c(!0),i(null);try{const t=await p.regenerateConfig(u,a);o(),alert(t.backedUp?e("已生成新的設定檔。原損壞檔案已備份為 {path}.corrupt-*.bak",{path:t.path}):e("已生成新的設定檔。"))}catch(t){i(t instanceof Error?t.message:String(t))}finally{c(!1)}};return s.jsx(f,{onClose:()=>{},children:s.jsxs("div",{className:`${g} flex max-h-[90vh] w-[460px] max-w-full flex-col gap-3 overflow-y-auto`,onClick:t=>t.stopPropagation(),children:[s.jsxs("h2",{className:"inline-flex items-center gap-2 text-lg font-extrabold text-berry",children:[s.jsx(j,{className:"size-5"})," ",e("設定檔已損壞")]}),s.jsxs("p",{className:"text-[13px] text-ink-muted",children:[m,e("無法正確解析,伺服器可能會忽略設定或開出一個全新的世界。")]}),l.reason&&s.jsxs("p",{className:"rounded-xl bg-berry/10 px-3 py-2 text-[13px] font-bold text-berry",children:[e("問題:"),l.reason]}),s.jsxs("p",{className:"text-[13px] text-ink-muted",children:[e("可以生成一份新的設定檔"),a==="world"?e("(依 GUI 目前儲存的世界設定)"):"",e("。原本的損壞檔案會先備份起來,不會直接刪除。")]}),x&&s.jsx("p",{className:y,children:x}),n&&s.jsx("p",{className:"rounded-xl bg-sun/10 px-3 py-2 text-[13px] font-bold text-sun",children:e("請先停止伺服器再重新生成。")}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{className:N,onClick:b,disabled:r||n,children:r?e("生成中…"):e("生成新的設定檔")}),s.jsx("button",{className:C,onClick:o,disabled:r,children:e("稍後再說")})]})]})})}export{w as C};
