import{av as E,H as y,J as N,aw as b,x as i,aB as u,bS as $,bs as j,ax as m,ay as p,aD as v,d as r,bb as S,bc as f,aI as d,az as l,aL as o,bd as c,cr as T,aQ as C,b3 as D,aA as I}from"./index-C-Ivu3jU.js";import{E as O}from"./EditConfig-Y1ATbenl.js";import{n as z}from"./index.browser-OxPLOBIU.js";import"./VForm-BYcBSxOg.js";import"./VInput-CnrZS6Kh.js";import"./VExpansionPanels-BevVHr3H.js";import"./VAlert-B3qbTkCR.js";import"./VSwitch-BQ2ltI05.js";import"./VCheckboxBtn-BmKOjEU4.js";import"./VSlider-B7gznk4l.js";import"./VTextField-Bkx949P5.js";import"./VSelect-JgdoZi1R.js";import"./VVirtualScroll-C_Lzj3jv.js";import"./VDialog-BZuFHdVP.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";const A={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},Z=E({__name:"EditCoreConfig",props:{domain:{}},setup(k){const V=I(),t=y(),w=z(11),s=y(!1),x=k;N(()=>x.domain,async a=>{a&&(t.value=await o.getCoreConfig(a))},{immediate:!0});const M=async function(a){s.value=!0,o.saveCoreConfig(t.value.domain,a).then(()=>{s.value=!1,V.push({name:"providersettings"})}).catch(e=>{alert(e),s.value=!1})},B=async function(a,e){s.value=!0;for(const n of Object.values(t.value.values))n.value!==void 0&&e[n.key]==null&&(e[n.key]=n.value);e.session_id=w,o.getCoreConfigEntries(t.value.domain,a,e).then(n=>{t.value.values={};for(const g of n)t.value.values[g.key]=g;s.value=!1}).catch(n=>{alert(n),s.value=!1})};return(a,e)=>(m(),b("section",null,[i($,null,{default:u(()=>[t.value?(m(),b("div",A,[i(S,null,{default:u(()=>[f(d(a.$t("settings.setup_provider",[l(o).providerManifests[t.value.domain].name])),1)]),_:1}),i(c,null,{default:u(()=>[f(d(l(o).providerManifests[t.value.domain].description),1)]),_:1}),e[3]||(e[3]=r("br",null,null,-1)),l(o).providerManifests[t.value.domain].codeowners.length?(m(),v(c,{key:0},{default:u(()=>[r("b",null,d(a.$t("settings.codeowners"))+": ",1),f(d(l(o).providerManifests[t.value.domain].codeowners.join(" / ")),1)]),_:1})):p("",!0),l(o).providerManifests[t.value.domain].documentation?(m(),v(c,{key:1},{default:u(()=>[r("b",null,d(a.$t("settings.need_help_setup_provider")),1),e[2]||(e[2]=f("  ",-1)),r("a",{onClick:e[0]||(e[0]=n=>l(T)(l(o).providerManifests[t.value.domain].documentation))},d(a.$t("settings.check_docs")),1)]),_:1})):p("",!0),e[4]||(e[4]=r("br",null,null,-1)),i(C),e[5]||(e[5]=r("br",null,null,-1)),e[6]||(e[6]=r("br",null,null,-1))])):p("",!0),i(C),t.value?(m(),v(O,{key:1,"config-entries":Object.values(t.value.values),disabled:!1,onSubmit:M,onAction:B},null,8,["config-entries"])):p("",!0)]),_:1}),i(j,{modelValue:s.value,"onUpdate:modelValue":e[1]||(e[1]=n=>s.value=n),scrim:"true",persistent:"",style:{display:"flex","align-items":"center","justify-content":"center"}},{default:u(()=>[i(D,{indeterminate:"",size:"64",color:"primary"})]),_:1},8,["modelValue"])]))}});export{Z as default};
