import{n as x}from"./index.browser-OxPLOBIU.js";import{av as H,H as k,a3 as L,aL as o,b6 as S,a4 as $,J as I,aw as C,x as i,aB as s,bS as N,bs as P,ax as m,ay as w,d as u,az as a,aD as b,bb as h,bc as f,aI as V,bd as g,bP as M,cr as D,aQ as j,bM as O,K as U,aO as z,b3 as G,aA as J,bG as K}from"./index-C-Ivu3jU.js";import{E as Q}from"./EditConfig-Y1ATbenl.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 R={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},q={id:"auth",href:"",target:"_blank"},ue=H({__name:"AddProviderDetails",props:{domain:{}},setup(r){const T=J(),p=k([]),y=x(11),d=k(!1),c=k(!1),v=r;L(()=>{const n=o.subscribe(S.AUTH_SESSION,e=>{if(e.object_id!==y)return;const t=e.data;c.value=!0,window.setTimeout(()=>{const l=document.getElementById("auth");l.setAttribute("href",t),l.click()},100)});$(n)}),I(()=>v.domain,async n=>{n&&(p.value=await o.getProviderConfigEntries(v.domain,void 0,void 0,{session_id:y}))},{immediate:!0});const A=async function(n){d.value=!0,o.saveProviderConfig(v.domain,n).then(()=>{T.push({name:"providersettings"})}).catch(e=>{alert(e)}).finally(()=>{d.value=!1,c.value=!1})},B=async function(n,e){d.value=!0;for(const t of p.value)t.value!==void 0&&e[t.key]==null&&(e[t.key]=t.value);e.session_id=y,o.getProviderConfigEntries(v.domain,void 0,n,e).then(t=>{p.value=t}).catch(t=>{alert(t)}).finally(()=>{d.value=!1,c.value=!1})},E=function(n){const e=[],{t}=K();for(const l of n)l.includes("@")?e.push(`[${l.replace("@","")}](https://github.com/${l.replace("@","")})`):e.push(l);return`**${t("settings.codeowners")}**: `+e.join(" / ")};return(n,e)=>(m(),C("section",null,[i(N,null,{default:s(()=>[a(o).providerManifests[r.domain]?(m(),C("div",R,[i(h,null,{default:s(()=>[f(V(n.$t("settings.setup_provider",[a(o).providerManifests[r.domain].name])),1)]),_:1}),i(g,{innerHTML:a(M)(a(o).providerManifests[r.domain].description)},null,8,["innerHTML"]),e[3]||(e[3]=u("br",null,null,-1)),a(o).providerManifests[r.domain].codeowners.length?(m(),b(g,{key:0,innerHTML:a(M)(E(a(o).providerManifests[r.domain].codeowners))},null,8,["innerHTML"])):w("",!0),a(o).providerManifests[r.domain].documentation?(m(),b(g,{key:1},{default:s(()=>[u("b",null,V(n.$t("settings.need_help_setup_provider")),1),e[2]||(e[2]=f("  ",-1)),u("a",{onClick:e[0]||(e[0]=t=>a(D)(a(o).providerManifests[r.domain].documentation))},V(n.$t("settings.check_docs")),1)]),_:1})):w("",!0)])):w("",!0),e[4]||(e[4]=u("br",null,null,-1)),i(j),e[5]||(e[5]=u("br",null,null,-1)),e[6]||(e[6]=u("br",null,null,-1)),i(Q,{"config-entries":p.value,disabled:!1,onSubmit:A,onAction:B},null,8,["config-entries"])]),_:1}),i(P,{modelValue:d.value,"onUpdate:modelValue":e[1]||(e[1]=t=>d.value=t),scrim:"true",persistent:"",style:{display:"flex","align-items":"center","justify-content":"center"}},{default:s(()=>[c.value?(m(),b(z,{key:0,style:{"background-color":"white"}},{default:s(()=>[i(h,null,{default:s(()=>[...e[7]||(e[7]=[f("Authenticating...",-1)])]),_:1}),i(g,null,{default:s(()=>[...e[8]||(e[8]=[f("A new tab/popup should be opened where you can authenticate",-1)])]),_:1}),i(O,null,{default:s(()=>[u("a",q,[i(U,null,{default:s(()=>[...e[9]||(e[9]=[f("Click here if the popup did not open",-1)])]),_:1})])]),_:1})]),_:1})):(m(),b(G,{key:1,indeterminate:"",size:"64",color:"primary"}))]),_:1},8,["modelValue"])]))}});export{ue as default};
