functionn(n){return(n=BigInt(n))>=0n?n:-n}functiont(n){if(1n===(n=BigInt(n)))return1;lett=1;do{t++}while((n>>=1n)>1n);returnt}functione(n,t){if((n=BigInt(n))<=0n|(t=BigInt(t))<=0n)thrownewRangeError("a and b MUST be > 0");lete=0n,r=1n,o=1n,i=0n;for(;0n!==n;){consts=t/n,a=t%n,c=e-o*s,u=r-i*s;t=n,n=a,e=o,r=i,o=c,i=u}return{g:t,x:e,y:r}}functionr(t,e){if(t=n(t),e=n(e),0n===t)returne;if(0n===e)returnt;letr=0n;for(;!(1n&(t|e));)t>>=1n,e>>=1n,r++;for(;!(1n&t);)t>>=1n;do{for(;!(1n&e);)e>>=1n;if(t>e){constn=t;t=e,e=n}e-=t}while(e);returnt<<r}functiono(t,e){returnt=BigInt(t),e=BigInt(e),0n===t&&0n===e?BigInt(0):n(t*e)/r(t,e)}functioni(n,t){return(n=BigInt(n))>=(t=BigInt(t))?n:t}functions(n,t){return(n=BigInt(n))>=(t=BigInt(t))?t:n}functiona(n,t){try{constr=e(u(n,t),t);return1n!==r.g?NaN:u(r.x,t)}catch(n){returnNaN}}functionc(t,e,r){if(0n===(r=BigInt(r)))returnNaN;if(1n===r)returnBigInt(0);if(t=u(t,r),(e=BigInt(e))<0n)returna(c(t,n(e),r),r);leto=1n;for(;e>0;)e%2n===1n&&(o=o*t%r),e/=2n,t=t**2n%r;returno}functionu(n,t){return(t=BigInt(t))<=0?NaN:(n=BigInt(n)%t)<0?n+t:n}functionf(n,t=16,e=!1){return"number"==typeofn&&(n=BigInt(n)),newPromise((e,r)=>{consto=newWorker(I());o.onmessage=n=>{o.terminate(),e(n.data.isPrime)},o.onmessageerror=n=>{r(n)},o.postMessage({rnd:n,iterations:t,id:0})})}functiong(n,t=16){if(n<1)thrownewRangeError("bitLength MUST be > 0");if(!S){lete=0n;do{e=$(d(n,!0))}while(!b(e,t));returnnewPromise(n=>{n(e)})}returnnewPromise(e=>{constr=[],o=(o,i)=>{if(o.isPrime){for(letn=0;n<r.length;n++)r[n].terminate();for(;r.length;)r.pop();e(o.value)}else{conste=$(d(n,!0));try{i.postMessage({rnd:e,iterations:t,id:o.id})}catch(n){}}};{constn=I();for(lett=0;t<self.navigator.hardwareConcurrency-1;t++){constt=newWorker(n);t.onmessage=n=>o(n.data,t),r.push(t)}}for(lete=0;e<r.length;e++)h(n,!0).then((function(n){consto=$(n);r[e].postMessage({rnd:o,iterations:t,id:e})}))})}functionl(n,t=16){if(n<1)thrownewRangeError("bitLength MUST be > 0");lete=0n;do{e=$(d(n,!0))}while(!b(e,t));returne}functionw(n,e=1n){if(n<=0n||e<0n||n<=e)thrownewError("inputs should be max > 0, min >= 0; max > min");constr=n-e,o=t(r);leti;do{i=$(d(o))}while(i>r);returni+e}asyncfunctionh(n,t=!1){if(n<1)thrownewRangeError("bitLength MUST be > 0");conste=Math.ceil(n/8),r=n%8,o=awaitm(e,!1);if(r&&(o[0]=o[0]&2**r-1),t){constn=r?2**(r-1):128;o[0]=o[0]|n}returno}functiond(n,t=!1){if(n<1)thrownewRangeError("bitLength MUST be > 0");conste=B(Math.ceil(n/8),!1),r=n%8;if(r&&(e[0]=e[0]&2**r-1),t){constn=r?2**(r-1):128;e[0]=e[0]|n}returne}functionm(n,t=!1){if(n<1)thrownewRangeError("byteLength MUST be > 0");returnnewPromise((function(e,r){{constr=newUint8Array(n);self.crypto.getRandomValues(r),t&&(r[0]=128|r[0]),e(r)}}))}functionB(n,t=!1){if(n<1)thrownewRangeError("byteLength MUST be > 0");{conste=newUint8Array(n);returnself.crypto.getRandomValues(e),t&&(e[0]=128|e[0]),e}}function$(n){lett=0n;for(consteofn.values()){constn=BigInt(e);t=(t<<BigInt(8))+n}returnt}functionI(){letn=`'use strict';const ${e.name}=${e.toString()};const ${a.name}=${a.toString()};const ${c.name}=${c.toString()};const ${u.name}=${u.toString()};const ${d.name}=${d.toString()};const ${B.name}=${B.toString()};const ${w.name}=${w.toString()};const ${f.name}=${b.toString()};${t.toString()}${$.toString()}`;returnn+=`onmessage = ${asyncfunction(n){constt=awaitf(n.data.rnd,n.data.iterations);postMessage({isPrime:t,value:n.data.rnd,id:n.data.id})}.toString()};`,function(n){n=`(() => {${n}})()`;constt=newBlob([n],{type:"text/javascript"});returnwindow.URL.createObjectURL(t)}(n)}functionb(n,t=16){if(2n===n)return!0;if(0n===(1n&n)||1n===n)return!1;conste=[3n,5n,7n,11n,13n,17n,19n,23n,29n,31n,37n,41n,43n,47n,53n,59n,61n,67n,71n,73n,79n,83n,89n,97n,101n,103n,107n,109n,113n,127n,131n,137n,139n,149n,151n,157n,163n,167n,173n,179n,181n,191n,193n,197n,199n,211n,223n,227n,229n,233n,239n,241n,251n,257n,263n,269n,271n,277n,281n,283n,293n,307n,311n,313n,317n,331n,337n,347n,349n,353n,359n,367n,373n,379n,383n,389n,397n,40