import{n as w}from"./index.browser-7e542916.js";import{l as M,I as N,r as g,o as S,O as t,af as j,b as B,w as E,q as f,y as h,j as i,x as l,A as a,K as c,N as d,v as y,L as r,M as v}from"./index-e9211ef1.js";import{_ as P}from"./EditConfig.vue_vue_type_style_index_0_lang-29ce80f7.js";import{b as T,V as _,c as $}from"./VCard-138864fc.js";import{V as A}from"./VDivider-336c24cd.js";import{j as I}from"./VBtn-68784d55.js";import{c as O}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 U={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},D=r("br",null,null,-1),q=["href"],z=r("br",null,null,-1),H=r("br",null,null,-1),K=r("br",null,null,-1),oe=M({__name:"AddProvider",props:{domain:{}},setup(b){const u=b,V=N(),m=g([]),p=w(11),s=g(!1);S(()=>{const e=t.subscribe(j.AUTH_SESSION,o=>{if(o.object_id!==p)return;const n=o.data;window.open(n,"_blank").focus()});B(e)}),E(()=>u.domain,async e=>{e&&(m.value=await t.getProviderConfigEntries(u.domain,void 0,void 0,{session_id:p}))},{immediate:!0});const k=async function(e){s.value=!0,t.saveProviderConfig(u.domain,e).then(()=>{s.value=!1,V.push({name:"providersettings"})}).catch(o=>{alert(o),s.value=!1})},C=async function(e,o){s.value=!0;for(const n of m.value)n.value!==void 0&&o[n.key]==null&&(o[n.key]=n.value);o.session_id=p,t.getProviderConfigEntries(u.domain,void 0,e,o).then(n=>{m.value=n,s.value=!1}).catch(n=>{alert(n),s.value=!1})};return(e,o)=>(f(),h("section",null,[i($,null,{default:l(()=>[a(t).providerManifests[e.domain]?(f(),h("div",U,[i(T,null,{default:l(()=>[c(d(e.$t("settings.setup_provider",[a(t).providerManifests[e.domain].name])),1)]),_:1}),i(_,null,{default:l(()=>[c(d(a(t).providerManifests[e.domain].description),1)]),_:1}),D,a(t).providerManifests[e.domain].codeowners.length?(f(),y(_,{key:0},{default:l(()=>[r("b",null,d(e.$t("settings.codeowners"))+": ",1),c(d(a(t).providerManifests[e.domain].codeowners.join(" / ")),1)]),_:1})):v("",!0),a(t).providerManifests[e.domain].documentation?(f(),y(_,{key:1},{default:l(()=>[r("b",null,d(e.$t("settings.need_help_setup_provider")),1),c("  "),r("a",{href:a(t).providerManifests[e.domain].documentation,target:"_blank"},d(e.$t("settings.check_docs")),9,q)]),_:1})):v("",!0)])):v("",!0),z,i(A),H,K,i(P,{"config-entries":m.value,disabled:!1,onSubmit:k,onAction:C},null,8,["config-entries"])]),_:1}),i(O,{modelValue:s.value,"onUpdate:modelValue":o[0]||(o[0]=n=>s.value=n),scrim:"true",persistent:"",style:{display:"flex","align-items":"center","justify-content":"center"}},{default:l(()=>[i(I,{indeterminate:"",size:"64",color:"primary"})]),_:1},8,["modelValue"])]))}});export{oe as default};
