function a(t){const e=new TextEncoder().encode(t);let n="";for(const r of e)n+=String.fromCharCode(r);return btoa(n)}function c(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return new TextDecoder("utf-8",{fatal:!0}).decode(n)}function s(t){const e=t instanceof Uint8Array?t:new Uint8Array(t);let n="";for(const r of e)n+=r.toString(16).padStart(2,"0");return n}function u(t){const e=t.replace(/[^0-9a-fA-F]/g,"");if(e.length%2)throw new Error("Hex 长度必须为偶数");const n=new Uint8Array(e.length/2);for(let r=0;r<n.length;r++)n[r]=parseInt(e.substr(r*2,2),16);return n}function f(t){return new TextEncoder().encode(t)}function l(t){return new TextDecoder().decode(t)}function i(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");for(;e.length%4;)e+="=";return c(e)}function g(t){let e="";for(const n of t)e+=String.fromCharCode(n);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function d(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");for(;e.length%4;)e+="=";const n=atob(e),r=new Uint8Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return r}function h(t){return new TextEncoder().encode(t).length}export{i as a,c as b,d as c,g as d,s as e,l as f,a as g,u as h,f as s,h as u};
