import{l as j,I as x,r as g,w as N,q as c,y,j as r,x as l,K as m,N as u,A as d,v,L as i,M as f,O as n}from"./index-e9211ef1.js";import{_ as $}from"./EditConfig.vue_vue_type_style_index_0_lang-29ce80f7.js";import{n as B}from"./index.browser-7e542916.js";import{b as O,V as p,c as E}from"./VCard-138864fc.js";import{V as h}from"./VDivider-336c24cd.js";import{j as S}from"./VBtn-68784d55.js";import{c as T}from"./VMenu-bc0cce60.js";import"./VExpansionPanel-67038b00.js";import"./VDialog-5f240a62.js";import"./VListItem-230d1393.js";import"./VSpacer-bdf2f653.js";import"./VSelect-04a129eb.js";const A={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},D=i("br",null,null,-1),I=["href"],q=i("br",null,null,-1),z=i("br",null,null,-1),K=i("br",null,null,-1),Z=j({__name:"EditCoreConfig",props:{domain:{}},setup(C){const V=C,b=x(),e=g(),k=B(11),s=g(!1);N(()=>V.domain,async t=>{t&&(e.value=await n.getCoreConfig(t))},{immediate:!0});const w=async function(t){s.value=!0,n.saveCoreConfig(e.value.domain,t).then(()=>{s.value=!1,b.push({name:"providersettings"})}).catch(o=>{alert(o),s.value=!1})},M=async function(t,o){s.value=!0;for(const a of Object.values(e.value.values))a.value!==void 0&&o[a.key]==null&&(o[a.key]=a.value);o.session_id=k,n.getCoreConfigEntries(e.value.domain,t,o).then(a=>{e.value.values={};for(const _ of a)e.value.values[_.key]=_;s.value=!1}).catch(a=>{alert(a),s.value=!1})};return(t,o)=>(c(),y("section",null,[r(E,null,{default:l(()=>[e.value?(c(),y("div",A,[r(O,null,{default:l(()=>[m(u(t.$t("settings.setup_provider",[d(n).providerManifests[e.value.domain].name])),1)]),_:1}),r(p,null,{default:l(()=>[m(u(d(n).providerManifests[e.value.domain].description),1)]),_:1}),D,d(n).providerManifests[e.value.domain].codeowners.length?(c(),v(p,{key:0},{default:l(()=>[i("b",null,u(t.$t("settings.codeowners"))+": ",1),m(u(d(n).providerManifests[e.value.domain].codeowners.join(" / ")),1)]),_:1})):f("",!0),d(n).providerManifests[e.value.domain].documentation?(c(),v(p,{key:1},{default:l(()=>[i("b",null,u(t.$t("settings.need_help_setup_provider")),1),m("  "),i("a",{href:d(n).providerManifests[e.value.domain].documentation,target:"_blank"},u(t.$t("settings.check_docs")),9,I)]),_:1})):f("",!0),q,r(h),z,K])):f("",!0),r(h),e.value?(c(),v($,{key:1,"config-entries":Object.values(e.value.values),disabled:!1,onSubmit:w,onAction:M},null,8,["config-entries"])):f("",!0)]),_:1}),r(T,{modelValue:s.value,"onUpdate:modelValue":o[0]||(o[0]=a=>s.value=a),scrim:"true",persistent:"",style:{display:"flex","align-items":"center","justify-content":"center"}},{default:l(()=>[r(S,{indeterminate:"",size:"64",color:"primary"})]),_:1},8,["modelValue"])]))}});export{Z as default};
