import{j as v,b9 as g,bq as n,bV as _,df as C,B as R,D as t,dg as I,Q as L,bt as o,r as c,o as T,aw as x,K as l,dh as A,ah as B,di as D}from"./index-CNZMR1GT.js";import{b as V}from"./useTitle-BClow7LS.js";import{I as j}from"./SettingItem-EdBZszST.js";import{R as q}from"./ResponsiveGrid-VTNos9Q3.js";import"./index-3N2OqIV6.js";import"./index-DsSWFirV.js";import"./index-DUl6hczb.js";import"./item_type-CyD6qwPS.js";const W=d=>{const s=T(),{pathname:S}=v();V("manage.sidemenu.".concat(S().split("/").pop()));const[u,y]=g(()=>n.get("/admin/setting/list?group=".concat(d.group))),[p,i]=_([]),r=async()=>{const e=await y();o(e,i)};r();const[b,k]=g(()=>n.post("/admin/setting/save",C(p))),[m,w]=g(()=>n.post("/admin/setting/default?group=".concat(d.group))),[h,f]=R(!1);return t(B,{w:"$full",alignItems:"start",spacing:"$2",get children(){return[t(q,{get children(){return t(I,{each:p,children:e=>t(j,L(e,{onChange:a=>{i($=>e().key===$.key,"value",a)},onDelete:async()=>{f(!0);const a=await n.post("/admin/setting/delete?key=".concat(e().key));f(!1),o(a,()=>{c.success(s("global.delete_success")),r()})}}))})}}),t(x,{spacing:"$2",get children(){return[t(l,{colorScheme:"accent",onClick:r,get loading(){return u()||h()||m()},get children(){return s("global.refresh")}}),t(l,{get loading(){return b()},onClick:async()=>{const e=await k();o(e,async()=>{c.success(s("global.save_success")),A(await n.get("/public/settings"),D)})},get children(){return s("global.save")}}),t(l,{colorScheme:"warning",get loading(){return u()||h()||m()},onClick:async()=>{const e=await w();o(e,a=>{c.info(s("manage.load_default_setting_success")),i(a)})},get children(){return s("manage.load_default_setting")}})]}})]}})};export{W as default};
