import{m as w,f as T,h as m,o as t,r as y,g as _,k as G,w as r,c as i,b as S,a as u,n as $,u as n,z as C,F as x,E as h,N as U,$ as N}from"./index-CdEV5Lsj.js";import{c as P,_ as z,a as B}from"./BasePage-aJlR_RJI.js";import{u as E,O as M}from"./index-DruWBKkm.js";import{_ as A}from"./UCheckbox.vue_vue_type_script_setup_true_lang-BeIZw2lc.js";import"./ULabel.vue_vue_type_script_setup_true_lang-DmdMPZfT.js";const R={__name:"TldCheckbox",props:w({label:{type:String,default:""},value:{type:String,default:""}},{modelValue:{type:Array,default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(d){const e=T(d,"modelValue"),l={checkboxLabel:{base:"gap-1 border border-brand-200 p-2 items-center flex rounded bg-white",label:"items-center flex !font-normal !p-0"},checkbox:"rounded-sm !size-3",iconWrapper:"rounded-sm !size-3",checkedIcon:{defaults:{size:"4xs"}}};return(s,o)=>{const c=A;return t(),m(c,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=p=>e.value=p),value:d.value,label:d.label,config:l},null,8,["modelValue","value","label"])}}},O={key:0,class:"relative"},j={key:0,class:"absolute inset-0 flex justify-center items-center"},F={class:"text-sm text-center"},K={__name:"Page",setup(d){const e=E(),l=y([]),s=y([]),o=_(()=>[...new Set(l.value.flatMap(a=>[...a.tlds]))]),c=_(()=>e.isDomainsLoading),p=_(()=>e.payments.mailin.isActive?{name:"GettingStarted/Payments/Step4"}:e.payments.banktransfer.isActive?{name:"GettingStarted/Payments/Step3"}:{name:"GettingStarted/Payments/Step1"});G(async()=>{e.setDomainsLoading(!0),await e.getDomainSalesTlds(),e.setDomainsLoading(!1),l.value=e.domains.tlds.availableGroupedTlds,s.value=e.domains.tlds.selectedTlds.length?e.domains.tlds.selectedTlds:o.value});async function k(a){s.value.length&&(e.setDomainsLoading(!0),await e.updateDomainSalesTlds({tlds:s.value}),e.setDomainsLoading(!1)),a()}return(a,b)=>{const D=z,g=P,L=N;return t(),m(B,{group:a.$t("group.domains"),"group-step":n(M)*4,title:a.$t("title.domains"),description:a.$t("description.tlds"),"prevent-next":c.value,prev:p.value,next:{name:"GettingStarted/Domains/Step2"},skip:{name:"GettingStarted/Domains/Step2"},loading:n(e).isDomainsLoading,onContinue:k},{default:r(()=>[l.value.length?(t(),i("div",O,[S("div",{class:$(["grid w-full grid-cols-2 gap-8 lg:w-[840px] mb-8",{"opacity-70":n(e).isDomainsLoading}])},[(t(!0),i(x,null,h(l.value,f=>(t(),i("div",{key:f.title,class:"space-y-3 col-span-1"},[u(g,{wrap:"",gap:"sm"},{default:r(()=>[u(D,{html:f.groupName,class:"mb-0 text-left text-sm"},null,8,["html"])]),_:2},1024),u(g,{wrap:"","no-mobile":"",gap:"sm",class:"sm:flex-row"},{default:r(()=>[(t(!0),i(x,null,h(f.tlds,v=>(t(),m(R,{key:v,modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=V=>s.value=V),disabled:n(e).isDomainsLoading,value:v,label:v},null,8,["modelValue","disabled","value","label"]))),128))]),_:2},1024)]))),128)),n(e).isDomainsLoading?(t(),i("div",j)):C("",!0)],2),u(g,{class:"justify-center"},{default:r(()=>[S("div",F,U(a.$t("label.selectedTld",{selected:s.value.length,totalTlds:o.value.length})),1)]),_:1})])):(t(),m(L,{key:1,loading:n(e).isDomainsLoading,color:"gray"},null,8,["loading"]))]),_:1},8,["group","group-step","title","description","prevent-next","prev","loading"])}}};export{K as default};
