/**
* Bundled by jsDelivr using Rollup v4.62.2 and esbuild v0.28.1.
* Original file: /npm/@noble/hashes@1.3.0/esm/sha256.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
import"./noble-crypto.js";function w(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function m(t){if(typeof t!="boolean")throw new Error(`Expected boolean, not ${t}`)}function U(t,...e){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function C(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");w(t.outputLen),w(t.blockLen)}function I(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function T(t,e){U(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const y={number:w,bool:m,bytes:U,hash:C,exists:I,output:T},A=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),a=(t,e)=>t<<32-e|t>>>e,_=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!_)throw new Error("Non little-endian hardware is not supported");Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function S(t){if(typeof t!="string")throw new TypeError(`utf8ToBytes expected string, got ${typeof t}`);return new TextEncoder().encode(t)}function L(t){if(typeof t=="string"&&(t=S(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}class k{clone(){return this._cloneInto()}}function B(t){const e=s=>t().update(L(s)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function D(t,e,n,s){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,s);const o=BigInt(32),f=BigInt(4294967295),i=Number(n>>o&f),c=Number(n&f),h=s?4:0,x=s?0:4;t.setUint32(e+h,i,s),t.setUint32(e+x,c,s)}class $ extends k{constructor(e,n,s,o){super(),this.blockLen=e,this.outputLen=n,this.padOffset=s,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=A(this.buffer)}update(e){y.exists(this);const{view:n,buffer:s,blockLen:o}=this;e=L(e);const f=e.length;for(let i=0;i<f;){const c=Math.min(o-this.pos,f-i);if(c===o){const h=A(e);for(;o<=f-i;i+=o)this.process(h,i);continue}s.set(e.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){y.exists(this),y.output(e,this),this.finished=!0;const{buffer:n,view:s,blockLen:o,isLE:f}=this;let{pos:i}=this;n[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(s,0),i=0);for(let r=i;r<o;r++)n[r]=0;D(s,o-8,BigInt(this.length*8),f),this.process(s,0);const c=A(e),h=this.outputLen;if(h%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const x=h/4,u=this.get();if(x>u.length)throw new Error("_sha2: outputLen bigger than state");for(let r=0;r<x;r++)c.setUint32(4*r,u[r],f)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const s=e.slice(0,n);return this.destroy(),s}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:s,length:o,finished:f,destroyed:i,pos:c}=this;return e.length=o,e.pos=c,e.finished=f,e.destroyed=i,o%n&&e.buffer.set(s),e}}const F=(t,e,n)=>t&e^~t&n,G=(t,e,n)=>t&e^t&n^e&n,N=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),b=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),p=new Uint32Array(64);class H extends ${constructor(){super(64,32,8,!1),this.A=b[0]|0,this.B=b[1]|0,this.C=b[2]|0,this.D=b[3]|0,this.E=b[4]|0,this.F=b[5]|0,this.G=b[6]|0,this.H=b[7]|0}get(){const{A:e,B:n,C:s,D:o,E:f,F:i,G:c,H:h}=this;return[e,n,s,o,f,i,c,h]}set(e,n,s,o,f,i,c,h){this.A=e|0,this.B=n|0,this.C=s|0,this.D=o|0,this.E=f|0,this.F=i|0,this.G=c|0,this.H=h|0}process(e,n){for(let r=0;r<16;r++,n+=4)p[r]=e.getUint32(n,!1);for(let r=16;r<64;r++){const l=p[r-15],d=p[r-2],E=a(l,7)^a(l,18)^l>>>3,g=a(d,17)^a(d,19)^d>>>10;p[r]=g+p[r-7]+E+p[r-16]|0}let{A:s,B:o,C:f,D:i,E:c,F:h,G:x,H:u}=this;for(let r=0;r<64;r++){const l=a(c,6)^a(c,11)^a(c,25),d=u+l+F(c,h,x)+N[r]+p[r]|0,g=(a(s,2)^a(s,13)^a(s,22))+G(s,o,f)|0;u=x,x=h,h=c,c=i+d|0,i=f,f=o,o=s,s=d+g|0}s=s+this.A|0,o=o+this.B|0,f=f+this.C|0,i=i+this.D|0,c=c+this.E|0,h=h+this.F|0,x=x+this.G|0,u=u+this.H|0,this.set(s,o,f,i,c,h,x,u)}roundClean(){p.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class V extends H{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const W=B(()=>new H),M=B(()=>new V);export{M as sha224,W as sha256};
//# sourceMappingURL=/sm/ca62abd53b825446bc284d916083e5a679dcf43aa71d5d6019708a75e9cf6ebd.map