/// (function(L,P){typeof exports=="object"&&typeof module!="undefined"?P(exports):typeof define=="function"&&define.amd?define(["exports"],P):(L=typeof globalThis!="undefined"?globalThis:L||self,P(L.OTPAuth={}))})(this,function(L){"use strict";const P=i=>{const e=new ArrayBuffer(8),n=new Uint8Array(e);let t=i;for(let r=7;r>=0&&t!==0;r--)n[r]=t&255,t-=n[r],t/=256;return e};var Z=Object.freeze({__proto__:null,createHmac:void 0,randomBytes:void 0,timingSafeEqual:void 0});const W="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function _(i,e,n,t){let r,s,u;const c=e||[0],a=(n=n||0)>>>3,l=t===-1?3:0;for(r=0;r>>2,c.length<=s&&c.push(0),c[s]|=i[r]<<8*(l+t*(u%4));return{value:c,binLen:8*i.length+n}}function F(i,e,n){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw new Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(i){case"HEX":return function(t,r,s){return function(u,c,a,l){let w,f,h,g;if(u.length%2!=0)throw new Error("String of HEX type must be in byte increments");const m=c||[0],p=(a=a||0)>>>3,A=l===-1?3:0;for(w=0;w>>1)+p,h=g>>>2;m.length<=h;)m.push(0);m[h]|=f<<8*(A+l*(g%4))}return{value:m,binLen:4*u.length+a}}(t,r,s,n)};case"TEXT":return function(t,r,s){return function(u,c,a,l,w){let f,h,g,m,p,A,b,C,I=0;const H=a||[0],S=(l=l||0)>>>3;if(c==="UTF8")for(b=w===-1?3:0,g=0;gf?h.push(f):2048>f?(h.push(192|f>>>6),h.push(128|63&f)):55296>f||57344<=f?h.push(224|f>>>12,128|f>>>6&63,128|63&f):(g+=1,f=65536+((1023&f)<<10|1023&u.charCodeAt(g)),h.push(240|f>>>18,128|f>>>12&63,128|f>>>6&63,128|63&f)),m=0;m>>2;H.length<=p;)H.push(0);H[p]|=h[m]<<8*(b+w*(A%4)),I+=1}else for(b=w===-1?2:0,C=c==="UTF16LE"&&w!==1||c!=="UTF16LE"&&w===1,g=0;g>>8),A=I+S,p=A>>>2;H.length<=p;)H.push(0);H[p]|=f<<8*(b+w*(A%4)),I+=2}return{value:H,binLen:8*I+l}}(t,e,r,s,n)};case"B64":return function(t,r,s){return function(u,c,a,l){let w,f,h,g,m,p,A,b=0;const C=c||[0],I=(a=a||0)>>>3,H=l===-1?3:0,S=u.indexOf("=");if(u.search(/^[a-zA-Z0-9=+/]+$/)===-1)throw new Error("Invalid character in base-64 string");if(u=u.replace(/=/g,""),S!==-1&&S