import{be as L,cc as g,cd as T,b$ as k,ce as h,b8 as F,bd as P,bj as R}from"../main.js";function S(n,t,e,s){g(n);const i=T({dkLen:32,asyncTick:10},s),{c:u,dkLen:c,asyncTick:o}=i;if(k(u),k(c),k(o),u<1)throw new Error("iterations (c) should be >= 1");const d=h(t),a=h(e),f=new Uint8Array(c),l=F.create(n,d),r=l._cloneInto().update(a);return{c:u,dkLen:c,asyncTick:o,DK:f,PRF:l,PRFSalt:r}}function v(n,t,e,s,i){return n.destroy(),t.destroy(),s&&s.destroy(),P(i),e}function A(n,t,e,s){const{c:i,dkLen:u,DK:c,PRF:o,PRFSalt:d}=S(n,t,e,s);let a;const f=new Uint8Array(4),l=L(f),r=new Uint8Array(o.outputLen);for(let w=1,p=0;p<u;w++,p+=o.outputLen){const m=c.subarray(p,p+o.outputLen);l.setInt32(0,w,!1),(a=d._cloneInto(a)).update(f).digestInto(r),m.set(r.subarray(0,m.length));for(let b=1;b<i;b++){o._cloneInto(a).update(r).digestInto(r);for(let y=0;y<m.length;y++)m[y]^=r[y]}}return v(o,d,c,a,r)}/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */function I(n){if(typeof n!="string")throw new TypeError("invalid mnemonic type: "+typeof n);return n.normalize("NFKD")}function D(n){const t=I(n),e=t.split(" ");if(![12,15,18,21,24].includes(e.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:e}}const E=n=>I("mnemonic"+n);function U(n,t=""){return A(R,D(n).nfkd,E(t),{c:2048,dkLen:64})}export{U as m};
