snarkjs/build/snarkjs.min.js

2 lines
647 KiB
JavaScript
Raw Normal View History

2020-08-20 11:44:00 +03:00
var snarkjs=function(A){"use strict";const I=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];function t(A,I){return I&&10!=I?16==I?"0x"==A.slice(0,2)?BigInt(A):BigInt("0x"+A):void 0:BigInt(A)}const i=t;function g(A,I){return BigInt(A)<<BigInt(I)}function C(A,I){return BigInt(A)>>BigInt(I)}const e=g,Q=C;var n=Object.freeze({__proto__:null,fromString:t,e:i,fromArray:function(A,I){let t=0n;I=BigInt(I);for(let i=0;i<A.length;i++)t=t*I+BigInt(A[i]);return t},bitLength:function(A){const t=A.toString(16);return 4*(t.length-1)+I[parseInt(t[0],16)]},isNegative:function(A){return BigInt(A)<0n},isZero:function(A){return!A},shiftLeft:g,shiftRight:C,shl:e,shr:Q,isOdd:function(A){return 1n==(1n&BigInt(A))},naf:function(A){let I=BigInt(A);const t=[];for(;I;){if(1n&I){const A=2-Number(I%4n);t.push(A),I-=BigInt(A)}else t.push(0);I>>=1n}return t},bits:function(A){let I=BigInt(A);const t=[];for(;I;)1n&I?t.push(1):t.push(0),I>>=1n;return t},toNumber:function(A){if(A>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("Number too big");return Number(A)},toArray:function(A,I){const t=[];let i=BigInt(A);for(I=BigInt(I);i;)t.unshift(Number(i%I)),i/=I;return t},add:function(A,I){return BigInt(A)+BigInt(I)},sub:function(A,I){return BigInt(A)-BigInt(I)},neg:function(A){return-BigInt(A)},mul:function(A,I){return BigInt(A)*BigInt(I)},square:function(A){return BigInt(A)*BigInt(A)},pow:function(A,I){return BigInt(A)**BigInt(I)},exp:function(A,I){return BigInt(A)**BigInt(I)},abs:function(A){return BigInt(A)>=0?BigInt(A):-BigInt(A)},div:function(A,I){return BigInt(A)/BigInt(I)},mod:function(A,I){return BigInt(A)%BigInt(I)},eq:function(A,I){return BigInt(A)==BigInt(I)},neq:function(A,I){return BigInt(A)!=BigInt(I)},lt:function(A,I){return BigInt(A)<BigInt(I)},gt:function(A,I){return BigInt(A)>BigInt(I)},leq:function(A,I){return BigInt(A)<=BigInt(I)},geq:function(A,I){return BigInt(A)>=BigInt(I)},band:function(A,I){return BigInt(A)&BigInt(I)},bor:function(A,I){return BigInt(A)|BigInt(I)},bxor:function(A,I){return BigInt(A)^BigInt(I)},land:function(A,I){return BigInt(A)&&BigInt(I)},lor:function(A,I){return BigInt(A)||BigInt(I)},lnot:function(A){return!BigInt(A)}});function B(A,I){return A(I={exports:{}},I.exports),I.exports}var r=B((function(A){var I=function(A){var t=1e7,i=9007199254740992,g=E(i),C="function"==typeof BigInt;function e(A,I,t,i){return void 0===A?e[0]:void 0!==I&&(10!=+I||t)?Y(A,I,t,i):Z(A)}function Q(A,I){this.value=A,this.sign=I,this.isSmall=!1}function n(A){this.value=A,this.sign=A<0,this.isSmall=!0}function B(A){this.value=A}function r(A){return-i<A&&A<i}function E(A){return A<1e7?[A]:A<1e14?[A%1e7,Math.floor(A/1e7)]:[A%1e7,Math.floor(A/1e7)%1e7,Math.floor(A/1e14)]}function h(A){o(A);var I=A.length;if(I<4&&U(A,g)<0)switch(I){case 0:return 0;case 1:return A[0];case 2:return A[0]+A[1]*t;default:return A[0]+(A[1]+A[2]*t)*t}return A}function o(A){for(var I=A.length;0===A[--I];);A.length=I+1}function s(A){for(var I=new Array(A),t=-1;++t<A;)I[t]=0;return I}function a(A){return A>0?Math.floor(A):Math.ceil(A)}function f(A,I){var i,g,C=A.length,e=I.length,Q=new Array(C),n=0,B=t;for(g=0;g<e;g++)n=(i=A[g]+I[g]+n)>=B?1:0,Q[g]=i-n*B;for(;g<C;)n=(i=A[g]+n)===B?1:0,Q[g++]=i-n*B;return n>0&&Q.push(n),Q}function w(A,I){return A.length>=I.length?f(A,I):f(I,A)}function D(A,I){var i,g,C=A.length,e=new Array(C),Q=t;for(g=0;g<C;g++)i=A[g]-Q+I,I=Math.floor(i/Q),e[g]=i-I*Q,I+=1;for(;I>0;)e[g++]=I%Q,I=Math.floor(I/Q);return e}function c(A,I){var t,i,g=A.length,C=I.length,e=new Array(g),Q=0;for(t=0;t<C;t++)(i=A[t]-Q-I[t])<0?(i+=1e7,Q=1):Q=0,e[t]=i;for(t=C;t<g;t++){if(!((i=A[t]-Q)<0)){e[t++]=i;break}i+=1e7,e[t]=i}for(;t<g;t++)e[t]=A[t];return o(e),e}function u(A,I,t){var i,g,C=A.length,e=new Array(C),B=-I;for(i=0;i<C;i++)g=A[i]+B,B=Math.floor(g/1e7),g%=1e7,e[i]=g<0?g+1e7:g;return"number"==typeof(e=h(e))?(t&&(e=-e),new n(e)):new Q(e,t)}function y(A,I){var t,i,g,C,e=A.length,Q=I.length,n=s(e+Q);for(g=0;g<e;++g){C=A[g];for(var B=0;B<Q;++B)t=C*I[B]+n[g+B],i=Math.floor(t/1e7),n[g+B]=t-1e7*i,n[g+B+1]+=i}return o(n),n}function p(A,I){var i,g,C=A.length,e=new Array(C),Q=t,n=0;for(g=0;g<C