import{C as e,E as t,Ht as n,I as r,Lt as i,Q as a,R as o,W as s,_ as c,d as l,g as u,gt as d,lt as f,ut as p,v as m,w as h}from"./vue.runtime.esm-bundler-56z_v_HH.js";import{a as g}from"./vue-router-_izWfDzq.js";import{n as _}from"./vue-i18n-DhldrKy8.js";import{D as v,M as y,T as b}from"./main-CkEZzrzw.js";import{n as x,t as S}from"./use-installation-feedback-D_coaJTi.js";var C=`install_language`,w=t({__name:`LanguageView`,setup(t){let w=g(),{t:T}=_(),{showRequestError:E}=S(),D=p(!0),O=p(!1),k=p([]),A=f({language:localStorage.getItem(C)??`en`}),j=b(u(()=>({language:{required:v.withMessage(T(`validation.required`),y)}})),A);r(async()=>{try{let{data:e}=await x.get(`/api/v1/installation/languages`);k.value=e?.languages??[]}catch(e){E(e)}finally{D.value=!1}});async function M(e){e&&typeof window.loadLanguage==`function`&&await window.loadLanguage(e)}async function N(){if(j.value.$touch(),!j.value.$invalid){O.value=!0;try{localStorage.setItem(C,A.language),await w.push({name:`installation.requirements`})}finally{O.value=!1}}}return(t,r)=>{let u=s(`BaseMultiselect`),f=s(`BaseInputGroup`),p=s(`BaseIcon`),g=s(`BaseButton`),_=s(`BaseWizardStep`);return o(),m(_,{title:t.$t(`wizard.install_language.title`),description:t.$t(`wizard.install_language.description`),"step-container-class":`w-full`},{default:a(()=>[c(`form`,{onSubmit:l(N,[`prevent`])},[h(f,{label:t.$t(`wizard.language`),error:d(j).language.$error?String(d(j).language.$errors[0]?.$message):void 0,"content-loading":D.value,required:``},{default:a(()=>[h(u,{modelValue:A.language,"onUpdate:modelValue":r[0]||=e=>A.language=e,"content-loading":D.value,options:k.value,label:`name`,"value-prop":`code`,placeholder:t.$t(`settings.preferences.select_language`),"track-by":`name`,searchable:!0,invalid:d(j).language.$error,class:`w-full`,onChange:M},null,8,[`modelValue`,`content-loading`,`options`,`placeholder`,`invalid`])]),_:1},8,[`label`,`error`,`content-loading`]),h(g,{type:`submit`,loading:O.value,disabled:O.value||D.value,class:`mt-8`},{right:a(e=>[h(p,{name:`ArrowRightIcon`,class:i(e.class)},null,8,[`class`])]),default:a(()=>[e(n(t.$t(`wizard.continue`))+` `,1)]),_:1},8,[`loading`,`disabled`])],32)]),_:1},8,[`title`,`description`])}}});export{w as default};