2 lines
27 KiB
JavaScript
Raw Normal View History

2025-09-05 14:59:21 +08:00
const d=[],y=[],ot=typeof Uint8Array>"u"?Array:Uint8Array,L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let t=0,e=L.length;t<e;++t)d[t]=L[t],y[L.charCodeAt(t)]=t;y[45]=62,y[95]=63;function rt(t){const e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");let n=t.indexOf("=");n===-1&&(n=e);const o=n===e?0:4-n%4;return[n,o]}function it(t,e,n){return(e+n)*3/4-n}function ft(t){let e;const n=rt(t),o=n[0],r=n[1],i=new ot(it(t,o,r));let u=0;const h=r>0?o-4:o;let c;for(c=0;c<h;c+=4)e=y[t.charCodeAt(c)]<<18|y[t.charCodeAt(c+1)]<<12|y[t.charCodeAt(c+2)]<<6|y[t.charCodeAt(c+3)],i[u++]=e>>16&255,i[u++]=e>>8&255,i[u++]=e&255;return r===2&&(e=y[t.charCodeAt(c)]<<2|y[t.charCodeAt(c+1)]>>4,i[u++]=e&255),r===1&&(e=y[t.charCodeAt(c)]<<10|y[t.charCodeAt(c+1)]<<4|y[t.charCodeAt(c+2)]>>2,i[u++]=e>>8&255,i[u++]=e&255),i}function ut(t){return d[t>>18&63]+d[t>>12&63]+d[t>>6&63]+d[t&63]}function st(t,e,n){let o;const r=[];for(let i=e;i<n;i+=3)o=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),r.push(ut(o));return r.join("")}function P(t){let e;const n=t.length,o=n%3,r=[],i=16383;for(let u=0,h=n-o;u<h;u+=i)r.push(st(t,u,u+i>h?h:u+i));return o===1?(e=t[n-1],r.push(d[e>>2]+d[e<<4&63]+"==")):o===2&&(e=(t[n-2]<<8)+t[n-1],r.push(d[e>>10]+d[e>>4&63]+d[e<<2&63]+"=")),r.join("")}/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function R(t,e,n,o,r){let i,u;const h=r*8-o-1,c=(1<<h)-1,l=c>>1;let s=-7,a=n?r-1:0;const I=n?-1:1;let w=t[e+a];for(a+=I,i=w&(1<<-s)-1,w>>=-s,s+=h;s>0;)i=i*256+t[e+a],a+=I,s-=8;for(u=i&(1<<-s)-1,i>>=-s,s+=o;s>0;)u=u*256+t[e+a],a+=I,s-=8;if(i===0)i=1-l;else{if(i===c)return u?Number.NaN:(w?-1:1)*Number.POSITIVE_INFINITY;u=u+Math.pow(2,o),i=i-l}return(w?-1:1)*u*Math.pow(2,i-o)}function F(t,e,n,o,r,i){let u,h,c,l=i*8-r-1;const s=(1<<l)-1,a=s>>1,I=r===23?Math.pow(2,-24)-Math.pow(2,-77):0;let w=o?0:i-1;const O=o?1:-1,nt=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),Number.isNaN(e)||e===Number.POSITIVE_INFINITY?(h=Number.isNaN(e)?1:0,u=s):(u=Math.floor(Math.log2(e)),e*(c=Math.pow(2,-u))<1&&(u--,c*=2),e+=u+a>=1?I/c:I*Math.pow(2,1-a),e*c>=2&&(u++,c/=2),u+a>=s?(h=0,u=s):u+a>=1?(h=(e*c-1)*Math.pow(2,r),u=u+a):(h=e*Math.pow(2,a-1)*Math.pow(2,r),u=0));r>=8;)t[n+w]=h&255,w+=O,h/=256,r-=8;for(u=u<<r|h,l+=r;l>0;)t[n+w]=u&255,w+=O,u/=256,l-=8;t[n+w-O]|=nt*128}const k=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null,ht=50,N=2147483647;f.TYPED_ARRAY_SUPPORT=ct(),!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This environment lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ct(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.buffer}}),Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.byteOffset}});function m(t){if(t>N)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,f.prototype),e}function f(t,e,n){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return S(t)}return j(t,e,n)}f.poolSize=8192;function j(t,e,n){if(typeof t=="string")return lt(t,e);if(ArrayBuffer.isView(t))return pt(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(b(t,ArrayBuffer)||t&&b(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(b(t,SharedArrayBuffer)||t&&b(t.buffer,SharedArrayBuffer)))return Y(t,e,n);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const o=t.valueOf&&t.valueOf();if(o!