import{F as k}from"./section-yxO0GkeZ.js";import{a4 as F,i as o,an as w,a5 as b,M as f,P as y,$ as u,w as K,f as M,bl as T,e as D}from"./app-JmgyQoR0.js";import{b as S,a as A,ad as I,h as _,t as V,l as r,j as e,K as l,E as t,z as s,F as L,G as N,i as U,u as m}from"./vue-y3KLWBaS.js";const E={class:"_formRoot"},P=m("i",{class:"ph-airplane-takeoff ph-bold ph-lg"},null,-1),j=m("i",{class:"ph-airplane-landing ph-bold ph-lg"},null,-1),q=m("i",{class:"ph-plus ph-bold ph-lg"},null,-1),z=m("i",{class:"ph-floppy-disk-back ph-bold ph-lg"},null,-1),J=S({__name:"migration",async setup(G){let h,v,d=A(""),n=A([""]);[h,v]=I(()=>g()),await h,v();async function g(){var i;if((i=u)!=null&&i.alsoKnownAs&&u.alsoKnownAs.length>0){const a=await M("users/show",{userIds:T(u.alsoKnownAs)});n.value=a&&a.length>0?a.map(c=>`@${D.toString(c)}`):[""]}else n.value=[""]}async function x(){const i=await y("i/known-as",{alsoKnownAs:n.value.map(a=>a.trim()).filter(a=>a!=="")});u.alsoKnownAs=i.alsoKnownAs,await g()}function B(){n.value.push("")}async function $(i){(await K({type:"warning",text:o.t("migrationConfirm",{account:i.toString()})})).canceled||y("i/move",{moveToAccount:i})}return F({title:o.ts.security,icon:"ph-lock ph-bold ph-lg"}),(i,a)=>(_(),V("div",E,[r(k,null,{label:e(()=>[l(t(s(o).ts.moveTo),1)]),default:e(()=>[r(w,{warn:"",class:"_formBlock"},{default:e(()=>[l(t(s(o).ts.moveAccountDescription),1)]),_:1}),r(b,{modelValue:d.value,"onUpdate:modelValue":a[0]||(a[0]=c=>d.value=c),class:"_formBlock"},{prefix:e(()=>[P]),label:e(()=>[l(t(s(o).ts.moveToLabel),1)]),_:1},8,["modelValue"]),r(f,{primary:"",danger:"",onClick:a[1]||(a[1]=c=>$(d.value))},{default:e(()=>[l(t(s(o).ts.moveAccount),1)]),_:1})]),_:1}),r(k,null,{label:e(()=>[l(t(s(o).ts.moveFrom),1)]),default:e(()=>[r(w,{warn:"",class:"_formBlock"},{default:e(()=>[l(t(s(o).ts.moveFromDescription),1)]),_:1}),(_(!0),V(L,null,N(n.value,(c,p)=>(_(),U(b,{modelValue:n.value[p],"onUpdate:modelValue":C=>n.value[p]=C,class:"_formBlock"},{prefix:e(()=>[j]),label:e(()=>[l(t(`#${p+1} ${s(o).ts.moveFromLabel}`),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]))),256)),r(f,{class:"button",disabled:n.value.length>=10,inline:"",style:{"margin-right":"8px"},onClick:B},{default:e(()=>[q,l(" "+t(s(o).ts.add),1)]),_:1},8,["disabled"]),r(f,{class:"button",inline:"",primary:"",onClick:x},{default:e(()=>[z,l(" "+t(s(o).ts.save),1)]),_:1})]),_:1})]))}});export{J as default};
