import{u as V,a as x,b as A,r as w,c as E,o as N,d as l,e as t,n as R,f as s,g as a,t as n,w as C,h as B,i as m,j as k,k as _,l as d,m as r,p as S}from"./app-CzxRjCVM.js";import{F as U}from"./Form-EFIuWKGI.js";import{u as K}from"./bus-BNAtGMCo.js";/*! 2FAuth version 5.4.3 - Copyright (c) 2024 Bubka - https://github.com/Bubka/2FAuth */const Q={class:"container has-text-centered"},T={class:"columns quick-uploader"},D={class:"column is-full quick-uploader-button"},M={class:"quick-uploader-centerer"},j={class:"column is-full"},z={class:"block light-or-darker"},G={key:0,class:"block has-text-link"},H={class:"block has-text-link"},J={class:"block has-text-link"},Y={__name:"Start",setup(O){const f=S(),u=V(),b=K(),g=x(),h=A(),p=w(null),c=w(null),i=E(new U({qrcode:null,inputFormat:"fileUpload"}));function v(){i.clear(),i.qrcode=p.value.files[0],i.upload("/api/v1/qrcode/decode",{returnError:!0}).then(e=>{e.data.data.slice(0,33).toLowerCase()==="otpauth-migration://offline?data="?(b.migrationUri=e.data.data,f.push({name:"importAccounts"})):(b.decodedUri=e.data.data,f.push({name:"createAccount"}))}).catch(e=>{e.response.status!==422&&g.alert({text:e.response.data.message})})}function $(){f.push({name:"capture"})}return N(()=>{u.preferences.useDirectCapture&&u.preferences.defaultCaptureMode==="upload"&&c.value.click()}),(e,o)=>{const F=d("FieldError"),y=d("RouterLink"),I=d("ButtonBackCloseCancel"),L=d("VueFooter");return r(),l("div",Q,[t("div",T,[t("div",{class:R(["column is-full quick-uploader-header",{"is-invisible":s(h).count!==0}])},[a(n(e.$t("twofaccounts.no_account_here")),1),o[3]||(o[3]=t("br",null,null,-1)),a(" "+n(e.$t("twofaccounts.add_first_account")),1)],2),t("div",D,[t("div",M,[s(u).preferences.useBasicQrcodeReader?(r(),l("label",{key:0,role:"button",tabindex:"0",class:"button is-link is-medium is-rounded is-main",ref_key:"qrcodeInputLabel",ref:c,onKeyup:o[0]||(o[0]=C(q=>s(c).click(),["enter"]))},[t("input",{"aria-hidden":"true",tabindex:"-1",class:"file-input",type:"file",accept:"image/*",onChange:v,ref_key:"qrcodeInput",ref:p},null,544),a(" "+n(e.$t("twofaccounts.forms.upload_qrcode")),1)],544)):(r(),l("button",{key:1,type:"button",class:"button is-link is-medium is-rounded is-main",onClick:o[1]||(o[1]=q=>$())},n(e.$t("twofaccounts.forms.scan_qrcode")),1))]),s(i).errors.hasAny("qrcode")?(r(),B(F,{key:0,error:s(i).errors.get("qrcode"),field:"qrcode"},null,8,["error"])):m("",!0)]),t("div",j,[t("div",z,n(e.$t("twofaccounts.forms.alternative_methods")),1),s(u).preferences.useBasicQrcodeReader?m("",!0):(r(),l("div",G,[t("label",{role:"button",tabindex:"0",class:"button is-link is-outlined is-rounded",ref_key:"qrcodeInputLabel",ref:c,onKeyup:o[2]||(o[2]=C(q=>s(c).click(),["enter"]))},[t("input",{"aria-hidden":"true",tabindex:"-1",class:"file-input",type:"file",accept:"image/*",onChange:v,ref_key:"qrcodeInput",ref:p},null,544),a(" "+n(e.$t("twofaccounts.forms.upload_qrcode")),1)],544)])),t("div",H,[k(y,{class:"button is-link is-outlined is-rounded",to:{name:"createAccount"}},{default:_(()=>[a(n(e.$t("twofaccounts.forms.use_advanced_form")),1)]),_:1})]),t("div",J,[k(y,{id:"btnImport",class:"button is-link is-outlined is-rounded",to:{name:"importAccounts"}},{default:_(()=>[a(n(e.$t("twofaccounts.import.import")),1)]),_:1})])])]),k(L,{showButtons:!0},{default:_(()=>[s(h).isEmpty?m("",!0):(r(),B(I,{key:0,returnTo:{name:"accounts"},action:"back"}))]),_:1})])}}};export{Y as default}; //# sourceMappingURL=Start-CJ1-KH4-.js.map