(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.MultiformatsMurmur3 = factory()}(typeof self !== 'undefined' ? self : this, function () { "use strict";var MultiformatsMurmur3=(()=>{var v=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var j=(t,r)=>{for(var e in r)v(t,e,{get:r[e],enumerable:!0})},J=(t,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of G(r))!V.call(t,c)&&c!==e&&v(t,c,{get:()=>r[c],enumerable:!(n=C(r,c))||n.enumerable});return t};var K=t=>J(v({},"__esModule",{value:!0}),t);var vt={};j(vt,{murmur3128:()=>yt,murmur332:()=>bt,murmur364:()=>Lt});var At=new Uint8Array(0);var P=H,S=128,Q=127,W=~Q,X=Math.pow(2,31);function H(t,r,e){r=r||[],e=e||0;for(var n=e;t>=X;)r[e++]=t&255|S,t/=128;for(;t&W;)r[e++]=t&255|S,t>>>=7;return r[e]=t|0,H.bytes=e-n+1,r}var Y=M,Z=128,z=127;function M(t,n){var e=0,n=n||0,c=0,h=n,u,l=t.length;do{if(h>=l)throw M.bytes=0,new RangeError("Could not decode varint");u=t[h++],e+=c<28?(u&z)<=Z);return M.bytes=h-n,e}var k=Math.pow(2,7),tt=Math.pow(2,14),et=Math.pow(2,21),rt=Math.pow(2,28),nt=Math.pow(2,35),ot=Math.pow(2,42),ct=Math.pow(2,49),it=Math.pow(2,56),st=Math.pow(2,63),ft=function(t){return tthis.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(r instanceof Uint8Array){let n=this.encode(r);return n instanceof Uint8Array?q(n,this.code,e?.truncate):n.then(c=>q(c,this.code,e?.truncate))}else throw Error("Unknown type, must be binary type")}};function q(t,r,e){if(e!=null&&e!==t.byteLength){if(e>t.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${t.byteLength}`);t=t.subarray(0,e)}return I(r,t)}function g(t,r){let e=t.lo+r.lo>>>0,n=t.hi+r.hi+(e>>0;return{lo:e,hi:n}}function dt(t,r){return t+r>>>0}function x(t,r){let e=t.lo&65535,n=t.lo>>>16,c=r.lo&65535,h=r.lo>>>16,u=e*c,l=e*h,o=n*c,s=n*h,f=(u>>>16)+(l&65535)+(o&65535)>>>0,y=(f<<16|u&65535)>>>0,w=s+(l>>>16)+(o>>>16)+(f>>>16),d=Math.imul(t.lo,r.hi),m=Math.imul(t.hi,r.lo),R=w+d+m>>>0;return{lo:y,hi:R}}function p(t,r){return Math.imul(t,r)>>>0}function b(t,r){if(r===0)return t;if(r===32)return{lo:t.hi,hi:t.lo};if(r<32){let c=(t.lo<>>32-r)>>>0,h=(t.hi<>>32-r)>>>0;return{lo:c,hi:h}}r-=32;let e=(t.hi<>>32-r)>>>0,n=(t.lo<>>32-r)>>>0;return{lo:e,hi:n}}function a(t,r){return{lo:(t.lo^r.lo)>>>0,hi:(t.hi^r.hi)>>>0}}function E(t,r){if(r===0)return t;if(r<32){let e=(t.lo>>>r|t.hi<<32-r)>>>0,n=t.hi>>>r;return{lo:e,hi:n}}return{lo:t.hi>>>r-32,hi:0}}function i(t,r){return{lo:t>>>0,hi:r>>>0}}function N(t,r){return(t<>>32-r)>>>0}function F(t,r){let e=r*8,n=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24,c=t[e+4]|t[e+5]<<8|t[e+6]<<16|t[e+7]<<24;return{lo:n>>>0,hi:c>>>0}}function mt(t,r){let e=r*4;return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function O(t){return t=a(t,E(t,33)),t=x(t,i(3981806797,4283543511)),t=a(t,E(t,33)),t=x(t,i(444984403,3301882366)),t=a(t,E(t,33)),t}function gt(t){return t^=t>>>16,t=p(t,2246822507),t^=t>>>13,t=p(t,3266489909),t^=t>>>16,t}function T(t,r=0){let e=i(r,0),n=i(r,0),c=t.length,h=Math.floor(c/16),u=i(289559509,2277735313),l=i(658871167,1291169091);for(let w=0;w>>24&255,e.hi>>>16&255,e.hi>>>8&255,e.hi&255,e.lo>>>24&255,e.lo>>>16&255,e.lo>>>8&255,e.lo&255,n.hi>>>24&255,n.hi>>>16&255,n.hi>>>8&255,n.hi&255,n.lo>>>24&255,n.lo>>>16&255,n.lo>>>8&255,n.lo&255])}function $(t,r=0){let e=r>>>0,n=t.length,c=Math.floor(n/4),h=3432918353,u=461845907;for(let s=0;s>8;return new Uint8Array(r)}var bt=L({name:"murmur3-32",code:35,encode:t=>wt($(t))}),yt=L({name:"murmur3-128",code:34,encode:t=>T(t)}),Lt=L({name:"murmur3-x64-64",code:34,encode:t=>T(t).subarray(0,8)});return K(vt);})(); return MultiformatsMurmur3})); //# sourceMappingURL=index.min.js.map