"use strict";(self.webpackChunkrln_reactts=self.webpackChunkrln_reactts||[]).push([[913],{4913:function(A,B,Q){Q.r(B),Q.d(B,{MembershipKey:function(){return U},RLNInstance:function(){return M},RateLimitProof:function(){return p},create:function(){return o},toEpoch:function(){return Y}});var E=Q(6097),C=Q(6568),g=Q(1584),I=Q(7324);function w(A,B){return G.apply(this,arguments)}function G(){return(G=(0,I.Z)((0,E.Z)().mark((function A(B,Q){var C,g,I,w,G,D,h;return(0,E.Z)().wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return h=function(){for(var A=G.exports.getFieldNumLen32(),B=new Uint32Array(A),Q=0;QG)throw new Error("Too many values for input signal ".concat(A,"\n"));for(var N=0;N0;)Q.unshift(0),C--;return Q}function k(A){for(var B=BigInt(0),Q=BigInt(4294967296),E=0;E>>=0,E>>>=0,C)||function(A,B,Q,E,C,g){if(B>C||BA.length)throw new RangeError("Index out of range")}(A,B,Q,E,Math.pow(2,8*E)-1,0);var g=1,I=0;for(A[Q]=255&B;++I1&&void 0!==arguments[1]?arguments[1]:10,Q=Math.floor(A.getTime()/1e3/B);return b(new Uint8Array(32),Q,0,8)}var p=function(){function A(B){if((0,g.Z)(this,A),B.length<320)throw"invalid proof";this.proof=B.subarray(0,128),this.merkleRoot=B.subarray(128,160),this.epoch=B.subarray(160,192),this.shareX=B.subarray(192,224),this.shareY=B.subarray(224,256),this.nullifier=B.subarray(256,288),this.rlnIdentifier=B.subarray(288,320)}return(0,C.Z)(A,[{key:"toBytes",value:function(){return H(this.proof,this.merkleRoot,this.epoch,this.shareX,this.shareY,this.nullifier,this.rlnIdentifier)}}]),A}(),M=function(){function A(B,Q){(0,g.Z)(this,A),this.zkRLN=B,this.witnessCalculator=Q}return(0,C.Z)(A,[{key:"generateMembershipKey",value:function(){var A=F.BG(this.zkRLN);return new U(A)}},{key:"inserMember",value:function(A){F.Di(this.zkRLN,A)}},{key:"serializeMessage",value:function(A,B,Q,E){var C=b(new Uint8Array(8),A.length,0,8);return H(E,b(new Uint8Array(8),B,0,8),Q,C,A)}},{key:"generateProof",value:function(){var A=(0,I.Z)((0,E.Z)().mark((function A(B,Q,C,g){var I,w,G,N,D;return(0,E.Z)().wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(void 0==C?C=Y(new Date):C instanceof Date&&(C=Y(C)),32==C.length){A.next=3;break}throw"invalid epoch";case 3:if(32==g.length){A.next=5;break}throw"invalid id key";case 5:if(!(Q<0)){A.next=7;break}throw"index must be >= 0";case 7:return I=this.serializeMessage(B,Q,C,g),w=F.ur(this.zkRLN,I),G=F.T8(this.zkRLN,w),A.next=12,this.witnessCalculator.calculateWitness(G,!1);case 12:return N=A.sent,D=F.RP(this.zkRLN,N,w),A.abrupt("return",new p(D));case 15:case"end":return A.stop()}}),A,this)})));return function(B,Q,E,C){return A.apply(this,arguments)}}()},{key:"verifyProof",value:function(A){return A instanceof p&&(A=A.toBytes()),F.xG(this.zkRLN,A)}}]),A}()},329:function(A,B,Q){Q.d(B,{$0:function(){return i},At:function(){return NA},BG:function(){return Z},Bk:function(){return SA},CU:function(){return AA},Di:function(){return b},FS:function(){return jA},G0:function(){return oA},Hc:function(){return DA},Ih:function(){return J},Jm:function(){return wA},Km:function(){return YA},LK:function(){return j},Of:function(){return o},Or:function(){return MA},RP:function(){return T},SF:function(){return FA},SH:function(){return v},SK:function(){return cA},T8:function(){return Y},UP:function(){return sA},Vz:function(){return BA},Wl:function(){return r},XP:function(){return u},Yw:function(){return UA},Z5:function(){return _},_J:function(){return bA},_d:function(){return V},_f:function(){return gA},bc:function(){return CA},cA:function(){return QA},df:function(){return HA},eA:function(){return aA},eY:function(){return d},fY:function(){return pA},gk:function(){return P},h4:function(){return R},hF:function(){return $},i9:function(){return f},lH:function(){return kA},li:function(){return GA},m_:function(){return t},oH:function(){return TA},pT:function(){return y},qN:function(){return hA},qt:function(){return l},ug:function(){return m},ur:function(){return U},v1:function(){return KA},vC:function(){return e},wE:function(){return IA},wF:function(){return EA},xG:function(){return X},yq:function(){return n},z1:function(){return z}});var E=Q(3602),C=new("undefined"===typeof TextDecoder?(0,module.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});C.decode();var g=new Uint8Array;function I(){return 0===g.byteLength&&(g=new Uint8Array(E.memory.buffer)),g}function w(A,B){return C.decode(I().subarray(A,A+B))}var G=new Array(32).fill(void 0);G.push(void 0,null,!0,!1);var N=G.length;function D(A){N===G.length&&G.push(G.length+1);var B=N;return N=G[B],G[B]=A,B}function k(A){return G[A]}function h(A){var B=k(A);return function(A){A<36||(G[A]=N,N=A)}(A),B}var K=0,F=new("undefined"===typeof TextEncoder?(0,module.require)("util").TextEncoder:TextEncoder)("utf-8"),s="function"===typeof F.encodeInto?function(A,B){return F.encodeInto(A,B)}:function(A,B){var Q=F.encode(A);return B.set(Q),{read:A.length,written:Q.length}};function H(A,B,Q){if(void 0===Q){var E=F.encode(A),C=B(E.length);return I().subarray(C,C+E.length).set(E),K=E.length,C}for(var g=A.length,w=B(g),G=I(),N=0;N127)break;G[w+N]=D}if(N!==g){0!==N&&(A=A.slice(N)),w=Q(w,g,g=N+3*A.length);var k=I().subarray(w+N,w+g);N+=s(A,k).written}return K=N,w}var S=new Int32Array;function a(){return 0===S.byteLength&&(S=new Int32Array(E.memory.buffer)),S}function c(A){var B=typeof A;if("number"==B||"boolean"==B||null==A)return"".concat(A);if("string"==B)return'"'.concat(A,'"');if("symbol"==B){var Q=A.description;return null==Q?"Symbol":"Symbol(".concat(Q,")")}if("function"==B){var E=A.name;return"string"==typeof E&&E.length>0?"Function(".concat(E,")"):"Function"}if(Array.isArray(A)){var C=A.length,g="[";C>0&&(g+=c(A[0]));for(var I=1;I1))return toString.call(A);if("Object"==(w=G[1]))try{return"Object("+JSON.stringify(A)+")"}catch(N){return"Object"}return A instanceof Error?"".concat(A.name,": ").concat(A.message,"\n").concat(A.stack):w}function o(){E.init_panic_hook()}function j(A,B,Q){return E.newRLN(A,D(B),D(Q))}function U(A,B){return h(E.getSerializedRLNWitness(A,D(B)))}function b(A,B){try{var Q=E.__wbindgen_add_to_stack_pointer(-16);E.insertMember(Q,A,D(B));var C=a()[Q/4+0];if(a()[Q/4+1])throw h(C)}finally{E.__wbindgen_add_to_stack_pointer(16)}}function Y(A,B){return h(E.RLNWitnessToJson(A,D(B)))}var p=new Uint32Array;function M(A,B){for(var Q=B(4*A.length),C=(0===p.byteLength&&(p=new Uint32Array(E.memory.buffer)),p),g=0;g>>0]=h(Q)}function FA(){return L((function(A,B){return D(k(A).toString(B))}),arguments)}function sA(A,B){return D(new Error(w(A,B)))}function HA(A,B,Q){return D(k(A).set(k(B),k(Q)))}function SA(){return L((function(A){return D(Object.fromEntries(k(A)))}),arguments)}function aA(A){return D(k(A).buffer)}function cA(A,B,Q){return D(new Uint8Array(k(A),B>>>0,Q>>>0))}function oA(A){return D(new Uint8Array(k(A)))}function jA(A,B,Q){k(A).set(k(B),Q>>>0)}function UA(A){return k(A).length}function bA(A){return D(new Uint8Array(A>>>0))}function YA(A,B,Q){return D(k(A).subarray(B>>>0,Q>>>0))}function pA(A,B){var Q=H(c(k(B)),E.__wbindgen_malloc,E.__wbindgen_realloc),C=K;a()[A/4+1]=C,a()[A/4+0]=Q}function MA(A,B){throw new Error(w(A,B))}function TA(){return D(E.memory)}},3602:function(A,B,Q){var E=Q.w[A.id];A.exports=E;Q(329);E[""]()}}]); //# sourceMappingURL=913.9518dccb.chunk.js.map