(function(i,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(i=typeof globalThis<"u"?globalThis:i||self,o(i.PolyfillCryptoMethods={}))})(this,function(i){"use strict";let o;if(typeof globalThis<"u"&&(o=globalThis),typeof self<"u")o=self;else if(typeof window<"u")o=window;else if(typeof global<"u")o=global;else try{o=Function("return this")()}catch{}function p(){return o}function y(e){if(!ArrayBuffer.isView(e))throw new TypeError("Failed to execute 'getRandomValues' on 'Crypto': parameter 1 is not of type 'ArrayBufferView'.");if(e.byteLength>65536){const t="Failed to execute 'getRandomValues' on 'Crypto': The ArrayBufferView's byte length ("+e.byteLength+") exceeds the number of bytes of entropy available via this API (65536).";throw"DOMException"in globalThis?new globalThis.DOMException(t):new Error(t)}const n=Math.pow(256,e.BYTES_PER_ELEMENT);for(let t=0;t2147483647)throw new RangeError(`[ERR_OUT_OF_RANGE]: The value of "size" is out of range. It must be >= 0 && <= 2147483647. Received ${e}`);if(n&&typeof n!="function")throw new TypeError(`[ERR_INVALID_ARG_TYPE]: The "callback" argument must be of type function. Received type ${typeof n} (${n})`);if(!n){const t=new Uint8Array(e);return y(t)}return new Promise(t=>{const u=new Uint8Array(e);let f=null;try{n(null,y(u))}catch{n(f,u)}t(u)})}function l(){return s(16).reduce((t,u,f)=>{let a=t+u.toString(16).padStart(2,"0");return(f===3||f===5||f===7||f===9)&&(a+="-"),a},"")}const r=p();(function(){"crypto"in r?("getRandomValues"in r.crypto||(r.crypto.getRandomValues=y),"randomBytes"in r.crypto||(r.crypto.randomBytes=s),"randomUUID"in r.crypto||(r.crypto.randomUUID=l)):r.crypto={getRandomValues:y,randomBytes:s,randomUUID:l}})();const d=r.crypto;i.crypto=d,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});