import{n as C}from"./index.browser-7e542916.js";import{l as M,a3 as N,r as g,o as S,L as t,a9 as B,b as E,w as P,y as f,I as h,j as i,A as l,x as a,R as c,N as d,z as y,D as r,H as v}from"./index-0b85ac09.js";import{_ as T}from"./EditConfig.vue_vue_type_style_index_0_lang-805c93f6.js";import{c as $,b as _,V as j}from"./VCard-49371ce3.js";import{V as A,w as D}from"./VImg-0b02a672.js";import{f as I}from"./VMenu-17c39295.js";import"./VExpansionPanel-4544781e.js";import"./VTextField-5fb2df8c.js";import"./VCheckboxBtn-f7c239ad.js";import"./VVirtualScroll-3bbd56c5.js";import"./VSpacer-e64ca4a5.js";import"./VDialog-69cc554b.js";const U={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},z=r("br",null,null,-1),H=["href"],O=r("br",null,null,-1),R=r("br",null,null,-1),L=r("br",null,null,-1),oe=M({__name:"AddProvider",props:{domain:{}},setup(b){const u=b,V=N(),m=g([]),p=C(11),s=g(!1);S(()=>{const e=t.subscribe(B.AUTH_SESSION,o=>{if(o.object_id!==p)return;const n=o.data;window.open(n,"_blank").focus()});E(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",U,[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}),z,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,H)]),_:1})):v("",!0)])):v("",!0),O,i(A),R,L,i(T,{"config-entries":m.value,disabled:!1,onSubmit:k,onAction:w},null,8,["config-entries"])]),_:1}),i(I,{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(D,{indeterminate:"",size:"64",color:"primary"})]),_:1},8,["modelValue"])]))}});export{oe as default};
