import{n as x}from"./index.browser-OxPLOBIU.js";import{ay as B,J as b,a3 as N,aP as o,bb as S,a4 as H,L,az as V,aA as d,o as a,aG as i,aB as k,E as f,aD as r,aI as y,bg as w,bh as v,aN as P,bi as h,c0 as C,aU as I,c3 as D,bV as U,M as $,aS as j,b8 as z,bx as O,aE as G,bN as J}from"./index-BRUnowC8.js";import{E as R}from"./EditConfig-DaKyuWVG.js";import"./VForm-CLH0WxMk.js";import"./VExpansionPanels-CpHWuHN2.js";import"./VDialog-Bh3mGVOy.js";import"./VAlert-DQxypmdN.js";import"./VSwitch-Dcs-7m3i.js";import"./VSelectionControl-Co1cRcmS.js";import"./VSlider-BOibVdD7.js";import"./VSelect-B-WERBOu.js";import"./VVirtualScroll-htzu2YXu.js";import"./VCheckboxBtn-D390s4L9.js";const q={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},F={id:"auth",href:"",target:"_blank"},se=B({__name:"AddProviderDetails",props:{domain:{}},setup(l){const M=G(),m=b([]),g=x(11),u=b(!1),c=b(!1),p=l;N(()=>{const n=o.subscribe(S.AUTH_SESSION,e=>{if(e.object_id!==g)return;const t=e.data;c.value=!0,window.setTimeout(()=>{const s=document.getElementById("auth");s.setAttribute("href",t),s.click()},100)});H(n)}),L(()=>p.domain,async n=>{n&&(m.value=await o.getProviderConfigEntries(p.domain,void 0,void 0,{session_id:g}))},{immediate:!0});const A=async function(n){u.value=!0,o.saveProviderConfig(p.domain,n).then(()=>{M.push({name:"providersettings"})}).catch(e=>{alert(e)}).finally(()=>{u.value=!1,c.value=!1})},T=async function(n,e){u.value=!0;for(const t of m.value)t.value!==void 0&&e[t.key]==null&&(e[t.key]=t.value);e.session_id=g,o.getProviderConfigEntries(p.domain,void 0,n,e).then(t=>{m.value=t}).catch(t=>{alert(t)}).finally(()=>{u.value=!1,c.value=!1})},E=function(n){const e=[],{t}=J();for(const s of n)s.includes("@")?e.push(`[${s.replace("@","")}](https://github.com/${s.replace("@","")})`):e.push(s);return`**${t("settings.codeowners")}**: `+e.join(" / ")};return(n,e)=>(d(),V("section",null,[a(D,null,{default:i(()=>[r(o).providerManifests[l.domain]?(d(),V("div",q,[a(w,null,{default:i(()=>[v(P(n.$t("settings.setup_provider",[r(o).providerManifests[l.domain].name])),1)]),_:1}),a(h,{innerHTML:r(C)(r(o).providerManifests[l.domain].description)},null,8,["innerHTML"]),e[1]||(e[1]=f("br",null,null,-1)),r(o).providerManifests[l.domain].codeowners.length?(d(),y(h,{key:0,innerHTML:r(C)(E(r(o).providerManifests[l.domain].codeowners))},null,8,["innerHTML"])):k("",!0)])):k("",!0),e[2]||(e[2]=f("br",null,null,-1)),a(I),e[3]||(e[3]=f("br",null,null,-1)),e[4]||(e[4]=f("br",null,null,-1)),a(R,{"config-entries":m.value,disabled:!1,onSubmit:A,onAction:T},null,8,["config-entries"])]),_:1}),a(O,{modelValue:u.value,"onUpdate:modelValue":e[0]||(e[0]=t=>u.value=t),scrim:"true",persistent:"",style:{display:"flex","align-items":"center","justify-content":"center"}},{default:i(()=>[c.value?(d(),y(j,{key:0,style:{"background-color":"white"}},{default:i(()=>[a(w,null,{default:i(()=>[...e[5]||(e[5]=[v("Authenticating...",-1)])]),_:1}),a(h,null,{default:i(()=>[...e[6]||(e[6]=[v("A new tab/popup should be opened where you can authenticate",-1)])]),_:1}),a(U,null,{default:i(()=>[f("a",F,[a($,null,{default:i(()=>[...e[7]||(e[7]=[v("Click here if the popup did not open",-1)])]),_:1})])]),_:1})]),_:1})):(d(),y(z,{key:1,indeterminate:"",size:"64",color:"primary"}))]),_:1},8,["modelValue"])]))}});export{se as default};
