1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./C4g6tlrE.js","./DREHXjTd.js","./entry.CQl2gFVD.css"])))=>i.map(i=>d[i]); 2import{d as g,j as h,k as w,c as l,h as x,w as c,D as s,i as _,e as u,F as k,E,n as v,b4 as T,p as d,t as p,m as I,_ as N,q as $,b5 as C,aU as A}from"./DREHXjTd.js";import{n as B}from"./CB5mdFk9.js";const F={p6:""},S={flex:"~ col gap2"},O=g({__name:"index",setup(V){const{t:m}=h();w({title:()=>`${m("settings.users.label")} | ${m("nav.settings")}`});const o=C();async function y(){if(!confirm("Please aware that the tokens represent the **full access** to your accounts, and should be treated as sensitive information. Are you sure you want to export the tokens?"))return;const{saveAs:n}=await A(async()=>{const{saveAs:i}=await import("./C4g6tlrE.js").then(t=>t.F);return{saveAs:i}},__vite__mapDeps([0,1,2]),import.meta.url),e={"/":"Generated by Elk, you can import it to Elk to restore the tokens.","//":"This file represents the **full access** to your accounts, and should be treated as sensitive information.",version:1,origin:location.origin,users:o.value},a=new Blob([JSON.stringify(e,null,2)],{type:"application/json;charset=utf-8"});n(a,`elk-users-tokens-${new Date().toISOString().slice(0,10)}.json`)}async function b(){const n=await B({description:"Token File",mimeTypes:["application/json"]});try{const e=await n.text(),a=JSON.parse(e);if(a.version!==1)throw new Error("Invalid version");const i=a.users,t=[];for(const r of i)o.value.some(f=>f.server===r.server&&f.account.id===r.account.id)||t.push(r);if(t.length===0){alert("No new users found");return}if(!confirm(`Found ${t.length} new users, are you sure you want to import them?`))return;o.value=[...o.value,...t]}catch{alert("Invalid Elk tokens file")}}return(n,e)=>{const a=N,i=T,t=$;return l(),x(t,{back:"small-only"},{title:c(()=>[v(a,{as:"h1",secondary:""},{default:c(()=>[d(p(n.$t("settings.users.label")),1)]),_:1})]),default:c(()=>[s("div",F,[_(o).length?(l(),u(k,{key:0},[s("div",S,[(l(!0),u(k,null,E(_(o),r=>(l(),u("div",{key:r.account.id},[v(i,{account:r.account,"hover-card":!1},null,8,["account"])]))),128))]),e[1]||(e[1]=s("div",{my4:"",border:"t base"},null,-1)),s("button",{"btn-text":"",flex:"~ gap-2","items-center":"",onClick:y},[e[0]||(e[0]=s("span",{block:"","i-ri-download-2-line":""},null,-1)),d(" "+p(n.$t("settings.users.export")),1)])],64)):I("",!0),s("button",{"btn-text":"",flex:"~ gap-2","items-center":"",onClick:b},[e[2]||(e[2]=s("span",{block:"","i-ri-upload-2-line":""},null,-1)),d(" "+p(n.$t("settings.users.import")),1)])])]),_:1})}}});
2export{O as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.