import{k as e,b7 as s,bq as t,bV as a,dk as n,X as i,E as r,dl as o,F as c,bt as l,x as g,q as d,ao as u,a8 as m,dm as p,a7 as h,dn as b}from"./index-C-dDkA_D.js";import{b as f}from"./useTitle-Dwsro-_9.js";import{I as y}from"./SettingItem-DATBsMwf.js";import{R as k}from"./ResponsiveGrid-EC2vEAXl.js";import"./index-Ddnz8quC.js";import"./index-BA8MiV3y.js";import"./index-2YNnOdV-.js";import"./item_type-Bo2djN9R.js";const j=j=>{const _=d(),{pathname:w}=e();f(`manage.sidemenu.${w().split("/").pop()}`);const[$,x]=s(()=>t.get(`/admin/setting/list?group=${j.group}`)),[v,C]=a([]),I=async()=>{const e=await x();l(e,C)};I();const[S,q]=s(()=>t.post("/admin/setting/save",n(v))),[R,D]=s(()=>t.post(`/admin/setting/default?group=${j.group}`)),[E,F]=i(!1);return r(h,{w:"$full",alignItems:"start",spacing:"$2",get children(){return[r(k,{get children(){return r(o,{each:v,children:e=>r(y,c(e,{onChange:s=>{C(s=>e().key===s.key,"value",s)},onDelete:async()=>{F(!0);const s=await t.post(`/admin/setting/delete?key=${e().key}`);F(!1),l(s,()=>{g.success(_("global.delete_success")),I()})}}))})}}),r(u,{spacing:"$2",get children(){return[r(m,{colorScheme:"accent",onClick:I,get loading(){return $()||E()||R()},get children(){return _("global.refresh")}}),r(m,{get loading(){return S()},onClick:async()=>{const e=await q();l(e,async()=>{g.success(_("global.save_success")),p(await t.get("/public/settings"),b)})},get children(){return _("global.save")}}),r(m,{colorScheme:"warning",get loading(){return $()||E()||R()},onClick:async()=>{const e=await D();l(e,e=>{g.info(_("manage.load_default_setting_success")),C(e)})},get children(){return _("manage.load_default_setting")}})]}})]}})};export{j as default};
