import{n as C}from"./index.browser-7e542916.js";import{l as M,a8 as B,r as g,o as S,J as t,ai as E,b as N,w as P,v as f,B as h,j as i,y as l,q as a,O as c,K as d,x as y,z as r,G as v}from"./index-e5db0b73.js";import{_ as T}from"./EditConfig.vue_vue_type_style_index_0_lang-0800e29c.js";import{c as $,b as _,V as j}from"./VCard-c9b9f4e9.js";import{V as A,w as O}from"./VImg-7a057c50.js";import{f as U}from"./VMenu-d9833a31.js";import"./VExpansionPanel-671eca9e.js";import"./VTextField-46667b30.js";import"./VCheckboxBtn-46446b67.js";import"./VVirtualScroll-01555b84.js";import"./VDialog-cda0f95b.js";const z={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},D=r("br",null,null,-1),I=["href"],q=r("br",null,null,-1),G=r("br",null,null,-1),H=r("br",null,null,-1),ee=M({__name:"AddProvider",props:{domain:{}},setup(b){const u=b,V=B(),m=g([]),p=C(11),s=g(!1);S(()=>{const e=t.subscribe(E.AUTH_SESSION,o=>{if(o.object_id!==p)return;const n=o.data;window.open(n,"_blank").focus()});N(e)}),P(()=>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})},w=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(j,null,{default:l(()=>[a(t).providerManifests[e.domain]?(f(),h("div",z,[i($,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,I)]),_:1})):v("",!0)])):v("",!0),q,i(A),G,H,i(T,{"config-entries":m.value,disabled:!1,onSubmit:k,onAction:w},null,8,["config-entries"])]),_:1}),i(U,{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(O,{indeterminate:"",size:"64",color:"primary"})]),_:1},8,["modelValue"])]))}});export{ee as default};
