import{a as s,t as v,_ as N}from"./index-CPxkwG0x.js";import{n as $}from"./index.browser-BY9c7rfI.js";import{u as z}from"./vue-router-DseMGm2G.js";import{E as A}from"./EditConfig-XXzkOWD0.js";import{a as D,a0 as S,d as T,k as G}from"./vuetify-C-X2RQxn.js";import{d as H,w as J,c as g,K as _,G as K,J as l,r as y,u as P,H as u,g as R,e as d,a2 as U,a4 as m,b as f}from"./lucide-6UWTdd2w.js";import{u as q}from"./vue-i18n-QBroYIqB.js";import"./qrcode-DG5BmHWw.js";import"./marked-BPdRUrA1.js";import"./color-CqFg8eif.js";import"./vueuse-BmOENVLt.js";/* empty css            */import"./swiper-7FOSZ2nt.js";import"./index-DP7PbNO3.js";import"./reka-ui-CE6xzTAG.js";import"./index-CE8OFbwX.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-BKnSpmLb.js";import"./NumberFieldInput.vue_vue_type_script_setup_true_lang-CFsEZBvu.js";const F={class:"edit-core-config"},L={key:0},Q={class:"header-content"},W={class:"header-icon"},X={class:"header-info"},Y={class:"header-title"},Z={class:"header-description"},ee=H({__name:"EditCoreConfig",props:{domain:{}},setup(C){const h=z(),{t:p}=q(),a=y(),k=$(11),n=y(!1),b=C,V=R(()=>a.value?Object.values(a.value.values):[]);J(()=>b.domain,async e=>{e&&(a.value=await s.getCoreConfig(e))},{immediate:!0});const w=e=>{const o=p(`settings.core_module.${e.domain}.name`);return o!==`settings.core_module.${e.domain}.name`?o:s.providerManifests[e.domain].name},I=e=>{const o=p(`settings.core_module.${e.domain}.description`);return o!==`settings.core_module.${e.domain}.description`?o:s.providerManifests[e.domain].description},E=e=>({streams:"mdi-radio-tower",players:"mdi-speaker-multiple",metadata:"mdi-tag-multiple",music:"mdi-music",webserver:"mdi-web",cache:"mdi-cached"})[e]||"mdi-cog",x=async function(e){n.value=!0,s.saveCoreConfig(a.value.domain,e).then(()=>{h.push({name:"systemsettings"})}).catch(o=>{v.error(o.message||o)}).finally(()=>{n.value=!1})},M=async function(e){const o=await s.saveCoreConfig(a.value.domain,e);for(const[i,t]of Object.entries(o.values))a.value.values[i]=t},O=async function(e,o,i){n.value=!0;for(const t of Object.values(a.value.values))t.value!==void 0&&o[t.key]==null&&(o[t.key]=t.value);o.session_id=k,s.getCoreConfigEntries(a.value.domain,e,o).then(async t=>{a.value.values={};for(const r of t)a.value.values[r.key]=r;if(i){const r={};for(const c of t)c.value!==void 0&&(r[c.key]=c.value);const j=await s.saveCoreConfig(a.value.domain,r);for(const[c,B]of Object.entries(j.values))a.value.values[c]=B}n.value=!1}).catch(t=>{v.error(t.message||t),n.value=!1})};return(e,o)=>(f(),g("section",F,[a.value&&P(s).providerManifests[a.value.domain]?(f(),g("div",L,[l(D,{class:"header-card mb-4",elevation:"0"},{default:u(()=>[d("div",Q,[d("div",W,[l(T,{size:"32",color:"primary"},{default:u(()=>[U(m(E(a.value.domain)),1)]),_:1})]),d("div",X,[d("h2",Y,m(w(a.value)),1),d("p",Z,m(I(a.value)),1)])])]),_:1})])):_("",!0),a.value?(f(),K(A,{key:1,"config-entries":V.value,disabled:!1,onSubmit:x,onAction:O,onImmediateApply:M},null,8,["config-entries"])):_("",!0),l(S,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=i=>n.value=i),scrim:"true",persistent:"",class:"loading-overlay"},{default:u(()=>[l(G,{indeterminate:"",size:"64",color:"primary"})]),_:1},8,["modelValue"])]))}}),Ce=N(ee,[["__scopeId","data-v-f347b2ab"]]);export{Ce as default};
