@zk-email/sdk 0.0.86 → 0.0.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +30 -6
  2. package/dist/ccip-Blve6Z7V.js +2 -0
  3. package/dist/ccip-Blve6Z7V.js.map +1 -0
  4. package/dist/ccip-CqWwM5V5.mjs +147 -0
  5. package/dist/ccip-CqWwM5V5.mjs.map +1 -0
  6. package/dist/index-76VwpgoI.js +41 -0
  7. package/dist/index-76VwpgoI.js.map +1 -0
  8. package/dist/index-BBAkhu6Z.mjs +13594 -0
  9. package/dist/index-BBAkhu6Z.mjs.map +1 -0
  10. package/dist/types/auth.d.ts +3 -0
  11. package/dist/types/blueprint.d.ts +132 -0
  12. package/dist/types/blueprintValidation.d.ts +82 -0
  13. package/dist/types/chain/index.d.ts +2 -0
  14. package/dist/types/index.d.ts +24 -0
  15. package/dist/types/localProverWorkerString.d.ts +1 -0
  16. package/dist/types/proof.d.ts +52 -0
  17. package/dist/types/prover.d.ts +39 -0
  18. package/dist/types/relayerUtils.d.ts +14 -0
  19. package/dist/types/types/auth.d.ts +16 -0
  20. package/dist/types/types/blueprint.d.ts +155 -0
  21. package/dist/types/types/index.d.ts +6 -0
  22. package/dist/types/types/proof.d.ts +63 -0
  23. package/dist/types/types/prover.d.ts +8 -0
  24. package/dist/types/types/sdk.d.ts +5 -0
  25. package/dist/types/types/utils.d.ts +8 -0
  26. package/dist/types/user.d.ts +5 -0
  27. package/dist/types/utils.d.ts +7 -0
  28. package/dist/zk-email-sdk.cjs.js +2 -0
  29. package/dist/zk-email-sdk.cjs.js.map +1 -0
  30. package/dist/zk-email-sdk.es.js +18 -0
  31. package/dist/zk-email-sdk.es.js.map +1 -0
  32. package/package.json +25 -11
  33. package/dist/index.d.mts +0 -557
  34. package/dist/index.d.ts +0 -557
  35. package/dist/index.js +0 -7
  36. package/dist/index.js.map +0 -1
  37. package/dist/index.mjs +0 -7
  38. package/dist/index.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ export declare const localProverWorkerCode = "var Kn=typeof globalThis<\"u\"?globalThis:typeof window<\"u\"?window:typeof global<\"u\"?global:typeof self<\"u\"?self:{};function mr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,\"default\")?n.default:n}function wr(n){if(n.__esModule)return n;var e=n.default;if(typeof e==\"function\"){var t=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,\"__esModule\",{value:!0}),Object.keys(n).forEach(function(i){var o=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:function(){return n[i]}})}),t}function pi(n){throw new Error('Could not dynamically require \"'+n+'\". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Hi={exports:{}};/*!\n localForage -- Offline Storage, Improved\n Version 1.10.0\n https://localforage.github.io/localForage\n (c) 2013-2017 Mozilla, Apache License 2.0\n*/var Pa;function dl(){return Pa||(Pa=1,function(n,e){(function(t){n.exports=t()})(function(){return function t(i,o,a){function s(d,u){if(!o[d]){if(!i[d]){var w=typeof pi==\"function\"&&pi;if(!u&&w)return w(d,!0);if(l)return l(d,!0);var C=new Error(\"Cannot find module '\"+d+\"'\");throw C.code=\"MODULE_NOT_FOUND\",C}var h=o[d]={exports:{}};i[d][0].call(h.exports,function(m){var O=i[d][1][m];return s(O||m)},h,h.exports,t,i,o,a)}return o[d].exports}for(var l=typeof pi==\"function\"&&pi,g=0;g<a.length;g++)s(a[g]);return s}({1:[function(t,i,o){(function(a){var s=a.MutationObserver||a.WebKitMutationObserver,l;if(s){var g=0,d=new s(m),u=a.document.createTextNode(\"\");d.observe(u,{characterData:!0}),l=function(){u.data=g=++g%2}}else if(!a.setImmediate&&typeof a.MessageChannel<\"u\"){var w=new a.MessageChannel;w.port1.onmessage=m,l=function(){w.port2.postMessage(0)}}else\"document\"in a&&\"onreadystatechange\"in a.document.createElement(\"script\")?l=function(){var Q=a.document.createElement(\"script\");Q.onreadystatechange=function(){m(),Q.onreadystatechange=null,Q.parentNode.removeChild(Q),Q=null},a.document.documentElement.appendChild(Q)}:l=function(){setTimeout(m,0)};var C,h=[];function m(){C=!0;for(var Q,P,G=h.length;G;){for(P=h,h=[],Q=-1;++Q<G;)P[Q]();G=h.length}C=!1}i.exports=O;function O(Q){h.push(Q)===1&&!C&&l()}}).call(this,typeof Kn<\"u\"?Kn:typeof self<\"u\"?self:typeof window<\"u\"?window:{})},{}],2:[function(t,i,o){var a=t(1);function s(){}var l={},g=[\"REJECTED\"],d=[\"FULFILLED\"],u=[\"PENDING\"];i.exports=w;function w(y){if(typeof y!=\"function\")throw new TypeError(\"resolver must be a function\");this.state=u,this.queue=[],this.outcome=void 0,y!==s&&O(this,y)}w.prototype.catch=function(y){return this.then(null,y)},w.prototype.then=function(y,I){if(typeof y!=\"function\"&&this.state===d||typeof I!=\"function\"&&this.state===g)return this;var _=new this.constructor(s);if(this.state!==u){var M=this.state===d?y:I;h(_,M,this.outcome)}else this.queue.push(new C(_,y,I));return _};function C(y,I,_){this.promise=y,typeof I==\"function\"&&(this.onFulfilled=I,this.callFulfilled=this.otherCallFulfilled),typeof _==\"function\"&&(this.onRejected=_,this.callRejected=this.otherCallRejected)}C.prototype.callFulfilled=function(y){l.resolve(this.promise,y)},C.prototype.otherCallFulfilled=function(y){h(this.promise,this.onFulfilled,y)},C.prototype.callRejected=function(y){l.reject(this.promise,y)},C.prototype.otherCallRejected=function(y){h(this.promise,this.onRejected,y)};function h(y,I,_){a(function(){var M;try{M=I(_)}catch(F){return l.reject(y,F)}M===y?l.reject(y,new TypeError(\"Cannot resolve promise with itself\")):l.resolve(y,M)})}l.resolve=function(y,I){var _=Q(m,I);if(_.status===\"error\")return l.reject(y,_.value);var M=_.value;if(M)O(y,M);else{y.state=d,y.outcome=I;for(var F=-1,L=y.queue.length;++F<L;)y.queue[F].callFulfilled(I)}return y},l.reject=function(y,I){y.state=g,y.outcome=I;for(var _=-1,M=y.queue.length;++_<M;)y.queue[_].callRejected(I);return y};function m(y){var I=y&&y.then;if(y&&(typeof y==\"object\"||typeof y==\"function\")&&typeof I==\"function\")return function(){I.apply(y,arguments)}}function O(y,I){var _=!1;function M(K){_||(_=!0,l.reject(y,K))}function F(K){_||(_=!0,l.resolve(y,K))}function L(){I(F,M)}var D=Q(L);D.status===\"error\"&&M(D.value)}function Q(y,I){var _={};try{_.value=y(I),_.status=\"success\"}catch(M){_.status=\"error\",_.value=M}return _}w.resolve=P;function P(y){return y instanceof this?y:l.resolve(new this(s),y)}w.reject=G;function G(y){var I=new this(s);return l.reject(I,y)}w.all=st;function st(y){var I=this;if(Object.prototype.toString.call(y)!==\"[object Array]\")return this.reject(new TypeError(\"must be an array\"));var _=y.length,M=!1;if(!_)return this.resolve([]);for(var F=new Array(_),L=0,D=-1,K=new this(s);++D<_;)$(y[D],D);return K;function $(S,B){I.resolve(S).then(E,function(_t){M||(M=!0,l.reject(K,_t))});function E(_t){F[B]=_t,++L===_&&!M&&(M=!0,l.resolve(K,F))}}}w.race=N;function N(y){var I=this;if(Object.prototype.toString.call(y)!==\"[object Array]\")return this.reject(new TypeError(\"must be an array\"));var _=y.length,M=!1;if(!_)return this.resolve([]);for(var F=-1,L=new this(s);++F<_;)D(y[F]);return L;function D(K){I.resolve(K).then(function($){M||(M=!0,l.resolve(L,$))},function($){M||(M=!0,l.reject(L,$))})}}},{1:1}],3:[function(t,i,o){(function(a){typeof a.Promise!=\"function\"&&(a.Promise=t(2))}).call(this,typeof Kn<\"u\"?Kn:typeof self<\"u\"?self:typeof window<\"u\"?window:{})},{2:2}],4:[function(t,i,o){var a=typeof Symbol==\"function\"&&typeof Symbol.iterator==\"symbol\"?function(T){return typeof T}:function(T){return T&&typeof Symbol==\"function\"&&T.constructor===Symbol&&T!==Symbol.prototype?\"symbol\":typeof T};function s(T,Y){if(!(T instanceof Y))throw new TypeError(\"Cannot call a class as a function\")}function l(){try{if(typeof indexedDB<\"u\")return indexedDB;if(typeof webkitIndexedDB<\"u\")return webkitIndexedDB;if(typeof mozIndexedDB<\"u\")return mozIndexedDB;if(typeof OIndexedDB<\"u\")return OIndexedDB;if(typeof msIndexedDB<\"u\")return msIndexedDB}catch{return}}var g=l();function d(){try{if(!g||!g.open)return!1;var T=typeof openDatabase<\"u\"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),Y=typeof fetch==\"function\"&&fetch.toString().indexOf(\"[native code\")!==-1;return(!T||Y)&&typeof indexedDB<\"u\"&&typeof IDBKeyRange<\"u\"}catch{return!1}}function u(T,Y){T=T||[],Y=Y||{};try{return new Blob(T,Y)}catch(et){if(et.name!==\"TypeError\")throw et;for(var z=typeof BlobBuilder<\"u\"?BlobBuilder:typeof MSBlobBuilder<\"u\"?MSBlobBuilder:typeof MozBlobBuilder<\"u\"?MozBlobBuilder:WebKitBlobBuilder,it=new z,lt=0;lt<T.length;lt+=1)it.append(T[lt]);return it.getBlob(Y.type)}}typeof Promise>\"u\"&&t(3);var w=Promise;function C(T,Y){Y&&T.then(function(z){Y(null,z)},function(z){Y(z)})}function h(T,Y,z){typeof Y==\"function\"&&T.then(Y),typeof z==\"function\"&&T.catch(z)}function m(T){return typeof T!=\"string\"&&(console.warn(T+\" used as a key, but it is not a string.\"),T=String(T)),T}function O(){if(arguments.length&&typeof arguments[arguments.length-1]==\"function\")return arguments[arguments.length-1]}var Q=\"local-forage-detect-blob-support\",P=void 0,G={},st=Object.prototype.toString,N=\"readonly\",y=\"readwrite\";function I(T){for(var Y=T.length,z=new ArrayBuffer(Y),it=new Uint8Array(z),lt=0;lt<Y;lt++)it[lt]=T.charCodeAt(lt);return z}function _(T){return new w(function(Y){var z=T.transaction(Q,y),it=u([\"\"]);z.objectStore(Q).put(it,\"key\"),z.onabort=function(lt){lt.preventDefault(),lt.stopPropagation(),Y(!1)},z.oncomplete=function(){var lt=navigator.userAgent.match(/Chrome\\/(\\d+)/),et=navigator.userAgent.match(/Edge\\//);Y(et||!lt||parseInt(lt[1],10)>=43)}}).catch(function(){return!1})}function M(T){return typeof P==\"boolean\"?w.resolve(P):_(T).then(function(Y){return P=Y,P})}function F(T){var Y=G[T.name],z={};z.promise=new w(function(it,lt){z.resolve=it,z.reject=lt}),Y.deferredOperations.push(z),Y.dbReady?Y.dbReady=Y.dbReady.then(function(){return z.promise}):Y.dbReady=z.promise}function L(T){var Y=G[T.name],z=Y.deferredOperations.pop();if(z)return z.resolve(),z.promise}function D(T,Y){var z=G[T.name],it=z.deferredOperations.pop();if(it)return it.reject(Y),it.promise}function K(T,Y){return new w(function(z,it){if(G[T.name]=G[T.name]||St(),T.db)if(Y)F(T),T.db.close();else return z(T.db);var lt=[T.name];Y&&lt.push(T.version);var et=g.open.apply(g,lt);Y&&(et.onupgradeneeded=function(wt){var vt=et.result;try{vt.createObjectStore(T.storeName),wt.oldVersion<=1&&vt.createObjectStore(Q)}catch(Pt){if(Pt.name===\"ConstraintError\")console.warn('The database \"'+T.name+'\" has been upgraded from version '+wt.oldVersion+\" to version \"+wt.newVersion+', but the storage \"'+T.storeName+'\" already exists.');else throw Pt}}),et.onerror=function(wt){wt.preventDefault(),it(et.error)},et.onsuccess=function(){var wt=et.result;wt.onversionchange=function(vt){vt.target.close()},z(wt),L(T)}})}function $(T){return K(T,!1)}function S(T){return K(T,!0)}function B(T,Y){if(!T.db)return!0;var z=!T.db.objectStoreNames.contains(T.storeName),it=T.version<T.db.version,lt=T.version>T.db.version;if(it&&(T.version!==Y&&console.warn('The database \"'+T.name+`\" can't be downgraded from version `+T.db.version+\" to version \"+T.version+\".\"),T.version=T.db.version),lt||z){if(z){var et=T.db.version+1;et>T.version&&(T.version=et)}return!0}return!1}function E(T){return new w(function(Y,z){var it=new FileReader;it.onerror=z,it.onloadend=function(lt){var et=btoa(lt.target.result||\"\");Y({__local_forage_encoded_blob:!0,data:et,type:T.type})},it.readAsBinaryString(T)})}function _t(T){var Y=I(atob(T.data));return u([Y],{type:T.type})}function tt(T){return T&&T.__local_forage_encoded_blob}function ft(T){var Y=this,z=Y._initReady().then(function(){var it=G[Y._dbInfo.name];if(it&&it.dbReady)return it.dbReady});return h(z,T,T),z}function Bt(T){F(T);for(var Y=G[T.name],z=Y.forages,it=0;it<z.length;it++){var lt=z[it];lt._dbInfo.db&&(lt._dbInfo.db.close(),lt._dbInfo.db=null)}return T.db=null,$(T).then(function(et){return T.db=et,B(T)?S(T):et}).then(function(et){T.db=Y.db=et;for(var wt=0;wt<z.length;wt++)z[wt]._dbInfo.db=et}).catch(function(et){throw D(T,et),et})}function Ct(T,Y,z,it){it===void 0&&(it=1);try{var lt=T.db.transaction(T.storeName,Y);z(null,lt)}catch(et){if(it>0&&(!T.db||et.name===\"InvalidStateError\"||et.name===\"NotFoundError\"))return w.resolve().then(function(){if(!T.db||et.name===\"NotFoundError\"&&!T.db.objectStoreNames.contains(T.storeName)&&T.version<=T.db.version)return T.db&&(T.version=T.db.version+1),S(T)}).then(function(){return Bt(T).then(function(){Ct(T,Y,z,it-1)})}).catch(z);z(et)}}function St(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ot(T){var Y=this,z={db:null};if(T)for(var it in T)z[it]=T[it];var lt=G[z.name];lt||(lt=St(),G[z.name]=lt),lt.forages.push(Y),Y._initReady||(Y._initReady=Y.ready,Y.ready=ft);var et=[];function wt(){return w.resolve()}for(var vt=0;vt<lt.forages.length;vt++){var Pt=lt.forages[vt];Pt!==Y&&et.push(Pt._initReady().catch(wt))}var Ut=lt.forages.slice(0);return w.all(et).then(function(){return z.db=lt.db,$(z)}).then(function(Tt){return z.db=Tt,B(z,Y._defaultConfig.version)?S(z):Tt}).then(function(Tt){z.db=lt.db=Tt,Y._dbInfo=z;for(var Ht=0;Ht<Ut.length;Ht++){var ee=Ut[Ht];ee!==Y&&(ee._dbInfo.db=z.db,ee._dbInfo.version=z.version)}})}function Dt(T,Y){var z=this;T=m(T);var it=new w(function(lt,et){z.ready().then(function(){Ct(z._dbInfo,N,function(wt,vt){if(wt)return et(wt);try{var Pt=vt.objectStore(z._dbInfo.storeName),Ut=Pt.get(T);Ut.onsuccess=function(){var Tt=Ut.result;Tt===void 0&&(Tt=null),tt(Tt)&&(Tt=_t(Tt)),lt(Tt)},Ut.onerror=function(){et(Ut.error)}}catch(Tt){et(Tt)}})}).catch(et)});return C(it,Y),it}function x(T,Y){var z=this,it=new w(function(lt,et){z.ready().then(function(){Ct(z._dbInfo,N,function(wt,vt){if(wt)return et(wt);try{var Pt=vt.objectStore(z._dbInfo.storeName),Ut=Pt.openCursor(),Tt=1;Ut.onsuccess=function(){var Ht=Ut.result;if(Ht){var ee=Ht.value;tt(ee)&&(ee=_t(ee));var ae=T(ee,Ht.key,Tt++);ae!==void 0?lt(ae):Ht.continue()}else lt()},Ut.onerror=function(){et(Ut.error)}}catch(Ht){et(Ht)}})}).catch(et)});return C(it,Y),it}function ht(T,Y,z){var it=this;T=m(T);var lt=new w(function(et,wt){var vt;it.ready().then(function(){return vt=it._dbInfo,st.call(Y)===\"[object Blob]\"?M(vt.db).then(function(Pt){return Pt?Y:E(Y)}):Y}).then(function(Pt){Ct(it._dbInfo,y,function(Ut,Tt){if(Ut)return wt(Ut);try{var Ht=Tt.objectStore(it._dbInfo.storeName);Pt===null&&(Pt=void 0);var ee=Ht.put(Pt,T);Tt.oncomplete=function(){Pt===void 0&&(Pt=null),et(Pt)},Tt.onabort=Tt.onerror=function(){var ae=ee.error?ee.error:ee.transaction.error;wt(ae)}}catch(ae){wt(ae)}})}).catch(wt)});return C(lt,z),lt}function yt(T,Y){var z=this;T=m(T);var it=new w(function(lt,et){z.ready().then(function(){Ct(z._dbInfo,y,function(wt,vt){if(wt)return et(wt);try{var Pt=vt.objectStore(z._dbInfo.storeName),Ut=Pt.delete(T);vt.oncomplete=function(){lt()},vt.onerror=function(){et(Ut.error)},vt.onabort=function(){var Tt=Ut.error?Ut.error:Ut.transaction.error;et(Tt)}}catch(Tt){et(Tt)}})}).catch(et)});return C(it,Y),it}function U(T){var Y=this,z=new w(function(it,lt){Y.ready().then(function(){Ct(Y._dbInfo,y,function(et,wt){if(et)return lt(et);try{var vt=wt.objectStore(Y._dbInfo.storeName),Pt=vt.clear();wt.oncomplete=function(){it()},wt.onabort=wt.onerror=function(){var Ut=Pt.error?Pt.error:Pt.transaction.error;lt(Ut)}}catch(Ut){lt(Ut)}})}).catch(lt)});return C(z,T),z}function r(T){var Y=this,z=new w(function(it,lt){Y.ready().then(function(){Ct(Y._dbInfo,N,function(et,wt){if(et)return lt(et);try{var vt=wt.objectStore(Y._dbInfo.storeName),Pt=vt.count();Pt.onsuccess=function(){it(Pt.result)},Pt.onerror=function(){lt(Pt.error)}}catch(Ut){lt(Ut)}})}).catch(lt)});return C(z,T),z}function dt(T,Y){var z=this,it=new w(function(lt,et){if(T<0){lt(null);return}z.ready().then(function(){Ct(z._dbInfo,N,function(wt,vt){if(wt)return et(wt);try{var Pt=vt.objectStore(z._dbInfo.storeName),Ut=!1,Tt=Pt.openKeyCursor();Tt.onsuccess=function(){var Ht=Tt.result;if(!Ht){lt(null);return}T===0||Ut?lt(Ht.key):(Ut=!0,Ht.advance(T))},Tt.onerror=function(){et(Tt.error)}}catch(Ht){et(Ht)}})}).catch(et)});return C(it,Y),it}function k(T){var Y=this,z=new w(function(it,lt){Y.ready().then(function(){Ct(Y._dbInfo,N,function(et,wt){if(et)return lt(et);try{var vt=wt.objectStore(Y._dbInfo.storeName),Pt=vt.openKeyCursor(),Ut=[];Pt.onsuccess=function(){var Tt=Pt.result;if(!Tt){it(Ut);return}Ut.push(Tt.key),Tt.continue()},Pt.onerror=function(){lt(Pt.error)}}catch(Tt){lt(Tt)}})}).catch(lt)});return C(z,T),z}function f(T,Y){Y=O.apply(this,arguments);var z=this.config();T=typeof T!=\"function\"&&T||{},T.name||(T.name=T.name||z.name,T.storeName=T.storeName||z.storeName);var it=this,lt;if(!T.name)lt=w.reject(\"Invalid arguments\");else{var et=T.name===z.name&&it._dbInfo.db,wt=et?w.resolve(it._dbInfo.db):$(T).then(function(vt){var Pt=G[T.name],Ut=Pt.forages;Pt.db=vt;for(var Tt=0;Tt<Ut.length;Tt++)Ut[Tt]._dbInfo.db=vt;return vt});T.storeName?lt=wt.then(function(vt){if(vt.objectStoreNames.contains(T.storeName)){var Pt=vt.version+1;F(T);var Ut=G[T.name],Tt=Ut.forages;vt.close();for(var Ht=0;Ht<Tt.length;Ht++){var ee=Tt[Ht];ee._dbInfo.db=null,ee._dbInfo.version=Pt}var ae=new w(function(re,fe){var de=g.open(T.name,Pt);de.onerror=function(ve){var kn=de.result;kn.close(),fe(ve)},de.onupgradeneeded=function(){var ve=de.result;ve.deleteObjectStore(T.storeName)},de.onsuccess=function(){var ve=de.result;ve.close(),re(ve)}});return ae.then(function(re){Ut.db=re;for(var fe=0;fe<Tt.length;fe++){var de=Tt[fe];de._dbInfo.db=re,L(de._dbInfo)}}).catch(function(re){throw(D(T,re)||w.resolve()).catch(function(){}),re})}}):lt=wt.then(function(vt){F(T);var Pt=G[T.name],Ut=Pt.forages;vt.close();for(var Tt=0;Tt<Ut.length;Tt++){var Ht=Ut[Tt];Ht._dbInfo.db=null}var ee=new w(function(ae,re){var fe=g.deleteDatabase(T.name);fe.onerror=function(){var de=fe.result;de&&de.close(),re(fe.error)},fe.onblocked=function(){console.warn('dropInstance blocked for database \"'+T.name+'\" until all open connections are closed')},fe.onsuccess=function(){var de=fe.result;de&&de.close(),ae(de)}});return ee.then(function(ae){Pt.db=ae;for(var re=0;re<Ut.length;re++){var fe=Ut[re];L(fe._dbInfo)}}).catch(function(ae){throw(D(T,ae)||w.resolve()).catch(function(){}),ae})})}return C(lt,Y),lt}var ct={_driver:\"asyncStorage\",_initStorage:Ot,_support:d(),iterate:x,getItem:Dt,setItem:ht,removeItem:yt,clear:U,length:r,key:dt,keys:k,dropInstance:f};function It(){return typeof openDatabase==\"function\"}var bt=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",H=\"~~local_forage_type~\",Z=/^~~local_forage_type~([^~]+)~/,V=\"__lfsc__:\",gt=V.length,Ft=\"arbf\",qt=\"blob\",W=\"si08\",b=\"ui08\",xt=\"uic8\",Vt=\"si16\",$t=\"si32\",v=\"ur16\",p=\"ui32\",A=\"fl32\",R=\"fl64\",j=gt+Ft.length,J=Object.prototype.toString;function nt(T){var Y=T.length*.75,z=T.length,it,lt=0,et,wt,vt,Pt;T[T.length-1]===\"=\"&&(Y--,T[T.length-2]===\"=\"&&Y--);var Ut=new ArrayBuffer(Y),Tt=new Uint8Array(Ut);for(it=0;it<z;it+=4)et=bt.indexOf(T[it]),wt=bt.indexOf(T[it+1]),vt=bt.indexOf(T[it+2]),Pt=bt.indexOf(T[it+3]),Tt[lt++]=et<<2|wt>>4,Tt[lt++]=(wt&15)<<4|vt>>2,Tt[lt++]=(vt&3)<<6|Pt&63;return Ut}function Mt(T){var Y=new Uint8Array(T),z=\"\",it;for(it=0;it<Y.length;it+=3)z+=bt[Y[it]>>2],z+=bt[(Y[it]&3)<<4|Y[it+1]>>4],z+=bt[(Y[it+1]&15)<<2|Y[it+2]>>6],z+=bt[Y[it+2]&63];return Y.length%3===2?z=z.substring(0,z.length-1)+\"=\":Y.length%3===1&&(z=z.substring(0,z.length-2)+\"==\"),z}function jt(T,Y){var z=\"\";if(T&&(z=J.call(T)),T&&(z===\"[object ArrayBuffer]\"||T.buffer&&J.call(T.buffer)===\"[object ArrayBuffer]\")){var it,lt=V;T instanceof ArrayBuffer?(it=T,lt+=Ft):(it=T.buffer,z===\"[object Int8Array]\"?lt+=W:z===\"[object Uint8Array]\"?lt+=b:z===\"[object Uint8ClampedArray]\"?lt+=xt:z===\"[object Int16Array]\"?lt+=Vt:z===\"[object Uint16Array]\"?lt+=v:z===\"[object Int32Array]\"?lt+=$t:z===\"[object Uint32Array]\"?lt+=p:z===\"[object Float32Array]\"?lt+=A:z===\"[object Float64Array]\"?lt+=R:Y(new Error(\"Failed to get type for BinaryArray\"))),Y(lt+Mt(it))}else if(z===\"[object Blob]\"){var et=new FileReader;et.onload=function(){var wt=H+T.type+\"~\"+Mt(this.result);Y(V+qt+wt)},et.readAsArrayBuffer(T)}else try{Y(JSON.stringify(T))}catch(wt){console.error(\"Couldn't convert value into a JSON string: \",T),Y(null,wt)}}function Xt(T){if(T.substring(0,gt)!==V)return JSON.parse(T);var Y=T.substring(j),z=T.substring(gt,j),it;if(z===qt&&Z.test(Y)){var lt=Y.match(Z);it=lt[1],Y=Y.substring(lt[0].length)}var et=nt(Y);switch(z){case Ft:return et;case qt:return u([et],{type:it});case W:return new Int8Array(et);case b:return new Uint8Array(et);case xt:return new Uint8ClampedArray(et);case Vt:return new Int16Array(et);case v:return new Uint16Array(et);case $t:return new Int32Array(et);case p:return new Uint32Array(et);case A:return new Float32Array(et);case R:return new Float64Array(et);default:throw new Error(\"Unkown type: \"+z)}}var ne={serialize:jt,deserialize:Xt,stringToBuffer:nt,bufferToString:Mt};function te(T,Y,z,it){T.executeSql(\"CREATE TABLE IF NOT EXISTS \"+Y.storeName+\" (id INTEGER PRIMARY KEY, key unique, value)\",[],z,it)}function Me(T){var Y=this,z={db:null};if(T)for(var it in T)z[it]=typeof T[it]!=\"string\"?T[it].toString():T[it];var lt=new w(function(et,wt){try{z.db=openDatabase(z.name,String(z.version),z.description,z.size)}catch(vt){return wt(vt)}z.db.transaction(function(vt){te(vt,z,function(){Y._dbInfo=z,et()},function(Pt,Ut){wt(Ut)})},wt)});return z.serializer=ne,lt}function ge(T,Y,z,it,lt,et){T.executeSql(z,it,lt,function(wt,vt){vt.code===vt.SYNTAX_ERR?wt.executeSql(\"SELECT name FROM sqlite_master WHERE type='table' AND name = ?\",[Y.storeName],function(Pt,Ut){Ut.rows.length?et(Pt,vt):te(Pt,Y,function(){Pt.executeSql(z,it,lt,et)},et)},et):et(wt,vt)},et)}function be(T,Y){var z=this;T=m(T);var it=new w(function(lt,et){z.ready().then(function(){var wt=z._dbInfo;wt.db.transaction(function(vt){ge(vt,wt,\"SELECT * FROM \"+wt.storeName+\" WHERE key = ? LIMIT 1\",[T],function(Pt,Ut){var Tt=Ut.rows.length?Ut.rows.item(0).value:null;Tt&&(Tt=wt.serializer.deserialize(Tt)),lt(Tt)},function(Pt,Ut){et(Ut)})})}).catch(et)});return C(it,Y),it}function ye(T,Y){var z=this,it=new w(function(lt,et){z.ready().then(function(){var wt=z._dbInfo;wt.db.transaction(function(vt){ge(vt,wt,\"SELECT * FROM \"+wt.storeName,[],function(Pt,Ut){for(var Tt=Ut.rows,Ht=Tt.length,ee=0;ee<Ht;ee++){var ae=Tt.item(ee),re=ae.value;if(re&&(re=wt.serializer.deserialize(re)),re=T(re,ae.key,ee+1),re!==void 0){lt(re);return}}lt()},function(Pt,Ut){et(Ut)})})}).catch(et)});return C(it,Y),it}function me(T,Y,z,it){var lt=this;T=m(T);var et=new w(function(wt,vt){lt.ready().then(function(){Y===void 0&&(Y=null);var Pt=Y,Ut=lt._dbInfo;Ut.serializer.serialize(Y,function(Tt,Ht){Ht?vt(Ht):Ut.db.transaction(function(ee){ge(ee,Ut,\"INSERT OR REPLACE INTO \"+Ut.storeName+\" (key, value) VALUES (?, ?)\",[T,Tt],function(){wt(Pt)},function(ae,re){vt(re)})},function(ee){if(ee.code===ee.QUOTA_ERR){if(it>0){wt(me.apply(lt,[T,Pt,z,it-1]));return}vt(ee)}})})}).catch(vt)});return C(et,z),et}function Ce(T,Y,z){return me.apply(this,[T,Y,z,1])}function Te(T,Y){var z=this;T=m(T);var it=new w(function(lt,et){z.ready().then(function(){var wt=z._dbInfo;wt.db.transaction(function(vt){ge(vt,wt,\"DELETE FROM \"+wt.storeName+\" WHERE key = ?\",[T],function(){lt()},function(Pt,Ut){et(Ut)})})}).catch(et)});return C(it,Y),it}function Re(T){var Y=this,z=new w(function(it,lt){Y.ready().then(function(){var et=Y._dbInfo;et.db.transaction(function(wt){ge(wt,et,\"DELETE FROM \"+et.storeName,[],function(){it()},function(vt,Pt){lt(Pt)})})}).catch(lt)});return C(z,T),z}function q(T){var Y=this,z=new w(function(it,lt){Y.ready().then(function(){var et=Y._dbInfo;et.db.transaction(function(wt){ge(wt,et,\"SELECT COUNT(key) as c FROM \"+et.storeName,[],function(vt,Pt){var Ut=Pt.rows.item(0).c;it(Ut)},function(vt,Pt){lt(Pt)})})}).catch(lt)});return C(z,T),z}function c(T,Y){var z=this,it=new w(function(lt,et){z.ready().then(function(){var wt=z._dbInfo;wt.db.transaction(function(vt){ge(vt,wt,\"SELECT key FROM \"+wt.storeName+\" WHERE id = ? LIMIT 1\",[T+1],function(Pt,Ut){var Tt=Ut.rows.length?Ut.rows.item(0).key:null;lt(Tt)},function(Pt,Ut){et(Ut)})})}).catch(et)});return C(it,Y),it}function X(T){var Y=this,z=new w(function(it,lt){Y.ready().then(function(){var et=Y._dbInfo;et.db.transaction(function(wt){ge(wt,et,\"SELECT key FROM \"+et.storeName,[],function(vt,Pt){for(var Ut=[],Tt=0;Tt<Pt.rows.length;Tt++)Ut.push(Pt.rows.item(Tt).key);it(Ut)},function(vt,Pt){lt(Pt)})})}).catch(lt)});return C(z,T),z}function ut(T){return new w(function(Y,z){T.transaction(function(it){it.executeSql(\"SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'\",[],function(lt,et){for(var wt=[],vt=0;vt<et.rows.length;vt++)wt.push(et.rows.item(vt).name);Y({db:T,storeNames:wt})},function(lt,et){z(et)})},function(it){z(it)})})}function ot(T,Y){Y=O.apply(this,arguments);var z=this.config();T=typeof T!=\"function\"&&T||{},T.name||(T.name=T.name||z.name,T.storeName=T.storeName||z.storeName);var it=this,lt;return T.name?lt=new w(function(et){var wt;T.name===z.name?wt=it._dbInfo.db:wt=openDatabase(T.name,\"\",\"\",0),T.storeName?et({db:wt,storeNames:[T.storeName]}):et(ut(wt))}).then(function(et){return new w(function(wt,vt){et.db.transaction(function(Pt){function Ut(ae){return new w(function(re,fe){Pt.executeSql(\"DROP TABLE IF EXISTS \"+ae,[],function(){re()},function(de,ve){fe(ve)})})}for(var Tt=[],Ht=0,ee=et.storeNames.length;Ht<ee;Ht++)Tt.push(Ut(et.storeNames[Ht]));w.all(Tt).then(function(){wt()}).catch(function(ae){vt(ae)})},function(Pt){vt(Pt)})})}):lt=w.reject(\"Invalid arguments\"),C(lt,Y),lt}var rt={_driver:\"webSQLStorage\",_initStorage:Me,_support:It(),iterate:ye,getItem:be,setItem:Ce,removeItem:Te,clear:Re,length:q,key:c,keys:X,dropInstance:ot};function at(){try{return typeof localStorage<\"u\"&&\"setItem\"in localStorage&&!!localStorage.setItem}catch{return!1}}function Lt(T,Y){var z=T.name+\"/\";return T.storeName!==Y.storeName&&(z+=T.storeName+\"/\"),z}function pt(){var T=\"_localforage_support_test\";try{return localStorage.setItem(T,!0),localStorage.removeItem(T),!1}catch{return!0}}function Et(){return!pt()||localStorage.length>0}function At(T){var Y=this,z={};if(T)for(var it in T)z[it]=T[it];return z.keyPrefix=Lt(T,Y._defaultConfig),Et()?(Y._dbInfo=z,z.serializer=ne,w.resolve()):w.reject()}function mt(T){var Y=this,z=Y.ready().then(function(){for(var it=Y._dbInfo.keyPrefix,lt=localStorage.length-1;lt>=0;lt--){var et=localStorage.key(lt);et.indexOf(it)===0&&localStorage.removeItem(et)}});return C(z,T),z}function Rt(T,Y){var z=this;T=m(T);var it=z.ready().then(function(){var lt=z._dbInfo,et=localStorage.getItem(lt.keyPrefix+T);return et&&(et=lt.serializer.deserialize(et)),et});return C(it,Y),it}function Nt(T,Y){var z=this,it=z.ready().then(function(){for(var lt=z._dbInfo,et=lt.keyPrefix,wt=et.length,vt=localStorage.length,Pt=1,Ut=0;Ut<vt;Ut++){var Tt=localStorage.key(Ut);if(Tt.indexOf(et)===0){var Ht=localStorage.getItem(Tt);if(Ht&&(Ht=lt.serializer.deserialize(Ht)),Ht=T(Ht,Tt.substring(wt),Pt++),Ht!==void 0)return Ht}}});return C(it,Y),it}function kt(T,Y){var z=this,it=z.ready().then(function(){var lt=z._dbInfo,et;try{et=localStorage.key(T)}catch{et=null}return et&&(et=et.substring(lt.keyPrefix.length)),et});return C(it,Y),it}function zt(T){var Y=this,z=Y.ready().then(function(){for(var it=Y._dbInfo,lt=localStorage.length,et=[],wt=0;wt<lt;wt++){var vt=localStorage.key(wt);vt.indexOf(it.keyPrefix)===0&&et.push(vt.substring(it.keyPrefix.length))}return et});return C(z,T),z}function Gt(T){var Y=this,z=Y.keys().then(function(it){return it.length});return C(z,T),z}function Yt(T,Y){var z=this;T=m(T);var it=z.ready().then(function(){var lt=z._dbInfo;localStorage.removeItem(lt.keyPrefix+T)});return C(it,Y),it}function Zt(T,Y,z){var it=this;T=m(T);var lt=it.ready().then(function(){Y===void 0&&(Y=null);var et=Y;return new w(function(wt,vt){var Pt=it._dbInfo;Pt.serializer.serialize(Y,function(Ut,Tt){if(Tt)vt(Tt);else try{localStorage.setItem(Pt.keyPrefix+T,Ut),wt(et)}catch(Ht){(Ht.name===\"QuotaExceededError\"||Ht.name===\"NS_ERROR_DOM_QUOTA_REACHED\")&&vt(Ht),vt(Ht)}})})});return C(lt,z),lt}function Jt(T,Y){if(Y=O.apply(this,arguments),T=typeof T!=\"function\"&&T||{},!T.name){var z=this.config();T.name=T.name||z.name,T.storeName=T.storeName||z.storeName}var it=this,lt;return T.name?lt=new w(function(et){T.storeName?et(Lt(T,it._defaultConfig)):et(T.name+\"/\")}).then(function(et){for(var wt=localStorage.length-1;wt>=0;wt--){var vt=localStorage.key(wt);vt.indexOf(et)===0&&localStorage.removeItem(vt)}}):lt=w.reject(\"Invalid arguments\"),C(lt,Y),lt}var Qt={_driver:\"localStorageWrapper\",_initStorage:At,_support:at(),iterate:Nt,getItem:Rt,setItem:Zt,removeItem:Yt,clear:mt,length:Gt,key:kt,keys:zt,dropInstance:Jt},Kt=function(Y,z){return Y===z||typeof Y==\"number\"&&typeof z==\"number\"&&isNaN(Y)&&isNaN(z)},Ee=function(Y,z){for(var it=Y.length,lt=0;lt<it;){if(Kt(Y[lt],z))return!0;lt++}return!1},Pe=Array.isArray||function(T){return Object.prototype.toString.call(T)===\"[object Array]\"},De={},mn={},ke={INDEXEDDB:ct,WEBSQL:rt,LOCALSTORAGE:Qt},Qi=[ke.INDEXEDDB._driver,ke.WEBSQL._driver,ke.LOCALSTORAGE._driver],Ye=[\"dropInstance\"],rn=[\"clear\",\"getItem\",\"iterate\",\"key\",\"keys\",\"length\",\"removeItem\",\"setItem\"].concat(Ye),Ni={description:\"\",driver:Qi.slice(),name:\"localforage\",size:4980736,storeName:\"keyvaluepairs\",version:1};function wn(T,Y){T[Y]=function(){var z=arguments;return T.ready().then(function(){return T[Y].apply(T,z)})}}function Ke(){for(var T=1;T<arguments.length;T++){var Y=arguments[T];if(Y)for(var z in Y)Y.hasOwnProperty(z)&&(Pe(Y[z])?arguments[0][z]=Y[z].slice():arguments[0][z]=Y[z])}return arguments[0]}var gi=function(){function T(Y){s(this,T);for(var z in ke)if(ke.hasOwnProperty(z)){var it=ke[z],lt=it._driver;this[z]=lt,De[lt]||this.defineDriver(it)}this._defaultConfig=Ke({},Ni),this._config=Ke({},this._defaultConfig,Y),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return T.prototype.config=function(z){if((typeof z>\"u\"?\"undefined\":a(z))===\"object\"){if(this._ready)return new Error(\"Can't call config() after localforage has been used.\");for(var it in z){if(it===\"storeName\"&&(z[it]=z[it].replace(/\\W/g,\"_\")),it===\"version\"&&typeof z[it]!=\"number\")return new Error(\"Database version must be a number.\");this._config[it]=z[it]}return\"driver\"in z&&z.driver?this.setDriver(this._config.driver):!0}else return typeof z==\"string\"?this._config[z]:this._config},T.prototype.defineDriver=function(z,it,lt){var et=new w(function(wt,vt){try{var Pt=z._driver,Ut=new Error(\"Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver\");if(!z._driver){vt(Ut);return}for(var Tt=rn.concat(\"_initStorage\"),Ht=0,ee=Tt.length;Ht<ee;Ht++){var ae=Tt[Ht],re=!Ee(Ye,ae);if((re||z[ae])&&typeof z[ae]!=\"function\"){vt(Ut);return}}var fe=function(){for(var kn=function(sl){return function(){var ll=new Error(\"Method \"+sl+\" is not implemented by the current driver\"),Oa=w.reject(ll);return C(Oa,arguments[arguments.length-1]),Oa}},Gi=0,rl=Ye.length;Gi<rl;Gi++){var Ki=Ye[Gi];z[Ki]||(z[Ki]=kn(Ki))}};fe();var de=function(kn){De[Pt]&&console.info(\"Redefining LocalForage driver: \"+Pt),De[Pt]=z,mn[Pt]=kn,wt()};\"_support\"in z?z._support&&typeof z._support==\"function\"?z._support().then(de,vt):de(!!z._support):de(!0)}catch(ve){vt(ve)}});return h(et,it,lt),et},T.prototype.driver=function(){return this._driver||null},T.prototype.getDriver=function(z,it,lt){var et=De[z]?w.resolve(De[z]):w.reject(new Error(\"Driver not found.\"));return h(et,it,lt),et},T.prototype.getSerializer=function(z){var it=w.resolve(ne);return h(it,z),it},T.prototype.ready=function(z){var it=this,lt=it._driverSet.then(function(){return it._ready===null&&(it._ready=it._initDriver()),it._ready});return h(lt,z,z),lt},T.prototype.setDriver=function(z,it,lt){var et=this;Pe(z)||(z=[z]);var wt=this._getSupportedDrivers(z);function vt(){et._config.driver=et.driver()}function Pt(Ht){return et._extend(Ht),vt(),et._ready=et._initStorage(et._config),et._ready}function Ut(Ht){return function(){var ee=0;function ae(){for(;ee<Ht.length;){var re=Ht[ee];return ee++,et._dbInfo=null,et._ready=null,et.getDriver(re).then(Pt).catch(ae)}vt();var fe=new Error(\"No available storage method found.\");return et._driverSet=w.reject(fe),et._driverSet}return ae()}}var Tt=this._driverSet!==null?this._driverSet.catch(function(){return w.resolve()}):w.resolve();return this._driverSet=Tt.then(function(){var Ht=wt[0];return et._dbInfo=null,et._ready=null,et.getDriver(Ht).then(function(ee){et._driver=ee._driver,vt(),et._wrapLibraryMethodsWithReady(),et._initDriver=Ut(wt)})}).catch(function(){vt();var Ht=new Error(\"No available storage method found.\");return et._driverSet=w.reject(Ht),et._driverSet}),h(this._driverSet,it,lt),this._driverSet},T.prototype.supports=function(z){return!!mn[z]},T.prototype._extend=function(z){Ke(this,z)},T.prototype._getSupportedDrivers=function(z){for(var it=[],lt=0,et=z.length;lt<et;lt++){var wt=z[lt];this.supports(wt)&&it.push(wt)}return it},T.prototype._wrapLibraryMethodsWithReady=function(){for(var z=0,it=rn.length;z<it;z++)wn(this,rn[z])},T.prototype.createInstance=function(z){return new T(z)},T}(),cl=new gi;i.exports=cl},{3:3}]},{},[4])(4)})}(Hi)),Hi.exports}var ul=dl();const vi=mr(ul),fl=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];function Ri(n,e){if(!e||e==10)return BigInt(n);if(e==16)return n.slice(0,2)==\"0x\"?BigInt(n):BigInt(\"0x\"+n)}const ue=Ri;function _l(n,e){let t=BigInt(0);e=BigInt(e);for(let i=0;i<n.length;i++)t=t*e+BigInt(n[i]);return t}function ri(n){const e=n.toString(16);return(e.length-1)*4+fl[parseInt(e[0],16)]}function Ir(n){return BigInt(n)<BigInt(0)}function Cr(n){return!n}function Fi(n,e){return BigInt(n)<<BigInt(e)}function xn(n,e){return BigInt(n)>>BigInt(e)}const hl=Fi,gl=xn;function la(n){return(BigInt(n)&BigInt(1))==BigInt(1)}function pl(n){let e=BigInt(n);const t=[];for(;e;){if(e&BigInt(1)){const i=2-Number(e%BigInt(4));t.push(i),e=e-BigInt(i)}else t.push(0);e=e>>BigInt(1)}return t}function Er(n){let e=BigInt(n);const t=[];for(;e;)e&BigInt(1)?t.push(1):t.push(0),e=e>>BigInt(1);return t}function Br(n){if(n>BigInt(Number.MAX_SAFE_INTEGER))throw new Error(\"Number too big\");return Number(n)}function Ll(n,e){const t=[];let i=BigInt(n);for(e=BigInt(e);i;)t.unshift(Number(i%e)),i=i/e;return t}function da(n,e){return BigInt(n)+BigInt(e)}function $e(n,e){return BigInt(n)-BigInt(e)}function xr(n){return-BigInt(n)}function vr(n,e){return BigInt(n)*BigInt(e)}function Al(n){return BigInt(n)*BigInt(n)}function si(n,e){return BigInt(n)**BigInt(e)}function bl(n,e){return BigInt(n)**BigInt(e)}function yl(n){return BigInt(n)>=0?BigInt(n):-BigInt(n)}function Sn(n,e){return BigInt(n)/BigInt(e)}function qe(n,e){return BigInt(n)%BigInt(e)}function sn(n,e){return BigInt(n)==BigInt(e)}function ml(n,e){return BigInt(n)!=BigInt(e)}function wl(n,e){return BigInt(n)<BigInt(e)}function Ho(n,e){return BigInt(n)>BigInt(e)}function Il(n,e){return BigInt(n)<=BigInt(e)}function Fr(n,e){return BigInt(n)>=BigInt(e)}function ua(n,e){return BigInt(n)&BigInt(e)}function Cl(n,e){return BigInt(n)|BigInt(e)}function El(n,e){return BigInt(n)^BigInt(e)}function Bl(n,e){return BigInt(n)&&BigInt(e)}function xl(n,e){return BigInt(n)||BigInt(e)}function vl(n){return!BigInt(n)}function Wn(n,e,t,i){const o=\"0000000\"+t.toString(16),a=new Uint32Array(n.buffer,e,i/4),s=((o.length-7)*4-1>>5)+1;for(let l=0;l<s;l++)a[l]=parseInt(o.substring(o.length-8*l-8,o.length-8*l),16);for(let l=s;l<a.length;l++)a[l]=0;for(let l=a.length*4;l<i;l++)n[l]=Br(ua(xn(t,l*8),255))}function Sr(n,e,t,i){const o=\"0000000\"+t.toString(16),a=new DataView(n.buffer,n.byteOffset+e,i),s=((o.length-7)*4-1>>5)+1;for(let l=0;l<s;l++)a.setUint32(i-l*4-4,parseInt(o.substring(o.length-8*l-8,o.length-8*l),16),!1);for(let l=0;l<i/4-s;l++)a[l]=0}function Xn(n,e,t){t=t||n.byteLength,e=e||0;const i=new Uint32Array(n.buffer,e,t/4),o=new Array(t/4);return i.forEach((a,s)=>o[o.length-s-1]=a.toString(16).padStart(8,\"0\")),Ri(o.join(\"\"),16)}function Or(n,e,t){t=t||n.byteLength,e=e||0;const i=new DataView(n.buffer,n.byteOffset+e,t),o=new Array(t/4);for(let a=0;a<t/4;a++)o[a]=i.getUint32(a*4,!1).toString(16).padStart(8,\"0\");return Ri(o.join(\"\"),16)}function Pr(n,e){return n.toString(e)}function On(n){const e=new Uint8Array(Math.floor((ri(n)-1)/8)+1);return Wn(e,0,n,e.byteLength),e}const Ur=ue(0),ln=ue(1),Fl=Object.freeze(Object.defineProperty({__proto__:null,abs:yl,add:da,band:ua,bitLength:ri,bits:Er,bor:Cl,bxor:El,div:Sn,e:ue,eq:sn,exp:bl,fromArray:_l,fromRprBE:Or,fromRprLE:Xn,fromString:Ri,geq:Fr,gt:Ho,isNegative:Ir,isOdd:la,isZero:Cr,land:Bl,leq:Il,lnot:vl,lor:xl,lt:wl,mod:qe,mul:vr,naf:pl,neg:xr,neq:ml,one:ln,pow:si,shiftLeft:Fi,shiftRight:xn,shl:hl,shr:gl,square:Al,sub:$e,toArray:Ll,toLEBuff:On,toNumber:Br,toRprBE:Sr,toRprLE:Wn,toString:Pr,zero:Ur},Symbol.toStringTag,{value:\"Module\"}));function Ua(n,e,t){if(Cr(t))return n.one;const i=Er(t);if(i.length==0)return n.one;let o=e;for(let a=i.length-2;a>=0;a--)o=n.square(o),i[a]&&(o=n.mul(o,e));return o}function Sl(n){if(n.m%2==1)if(sn(qe(n.p,4),1))if(sn(qe(n.p,8),1))if(sn(qe(n.p,16),1))Ol(n);else if(sn(qe(n.p,16),9))Pl(n);else throw new Error(\"Field withot sqrt\");else if(sn(qe(n.p,8),5))Ul(n);else throw new Error(\"Field withot sqrt\");else sn(qe(n.p,4),3)&&Ml(n);else{const e=qe(si(n.p,n.m/2),4);e==1?Tl(n):e==3?Rl(n):Dl(n)}}function Ol(n){for(n.sqrt_q=si(n.p,n.m),n.sqrt_s=0,n.sqrt_t=$e(n.sqrt_q,1);!la(n.sqrt_t);)n.sqrt_s=n.sqrt_s+1,n.sqrt_t=Sn(n.sqrt_t,2);let e=n.one;for(;n.eq(e,n.one);){const t=n.random();n.sqrt_z=n.pow(t,n.sqrt_t),e=n.pow(n.sqrt_z,2**(n.sqrt_s-1))}n.sqrt_tm1d2=Sn($e(n.sqrt_t,1),2),n.sqrt=function(t){const i=this;if(i.isZero(t))return i.zero;let o=i.pow(t,i.sqrt_tm1d2);const a=i.pow(i.mul(i.square(o),t),2**(i.sqrt_s-1));if(i.eq(a,i.negone))return null;let s=i.sqrt_s,l=i.mul(t,o),g=i.mul(l,o),d=i.sqrt_z;for(;!i.eq(g,i.one);){let u=i.square(g),w=1;for(;!i.eq(u,i.one);)u=i.square(u),w++;o=d;for(let C=0;C<s-w-1;C++)o=i.square(o);d=i.square(o),g=i.mul(g,d),l=i.mul(l,o),s=w}return i.geq(l,i.zero)?l:i.neg(l)}}function Pl(n){n.sqrt=function(){throw new Error(\"Sqrt alg 4 not implemented\")}}function Ul(n){n.sqrt=function(){throw new Error(\"Sqrt alg 3 not implemented\")}}function Ml(n){n.sqrt_q=si(n.p,n.m),n.sqrt_e1=Sn($e(n.sqrt_q,3),4),n.sqrt=function(e){if(this.isZero(e))return this.zero;const t=this.pow(e,this.sqrt_e1),i=this.mul(this.square(t),e);if(this.eq(i,this.negone))return null;const o=this.mul(t,e);return n.geq(o,n.zero)?o:n.neg(o)}}function Tl(n){n.sqrt=function(){throw new Error(\"Sqrt alg 10 not implemented\")}}function Rl(n){n.sqrt_q=si(n.p,n.m/2),n.sqrt_e34=Sn($e(n.sqrt_q,3),4),n.sqrt_e12=Sn($e(n.sqrt_q,1),2),n.frobenius=function(e,t){return e%2==1?n.conjugate(t):t},n.sqrt=function(e){const t=this,i=t.pow(e,t.sqrt_e34),o=t.mul(t.square(i),e),a=t.mul(t.frobenius(1,o),o);if(t.eq(a,t.negone))return null;const s=t.mul(i,e);let l;if(t.eq(o,t.negone))l=t.mul(s,[t.F.zero,t.F.one]);else{const g=t.pow(t.add(t.one,o),t.sqrt_e12);l=t.mul(g,s)}return t.geq(l,t.zero)?l:t.neg(l)}}function Dl(n){n.sqrt=function(){throw new Error(\"Sqrt alg 8 not implemented\")}}const hn=typeof global<\"u\"?global:typeof self<\"u\"?self:typeof window<\"u\"?window:{};function Mr(){throw new Error(\"setTimeout has not been defined\")}function Tr(){throw new Error(\"clearTimeout has not been defined\")}var Xe=Mr,Je=Tr;typeof hn.setTimeout==\"function\"&&(Xe=setTimeout);typeof hn.clearTimeout==\"function\"&&(Je=clearTimeout);function Rr(n){if(Xe===setTimeout)return setTimeout(n,0);if((Xe===Mr||!Xe)&&setTimeout)return Xe=setTimeout,setTimeout(n,0);try{return Xe(n,0)}catch{try{return Xe.call(null,n,0)}catch{return Xe.call(this,n,0)}}}function kl(n){if(Je===clearTimeout)return clearTimeout(n);if((Je===Tr||!Je)&&clearTimeout)return Je=clearTimeout,clearTimeout(n);try{return Je(n)}catch{try{return Je.call(null,n)}catch{return Je.call(this,n)}}}var Ve=[],vn=!1,dn,Bi=-1;function zl(){!vn||!dn||(vn=!1,dn.length?Ve=dn.concat(Ve):Bi=-1,Ve.length&&Dr())}function Dr(){if(!vn){var n=Rr(zl);vn=!0;for(var e=Ve.length;e;){for(dn=Ve,Ve=[];++Bi<e;)dn&&dn[Bi].run();Bi=-1,e=Ve.length}dn=null,vn=!1,kl(n)}}function ql(n){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];Ve.push(new kr(n,e)),Ve.length===1&&!vn&&Rr(Dr)}function kr(n,e){this.fun=n,this.array=e}kr.prototype.run=function(){this.fun.apply(null,this.array)};var Ql=\"browser\",Nl=\"browser\",Gl=!0,Kl={},Hl=[],Zl=\"\",jl={},Vl={},$l={};function An(){}var Yl=An,Wl=An,Xl=An,Jl=An,td=An,ed=An,nd=An;function id(n){throw new Error(\"process.binding is not supported\")}function od(){return\"/\"}function ad(n){throw new Error(\"process.chdir is not supported\")}function cd(){return 0}var Bn=hn.performance||{},rd=Bn.now||Bn.mozNow||Bn.msNow||Bn.oNow||Bn.webkitNow||function(){return new Date().getTime()};function sd(n){var e=rd.call(Bn)*.001,t=Math.floor(e),i=Math.floor(e%1*1e9);return n&&(t=t-n[0],i=i-n[1],i<0&&(t--,i+=1e9)),[t,i]}var ld=new Date;function dd(){var n=new Date,e=n-ld;return e/1e3}var Zi={nextTick:ql,title:Ql,browser:Gl,env:Kl,argv:Hl,version:Zl,versions:jl,on:Yl,addListener:Wl,once:Xl,off:Jl,removeListener:td,removeAllListeners:ed,emit:nd,binding:id,cwd:od,chdir:ad,umask:cd,hrtime:sd,platform:Nl,release:Vl,config:$l,uptime:dd};function We(n,e,t,i,o){n[e]=n[e]+n[t]>>>0,n[o]=(n[o]^n[e])>>>0,n[o]=(n[o]<<16|n[o]>>>16&65535)>>>0,n[i]=n[i]+n[o]>>>0,n[t]=(n[t]^n[i])>>>0,n[t]=(n[t]<<12|n[t]>>>20&4095)>>>0,n[e]=n[e]+n[t]>>>0,n[o]=(n[o]^n[e])>>>0,n[o]=(n[o]<<8|n[o]>>>24&255)>>>0,n[i]=n[i]+n[o]>>>0,n[t]=(n[t]^n[i])>>>0,n[t]=(n[t]<<7|n[t]>>>25&127)>>>0}function ud(n){We(n,0,4,8,12),We(n,1,5,9,13),We(n,2,6,10,14),We(n,3,7,11,15),We(n,0,5,10,15),We(n,1,6,11,12),We(n,2,7,8,13),We(n,3,4,9,14)}class fd{constructor(e){e=e||[0,0,0,0,0,0,0,0],this.state=[1634760805,857760878,2036477234,1797285236,e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],0,0,0,0],this.idx=16,this.buff=new Array(16)}nextU32(){return this.idx==16&&this.update(),this.buff[this.idx++]}nextU64(){return da(vr(this.nextU32(),4294967296),this.nextU32())}nextBool(){return(this.nextU32()&1)==1}update(){for(let e=0;e<16;e++)this.buff[e]=this.state[e];for(let e=0;e<10;e++)ud(this.buff);for(let e=0;e<16;e++)this.buff[e]=this.buff[e]+this.state[e]>>>0;this.idx=0,this.state[12]=this.state[12]+1>>>0,this.state[12]==0&&(this.state[13]=this.state[13]+1>>>0,this.state[13]==0&&(this.state[14]=this.state[14]+1>>>0,this.state[14]==0&&(this.state[15]=this.state[15]+1>>>0)))}}var ji={},zn={},Ma;function _d(){if(Ma)return zn;Ma=1,zn.byteLength=l,zn.toByteArray=d,zn.fromByteArray=C;for(var n=[],e=[],t=typeof Uint8Array<\"u\"?Uint8Array:Array,i=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",o=0,a=i.length;o<a;++o)n[o]=i[o],e[i.charCodeAt(o)]=o;e[45]=62,e[95]=63;function s(h){var m=h.length;if(m%4>0)throw new Error(\"Invalid string. Length must be a multiple of 4\");var O=h.indexOf(\"=\");O===-1&&(O=m);var Q=O===m?0:4-O%4;return[O,Q]}function l(h){var m=s(h),O=m[0],Q=m[1];return(O+Q)*3/4-Q}function g(h,m,O){return(m+O)*3/4-O}function d(h){var m,O=s(h),Q=O[0],P=O[1],G=new t(g(h,Q,P)),st=0,N=P>0?Q-4:Q,y;for(y=0;y<N;y+=4)m=e[h.charCodeAt(y)]<<18|e[h.charCodeAt(y+1)]<<12|e[h.charCodeAt(y+2)]<<6|e[h.charCodeAt(y+3)],G[st++]=m>>16&255,G[st++]=m>>8&255,G[st++]=m&255;return P===2&&(m=e[h.charCodeAt(y)]<<2|e[h.charCodeAt(y+1)]>>4,G[st++]=m&255),P===1&&(m=e[h.charCodeAt(y)]<<10|e[h.charCodeAt(y+1)]<<4|e[h.charCodeAt(y+2)]>>2,G[st++]=m>>8&255,G[st++]=m&255),G}function u(h){return n[h>>18&63]+n[h>>12&63]+n[h>>6&63]+n[h&63]}function w(h,m,O){for(var Q,P=[],G=m;G<O;G+=3)Q=(h[G]<<16&16711680)+(h[G+1]<<8&65280)+(h[G+2]&255),P.push(u(Q));return P.join(\"\")}function C(h){for(var m,O=h.length,Q=O%3,P=[],G=16383,st=0,N=O-Q;st<N;st+=G)P.push(w(h,st,st+G>N?N:st+G));return Q===1?(m=h[O-1],P.push(n[m>>2]+n[m<<4&63]+\"==\")):Q===2&&(m=(h[O-2]<<8)+h[O-1],P.push(n[m>>10]+n[m>>4&63]+n[m<<2&63]+\"=\")),P.join(\"\")}return zn}var Li={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Ta;function hd(){return Ta||(Ta=1,Li.read=function(n,e,t,i,o){var a,s,l=o*8-i-1,g=(1<<l)-1,d=g>>1,u=-7,w=t?o-1:0,C=t?-1:1,h=n[e+w];for(w+=C,a=h&(1<<-u)-1,h>>=-u,u+=l;u>0;a=a*256+n[e+w],w+=C,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=i;u>0;s=s*256+n[e+w],w+=C,u-=8);if(a===0)a=1-d;else{if(a===g)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,i),a=a-d}return(h?-1:1)*s*Math.pow(2,a-i)},Li.write=function(n,e,t,i,o,a){var s,l,g,d=a*8-o-1,u=(1<<d)-1,w=u>>1,C=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:a-1,m=i?1:-1,O=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-s))<1&&(s--,g*=2),s+w>=1?e+=C/g:e+=C*Math.pow(2,1-w),e*g>=2&&(s++,g/=2),s+w>=u?(l=0,s=u):s+w>=1?(l=(e*g-1)*Math.pow(2,o),s=s+w):(l=e*Math.pow(2,w-1)*Math.pow(2,o),s=0));o>=8;n[t+h]=l&255,h+=m,l/=256,o-=8);for(s=s<<o|l,d+=o;d>0;n[t+h]=s&255,h+=m,s/=256,d-=8);n[t+h-m]|=O*128}),Li}/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */var Ra;function gd(){return Ra||(Ra=1,function(n){const e=_d(),t=hd(),i=typeof Symbol==\"function\"&&typeof Symbol.for==\"function\"?Symbol.for(\"nodejs.util.inspect.custom\"):null;n.Buffer=l,n.SlowBuffer=G,n.INSPECT_MAX_BYTES=50;const o=2147483647;n.kMaxLength=o,l.TYPED_ARRAY_SUPPORT=a(),!l.TYPED_ARRAY_SUPPORT&&typeof console<\"u\"&&typeof console.error==\"function\"&&console.error(\"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.\");function a(){try{const v=new Uint8Array(1),p={foo:function(){return 42}};return Object.setPrototypeOf(p,Uint8Array.prototype),Object.setPrototypeOf(v,p),v.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,\"parent\",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,\"offset\",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function s(v){if(v>o)throw new RangeError('The value \"'+v+'\" is invalid for option \"size\"');const p=new Uint8Array(v);return Object.setPrototypeOf(p,l.prototype),p}function l(v,p,A){if(typeof v==\"number\"){if(typeof p==\"string\")throw new TypeError('The \"string\" argument must be of type string. Received type number');return w(v)}return g(v,p,A)}l.poolSize=8192;function g(v,p,A){if(typeof v==\"string\")return C(v,p);if(ArrayBuffer.isView(v))return m(v);if(v==null)throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof v);if(W(v,ArrayBuffer)||v&&W(v.buffer,ArrayBuffer)||typeof SharedArrayBuffer<\"u\"&&(W(v,SharedArrayBuffer)||v&&W(v.buffer,SharedArrayBuffer)))return O(v,p,A);if(typeof v==\"number\")throw new TypeError('The \"value\" argument must not be of type number. Received type number');const R=v.valueOf&&v.valueOf();if(R!=null&&R!==v)return l.from(R,p,A);const j=Q(v);if(j)return j;if(typeof Symbol<\"u\"&&Symbol.toPrimitive!=null&&typeof v[Symbol.toPrimitive]==\"function\")return l.from(v[Symbol.toPrimitive](\"string\"),p,A);throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof v)}l.from=function(v,p,A){return g(v,p,A)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function d(v){if(typeof v!=\"number\")throw new TypeError('\"size\" argument must be of type number');if(v<0)throw new RangeError('The value \"'+v+'\" is invalid for option \"size\"')}function u(v,p,A){return d(v),v<=0?s(v):p!==void 0?typeof A==\"string\"?s(v).fill(p,A):s(v).fill(p):s(v)}l.alloc=function(v,p,A){return u(v,p,A)};function w(v){return d(v),s(v<0?0:P(v)|0)}l.allocUnsafe=function(v){return w(v)},l.allocUnsafeSlow=function(v){return w(v)};function C(v,p){if((typeof p!=\"string\"||p===\"\")&&(p=\"utf8\"),!l.isEncoding(p))throw new TypeError(\"Unknown encoding: \"+p);const A=st(v,p)|0;let R=s(A);const j=R.write(v,p);return j!==A&&(R=R.slice(0,j)),R}function h(v){const p=v.length<0?0:P(v.length)|0,A=s(p);for(let R=0;R<p;R+=1)A[R]=v[R]&255;return A}function m(v){if(W(v,Uint8Array)){const p=new Uint8Array(v);return O(p.buffer,p.byteOffset,p.byteLength)}return h(v)}function O(v,p,A){if(p<0||v.byteLength<p)throw new RangeError('\"offset\" is outside of buffer bounds');if(v.byteLength<p+(A||0))throw new RangeError('\"length\" is outside of buffer bounds');let R;return p===void 0&&A===void 0?R=new Uint8Array(v):A===void 0?R=new Uint8Array(v,p):R=new Uint8Array(v,p,A),Object.setPrototypeOf(R,l.prototype),R}function Q(v){if(l.isBuffer(v)){const p=P(v.length)|0,A=s(p);return A.length===0||v.copy(A,0,0,p),A}if(v.length!==void 0)return typeof v.length!=\"number\"||b(v.length)?s(0):h(v);if(v.type===\"Buffer\"&&Array.isArray(v.data))return h(v.data)}function P(v){if(v>=o)throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+o.toString(16)+\" bytes\");return v|0}function G(v){return+v!=v&&(v=0),l.alloc(+v)}l.isBuffer=function(p){return p!=null&&p._isBuffer===!0&&p!==l.prototype},l.compare=function(p,A){if(W(p,Uint8Array)&&(p=l.from(p,p.offset,p.byteLength)),W(A,Uint8Array)&&(A=l.from(A,A.offset,A.byteLength)),!l.isBuffer(p)||!l.isBuffer(A))throw new TypeError('The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array');if(p===A)return 0;let R=p.length,j=A.length;for(let J=0,nt=Math.min(R,j);J<nt;++J)if(p[J]!==A[J]){R=p[J],j=A[J];break}return R<j?-1:j<R?1:0},l.isEncoding=function(p){switch(String(p).toLowerCase()){case\"hex\":case\"utf8\":case\"utf-8\":case\"ascii\":case\"latin1\":case\"binary\":case\"base64\":case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return!0;default:return!1}},l.concat=function(p,A){if(!Array.isArray(p))throw new TypeError('\"list\" argument must be an Array of Buffers');if(p.length===0)return l.alloc(0);let R;if(A===void 0)for(A=0,R=0;R<p.length;++R)A+=p[R].length;const j=l.allocUnsafe(A);let J=0;for(R=0;R<p.length;++R){let nt=p[R];if(W(nt,Uint8Array))J+nt.length>j.length?(l.isBuffer(nt)||(nt=l.from(nt)),nt.copy(j,J)):Uint8Array.prototype.set.call(j,nt,J);else if(l.isBuffer(nt))nt.copy(j,J);else throw new TypeError('\"list\" argument must be an Array of Buffers');J+=nt.length}return j};function st(v,p){if(l.isBuffer(v))return v.length;if(ArrayBuffer.isView(v)||W(v,ArrayBuffer))return v.byteLength;if(typeof v!=\"string\")throw new TypeError('The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof v);const A=v.length,R=arguments.length>2&&arguments[2]===!0;if(!R&&A===0)return 0;let j=!1;for(;;)switch(p){case\"ascii\":case\"latin1\":case\"binary\":return A;case\"utf8\":case\"utf-8\":return Z(v).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return A*2;case\"hex\":return A>>>1;case\"base64\":return Ft(v).length;default:if(j)return R?-1:Z(v).length;p=(\"\"+p).toLowerCase(),j=!0}}l.byteLength=st;function N(v,p,A){let R=!1;if((p===void 0||p<0)&&(p=0),p>this.length||((A===void 0||A>this.length)&&(A=this.length),A<=0)||(A>>>=0,p>>>=0,A<=p))return\"\";for(v||(v=\"utf8\");;)switch(v){case\"hex\":return ft(this,p,A);case\"utf8\":case\"utf-8\":return S(this,p,A);case\"ascii\":return _t(this,p,A);case\"latin1\":case\"binary\":return tt(this,p,A);case\"base64\":return $(this,p,A);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return Bt(this,p,A);default:if(R)throw new TypeError(\"Unknown encoding: \"+v);v=(v+\"\").toLowerCase(),R=!0}}l.prototype._isBuffer=!0;function y(v,p,A){const R=v[p];v[p]=v[A],v[A]=R}l.prototype.swap16=function(){const p=this.length;if(p%2!==0)throw new RangeError(\"Buffer size must be a multiple of 16-bits\");for(let A=0;A<p;A+=2)y(this,A,A+1);return this},l.prototype.swap32=function(){const p=this.length;if(p%4!==0)throw new RangeError(\"Buffer size must be a multiple of 32-bits\");for(let A=0;A<p;A+=4)y(this,A,A+3),y(this,A+1,A+2);return this},l.prototype.swap64=function(){const p=this.length;if(p%8!==0)throw new RangeError(\"Buffer size must be a multiple of 64-bits\");for(let A=0;A<p;A+=8)y(this,A,A+7),y(this,A+1,A+6),y(this,A+2,A+5),y(this,A+3,A+4);return this},l.prototype.toString=function(){const p=this.length;return p===0?\"\":arguments.length===0?S(this,0,p):N.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(p){if(!l.isBuffer(p))throw new TypeError(\"Argument must be a Buffer\");return this===p?!0:l.compare(this,p)===0},l.prototype.inspect=function(){let p=\"\";const A=n.INSPECT_MAX_BYTES;return p=this.toString(\"hex\",0,A).replace(/(.{2})/g,\"$1 \").trim(),this.length>A&&(p+=\" ... \"),\"<Buffer \"+p+\">\"},i&&(l.prototype[i]=l.prototype.inspect),l.prototype.compare=function(p,A,R,j,J){if(W(p,Uint8Array)&&(p=l.from(p,p.offset,p.byteLength)),!l.isBuffer(p))throw new TypeError('The \"target\" argument must be one of type Buffer or Uint8Array. Received type '+typeof p);if(A===void 0&&(A=0),R===void 0&&(R=p?p.length:0),j===void 0&&(j=0),J===void 0&&(J=this.length),A<0||R>p.length||j<0||J>this.length)throw new RangeError(\"out of range index\");if(j>=J&&A>=R)return 0;if(j>=J)return-1;if(A>=R)return 1;if(A>>>=0,R>>>=0,j>>>=0,J>>>=0,this===p)return 0;let nt=J-j,Mt=R-A;const jt=Math.min(nt,Mt),Xt=this.slice(j,J),ne=p.slice(A,R);for(let te=0;te<jt;++te)if(Xt[te]!==ne[te]){nt=Xt[te],Mt=ne[te];break}return nt<Mt?-1:Mt<nt?1:0};function I(v,p,A,R,j){if(v.length===0)return-1;if(typeof A==\"string\"?(R=A,A=0):A>2147483647?A=2147483647:A<-2147483648&&(A=-2147483648),A=+A,b(A)&&(A=j?0:v.length-1),A<0&&(A=v.length+A),A>=v.length){if(j)return-1;A=v.length-1}else if(A<0)if(j)A=0;else return-1;if(typeof p==\"string\"&&(p=l.from(p,R)),l.isBuffer(p))return p.length===0?-1:_(v,p,A,R,j);if(typeof p==\"number\")return p=p&255,typeof Uint8Array.prototype.indexOf==\"function\"?j?Uint8Array.prototype.indexOf.call(v,p,A):Uint8Array.prototype.lastIndexOf.call(v,p,A):_(v,[p],A,R,j);throw new TypeError(\"val must be string, number or Buffer\")}function _(v,p,A,R,j){let J=1,nt=v.length,Mt=p.length;if(R!==void 0&&(R=String(R).toLowerCase(),R===\"ucs2\"||R===\"ucs-2\"||R===\"utf16le\"||R===\"utf-16le\")){if(v.length<2||p.length<2)return-1;J=2,nt/=2,Mt/=2,A/=2}function jt(ne,te){return J===1?ne[te]:ne.readUInt16BE(te*J)}let Xt;if(j){let ne=-1;for(Xt=A;Xt<nt;Xt++)if(jt(v,Xt)===jt(p,ne===-1?0:Xt-ne)){if(ne===-1&&(ne=Xt),Xt-ne+1===Mt)return ne*J}else ne!==-1&&(Xt-=Xt-ne),ne=-1}else for(A+Mt>nt&&(A=nt-Mt),Xt=A;Xt>=0;Xt--){let ne=!0;for(let te=0;te<Mt;te++)if(jt(v,Xt+te)!==jt(p,te)){ne=!1;break}if(ne)return Xt}return-1}l.prototype.includes=function(p,A,R){return this.indexOf(p,A,R)!==-1},l.prototype.indexOf=function(p,A,R){return I(this,p,A,R,!0)},l.prototype.lastIndexOf=function(p,A,R){return I(this,p,A,R,!1)};function M(v,p,A,R){A=Number(A)||0;const j=v.length-A;R?(R=Number(R),R>j&&(R=j)):R=j;const J=p.length;R>J/2&&(R=J/2);let nt;for(nt=0;nt<R;++nt){const Mt=parseInt(p.substr(nt*2,2),16);if(b(Mt))return nt;v[A+nt]=Mt}return nt}function F(v,p,A,R){return qt(Z(p,v.length-A),v,A,R)}function L(v,p,A,R){return qt(V(p),v,A,R)}function D(v,p,A,R){return qt(Ft(p),v,A,R)}function K(v,p,A,R){return qt(gt(p,v.length-A),v,A,R)}l.prototype.write=function(p,A,R,j){if(A===void 0)j=\"utf8\",R=this.length,A=0;else if(R===void 0&&typeof A==\"string\")j=A,R=this.length,A=0;else if(isFinite(A))A=A>>>0,isFinite(R)?(R=R>>>0,j===void 0&&(j=\"utf8\")):(j=R,R=void 0);else throw new Error(\"Buffer.write(string, encoding, offset[, length]) is no longer supported\");const J=this.length-A;if((R===void 0||R>J)&&(R=J),p.length>0&&(R<0||A<0)||A>this.length)throw new RangeError(\"Attempt to write outside buffer bounds\");j||(j=\"utf8\");let nt=!1;for(;;)switch(j){case\"hex\":return M(this,p,A,R);case\"utf8\":case\"utf-8\":return F(this,p,A,R);case\"ascii\":case\"latin1\":case\"binary\":return L(this,p,A,R);case\"base64\":return D(this,p,A,R);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return K(this,p,A,R);default:if(nt)throw new TypeError(\"Unknown encoding: \"+j);j=(\"\"+j).toLowerCase(),nt=!0}},l.prototype.toJSON=function(){return{type:\"Buffer\",data:Array.prototype.slice.call(this._arr||this,0)}};function $(v,p,A){return p===0&&A===v.length?e.fromByteArray(v):e.fromByteArray(v.slice(p,A))}function S(v,p,A){A=Math.min(v.length,A);const R=[];let j=p;for(;j<A;){const J=v[j];let nt=null,Mt=J>239?4:J>223?3:J>191?2:1;if(j+Mt<=A){let jt,Xt,ne,te;switch(Mt){case 1:J<128&&(nt=J);break;case 2:jt=v[j+1],(jt&192)===128&&(te=(J&31)<<6|jt&63,te>127&&(nt=te));break;case 3:jt=v[j+1],Xt=v[j+2],(jt&192)===128&&(Xt&192)===128&&(te=(J&15)<<12|(jt&63)<<6|Xt&63,te>2047&&(te<55296||te>57343)&&(nt=te));break;case 4:jt=v[j+1],Xt=v[j+2],ne=v[j+3],(jt&192)===128&&(Xt&192)===128&&(ne&192)===128&&(te=(J&15)<<18|(jt&63)<<12|(Xt&63)<<6|ne&63,te>65535&&te<1114112&&(nt=te))}}nt===null?(nt=65533,Mt=1):nt>65535&&(nt-=65536,R.push(nt>>>10&1023|55296),nt=56320|nt&1023),R.push(nt),j+=Mt}return E(R)}const B=4096;function E(v){const p=v.length;if(p<=B)return String.fromCharCode.apply(String,v);let A=\"\",R=0;for(;R<p;)A+=String.fromCharCode.apply(String,v.slice(R,R+=B));return A}function _t(v,p,A){let R=\"\";A=Math.min(v.length,A);for(let j=p;j<A;++j)R+=String.fromCharCode(v[j]&127);return R}function tt(v,p,A){let R=\"\";A=Math.min(v.length,A);for(let j=p;j<A;++j)R+=String.fromCharCode(v[j]);return R}function ft(v,p,A){const R=v.length;(!p||p<0)&&(p=0),(!A||A<0||A>R)&&(A=R);let j=\"\";for(let J=p;J<A;++J)j+=xt[v[J]];return j}function Bt(v,p,A){const R=v.slice(p,A);let j=\"\";for(let J=0;J<R.length-1;J+=2)j+=String.fromCharCode(R[J]+R[J+1]*256);return j}l.prototype.slice=function(p,A){const R=this.length;p=~~p,A=A===void 0?R:~~A,p<0?(p+=R,p<0&&(p=0)):p>R&&(p=R),A<0?(A+=R,A<0&&(A=0)):A>R&&(A=R),A<p&&(A=p);const j=this.subarray(p,A);return Object.setPrototypeOf(j,l.prototype),j};function Ct(v,p,A){if(v%1!==0||v<0)throw new RangeError(\"offset is not uint\");if(v+p>A)throw new RangeError(\"Trying to access beyond buffer length\")}l.prototype.readUintLE=l.prototype.readUIntLE=function(p,A,R){p=p>>>0,A=A>>>0,R||Ct(p,A,this.length);let j=this[p],J=1,nt=0;for(;++nt<A&&(J*=256);)j+=this[p+nt]*J;return j},l.prototype.readUintBE=l.prototype.readUIntBE=function(p,A,R){p=p>>>0,A=A>>>0,R||Ct(p,A,this.length);let j=this[p+--A],J=1;for(;A>0&&(J*=256);)j+=this[p+--A]*J;return j},l.prototype.readUint8=l.prototype.readUInt8=function(p,A){return p=p>>>0,A||Ct(p,1,this.length),this[p]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(p,A){return p=p>>>0,A||Ct(p,2,this.length),this[p]|this[p+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(p,A){return p=p>>>0,A||Ct(p,2,this.length),this[p]<<8|this[p+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(p,A){return p=p>>>0,A||Ct(p,4,this.length),(this[p]|this[p+1]<<8|this[p+2]<<16)+this[p+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(p,A){return p=p>>>0,A||Ct(p,4,this.length),this[p]*16777216+(this[p+1]<<16|this[p+2]<<8|this[p+3])},l.prototype.readBigUInt64LE=Vt(function(p){p=p>>>0,ct(p,\"offset\");const A=this[p],R=this[p+7];(A===void 0||R===void 0)&&It(p,this.length-8);const j=A+this[++p]*2**8+this[++p]*2**16+this[++p]*2**24,J=this[++p]+this[++p]*2**8+this[++p]*2**16+R*2**24;return BigInt(j)+(BigInt(J)<<BigInt(32))}),l.prototype.readBigUInt64BE=Vt(function(p){p=p>>>0,ct(p,\"offset\");const A=this[p],R=this[p+7];(A===void 0||R===void 0)&&It(p,this.length-8);const j=A*2**24+this[++p]*2**16+this[++p]*2**8+this[++p],J=this[++p]*2**24+this[++p]*2**16+this[++p]*2**8+R;return(BigInt(j)<<BigInt(32))+BigInt(J)}),l.prototype.readIntLE=function(p,A,R){p=p>>>0,A=A>>>0,R||Ct(p,A,this.length);let j=this[p],J=1,nt=0;for(;++nt<A&&(J*=256);)j+=this[p+nt]*J;return J*=128,j>=J&&(j-=Math.pow(2,8*A)),j},l.prototype.readIntBE=function(p,A,R){p=p>>>0,A=A>>>0,R||Ct(p,A,this.length);let j=A,J=1,nt=this[p+--j];for(;j>0&&(J*=256);)nt+=this[p+--j]*J;return J*=128,nt>=J&&(nt-=Math.pow(2,8*A)),nt},l.prototype.readInt8=function(p,A){return p=p>>>0,A||Ct(p,1,this.length),this[p]&128?(255-this[p]+1)*-1:this[p]},l.prototype.readInt16LE=function(p,A){p=p>>>0,A||Ct(p,2,this.length);const R=this[p]|this[p+1]<<8;return R&32768?R|4294901760:R},l.prototype.readInt16BE=function(p,A){p=p>>>0,A||Ct(p,2,this.length);const R=this[p+1]|this[p]<<8;return R&32768?R|4294901760:R},l.prototype.readInt32LE=function(p,A){return p=p>>>0,A||Ct(p,4,this.length),this[p]|this[p+1]<<8|this[p+2]<<16|this[p+3]<<24},l.prototype.readInt32BE=function(p,A){return p=p>>>0,A||Ct(p,4,this.length),this[p]<<24|this[p+1]<<16|this[p+2]<<8|this[p+3]},l.prototype.readBigInt64LE=Vt(function(p){p=p>>>0,ct(p,\"offset\");const A=this[p],R=this[p+7];(A===void 0||R===void 0)&&It(p,this.length-8);const j=this[p+4]+this[p+5]*2**8+this[p+6]*2**16+(R<<24);return(BigInt(j)<<BigInt(32))+BigInt(A+this[++p]*2**8+this[++p]*2**16+this[++p]*2**24)}),l.prototype.readBigInt64BE=Vt(function(p){p=p>>>0,ct(p,\"offset\");const A=this[p],R=this[p+7];(A===void 0||R===void 0)&&It(p,this.length-8);const j=(A<<24)+this[++p]*2**16+this[++p]*2**8+this[++p];return(BigInt(j)<<BigInt(32))+BigInt(this[++p]*2**24+this[++p]*2**16+this[++p]*2**8+R)}),l.prototype.readFloatLE=function(p,A){return p=p>>>0,A||Ct(p,4,this.length),t.read(this,p,!0,23,4)},l.prototype.readFloatBE=function(p,A){return p=p>>>0,A||Ct(p,4,this.length),t.read(this,p,!1,23,4)},l.prototype.readDoubleLE=function(p,A){return p=p>>>0,A||Ct(p,8,this.length),t.read(this,p,!0,52,8)},l.prototype.readDoubleBE=function(p,A){return p=p>>>0,A||Ct(p,8,this.length),t.read(this,p,!1,52,8)};function St(v,p,A,R,j,J){if(!l.isBuffer(v))throw new TypeError('\"buffer\" argument must be a Buffer instance');if(p>j||p<J)throw new RangeError('\"value\" argument is out of bounds');if(A+R>v.length)throw new RangeError(\"Index out of range\")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(p,A,R,j){if(p=+p,A=A>>>0,R=R>>>0,!j){const Mt=Math.pow(2,8*R)-1;St(this,p,A,R,Mt,0)}let J=1,nt=0;for(this[A]=p&255;++nt<R&&(J*=256);)this[A+nt]=p/J&255;return A+R},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(p,A,R,j){if(p=+p,A=A>>>0,R=R>>>0,!j){const Mt=Math.pow(2,8*R)-1;St(this,p,A,R,Mt,0)}let J=R-1,nt=1;for(this[A+J]=p&255;--J>=0&&(nt*=256);)this[A+J]=p/nt&255;return A+R},l.prototype.writeUint8=l.prototype.writeUInt8=function(p,A,R){return p=+p,A=A>>>0,R||St(this,p,A,1,255,0),this[A]=p&255,A+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(p,A,R){return p=+p,A=A>>>0,R||St(this,p,A,2,65535,0),this[A]=p&255,this[A+1]=p>>>8,A+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(p,A,R){return p=+p,A=A>>>0,R||St(this,p,A,2,65535,0),this[A]=p>>>8,this[A+1]=p&255,A+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(p,A,R){return p=+p,A=A>>>0,R||St(this,p,A,4,4294967295,0),this[A+3]=p>>>24,this[A+2]=p>>>16,this[A+1]=p>>>8,this[A]=p&255,A+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(p,A,R){return p=+p,A=A>>>0,R||St(this,p,A,4,4294967295,0),this[A]=p>>>24,this[A+1]=p>>>16,this[A+2]=p>>>8,this[A+3]=p&255,A+4};function Ot(v,p,A,R,j){f(p,R,j,v,A,7);let J=Number(p&BigInt(4294967295));v[A++]=J,J=J>>8,v[A++]=J,J=J>>8,v[A++]=J,J=J>>8,v[A++]=J;let nt=Number(p>>BigInt(32)&BigInt(4294967295));return v[A++]=nt,nt=nt>>8,v[A++]=nt,nt=nt>>8,v[A++]=nt,nt=nt>>8,v[A++]=nt,A}function Dt(v,p,A,R,j){f(p,R,j,v,A,7);let J=Number(p&BigInt(4294967295));v[A+7]=J,J=J>>8,v[A+6]=J,J=J>>8,v[A+5]=J,J=J>>8,v[A+4]=J;let nt=Number(p>>BigInt(32)&BigInt(4294967295));return v[A+3]=nt,nt=nt>>8,v[A+2]=nt,nt=nt>>8,v[A+1]=nt,nt=nt>>8,v[A]=nt,A+8}l.prototype.writeBigUInt64LE=Vt(function(p,A=0){return Ot(this,p,A,BigInt(0),BigInt(\"0xffffffffffffffff\"))}),l.prototype.writeBigUInt64BE=Vt(function(p,A=0){return Dt(this,p,A,BigInt(0),BigInt(\"0xffffffffffffffff\"))}),l.prototype.writeIntLE=function(p,A,R,j){if(p=+p,A=A>>>0,!j){const jt=Math.pow(2,8*R-1);St(this,p,A,R,jt-1,-jt)}let J=0,nt=1,Mt=0;for(this[A]=p&255;++J<R&&(nt*=256);)p<0&&Mt===0&&this[A+J-1]!==0&&(Mt=1),this[A+J]=(p/nt>>0)-Mt&255;return A+R},l.prototype.writeIntBE=function(p,A,R,j){if(p=+p,A=A>>>0,!j){const jt=Math.pow(2,8*R-1);St(this,p,A,R,jt-1,-jt)}let J=R-1,nt=1,Mt=0;for(this[A+J]=p&255;--J>=0&&(nt*=256);)p<0&&Mt===0&&this[A+J+1]!==0&&(Mt=1),this[A+J]=(p/nt>>0)-Mt&255;return A+R},l.prototype.writeInt8=function(p,A,R){return p=+p,A=A>>>0,R||St(this,p,A,1,127,-128),p<0&&(p=255+p+1),this[A]=p&255,A+1},l.prototype.writeInt16LE=function(p,A,R){return p=+p,A=A>>>0,R||St(this,p,A,2,32767,-32768),this[A]=p&255,this[A+1]=p>>>8,A+2},l.prototype.writeInt16BE=function(p,A,R){return p=+p,A=A>>>0,R||St(this,p,A,2,32767,-32768),this[A]=p>>>8,this[A+1]=p&255,A+2},l.prototype.writeInt32LE=function(p,A,R){return p=+p,A=A>>>0,R||St(this,p,A,4,2147483647,-2147483648),this[A]=p&255,this[A+1]=p>>>8,this[A+2]=p>>>16,this[A+3]=p>>>24,A+4},l.prototype.writeInt32BE=function(p,A,R){return p=+p,A=A>>>0,R||St(this,p,A,4,2147483647,-2147483648),p<0&&(p=4294967295+p+1),this[A]=p>>>24,this[A+1]=p>>>16,this[A+2]=p>>>8,this[A+3]=p&255,A+4},l.prototype.writeBigInt64LE=Vt(function(p,A=0){return Ot(this,p,A,-BigInt(\"0x8000000000000000\"),BigInt(\"0x7fffffffffffffff\"))}),l.prototype.writeBigInt64BE=Vt(function(p,A=0){return Dt(this,p,A,-BigInt(\"0x8000000000000000\"),BigInt(\"0x7fffffffffffffff\"))});function x(v,p,A,R,j,J){if(A+R>v.length)throw new RangeError(\"Index out of range\");if(A<0)throw new RangeError(\"Index out of range\")}function ht(v,p,A,R,j){return p=+p,A=A>>>0,j||x(v,p,A,4),t.write(v,p,A,R,23,4),A+4}l.prototype.writeFloatLE=function(p,A,R){return ht(this,p,A,!0,R)},l.prototype.writeFloatBE=function(p,A,R){return ht(this,p,A,!1,R)};function yt(v,p,A,R,j){return p=+p,A=A>>>0,j||x(v,p,A,8),t.write(v,p,A,R,52,8),A+8}l.prototype.writeDoubleLE=function(p,A,R){return yt(this,p,A,!0,R)},l.prototype.writeDoubleBE=function(p,A,R){return yt(this,p,A,!1,R)},l.prototype.copy=function(p,A,R,j){if(!l.isBuffer(p))throw new TypeError(\"argument should be a Buffer\");if(R||(R=0),!j&&j!==0&&(j=this.length),A>=p.length&&(A=p.length),A||(A=0),j>0&&j<R&&(j=R),j===R||p.length===0||this.length===0)return 0;if(A<0)throw new RangeError(\"targetStart out of bounds\");if(R<0||R>=this.length)throw new RangeError(\"Index out of range\");if(j<0)throw new RangeError(\"sourceEnd out of bounds\");j>this.length&&(j=this.length),p.length-A<j-R&&(j=p.length-A+R);const J=j-R;return this===p&&typeof Uint8Array.prototype.copyWithin==\"function\"?this.copyWithin(A,R,j):Uint8Array.prototype.set.call(p,this.subarray(R,j),A),J},l.prototype.fill=function(p,A,R,j){if(typeof p==\"string\"){if(typeof A==\"string\"?(j=A,A=0,R=this.length):typeof R==\"string\"&&(j=R,R=this.length),j!==void 0&&typeof j!=\"string\")throw new TypeError(\"encoding must be a string\");if(typeof j==\"string\"&&!l.isEncoding(j))throw new TypeError(\"Unknown encoding: \"+j);if(p.length===1){const nt=p.charCodeAt(0);(j===\"utf8\"&&nt<128||j===\"latin1\")&&(p=nt)}}else typeof p==\"number\"?p=p&255:typeof p==\"boolean\"&&(p=Number(p));if(A<0||this.length<A||this.length<R)throw new RangeError(\"Out of range index\");if(R<=A)return this;A=A>>>0,R=R===void 0?this.length:R>>>0,p||(p=0);let J;if(typeof p==\"number\")for(J=A;J<R;++J)this[J]=p;else{const nt=l.isBuffer(p)?p:l.from(p,j),Mt=nt.length;if(Mt===0)throw new TypeError('The value \"'+p+'\" is invalid for argument \"value\"');for(J=0;J<R-A;++J)this[J+A]=nt[J%Mt]}return this};const U={};function r(v,p,A){U[v]=class extends A{constructor(){super(),Object.defineProperty(this,\"message\",{value:p.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${v}]`,this.stack,delete this.name}get code(){return v}set code(j){Object.defineProperty(this,\"code\",{configurable:!0,enumerable:!0,value:j,writable:!0})}toString(){return`${this.name} [${v}]: ${this.message}`}}}r(\"ERR_BUFFER_OUT_OF_BOUNDS\",function(v){return v?`${v} is outside of buffer bounds`:\"Attempt to access memory outside buffer bounds\"},RangeError),r(\"ERR_INVALID_ARG_TYPE\",function(v,p){return`The \"${v}\" argument must be of type number. Received type ${typeof p}`},TypeError),r(\"ERR_OUT_OF_RANGE\",function(v,p,A){let R=`The value of \"${v}\" is out of range.`,j=A;return Number.isInteger(A)&&Math.abs(A)>2**32?j=dt(String(A)):typeof A==\"bigint\"&&(j=String(A),(A>BigInt(2)**BigInt(32)||A<-(BigInt(2)**BigInt(32)))&&(j=dt(j)),j+=\"n\"),R+=` It must be ${p}. Received ${j}`,R},RangeError);function dt(v){let p=\"\",A=v.length;const R=v[0]===\"-\"?1:0;for(;A>=R+4;A-=3)p=`_${v.slice(A-3,A)}${p}`;return`${v.slice(0,A)}${p}`}function k(v,p,A){ct(p,\"offset\"),(v[p]===void 0||v[p+A]===void 0)&&It(p,v.length-(A+1))}function f(v,p,A,R,j,J){if(v>A||v<p){const nt=typeof p==\"bigint\"?\"n\":\"\";let Mt;throw p===0||p===BigInt(0)?Mt=`>= 0${nt} and < 2${nt} ** ${(J+1)*8}${nt}`:Mt=`>= -(2${nt} ** ${(J+1)*8-1}${nt}) and < 2 ** ${(J+1)*8-1}${nt}`,new U.ERR_OUT_OF_RANGE(\"value\",Mt,v)}k(R,j,J)}function ct(v,p){if(typeof v!=\"number\")throw new U.ERR_INVALID_ARG_TYPE(p,\"number\",v)}function It(v,p,A){throw Math.floor(v)!==v?(ct(v,A),new U.ERR_OUT_OF_RANGE(\"offset\",\"an integer\",v)):p<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE(\"offset\",`>= 0 and <= ${p}`,v)}const bt=/[^+/0-9A-Za-z-_]/g;function H(v){if(v=v.split(\"=\")[0],v=v.trim().replace(bt,\"\"),v.length<2)return\"\";for(;v.length%4!==0;)v=v+\"=\";return v}function Z(v,p){p=p||1/0;let A;const R=v.length;let j=null;const J=[];for(let nt=0;nt<R;++nt){if(A=v.charCodeAt(nt),A>55295&&A<57344){if(!j){if(A>56319){(p-=3)>-1&&J.push(239,191,189);continue}else if(nt+1===R){(p-=3)>-1&&J.push(239,191,189);continue}j=A;continue}if(A<56320){(p-=3)>-1&&J.push(239,191,189),j=A;continue}A=(j-55296<<10|A-56320)+65536}else j&&(p-=3)>-1&&J.push(239,191,189);if(j=null,A<128){if((p-=1)<0)break;J.push(A)}else if(A<2048){if((p-=2)<0)break;J.push(A>>6|192,A&63|128)}else if(A<65536){if((p-=3)<0)break;J.push(A>>12|224,A>>6&63|128,A&63|128)}else if(A<1114112){if((p-=4)<0)break;J.push(A>>18|240,A>>12&63|128,A>>6&63|128,A&63|128)}else throw new Error(\"Invalid code point\")}return J}function V(v){const p=[];for(let A=0;A<v.length;++A)p.push(v.charCodeAt(A)&255);return p}function gt(v,p){let A,R,j;const J=[];for(let nt=0;nt<v.length&&!((p-=2)<0);++nt)A=v.charCodeAt(nt),R=A>>8,j=A%256,J.push(j),J.push(R);return J}function Ft(v){return e.toByteArray(H(v))}function qt(v,p,A,R){let j;for(j=0;j<R&&!(j+A>=p.length||j>=v.length);++j)p[j+A]=v[j];return j}function W(v,p){return v instanceof p||v!=null&&v.constructor!=null&&v.constructor.name!=null&&v.constructor.name===p.name}function b(v){return v!==v}const xt=function(){const v=\"0123456789abcdef\",p=new Array(256);for(let A=0;A<16;++A){const R=A*16;for(let j=0;j<16;++j)p[R+j]=v[A]+v[j]}return p}();function Vt(v){return typeof BigInt>\"u\"?$t:v}function $t(){throw new Error(\"BigInt not supported\")}}(ji)),ji}gd();const fa={},pd=Object.freeze(Object.defineProperty({__proto__:null,default:fa},Symbol.toStringTag,{value:\"Module\"})),Ld=wr(pd);function zr(n){let e=new Uint8Array(n);if(typeof globalThis.crypto<\"u\")globalThis.crypto.getRandomValues(e);else for(let t=0;t<n;t++)e[t]=Math.random()*4294967296>>>0;return e}function Ad(){const n=zr(32),e=new Uint32Array(n.buffer),t=[];for(let i=0;i<8;i++)t.push(e[i]);return t}let Ai=null;function _a(){return Ai||(Ai=new fd(Ad()),Ai)}class bd{constructor(e,t,i){this.F=t,this.G=e,this.opMulGF=i;let o=t.sqrt_t||t.t,a=t.sqrt_s||t.s,s=t.one;for(;t.eq(t.pow(s,t.half),t.one);)s=t.add(s,t.one);this.w=new Array(a+1),this.wi=new Array(a+1),this.w[a]=this.F.pow(s,o),this.wi[a]=this.F.inv(this.w[a]);let l=a-1;for(;l>=0;)this.w[l]=this.F.square(this.w[l+1]),this.wi[l]=this.F.square(this.wi[l+1]),l--;this.roots=[],this._setRoots(Math.min(a,15))}_setRoots(e){for(let t=e;t>=0&&!this.roots[t];t--){let i=this.F.one;const o=1<<t,a=new Array(o);for(let s=0;s<o;s++)a[s]=i,i=this.F.mul(i,this.w[t]);this.roots[t]=a}}fft(e){if(e.length<=1)return e;const t=Da(e.length-1)+1;this._setRoots(t);const i=1<<t;if(e.length!=i)throw new Error(\"Size must be multiple of 2\");return Si(this,e,t,0,1)}ifft(e){if(e.length<=1)return e;const t=Da(e.length-1)+1;this._setRoots(t);const i=1<<t;if(e.length!=i)throw new Error(\"Size must be multiple of 2\");const o=Si(this,e,t,0,1),a=this.F.inv(this.F.mulScalar(this.F.one,i)),s=new Array(i);for(let l=0;l<i;l++)s[l]=this.opMulGF(o[(i-l)%i],a);return s}}function Da(n){return(n&4294901760?(n&=4294901760,16):0)|(n&4278255360?(n&=4278255360,8):0)|(n&4042322160?(n&=4042322160,4):0)|(n&3435973836?(n&=3435973836,2):0)|(n&2863311530)!==0}function Si(n,e,t,i,o){const a=1<<t;if(a==1)return[e[i]];if(a==2)return[n.G.add(e[i],e[i+o]),n.G.sub(e[i],e[i+o])];const s=a>>1,l=Si(n,e,t-1,i,o*2),g=Si(n,e,t-1,i+o,o*2),d=new Array(a);for(let u=0;u<s;u++)d[u]=n.G.add(l[u],n.opMulGF(g[u],n.roots[t][u])),d[u+s]=n.G.sub(l[u],n.opMulGF(g[u],n.roots[t][u]));return d}class yd{constructor(e){this.type=\"F1\",this.one=BigInt(1),this.zero=BigInt(0),this.p=BigInt(e),this.m=1,this.negone=this.p-this.one,this.two=BigInt(2),this.half=this.p>>this.one,this.bitLength=ri(this.p),this.mask=(this.one<<BigInt(this.bitLength))-this.one,this.n64=Math.floor((this.bitLength-1)/64)+1,this.n32=this.n64*2,this.n8=this.n64*8,this.R=this.e(this.one<<BigInt(this.n64*64)),this.Ri=this.inv(this.R);const t=this.negone>>this.one;this.nqr=this.two;let i=this.pow(this.nqr,t);for(;!this.eq(i,this.negone);)this.nqr=this.nqr+this.one,i=this.pow(this.nqr,t);for(this.s=0,this.t=this.negone;(this.t&this.one)==this.zero;)this.s=this.s+1,this.t=this.t>>this.one;this.nqr_to_t=this.pow(this.nqr,this.t),Sl(this),this.FFT=new bd(this,this,this.mul.bind(this)),this.fft=this.FFT.fft.bind(this.FFT),this.ifft=this.FFT.ifft.bind(this.FFT),this.w=this.FFT.w,this.wi=this.FFT.wi,this.shift=this.square(this.nqr),this.k=this.exp(this.nqr,2**this.s)}e(e,t){let i;if(t?t==16&&(i=BigInt(\"0x\"+e)):i=BigInt(e),i<0){let o=-i;return o>=this.p&&(o=o%this.p),this.p-o}else return i>=this.p?i%this.p:i}add(e,t){const i=e+t;return i>=this.p?i-this.p:i}sub(e,t){return e>=t?e-t:this.p-t+e}neg(e){return e&&this.p-e}mul(e,t){return e*t%this.p}mulScalar(e,t){return e*this.e(t)%this.p}square(e){return e*e%this.p}eq(e,t){return e==t}neq(e,t){return e!=t}lt(e,t){const i=e>this.half?e-this.p:e,o=t>this.half?t-this.p:t;return i<o}gt(e,t){const i=e>this.half?e-this.p:e,o=t>this.half?t-this.p:t;return i>o}leq(e,t){const i=e>this.half?e-this.p:e,o=t>this.half?t-this.p:t;return i<=o}geq(e,t){const i=e>this.half?e-this.p:e,o=t>this.half?t-this.p:t;return i>=o}div(e,t){return this.mul(e,this.inv(t))}idiv(e,t){if(!t)throw new Error(\"Division by zero\");return e/t}inv(e){if(!e)throw new Error(\"Division by zero\");let t=this.zero,i=this.p,o=this.one,a=e%this.p;for(;a;){let s=i/a;[t,o]=[o,t-s*o],[i,a]=[a,i-s*a]}return t<this.zero&&(t+=this.p),t}mod(e,t){return e%t}pow(e,t){return Ua(this,e,t)}exp(e,t){return Ua(this,e,t)}band(e,t){const i=e&t&this.mask;return i>=this.p?i-this.p:i}bor(e,t){const i=(e|t)&this.mask;return i>=this.p?i-this.p:i}bxor(e,t){const i=(e^t)&this.mask;return i>=this.p?i-this.p:i}bnot(e){const t=e^this.mask;return t>=this.p?t-this.p:t}shl(e,t){if(Number(t)<this.bitLength){const i=e<<t&this.mask;return i>=this.p?i-this.p:i}else{const i=this.p-t;return Number(i)<this.bitLength?e>>i:this.zero}}shr(e,t){if(Number(t)<this.bitLength)return e>>t;{const i=this.p-t;if(Number(i)<this.bitLength){const o=e<<i&this.mask;return o>=this.p?o-this.p:o}else return 0}}land(e,t){return e&&t?this.one:this.zero}lor(e,t){return e||t?this.one:this.zero}lnot(e){return e?this.zero:this.one}sqrt_old(e){if(e==this.zero)return this.zero;if(this.pow(e,this.negone>>this.one)!=this.one)return null;let i=this.s,o=this.nqr_to_t,a=this.pow(e,this.t),s=this.pow(e,this.add(this.t,this.one)>>this.one);for(;a!=this.one;){let l=this.square(a),g=1;for(;l!=this.one;)g++,l=this.square(l);let d=o;for(let u=0;u<i-g-1;u++)d=this.square(d);i=g,o=this.square(d),a=this.mul(a,o),s=this.mul(s,d)}return s>this.p>>this.one&&(s=this.neg(s)),s}normalize(e,t){if(e=BigInt(e,t),e<0){let i=-e;return i>=this.p&&(i=i%this.p),this.p-i}else return e>=this.p?e%this.p:e}random(){const e=this.bitLength*2/8;let t=this.zero;for(let i=0;i<e;i++)t=(t<<BigInt(8))+BigInt(zr(1)[0]);return t%this.p}toString(e,t){t=t||10;let i;return e>this.half&&t==10?i=\"-\"+(this.p-e).toString(t):i=e.toString(t),i}isZero(e){return e==this.zero}fromRng(e){let t;do{t=this.zero;for(let i=0;i<this.n64;i++)t+=e.nextU64()<<BigInt(64*i);t&=this.mask}while(t>=this.p);return t=t*this.Ri%this.p,t}fft(e){return this.FFT.fft(e)}ifft(e){return this.FFT.ifft(e)}toRprLE(e,t,i){Wn(e,t,i,this.n64*8)}toRprBE(e,t,i){Sr(e,t,i,this.n64*8)}toRprBEM(e,t,i){return this.toRprBE(e,t,this.mul(this.R,i))}toRprLEM(e,t,i){return this.toRprLE(e,t,this.mul(this.R,i))}fromRprLE(e,t){return Xn(e,t,this.n8)}fromRprBE(e,t){return Or(e,t,this.n8)}fromRprLEM(e,t){return this.mul(this.fromRprLE(e,t),this.Ri)}fromRprBEM(e,t){return this.mul(this.fromRprBE(e,t),this.Ri)}toObject(e){return e}}var qn={},Qn={},ka;function li(){return ka||(ka=1,Qn.bigInt2BytesLE=function(e,t){const i=Array(t);let o=BigInt(e);for(let a=0;a<t;a++)i[a]=Number(o&0xFFn),o=o>>8n;return i},Qn.bigInt2U32LE=function(e,t){const i=Array(t);let o=BigInt(e);for(let a=0;a<t;a++)i[a]=Number(o&0xFFFFFFFFn),o=o>>32n;return i},Qn.isOcamNum=function(n){return!(!Array.isArray(n)||n.length!=3||typeof n[0]!=\"number\"||typeof n[1]!=\"number\"||!Array.isArray(n[2]))}),Qn}var Vi,za;function md(){return za||(za=1,Vi=function(e,t,i){const o=i||\"int\";if(e.modules[o])return o;e.modules[o]={};const a=t*2,s=t*8;function l(){const I=e.addFunction(o+\"_copy\");I.addParam(\"px\",\"i32\"),I.addParam(\"pr\",\"i32\");const _=I.getCodeBuilder();for(let M=0;M<t;M++)I.addCode(_.i64_store(_.getLocal(\"pr\"),M*8,_.i64_load(_.getLocal(\"px\"),M*8)))}function g(){const I=e.addFunction(o+\"_zero\");I.addParam(\"pr\",\"i32\");const _=I.getCodeBuilder();for(let M=0;M<t;M++)I.addCode(_.i64_store(_.getLocal(\"pr\"),M*8,_.i64_const(0)))}function d(){const I=e.addFunction(o+\"_one\");I.addParam(\"pr\",\"i32\");const _=I.getCodeBuilder();I.addCode(_.i64_store(_.getLocal(\"pr\"),0,_.i64_const(1)));for(let M=1;M<t;M++)I.addCode(_.i64_store(_.getLocal(\"pr\"),M*8,_.i64_const(0)))}function u(){const I=e.addFunction(o+\"_isZero\");I.addParam(\"px\",\"i32\"),I.setReturnType(\"i32\");const _=I.getCodeBuilder();function M(F){return F==0?_.ret(_.i64_eqz(_.i64_load(_.getLocal(\"px\")))):_.if(_.i64_eqz(_.i64_load(_.getLocal(\"px\"),F*8)),M(F-1),_.ret(_.i32_const(0)))}I.addCode(M(t-1)),I.addCode(_.ret(_.i32_const(0)))}function w(){const I=e.addFunction(o+\"_eq\");I.addParam(\"px\",\"i32\"),I.addParam(\"py\",\"i32\"),I.setReturnType(\"i32\");const _=I.getCodeBuilder();function M(F){return F==0?_.ret(_.i64_eq(_.i64_load(_.getLocal(\"px\")),_.i64_load(_.getLocal(\"py\")))):_.if(_.i64_eq(_.i64_load(_.getLocal(\"px\"),F*8),_.i64_load(_.getLocal(\"py\"),F*8)),M(F-1),_.ret(_.i32_const(0)))}I.addCode(M(t-1)),I.addCode(_.ret(_.i32_const(0)))}function C(){const I=e.addFunction(o+\"_gte\");I.addParam(\"px\",\"i32\"),I.addParam(\"py\",\"i32\"),I.setReturnType(\"i32\");const _=I.getCodeBuilder();function M(F){return F==0?_.ret(_.i64_ge_u(_.i64_load(_.getLocal(\"px\")),_.i64_load(_.getLocal(\"py\")))):_.if(_.i64_lt_u(_.i64_load(_.getLocal(\"px\"),F*8),_.i64_load(_.getLocal(\"py\"),F*8)),_.ret(_.i32_const(0)),_.if(_.i64_gt_u(_.i64_load(_.getLocal(\"px\"),F*8),_.i64_load(_.getLocal(\"py\"),F*8)),_.ret(_.i32_const(1)),M(F-1)))}I.addCode(M(t-1)),I.addCode(_.ret(_.i32_const(0)))}function h(){const I=e.addFunction(o+\"_add\");I.addParam(\"x\",\"i32\"),I.addParam(\"y\",\"i32\"),I.addParam(\"r\",\"i32\"),I.setReturnType(\"i32\"),I.addLocal(\"c\",\"i64\");const _=I.getCodeBuilder();I.addCode(_.setLocal(\"c\",_.i64_add(_.i64_load32_u(_.getLocal(\"x\")),_.i64_load32_u(_.getLocal(\"y\"))))),I.addCode(_.i64_store32(_.getLocal(\"r\"),_.getLocal(\"c\")));for(let M=1;M<a;M++)I.addCode(_.setLocal(\"c\",_.i64_add(_.i64_add(_.i64_load32_u(_.getLocal(\"x\"),4*M),_.i64_load32_u(_.getLocal(\"y\"),4*M)),_.i64_shr_u(_.getLocal(\"c\"),_.i64_const(32))))),I.addCode(_.i64_store32(_.getLocal(\"r\"),M*4,_.getLocal(\"c\")));I.addCode(_.i32_wrap_i64(_.i64_shr_u(_.getLocal(\"c\"),_.i64_const(32))))}function m(){const I=e.addFunction(o+\"_sub\");I.addParam(\"x\",\"i32\"),I.addParam(\"y\",\"i32\"),I.addParam(\"r\",\"i32\"),I.setReturnType(\"i32\"),I.addLocal(\"c\",\"i64\");const _=I.getCodeBuilder();I.addCode(_.setLocal(\"c\",_.i64_sub(_.i64_load32_u(_.getLocal(\"x\")),_.i64_load32_u(_.getLocal(\"y\"))))),I.addCode(_.i64_store32(_.getLocal(\"r\"),_.i64_and(_.getLocal(\"c\"),_.i64_const(\"0xFFFFFFFF\"))));for(let M=1;M<a;M++)I.addCode(_.setLocal(\"c\",_.i64_add(_.i64_sub(_.i64_load32_u(_.getLocal(\"x\"),4*M),_.i64_load32_u(_.getLocal(\"y\"),4*M)),_.i64_shr_s(_.getLocal(\"c\"),_.i64_const(32))))),I.addCode(_.i64_store32(_.getLocal(\"r\"),M*4,_.i64_and(_.getLocal(\"c\"),_.i64_const(\"0xFFFFFFFF\"))));I.addCode(_.i32_wrap_i64(_.i64_shr_s(_.getLocal(\"c\"),_.i64_const(32))))}function O(){const I=e.addFunction(o+\"_mul\");I.addParam(\"x\",\"i32\"),I.addParam(\"y\",\"i32\"),I.addParam(\"r\",\"i32\"),I.addLocal(\"c0\",\"i64\"),I.addLocal(\"c1\",\"i64\");for(let $=0;$<a;$++)I.addLocal(\"x\"+$,\"i64\"),I.addLocal(\"y\"+$,\"i64\");const _=I.getCodeBuilder(),M=[],F=[];function L($,S){let B,E;return M[$]?B=_.getLocal(\"x\"+$):(B=_.teeLocal(\"x\"+$,_.i64_load32_u(_.getLocal(\"x\"),$*4)),M[$]=!0),F[S]?E=_.getLocal(\"y\"+S):(E=_.teeLocal(\"y\"+S,_.i64_load32_u(_.getLocal(\"y\"),S*4)),F[S]=!0),_.i64_mul(B,E)}let D=\"c0\",K=\"c1\";for(let $=0;$<a*2-1;$++){for(let S=Math.max(0,$-a+1);S<=$&&S<a;S++){const B=$-S;I.addCode(_.setLocal(D,_.i64_add(_.i64_and(_.getLocal(D),_.i64_const(4294967295)),L(S,B)))),I.addCode(_.setLocal(K,_.i64_add(_.getLocal(K),_.i64_shr_u(_.getLocal(D),_.i64_const(32)))))}I.addCode(_.i64_store32(_.getLocal(\"r\"),$*4,_.getLocal(D))),[D,K]=[K,D],I.addCode(_.setLocal(K,_.i64_shr_u(_.getLocal(D),_.i64_const(32))))}I.addCode(_.i64_store32(_.getLocal(\"r\"),a*4*2-4,_.getLocal(D)))}function Q(){const I=e.addFunction(o+\"_square\");I.addParam(\"x\",\"i32\"),I.addParam(\"r\",\"i32\"),I.addLocal(\"c0\",\"i64\"),I.addLocal(\"c1\",\"i64\"),I.addLocal(\"c0_old\",\"i64\"),I.addLocal(\"c1_old\",\"i64\");for(let S=0;S<a;S++)I.addLocal(\"x\"+S,\"i64\");const _=I.getCodeBuilder(),M=[];function F(S,B){let E,_t;return M[S]?E=_.getLocal(\"x\"+S):(E=_.teeLocal(\"x\"+S,_.i64_load32_u(_.getLocal(\"x\"),S*4)),M[S]=!0),M[B]?_t=_.getLocal(\"x\"+B):(_t=_.teeLocal(\"x\"+B,_.i64_load32_u(_.getLocal(\"x\"),B*4)),M[B]=!0),_.i64_mul(E,_t)}let L=\"c0\",D=\"c1\",K=\"c0_old\",$=\"c1_old\";for(let S=0;S<a*2-1;S++){I.addCode(_.setLocal(L,_.i64_const(0)),_.setLocal(D,_.i64_const(0)));for(let B=Math.max(0,S-a+1);B<S+1>>1&&B<a;B++){const E=S-B;I.addCode(_.setLocal(L,_.i64_add(_.i64_and(_.getLocal(L),_.i64_const(4294967295)),F(B,E)))),I.addCode(_.setLocal(D,_.i64_add(_.getLocal(D),_.i64_shr_u(_.getLocal(L),_.i64_const(32)))))}I.addCode(_.setLocal(L,_.i64_shl(_.i64_and(_.getLocal(L),_.i64_const(4294967295)),_.i64_const(1)))),I.addCode(_.setLocal(D,_.i64_add(_.i64_shl(_.getLocal(D),_.i64_const(1)),_.i64_shr_u(_.getLocal(L),_.i64_const(32))))),S%2==0&&(I.addCode(_.setLocal(L,_.i64_add(_.i64_and(_.getLocal(L),_.i64_const(4294967295)),F(S>>1,S>>1)))),I.addCode(_.setLocal(D,_.i64_add(_.getLocal(D),_.i64_shr_u(_.getLocal(L),_.i64_const(32)))))),S>0&&(I.addCode(_.setLocal(L,_.i64_add(_.i64_and(_.getLocal(L),_.i64_const(4294967295)),_.i64_and(_.getLocal(K),_.i64_const(4294967295))))),I.addCode(_.setLocal(D,_.i64_add(_.i64_add(_.getLocal(D),_.i64_shr_u(_.getLocal(L),_.i64_const(32))),_.getLocal($))))),I.addCode(_.i64_store32(_.getLocal(\"r\"),S*4,_.getLocal(L))),I.addCode(_.setLocal(K,_.getLocal(D)),_.setLocal($,_.i64_shr_u(_.getLocal(K),_.i64_const(32))))}I.addCode(_.i64_store32(_.getLocal(\"r\"),a*4*2-4,_.getLocal(K)))}function P(){const I=e.addFunction(o+\"_squareOld\");I.addParam(\"x\",\"i32\"),I.addParam(\"r\",\"i32\");const _=I.getCodeBuilder();I.addCode(_.call(o+\"_mul\",_.getLocal(\"x\"),_.getLocal(\"x\"),_.getLocal(\"r\")))}function G(){const I=e.addFunction(o+\"__mul1\");I.addParam(\"px\",\"i32\"),I.addParam(\"y\",\"i64\"),I.addParam(\"pr\",\"i32\"),I.addLocal(\"c\",\"i64\");const _=I.getCodeBuilder();I.addCode(_.setLocal(\"c\",_.i64_mul(_.i64_load32_u(_.getLocal(\"px\"),0,0),_.getLocal(\"y\")))),I.addCode(_.i64_store32(_.getLocal(\"pr\"),0,0,_.getLocal(\"c\")));for(let M=1;M<a;M++)I.addCode(_.setLocal(\"c\",_.i64_add(_.i64_mul(_.i64_load32_u(_.getLocal(\"px\"),4*M,0),_.getLocal(\"y\")),_.i64_shr_u(_.getLocal(\"c\"),_.i64_const(32))))),I.addCode(_.i64_store32(_.getLocal(\"pr\"),M*4,0,_.getLocal(\"c\")))}function st(){const I=e.addFunction(o+\"__add1\");I.addParam(\"x\",\"i32\"),I.addParam(\"y\",\"i64\"),I.addLocal(\"c\",\"i64\"),I.addLocal(\"px\",\"i32\");const _=I.getCodeBuilder();I.addCode(_.setLocal(\"px\",_.getLocal(\"x\"))),I.addCode(_.setLocal(\"c\",_.i64_add(_.i64_load32_u(_.getLocal(\"px\"),0,0),_.getLocal(\"y\")))),I.addCode(_.i64_store32(_.getLocal(\"px\"),0,0,_.getLocal(\"c\"))),I.addCode(_.setLocal(\"c\",_.i64_shr_u(_.getLocal(\"c\"),_.i64_const(32)))),I.addCode(_.block(_.loop(_.br_if(1,_.i64_eqz(_.getLocal(\"c\"))),_.setLocal(\"px\",_.i32_add(_.getLocal(\"px\"),_.i32_const(4))),_.setLocal(\"c\",_.i64_add(_.i64_load32_u(_.getLocal(\"px\"),0,0),_.getLocal(\"c\"))),_.i64_store32(_.getLocal(\"px\"),0,0,_.getLocal(\"c\")),_.setLocal(\"c\",_.i64_shr_u(_.getLocal(\"c\"),_.i64_const(32))),_.br(0))))}function N(){G(),st();const I=e.addFunction(o+\"_div\");I.addParam(\"x\",\"i32\"),I.addParam(\"y\",\"i32\"),I.addParam(\"c\",\"i32\"),I.addParam(\"r\",\"i32\"),I.addLocal(\"rr\",\"i32\"),I.addLocal(\"cc\",\"i32\"),I.addLocal(\"eX\",\"i32\"),I.addLocal(\"eY\",\"i32\"),I.addLocal(\"sy\",\"i64\"),I.addLocal(\"sx\",\"i64\"),I.addLocal(\"ec\",\"i32\");const _=I.getCodeBuilder(),M=_.i32_const(e.alloc(s)),F=_.i32_const(e.alloc(s)),L=_.i32_const(e.alloc(s)),D=_.getLocal(\"cc\"),K=_.getLocal(\"rr\"),$=e.alloc(s*2),S=_.i32_const($),B=_.i32_const($+s);I.addCode(_.if(_.getLocal(\"c\"),_.setLocal(\"cc\",_.getLocal(\"c\")),_.setLocal(\"cc\",F))),I.addCode(_.if(_.getLocal(\"r\"),_.setLocal(\"rr\",_.getLocal(\"r\")),_.setLocal(\"rr\",L))),I.addCode(_.call(o+\"_copy\",_.getLocal(\"x\"),K)),I.addCode(_.call(o+\"_copy\",_.getLocal(\"y\"),M)),I.addCode(_.call(o+\"_zero\",D)),I.addCode(_.call(o+\"_zero\",S)),I.addCode(_.setLocal(\"eX\",_.i32_const(s-1))),I.addCode(_.setLocal(\"eY\",_.i32_const(s-1))),I.addCode(_.block(_.loop(_.br_if(1,_.i32_or(_.i32_load8_u(_.i32_add(M,_.getLocal(\"eY\")),0,0),_.i32_eq(_.getLocal(\"eY\"),_.i32_const(3)))),_.setLocal(\"eY\",_.i32_sub(_.getLocal(\"eY\"),_.i32_const(1))),_.br(0)))),I.addCode(_.setLocal(\"sy\",_.i64_add(_.i64_load32_u(_.i32_sub(_.i32_add(M,_.getLocal(\"eY\")),_.i32_const(3)),0,0),_.i64_const(1)))),I.addCode(_.if(_.i64_eq(_.getLocal(\"sy\"),_.i64_const(1)),_.drop(_.i64_div_u(_.i64_const(0),_.i64_const(0))))),I.addCode(_.block(_.loop(_.block(_.loop(_.br_if(1,_.i32_or(_.i32_load8_u(_.i32_add(K,_.getLocal(\"eX\")),0,0),_.i32_eq(_.getLocal(\"eX\"),_.i32_const(7)))),_.setLocal(\"eX\",_.i32_sub(_.getLocal(\"eX\"),_.i32_const(1))),_.br(0))),_.setLocal(\"sx\",_.i64_load(_.i32_sub(_.i32_add(K,_.getLocal(\"eX\")),_.i32_const(7)),0,0)),_.setLocal(\"sx\",_.i64_div_u(_.getLocal(\"sx\"),_.getLocal(\"sy\"))),_.setLocal(\"ec\",_.i32_sub(_.i32_sub(_.getLocal(\"eX\"),_.getLocal(\"eY\")),_.i32_const(4))),_.block(_.loop(_.br_if(1,_.i32_and(_.i64_eqz(_.i64_and(_.getLocal(\"sx\"),_.i64_const(\"0xFFFFFFFF00000000\"))),_.i32_ge_s(_.getLocal(\"ec\"),_.i32_const(0)))),_.setLocal(\"sx\",_.i64_shr_u(_.getLocal(\"sx\"),_.i64_const(8))),_.setLocal(\"ec\",_.i32_add(_.getLocal(\"ec\"),_.i32_const(1))),_.br(0))),_.if(_.i64_eqz(_.getLocal(\"sx\")),[..._.br_if(2,_.i32_eqz(_.call(o+\"_gte\",K,M))),..._.setLocal(\"sx\",_.i64_const(1)),..._.setLocal(\"ec\",_.i32_const(0))]),_.call(o+\"__mul1\",M,_.getLocal(\"sx\"),B),_.drop(_.call(o+\"_sub\",K,_.i32_sub(B,_.getLocal(\"ec\")),K)),_.call(o+\"__add1\",_.i32_add(D,_.getLocal(\"ec\")),_.getLocal(\"sx\")),_.br(0))))}function y(){const I=e.addFunction(o+\"_inverseMod\");I.addParam(\"px\",\"i32\"),I.addParam(\"pm\",\"i32\"),I.addParam(\"pr\",\"i32\"),I.addLocal(\"t\",\"i32\"),I.addLocal(\"newt\",\"i32\"),I.addLocal(\"r\",\"i32\"),I.addLocal(\"qq\",\"i32\"),I.addLocal(\"qr\",\"i32\"),I.addLocal(\"newr\",\"i32\"),I.addLocal(\"swp\",\"i32\"),I.addLocal(\"x\",\"i32\"),I.addLocal(\"signt\",\"i32\"),I.addLocal(\"signnewt\",\"i32\"),I.addLocal(\"signx\",\"i32\");const _=I.getCodeBuilder(),M=_.i32_const(e.alloc(s)),F=_.i32_const(e.alloc(s)),L=_.i32_const(e.alloc(s)),D=_.i32_const(e.alloc(s)),K=_.i32_const(e.alloc(s)),$=_.i32_const(e.alloc(s)),S=_.i32_const(e.alloc(s*2)),B=_.i32_const(e.alloc(s));I.addCode(_.setLocal(\"t\",M),_.call(o+\"_zero\",M),_.setLocal(\"signt\",_.i32_const(0))),I.addCode(_.setLocal(\"r\",F),_.call(o+\"_copy\",_.getLocal(\"pm\"),F)),I.addCode(_.setLocal(\"newt\",L),_.call(o+\"_one\",L),_.setLocal(\"signnewt\",_.i32_const(0))),I.addCode(_.setLocal(\"newr\",D),_.call(o+\"_copy\",_.getLocal(\"px\"),D)),I.addCode(_.setLocal(\"qq\",K)),I.addCode(_.setLocal(\"qr\",$)),I.addCode(_.setLocal(\"x\",B)),I.addCode(_.block(_.loop(_.br_if(1,_.call(o+\"_isZero\",_.getLocal(\"newr\"))),_.call(o+\"_div\",_.getLocal(\"r\"),_.getLocal(\"newr\"),_.getLocal(\"qq\"),_.getLocal(\"qr\")),_.call(o+\"_mul\",_.getLocal(\"qq\"),_.getLocal(\"newt\"),S),_.if(_.getLocal(\"signt\"),_.if(_.getLocal(\"signnewt\"),_.if(_.call(o+\"_gte\",S,_.getLocal(\"t\")),[..._.drop(_.call(o+\"_sub\",S,_.getLocal(\"t\"),_.getLocal(\"x\"))),..._.setLocal(\"signx\",_.i32_const(0))],[..._.drop(_.call(o+\"_sub\",_.getLocal(\"t\"),S,_.getLocal(\"x\"))),..._.setLocal(\"signx\",_.i32_const(1))]),[..._.drop(_.call(o+\"_add\",S,_.getLocal(\"t\"),_.getLocal(\"x\"))),..._.setLocal(\"signx\",_.i32_const(1))]),_.if(_.getLocal(\"signnewt\"),[..._.drop(_.call(o+\"_add\",S,_.getLocal(\"t\"),_.getLocal(\"x\"))),..._.setLocal(\"signx\",_.i32_const(0))],_.if(_.call(o+\"_gte\",_.getLocal(\"t\"),S),[..._.drop(_.call(o+\"_sub\",_.getLocal(\"t\"),S,_.getLocal(\"x\"))),..._.setLocal(\"signx\",_.i32_const(0))],[..._.drop(_.call(o+\"_sub\",S,_.getLocal(\"t\"),_.getLocal(\"x\"))),..._.setLocal(\"signx\",_.i32_const(1))]))),_.setLocal(\"swp\",_.getLocal(\"t\")),_.setLocal(\"t\",_.getLocal(\"newt\")),_.setLocal(\"newt\",_.getLocal(\"x\")),_.setLocal(\"x\",_.getLocal(\"swp\")),_.setLocal(\"signt\",_.getLocal(\"signnewt\")),_.setLocal(\"signnewt\",_.getLocal(\"signx\")),_.setLocal(\"swp\",_.getLocal(\"r\")),_.setLocal(\"r\",_.getLocal(\"newr\")),_.setLocal(\"newr\",_.getLocal(\"qr\")),_.setLocal(\"qr\",_.getLocal(\"swp\")),_.br(0)))),I.addCode(_.if(_.getLocal(\"signt\"),_.drop(_.call(o+\"_sub\",_.getLocal(\"pm\"),_.getLocal(\"t\"),_.getLocal(\"pr\"))),_.call(o+\"_copy\",_.getLocal(\"t\"),_.getLocal(\"pr\"))))}return l(),g(),u(),d(),w(),C(),h(),m(),O(),Q(),P(),N(),y(),e.exportFunction(o+\"_copy\"),e.exportFunction(o+\"_zero\"),e.exportFunction(o+\"_one\"),e.exportFunction(o+\"_isZero\"),e.exportFunction(o+\"_eq\"),e.exportFunction(o+\"_gte\"),e.exportFunction(o+\"_add\"),e.exportFunction(o+\"_sub\"),e.exportFunction(o+\"_mul\"),e.exportFunction(o+\"_square\"),e.exportFunction(o+\"_squareOld\"),e.exportFunction(o+\"_div\"),e.exportFunction(o+\"_inverseMod\"),o}),Vi}var $i,qa;function ha(){return qa||(qa=1,$i=function(e,t,i,o,a,s,l){const g=e.addFunction(t);g.addParam(\"base\",\"i32\"),g.addParam(\"scalar\",\"i32\"),g.addParam(\"scalarLength\",\"i32\"),g.addParam(\"r\",\"i32\"),g.addLocal(\"i\",\"i32\"),g.addLocal(\"b\",\"i32\");const d=g.getCodeBuilder(),u=d.i32_const(e.alloc(i));g.addCode(d.if(d.i32_eqz(d.getLocal(\"scalarLength\")),[...d.call(l,d.getLocal(\"r\")),...d.ret([])])),g.addCode(d.call(s,d.getLocal(\"base\"),u)),g.addCode(d.call(l,d.getLocal(\"r\"))),g.addCode(d.setLocal(\"i\",d.getLocal(\"scalarLength\"))),g.addCode(d.block(d.loop(d.setLocal(\"i\",d.i32_sub(d.getLocal(\"i\"),d.i32_const(1))),d.setLocal(\"b\",d.i32_load8_u(d.i32_add(d.getLocal(\"scalar\"),d.getLocal(\"i\")))),...w(),d.br_if(1,d.i32_eqz(d.getLocal(\"i\"))),d.br(0))));function w(){const C=[];for(let h=0;h<8;h++)C.push(...d.call(a,d.getLocal(\"r\"),d.getLocal(\"r\")),...d.if(d.i32_ge_u(d.getLocal(\"b\"),d.i32_const(128>>h)),[...d.setLocal(\"b\",d.i32_sub(d.getLocal(\"b\"),d.i32_const(128>>h))),...d.call(o,d.getLocal(\"r\"),u,d.getLocal(\"r\"))]));return C}}),$i}var Yi,Qa;function ga(){if(Qa)return Yi;Qa=1,Yi=n;function n(e,t){const i=e.modules[t].n64*8,o=e.addFunction(t+\"_batchInverse\");o.addParam(\"pIn\",\"i32\"),o.addParam(\"inStep\",\"i32\"),o.addParam(\"n\",\"i32\"),o.addParam(\"pOut\",\"i32\"),o.addParam(\"outStep\",\"i32\"),o.addLocal(\"itAux\",\"i32\"),o.addLocal(\"itIn\",\"i32\"),o.addLocal(\"itOut\",\"i32\"),o.addLocal(\"i\",\"i32\");const a=o.getCodeBuilder(),s=a.i32_const(e.alloc(i));o.addCode(a.setLocal(\"itAux\",a.i32_load(a.i32_const(0))),a.i32_store(a.i32_const(0),a.i32_add(a.getLocal(\"itAux\"),a.i32_mul(a.i32_add(a.getLocal(\"n\"),a.i32_const(1)),a.i32_const(i))))),o.addCode(a.call(t+\"_one\",a.getLocal(\"itAux\")),a.setLocal(\"itIn\",a.getLocal(\"pIn\")),a.setLocal(\"itAux\",a.i32_add(a.getLocal(\"itAux\"),a.i32_const(i))),a.setLocal(\"i\",a.i32_const(0)),a.block(a.loop(a.br_if(1,a.i32_eq(a.getLocal(\"i\"),a.getLocal(\"n\"))),a.if(a.call(t+\"_isZero\",a.getLocal(\"itIn\")),a.call(t+\"_copy\",a.i32_sub(a.getLocal(\"itAux\"),a.i32_const(i)),a.getLocal(\"itAux\")),a.call(t+\"_mul\",a.getLocal(\"itIn\"),a.i32_sub(a.getLocal(\"itAux\"),a.i32_const(i)),a.getLocal(\"itAux\"))),a.setLocal(\"itIn\",a.i32_add(a.getLocal(\"itIn\"),a.getLocal(\"inStep\"))),a.setLocal(\"itAux\",a.i32_add(a.getLocal(\"itAux\"),a.i32_const(i))),a.setLocal(\"i\",a.i32_add(a.getLocal(\"i\"),a.i32_const(1))),a.br(0))),a.setLocal(\"itIn\",a.i32_sub(a.getLocal(\"itIn\"),a.getLocal(\"inStep\"))),a.setLocal(\"itAux\",a.i32_sub(a.getLocal(\"itAux\"),a.i32_const(i))),a.setLocal(\"itOut\",a.i32_add(a.getLocal(\"pOut\"),a.i32_mul(a.i32_sub(a.getLocal(\"n\"),a.i32_const(1)),a.getLocal(\"outStep\")))),a.call(t+\"_inverse\",a.getLocal(\"itAux\"),a.getLocal(\"itAux\")),a.block(a.loop(a.br_if(1,a.i32_eqz(a.getLocal(\"i\"))),a.if(a.call(t+\"_isZero\",a.getLocal(\"itIn\")),[...a.call(t+\"_copy\",a.getLocal(\"itAux\"),a.i32_sub(a.getLocal(\"itAux\"),a.i32_const(i))),...a.call(t+\"_zero\",a.getLocal(\"itOut\"))],[...a.call(t+\"_copy\",a.i32_sub(a.getLocal(\"itAux\"),a.i32_const(i)),s),...a.call(t+\"_mul\",a.getLocal(\"itAux\"),a.getLocal(\"itIn\"),a.i32_sub(a.getLocal(\"itAux\"),a.i32_const(i))),...a.call(t+\"_mul\",a.getLocal(\"itAux\"),s,a.getLocal(\"itOut\"))]),a.setLocal(\"itIn\",a.i32_sub(a.getLocal(\"itIn\"),a.getLocal(\"inStep\"))),a.setLocal(\"itOut\",a.i32_sub(a.getLocal(\"itOut\"),a.getLocal(\"outStep\"))),a.setLocal(\"itAux\",a.i32_sub(a.getLocal(\"itAux\"),a.i32_const(i))),a.setLocal(\"i\",a.i32_sub(a.getLocal(\"i\"),a.i32_const(1))),a.br(0)))),o.addCode(a.i32_store(a.i32_const(0),a.getLocal(\"itAux\")))}return Yi}var Wi,Na;function qr(){if(Na)return Wi;Na=1,Wi=n;function n(e,t,i,o,a,s){typeof s>\"u\"&&(o<a?s=!0:s=!1);const l=e.addFunction(t);l.addParam(\"pIn\",\"i32\"),l.addParam(\"n\",\"i32\"),l.addParam(\"pOut\",\"i32\"),l.addLocal(\"i\",\"i32\"),l.addLocal(\"itIn\",\"i32\"),l.addLocal(\"itOut\",\"i32\");const g=l.getCodeBuilder();s?l.addCode(g.setLocal(\"itIn\",g.i32_add(g.getLocal(\"pIn\"),g.i32_mul(g.i32_sub(g.getLocal(\"n\"),g.i32_const(1)),g.i32_const(o)))),g.setLocal(\"itOut\",g.i32_add(g.getLocal(\"pOut\"),g.i32_mul(g.i32_sub(g.getLocal(\"n\"),g.i32_const(1)),g.i32_const(a)))),g.setLocal(\"i\",g.i32_const(0)),g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal(\"i\"),g.getLocal(\"n\"))),g.call(i,g.getLocal(\"itIn\"),g.getLocal(\"itOut\")),g.setLocal(\"itIn\",g.i32_sub(g.getLocal(\"itIn\"),g.i32_const(o))),g.setLocal(\"itOut\",g.i32_sub(g.getLocal(\"itOut\"),g.i32_const(a))),g.setLocal(\"i\",g.i32_add(g.getLocal(\"i\"),g.i32_const(1))),g.br(0)))):l.addCode(g.setLocal(\"itIn\",g.getLocal(\"pIn\")),g.setLocal(\"itOut\",g.getLocal(\"pOut\")),g.setLocal(\"i\",g.i32_const(0)),g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal(\"i\"),g.getLocal(\"n\"))),g.call(i,g.getLocal(\"itIn\"),g.getLocal(\"itOut\")),g.setLocal(\"itIn\",g.i32_add(g.getLocal(\"itIn\"),g.i32_const(o))),g.setLocal(\"itOut\",g.i32_add(g.getLocal(\"itOut\"),g.i32_const(a))),g.setLocal(\"i\",g.i32_add(g.getLocal(\"i\"),g.i32_const(1))),g.br(0))))}return Wi}var Xi,Ga;function wd(){if(Ga)return Xi;Ga=1,Xi=n;function n(e,t,i,o,a,s){typeof s>\"u\"&&(o<a?s=!0:s=!1);const l=e.addFunction(t);l.addParam(\"pIn1\",\"i32\"),l.addParam(\"pIn2\",\"i32\"),l.addParam(\"n\",\"i32\"),l.addParam(\"pOut\",\"i32\"),l.addLocal(\"i\",\"i32\"),l.addLocal(\"itIn1\",\"i32\"),l.addLocal(\"itIn2\",\"i32\"),l.addLocal(\"itOut\",\"i32\");const g=l.getCodeBuilder();s?l.addCode(g.setLocal(\"itIn1\",g.i32_add(g.getLocal(\"pIn1\"),g.i32_mul(g.i32_sub(g.getLocal(\"n\"),g.i32_const(1)),g.i32_const(o)))),g.setLocal(\"itIn2\",g.i32_add(g.getLocal(\"pIn2\"),g.i32_mul(g.i32_sub(g.getLocal(\"n\"),g.i32_const(1)),g.i32_const(o)))),g.setLocal(\"itOut\",g.i32_add(g.getLocal(\"pOut\"),g.i32_mul(g.i32_sub(g.getLocal(\"n\"),g.i32_const(1)),g.i32_const(a)))),g.setLocal(\"i\",g.i32_const(0)),g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal(\"i\"),g.getLocal(\"n\"))),g.call(i,g.getLocal(\"itIn1\"),g.getLocal(\"itIn2\"),g.getLocal(\"itOut\")),g.setLocal(\"itIn1\",g.i32_sub(g.getLocal(\"itIn1\"),g.i32_const(o))),g.setLocal(\"itIn2\",g.i32_sub(g.getLocal(\"itIn2\"),g.i32_const(o))),g.setLocal(\"itOut\",g.i32_sub(g.getLocal(\"itOut\"),g.i32_const(a))),g.setLocal(\"i\",g.i32_add(g.getLocal(\"i\"),g.i32_const(1))),g.br(0)))):l.addCode(g.setLocal(\"itIn1\",g.getLocal(\"pIn1\")),g.setLocal(\"itIn2\",g.getLocal(\"pIn2\")),g.setLocal(\"itOut\",g.getLocal(\"pOut\")),g.setLocal(\"i\",g.i32_const(0)),g.block(g.loop(g.br_if(1,g.i32_eq(g.getLocal(\"i\"),g.getLocal(\"n\"))),g.call(i,g.getLocal(\"itIn1\"),g.getLocal(\"itIn2\"),g.getLocal(\"itOut\")),g.setLocal(\"itIn1\",g.i32_add(g.getLocal(\"itIn1\"),g.i32_const(o))),g.setLocal(\"itIn2\",g.i32_add(g.getLocal(\"itIn2\"),g.i32_const(o))),g.setLocal(\"itOut\",g.i32_add(g.getLocal(\"itOut\"),g.i32_const(a))),g.setLocal(\"i\",g.i32_add(g.getLocal(\"i\"),g.i32_const(1))),g.br(0))))}return Xi}var Fe={},Ka;function di(){if(Ka)return Fe;Ka=1;function n(P,G){return P===G?0:P>G?1:-1}function e(P){return P*P}function t(P){return P%2n!==0n}function i(P){return P%2n===0n}function o(P){return P<0n}function a(P){return P>0n}function s(P){return o(P)?P.toString(2).length-1:P.toString(2).length}function l(P){return P<0n?-P:P}function g(P){return l(P)===1n}function d(P,G){for(var st=0n,N=1n,y=G,I=l(P),_,M,F;I!==0n;)_=y/I,M=st,F=y,st=N,y=I,N=M-_*N,I=F-_*I;if(!g(y))throw new Error(P.toString()+\" and \"+G.toString()+\" are not co-prime\");return n(st,0n)===-1&&(st=st+G),o(P)?-st:st}function u(P,G,st){if(st===0n)throw new Error(\"Cannot take modPow with modulus 0\");var N=1n,y=P%st;for(o(G)&&(G=G*-1n,y=d(y,st));a(G);){if(y===0n)return 0n;t(G)&&(N=N*y%st),G=G/2n,y=e(y)%st}return N}function w(P,G){return P=P>=0n?P:-P,G=G>=0n?G:-G,P===G?0:P>G?1:-1}function C(P,G){return G===0n?!1:g(G)?!0:w(G,2n)===0?i(P):P%G===0n}function h(P){var G=l(P);if(g(G))return!1;if(G===2n||G===3n||G===5n)return!0;if(i(G)||C(G,3n)||C(G,5n))return!1;if(G<49n)return!0}function m(P){return P-1n}function O(P,G){for(var st=m(P),N=st,y=0,I,_,M;i(N);)N=N/2n,y++;t:for(_=0;_<G.length;_++)if(!(P<G[_])&&(M=u(BigInt(G[_]),N,P),!(g(M)||M===st))){for(I=y-1;I!=0;I--){if(M=e(M)%P,g(M))return!1;if(M===st)continue t}return!1}return!0}function Q(P){var G=h(P);if(G!==void 0)return G;var st=l(P),N=s(st);if(N<=64)return O(st,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var y=Math.log(2)*Number(N),I=Math.ceil(y),_=[],M=0;M<I;M++)_.push(BigInt(M+2));return O(st,_)}return Fe.bitLength=s,Fe.isOdd=t,Fe.isNegative=o,Fe.abs=l,Fe.isUnit=g,Fe.compare=n,Fe.modInv=d,Fe.modPow=u,Fe.isPrime=Q,Fe.square=e,Fe}var Ji,Ha;function Di(){if(Ha)return Ji;Ha=1;const n=md(),e=li(),t=ha(),i=ga(),o=qr(),a=wd(),{bitLength:s,modInv:l,modPow:g,isPrime:d,isOdd:u,square:w}=di();return Ji=function(h,m,O,Q){const P=BigInt(m),G=Math.floor((s(P-1n)-1)/64)+1,st=G*2,N=G*8,y=O||\"f1m\";if(h.modules[y])return y;const I=n(h,G,Q),_=h.alloc(N,e.bigInt2BytesLE(P,N)),M=h.alloc(e.bigInt2BytesLE(w(1n<<BigInt(G*64))%P,N)),F=h.alloc(e.bigInt2BytesLE((1n<<BigInt(G*64))%P,N)),L=h.alloc(e.bigInt2BytesLE(0n,N)),D=P-1n,K=D>>1n,$=h.alloc(N,e.bigInt2BytesLE(K,N)),S=K+1n,B=h.alloc(N,e.bigInt2BytesLE(S,N));h.modules[y]={pq:_,pR2:M,n64:G,q:P,pOne:F,pZero:L,pePlusOne:B};function E(){const W=h.addFunction(y+\"_one\");W.addParam(\"pr\",\"i32\");const b=W.getCodeBuilder();W.addCode(b.call(I+\"_copy\",b.i32_const(F),b.getLocal(\"pr\")))}function _t(){const W=h.addFunction(y+\"_add\");W.addParam(\"x\",\"i32\"),W.addParam(\"y\",\"i32\"),W.addParam(\"r\",\"i32\");const b=W.getCodeBuilder();W.addCode(b.if(b.call(I+\"_add\",b.getLocal(\"x\"),b.getLocal(\"y\"),b.getLocal(\"r\")),b.drop(b.call(I+\"_sub\",b.getLocal(\"r\"),b.i32_const(_),b.getLocal(\"r\"))),b.if(b.call(I+\"_gte\",b.getLocal(\"r\"),b.i32_const(_)),b.drop(b.call(I+\"_sub\",b.getLocal(\"r\"),b.i32_const(_),b.getLocal(\"r\"))))))}function tt(){const W=h.addFunction(y+\"_sub\");W.addParam(\"x\",\"i32\"),W.addParam(\"y\",\"i32\"),W.addParam(\"r\",\"i32\");const b=W.getCodeBuilder();W.addCode(b.if(b.call(I+\"_sub\",b.getLocal(\"x\"),b.getLocal(\"y\"),b.getLocal(\"r\")),b.drop(b.call(I+\"_add\",b.getLocal(\"r\"),b.i32_const(_),b.getLocal(\"r\")))))}function ft(){const W=h.addFunction(y+\"_neg\");W.addParam(\"x\",\"i32\"),W.addParam(\"r\",\"i32\");const b=W.getCodeBuilder();W.addCode(b.call(y+\"_sub\",b.i32_const(L),b.getLocal(\"x\"),b.getLocal(\"r\")))}function Bt(){const W=h.addFunction(y+\"_isNegative\");W.addParam(\"x\",\"i32\"),W.setReturnType(\"i32\");const b=W.getCodeBuilder(),xt=b.i32_const(h.alloc(N));W.addCode(b.call(y+\"_fromMontgomery\",b.getLocal(\"x\"),xt),b.call(I+\"_gte\",xt,b.i32_const(B)))}function Ct(){const W=h.addFunction(y+\"_sign\");W.addParam(\"x\",\"i32\"),W.setReturnType(\"i32\");const b=W.getCodeBuilder(),xt=b.i32_const(h.alloc(N));W.addCode(b.if(b.call(I+\"_isZero\",b.getLocal(\"x\")),b.ret(b.i32_const(0))),b.call(y+\"_fromMontgomery\",b.getLocal(\"x\"),xt),b.if(b.call(I+\"_gte\",xt,b.i32_const(B)),b.ret(b.i32_const(-1))),b.ret(b.i32_const(1)))}function St(){const W=h.alloc(st*st*8),b=h.addFunction(y+\"_mReduct\");b.addParam(\"t\",\"i32\"),b.addParam(\"r\",\"i32\"),b.addLocal(\"np32\",\"i64\"),b.addLocal(\"c\",\"i64\"),b.addLocal(\"m\",\"i64\");const xt=b.getCodeBuilder(),Vt=Number(0x100000000n-l(P,0x100000000n));b.addCode(xt.setLocal(\"np32\",xt.i64_const(Vt)));for(let $t=0;$t<st;$t++){b.addCode(xt.setLocal(\"c\",xt.i64_const(0))),b.addCode(xt.setLocal(\"m\",xt.i64_and(xt.i64_mul(xt.i64_load32_u(xt.getLocal(\"t\"),$t*4),xt.getLocal(\"np32\")),xt.i64_const(\"0xFFFFFFFF\"))));for(let v=0;v<st;v++)b.addCode(xt.setLocal(\"c\",xt.i64_add(xt.i64_add(xt.i64_load32_u(xt.getLocal(\"t\"),($t+v)*4),xt.i64_shr_u(xt.getLocal(\"c\"),xt.i64_const(32))),xt.i64_mul(xt.i64_load32_u(xt.i32_const(_),v*4),xt.getLocal(\"m\"))))),b.addCode(xt.i64_store32(xt.getLocal(\"t\"),($t+v)*4,xt.getLocal(\"c\")));b.addCode(xt.i64_store32(xt.i32_const(W),$t*4,xt.i64_shr_u(xt.getLocal(\"c\"),xt.i64_const(32))))}b.addCode(xt.call(y+\"_add\",xt.i32_const(W),xt.i32_add(xt.getLocal(\"t\"),xt.i32_const(st*4)),xt.getLocal(\"r\")))}function Ot(){const W=h.addFunction(y+\"_mul\");W.addParam(\"x\",\"i32\"),W.addParam(\"y\",\"i32\"),W.addParam(\"r\",\"i32\"),W.addLocal(\"c0\",\"i64\"),W.addLocal(\"c1\",\"i64\"),W.addLocal(\"np32\",\"i64\");for(let J=0;J<st;J++)W.addLocal(\"x\"+J,\"i64\"),W.addLocal(\"y\"+J,\"i64\"),W.addLocal(\"m\"+J,\"i64\"),W.addLocal(\"q\"+J,\"i64\");const b=W.getCodeBuilder(),xt=Number(0x100000000n-l(P,0x100000000n));W.addCode(b.setLocal(\"np32\",b.i64_const(xt)));const Vt=[],$t=[],v=[];function p(J,nt){let Mt,jt;return Vt[J]?Mt=b.getLocal(\"x\"+J):(Mt=b.teeLocal(\"x\"+J,b.i64_load32_u(b.getLocal(\"x\"),J*4)),Vt[J]=!0),$t[nt]?jt=b.getLocal(\"y\"+nt):(jt=b.teeLocal(\"y\"+nt,b.i64_load32_u(b.getLocal(\"y\"),nt*4)),$t[nt]=!0),b.i64_mul(Mt,jt)}function A(J,nt){let Mt,jt;return v[J]?Mt=b.getLocal(\"q\"+J):(Mt=b.teeLocal(\"q\"+J,b.i64_load32_u(b.i32_const(0),_+J*4)),v[J]=!0),jt=b.getLocal(\"m\"+nt),b.i64_mul(Mt,jt)}let R=\"c0\",j=\"c1\";for(let J=0;J<st*2-1;J++){for(let nt=Math.max(0,J-st+1);nt<=J&&nt<st;nt++){const Mt=J-nt;W.addCode(b.setLocal(R,b.i64_add(b.i64_and(b.getLocal(R),b.i64_const(4294967295)),p(nt,Mt)))),W.addCode(b.setLocal(j,b.i64_add(b.getLocal(j),b.i64_shr_u(b.getLocal(R),b.i64_const(32)))))}for(let nt=Math.max(1,J-st+1);nt<=J&&nt<st;nt++){const Mt=J-nt;W.addCode(b.setLocal(R,b.i64_add(b.i64_and(b.getLocal(R),b.i64_const(4294967295)),A(nt,Mt)))),W.addCode(b.setLocal(j,b.i64_add(b.getLocal(j),b.i64_shr_u(b.getLocal(R),b.i64_const(32)))))}J<st&&(W.addCode(b.setLocal(\"m\"+J,b.i64_and(b.i64_mul(b.i64_and(b.getLocal(R),b.i64_const(4294967295)),b.getLocal(\"np32\")),b.i64_const(\"0xFFFFFFFF\")))),W.addCode(b.setLocal(R,b.i64_add(b.i64_and(b.getLocal(R),b.i64_const(4294967295)),A(0,J)))),W.addCode(b.setLocal(j,b.i64_add(b.getLocal(j),b.i64_shr_u(b.getLocal(R),b.i64_const(32)))))),J>=st&&W.addCode(b.i64_store32(b.getLocal(\"r\"),(J-st)*4,b.getLocal(R))),[R,j]=[j,R],W.addCode(b.setLocal(j,b.i64_shr_u(b.getLocal(R),b.i64_const(32))))}W.addCode(b.i64_store32(b.getLocal(\"r\"),st*4-4,b.getLocal(R))),W.addCode(b.if(b.i32_wrap_i64(b.getLocal(j)),b.drop(b.call(I+\"_sub\",b.getLocal(\"r\"),b.i32_const(_),b.getLocal(\"r\"))),b.if(b.call(I+\"_gte\",b.getLocal(\"r\"),b.i32_const(_)),b.drop(b.call(I+\"_sub\",b.getLocal(\"r\"),b.i32_const(_),b.getLocal(\"r\"))))))}function Dt(){const W=h.addFunction(y+\"_square\");W.addParam(\"x\",\"i32\"),W.addParam(\"r\",\"i32\"),W.addLocal(\"c0\",\"i64\"),W.addLocal(\"c1\",\"i64\"),W.addLocal(\"c0_old\",\"i64\"),W.addLocal(\"c1_old\",\"i64\"),W.addLocal(\"np32\",\"i64\");for(let nt=0;nt<st;nt++)W.addLocal(\"x\"+nt,\"i64\"),W.addLocal(\"m\"+nt,\"i64\"),W.addLocal(\"q\"+nt,\"i64\");const b=W.getCodeBuilder(),xt=Number(0x100000000n-l(P,0x100000000n));W.addCode(b.setLocal(\"np32\",b.i64_const(xt)));const Vt=[],$t=[];function v(nt,Mt){let jt,Xt;return Vt[nt]?jt=b.getLocal(\"x\"+nt):(jt=b.teeLocal(\"x\"+nt,b.i64_load32_u(b.getLocal(\"x\"),nt*4)),Vt[nt]=!0),Vt[Mt]?Xt=b.getLocal(\"x\"+Mt):(Xt=b.teeLocal(\"x\"+Mt,b.i64_load32_u(b.getLocal(\"x\"),Mt*4)),Vt[Mt]=!0),b.i64_mul(jt,Xt)}function p(nt,Mt){let jt,Xt;return $t[nt]?jt=b.getLocal(\"q\"+nt):(jt=b.teeLocal(\"q\"+nt,b.i64_load32_u(b.i32_const(0),_+nt*4)),$t[nt]=!0),Xt=b.getLocal(\"m\"+Mt),b.i64_mul(jt,Xt)}let A=\"c0\",R=\"c1\",j=\"c0_old\",J=\"c1_old\";for(let nt=0;nt<st*2-1;nt++){W.addCode(b.setLocal(A,b.i64_const(0)),b.setLocal(R,b.i64_const(0)));for(let Mt=Math.max(0,nt-st+1);Mt<nt+1>>1&&Mt<st;Mt++){const jt=nt-Mt;W.addCode(b.setLocal(A,b.i64_add(b.i64_and(b.getLocal(A),b.i64_const(4294967295)),v(Mt,jt)))),W.addCode(b.setLocal(R,b.i64_add(b.getLocal(R),b.i64_shr_u(b.getLocal(A),b.i64_const(32)))))}W.addCode(b.setLocal(A,b.i64_shl(b.i64_and(b.getLocal(A),b.i64_const(4294967295)),b.i64_const(1)))),W.addCode(b.setLocal(R,b.i64_add(b.i64_shl(b.getLocal(R),b.i64_const(1)),b.i64_shr_u(b.getLocal(A),b.i64_const(32))))),nt%2==0&&(W.addCode(b.setLocal(A,b.i64_add(b.i64_and(b.getLocal(A),b.i64_const(4294967295)),v(nt>>1,nt>>1)))),W.addCode(b.setLocal(R,b.i64_add(b.getLocal(R),b.i64_shr_u(b.getLocal(A),b.i64_const(32)))))),nt>0&&(W.addCode(b.setLocal(A,b.i64_add(b.i64_and(b.getLocal(A),b.i64_const(4294967295)),b.i64_and(b.getLocal(j),b.i64_const(4294967295))))),W.addCode(b.setLocal(R,b.i64_add(b.i64_add(b.getLocal(R),b.i64_shr_u(b.getLocal(A),b.i64_const(32))),b.getLocal(J)))));for(let Mt=Math.max(1,nt-st+1);Mt<=nt&&Mt<st;Mt++){const jt=nt-Mt;W.addCode(b.setLocal(A,b.i64_add(b.i64_and(b.getLocal(A),b.i64_const(4294967295)),p(Mt,jt)))),W.addCode(b.setLocal(R,b.i64_add(b.getLocal(R),b.i64_shr_u(b.getLocal(A),b.i64_const(32)))))}nt<st&&(W.addCode(b.setLocal(\"m\"+nt,b.i64_and(b.i64_mul(b.i64_and(b.getLocal(A),b.i64_const(4294967295)),b.getLocal(\"np32\")),b.i64_const(\"0xFFFFFFFF\")))),W.addCode(b.setLocal(A,b.i64_add(b.i64_and(b.getLocal(A),b.i64_const(4294967295)),p(0,nt)))),W.addCode(b.setLocal(R,b.i64_add(b.getLocal(R),b.i64_shr_u(b.getLocal(A),b.i64_const(32)))))),nt>=st&&W.addCode(b.i64_store32(b.getLocal(\"r\"),(nt-st)*4,b.getLocal(A))),W.addCode(b.setLocal(j,b.getLocal(R)),b.setLocal(J,b.i64_shr_u(b.getLocal(j),b.i64_const(32))))}W.addCode(b.i64_store32(b.getLocal(\"r\"),st*4-4,b.getLocal(j))),W.addCode(b.if(b.i32_wrap_i64(b.getLocal(J)),b.drop(b.call(I+\"_sub\",b.getLocal(\"r\"),b.i32_const(_),b.getLocal(\"r\"))),b.if(b.call(I+\"_gte\",b.getLocal(\"r\"),b.i32_const(_)),b.drop(b.call(I+\"_sub\",b.getLocal(\"r\"),b.i32_const(_),b.getLocal(\"r\"))))))}function x(){const W=h.addFunction(y+\"_squareOld\");W.addParam(\"x\",\"i32\"),W.addParam(\"r\",\"i32\");const b=W.getCodeBuilder();W.addCode(b.call(y+\"_mul\",b.getLocal(\"x\"),b.getLocal(\"x\"),b.getLocal(\"r\")))}function ht(){const W=h.addFunction(y+\"_toMontgomery\");W.addParam(\"x\",\"i32\"),W.addParam(\"r\",\"i32\");const b=W.getCodeBuilder();W.addCode(b.call(y+\"_mul\",b.getLocal(\"x\"),b.i32_const(M),b.getLocal(\"r\")))}function yt(){const W=h.alloc(N*2),b=h.addFunction(y+\"_fromMontgomery\");b.addParam(\"x\",\"i32\"),b.addParam(\"r\",\"i32\");const xt=b.getCodeBuilder();b.addCode(xt.call(I+\"_copy\",xt.getLocal(\"x\"),xt.i32_const(W))),b.addCode(xt.call(I+\"_zero\",xt.i32_const(W+N))),b.addCode(xt.call(y+\"_mReduct\",xt.i32_const(W),xt.getLocal(\"r\")))}function U(){const W=h.addFunction(y+\"_inverse\");W.addParam(\"x\",\"i32\"),W.addParam(\"r\",\"i32\");const b=W.getCodeBuilder();W.addCode(b.call(y+\"_fromMontgomery\",b.getLocal(\"x\"),b.getLocal(\"r\"))),W.addCode(b.call(I+\"_inverseMod\",b.getLocal(\"r\"),b.i32_const(_),b.getLocal(\"r\"))),W.addCode(b.call(y+\"_toMontgomery\",b.getLocal(\"r\"),b.getLocal(\"r\")))}let r=2n;if(d(P))for(;g(r,K,P)!==D;)r=r+1n;let dt=0,k=D;for(;!u(k)&&k!==0n;)dt++,k=k>>1n;const f=h.alloc(N,e.bigInt2BytesLE(k,N)),ct=g(r,k,P),It=h.alloc(e.bigInt2BytesLE((ct<<BigInt(G*64))%P,N)),bt=k+1n>>1n,H=h.alloc(N,e.bigInt2BytesLE(bt,N));function Z(){const W=h.addFunction(y+\"_sqrt\");W.addParam(\"n\",\"i32\"),W.addParam(\"r\",\"i32\"),W.addLocal(\"m\",\"i32\"),W.addLocal(\"i\",\"i32\"),W.addLocal(\"j\",\"i32\");const b=W.getCodeBuilder(),xt=b.i32_const(F),Vt=b.i32_const(h.alloc(N)),$t=b.i32_const(h.alloc(N)),v=b.i32_const(h.alloc(N)),p=b.i32_const(h.alloc(N)),A=b.i32_const(h.alloc(N));W.addCode(b.if(b.call(y+\"_isZero\",b.getLocal(\"n\")),b.ret(b.call(y+\"_zero\",b.getLocal(\"r\")))),b.setLocal(\"m\",b.i32_const(dt)),b.call(y+\"_copy\",b.i32_const(It),Vt),b.call(y+\"_exp\",b.getLocal(\"n\"),b.i32_const(f),b.i32_const(N),$t),b.call(y+\"_exp\",b.getLocal(\"n\"),b.i32_const(H),b.i32_const(N),v),b.block(b.loop(b.br_if(1,b.call(y+\"_eq\",$t,xt)),b.call(y+\"_square\",$t,p),b.setLocal(\"i\",b.i32_const(1)),b.block(b.loop(b.br_if(1,b.call(y+\"_eq\",p,xt)),b.call(y+\"_square\",p,p),b.setLocal(\"i\",b.i32_add(b.getLocal(\"i\"),b.i32_const(1))),b.br(0))),b.call(y+\"_copy\",Vt,A),b.setLocal(\"j\",b.i32_sub(b.i32_sub(b.getLocal(\"m\"),b.getLocal(\"i\")),b.i32_const(1))),b.block(b.loop(b.br_if(1,b.i32_eqz(b.getLocal(\"j\"))),b.call(y+\"_square\",A,A),b.setLocal(\"j\",b.i32_sub(b.getLocal(\"j\"),b.i32_const(1))),b.br(0))),b.setLocal(\"m\",b.getLocal(\"i\")),b.call(y+\"_square\",A,Vt),b.call(y+\"_mul\",$t,Vt,$t),b.call(y+\"_mul\",v,A,v),b.br(0))),b.if(b.call(y+\"_isNegative\",v),b.call(y+\"_neg\",v,b.getLocal(\"r\")),b.call(y+\"_copy\",v,b.getLocal(\"r\"))))}function V(){const W=h.addFunction(y+\"_isSquare\");W.addParam(\"n\",\"i32\"),W.setReturnType(\"i32\");const b=W.getCodeBuilder(),xt=b.i32_const(F),Vt=b.i32_const(h.alloc(N));W.addCode(b.if(b.call(y+\"_isZero\",b.getLocal(\"n\")),b.ret(b.i32_const(1))),b.call(y+\"_exp\",b.getLocal(\"n\"),b.i32_const($),b.i32_const(N),Vt),b.call(y+\"_eq\",Vt,xt))}function gt(){const W=h.addFunction(y+\"_load\");W.addParam(\"scalar\",\"i32\"),W.addParam(\"scalarLen\",\"i32\"),W.addParam(\"r\",\"i32\"),W.addLocal(\"p\",\"i32\"),W.addLocal(\"l\",\"i32\"),W.addLocal(\"i\",\"i32\"),W.addLocal(\"j\",\"i32\");const b=W.getCodeBuilder(),xt=b.i32_const(h.alloc(N)),Vt=h.alloc(N),$t=b.i32_const(Vt);W.addCode(b.call(I+\"_zero\",b.getLocal(\"r\")),b.setLocal(\"i\",b.i32_const(N)),b.setLocal(\"p\",b.getLocal(\"scalar\")),b.block(b.loop(b.br_if(1,b.i32_gt_u(b.getLocal(\"i\"),b.getLocal(\"scalarLen\"))),b.if(b.i32_eq(b.getLocal(\"i\"),b.i32_const(N)),b.call(y+\"_one\",xt),b.call(y+\"_mul\",xt,b.i32_const(M),xt)),b.call(y+\"_mul\",b.getLocal(\"p\"),xt,$t),b.call(y+\"_add\",b.getLocal(\"r\"),$t,b.getLocal(\"r\")),b.setLocal(\"p\",b.i32_add(b.getLocal(\"p\"),b.i32_const(N))),b.setLocal(\"i\",b.i32_add(b.getLocal(\"i\"),b.i32_const(N))),b.br(0))),b.setLocal(\"l\",b.i32_rem_u(b.getLocal(\"scalarLen\"),b.i32_const(N))),b.if(b.i32_eqz(b.getLocal(\"l\")),b.ret([])),b.call(I+\"_zero\",$t),b.setLocal(\"j\",b.i32_const(0)),b.block(b.loop(b.br_if(1,b.i32_eq(b.getLocal(\"j\"),b.getLocal(\"l\"))),b.i32_store8(b.getLocal(\"j\"),Vt,b.i32_load8_u(b.getLocal(\"p\"))),b.setLocal(\"p\",b.i32_add(b.getLocal(\"p\"),b.i32_const(1))),b.setLocal(\"j\",b.i32_add(b.getLocal(\"j\"),b.i32_const(1))),b.br(0))),b.if(b.i32_eq(b.getLocal(\"i\"),b.i32_const(N)),b.call(y+\"_one\",xt),b.call(y+\"_mul\",xt,b.i32_const(M),xt)),b.call(y+\"_mul\",$t,xt,$t),b.call(y+\"_add\",b.getLocal(\"r\"),$t,b.getLocal(\"r\")))}function Ft(){const W=h.addFunction(y+\"_timesScalar\");W.addParam(\"x\",\"i32\"),W.addParam(\"scalar\",\"i32\"),W.addParam(\"scalarLen\",\"i32\"),W.addParam(\"r\",\"i32\");const b=W.getCodeBuilder(),xt=b.i32_const(h.alloc(N));W.addCode(b.call(y+\"_load\",b.getLocal(\"scalar\"),b.getLocal(\"scalarLen\"),xt),b.call(y+\"_toMontgomery\",xt,xt),b.call(y+\"_mul\",b.getLocal(\"x\"),xt,b.getLocal(\"r\")))}function qt(){const W=h.addFunction(y+\"_isOne\");W.addParam(\"x\",\"i32\"),W.setReturnType(\"i32\");const b=W.getCodeBuilder();W.addCode(b.ret(b.call(I+\"_eq\",b.getLocal(\"x\"),b.i32_const(F))))}return h.exportFunction(I+\"_copy\",y+\"_copy\"),h.exportFunction(I+\"_zero\",y+\"_zero\"),h.exportFunction(I+\"_isZero\",y+\"_isZero\"),h.exportFunction(I+\"_eq\",y+\"_eq\"),qt(),_t(),tt(),ft(),St(),Ot(),Dt(),x(),ht(),yt(),Bt(),Ct(),U(),E(),gt(),Ft(),i(h,y),o(h,y+\"_batchToMontgomery\",y+\"_toMontgomery\",N,N),o(h,y+\"_batchFromMontgomery\",y+\"_fromMontgomery\",N,N),o(h,y+\"_batchNeg\",y+\"_neg\",N,N),a(h,y+\"_batchAdd\",y+\"_add\",N,N),a(h,y+\"_batchSub\",y+\"_sub\",N,N),a(h,y+\"_batchMul\",y+\"_mul\",N,N),h.exportFunction(y+\"_add\"),h.exportFunction(y+\"_sub\"),h.exportFunction(y+\"_neg\"),h.exportFunction(y+\"_isNegative\"),h.exportFunction(y+\"_isOne\"),h.exportFunction(y+\"_sign\"),h.exportFunction(y+\"_mReduct\"),h.exportFunction(y+\"_mul\"),h.exportFunction(y+\"_square\"),h.exportFunction(y+\"_squareOld\"),h.exportFunction(y+\"_fromMontgomery\"),h.exportFunction(y+\"_toMontgomery\"),h.exportFunction(y+\"_inverse\"),h.exportFunction(y+\"_one\"),h.exportFunction(y+\"_load\"),h.exportFunction(y+\"_timesScalar\"),t(h,y+\"_exp\",N,y+\"_mul\",y+\"_square\",I+\"_copy\",y+\"_one\"),h.exportFunction(y+\"_exp\"),h.exportFunction(y+\"_batchInverse\"),d(P)&&(Z(),V(),h.exportFunction(y+\"_sqrt\"),h.exportFunction(y+\"_isSquare\")),h.exportFunction(y+\"_batchToMontgomery\"),h.exportFunction(y+\"_batchFromMontgomery\"),y},Ji}var to,Za;function Qr(){if(Za)return to;Za=1;const n=Di(),{bitLength:e}=di();return to=function(i,o,a,s,l){const g=BigInt(o),d=Math.floor((e(g-1n)-1)/64)+1,u=d*8,w=a||\"f1\";if(i.modules[w])return w;i.modules[w]={n64:d};const C=l||\"int\",h=n(i,g,s,C),m=i.modules[h].pR2,O=i.modules[h].pq,Q=i.modules[h].pePlusOne;function P(){const y=i.alloc(u),I=i.addFunction(w+\"_mul\");I.addParam(\"x\",\"i32\"),I.addParam(\"y\",\"i32\"),I.addParam(\"r\",\"i32\");const _=I.getCodeBuilder();I.addCode(_.call(h+\"_mul\",_.getLocal(\"x\"),_.getLocal(\"y\"),_.i32_const(y))),I.addCode(_.call(h+\"_mul\",_.i32_const(y),_.i32_const(m),_.getLocal(\"r\")))}function G(){const y=i.addFunction(w+\"_square\");y.addParam(\"x\",\"i32\"),y.addParam(\"r\",\"i32\");const I=y.getCodeBuilder();y.addCode(I.call(w+\"_mul\",I.getLocal(\"x\"),I.getLocal(\"x\"),I.getLocal(\"r\")))}function st(){const y=i.addFunction(w+\"_inverse\");y.addParam(\"x\",\"i32\"),y.addParam(\"r\",\"i32\");const I=y.getCodeBuilder();y.addCode(I.call(C+\"_inverseMod\",I.getLocal(\"x\"),I.i32_const(O),I.getLocal(\"r\")))}function N(){const y=i.addFunction(w+\"_isNegative\");y.addParam(\"x\",\"i32\"),y.setReturnType(\"i32\");const I=y.getCodeBuilder();y.addCode(I.call(C+\"_gte\",I.getLocal(\"x\"),I.i32_const(Q)))}return P(),G(),st(),N(),i.exportFunction(h+\"_add\",w+\"_add\"),i.exportFunction(h+\"_sub\",w+\"_sub\"),i.exportFunction(h+\"_neg\",w+\"_neg\"),i.exportFunction(w+\"_mul\"),i.exportFunction(w+\"_square\"),i.exportFunction(w+\"_inverse\"),i.exportFunction(w+\"_isNegative\"),i.exportFunction(h+\"_copy\",w+\"_copy\"),i.exportFunction(h+\"_zero\",w+\"_zero\"),i.exportFunction(h+\"_one\",w+\"_one\"),i.exportFunction(h+\"_isZero\",w+\"_isZero\"),i.exportFunction(h+\"_eq\",w+\"_eq\"),w},to}var eo,ja;function Nr(){if(ja)return eo;ja=1;const n=ha(),e=ga(),t=li();return eo=function(o,a,s,l){if(o.modules[s])return s;const g=o.modules[l].n64*8,d=o.modules[l].q;o.modules[s]={n64:o.modules[l].n64*2};function u(){const B=o.addFunction(s+\"_add\");B.addParam(\"x\",\"i32\"),B.addParam(\"y\",\"i32\"),B.addParam(\"r\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g)),ft=E.getLocal(\"y\"),Bt=E.i32_add(E.getLocal(\"y\"),E.i32_const(g)),Ct=E.getLocal(\"r\"),St=E.i32_add(E.getLocal(\"r\"),E.i32_const(g));B.addCode(E.call(l+\"_add\",_t,ft,Ct),E.call(l+\"_add\",tt,Bt,St))}function w(){const B=o.addFunction(s+\"_timesScalar\");B.addParam(\"x\",\"i32\"),B.addParam(\"scalar\",\"i32\"),B.addParam(\"scalarLen\",\"i32\"),B.addParam(\"r\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g)),ft=E.getLocal(\"r\"),Bt=E.i32_add(E.getLocal(\"r\"),E.i32_const(g));B.addCode(E.call(l+\"_timesScalar\",_t,E.getLocal(\"scalar\"),E.getLocal(\"scalarLen\"),ft),E.call(l+\"_timesScalar\",tt,E.getLocal(\"scalar\"),E.getLocal(\"scalarLen\"),Bt))}function C(){const B=o.addFunction(s+\"_sub\");B.addParam(\"x\",\"i32\"),B.addParam(\"y\",\"i32\"),B.addParam(\"r\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g)),ft=E.getLocal(\"y\"),Bt=E.i32_add(E.getLocal(\"y\"),E.i32_const(g)),Ct=E.getLocal(\"r\"),St=E.i32_add(E.getLocal(\"r\"),E.i32_const(g));B.addCode(E.call(l+\"_sub\",_t,ft,Ct),E.call(l+\"_sub\",tt,Bt,St))}function h(){const B=o.addFunction(s+\"_neg\");B.addParam(\"x\",\"i32\"),B.addParam(\"r\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g)),ft=E.getLocal(\"r\"),Bt=E.i32_add(E.getLocal(\"r\"),E.i32_const(g));B.addCode(E.call(l+\"_neg\",_t,ft),E.call(l+\"_neg\",tt,Bt))}function m(){const B=o.addFunction(s+\"_conjugate\");B.addParam(\"x\",\"i32\"),B.addParam(\"r\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g)),ft=E.getLocal(\"r\"),Bt=E.i32_add(E.getLocal(\"r\"),E.i32_const(g));B.addCode(E.call(l+\"_copy\",_t,ft),E.call(l+\"_neg\",tt,Bt))}function O(){const B=o.addFunction(s+\"_isNegative\");B.addParam(\"x\",\"i32\"),B.setReturnType(\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g));B.addCode(E.if(E.call(l+\"_isZero\",tt),E.ret(E.call(l+\"_isNegative\",_t))),E.ret(E.call(l+\"_isNegative\",tt)))}function Q(){const B=o.addFunction(s+\"_mul\");B.addParam(\"x\",\"i32\"),B.addParam(\"y\",\"i32\"),B.addParam(\"r\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g)),ft=E.getLocal(\"y\"),Bt=E.i32_add(E.getLocal(\"y\"),E.i32_const(g)),Ct=E.getLocal(\"r\"),St=E.i32_add(E.getLocal(\"r\"),E.i32_const(g)),Ot=E.i32_const(o.alloc(g)),Dt=E.i32_const(o.alloc(g)),x=E.i32_const(o.alloc(g)),ht=E.i32_const(o.alloc(g));B.addCode(E.call(l+\"_mul\",_t,ft,Ot),E.call(l+\"_mul\",tt,Bt,Dt),E.call(l+\"_add\",_t,tt,x),E.call(l+\"_add\",ft,Bt,ht),E.call(l+\"_mul\",x,ht,x),E.call(a,Dt,Ct),E.call(l+\"_add\",Ot,Ct,Ct),E.call(l+\"_add\",Ot,Dt,St),E.call(l+\"_sub\",x,St,St))}function P(){const B=o.addFunction(s+\"_mul1\");B.addParam(\"x\",\"i32\"),B.addParam(\"y\",\"i32\"),B.addParam(\"r\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g)),ft=E.getLocal(\"y\"),Bt=E.getLocal(\"r\"),Ct=E.i32_add(E.getLocal(\"r\"),E.i32_const(g));B.addCode(E.call(l+\"_mul\",_t,ft,Bt),E.call(l+\"_mul\",tt,ft,Ct))}function G(){const B=o.addFunction(s+\"_square\");B.addParam(\"x\",\"i32\"),B.addParam(\"r\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g)),ft=E.getLocal(\"r\"),Bt=E.i32_add(E.getLocal(\"r\"),E.i32_const(g)),Ct=E.i32_const(o.alloc(g)),St=E.i32_const(o.alloc(g)),Ot=E.i32_const(o.alloc(g)),Dt=E.i32_const(o.alloc(g));B.addCode(E.call(l+\"_mul\",_t,tt,Ct),E.call(l+\"_add\",_t,tt,St),E.call(a,tt,Ot),E.call(l+\"_add\",_t,Ot,Ot),E.call(a,Ct,Dt),E.call(l+\"_add\",Dt,Ct,Dt),E.call(l+\"_mul\",St,Ot,ft),E.call(l+\"_sub\",ft,Dt,ft),E.call(l+\"_add\",Ct,Ct,Bt))}function st(){const B=o.addFunction(s+\"_toMontgomery\");B.addParam(\"x\",\"i32\"),B.addParam(\"r\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g)),ft=E.getLocal(\"r\"),Bt=E.i32_add(E.getLocal(\"r\"),E.i32_const(g));B.addCode(E.call(l+\"_toMontgomery\",_t,ft),E.call(l+\"_toMontgomery\",tt,Bt))}function N(){const B=o.addFunction(s+\"_fromMontgomery\");B.addParam(\"x\",\"i32\"),B.addParam(\"r\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g)),ft=E.getLocal(\"r\"),Bt=E.i32_add(E.getLocal(\"r\"),E.i32_const(g));B.addCode(E.call(l+\"_fromMontgomery\",_t,ft),E.call(l+\"_fromMontgomery\",tt,Bt))}function y(){const B=o.addFunction(s+\"_copy\");B.addParam(\"x\",\"i32\"),B.addParam(\"r\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g)),ft=E.getLocal(\"r\"),Bt=E.i32_add(E.getLocal(\"r\"),E.i32_const(g));B.addCode(E.call(l+\"_copy\",_t,ft),E.call(l+\"_copy\",tt,Bt))}function I(){const B=o.addFunction(s+\"_zero\");B.addParam(\"x\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g));B.addCode(E.call(l+\"_zero\",_t),E.call(l+\"_zero\",tt))}function _(){const B=o.addFunction(s+\"_one\");B.addParam(\"x\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g));B.addCode(E.call(l+\"_one\",_t),E.call(l+\"_zero\",tt))}function M(){const B=o.addFunction(s+\"_eq\");B.addParam(\"x\",\"i32\"),B.addParam(\"y\",\"i32\"),B.setReturnType(\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g)),ft=E.getLocal(\"y\"),Bt=E.i32_add(E.getLocal(\"y\"),E.i32_const(g));B.addCode(E.i32_and(E.call(l+\"_eq\",_t,ft),E.call(l+\"_eq\",tt,Bt)))}function F(){const B=o.addFunction(s+\"_isZero\");B.addParam(\"x\",\"i32\"),B.setReturnType(\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g));B.addCode(E.i32_and(E.call(l+\"_isZero\",_t),E.call(l+\"_isZero\",tt)))}function L(){const B=o.addFunction(s+\"_inverse\");B.addParam(\"x\",\"i32\"),B.addParam(\"r\",\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g)),ft=E.getLocal(\"r\"),Bt=E.i32_add(E.getLocal(\"r\"),E.i32_const(g)),Ct=E.i32_const(o.alloc(g)),St=E.i32_const(o.alloc(g)),Ot=E.i32_const(o.alloc(g)),Dt=E.i32_const(o.alloc(g));B.addCode(E.call(l+\"_square\",_t,Ct),E.call(l+\"_square\",tt,St),E.call(a,St,Ot),E.call(l+\"_sub\",Ct,Ot,Ot),E.call(l+\"_inverse\",Ot,Dt),E.call(l+\"_mul\",_t,Dt,ft),E.call(l+\"_mul\",tt,Dt,Bt),E.call(l+\"_neg\",Bt,Bt))}function D(){const B=o.addFunction(s+\"_sign\");B.addParam(\"x\",\"i32\"),B.addLocal(\"s\",\"i32\"),B.setReturnType(\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g));B.addCode(E.setLocal(\"s\",E.call(l+\"_sign\",tt)),E.if(E.getLocal(\"s\"),E.ret(E.getLocal(\"s\"))),E.ret(E.call(l+\"_sign\",_t)))}function K(){const B=o.addFunction(s+\"_isOne\");B.addParam(\"x\",\"i32\"),B.setReturnType(\"i32\");const E=B.getCodeBuilder(),_t=E.getLocal(\"x\"),tt=E.i32_add(E.getLocal(\"x\"),E.i32_const(g));B.addCode(E.ret(E.i32_and(E.call(l+\"_isOne\",_t),E.call(l+\"_isZero\",tt))))}function $(){const B=o.addFunction(s+\"_sqrt\");B.addParam(\"a\",\"i32\"),B.addParam(\"pr\",\"i32\");const E=B.getCodeBuilder(),_t=E.i32_const(o.alloc(t.bigInt2BytesLE((BigInt(d||0)-3n)/4n,g))),tt=E.i32_const(o.alloc(t.bigInt2BytesLE((BigInt(d||0)-1n)/2n,g))),ft=E.getLocal(\"a\"),Bt=E.i32_const(o.alloc(g*2)),Ct=E.i32_const(o.alloc(g*2)),St=E.i32_const(o.alloc(g*2)),Ot=o.alloc(g*2),Dt=E.i32_const(Ot),x=E.i32_const(Ot),ht=E.i32_const(Ot+g),yt=E.i32_const(o.alloc(g*2)),U=E.i32_const(o.alloc(g*2));B.addCode(E.call(s+\"_one\",Dt),E.call(s+\"_neg\",Dt,Dt),E.call(s+\"_exp\",ft,_t,E.i32_const(g),Bt),E.call(s+\"_square\",Bt,Ct),E.call(s+\"_mul\",ft,Ct,Ct),E.call(s+\"_conjugate\",Ct,St),E.call(s+\"_mul\",St,Ct,St),E.if(E.call(s+\"_eq\",St,Dt),E.unreachable()),E.call(s+\"_mul\",Bt,ft,yt),E.if(E.call(s+\"_eq\",Ct,Dt),[...E.call(l+\"_zero\",x),...E.call(l+\"_one\",ht),...E.call(s+\"_mul\",Dt,yt,E.getLocal(\"pr\"))],[...E.call(s+\"_one\",U),...E.call(s+\"_add\",U,Ct,U),...E.call(s+\"_exp\",U,tt,E.i32_const(g),U),...E.call(s+\"_mul\",U,yt,E.getLocal(\"pr\"))]))}function S(){const B=o.addFunction(s+\"_isSquare\");B.addParam(\"a\",\"i32\"),B.setReturnType(\"i32\");const E=B.getCodeBuilder(),_t=E.i32_const(o.alloc(t.bigInt2BytesLE((BigInt(d||0)-3n)/4n,g))),tt=E.getLocal(\"a\"),ft=E.i32_const(o.alloc(g*2)),Bt=E.i32_const(o.alloc(g*2)),Ct=E.i32_const(o.alloc(g*2)),St=o.alloc(g*2),Ot=E.i32_const(St);B.addCode(E.call(s+\"_one\",Ot),E.call(s+\"_neg\",Ot,Ot),E.call(s+\"_exp\",tt,_t,E.i32_const(g),ft),E.call(s+\"_square\",ft,Bt),E.call(s+\"_mul\",tt,Bt,Bt),E.call(s+\"_conjugate\",Bt,Ct),E.call(s+\"_mul\",Ct,Bt,Ct),E.if(E.call(s+\"_eq\",Ct,Ot),E.ret(E.i32_const(0))),E.ret(E.i32_const(1)))}return F(),K(),I(),_(),y(),Q(),P(),G(),u(),C(),h(),m(),st(),N(),M(),L(),w(),D(),O(),o.exportFunction(s+\"_isZero\"),o.exportFunction(s+\"_isOne\"),o.exportFunction(s+\"_zero\"),o.exportFunction(s+\"_one\"),o.exportFunction(s+\"_copy\"),o.exportFunction(s+\"_mul\"),o.exportFunction(s+\"_mul1\"),o.exportFunction(s+\"_square\"),o.exportFunction(s+\"_add\"),o.exportFunction(s+\"_sub\"),o.exportFunction(s+\"_neg\"),o.exportFunction(s+\"_sign\"),o.exportFunction(s+\"_conjugate\"),o.exportFunction(s+\"_fromMontgomery\"),o.exportFunction(s+\"_toMontgomery\"),o.exportFunction(s+\"_eq\"),o.exportFunction(s+\"_inverse\"),e(o,s),n(o,s+\"_exp\",g*2,s+\"_mul\",s+\"_square\",s+\"_copy\",s+\"_one\"),$(),S(),o.exportFunction(s+\"_exp\"),o.exportFunction(s+\"_timesScalar\"),o.exportFunction(s+\"_batchInverse\"),o.exportFunction(s+\"_sqrt\"),o.exportFunction(s+\"_isSquare\"),o.exportFunction(s+\"_isNegative\"),s},eo}var no,Va;function Gr(){if(Va)return no;Va=1;const n=ha(),e=ga();return no=function(i,o,a,s){if(i.modules[a])return a;const l=i.modules[s].n64*8;i.modules[a]={n64:i.modules[s].n64*3};function g(){const F=i.addFunction(a+\"_add\");F.addParam(\"x\",\"i32\"),F.addParam(\"y\",\"i32\"),F.addParam(\"r\",\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l)),S=L.getLocal(\"y\"),B=L.i32_add(L.getLocal(\"y\"),L.i32_const(l)),E=L.i32_add(L.getLocal(\"y\"),L.i32_const(2*l)),_t=L.getLocal(\"r\"),tt=L.i32_add(L.getLocal(\"r\"),L.i32_const(l)),ft=L.i32_add(L.getLocal(\"r\"),L.i32_const(2*l));F.addCode(L.call(s+\"_add\",D,S,_t),L.call(s+\"_add\",K,B,tt),L.call(s+\"_add\",$,E,ft))}function d(){const F=i.addFunction(a+\"_timesScalar\");F.addParam(\"x\",\"i32\"),F.addParam(\"scalar\",\"i32\"),F.addParam(\"scalarLen\",\"i32\"),F.addParam(\"r\",\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l)),S=L.getLocal(\"r\"),B=L.i32_add(L.getLocal(\"r\"),L.i32_const(l)),E=L.i32_add(L.getLocal(\"r\"),L.i32_const(2*l));F.addCode(L.call(s+\"_timesScalar\",D,L.getLocal(\"scalar\"),L.getLocal(\"scalarLen\"),S),L.call(s+\"_timesScalar\",K,L.getLocal(\"scalar\"),L.getLocal(\"scalarLen\"),B),L.call(s+\"_timesScalar\",$,L.getLocal(\"scalar\"),L.getLocal(\"scalarLen\"),E))}function u(){const F=i.addFunction(a+\"_sub\");F.addParam(\"x\",\"i32\"),F.addParam(\"y\",\"i32\"),F.addParam(\"r\",\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l)),S=L.getLocal(\"y\"),B=L.i32_add(L.getLocal(\"y\"),L.i32_const(l)),E=L.i32_add(L.getLocal(\"y\"),L.i32_const(2*l)),_t=L.getLocal(\"r\"),tt=L.i32_add(L.getLocal(\"r\"),L.i32_const(l)),ft=L.i32_add(L.getLocal(\"r\"),L.i32_const(2*l));F.addCode(L.call(s+\"_sub\",D,S,_t),L.call(s+\"_sub\",K,B,tt),L.call(s+\"_sub\",$,E,ft))}function w(){const F=i.addFunction(a+\"_neg\");F.addParam(\"x\",\"i32\"),F.addParam(\"r\",\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l)),S=L.getLocal(\"r\"),B=L.i32_add(L.getLocal(\"r\"),L.i32_const(l)),E=L.i32_add(L.getLocal(\"r\"),L.i32_const(2*l));F.addCode(L.call(s+\"_neg\",D,S),L.call(s+\"_neg\",K,B),L.call(s+\"_neg\",$,E))}function C(){const F=i.addFunction(a+\"_isNegative\");F.addParam(\"x\",\"i32\"),F.setReturnType(\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l));F.addCode(L.if(L.call(s+\"_isZero\",$),L.if(L.call(s+\"_isZero\",K),L.ret(L.call(s+\"_isNegative\",D)),L.ret(L.call(s+\"_isNegative\",K)))),L.ret(L.call(s+\"_isNegative\",$)))}function h(){const F=i.addFunction(a+\"_mul\");F.addParam(\"x\",\"i32\"),F.addParam(\"y\",\"i32\"),F.addParam(\"r\",\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l)),S=L.getLocal(\"y\"),B=L.i32_add(L.getLocal(\"y\"),L.i32_const(l)),E=L.i32_add(L.getLocal(\"y\"),L.i32_const(2*l)),_t=L.getLocal(\"r\"),tt=L.i32_add(L.getLocal(\"r\"),L.i32_const(l)),ft=L.i32_add(L.getLocal(\"r\"),L.i32_const(2*l)),Bt=L.i32_const(i.alloc(l)),Ct=L.i32_const(i.alloc(l)),St=L.i32_const(i.alloc(l)),Ot=L.i32_const(i.alloc(l)),Dt=L.i32_const(i.alloc(l)),x=L.i32_const(i.alloc(l)),ht=L.i32_const(i.alloc(l)),yt=L.i32_const(i.alloc(l)),U=L.i32_const(i.alloc(l)),r=L.i32_const(i.alloc(l)),dt=L.i32_const(i.alloc(l)),k=L.i32_const(i.alloc(l)),f=L.i32_const(i.alloc(l));F.addCode(L.call(s+\"_mul\",D,S,Bt),L.call(s+\"_mul\",K,B,Ct),L.call(s+\"_mul\",$,E,St),L.call(s+\"_add\",D,K,Ot),L.call(s+\"_add\",S,B,Dt),L.call(s+\"_add\",D,$,x),L.call(s+\"_add\",S,E,ht),L.call(s+\"_add\",K,$,yt),L.call(s+\"_add\",B,E,U),L.call(s+\"_add\",Bt,Ct,r),L.call(s+\"_add\",Bt,St,dt),L.call(s+\"_add\",Ct,St,k),L.call(s+\"_mul\",yt,U,_t),L.call(s+\"_sub\",_t,k,_t),L.call(o,_t,_t),L.call(s+\"_add\",Bt,_t,_t),L.call(s+\"_mul\",Ot,Dt,tt),L.call(s+\"_sub\",tt,r,tt),L.call(o,St,f),L.call(s+\"_add\",tt,f,tt),L.call(s+\"_mul\",x,ht,ft),L.call(s+\"_sub\",ft,dt,ft),L.call(s+\"_add\",ft,Ct,ft))}function m(){const F=i.addFunction(a+\"_square\");F.addParam(\"x\",\"i32\"),F.addParam(\"r\",\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l)),S=L.getLocal(\"r\"),B=L.i32_add(L.getLocal(\"r\"),L.i32_const(l)),E=L.i32_add(L.getLocal(\"r\"),L.i32_const(2*l)),_t=L.i32_const(i.alloc(l)),tt=L.i32_const(i.alloc(l)),ft=L.i32_const(i.alloc(l)),Bt=L.i32_const(i.alloc(l)),Ct=L.i32_const(i.alloc(l)),St=L.i32_const(i.alloc(l)),Ot=L.i32_const(i.alloc(l));F.addCode(L.call(s+\"_square\",D,_t),L.call(s+\"_mul\",D,K,tt),L.call(s+\"_add\",tt,tt,ft),L.call(s+\"_sub\",D,K,Bt),L.call(s+\"_add\",Bt,$,Bt),L.call(s+\"_square\",Bt,Bt),L.call(s+\"_mul\",K,$,Ct),L.call(s+\"_add\",Ct,Ct,St),L.call(s+\"_square\",$,Ot),L.call(o,St,S),L.call(s+\"_add\",_t,S,S),L.call(o,Ot,B),L.call(s+\"_add\",ft,B,B),L.call(s+\"_add\",_t,Ot,E),L.call(s+\"_sub\",St,E,E),L.call(s+\"_add\",Bt,E,E),L.call(s+\"_add\",ft,E,E))}function O(){const F=i.addFunction(a+\"_toMontgomery\");F.addParam(\"x\",\"i32\"),F.addParam(\"r\",\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l)),S=L.getLocal(\"r\"),B=L.i32_add(L.getLocal(\"r\"),L.i32_const(l)),E=L.i32_add(L.getLocal(\"r\"),L.i32_const(2*l));F.addCode(L.call(s+\"_toMontgomery\",D,S),L.call(s+\"_toMontgomery\",K,B),L.call(s+\"_toMontgomery\",$,E))}function Q(){const F=i.addFunction(a+\"_fromMontgomery\");F.addParam(\"x\",\"i32\"),F.addParam(\"r\",\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l)),S=L.getLocal(\"r\"),B=L.i32_add(L.getLocal(\"r\"),L.i32_const(l)),E=L.i32_add(L.getLocal(\"r\"),L.i32_const(2*l));F.addCode(L.call(s+\"_fromMontgomery\",D,S),L.call(s+\"_fromMontgomery\",K,B),L.call(s+\"_fromMontgomery\",$,E))}function P(){const F=i.addFunction(a+\"_copy\");F.addParam(\"x\",\"i32\"),F.addParam(\"r\",\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l)),S=L.getLocal(\"r\"),B=L.i32_add(L.getLocal(\"r\"),L.i32_const(l)),E=L.i32_add(L.getLocal(\"r\"),L.i32_const(2*l));F.addCode(L.call(s+\"_copy\",D,S),L.call(s+\"_copy\",K,B),L.call(s+\"_copy\",$,E))}function G(){const F=i.addFunction(a+\"_zero\");F.addParam(\"x\",\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l));F.addCode(L.call(s+\"_zero\",D),L.call(s+\"_zero\",K),L.call(s+\"_zero\",$))}function st(){const F=i.addFunction(a+\"_one\");F.addParam(\"x\",\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l));F.addCode(L.call(s+\"_one\",D),L.call(s+\"_zero\",K),L.call(s+\"_zero\",$))}function N(){const F=i.addFunction(a+\"_eq\");F.addParam(\"x\",\"i32\"),F.addParam(\"y\",\"i32\"),F.setReturnType(\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l)),S=L.getLocal(\"y\"),B=L.i32_add(L.getLocal(\"y\"),L.i32_const(l)),E=L.i32_add(L.getLocal(\"y\"),L.i32_const(2*l));F.addCode(L.i32_and(L.i32_and(L.call(s+\"_eq\",D,S),L.call(s+\"_eq\",K,B)),L.call(s+\"_eq\",$,E)))}function y(){const F=i.addFunction(a+\"_isZero\");F.addParam(\"x\",\"i32\"),F.setReturnType(\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l));F.addCode(L.i32_and(L.i32_and(L.call(s+\"_isZero\",D),L.call(s+\"_isZero\",K)),L.call(s+\"_isZero\",$)))}function I(){const F=i.addFunction(a+\"_inverse\");F.addParam(\"x\",\"i32\"),F.addParam(\"r\",\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l)),S=L.getLocal(\"r\"),B=L.i32_add(L.getLocal(\"r\"),L.i32_const(l)),E=L.i32_add(L.getLocal(\"r\"),L.i32_const(2*l)),_t=L.i32_const(i.alloc(l)),tt=L.i32_const(i.alloc(l)),ft=L.i32_const(i.alloc(l)),Bt=L.i32_const(i.alloc(l)),Ct=L.i32_const(i.alloc(l)),St=L.i32_const(i.alloc(l)),Ot=L.i32_const(i.alloc(l)),Dt=L.i32_const(i.alloc(l)),x=L.i32_const(i.alloc(l)),ht=L.i32_const(i.alloc(l)),yt=L.i32_const(i.alloc(l));F.addCode(L.call(s+\"_square\",D,_t),L.call(s+\"_square\",K,tt),L.call(s+\"_square\",$,ft),L.call(s+\"_mul\",D,K,Bt),L.call(s+\"_mul\",D,$,Ct),L.call(s+\"_mul\",K,$,St),L.call(o,St,Ot),L.call(s+\"_sub\",_t,Ot,Ot),L.call(o,ft,Dt),L.call(s+\"_sub\",Dt,Bt,Dt),L.call(s+\"_sub\",tt,Ct,x),L.call(s+\"_mul\",$,Dt,ht),L.call(s+\"_mul\",K,x,yt),L.call(s+\"_add\",ht,yt,ht),L.call(o,ht,ht),L.call(s+\"_mul\",D,Ot,yt),L.call(s+\"_add\",yt,ht,ht),L.call(s+\"_inverse\",ht,ht),L.call(s+\"_mul\",ht,Ot,S),L.call(s+\"_mul\",ht,Dt,B),L.call(s+\"_mul\",ht,x,E))}function _(){const F=i.addFunction(a+\"_sign\");F.addParam(\"x\",\"i32\"),F.addLocal(\"s\",\"i32\"),F.setReturnType(\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(2*l));F.addCode(L.setLocal(\"s\",L.call(s+\"_sign\",$)),L.if(L.getLocal(\"s\"),L.ret(L.getLocal(\"s\"))),L.setLocal(\"s\",L.call(s+\"_sign\",K)),L.if(L.getLocal(\"s\"),L.ret(L.getLocal(\"s\"))),L.ret(L.call(s+\"_sign\",D)))}function M(){const F=i.addFunction(a+\"_isOne\");F.addParam(\"x\",\"i32\"),F.setReturnType(\"i32\");const L=F.getCodeBuilder(),D=L.getLocal(\"x\"),K=L.i32_add(L.getLocal(\"x\"),L.i32_const(l)),$=L.i32_add(L.getLocal(\"x\"),L.i32_const(l*2));F.addCode(L.ret(L.i32_and(L.i32_and(L.call(s+\"_isOne\",D),L.call(s+\"_isZero\",K)),L.call(s+\"_isZero\",$))))}return y(),M(),G(),st(),P(),h(),m(),g(),u(),w(),_(),O(),Q(),N(),I(),d(),C(),i.exportFunction(a+\"_isZero\"),i.exportFunction(a+\"_isOne\"),i.exportFunction(a+\"_zero\"),i.exportFunction(a+\"_one\"),i.exportFunction(a+\"_copy\"),i.exportFunction(a+\"_mul\"),i.exportFunction(a+\"_square\"),i.exportFunction(a+\"_add\"),i.exportFunction(a+\"_sub\"),i.exportFunction(a+\"_neg\"),i.exportFunction(a+\"_sign\"),i.exportFunction(a+\"_fromMontgomery\"),i.exportFunction(a+\"_toMontgomery\"),i.exportFunction(a+\"_eq\"),i.exportFunction(a+\"_inverse\"),e(i,a),n(i,a+\"_exp\",l*3,a+\"_mul\",a+\"_square\",a+\"_copy\",a+\"_one\"),i.exportFunction(a+\"_exp\"),i.exportFunction(a+\"_timesScalar\"),i.exportFunction(a+\"_batchInverse\"),i.exportFunction(a+\"_isNegative\"),a},no}var io,$a;function Id(){return $a||($a=1,io=function(e,t,i,o,a,s,l,g){const d=e.addFunction(t);d.addParam(\"base\",\"i32\"),d.addParam(\"scalar\",\"i32\"),d.addParam(\"scalarLength\",\"i32\"),d.addParam(\"r\",\"i32\"),d.addLocal(\"old0\",\"i32\"),d.addLocal(\"nbits\",\"i32\"),d.addLocal(\"i\",\"i32\"),d.addLocal(\"last\",\"i32\"),d.addLocal(\"cur\",\"i32\"),d.addLocal(\"carry\",\"i32\"),d.addLocal(\"p\",\"i32\");const u=d.getCodeBuilder(),w=u.i32_const(e.alloc(i));function C(m){return u.i32_and(u.i32_shr_u(u.i32_load(u.i32_add(u.getLocal(\"scalar\"),u.i32_and(u.i32_shr_u(m,u.i32_const(3)),u.i32_const(4294967292)))),u.i32_and(m,u.i32_const(31))),u.i32_const(1))}function h(m){return[...u.i32_store8(u.getLocal(\"p\"),u.i32_const(m)),...u.setLocal(\"p\",u.i32_add(u.getLocal(\"p\"),u.i32_const(1)))]}d.addCode(u.if(u.i32_eqz(u.getLocal(\"scalarLength\")),[...u.call(g,u.getLocal(\"r\")),...u.ret([])]),u.setLocal(\"nbits\",u.i32_shl(u.getLocal(\"scalarLength\"),u.i32_const(3))),u.setLocal(\"old0\",u.i32_load(u.i32_const(0))),u.setLocal(\"p\",u.getLocal(\"old0\")),u.i32_store(u.i32_const(0),u.i32_and(u.i32_add(u.i32_add(u.getLocal(\"old0\"),u.i32_const(32)),u.getLocal(\"nbits\")),u.i32_const(4294967288))),u.setLocal(\"i\",u.i32_const(1)),u.setLocal(\"last\",C(u.i32_const(0))),u.setLocal(\"carry\",u.i32_const(0)),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal(\"i\"),u.getLocal(\"nbits\"))),u.setLocal(\"cur\",C(u.getLocal(\"i\"))),u.if(u.getLocal(\"last\"),u.if(u.getLocal(\"cur\"),u.if(u.getLocal(\"carry\"),[...u.setLocal(\"last\",u.i32_const(0)),...u.setLocal(\"carry\",u.i32_const(1)),...h(1)],[...u.setLocal(\"last\",u.i32_const(0)),...u.setLocal(\"carry\",u.i32_const(1)),...h(255)]),u.if(u.getLocal(\"carry\"),[...u.setLocal(\"last\",u.i32_const(0)),...u.setLocal(\"carry\",u.i32_const(1)),...h(255)],[...u.setLocal(\"last\",u.i32_const(0)),...u.setLocal(\"carry\",u.i32_const(0)),...h(1)])),u.if(u.getLocal(\"cur\"),u.if(u.getLocal(\"carry\"),[...u.setLocal(\"last\",u.i32_const(0)),...u.setLocal(\"carry\",u.i32_const(1)),...h(0)],[...u.setLocal(\"last\",u.i32_const(1)),...u.setLocal(\"carry\",u.i32_const(0)),...h(0)]),u.if(u.getLocal(\"carry\"),[...u.setLocal(\"last\",u.i32_const(1)),...u.setLocal(\"carry\",u.i32_const(0)),...h(0)],[...u.setLocal(\"last\",u.i32_const(0)),...u.setLocal(\"carry\",u.i32_const(0)),...h(0)]))),u.setLocal(\"i\",u.i32_add(u.getLocal(\"i\"),u.i32_const(1))),u.br(0))),u.if(u.getLocal(\"last\"),u.if(u.getLocal(\"carry\"),[...h(255),...h(0),...h(1)],[...h(1)]),u.if(u.getLocal(\"carry\"),[...h(0),...h(1)])),u.setLocal(\"p\",u.i32_sub(u.getLocal(\"p\"),u.i32_const(1))),u.call(l,u.getLocal(\"base\"),w),u.call(g,u.getLocal(\"r\")),u.block(u.loop(u.call(a,u.getLocal(\"r\"),u.getLocal(\"r\")),u.setLocal(\"cur\",u.i32_load8_u(u.getLocal(\"p\"))),u.if(u.getLocal(\"cur\"),u.if(u.i32_eq(u.getLocal(\"cur\"),u.i32_const(1)),u.call(o,u.getLocal(\"r\"),w,u.getLocal(\"r\")),u.call(s,u.getLocal(\"r\"),w,u.getLocal(\"r\")))),u.br_if(1,u.i32_eq(u.getLocal(\"old0\"),u.getLocal(\"p\"))),u.setLocal(\"p\",u.i32_sub(u.getLocal(\"p\"),u.i32_const(1))),u.br(0))),u.i32_store(u.i32_const(0),u.getLocal(\"old0\")))}),io}var oo,Ya;function Cd(){return Ya||(Ya=1,oo=function(e,t,i,o,a){const l=e.modules[t].n64*8;function g(){const C=e.addFunction(i+\"_getChunk\");C.addParam(\"pScalar\",\"i32\"),C.addParam(\"scalarSize\",\"i32\"),C.addParam(\"startBit\",\"i32\"),C.addParam(\"chunkSize\",\"i32\"),C.addLocal(\"bitsToEnd\",\"i32\"),C.addLocal(\"mask\",\"i32\"),C.setReturnType(\"i32\");const h=C.getCodeBuilder();C.addCode(h.setLocal(\"bitsToEnd\",h.i32_sub(h.i32_mul(h.getLocal(\"scalarSize\"),h.i32_const(8)),h.getLocal(\"startBit\"))),h.if(h.i32_gt_s(h.getLocal(\"chunkSize\"),h.getLocal(\"bitsToEnd\")),h.setLocal(\"mask\",h.i32_sub(h.i32_shl(h.i32_const(1),h.getLocal(\"bitsToEnd\")),h.i32_const(1))),h.setLocal(\"mask\",h.i32_sub(h.i32_shl(h.i32_const(1),h.getLocal(\"chunkSize\")),h.i32_const(1)))),h.i32_and(h.i32_shr_u(h.i32_load(h.i32_add(h.getLocal(\"pScalar\"),h.i32_shr_u(h.getLocal(\"startBit\"),h.i32_const(3))),0,0),h.i32_and(h.getLocal(\"startBit\"),h.i32_const(7))),h.getLocal(\"mask\")))}function d(){const C=e.addFunction(i+\"_chunk\");C.addParam(\"pBases\",\"i32\"),C.addParam(\"pScalars\",\"i32\"),C.addParam(\"scalarSize\",\"i32\"),C.addParam(\"n\",\"i32\"),C.addParam(\"startBit\",\"i32\"),C.addParam(\"chunkSize\",\"i32\"),C.addParam(\"pr\",\"i32\"),C.addLocal(\"nChunks\",\"i32\"),C.addLocal(\"itScalar\",\"i32\"),C.addLocal(\"endScalar\",\"i32\"),C.addLocal(\"itBase\",\"i32\"),C.addLocal(\"i\",\"i32\"),C.addLocal(\"j\",\"i32\"),C.addLocal(\"nTable\",\"i32\"),C.addLocal(\"pTable\",\"i32\"),C.addLocal(\"idx\",\"i32\"),C.addLocal(\"pIdxTable\",\"i32\");const h=C.getCodeBuilder();C.addCode(h.if(h.i32_eqz(h.getLocal(\"n\")),[...h.call(t+\"_zero\",h.getLocal(\"pr\")),...h.ret([])]),h.setLocal(\"nTable\",h.i32_shl(h.i32_const(1),h.getLocal(\"chunkSize\"))),h.setLocal(\"pTable\",h.i32_load(h.i32_const(0))),h.i32_store(h.i32_const(0),h.i32_add(h.getLocal(\"pTable\"),h.i32_mul(h.getLocal(\"nTable\"),h.i32_const(l)))),h.setLocal(\"j\",h.i32_const(0)),h.block(h.loop(h.br_if(1,h.i32_eq(h.getLocal(\"j\"),h.getLocal(\"nTable\"))),h.call(t+\"_zero\",h.i32_add(h.getLocal(\"pTable\"),h.i32_mul(h.getLocal(\"j\"),h.i32_const(l)))),h.setLocal(\"j\",h.i32_add(h.getLocal(\"j\"),h.i32_const(1))),h.br(0))),h.setLocal(\"itBase\",h.getLocal(\"pBases\")),h.setLocal(\"itScalar\",h.getLocal(\"pScalars\")),h.setLocal(\"endScalar\",h.i32_add(h.getLocal(\"pScalars\"),h.i32_mul(h.getLocal(\"n\"),h.getLocal(\"scalarSize\")))),h.block(h.loop(h.br_if(1,h.i32_eq(h.getLocal(\"itScalar\"),h.getLocal(\"endScalar\"))),h.setLocal(\"idx\",h.call(i+\"_getChunk\",h.getLocal(\"itScalar\"),h.getLocal(\"scalarSize\"),h.getLocal(\"startBit\"),h.getLocal(\"chunkSize\"))),h.if(h.getLocal(\"idx\"),[...h.setLocal(\"pIdxTable\",h.i32_add(h.getLocal(\"pTable\"),h.i32_mul(h.i32_sub(h.getLocal(\"idx\"),h.i32_const(1)),h.i32_const(l)))),...h.call(o,h.getLocal(\"pIdxTable\"),h.getLocal(\"itBase\"),h.getLocal(\"pIdxTable\"))]),h.setLocal(\"itScalar\",h.i32_add(h.getLocal(\"itScalar\"),h.getLocal(\"scalarSize\"))),h.setLocal(\"itBase\",h.i32_add(h.getLocal(\"itBase\"),h.i32_const(a))),h.br(0))),h.call(i+\"_reduceTable\",h.getLocal(\"pTable\"),h.getLocal(\"chunkSize\")),h.call(t+\"_copy\",h.getLocal(\"pTable\"),h.getLocal(\"pr\")),h.i32_store(h.i32_const(0),h.getLocal(\"pTable\")))}function u(){const C=e.addFunction(i);C.addParam(\"pBases\",\"i32\"),C.addParam(\"pScalars\",\"i32\"),C.addParam(\"scalarSize\",\"i32\"),C.addParam(\"n\",\"i32\"),C.addParam(\"pr\",\"i32\"),C.addLocal(\"chunkSize\",\"i32\"),C.addLocal(\"nChunks\",\"i32\"),C.addLocal(\"itScalar\",\"i32\"),C.addLocal(\"endScalar\",\"i32\"),C.addLocal(\"itBase\",\"i32\"),C.addLocal(\"itBit\",\"i32\"),C.addLocal(\"i\",\"i32\"),C.addLocal(\"j\",\"i32\"),C.addLocal(\"nTable\",\"i32\"),C.addLocal(\"pTable\",\"i32\"),C.addLocal(\"idx\",\"i32\"),C.addLocal(\"pIdxTable\",\"i32\");const h=C.getCodeBuilder(),m=h.i32_const(e.alloc(l)),O=e.alloc([17,17,17,17,17,17,17,17,17,17,16,16,15,14,13,13,12,11,10,9,8,7,7,6,5,4,3,2,1,1,1,1]);C.addCode(h.call(t+\"_zero\",h.getLocal(\"pr\")),h.if(h.i32_eqz(h.getLocal(\"n\")),h.ret([])),h.setLocal(\"chunkSize\",h.i32_load8_u(h.i32_clz(h.getLocal(\"n\")),O)),h.setLocal(\"nChunks\",h.i32_add(h.i32_div_u(h.i32_sub(h.i32_shl(h.getLocal(\"scalarSize\"),h.i32_const(3)),h.i32_const(1)),h.getLocal(\"chunkSize\")),h.i32_const(1))),h.setLocal(\"itBit\",h.i32_mul(h.i32_sub(h.getLocal(\"nChunks\"),h.i32_const(1)),h.getLocal(\"chunkSize\"))),h.block(h.loop(h.br_if(1,h.i32_lt_s(h.getLocal(\"itBit\"),h.i32_const(0))),h.if(h.i32_eqz(h.call(t+\"_isZero\",h.getLocal(\"pr\"))),[...h.setLocal(\"j\",h.i32_const(0)),...h.block(h.loop(h.br_if(1,h.i32_eq(h.getLocal(\"j\"),h.getLocal(\"chunkSize\"))),h.call(t+\"_double\",h.getLocal(\"pr\"),h.getLocal(\"pr\")),h.setLocal(\"j\",h.i32_add(h.getLocal(\"j\"),h.i32_const(1))),h.br(0)))]),h.call(i+\"_chunk\",h.getLocal(\"pBases\"),h.getLocal(\"pScalars\"),h.getLocal(\"scalarSize\"),h.getLocal(\"n\"),h.getLocal(\"itBit\"),h.getLocal(\"chunkSize\"),m),h.call(t+\"_add\",h.getLocal(\"pr\"),m,h.getLocal(\"pr\")),h.setLocal(\"itBit\",h.i32_sub(h.getLocal(\"itBit\"),h.getLocal(\"chunkSize\"))),h.br(0))))}function w(){const C=e.addFunction(i+\"_reduceTable\");C.addParam(\"pTable\",\"i32\"),C.addParam(\"p\",\"i32\"),C.addLocal(\"half\",\"i32\"),C.addLocal(\"it1\",\"i32\"),C.addLocal(\"it2\",\"i32\"),C.addLocal(\"pAcc\",\"i32\");const h=C.getCodeBuilder();C.addCode(h.if(h.i32_eq(h.getLocal(\"p\"),h.i32_const(1)),h.ret([])),h.setLocal(\"half\",h.i32_shl(h.i32_const(1),h.i32_sub(h.getLocal(\"p\"),h.i32_const(1)))),h.setLocal(\"it1\",h.getLocal(\"pTable\")),h.setLocal(\"it2\",h.i32_add(h.getLocal(\"pTable\"),h.i32_mul(h.getLocal(\"half\"),h.i32_const(l)))),h.setLocal(\"pAcc\",h.i32_sub(h.getLocal(\"it2\"),h.i32_const(l))),h.block(h.loop(h.br_if(1,h.i32_eq(h.getLocal(\"it1\"),h.getLocal(\"pAcc\"))),h.call(t+\"_add\",h.getLocal(\"it1\"),h.getLocal(\"it2\"),h.getLocal(\"it1\")),h.call(t+\"_add\",h.getLocal(\"pAcc\"),h.getLocal(\"it2\"),h.getLocal(\"pAcc\")),h.setLocal(\"it1\",h.i32_add(h.getLocal(\"it1\"),h.i32_const(l))),h.setLocal(\"it2\",h.i32_add(h.getLocal(\"it2\"),h.i32_const(l))),h.br(0))),h.call(i+\"_reduceTable\",h.getLocal(\"pTable\"),h.i32_sub(h.getLocal(\"p\"),h.i32_const(1))),h.setLocal(\"p\",h.i32_sub(h.getLocal(\"p\"),h.i32_const(1))),h.block(h.loop(h.br_if(1,h.i32_eqz(h.getLocal(\"p\"))),h.call(t+\"_double\",h.getLocal(\"pAcc\"),h.getLocal(\"pAcc\")),h.setLocal(\"p\",h.i32_sub(h.getLocal(\"p\"),h.i32_const(1))),h.br(0))),h.call(t+\"_add\",h.getLocal(\"pTable\"),h.getLocal(\"pAcc\"),h.getLocal(\"pTable\")))}g(),w(),d(),u(),e.exportFunction(i),e.exportFunction(i+\"_chunk\")}),oo}var ao,Wa;function Kr(){if(Wa)return ao;Wa=1;const n=Id(),e=qr(),t=Cd();return ao=function(o,a,s,l){const g=o.modules[s].n64,d=g*8;if(o.modules[a])return a;o.modules[a]={n64:g*3};function u(){const U=o.addFunction(a+\"_isZero\");U.addParam(\"p1\",\"i32\"),U.setReturnType(\"i32\");const r=U.getCodeBuilder();U.addCode(r.call(s+\"_isZero\",r.i32_add(r.getLocal(\"p1\"),r.i32_const(d*2))))}function w(){const U=o.addFunction(a+\"_isZeroAffine\");U.addParam(\"p1\",\"i32\"),U.setReturnType(\"i32\");const r=U.getCodeBuilder();U.addCode(r.i32_and(r.call(s+\"_isZero\",r.getLocal(\"p1\")),r.call(s+\"_isZero\",r.i32_add(r.getLocal(\"p1\"),r.i32_const(d)))))}function C(){const U=o.addFunction(a+\"_copy\");U.addParam(\"ps\",\"i32\"),U.addParam(\"pd\",\"i32\");const r=U.getCodeBuilder();for(let dt=0;dt<g*3;dt++)U.addCode(r.i64_store(r.getLocal(\"pd\"),dt*8,r.i64_load(r.getLocal(\"ps\"),dt*8)))}function h(){const U=o.addFunction(a+\"_copyAffine\");U.addParam(\"ps\",\"i32\"),U.addParam(\"pd\",\"i32\");const r=U.getCodeBuilder();for(let dt=0;dt<g*2;dt++)U.addCode(r.i64_store(r.getLocal(\"pd\"),dt*8,r.i64_load(r.getLocal(\"ps\"),dt*8)))}function m(){const U=o.addFunction(a+\"_zero\");U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder();U.addCode(r.call(s+\"_zero\",r.getLocal(\"pr\"))),U.addCode(r.call(s+\"_one\",r.i32_add(r.getLocal(\"pr\"),r.i32_const(d)))),U.addCode(r.call(s+\"_zero\",r.i32_add(r.getLocal(\"pr\"),r.i32_const(d*2))))}function O(){const U=o.addFunction(a+\"_zeroAffine\");U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder();U.addCode(r.call(s+\"_zero\",r.getLocal(\"pr\"))),U.addCode(r.call(s+\"_zero\",r.i32_add(r.getLocal(\"pr\"),r.i32_const(d))))}function Q(){const U=o.addFunction(a+\"_eq\");U.addParam(\"p1\",\"i32\"),U.addParam(\"p2\",\"i32\"),U.setReturnType(\"i32\"),U.addLocal(\"z1\",\"i32\"),U.addLocal(\"z2\",\"i32\");const r=U.getCodeBuilder(),dt=r.getLocal(\"p1\"),k=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d));U.addCode(r.setLocal(\"z1\",r.i32_add(r.getLocal(\"p1\"),r.i32_const(d*2))));const f=r.getLocal(\"z1\"),ct=r.getLocal(\"p2\"),It=r.i32_add(r.getLocal(\"p2\"),r.i32_const(d));U.addCode(r.setLocal(\"z2\",r.i32_add(r.getLocal(\"p2\"),r.i32_const(d*2))));const bt=r.getLocal(\"z2\"),H=r.i32_const(o.alloc(d)),Z=r.i32_const(o.alloc(d)),V=r.i32_const(o.alloc(d)),gt=r.i32_const(o.alloc(d)),Ft=r.i32_const(o.alloc(d)),qt=r.i32_const(o.alloc(d)),W=r.i32_const(o.alloc(d)),b=r.i32_const(o.alloc(d));U.addCode(r.if(r.call(a+\"_isZero\",r.getLocal(\"p1\")),r.ret(r.call(a+\"_isZero\",r.getLocal(\"p2\")))),r.if(r.call(a+\"_isZero\",r.getLocal(\"p2\")),r.ret(r.i32_const(0))),r.if(r.call(s+\"_isOne\",f),r.ret(r.call(a+\"_eqMixed\",r.getLocal(\"p2\"),r.getLocal(\"p1\")))),r.if(r.call(s+\"_isOne\",bt),r.ret(r.call(a+\"_eqMixed\",r.getLocal(\"p1\"),r.getLocal(\"p2\")))),r.call(s+\"_square\",f,H),r.call(s+\"_square\",bt,Z),r.call(s+\"_mul\",dt,Z,V),r.call(s+\"_mul\",ct,H,gt),r.call(s+\"_mul\",f,H,Ft),r.call(s+\"_mul\",bt,Z,qt),r.call(s+\"_mul\",k,qt,W),r.call(s+\"_mul\",It,Ft,b),r.if(r.call(s+\"_eq\",V,gt),r.if(r.call(s+\"_eq\",W,b),r.ret(r.i32_const(1)))),r.ret(r.i32_const(0)))}function P(){const U=o.addFunction(a+\"_eqMixed\");U.addParam(\"p1\",\"i32\"),U.addParam(\"p2\",\"i32\"),U.setReturnType(\"i32\"),U.addLocal(\"z1\",\"i32\");const r=U.getCodeBuilder(),dt=r.getLocal(\"p1\"),k=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d));U.addCode(r.setLocal(\"z1\",r.i32_add(r.getLocal(\"p1\"),r.i32_const(d*2))));const f=r.getLocal(\"z1\"),ct=r.getLocal(\"p2\"),It=r.i32_add(r.getLocal(\"p2\"),r.i32_const(d)),bt=r.i32_const(o.alloc(d)),H=r.i32_const(o.alloc(d)),Z=r.i32_const(o.alloc(d)),V=r.i32_const(o.alloc(d));U.addCode(r.if(r.call(a+\"_isZero\",r.getLocal(\"p1\")),r.ret(r.call(a+\"_isZeroAffine\",r.getLocal(\"p2\")))),r.if(r.call(a+\"_isZeroAffine\",r.getLocal(\"p2\")),r.ret(r.i32_const(0))),r.if(r.call(s+\"_isOne\",f),r.ret(r.call(a+\"_eqAffine\",r.getLocal(\"p1\"),r.getLocal(\"p2\")))),r.call(s+\"_square\",f,bt),r.call(s+\"_mul\",ct,bt,H),r.call(s+\"_mul\",f,bt,Z),r.call(s+\"_mul\",It,Z,V),r.if(r.call(s+\"_eq\",dt,H),r.if(r.call(s+\"_eq\",k,V),r.ret(r.i32_const(1)))),r.ret(r.i32_const(0)))}function G(){const U=o.addFunction(a+\"_double\");U.addParam(\"p1\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder(),dt=r.getLocal(\"p1\"),k=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d)),f=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d*2)),ct=r.getLocal(\"pr\"),It=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d)),bt=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d*2)),H=r.i32_const(o.alloc(d)),Z=r.i32_const(o.alloc(d)),V=r.i32_const(o.alloc(d)),gt=r.i32_const(o.alloc(d)),Ft=r.i32_const(o.alloc(d)),qt=r.i32_const(o.alloc(d)),W=r.i32_const(o.alloc(d)),b=r.i32_const(o.alloc(d));U.addCode(r.if(r.call(a+\"_isZero\",r.getLocal(\"p1\")),[...r.call(a+\"_copy\",r.getLocal(\"p1\"),r.getLocal(\"pr\")),...r.ret([])]),r.if(r.call(s+\"_isOne\",f),[...r.ret(r.call(a+\"_doubleAffine\",r.getLocal(\"p1\"),r.getLocal(\"pr\"))),...r.ret([])]),r.call(s+\"_square\",dt,H),r.call(s+\"_square\",k,Z),r.call(s+\"_square\",Z,V),r.call(s+\"_add\",dt,Z,gt),r.call(s+\"_square\",gt,gt),r.call(s+\"_sub\",gt,H,gt),r.call(s+\"_sub\",gt,V,gt),r.call(s+\"_add\",gt,gt,gt),r.call(s+\"_add\",H,H,Ft),r.call(s+\"_add\",Ft,H,Ft),r.call(s+\"_square\",Ft,qt),r.call(s+\"_mul\",k,f,W),r.call(s+\"_add\",gt,gt,ct),r.call(s+\"_sub\",qt,ct,ct),r.call(s+\"_add\",V,V,b),r.call(s+\"_add\",b,b,b),r.call(s+\"_add\",b,b,b),r.call(s+\"_sub\",gt,ct,It),r.call(s+\"_mul\",It,Ft,It),r.call(s+\"_sub\",It,b,It),r.call(s+\"_add\",W,W,bt))}function st(){const U=o.addFunction(a+\"_doubleAffine\");U.addParam(\"p1\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder(),dt=r.getLocal(\"p1\"),k=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d)),f=r.getLocal(\"pr\"),ct=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d)),It=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d*2)),bt=r.i32_const(o.alloc(d)),H=r.i32_const(o.alloc(d)),Z=r.i32_const(o.alloc(d)),V=r.i32_const(o.alloc(d)),gt=r.i32_const(o.alloc(d)),Ft=r.i32_const(o.alloc(d));U.addCode(r.if(r.call(a+\"_isZeroAffine\",r.getLocal(\"p1\")),[...r.call(a+\"_toJacobian\",r.getLocal(\"p1\"),r.getLocal(\"pr\")),...r.ret([])]),r.call(s+\"_square\",dt,bt),r.call(s+\"_square\",k,H),r.call(s+\"_square\",H,Z),r.call(s+\"_add\",dt,H,V),r.call(s+\"_square\",V,V),r.call(s+\"_sub\",V,bt,V),r.call(s+\"_sub\",V,Z,V),r.call(s+\"_add\",V,V,V),r.call(s+\"_add\",bt,bt,gt),r.call(s+\"_add\",gt,bt,gt),r.call(s+\"_add\",k,k,It),r.call(s+\"_square\",gt,f),r.call(s+\"_sub\",f,V,f),r.call(s+\"_sub\",f,V,f),r.call(s+\"_add\",Z,Z,Ft),r.call(s+\"_add\",Ft,Ft,Ft),r.call(s+\"_add\",Ft,Ft,Ft),r.call(s+\"_sub\",V,f,ct),r.call(s+\"_mul\",ct,gt,ct),r.call(s+\"_sub\",ct,Ft,ct))}function N(){const U=o.addFunction(a+\"_eqAffine\");U.addParam(\"p1\",\"i32\"),U.addParam(\"p2\",\"i32\"),U.setReturnType(\"i32\"),U.addLocal(\"z1\",\"i32\");const r=U.getCodeBuilder();U.addCode(r.ret(r.i32_and(r.call(s+\"_eq\",r.getLocal(\"p1\"),r.getLocal(\"p2\")),r.call(s+\"_eq\",r.i32_add(r.getLocal(\"p1\"),r.i32_const(d)),r.i32_add(r.getLocal(\"p2\"),r.i32_const(d))))))}function y(){const U=o.addFunction(a+\"_toMontgomery\");U.addParam(\"p1\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder();U.addCode(r.call(s+\"_toMontgomery\",r.getLocal(\"p1\"),r.getLocal(\"pr\")));for(let dt=1;dt<3;dt++)U.addCode(r.call(s+\"_toMontgomery\",r.i32_add(r.getLocal(\"p1\"),r.i32_const(dt*d)),r.i32_add(r.getLocal(\"pr\"),r.i32_const(dt*d))))}function I(){const U=o.addFunction(a+\"_toMontgomeryAffine\");U.addParam(\"p1\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder();U.addCode(r.call(s+\"_toMontgomery\",r.getLocal(\"p1\"),r.getLocal(\"pr\")));for(let dt=1;dt<2;dt++)U.addCode(r.call(s+\"_toMontgomery\",r.i32_add(r.getLocal(\"p1\"),r.i32_const(dt*d)),r.i32_add(r.getLocal(\"pr\"),r.i32_const(dt*d))))}function _(){const U=o.addFunction(a+\"_fromMontgomery\");U.addParam(\"p1\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder();U.addCode(r.call(s+\"_fromMontgomery\",r.getLocal(\"p1\"),r.getLocal(\"pr\")));for(let dt=1;dt<3;dt++)U.addCode(r.call(s+\"_fromMontgomery\",r.i32_add(r.getLocal(\"p1\"),r.i32_const(dt*d)),r.i32_add(r.getLocal(\"pr\"),r.i32_const(dt*d))))}function M(){const U=o.addFunction(a+\"_fromMontgomeryAffine\");U.addParam(\"p1\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder();U.addCode(r.call(s+\"_fromMontgomery\",r.getLocal(\"p1\"),r.getLocal(\"pr\")));for(let dt=1;dt<2;dt++)U.addCode(r.call(s+\"_fromMontgomery\",r.i32_add(r.getLocal(\"p1\"),r.i32_const(dt*d)),r.i32_add(r.getLocal(\"pr\"),r.i32_const(dt*d))))}function F(){const U=o.addFunction(a+\"_add\");U.addParam(\"p1\",\"i32\"),U.addParam(\"p2\",\"i32\"),U.addParam(\"pr\",\"i32\"),U.addLocal(\"z1\",\"i32\"),U.addLocal(\"z2\",\"i32\");const r=U.getCodeBuilder(),dt=r.getLocal(\"p1\"),k=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d));U.addCode(r.setLocal(\"z1\",r.i32_add(r.getLocal(\"p1\"),r.i32_const(d*2))));const f=r.getLocal(\"z1\"),ct=r.getLocal(\"p2\"),It=r.i32_add(r.getLocal(\"p2\"),r.i32_const(d));U.addCode(r.setLocal(\"z2\",r.i32_add(r.getLocal(\"p2\"),r.i32_const(d*2))));const bt=r.getLocal(\"z2\"),H=r.getLocal(\"pr\"),Z=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d)),V=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d*2)),gt=r.i32_const(o.alloc(d)),Ft=r.i32_const(o.alloc(d)),qt=r.i32_const(o.alloc(d)),W=r.i32_const(o.alloc(d)),b=r.i32_const(o.alloc(d)),xt=r.i32_const(o.alloc(d)),Vt=r.i32_const(o.alloc(d)),$t=r.i32_const(o.alloc(d)),v=r.i32_const(o.alloc(d)),p=r.i32_const(o.alloc(d)),A=r.i32_const(o.alloc(d)),R=r.i32_const(o.alloc(d)),j=r.i32_const(o.alloc(d)),J=r.i32_const(o.alloc(d)),nt=r.i32_const(o.alloc(d)),Mt=r.i32_const(o.alloc(d)),jt=r.i32_const(o.alloc(d));U.addCode(r.if(r.call(a+\"_isZero\",r.getLocal(\"p1\")),[...r.call(a+\"_copy\",r.getLocal(\"p2\"),r.getLocal(\"pr\")),...r.ret([])]),r.if(r.call(a+\"_isZero\",r.getLocal(\"p2\")),[...r.call(a+\"_copy\",r.getLocal(\"p1\"),r.getLocal(\"pr\")),...r.ret([])]),r.if(r.call(s+\"_isOne\",f),[...r.call(a+\"_addMixed\",ct,dt,H),...r.ret([])]),r.if(r.call(s+\"_isOne\",bt),[...r.call(a+\"_addMixed\",dt,ct,H),...r.ret([])]),r.call(s+\"_square\",f,gt),r.call(s+\"_square\",bt,Ft),r.call(s+\"_mul\",dt,Ft,qt),r.call(s+\"_mul\",ct,gt,W),r.call(s+\"_mul\",f,gt,b),r.call(s+\"_mul\",bt,Ft,xt),r.call(s+\"_mul\",k,xt,Vt),r.call(s+\"_mul\",It,b,$t),r.if(r.call(s+\"_eq\",qt,W),r.if(r.call(s+\"_eq\",Vt,$t),[...r.call(a+\"_double\",r.getLocal(\"p1\"),r.getLocal(\"pr\")),...r.ret([])])),r.call(s+\"_sub\",W,qt,v),r.call(s+\"_sub\",$t,Vt,p),r.call(s+\"_add\",v,v,A),r.call(s+\"_square\",A,A),r.call(s+\"_mul\",v,A,R),r.call(s+\"_add\",p,p,j),r.call(s+\"_mul\",qt,A,nt),r.call(s+\"_square\",j,J),r.call(s+\"_add\",nt,nt,Mt),r.call(s+\"_sub\",J,R,H),r.call(s+\"_sub\",H,Mt,H),r.call(s+\"_mul\",Vt,R,jt),r.call(s+\"_add\",jt,jt,jt),r.call(s+\"_sub\",nt,H,Z),r.call(s+\"_mul\",Z,j,Z),r.call(s+\"_sub\",Z,jt,Z),r.call(s+\"_add\",f,bt,V),r.call(s+\"_square\",V,V),r.call(s+\"_sub\",V,gt,V),r.call(s+\"_sub\",V,Ft,V),r.call(s+\"_mul\",V,v,V))}function L(){const U=o.addFunction(a+\"_addMixed\");U.addParam(\"p1\",\"i32\"),U.addParam(\"p2\",\"i32\"),U.addParam(\"pr\",\"i32\"),U.addLocal(\"z1\",\"i32\");const r=U.getCodeBuilder(),dt=r.getLocal(\"p1\"),k=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d));U.addCode(r.setLocal(\"z1\",r.i32_add(r.getLocal(\"p1\"),r.i32_const(d*2))));const f=r.getLocal(\"z1\"),ct=r.getLocal(\"p2\"),It=r.i32_add(r.getLocal(\"p2\"),r.i32_const(d)),bt=r.getLocal(\"pr\"),H=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d)),Z=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d*2)),V=r.i32_const(o.alloc(d)),gt=r.i32_const(o.alloc(d)),Ft=r.i32_const(o.alloc(d)),qt=r.i32_const(o.alloc(d)),W=r.i32_const(o.alloc(d)),b=r.i32_const(o.alloc(d)),xt=r.i32_const(o.alloc(d)),Vt=r.i32_const(o.alloc(d)),$t=r.i32_const(o.alloc(d)),v=r.i32_const(o.alloc(d)),p=r.i32_const(o.alloc(d)),A=r.i32_const(o.alloc(d)),R=r.i32_const(o.alloc(d)),j=r.i32_const(o.alloc(d));U.addCode(r.if(r.call(a+\"_isZero\",r.getLocal(\"p1\")),[...r.call(a+\"_copyAffine\",r.getLocal(\"p2\"),r.getLocal(\"pr\")),...r.call(s+\"_one\",r.i32_add(r.getLocal(\"pr\"),r.i32_const(d*2))),...r.ret([])]),r.if(r.call(a+\"_isZeroAffine\",r.getLocal(\"p2\")),[...r.call(a+\"_copy\",r.getLocal(\"p1\"),r.getLocal(\"pr\")),...r.ret([])]),r.if(r.call(s+\"_isOne\",f),[...r.call(a+\"_addAffine\",dt,ct,bt),...r.ret([])]),r.call(s+\"_square\",f,V),r.call(s+\"_mul\",ct,V,gt),r.call(s+\"_mul\",f,V,Ft),r.call(s+\"_mul\",It,Ft,qt),r.if(r.call(s+\"_eq\",dt,gt),r.if(r.call(s+\"_eq\",k,qt),[...r.call(a+\"_doubleAffine\",r.getLocal(\"p2\"),r.getLocal(\"pr\")),...r.ret([])])),r.call(s+\"_sub\",gt,dt,W),r.call(s+\"_sub\",qt,k,xt),r.call(s+\"_square\",W,b),r.call(s+\"_add\",b,b,Vt),r.call(s+\"_add\",Vt,Vt,Vt),r.call(s+\"_mul\",W,Vt,$t),r.call(s+\"_add\",xt,xt,v),r.call(s+\"_mul\",dt,Vt,A),r.call(s+\"_square\",v,p),r.call(s+\"_add\",A,A,R),r.call(s+\"_sub\",p,$t,bt),r.call(s+\"_sub\",bt,R,bt),r.call(s+\"_mul\",k,$t,j),r.call(s+\"_add\",j,j,j),r.call(s+\"_sub\",A,bt,H),r.call(s+\"_mul\",H,v,H),r.call(s+\"_sub\",H,j,H),r.call(s+\"_add\",f,W,Z),r.call(s+\"_square\",Z,Z),r.call(s+\"_sub\",Z,V,Z),r.call(s+\"_sub\",Z,b,Z))}function D(){const U=o.addFunction(a+\"_addAffine\");U.addParam(\"p1\",\"i32\"),U.addParam(\"p2\",\"i32\"),U.addParam(\"pr\",\"i32\"),U.addLocal(\"z1\",\"i32\");const r=U.getCodeBuilder(),dt=r.getLocal(\"p1\"),k=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d));U.addCode(r.setLocal(\"z1\",r.i32_add(r.getLocal(\"p1\"),r.i32_const(d*2))));const f=r.getLocal(\"p2\"),ct=r.i32_add(r.getLocal(\"p2\"),r.i32_const(d)),It=r.getLocal(\"pr\"),bt=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d)),H=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d*2)),Z=r.i32_const(o.alloc(d)),V=r.i32_const(o.alloc(d)),gt=r.i32_const(o.alloc(d)),Ft=r.i32_const(o.alloc(d)),qt=r.i32_const(o.alloc(d)),W=r.i32_const(o.alloc(d)),b=r.i32_const(o.alloc(d)),xt=r.i32_const(o.alloc(d)),Vt=r.i32_const(o.alloc(d)),$t=r.i32_const(o.alloc(d));U.addCode(r.if(r.call(a+\"_isZeroAffine\",r.getLocal(\"p1\")),[...r.call(a+\"_copyAffine\",r.getLocal(\"p2\"),r.getLocal(\"pr\")),...r.call(s+\"_one\",r.i32_add(r.getLocal(\"pr\"),r.i32_const(d*2))),...r.ret([])]),r.if(r.call(a+\"_isZeroAffine\",r.getLocal(\"p2\")),[...r.call(a+\"_copyAffine\",r.getLocal(\"p1\"),r.getLocal(\"pr\")),...r.call(s+\"_one\",r.i32_add(r.getLocal(\"pr\"),r.i32_const(d*2))),...r.ret([])]),r.if(r.call(s+\"_eq\",dt,f),r.if(r.call(s+\"_eq\",k,ct),[...r.call(a+\"_doubleAffine\",r.getLocal(\"p2\"),r.getLocal(\"pr\")),...r.ret([])])),r.call(s+\"_sub\",f,dt,Z),r.call(s+\"_sub\",ct,k,gt),r.call(s+\"_square\",Z,V),r.call(s+\"_add\",V,V,Ft),r.call(s+\"_add\",Ft,Ft,Ft),r.call(s+\"_mul\",Z,Ft,qt),r.call(s+\"_add\",gt,gt,W),r.call(s+\"_mul\",dt,Ft,xt),r.call(s+\"_square\",W,b),r.call(s+\"_add\",xt,xt,Vt),r.call(s+\"_sub\",b,qt,It),r.call(s+\"_sub\",It,Vt,It),r.call(s+\"_mul\",k,qt,$t),r.call(s+\"_add\",$t,$t,$t),r.call(s+\"_sub\",xt,It,bt),r.call(s+\"_mul\",bt,W,bt),r.call(s+\"_sub\",bt,$t,bt),r.call(s+\"_add\",Z,Z,H))}function K(){const U=o.addFunction(a+\"_neg\");U.addParam(\"p1\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder(),dt=r.getLocal(\"p1\"),k=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d)),f=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d*2)),ct=r.getLocal(\"pr\"),It=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d)),bt=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d*2));U.addCode(r.call(s+\"_copy\",dt,ct),r.call(s+\"_neg\",k,It),r.call(s+\"_copy\",f,bt))}function $(){const U=o.addFunction(a+\"_negAffine\");U.addParam(\"p1\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder(),dt=r.getLocal(\"p1\"),k=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d)),f=r.getLocal(\"pr\"),ct=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d));U.addCode(r.call(s+\"_copy\",dt,f),r.call(s+\"_neg\",k,ct))}function S(){const U=o.addFunction(a+\"_sub\");U.addParam(\"p1\",\"i32\"),U.addParam(\"p2\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder(),dt=r.i32_const(o.alloc(d*3));U.addCode(r.call(a+\"_neg\",r.getLocal(\"p2\"),dt),r.call(a+\"_add\",r.getLocal(\"p1\"),dt,r.getLocal(\"pr\")))}function B(){const U=o.addFunction(a+\"_subMixed\");U.addParam(\"p1\",\"i32\"),U.addParam(\"p2\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder(),dt=r.i32_const(o.alloc(d*3));U.addCode(r.call(a+\"_negAffine\",r.getLocal(\"p2\"),dt),r.call(a+\"_addMixed\",r.getLocal(\"p1\"),dt,r.getLocal(\"pr\")))}function E(){const U=o.addFunction(a+\"_subAffine\");U.addParam(\"p1\",\"i32\"),U.addParam(\"p2\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder(),dt=r.i32_const(o.alloc(d*3));U.addCode(r.call(a+\"_negAffine\",r.getLocal(\"p2\"),dt),r.call(a+\"_addAffine\",r.getLocal(\"p1\"),dt,r.getLocal(\"pr\")))}function _t(){const U=o.addFunction(a+\"_normalize\");U.addParam(\"p1\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder(),dt=r.getLocal(\"p1\"),k=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d)),f=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d*2)),ct=r.getLocal(\"pr\"),It=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d)),bt=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d*2)),H=r.i32_const(o.alloc(d)),Z=r.i32_const(o.alloc(d)),V=r.i32_const(o.alloc(d));U.addCode(r.if(r.call(a+\"_isZero\",r.getLocal(\"p1\")),r.call(a+\"_zero\",r.getLocal(\"pr\")),[...r.call(s+\"_inverse\",f,H),...r.call(s+\"_square\",H,Z),...r.call(s+\"_mul\",H,Z,V),...r.call(s+\"_mul\",dt,Z,ct),...r.call(s+\"_mul\",k,V,It),...r.call(s+\"_one\",bt)]))}function tt(){const U=o.addFunction(a+\"_toAffine\");U.addParam(\"p1\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder(),dt=r.getLocal(\"p1\"),k=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d)),f=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d*2)),ct=r.getLocal(\"pr\"),It=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d)),bt=r.i32_const(o.alloc(d)),H=r.i32_const(o.alloc(d)),Z=r.i32_const(o.alloc(d));U.addCode(r.if(r.call(a+\"_isZero\",r.getLocal(\"p1\")),[...r.call(s+\"_zero\",ct),...r.call(s+\"_zero\",It)],[...r.call(s+\"_inverse\",f,bt),...r.call(s+\"_square\",bt,H),...r.call(s+\"_mul\",bt,H,Z),...r.call(s+\"_mul\",dt,H,ct),...r.call(s+\"_mul\",k,Z,It)]))}function ft(){const U=o.addFunction(a+\"_toJacobian\");U.addParam(\"p1\",\"i32\"),U.addParam(\"pr\",\"i32\");const r=U.getCodeBuilder(),dt=r.getLocal(\"p1\"),k=r.i32_add(r.getLocal(\"p1\"),r.i32_const(d)),f=r.getLocal(\"pr\"),ct=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d)),It=r.i32_add(r.getLocal(\"pr\"),r.i32_const(d*2));U.addCode(r.if(r.call(a+\"_isZeroAffine\",r.getLocal(\"p1\")),r.call(a+\"_zero\",r.getLocal(\"pr\")),[...r.call(s+\"_one\",It),...r.call(s+\"_copy\",k,ct),...r.call(s+\"_copy\",dt,f)]))}function Bt(){const U=o.addFunction(a+\"_batchToAffine\");U.addParam(\"pIn\",\"i32\"),U.addParam(\"n\",\"i32\"),U.addParam(\"pOut\",\"i32\"),U.addLocal(\"pAux\",\"i32\"),U.addLocal(\"itIn\",\"i32\"),U.addLocal(\"itAux\",\"i32\"),U.addLocal(\"itOut\",\"i32\"),U.addLocal(\"i\",\"i32\");const r=U.getCodeBuilder(),dt=r.i32_const(o.alloc(d));U.addCode(r.setLocal(\"pAux\",r.i32_load(r.i32_const(0))),r.i32_store(r.i32_const(0),r.i32_add(r.getLocal(\"pAux\"),r.i32_mul(r.getLocal(\"n\"),r.i32_const(d)))),r.call(s+\"_batchInverse\",r.i32_add(r.getLocal(\"pIn\"),r.i32_const(d*2)),r.i32_const(d*3),r.getLocal(\"n\"),r.getLocal(\"pAux\"),r.i32_const(d)),r.setLocal(\"itIn\",r.getLocal(\"pIn\")),r.setLocal(\"itAux\",r.getLocal(\"pAux\")),r.setLocal(\"itOut\",r.getLocal(\"pOut\")),r.setLocal(\"i\",r.i32_const(0)),r.block(r.loop(r.br_if(1,r.i32_eq(r.getLocal(\"i\"),r.getLocal(\"n\"))),r.if(r.call(s+\"_isZero\",r.getLocal(\"itAux\")),[...r.call(s+\"_zero\",r.getLocal(\"itOut\")),...r.call(s+\"_zero\",r.i32_add(r.getLocal(\"itOut\"),r.i32_const(d)))],[...r.call(s+\"_mul\",r.getLocal(\"itAux\"),r.i32_add(r.getLocal(\"itIn\"),r.i32_const(d)),dt),...r.call(s+\"_square\",r.getLocal(\"itAux\"),r.getLocal(\"itAux\")),...r.call(s+\"_mul\",r.getLocal(\"itAux\"),r.getLocal(\"itIn\"),r.getLocal(\"itOut\")),...r.call(s+\"_mul\",r.getLocal(\"itAux\"),dt,r.i32_add(r.getLocal(\"itOut\"),r.i32_const(d)))]),r.setLocal(\"itIn\",r.i32_add(r.getLocal(\"itIn\"),r.i32_const(d*3))),r.setLocal(\"itOut\",r.i32_add(r.getLocal(\"itOut\"),r.i32_const(d*2))),r.setLocal(\"itAux\",r.i32_add(r.getLocal(\"itAux\"),r.i32_const(d))),r.setLocal(\"i\",r.i32_add(r.getLocal(\"i\"),r.i32_const(1))),r.br(0))),r.i32_store(r.i32_const(0),r.getLocal(\"pAux\")))}function Ct(){const U=o.addFunction(a+\"__reverseBytes\");U.addParam(\"pIn\",\"i32\"),U.addParam(\"n\",\"i32\"),U.addParam(\"pOut\",\"i32\"),U.addLocal(\"itOut\",\"i32\"),U.addLocal(\"itIn\",\"i32\");const r=U.getCodeBuilder();U.addCode(r.setLocal(\"itOut\",r.i32_sub(r.i32_add(r.getLocal(\"pOut\"),r.getLocal(\"n\")),r.i32_const(1))),r.setLocal(\"itIn\",r.getLocal(\"pIn\")),r.block(r.loop(r.br_if(1,r.i32_lt_s(r.getLocal(\"itOut\"),r.getLocal(\"pOut\"))),r.i32_store8(r.getLocal(\"itOut\"),r.i32_load8_u(r.getLocal(\"itIn\"))),r.setLocal(\"itOut\",r.i32_sub(r.getLocal(\"itOut\"),r.i32_const(1))),r.setLocal(\"itIn\",r.i32_add(r.getLocal(\"itIn\"),r.i32_const(1))),r.br(0))))}function St(){const U=o.addFunction(a+\"_LEMtoC\");U.addParam(\"pIn\",\"i32\"),U.addParam(\"pOut\",\"i32\");const r=U.getCodeBuilder(),dt=r.i32_const(o.alloc(d));U.addCode(r.if(r.call(a+\"_isZero\",r.getLocal(\"pIn\")),[...r.call(s+\"_zero\",r.getLocal(\"pOut\")),...r.i32_store8(r.getLocal(\"pOut\"),r.i32_const(64)),...r.ret([])]),r.call(s+\"_fromMontgomery\",r.getLocal(\"pIn\"),dt),r.call(a+\"__reverseBytes\",dt,r.i32_const(d),r.getLocal(\"pOut\")),r.if(r.i32_eq(r.call(s+\"_sign\",r.i32_add(r.getLocal(\"pIn\"),r.i32_const(d))),r.i32_const(-1)),r.i32_store8(r.getLocal(\"pOut\"),r.i32_or(r.i32_load8_u(r.getLocal(\"pOut\")),r.i32_const(128)))))}function Ot(){const U=o.addFunction(a+\"_LEMtoU\");U.addParam(\"pIn\",\"i32\"),U.addParam(\"pOut\",\"i32\");const r=U.getCodeBuilder(),dt=o.alloc(d*2),k=r.i32_const(dt),f=r.i32_const(dt),ct=r.i32_const(dt+d);U.addCode(r.if(r.call(a+\"_isZeroAffine\",r.getLocal(\"pIn\")),[...r.call(a+\"_zeroAffine\",r.getLocal(\"pOut\")),...r.i32_store8(r.getLocal(\"pOut\"),r.i32_const(64)),...r.ret([])]),r.call(a+\"_fromMontgomeryAffine\",r.getLocal(\"pIn\"),k),r.call(a+\"__reverseBytes\",f,r.i32_const(d),r.getLocal(\"pOut\")),r.call(a+\"__reverseBytes\",ct,r.i32_const(d),r.i32_add(r.getLocal(\"pOut\"),r.i32_const(d))))}function Dt(){const U=o.addFunction(a+\"_UtoLEM\");U.addParam(\"pIn\",\"i32\"),U.addParam(\"pOut\",\"i32\");const r=U.getCodeBuilder(),dt=o.alloc(d*2),k=r.i32_const(dt),f=r.i32_const(dt),ct=r.i32_const(dt+d);U.addCode(r.if(r.i32_and(r.i32_load8_u(r.getLocal(\"pIn\")),r.i32_const(64)),[...r.call(a+\"_zeroAffine\",r.getLocal(\"pOut\")),...r.ret([])]),r.call(a+\"__reverseBytes\",r.getLocal(\"pIn\"),r.i32_const(d),f),r.call(a+\"__reverseBytes\",r.i32_add(r.getLocal(\"pIn\"),r.i32_const(d)),r.i32_const(d),ct),r.call(a+\"_toMontgomeryAffine\",k,r.getLocal(\"pOut\")))}function x(){const U=o.addFunction(a+\"_CtoLEM\");U.addParam(\"pIn\",\"i32\"),U.addParam(\"pOut\",\"i32\"),U.addLocal(\"firstByte\",\"i32\"),U.addLocal(\"greatest\",\"i32\");const r=U.getCodeBuilder(),dt=o.alloc(d*2),k=r.i32_const(dt),f=r.i32_const(dt+d);U.addCode(r.setLocal(\"firstByte\",r.i32_load8_u(r.getLocal(\"pIn\"))),r.if(r.i32_and(r.getLocal(\"firstByte\"),r.i32_const(64)),[...r.call(a+\"_zeroAffine\",r.getLocal(\"pOut\")),...r.ret([])]),r.setLocal(\"greatest\",r.i32_and(r.getLocal(\"firstByte\"),r.i32_const(128))),r.call(s+\"_copy\",r.getLocal(\"pIn\"),f),r.i32_store8(f,r.i32_and(r.getLocal(\"firstByte\"),r.i32_const(63))),r.call(a+\"__reverseBytes\",f,r.i32_const(d),k),r.call(s+\"_toMontgomery\",k,r.getLocal(\"pOut\")),r.call(s+\"_square\",r.getLocal(\"pOut\"),f),r.call(s+\"_mul\",r.getLocal(\"pOut\"),f,f),r.call(s+\"_add\",f,r.i32_const(l),f),r.call(s+\"_sqrt\",f,f),r.call(s+\"_neg\",f,k),r.if(r.i32_eq(r.call(s+\"_sign\",f),r.i32_const(-1)),r.if(r.getLocal(\"greatest\"),r.call(s+\"_copy\",f,r.i32_add(r.getLocal(\"pOut\"),r.i32_const(d))),r.call(s+\"_neg\",f,r.i32_add(r.getLocal(\"pOut\"),r.i32_const(d)))),r.if(r.getLocal(\"greatest\"),r.call(s+\"_neg\",f,r.i32_add(r.getLocal(\"pOut\"),r.i32_const(d))),r.call(s+\"_copy\",f,r.i32_add(r.getLocal(\"pOut\"),r.i32_const(d))))))}function ht(){const U=o.addFunction(a+\"_inCurveAffine\");U.addParam(\"pIn\",\"i32\"),U.setReturnType(\"i32\");const r=U.getCodeBuilder(),dt=r.getLocal(\"pIn\"),k=r.i32_add(r.getLocal(\"pIn\"),r.i32_const(d)),f=r.i32_const(o.alloc(d)),ct=r.i32_const(o.alloc(d));U.addCode(r.call(s+\"_square\",k,f),r.call(s+\"_square\",dt,ct),r.call(s+\"_mul\",dt,ct,ct),r.call(s+\"_add\",ct,r.i32_const(l),ct),r.ret(r.call(s+\"_eq\",f,ct)))}function yt(){const U=o.addFunction(a+\"_inCurve\");U.addParam(\"pIn\",\"i32\"),U.setReturnType(\"i32\");const r=U.getCodeBuilder(),dt=r.i32_const(o.alloc(d*2));U.addCode(r.call(a+\"_toAffine\",r.getLocal(\"pIn\"),dt),r.ret(r.call(a+\"_inCurveAffine\",dt)))}return w(),u(),O(),m(),h(),C(),ft(),N(),P(),Q(),st(),G(),D(),L(),F(),$(),K(),E(),B(),S(),M(),_(),I(),y(),tt(),ht(),yt(),Bt(),_t(),Ct(),Ot(),St(),Dt(),x(),e(o,a+\"_batchLEMtoU\",a+\"_LEMtoU\",d*2,d*2),e(o,a+\"_batchLEMtoC\",a+\"_LEMtoC\",d*2,d),e(o,a+\"_batchUtoLEM\",a+\"_UtoLEM\",d*2,d*2),e(o,a+\"_batchCtoLEM\",a+\"_CtoLEM\",d,d*2,!0),e(o,a+\"_batchToJacobian\",a+\"_toJacobian\",d*2,d*3,!0),t(o,a,a+\"_multiexp\",a+\"_add\",d*3),t(o,a,a+\"_multiexpAffine\",a+\"_addMixed\",d*2),n(o,a+\"_timesScalar\",d*3,a+\"_add\",a+\"_double\",a+\"_sub\",a+\"_copy\",a+\"_zero\"),n(o,a+\"_timesScalarAffine\",d*2,a+\"_addMixed\",a+\"_double\",a+\"_subMixed\",a+\"_copyAffine\",a+\"_zero\"),o.exportFunction(a+\"_isZero\"),o.exportFunction(a+\"_isZeroAffine\"),o.exportFunction(a+\"_eq\"),o.exportFunction(a+\"_eqMixed\"),o.exportFunction(a+\"_eqAffine\"),o.exportFunction(a+\"_copy\"),o.exportFunction(a+\"_copyAffine\"),o.exportFunction(a+\"_zero\"),o.exportFunction(a+\"_zeroAffine\"),o.exportFunction(a+\"_double\"),o.exportFunction(a+\"_doubleAffine\"),o.exportFunction(a+\"_add\"),o.exportFunction(a+\"_addMixed\"),o.exportFunction(a+\"_addAffine\"),o.exportFunction(a+\"_neg\"),o.exportFunction(a+\"_negAffine\"),o.exportFunction(a+\"_sub\"),o.exportFunction(a+\"_subMixed\"),o.exportFunction(a+\"_subAffine\"),o.exportFunction(a+\"_fromMontgomery\"),o.exportFunction(a+\"_fromMontgomeryAffine\"),o.exportFunction(a+\"_toMontgomery\"),o.exportFunction(a+\"_toMontgomeryAffine\"),o.exportFunction(a+\"_timesScalar\"),o.exportFunction(a+\"_timesScalarAffine\"),o.exportFunction(a+\"_normalize\"),o.exportFunction(a+\"_LEMtoU\"),o.exportFunction(a+\"_LEMtoC\"),o.exportFunction(a+\"_UtoLEM\"),o.exportFunction(a+\"_CtoLEM\"),o.exportFunction(a+\"_batchLEMtoU\"),o.exportFunction(a+\"_batchLEMtoC\"),o.exportFunction(a+\"_batchUtoLEM\"),o.exportFunction(a+\"_batchCtoLEM\"),o.exportFunction(a+\"_toAffine\"),o.exportFunction(a+\"_toJacobian\"),o.exportFunction(a+\"_batchToAffine\"),o.exportFunction(a+\"_batchToJacobian\"),o.exportFunction(a+\"_inCurve\"),o.exportFunction(a+\"_inCurveAffine\"),a},ao}var co,Xa;function Hr(){if(Xa)return co;Xa=1;const{isOdd:n,modInv:e,modPow:t}=di(),i=li();return co=function(a,s,l,g,d){const w=a.modules[g].n64*8,h=a.modules[l].n64*8,m=a.modules[g].q;let O=m-1n,Q=0;for(;!n(O);)Q++,O=O>>1n;let P=2n;for(;t(P,m>>1n,m)===1n;)P=P+1n;const G=new Array(Q+1);G[Q]=t(P,O,m);let st=Q-1;for(;st>=0;)G[st]=t(G[st+1],2n,m),st--;const N=[],y=(1n<<BigInt(w*8))%m;for(let k=0;k<G.length;k++){const f=G[k]*y%m;N.push(...i.bigInt2BytesLE(f,w))}const I=a.alloc(N),_=new Array(Q+1);_[0]=1n;for(let k=1;k<=Q;k++)_[k]=_[k-1]*2n;const M=[];for(let k=0;k<=Q;k++){const f=e(_[k],m)*y%m;M.push(...i.bigInt2BytesLE(f,w))}const F=a.alloc(M),L=t(P,2n,m),D=[],K=[];for(let k=0;k<=Q;k++){const f=t(L,2n**BigInt(k),m),ct=e(m+1n-f,m);D.push(...i.bigInt2BytesLE(f*y%m,w)),K.push(...i.bigInt2BytesLE(ct*y%m,w))}const $=a.alloc(D),S=a.alloc(K);function B(k){let f=0;for(let ct=0;ct<8;ct++)k&1<<ct&&(f=f|128>>ct);return f}const E=Array(256);for(let k=0;k<256;k++)E[k]=B(k);const _t=a.alloc(E);function tt(){const k=a.addFunction(s+\"__log2\");k.addParam(\"n\",\"i32\"),k.setReturnType(\"i32\"),k.addLocal(\"bits\",\"i32\"),k.addLocal(\"aux\",\"i32\");const f=k.getCodeBuilder();k.addCode(f.setLocal(\"aux\",f.i32_shr_u(f.getLocal(\"n\"),f.i32_const(1)))),k.addCode(f.setLocal(\"bits\",f.i32_const(0))),k.addCode(f.block(f.loop(f.br_if(1,f.i32_eqz(f.getLocal(\"aux\"))),f.setLocal(\"aux\",f.i32_shr_u(f.getLocal(\"aux\"),f.i32_const(1))),f.setLocal(\"bits\",f.i32_add(f.getLocal(\"bits\"),f.i32_const(1))),f.br(0)))),k.addCode(f.if(f.i32_ne(f.getLocal(\"n\"),f.i32_shl(f.i32_const(1),f.getLocal(\"bits\"))),f.unreachable())),k.addCode(f.if(f.i32_gt_u(f.getLocal(\"bits\"),f.i32_const(Q)),f.unreachable())),k.addCode(f.getLocal(\"bits\"))}function ft(){const k=a.addFunction(s+\"_fft\");k.addParam(\"px\",\"i32\"),k.addParam(\"n\",\"i32\"),k.addLocal(\"bits\",\"i32\");const f=k.getCodeBuilder(),ct=f.i32_const(a.alloc(w));k.addCode(f.setLocal(\"bits\",f.call(s+\"__log2\",f.getLocal(\"n\"))),f.call(g+\"_one\",ct),f.call(s+\"_rawfft\",f.getLocal(\"px\"),f.getLocal(\"bits\"),f.i32_const(0),ct))}function Bt(){const k=a.addFunction(s+\"_ifft\");k.addParam(\"px\",\"i32\"),k.addParam(\"n\",\"i32\"),k.addLocal(\"bits\",\"i32\"),k.addLocal(\"pInv2\",\"i32\");const f=k.getCodeBuilder();k.addCode(f.setLocal(\"bits\",f.call(s+\"__log2\",f.getLocal(\"n\"))),f.setLocal(\"pInv2\",f.i32_add(f.i32_const(F),f.i32_mul(f.getLocal(\"bits\"),f.i32_const(w)))),f.call(s+\"_rawfft\",f.getLocal(\"px\"),f.getLocal(\"bits\"),f.i32_const(1),f.getLocal(\"pInv2\")))}function Ct(){const k=a.addFunction(s+\"_rawfft\");k.addParam(\"px\",\"i32\"),k.addParam(\"bits\",\"i32\"),k.addParam(\"reverse\",\"i32\"),k.addParam(\"mulFactor\",\"i32\"),k.addLocal(\"s\",\"i32\"),k.addLocal(\"k\",\"i32\"),k.addLocal(\"j\",\"i32\"),k.addLocal(\"m\",\"i32\"),k.addLocal(\"mdiv2\",\"i32\"),k.addLocal(\"n\",\"i32\"),k.addLocal(\"pwm\",\"i32\"),k.addLocal(\"idx1\",\"i32\"),k.addLocal(\"idx2\",\"i32\");const f=k.getCodeBuilder(),ct=f.i32_const(a.alloc(w)),It=f.i32_const(a.alloc(h)),bt=f.i32_const(a.alloc(h));k.addCode(f.call(s+\"__reversePermutation\",f.getLocal(\"px\"),f.getLocal(\"bits\")),f.setLocal(\"n\",f.i32_shl(f.i32_const(1),f.getLocal(\"bits\"))),f.setLocal(\"s\",f.i32_const(1)),f.block(f.loop(f.br_if(1,f.i32_gt_u(f.getLocal(\"s\"),f.getLocal(\"bits\"))),f.setLocal(\"m\",f.i32_shl(f.i32_const(1),f.getLocal(\"s\"))),f.setLocal(\"pwm\",f.i32_add(f.i32_const(I),f.i32_mul(f.getLocal(\"s\"),f.i32_const(w)))),f.setLocal(\"k\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_ge_u(f.getLocal(\"k\"),f.getLocal(\"n\"))),f.call(g+\"_one\",ct),f.setLocal(\"mdiv2\",f.i32_shr_u(f.getLocal(\"m\"),f.i32_const(1))),f.setLocal(\"j\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_ge_u(f.getLocal(\"j\"),f.getLocal(\"mdiv2\"))),f.setLocal(\"idx1\",f.i32_add(f.getLocal(\"px\"),f.i32_mul(f.i32_add(f.getLocal(\"k\"),f.getLocal(\"j\")),f.i32_const(h)))),f.setLocal(\"idx2\",f.i32_add(f.getLocal(\"idx1\"),f.i32_mul(f.getLocal(\"mdiv2\"),f.i32_const(h)))),f.call(d,f.getLocal(\"idx2\"),ct,It),f.call(l+\"_copy\",f.getLocal(\"idx1\"),bt),f.call(l+\"_add\",bt,It,f.getLocal(\"idx1\")),f.call(l+\"_sub\",bt,It,f.getLocal(\"idx2\")),f.call(g+\"_mul\",ct,f.getLocal(\"pwm\"),ct),f.setLocal(\"j\",f.i32_add(f.getLocal(\"j\"),f.i32_const(1))),f.br(0))),f.setLocal(\"k\",f.i32_add(f.getLocal(\"k\"),f.getLocal(\"m\"))),f.br(0))),f.setLocal(\"s\",f.i32_add(f.getLocal(\"s\"),f.i32_const(1))),f.br(0))),f.call(s+\"__fftFinal\",f.getLocal(\"px\"),f.getLocal(\"bits\"),f.getLocal(\"reverse\"),f.getLocal(\"mulFactor\")))}function St(){const k=a.addFunction(s+\"__fftFinal\");k.addParam(\"px\",\"i32\"),k.addParam(\"bits\",\"i32\"),k.addParam(\"reverse\",\"i32\"),k.addParam(\"mulFactor\",\"i32\"),k.addLocal(\"n\",\"i32\"),k.addLocal(\"ndiv2\",\"i32\"),k.addLocal(\"pInv2\",\"i32\"),k.addLocal(\"i\",\"i32\"),k.addLocal(\"mask\",\"i32\"),k.addLocal(\"idx1\",\"i32\"),k.addLocal(\"idx2\",\"i32\");const f=k.getCodeBuilder(),ct=f.i32_const(a.alloc(h));k.addCode(f.if(f.i32_and(f.i32_eqz(f.getLocal(\"reverse\")),f.call(g+\"_isOne\",f.getLocal(\"mulFactor\"))),f.ret([])),f.setLocal(\"n\",f.i32_shl(f.i32_const(1),f.getLocal(\"bits\"))),f.setLocal(\"mask\",f.i32_sub(f.getLocal(\"n\"),f.i32_const(1))),f.setLocal(\"i\",f.i32_const(1)),f.setLocal(\"ndiv2\",f.i32_shr_u(f.getLocal(\"n\"),f.i32_const(1))),f.block(f.loop(f.br_if(1,f.i32_ge_u(f.getLocal(\"i\"),f.getLocal(\"ndiv2\"))),f.setLocal(\"idx1\",f.i32_add(f.getLocal(\"px\"),f.i32_mul(f.getLocal(\"i\"),f.i32_const(h)))),f.setLocal(\"idx2\",f.i32_add(f.getLocal(\"px\"),f.i32_mul(f.i32_sub(f.getLocal(\"n\"),f.getLocal(\"i\")),f.i32_const(h)))),f.if(f.getLocal(\"reverse\"),f.if(f.call(g+\"_isOne\",f.getLocal(\"mulFactor\")),[...f.call(l+\"_copy\",f.getLocal(\"idx1\"),ct),...f.call(l+\"_copy\",f.getLocal(\"idx2\"),f.getLocal(\"idx1\")),...f.call(l+\"_copy\",ct,f.getLocal(\"idx2\"))],[...f.call(l+\"_copy\",f.getLocal(\"idx1\"),ct),...f.call(d,f.getLocal(\"idx2\"),f.getLocal(\"mulFactor\"),f.getLocal(\"idx1\")),...f.call(d,ct,f.getLocal(\"mulFactor\"),f.getLocal(\"idx2\"))]),f.if(f.call(g+\"_isOne\",f.getLocal(\"mulFactor\")),[],[...f.call(d,f.getLocal(\"idx1\"),f.getLocal(\"mulFactor\"),f.getLocal(\"idx1\")),...f.call(d,f.getLocal(\"idx2\"),f.getLocal(\"mulFactor\"),f.getLocal(\"idx2\"))])),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0))),f.if(f.call(g+\"_isOne\",f.getLocal(\"mulFactor\")),[],[...f.call(d,f.getLocal(\"px\"),f.getLocal(\"mulFactor\"),f.getLocal(\"px\")),...f.setLocal(\"idx2\",f.i32_add(f.getLocal(\"px\"),f.i32_mul(f.getLocal(\"ndiv2\"),f.i32_const(h)))),...f.call(d,f.getLocal(\"idx2\"),f.getLocal(\"mulFactor\"),f.getLocal(\"idx2\"))]))}function Ot(){const k=a.addFunction(s+\"__reversePermutation\");k.addParam(\"px\",\"i32\"),k.addParam(\"bits\",\"i32\"),k.addLocal(\"n\",\"i32\"),k.addLocal(\"i\",\"i32\"),k.addLocal(\"ri\",\"i32\"),k.addLocal(\"idx1\",\"i32\"),k.addLocal(\"idx2\",\"i32\");const f=k.getCodeBuilder(),ct=f.i32_const(a.alloc(h));k.addCode(f.setLocal(\"n\",f.i32_shl(f.i32_const(1),f.getLocal(\"bits\"))),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"n\"))),f.setLocal(\"idx1\",f.i32_add(f.getLocal(\"px\"),f.i32_mul(f.getLocal(\"i\"),f.i32_const(h)))),f.setLocal(\"ri\",f.call(s+\"__rev\",f.getLocal(\"i\"),f.getLocal(\"bits\"))),f.setLocal(\"idx2\",f.i32_add(f.getLocal(\"px\"),f.i32_mul(f.getLocal(\"ri\"),f.i32_const(h)))),f.if(f.i32_lt_u(f.getLocal(\"i\"),f.getLocal(\"ri\")),[...f.call(l+\"_copy\",f.getLocal(\"idx1\"),ct),...f.call(l+\"_copy\",f.getLocal(\"idx2\"),f.getLocal(\"idx1\")),...f.call(l+\"_copy\",ct,f.getLocal(\"idx2\"))]),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0))))}function Dt(){const k=a.addFunction(s+\"__rev\");k.addParam(\"x\",\"i32\"),k.addParam(\"bits\",\"i32\"),k.setReturnType(\"i32\");const f=k.getCodeBuilder();k.addCode(f.i32_rotl(f.i32_add(f.i32_add(f.i32_shl(f.i32_load8_u(f.i32_and(f.getLocal(\"x\"),f.i32_const(255)),_t,0),f.i32_const(24)),f.i32_shl(f.i32_load8_u(f.i32_and(f.i32_shr_u(f.getLocal(\"x\"),f.i32_const(8)),f.i32_const(255)),_t,0),f.i32_const(16))),f.i32_add(f.i32_shl(f.i32_load8_u(f.i32_and(f.i32_shr_u(f.getLocal(\"x\"),f.i32_const(16)),f.i32_const(255)),_t,0),f.i32_const(8)),f.i32_load8_u(f.i32_and(f.i32_shr_u(f.getLocal(\"x\"),f.i32_const(24)),f.i32_const(255)),_t,0))),f.getLocal(\"bits\")))}function x(){const k=a.addFunction(s+\"_fftJoin\");k.addParam(\"pBuff1\",\"i32\"),k.addParam(\"pBuff2\",\"i32\"),k.addParam(\"n\",\"i32\"),k.addParam(\"first\",\"i32\"),k.addParam(\"inc\",\"i32\"),k.addLocal(\"idx1\",\"i32\"),k.addLocal(\"idx2\",\"i32\"),k.addLocal(\"i\",\"i32\");const f=k.getCodeBuilder(),ct=f.i32_const(a.alloc(w)),It=f.i32_const(a.alloc(h)),bt=f.i32_const(a.alloc(h));k.addCode(f.call(g+\"_copy\",f.getLocal(\"first\"),ct),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"n\"))),f.setLocal(\"idx1\",f.i32_add(f.getLocal(\"pBuff1\"),f.i32_mul(f.getLocal(\"i\"),f.i32_const(h)))),f.setLocal(\"idx2\",f.i32_add(f.getLocal(\"pBuff2\"),f.i32_mul(f.getLocal(\"i\"),f.i32_const(h)))),f.call(d,f.getLocal(\"idx2\"),ct,It),f.call(l+\"_copy\",f.getLocal(\"idx1\"),bt),f.call(l+\"_add\",bt,It,f.getLocal(\"idx1\")),f.call(l+\"_sub\",bt,It,f.getLocal(\"idx2\")),f.call(g+\"_mul\",ct,f.getLocal(\"inc\"),ct),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0))))}function ht(){const k=a.addFunction(s+\"_fftJoinExt\");k.addParam(\"pBuff1\",\"i32\"),k.addParam(\"pBuff2\",\"i32\"),k.addParam(\"n\",\"i32\"),k.addParam(\"first\",\"i32\"),k.addParam(\"inc\",\"i32\"),k.addParam(\"totalBits\",\"i32\"),k.addLocal(\"idx1\",\"i32\"),k.addLocal(\"idx2\",\"i32\"),k.addLocal(\"i\",\"i32\"),k.addLocal(\"pShiftToM\",\"i32\");const f=k.getCodeBuilder(),ct=f.i32_const(a.alloc(w)),It=f.i32_const(a.alloc(h));k.addCode(f.setLocal(\"pShiftToM\",f.i32_add(f.i32_const($),f.i32_mul(f.getLocal(\"totalBits\"),f.i32_const(w)))),f.call(g+\"_copy\",f.getLocal(\"first\"),ct),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"n\"))),f.setLocal(\"idx1\",f.i32_add(f.getLocal(\"pBuff1\"),f.i32_mul(f.getLocal(\"i\"),f.i32_const(h)))),f.setLocal(\"idx2\",f.i32_add(f.getLocal(\"pBuff2\"),f.i32_mul(f.getLocal(\"i\"),f.i32_const(h)))),f.call(l+\"_add\",f.getLocal(\"idx1\"),f.getLocal(\"idx2\"),It),f.call(d,f.getLocal(\"idx2\"),f.getLocal(\"pShiftToM\"),f.getLocal(\"idx2\")),f.call(l+\"_add\",f.getLocal(\"idx1\"),f.getLocal(\"idx2\"),f.getLocal(\"idx2\")),f.call(d,f.getLocal(\"idx2\"),ct,f.getLocal(\"idx2\")),f.call(l+\"_copy\",It,f.getLocal(\"idx1\")),f.call(g+\"_mul\",ct,f.getLocal(\"inc\"),ct),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0))))}function yt(){const k=a.addFunction(s+\"_fftJoinExtInv\");k.addParam(\"pBuff1\",\"i32\"),k.addParam(\"pBuff2\",\"i32\"),k.addParam(\"n\",\"i32\"),k.addParam(\"first\",\"i32\"),k.addParam(\"inc\",\"i32\"),k.addParam(\"totalBits\",\"i32\"),k.addLocal(\"idx1\",\"i32\"),k.addLocal(\"idx2\",\"i32\"),k.addLocal(\"i\",\"i32\"),k.addLocal(\"pShiftToM\",\"i32\"),k.addLocal(\"pSConst\",\"i32\");const f=k.getCodeBuilder(),ct=f.i32_const(a.alloc(w)),It=f.i32_const(a.alloc(h));k.addCode(f.setLocal(\"pShiftToM\",f.i32_add(f.i32_const($),f.i32_mul(f.getLocal(\"totalBits\"),f.i32_const(w)))),f.setLocal(\"pSConst\",f.i32_add(f.i32_const(S),f.i32_mul(f.getLocal(\"totalBits\"),f.i32_const(w)))),f.call(g+\"_copy\",f.getLocal(\"first\"),ct),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"n\"))),f.setLocal(\"idx1\",f.i32_add(f.getLocal(\"pBuff1\"),f.i32_mul(f.getLocal(\"i\"),f.i32_const(h)))),f.setLocal(\"idx2\",f.i32_add(f.getLocal(\"pBuff2\"),f.i32_mul(f.getLocal(\"i\"),f.i32_const(h)))),f.call(d,f.getLocal(\"idx2\"),ct,It),f.call(l+\"_sub\",f.getLocal(\"idx1\"),It,f.getLocal(\"idx2\")),f.call(d,f.getLocal(\"idx2\"),f.getLocal(\"pSConst\"),f.getLocal(\"idx2\")),f.call(d,f.getLocal(\"idx1\"),f.getLocal(\"pShiftToM\"),f.getLocal(\"idx1\")),f.call(l+\"_sub\",It,f.getLocal(\"idx1\"),f.getLocal(\"idx1\")),f.call(d,f.getLocal(\"idx1\"),f.getLocal(\"pSConst\"),f.getLocal(\"idx1\")),f.call(g+\"_mul\",ct,f.getLocal(\"inc\"),ct),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0))))}function U(){const k=a.addFunction(s+\"_prepareLagrangeEvaluation\");k.addParam(\"pBuff1\",\"i32\"),k.addParam(\"pBuff2\",\"i32\"),k.addParam(\"n\",\"i32\"),k.addParam(\"first\",\"i32\"),k.addParam(\"inc\",\"i32\"),k.addParam(\"totalBits\",\"i32\"),k.addLocal(\"idx1\",\"i32\"),k.addLocal(\"idx2\",\"i32\"),k.addLocal(\"i\",\"i32\"),k.addLocal(\"pShiftToM\",\"i32\"),k.addLocal(\"pSConst\",\"i32\");const f=k.getCodeBuilder(),ct=f.i32_const(a.alloc(w)),It=f.i32_const(a.alloc(h));k.addCode(f.setLocal(\"pShiftToM\",f.i32_add(f.i32_const($),f.i32_mul(f.getLocal(\"totalBits\"),f.i32_const(w)))),f.setLocal(\"pSConst\",f.i32_add(f.i32_const(S),f.i32_mul(f.getLocal(\"totalBits\"),f.i32_const(w)))),f.call(g+\"_copy\",f.getLocal(\"first\"),ct),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"n\"))),f.setLocal(\"idx1\",f.i32_add(f.getLocal(\"pBuff1\"),f.i32_mul(f.getLocal(\"i\"),f.i32_const(h)))),f.setLocal(\"idx2\",f.i32_add(f.getLocal(\"pBuff2\"),f.i32_mul(f.getLocal(\"i\"),f.i32_const(h)))),f.call(d,f.getLocal(\"idx1\"),f.getLocal(\"pShiftToM\"),It),f.call(l+\"_sub\",f.getLocal(\"idx2\"),It,It),f.call(l+\"_sub\",f.getLocal(\"idx1\"),f.getLocal(\"idx2\"),f.getLocal(\"idx2\")),f.call(d,It,f.getLocal(\"pSConst\"),f.getLocal(\"idx1\")),f.call(d,f.getLocal(\"idx2\"),ct,f.getLocal(\"idx2\")),f.call(g+\"_mul\",ct,f.getLocal(\"inc\"),ct),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0))))}function r(){const k=a.addFunction(s+\"_fftMix\");k.addParam(\"pBuff\",\"i32\"),k.addParam(\"n\",\"i32\"),k.addParam(\"exp\",\"i32\"),k.addLocal(\"nGroups\",\"i32\"),k.addLocal(\"nPerGroup\",\"i32\"),k.addLocal(\"nPerGroupDiv2\",\"i32\"),k.addLocal(\"pairOffset\",\"i32\"),k.addLocal(\"idx1\",\"i32\"),k.addLocal(\"idx2\",\"i32\"),k.addLocal(\"i\",\"i32\"),k.addLocal(\"j\",\"i32\"),k.addLocal(\"pwm\",\"i32\");const f=k.getCodeBuilder(),ct=f.i32_const(a.alloc(w)),It=f.i32_const(a.alloc(h)),bt=f.i32_const(a.alloc(h));k.addCode(f.setLocal(\"nPerGroup\",f.i32_shl(f.i32_const(1),f.getLocal(\"exp\"))),f.setLocal(\"nPerGroupDiv2\",f.i32_shr_u(f.getLocal(\"nPerGroup\"),f.i32_const(1))),f.setLocal(\"nGroups\",f.i32_shr_u(f.getLocal(\"n\"),f.getLocal(\"exp\"))),f.setLocal(\"pairOffset\",f.i32_mul(f.getLocal(\"nPerGroupDiv2\"),f.i32_const(h))),f.setLocal(\"pwm\",f.i32_add(f.i32_const(I),f.i32_mul(f.getLocal(\"exp\"),f.i32_const(w)))),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"i\"),f.getLocal(\"nGroups\"))),f.call(g+\"_one\",ct),f.setLocal(\"j\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_eq(f.getLocal(\"j\"),f.getLocal(\"nPerGroupDiv2\"))),f.setLocal(\"idx1\",f.i32_add(f.getLocal(\"pBuff\"),f.i32_mul(f.i32_add(f.i32_mul(f.getLocal(\"i\"),f.getLocal(\"nPerGroup\")),f.getLocal(\"j\")),f.i32_const(h)))),f.setLocal(\"idx2\",f.i32_add(f.getLocal(\"idx1\"),f.getLocal(\"pairOffset\"))),f.call(d,f.getLocal(\"idx2\"),ct,It),f.call(l+\"_copy\",f.getLocal(\"idx1\"),bt),f.call(l+\"_add\",bt,It,f.getLocal(\"idx1\")),f.call(l+\"_sub\",bt,It,f.getLocal(\"idx2\")),f.call(g+\"_mul\",ct,f.getLocal(\"pwm\"),ct),f.setLocal(\"j\",f.i32_add(f.getLocal(\"j\"),f.i32_const(1))),f.br(0))),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0))))}function dt(){const k=a.addFunction(s+\"_fftFinal\");k.addParam(\"pBuff\",\"i32\"),k.addParam(\"n\",\"i32\"),k.addParam(\"factor\",\"i32\"),k.addLocal(\"idx1\",\"i32\"),k.addLocal(\"idx2\",\"i32\"),k.addLocal(\"i\",\"i32\"),k.addLocal(\"ndiv2\",\"i32\");const f=k.getCodeBuilder(),ct=f.i32_const(a.alloc(h));k.addCode(f.setLocal(\"ndiv2\",f.i32_shr_u(f.getLocal(\"n\"),f.i32_const(1))),f.if(f.i32_and(f.getLocal(\"n\"),f.i32_const(1)),f.call(d,f.i32_add(f.getLocal(\"pBuff\"),f.i32_mul(f.getLocal(\"ndiv2\"),f.i32_const(h))),f.getLocal(\"factor\"),f.i32_add(f.getLocal(\"pBuff\"),f.i32_mul(f.getLocal(\"ndiv2\"),f.i32_const(h))))),f.setLocal(\"i\",f.i32_const(0)),f.block(f.loop(f.br_if(1,f.i32_ge_u(f.getLocal(\"i\"),f.getLocal(\"ndiv2\"))),f.setLocal(\"idx1\",f.i32_add(f.getLocal(\"pBuff\"),f.i32_mul(f.getLocal(\"i\"),f.i32_const(h)))),f.setLocal(\"idx2\",f.i32_add(f.getLocal(\"pBuff\"),f.i32_mul(f.i32_sub(f.i32_sub(f.getLocal(\"n\"),f.i32_const(1)),f.getLocal(\"i\")),f.i32_const(h)))),f.call(d,f.getLocal(\"idx2\"),f.getLocal(\"factor\"),ct),f.call(d,f.getLocal(\"idx1\"),f.getLocal(\"factor\"),f.getLocal(\"idx2\")),f.call(l+\"_copy\",ct,f.getLocal(\"idx1\")),f.setLocal(\"i\",f.i32_add(f.getLocal(\"i\"),f.i32_const(1))),f.br(0))))}Dt(),Ot(),St(),Ct(),tt(),ft(),Bt(),x(),ht(),yt(),r(),dt(),U(),a.exportFunction(s+\"_fft\"),a.exportFunction(s+\"_ifft\"),a.exportFunction(s+\"_rawfft\"),a.exportFunction(s+\"_fftJoin\"),a.exportFunction(s+\"_fftJoinExt\"),a.exportFunction(s+\"_fftJoinExtInv\"),a.exportFunction(s+\"_fftMix\"),a.exportFunction(s+\"_fftFinal\"),a.exportFunction(s+\"_prepareLagrangeEvaluation\")},co}var ro,Ja;function Zr(){return Ja||(Ja=1,ro=function(e,t,i){const a=e.modules[i].n64*8;function s(){const g=e.addFunction(t+\"_zero\");g.addParam(\"px\",\"i32\"),g.addParam(\"n\",\"i32\"),g.addLocal(\"lastp\",\"i32\"),g.addLocal(\"p\",\"i32\");const d=g.getCodeBuilder();g.addCode(d.setLocal(\"p\",d.getLocal(\"px\")),d.setLocal(\"lastp\",d.i32_add(d.getLocal(\"px\"),d.i32_mul(d.getLocal(\"n\"),d.i32_const(a)))),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal(\"p\"),d.getLocal(\"lastp\"))),d.call(i+\"_zero\",d.getLocal(\"p\")),d.setLocal(\"p\",d.i32_add(d.getLocal(\"p\"),d.i32_const(a))),d.br(0))))}function l(){const g=e.addFunction(t+\"_constructLC\");g.addParam(\"ppolynomials\",\"i32\"),g.addParam(\"psignals\",\"i32\"),g.addParam(\"nSignals\",\"i32\"),g.addParam(\"pres\",\"i32\"),g.addLocal(\"i\",\"i32\"),g.addLocal(\"j\",\"i32\"),g.addLocal(\"pp\",\"i32\"),g.addLocal(\"ps\",\"i32\"),g.addLocal(\"pd\",\"i32\"),g.addLocal(\"ncoefs\",\"i32\");const d=g.getCodeBuilder(),u=d.i32_const(e.alloc(a));g.addCode(d.setLocal(\"i\",d.i32_const(0)),d.setLocal(\"pp\",d.getLocal(\"ppolynomials\")),d.setLocal(\"ps\",d.getLocal(\"psignals\")),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal(\"i\"),d.getLocal(\"nSignals\"))),d.setLocal(\"ncoefs\",d.i32_load(d.getLocal(\"pp\"))),d.setLocal(\"pp\",d.i32_add(d.getLocal(\"pp\"),d.i32_const(4))),d.setLocal(\"j\",d.i32_const(0)),d.block(d.loop(d.br_if(1,d.i32_eq(d.getLocal(\"j\"),d.getLocal(\"ncoefs\"))),d.setLocal(\"pd\",d.i32_add(d.getLocal(\"pres\"),d.i32_mul(d.i32_load(d.getLocal(\"pp\")),d.i32_const(a)))),d.setLocal(\"pp\",d.i32_add(d.getLocal(\"pp\"),d.i32_const(4))),d.call(i+\"_mul\",d.getLocal(\"ps\"),d.getLocal(\"pp\"),u),d.call(i+\"_add\",u,d.getLocal(\"pd\"),d.getLocal(\"pd\")),d.setLocal(\"pp\",d.i32_add(d.getLocal(\"pp\"),d.i32_const(a))),d.setLocal(\"j\",d.i32_add(d.getLocal(\"j\"),d.i32_const(1))),d.br(0))),d.setLocal(\"ps\",d.i32_add(d.getLocal(\"ps\"),d.i32_const(a))),d.setLocal(\"i\",d.i32_add(d.getLocal(\"i\"),d.i32_const(1))),d.br(0))))}return s(),l(),e.exportFunction(t+\"_zero\"),e.exportFunction(t+\"_constructLC\"),t}),ro}var so,tc;function jr(){return tc||(tc=1,so=function(e,t,i){const a=e.modules[i].n64*8;function s(){const d=e.addFunction(t+\"_buildABC\");d.addParam(\"pCoefs\",\"i32\"),d.addParam(\"nCoefs\",\"i32\"),d.addParam(\"pWitness\",\"i32\"),d.addParam(\"pA\",\"i32\"),d.addParam(\"pB\",\"i32\"),d.addParam(\"pC\",\"i32\"),d.addParam(\"offsetOut\",\"i32\"),d.addParam(\"nOut\",\"i32\"),d.addParam(\"offsetWitness\",\"i32\"),d.addParam(\"nWitness\",\"i32\"),d.addLocal(\"it\",\"i32\"),d.addLocal(\"ita\",\"i32\"),d.addLocal(\"itb\",\"i32\"),d.addLocal(\"last\",\"i32\"),d.addLocal(\"m\",\"i32\"),d.addLocal(\"c\",\"i32\"),d.addLocal(\"s\",\"i32\"),d.addLocal(\"pOut\",\"i32\");const u=d.getCodeBuilder(),w=u.i32_const(e.alloc(a));d.addCode(u.setLocal(\"ita\",u.getLocal(\"pA\")),u.setLocal(\"itb\",u.getLocal(\"pB\")),u.setLocal(\"last\",u.i32_add(u.getLocal(\"pA\"),u.i32_mul(u.getLocal(\"nOut\"),u.i32_const(a)))),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal(\"ita\"),u.getLocal(\"last\"))),u.call(i+\"_zero\",u.getLocal(\"ita\")),u.call(i+\"_zero\",u.getLocal(\"itb\")),u.setLocal(\"ita\",u.i32_add(u.getLocal(\"ita\"),u.i32_const(a))),u.setLocal(\"itb\",u.i32_add(u.getLocal(\"itb\"),u.i32_const(a))),u.br(0))),u.setLocal(\"it\",u.getLocal(\"pCoefs\")),u.setLocal(\"last\",u.i32_add(u.getLocal(\"pCoefs\"),u.i32_mul(u.getLocal(\"nCoefs\"),u.i32_const(a+12)))),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal(\"it\"),u.getLocal(\"last\"))),u.setLocal(\"s\",u.i32_load(u.getLocal(\"it\"),8)),u.if(u.i32_or(u.i32_lt_u(u.getLocal(\"s\"),u.getLocal(\"offsetWitness\")),u.i32_ge_u(u.getLocal(\"s\"),u.i32_add(u.getLocal(\"offsetWitness\"),u.getLocal(\"nWitness\")))),[...u.setLocal(\"it\",u.i32_add(u.getLocal(\"it\"),u.i32_const(a+12))),...u.br(1)]),u.setLocal(\"m\",u.i32_load(u.getLocal(\"it\"))),u.if(u.i32_eq(u.getLocal(\"m\"),u.i32_const(0)),u.setLocal(\"pOut\",u.getLocal(\"pA\")),u.if(u.i32_eq(u.getLocal(\"m\"),u.i32_const(1)),u.setLocal(\"pOut\",u.getLocal(\"pB\")),[...u.setLocal(\"it\",u.i32_add(u.getLocal(\"it\"),u.i32_const(a+12))),...u.br(1)])),u.setLocal(\"c\",u.i32_load(u.getLocal(\"it\"),4)),u.if(u.i32_or(u.i32_lt_u(u.getLocal(\"c\"),u.getLocal(\"offsetOut\")),u.i32_ge_u(u.getLocal(\"c\"),u.i32_add(u.getLocal(\"offsetOut\"),u.getLocal(\"nOut\")))),[...u.setLocal(\"it\",u.i32_add(u.getLocal(\"it\"),u.i32_const(a+12))),...u.br(1)]),u.setLocal(\"pOut\",u.i32_add(u.getLocal(\"pOut\"),u.i32_mul(u.i32_sub(u.getLocal(\"c\"),u.getLocal(\"offsetOut\")),u.i32_const(a)))),u.call(i+\"_mul\",u.i32_add(u.getLocal(\"pWitness\"),u.i32_mul(u.i32_sub(u.getLocal(\"s\"),u.getLocal(\"offsetWitness\")),u.i32_const(a))),u.i32_add(u.getLocal(\"it\"),u.i32_const(12)),w),u.call(i+\"_add\",u.getLocal(\"pOut\"),w,u.getLocal(\"pOut\")),u.setLocal(\"it\",u.i32_add(u.getLocal(\"it\"),u.i32_const(a+12))),u.br(0))),u.setLocal(\"ita\",u.getLocal(\"pA\")),u.setLocal(\"itb\",u.getLocal(\"pB\")),u.setLocal(\"it\",u.getLocal(\"pC\")),u.setLocal(\"last\",u.i32_add(u.getLocal(\"pA\"),u.i32_mul(u.getLocal(\"nOut\"),u.i32_const(a)))),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal(\"ita\"),u.getLocal(\"last\"))),u.call(i+\"_mul\",u.getLocal(\"ita\"),u.getLocal(\"itb\"),u.getLocal(\"it\")),u.setLocal(\"ita\",u.i32_add(u.getLocal(\"ita\"),u.i32_const(a))),u.setLocal(\"itb\",u.i32_add(u.getLocal(\"itb\"),u.i32_const(a))),u.setLocal(\"it\",u.i32_add(u.getLocal(\"it\"),u.i32_const(a))),u.br(0))))}function l(){const d=e.addFunction(t+\"_joinABC\");d.addParam(\"pA\",\"i32\"),d.addParam(\"pB\",\"i32\"),d.addParam(\"pC\",\"i32\"),d.addParam(\"n\",\"i32\"),d.addParam(\"pP\",\"i32\"),d.addLocal(\"ita\",\"i32\"),d.addLocal(\"itb\",\"i32\"),d.addLocal(\"itc\",\"i32\"),d.addLocal(\"itp\",\"i32\"),d.addLocal(\"last\",\"i32\");const u=d.getCodeBuilder(),w=u.i32_const(e.alloc(a));d.addCode(u.setLocal(\"ita\",u.getLocal(\"pA\")),u.setLocal(\"itb\",u.getLocal(\"pB\")),u.setLocal(\"itc\",u.getLocal(\"pC\")),u.setLocal(\"itp\",u.getLocal(\"pP\")),u.setLocal(\"last\",u.i32_add(u.getLocal(\"pA\"),u.i32_mul(u.getLocal(\"n\"),u.i32_const(a)))),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal(\"ita\"),u.getLocal(\"last\"))),u.call(i+\"_mul\",u.getLocal(\"ita\"),u.getLocal(\"itb\"),w),u.call(i+\"_sub\",w,u.getLocal(\"itc\"),u.getLocal(\"itp\")),u.setLocal(\"ita\",u.i32_add(u.getLocal(\"ita\"),u.i32_const(a))),u.setLocal(\"itb\",u.i32_add(u.getLocal(\"itb\"),u.i32_const(a))),u.setLocal(\"itc\",u.i32_add(u.getLocal(\"itc\"),u.i32_const(a))),u.setLocal(\"itp\",u.i32_add(u.getLocal(\"itp\"),u.i32_const(a))),u.br(0))))}function g(){const d=e.addFunction(t+\"_batchAdd\");d.addParam(\"pa\",\"i32\"),d.addParam(\"pb\",\"i32\"),d.addParam(\"n\",\"i32\"),d.addParam(\"pr\",\"i32\"),d.addLocal(\"ita\",\"i32\"),d.addLocal(\"itb\",\"i32\"),d.addLocal(\"itr\",\"i32\"),d.addLocal(\"last\",\"i32\");const u=d.getCodeBuilder();d.addCode(u.setLocal(\"ita\",u.getLocal(\"pa\")),u.setLocal(\"itb\",u.getLocal(\"pb\")),u.setLocal(\"itr\",u.getLocal(\"pr\")),u.setLocal(\"last\",u.i32_add(u.getLocal(\"pa\"),u.i32_mul(u.getLocal(\"n\"),u.i32_const(a)))),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal(\"ita\"),u.getLocal(\"last\"))),u.call(i+\"_add\",u.getLocal(\"ita\"),u.getLocal(\"itb\"),u.getLocal(\"itr\")),u.setLocal(\"ita\",u.i32_add(u.getLocal(\"ita\"),u.i32_const(a))),u.setLocal(\"itb\",u.i32_add(u.getLocal(\"itb\"),u.i32_const(a))),u.setLocal(\"itr\",u.i32_add(u.getLocal(\"itr\"),u.i32_const(a))),u.br(0))))}return s(),l(),g(),e.exportFunction(t+\"_buildABC\"),e.exportFunction(t+\"_joinABC\"),e.exportFunction(t+\"_batchAdd\"),t}),so}var lo,ec;function Vr(){return ec||(ec=1,lo=function(e,t,i,o,a,s,l,g){const d=e.addFunction(t);d.addParam(\"pIn\",\"i32\"),d.addParam(\"n\",\"i32\"),d.addParam(\"pFirst\",\"i32\"),d.addParam(\"pInc\",\"i32\"),d.addParam(\"pOut\",\"i32\"),d.addLocal(\"pOldFree\",\"i32\"),d.addLocal(\"i\",\"i32\"),d.addLocal(\"pFrom\",\"i32\"),d.addLocal(\"pTo\",\"i32\");const u=d.getCodeBuilder(),w=u.i32_const(e.alloc(l));d.addCode(u.setLocal(\"pFrom\",u.getLocal(\"pIn\")),u.setLocal(\"pTo\",u.getLocal(\"pOut\"))),d.addCode(u.call(o+\"_copy\",u.getLocal(\"pFirst\"),w)),d.addCode(u.setLocal(\"i\",u.i32_const(0)),u.block(u.loop(u.br_if(1,u.i32_eq(u.getLocal(\"i\"),u.getLocal(\"n\"))),u.call(g,u.getLocal(\"pFrom\"),w,u.getLocal(\"pTo\")),u.setLocal(\"pFrom\",u.i32_add(u.getLocal(\"pFrom\"),u.i32_const(a))),u.setLocal(\"pTo\",u.i32_add(u.getLocal(\"pTo\"),u.i32_const(s))),u.call(o+\"_mul\",w,u.getLocal(\"pInc\"),w),u.setLocal(\"i\",u.i32_add(u.getLocal(\"i\"),u.i32_const(1))),u.br(0)))),e.exportFunction(t)}),lo}var uo,nc;function Ed(){if(nc)return uo;nc=1;const n=li(),e=Di(),t=Qr(),i=Nr(),o=Gr(),a=Kr(),s=Hr(),l=Zr(),g=jr(),d=Vr(),{bitLength:u,modInv:w,isOdd:C,isNegative:h}=di();return uo=function(O,Q){const P=Q||\"bn128\";if(O.modules[P])return P;const G=21888242871839275222246405745257275088696311157297823662689037894645226208583n,st=21888242871839275222246405745257275088548364400416034343698204186575808495617n,N=Math.floor((u(G-1n)-1)/64)+1,y=N*8,I=y,_=y,M=_*2,F=_*12,L=O.alloc(n.bigInt2BytesLE(st,I)),D=e(O,G,\"f1m\");t(O,st,\"fr\",\"frm\");const K=O.alloc(n.bigInt2BytesLE(tt(3n),_)),$=a(O,\"g1m\",\"f1m\",K);s(O,\"frm\",\"frm\",\"frm\",\"frm_mul\"),l(O,\"pol\",\"frm\"),g(O,\"qap\",\"frm\");const S=i(O,\"f1m_neg\",\"f2m\",\"f1m\"),B=O.alloc([...n.bigInt2BytesLE(tt(19485874751759354771024239261021720505790618469301721065564631296452457478373n),_),...n.bigInt2BytesLE(tt(266929791119991161246907387137283842545076965332900288569378510910307636690n),_)]),E=a(O,\"g2m\",\"f2m\",B);function _t(q,c){const X=O.addFunction(q);X.addParam(\"pG\",\"i32\"),X.addParam(\"pFr\",\"i32\"),X.addParam(\"pr\",\"i32\");const ut=X.getCodeBuilder(),ot=ut.i32_const(O.alloc(y));X.addCode(ut.call(\"frm_fromMontgomery\",ut.getLocal(\"pFr\"),ot),ut.call(c,ut.getLocal(\"pG\"),ot,ut.i32_const(y),ut.getLocal(\"pr\"))),O.exportFunction(q)}_t(\"g1m_timesFr\",\"g1m_timesScalar\"),s(O,\"g1m\",\"g1m\",\"frm\",\"g1m_timesFr\"),_t(\"g2m_timesFr\",\"g2m_timesScalar\"),s(O,\"g2m\",\"g2m\",\"frm\",\"g2m_timesFr\"),_t(\"g1m_timesFrAffine\",\"g1m_timesScalarAffine\"),_t(\"g2m_timesFrAffine\",\"g2m_timesScalarAffine\"),d(O,\"frm_batchApplyKey\",\"fmr\",\"frm\",y,y,y,\"frm_mul\"),d(O,\"g1m_batchApplyKey\",\"g1m\",\"frm\",y*3,y*3,y,\"g1m_timesFr\"),d(O,\"g1m_batchApplyKeyMixed\",\"g1m\",\"frm\",y*2,y*3,y,\"g1m_timesFrAffine\"),d(O,\"g2m_batchApplyKey\",\"g2m\",\"frm\",y*2*3,y*3*2,y,\"g2m_timesFr\"),d(O,\"g2m_batchApplyKeyMixed\",\"g2m\",\"frm\",y*2*2,y*3*2,y,\"g2m_timesFrAffine\");function tt(q){return BigInt(q)*(1n<<BigInt(_*8))%G}const ft=[1n,2n,1n],Bt=O.alloc([...n.bigInt2BytesLE(tt(ft[0]),_),...n.bigInt2BytesLE(tt(ft[1]),_),...n.bigInt2BytesLE(tt(ft[2]),_)]),Ct=[0n,1n,0n],St=O.alloc([...n.bigInt2BytesLE(tt(Ct[0]),_),...n.bigInt2BytesLE(tt(Ct[1]),_),...n.bigInt2BytesLE(tt(Ct[2]),_)]),Ot=[[10857046999023057135944570762232829481370756359578518086990519993285655852781n,11559732032986387107991004021392285783925812861821192530917403151452391805634n],[8495653923123431417604973247489272438418190587263600148770280649306958101930n,4082367875863433681332203403145435568316851327593401208105741076214120093531n],[1n,0n]],Dt=O.alloc([...n.bigInt2BytesLE(tt(Ot[0][0]),_),...n.bigInt2BytesLE(tt(Ot[0][1]),_),...n.bigInt2BytesLE(tt(Ot[1][0]),_),...n.bigInt2BytesLE(tt(Ot[1][1]),_),...n.bigInt2BytesLE(tt(Ot[2][0]),_),...n.bigInt2BytesLE(tt(Ot[2][1]),_)]),x=[[0n,0n],[1n,0n],[0n,0n]],ht=O.alloc([...n.bigInt2BytesLE(tt(x[0][0]),_),...n.bigInt2BytesLE(tt(x[0][1]),_),...n.bigInt2BytesLE(tt(x[1][0]),_),...n.bigInt2BytesLE(tt(x[1][1]),_),...n.bigInt2BytesLE(tt(x[2][0]),_),...n.bigInt2BytesLE(tt(x[2][1]),_)]),yt=O.alloc([...n.bigInt2BytesLE(tt(1),_),...n.bigInt2BytesLE(tt(0),_),...n.bigInt2BytesLE(tt(0),_),...n.bigInt2BytesLE(tt(0),_),...n.bigInt2BytesLE(tt(0),_),...n.bigInt2BytesLE(tt(0),_),...n.bigInt2BytesLE(tt(0),_),...n.bigInt2BytesLE(tt(0),_),...n.bigInt2BytesLE(tt(0),_),...n.bigInt2BytesLE(tt(0),_),...n.bigInt2BytesLE(tt(0),_),...n.bigInt2BytesLE(tt(0),_)]),U=O.alloc([...n.bigInt2BytesLE(tt(9),_),...n.bigInt2BytesLE(tt(1),_)]),r=O.alloc([...n.bigInt2BytesLE(tt(w(2n,G)),_),...n.bigInt2BytesLE(0n,_)]),dt=U,k=O.alloc([...n.bigInt2BytesLE(tt(19485874751759354771024239261021720505790618469301721065564631296452457478373n),_),...n.bigInt2BytesLE(tt(266929791119991161246907387137283842545076965332900288569378510910307636690n),_)]);function f(){const q=O.addFunction(P+\"_mulNR6\");q.addParam(\"x\",\"i32\"),q.addParam(\"pr\",\"i32\");const c=q.getCodeBuilder();q.addCode(c.call(S+\"_mul\",c.i32_const(U),c.getLocal(\"x\"),c.getLocal(\"pr\")))}f();const ct=o(O,P+\"_mulNR6\",\"f6m\",\"f2m\");function It(){const q=O.addFunction(P+\"_mulNR12\");q.addParam(\"x\",\"i32\"),q.addParam(\"pr\",\"i32\");const c=q.getCodeBuilder();q.addCode(c.call(S+\"_mul\",c.i32_const(U),c.i32_add(c.getLocal(\"x\"),c.i32_const(y*4)),c.getLocal(\"pr\")),c.call(S+\"_copy\",c.getLocal(\"x\"),c.i32_add(c.getLocal(\"pr\"),c.i32_const(y*2))),c.call(S+\"_copy\",c.i32_add(c.getLocal(\"x\"),c.i32_const(y*2)),c.i32_add(c.getLocal(\"pr\"),c.i32_const(y*4))))}It();const bt=i(O,P+\"_mulNR12\",\"ftm\",ct),Z=v(29793968203157093288n),V=O.alloc(Z),gt=3*M,Ft=Z.length-1,W=Z.reduce((q,c)=>q+(c!=0?1:0),0)+Ft+1,b=3*2*y,xt=3*y*2+W*gt;O.modules[P]={n64:N,pG1gen:Bt,pG1zero:St,pG1b:K,pG2gen:Dt,pG2zero:ht,pG2b:B,pq:O.modules.f1m.pq,pr:L,pOneT:yt,prePSize:b,preQSize:xt,r:st.toString(),q:G.toString()};const Vt=4965661367192848881n;function $t(q){let c=q;const X=[];for(;c>0n;){if(C(c)){const ut=2-Number(c%4n);X.push(ut),c=c-BigInt(ut)}else X.push(0);c=c>>1n}return X}function v(q){let c=q;const X=[];for(;c>0n;)C(c)?X.push(1):X.push(0),c=c>>1n;return X}function p(){const q=O.addFunction(P+\"_prepareG1\");q.addParam(\"pP\",\"i32\"),q.addParam(\"ppreP\",\"i32\");const c=q.getCodeBuilder();q.addCode(c.call($+\"_normalize\",c.getLocal(\"pP\"),c.getLocal(\"ppreP\")))}function A(){const q=O.addFunction(P+\"_prepAddStep\");q.addParam(\"pQ\",\"i32\"),q.addParam(\"pR\",\"i32\"),q.addParam(\"pCoef\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"pQ\"),ut=c.i32_add(c.getLocal(\"pQ\"),c.i32_const(M)),ot=c.getLocal(\"pR\"),rt=c.i32_add(c.getLocal(\"pR\"),c.i32_const(M)),at=c.i32_add(c.getLocal(\"pR\"),c.i32_const(2*M)),Lt=c.getLocal(\"pCoef\"),pt=c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(M)),Et=c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(2*M)),At=pt,mt=c.i32_const(O.alloc(M)),Rt=c.i32_const(O.alloc(M)),Nt=c.i32_const(O.alloc(M)),kt=c.i32_const(O.alloc(M)),zt=c.i32_const(O.alloc(M)),Gt=c.i32_const(O.alloc(M)),Yt=c.i32_const(O.alloc(M));q.addCode(c.call(S+\"_mul\",X,at,At),c.call(S+\"_sub\",ot,At,At),c.call(S+\"_mul\",ut,at,mt),c.call(S+\"_sub\",rt,mt,mt),c.call(S+\"_square\",At,Rt),c.call(S+\"_square\",mt,Nt),c.call(S+\"_mul\",At,Rt,kt),c.call(S+\"_mul\",ot,Rt,zt),c.call(S+\"_add\",zt,zt,Yt),c.call(S+\"_mul\",at,Nt,Gt),c.call(S+\"_add\",kt,Gt,Gt),c.call(S+\"_sub\",Gt,Yt,Gt),c.call(S+\"_mul\",At,Gt,ot),c.call(S+\"_mul\",kt,rt,rt),c.call(S+\"_sub\",zt,Gt,Yt),c.call(S+\"_mul\",mt,Yt,Yt),c.call(S+\"_sub\",Yt,rt,rt),c.call(S+\"_mul\",at,kt,at),c.call(S+\"_mul\",At,ut,Yt),c.call(S+\"_mul\",mt,X,Lt),c.call(S+\"_sub\",Lt,Yt,Lt),c.call(S+\"_mul\",Lt,c.i32_const(dt),Lt),c.call(S+\"_neg\",mt,Et))}function R(){const q=O.addFunction(P+\"_prepDblStep\");q.addParam(\"pR\",\"i32\"),q.addParam(\"pCoef\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"pR\"),ut=c.i32_add(c.getLocal(\"pR\"),c.i32_const(M)),ot=c.i32_add(c.getLocal(\"pR\"),c.i32_const(2*M)),rt=c.getLocal(\"pCoef\"),at=c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(M)),Lt=c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(2*M)),pt=c.i32_const(O.alloc(M)),Et=c.i32_const(O.alloc(M)),At=c.i32_const(O.alloc(M)),mt=c.i32_const(O.alloc(M)),Rt=c.i32_const(O.alloc(M)),Nt=c.i32_const(O.alloc(M)),kt=c.i32_const(O.alloc(M)),zt=c.i32_const(O.alloc(M)),Gt=c.i32_const(O.alloc(M)),Yt=c.i32_const(O.alloc(M)),Zt=c.i32_const(O.alloc(M)),Jt=c.i32_const(O.alloc(M));q.addCode(c.call(S+\"_mul\",ut,c.i32_const(r),pt),c.call(S+\"_mul\",X,pt,pt),c.call(S+\"_square\",ut,Et),c.call(S+\"_square\",ot,At),c.call(S+\"_add\",At,At,mt),c.call(S+\"_add\",mt,At,mt),c.call(S+\"_mul\",c.i32_const(k),mt,Rt),c.call(S+\"_add\",Rt,Rt,Nt),c.call(S+\"_add\",Rt,Nt,Nt),c.call(S+\"_add\",Et,Nt,kt),c.call(S+\"_mul\",kt,c.i32_const(r),kt),c.call(S+\"_add\",Et,At,Jt),c.call(S+\"_add\",ut,ot,zt),c.call(S+\"_square\",zt,zt),c.call(S+\"_sub\",zt,Jt,zt),c.call(S+\"_sub\",Rt,Et,Gt),c.call(S+\"_square\",X,Yt),c.call(S+\"_square\",Rt,Zt),c.call(S+\"_sub\",Et,Nt,Jt),c.call(S+\"_mul\",pt,Jt,X),c.call(S+\"_add\",Zt,Zt,Jt),c.call(S+\"_add\",Zt,Jt,Jt),c.call(S+\"_square\",kt,ut),c.call(S+\"_sub\",ut,Jt,ut),c.call(S+\"_mul\",Et,zt,ot),c.call(S+\"_mul\",c.i32_const(dt),Gt,rt),c.call(S+\"_neg\",zt,at),c.call(S+\"_add\",Yt,Yt,Lt),c.call(S+\"_add\",Yt,Lt,Lt))}function j(){const q=O.addFunction(P+\"_mulByQ\");q.addParam(\"p1\",\"i32\"),q.addParam(\"pr\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"p1\"),ut=c.i32_add(c.getLocal(\"p1\"),c.i32_const(M)),ot=c.i32_add(c.getLocal(\"p1\"),c.i32_const(M*2)),rt=c.getLocal(\"pr\"),at=c.i32_add(c.getLocal(\"pr\"),c.i32_const(M)),Lt=c.i32_add(c.getLocal(\"pr\"),c.i32_const(M*2)),pt=c.i32_const(O.alloc([...n.bigInt2BytesLE(tt(\"21575463638280843010398324269430826099269044274347216827212613867836435027261\"),_),...n.bigInt2BytesLE(tt(\"10307601595873709700152284273816112264069230130616436755625194854815875713954\"),_)])),Et=c.i32_const(O.alloc([...n.bigInt2BytesLE(tt(\"2821565182194536844548159561693502659359617185244120367078079554186484126554\"),_),...n.bigInt2BytesLE(tt(\"3505843767911556378687030309984248845540243509899259641013678093033130930403\"),_)]));q.addCode(c.call(S+\"_conjugate\",X,rt),c.call(S+\"_mul\",pt,rt,rt),c.call(S+\"_conjugate\",ut,at),c.call(S+\"_mul\",Et,at,at),c.call(S+\"_conjugate\",ot,Lt))}function J(){j();const q=O.addFunction(P+\"_prepareG2\");q.addParam(\"pQ\",\"i32\"),q.addParam(\"ppreQ\",\"i32\"),q.addLocal(\"pCoef\",\"i32\"),q.addLocal(\"i\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"pQ\"),ut=O.alloc(M*3),ot=c.i32_const(ut),rt=c.i32_const(ut),at=c.i32_const(ut+M),Lt=c.i32_const(ut+2*M),pt=c.i32_add(c.getLocal(\"ppreQ\"),c.i32_const(0)),Et=c.i32_add(c.getLocal(\"ppreQ\"),c.i32_const(M)),At=O.alloc(M*3),mt=c.i32_const(At),Rt=O.alloc(M*3),Nt=c.i32_const(Rt),kt=c.i32_const(Rt+M);q.addCode(c.call(E+\"_normalize\",X,pt),c.call(S+\"_copy\",pt,rt),c.call(S+\"_copy\",Et,at),c.call(S+\"_one\",Lt)),q.addCode(c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"ppreQ\"),c.i32_const(M*3))),c.setLocal(\"i\",c.i32_const(Z.length-2)),c.block(c.loop(c.call(P+\"_prepDblStep\",ot,c.getLocal(\"pCoef\")),c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(gt))),c.if(c.i32_load8_s(c.getLocal(\"i\"),V),[...c.call(P+\"_prepAddStep\",pt,ot,c.getLocal(\"pCoef\")),...c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(gt)))]),c.br_if(1,c.i32_eqz(c.getLocal(\"i\"))),c.setLocal(\"i\",c.i32_sub(c.getLocal(\"i\"),c.i32_const(1))),c.br(0)))),q.addCode(c.call(P+\"_mulByQ\",pt,mt),c.call(P+\"_mulByQ\",mt,Nt)),q.addCode(c.call(S+\"_neg\",kt,kt),c.call(P+\"_prepAddStep\",mt,ot,c.getLocal(\"pCoef\")),c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(gt))),c.call(P+\"_prepAddStep\",Nt,ot,c.getLocal(\"pCoef\")),c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(gt))))}function nt(){const q=O.addFunction(P+\"__mulBy024Old\");q.addParam(\"pEll0\",\"i32\"),q.addParam(\"pEllVW\",\"i32\"),q.addParam(\"pEllVV\",\"i32\"),q.addParam(\"pR\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"pEll0\"),ut=c.getLocal(\"pEllVV\"),ot=c.getLocal(\"pEllVW\"),rt=c.getLocal(\"pR\"),at=O.alloc(F),Lt=c.i32_const(at),pt=c.i32_const(at),Et=c.i32_const(at+M),At=c.i32_const(at+M*2),mt=c.i32_const(at+M*3),Rt=c.i32_const(at+M*4),Nt=c.i32_const(at+M*5);q.addCode(c.call(S+\"_copy\",X,pt),c.call(S+\"_zero\",Et),c.call(S+\"_copy\",ut,At),c.call(S+\"_zero\",mt),c.call(S+\"_copy\",ot,Rt),c.call(S+\"_zero\",Nt),c.call(bt+\"_mul\",Lt,rt,rt))}function Mt(){const q=O.addFunction(P+\"__mulBy024\");q.addParam(\"pEll0\",\"i32\"),q.addParam(\"pEllVW\",\"i32\"),q.addParam(\"pEllVV\",\"i32\"),q.addParam(\"pR\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"pEll0\"),ut=c.getLocal(\"pEllVV\"),ot=c.getLocal(\"pEllVW\"),rt=c.getLocal(\"pR\"),at=c.i32_add(c.getLocal(\"pR\"),c.i32_const(2*y)),Lt=c.i32_add(c.getLocal(\"pR\"),c.i32_const(4*y)),pt=c.i32_add(c.getLocal(\"pR\"),c.i32_const(6*y)),Et=c.i32_add(c.getLocal(\"pR\"),c.i32_const(8*y)),At=c.i32_add(c.getLocal(\"pR\"),c.i32_const(10*y)),mt=c.i32_const(O.alloc(M)),Rt=c.i32_const(O.alloc(M)),Nt=c.i32_const(O.alloc(M)),kt=c.i32_const(O.alloc(M)),zt=c.i32_const(O.alloc(M)),Gt=c.i32_const(O.alloc(M)),Yt=c.i32_const(O.alloc(M)),Zt=c.i32_const(O.alloc(M)),Jt=c.i32_const(O.alloc(M)),Qt=c.i32_const(O.alloc(M)),Kt=c.i32_const(O.alloc(M));q.addCode(c.call(S+\"_mul\",rt,X,Yt),c.call(S+\"_mul\",Lt,ut,Zt),c.call(S+\"_mul\",Et,ot,Jt),c.call(S+\"_add\",rt,Et,Nt),c.call(S+\"_add\",rt,Lt,Rt),c.call(S+\"_add\",at,pt,kt),c.call(S+\"_add\",kt,At,kt),c.call(S+\"_mul\",at,ut,Qt),c.call(S+\"_add\",Qt,Jt,zt),c.call(S+\"_mul\",c.i32_const(U),zt,Gt),c.call(S+\"_add\",Gt,Yt,rt),c.call(S+\"_mul\",At,ot,zt),c.call(S+\"_add\",Qt,zt,Qt),c.call(S+\"_add\",zt,Zt,zt),c.call(S+\"_mul\",c.i32_const(U),zt,Gt),c.call(S+\"_mul\",at,X,zt),c.call(S+\"_add\",Qt,zt,Qt),c.call(S+\"_add\",Gt,zt,at),c.call(S+\"_add\",X,ut,mt),c.call(S+\"_mul\",Rt,mt,zt),c.call(S+\"_add\",Yt,Zt,Kt),c.call(S+\"_sub\",zt,Kt,zt),c.call(S+\"_mul\",pt,ot,Gt),c.call(S+\"_add\",Qt,Gt,Qt),c.call(S+\"_add\",Lt,Et,mt),c.call(S+\"_add\",zt,Gt,Lt),c.call(S+\"_add\",ut,ot,Rt),c.call(S+\"_mul\",Rt,mt,zt),c.call(S+\"_add\",Zt,Jt,Kt),c.call(S+\"_sub\",zt,Kt,zt),c.call(S+\"_mul\",c.i32_const(U),zt,Gt),c.call(S+\"_mul\",pt,X,zt),c.call(S+\"_add\",Qt,zt,Qt),c.call(S+\"_add\",Gt,zt,pt),c.call(S+\"_mul\",At,ut,zt),c.call(S+\"_add\",Qt,zt,Qt),c.call(S+\"_mul\",c.i32_const(U),zt,Gt),c.call(S+\"_add\",X,ot,mt),c.call(S+\"_mul\",Nt,mt,zt),c.call(S+\"_add\",Yt,Jt,Kt),c.call(S+\"_sub\",zt,Kt,zt),c.call(S+\"_add\",Gt,zt,Et),c.call(S+\"_add\",X,ut,mt),c.call(S+\"_add\",mt,ot,mt),c.call(S+\"_mul\",kt,mt,zt),c.call(S+\"_sub\",zt,Qt,At))}function jt(){const q=O.addFunction(P+\"_millerLoop\");q.addParam(\"ppreP\",\"i32\"),q.addParam(\"ppreQ\",\"i32\"),q.addParam(\"r\",\"i32\"),q.addLocal(\"pCoef\",\"i32\"),q.addLocal(\"i\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"ppreP\"),ut=c.i32_add(c.getLocal(\"ppreP\"),c.i32_const(_)),ot=c.getLocal(\"pCoef\"),rt=c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(M)),at=c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(2*M)),Lt=O.alloc(M),pt=c.i32_const(Lt),Et=O.alloc(M),At=c.i32_const(Et),mt=c.getLocal(\"r\");q.addCode(c.call(bt+\"_one\",mt),c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"ppreQ\"),c.i32_const(M*3))),c.setLocal(\"i\",c.i32_const(Z.length-2)),c.block(c.loop(c.call(bt+\"_square\",mt,mt),c.call(S+\"_mul1\",rt,ut,pt),c.call(S+\"_mul1\",at,X,At),c.call(P+\"__mulBy024\",ot,pt,At,mt),c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(gt))),c.if(c.i32_load8_s(c.getLocal(\"i\"),V),[...c.call(S+\"_mul1\",rt,ut,pt),...c.call(S+\"_mul1\",at,X,At),...c.call(P+\"__mulBy024\",ot,pt,At,mt),...c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(gt)))]),c.br_if(1,c.i32_eqz(c.getLocal(\"i\"))),c.setLocal(\"i\",c.i32_sub(c.getLocal(\"i\"),c.i32_const(1))),c.br(0)))),q.addCode(c.call(S+\"_mul1\",rt,ut,pt),c.call(S+\"_mul1\",at,X,At),c.call(P+\"__mulBy024\",ot,pt,At,mt),c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(gt))),c.call(S+\"_mul1\",rt,ut,pt),c.call(S+\"_mul1\",at,X,At),c.call(P+\"__mulBy024\",ot,pt,At,mt),c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(gt))))}function Xt(q){const c=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[8376118865763821496583973867626364092589906065868298776909617916018768340080n,16469823323077808223889137241176536799009286646108169935659301613961712198316n],[21888242871839275220042445260109153167277707414472061641714758635765020556617n,0n],[11697423496358154304825782922584725312912383441159505038794027105778954184319n,303847389135065887422783454877609941456349188919719272345083954437860409601n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[3321304630594332808241809054958361220322477375291206261884409189760185844239n,5722266937896532885780051958958348231143373700109372999374820235121374419868n],[21888242871839275222246405745257275088696311157297823662689037894645226208582n,0n],[13512124006075453725662431877630910996106405091429524885779419978626457868503n,5418419548761466998357268504080738289687024511189653727029736280683514010267n],[2203960485148121921418603742825762020974279258880205651966n,0n],[10190819375481120917420622822672549775783927716138318623895010788866272024264n,21584395482704209334823622290379665147239961968378104390343953940207365798982n],[2203960485148121921418603742825762020974279258880205651967n,0n],[18566938241244942414004596690298913868373833782006617400804628704885040364344n,16165975933942742336466353786298926857552937457188450663314217659523851788715n]]],X=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[21575463638280843010398324269430826099269044274347216827212613867836435027261n,10307601595873709700152284273816112264069230130616436755625194854815875713954n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[3772000881919853776433695186713858239009073593817195771773381919316419345261n,2236595495967245188281701248203181795121068902605861227855261137820944008926n],[2203960485148121921418603742825762020974279258880205651966n,0n],[18429021223477853657660792034369865839114504446431234726392080002137598044644n,9344045779998320333812420223237981029506012124075525679208581902008406485703n]],[[1n,0n],[2581911344467009335267311115468803099551665605076196740867805258568234346338n,19937756971775647987995932169929341994314640652964949448313374472400716661030n],[2203960485148121921418603742825762020974279258880205651966n,0n],[5324479202449903542726783395506214481928257762400643279780343368557297135718n,16208900380737693084919495127334387981393726419856888799917914180988844123039n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[13981852324922362344252311234282257507216387789820983642040889267519694726527n,7629828391165209371577384193250820201684255241773809077146787135900891633097n]]],ut=O.addFunction(P+\"__frobeniusMap\"+q);ut.addParam(\"x\",\"i32\"),ut.addParam(\"r\",\"i32\");const ot=ut.getCodeBuilder();for(let at=0;at<6;at++){const Lt=at==0?ot.getLocal(\"x\"):ot.i32_add(ot.getLocal(\"x\"),ot.i32_const(at*M)),pt=Lt,Et=ot.i32_add(ot.getLocal(\"x\"),ot.i32_const(at*M+_)),At=at==0?ot.getLocal(\"r\"):ot.i32_add(ot.getLocal(\"r\"),ot.i32_const(at*M)),mt=At,Rt=ot.i32_add(ot.getLocal(\"r\"),ot.i32_const(at*M+_)),Nt=rt(c[Math.floor(at/3)][q%12],X[at%3][q%6]),kt=O.alloc([...n.bigInt2BytesLE(tt(Nt[0]),32),...n.bigInt2BytesLE(tt(Nt[1]),32)]);q%2==1?ut.addCode(ot.call(D+\"_copy\",pt,mt),ot.call(D+\"_neg\",Et,Rt),ot.call(S+\"_mul\",At,ot.i32_const(kt),At)):ut.addCode(ot.call(S+\"_mul\",Lt,ot.i32_const(kt),At))}function rt(at,Lt){const pt=BigInt(at[0]),Et=BigInt(at[1]),At=BigInt(Lt[0]),mt=BigInt(Lt[1]),Rt=[(pt*At-Et*mt)%G,(pt*mt+Et*At)%G];return h(Rt[0])&&(Rt[0]=Rt[0]+G),Rt}}function ne(){const q=O.addFunction(P+\"__finalExponentiationFirstChunk\");q.addParam(\"x\",\"i32\"),q.addParam(\"r\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"x\"),ut=X,ot=c.i32_add(X,c.i32_const(y*6)),rt=c.getLocal(\"r\"),at=O.alloc(F),Lt=c.i32_const(at),pt=Lt,Et=c.i32_const(at+y*6),At=c.i32_const(O.alloc(F)),mt=c.i32_const(O.alloc(F)),Rt=c.i32_const(O.alloc(F));q.addCode(c.call(ct+\"_copy\",ut,pt),c.call(ct+\"_neg\",ot,Et),c.call(bt+\"_inverse\",X,At),c.call(bt+\"_mul\",Lt,At,mt),c.call(P+\"__frobeniusMap2\",mt,Rt),c.call(bt+\"_mul\",mt,Rt,rt))}function te(){const q=O.addFunction(P+\"__cyclotomicSquare\");q.addParam(\"x\",\"i32\"),q.addParam(\"r\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"x\"),ut=c.i32_add(c.getLocal(\"x\"),c.i32_const(M)),ot=c.i32_add(c.getLocal(\"x\"),c.i32_const(2*M)),rt=c.i32_add(c.getLocal(\"x\"),c.i32_const(3*M)),at=c.i32_add(c.getLocal(\"x\"),c.i32_const(4*M)),Lt=c.i32_add(c.getLocal(\"x\"),c.i32_const(5*M)),pt=c.getLocal(\"r\"),Et=c.i32_add(c.getLocal(\"r\"),c.i32_const(M)),At=c.i32_add(c.getLocal(\"r\"),c.i32_const(2*M)),mt=c.i32_add(c.getLocal(\"r\"),c.i32_const(3*M)),Rt=c.i32_add(c.getLocal(\"r\"),c.i32_const(4*M)),Nt=c.i32_add(c.getLocal(\"r\"),c.i32_const(5*M)),kt=c.i32_const(O.alloc(M)),zt=c.i32_const(O.alloc(M)),Gt=c.i32_const(O.alloc(M)),Yt=c.i32_const(O.alloc(M)),Zt=c.i32_const(O.alloc(M)),Jt=c.i32_const(O.alloc(M)),Qt=c.i32_const(O.alloc(M)),Kt=c.i32_const(O.alloc(M));q.addCode(c.call(S+\"_mul\",X,at,Qt),c.call(S+\"_mul\",at,c.i32_const(U),kt),c.call(S+\"_add\",X,kt,kt),c.call(S+\"_add\",X,at,Kt),c.call(S+\"_mul\",Kt,kt,kt),c.call(S+\"_mul\",c.i32_const(U),Qt,Kt),c.call(S+\"_add\",Qt,Kt,Kt),c.call(S+\"_sub\",kt,Kt,kt),c.call(S+\"_add\",Qt,Qt,zt),c.call(S+\"_mul\",rt,ot,Qt),c.call(S+\"_mul\",ot,c.i32_const(U),Gt),c.call(S+\"_add\",rt,Gt,Gt),c.call(S+\"_add\",rt,ot,Kt),c.call(S+\"_mul\",Kt,Gt,Gt),c.call(S+\"_mul\",c.i32_const(U),Qt,Kt),c.call(S+\"_add\",Qt,Kt,Kt),c.call(S+\"_sub\",Gt,Kt,Gt),c.call(S+\"_add\",Qt,Qt,Yt),c.call(S+\"_mul\",ut,Lt,Qt),c.call(S+\"_mul\",Lt,c.i32_const(U),Zt),c.call(S+\"_add\",ut,Zt,Zt),c.call(S+\"_add\",ut,Lt,Kt),c.call(S+\"_mul\",Kt,Zt,Zt),c.call(S+\"_mul\",c.i32_const(U),Qt,Kt),c.call(S+\"_add\",Qt,Kt,Kt),c.call(S+\"_sub\",Zt,Kt,Zt),c.call(S+\"_add\",Qt,Qt,Jt),c.call(S+\"_sub\",kt,X,pt),c.call(S+\"_add\",pt,pt,pt),c.call(S+\"_add\",kt,pt,pt),c.call(S+\"_add\",zt,at,Rt),c.call(S+\"_add\",Rt,Rt,Rt),c.call(S+\"_add\",zt,Rt,Rt),c.call(S+\"_mul\",Jt,c.i32_const(dt),Kt),c.call(S+\"_add\",Kt,rt,mt),c.call(S+\"_add\",mt,mt,mt),c.call(S+\"_add\",Kt,mt,mt),c.call(S+\"_sub\",Zt,ot,At),c.call(S+\"_add\",At,At,At),c.call(S+\"_add\",Zt,At,At),c.call(S+\"_sub\",Gt,ut,Et),c.call(S+\"_add\",Et,Et,Et),c.call(S+\"_add\",Gt,Et,Et),c.call(S+\"_add\",Yt,Lt,Nt),c.call(S+\"_add\",Nt,Nt,Nt),c.call(S+\"_add\",Yt,Nt,Nt))}function Me(q,c){const X=$t(q).map(Et=>Et==-1?255:Et),ut=O.alloc(X),ot=O.addFunction(P+\"__cyclotomicExp_\"+c);ot.addParam(\"x\",\"i32\"),ot.addParam(\"r\",\"i32\"),ot.addLocal(\"bit\",\"i32\"),ot.addLocal(\"i\",\"i32\");const rt=ot.getCodeBuilder(),at=rt.getLocal(\"x\"),Lt=rt.getLocal(\"r\"),pt=rt.i32_const(O.alloc(F));ot.addCode(rt.call(bt+\"_conjugate\",at,pt),rt.call(bt+\"_one\",Lt),rt.if(rt.teeLocal(\"bit\",rt.i32_load8_s(rt.i32_const(X.length-1),ut)),rt.if(rt.i32_eq(rt.getLocal(\"bit\"),rt.i32_const(1)),rt.call(bt+\"_mul\",Lt,at,Lt),rt.call(bt+\"_mul\",Lt,pt,Lt))),rt.setLocal(\"i\",rt.i32_const(X.length-2)),rt.block(rt.loop(rt.call(P+\"__cyclotomicSquare\",Lt,Lt),rt.if(rt.teeLocal(\"bit\",rt.i32_load8_s(rt.getLocal(\"i\"),ut)),rt.if(rt.i32_eq(rt.getLocal(\"bit\"),rt.i32_const(1)),rt.call(bt+\"_mul\",Lt,at,Lt),rt.call(bt+\"_mul\",Lt,pt,Lt))),rt.br_if(1,rt.i32_eqz(rt.getLocal(\"i\"))),rt.setLocal(\"i\",rt.i32_sub(rt.getLocal(\"i\"),rt.i32_const(1))),rt.br(0))))}function ge(){te(),Me(Vt,\"w0\");const q=O.addFunction(P+\"__finalExponentiationLastChunk\");q.addParam(\"x\",\"i32\"),q.addParam(\"r\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"x\"),ut=c.getLocal(\"r\"),ot=c.i32_const(O.alloc(F)),rt=c.i32_const(O.alloc(F)),at=c.i32_const(O.alloc(F)),Lt=c.i32_const(O.alloc(F)),pt=c.i32_const(O.alloc(F)),Et=c.i32_const(O.alloc(F)),At=c.i32_const(O.alloc(F)),mt=c.i32_const(O.alloc(F)),Rt=c.i32_const(O.alloc(F)),Nt=c.i32_const(O.alloc(F)),kt=c.i32_const(O.alloc(F)),zt=c.i32_const(O.alloc(F)),Gt=c.i32_const(O.alloc(F)),Yt=c.i32_const(O.alloc(F)),Zt=c.i32_const(O.alloc(F)),Jt=c.i32_const(O.alloc(F)),Qt=c.i32_const(O.alloc(F)),Kt=c.i32_const(O.alloc(F)),Ee=c.i32_const(O.alloc(F)),Pe=c.i32_const(O.alloc(F)),De=c.i32_const(O.alloc(F));q.addCode(c.call(P+\"__cyclotomicExp_w0\",X,ot),c.call(bt+\"_conjugate\",ot,ot),c.call(P+\"__cyclotomicSquare\",ot,rt),c.call(P+\"__cyclotomicSquare\",rt,at),c.call(bt+\"_mul\",at,rt,Lt),c.call(P+\"__cyclotomicExp_w0\",Lt,pt),c.call(bt+\"_conjugate\",pt,pt),c.call(P+\"__cyclotomicSquare\",pt,Et),c.call(P+\"__cyclotomicExp_w0\",Et,At),c.call(bt+\"_conjugate\",At,At),c.call(bt+\"_conjugate\",Lt,mt),c.call(bt+\"_conjugate\",At,Rt),c.call(bt+\"_mul\",Rt,pt,Nt),c.call(bt+\"_mul\",Nt,mt,kt),c.call(bt+\"_mul\",kt,rt,zt),c.call(bt+\"_mul\",kt,pt,Gt),c.call(bt+\"_mul\",Gt,X,Yt),c.call(P+\"__frobeniusMap1\",zt,Zt),c.call(bt+\"_mul\",Zt,Yt,Jt),c.call(P+\"__frobeniusMap2\",kt,Qt),c.call(bt+\"_mul\",Qt,Jt,Kt),c.call(bt+\"_conjugate\",X,Ee),c.call(bt+\"_mul\",Ee,zt,Pe),c.call(P+\"__frobeniusMap3\",Pe,De),c.call(bt+\"_mul\",De,Kt,ut))}function be(){ne(),ge();const q=O.addFunction(P+\"_finalExponentiation\");q.addParam(\"x\",\"i32\"),q.addParam(\"r\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"x\"),ut=c.getLocal(\"r\"),ot=c.i32_const(O.alloc(F));q.addCode(c.call(P+\"__finalExponentiationFirstChunk\",X,ot),c.call(P+\"__finalExponentiationLastChunk\",ot,ut))}function ye(){const q=O.addFunction(P+\"_finalExponentiationOld\");q.addParam(\"x\",\"i32\"),q.addParam(\"r\",\"i32\");const X=O.alloc(n.bigInt2BytesLE(552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480n,352)),ut=q.getCodeBuilder();q.addCode(ut.call(bt+\"_exp\",ut.getLocal(\"x\"),ut.i32_const(X),ut.i32_const(352),ut.getLocal(\"r\")))}const me=O.alloc(b),Ce=O.alloc(xt);function Te(q){const c=O.addFunction(P+\"_pairingEq\"+q);for(let rt=0;rt<q;rt++)c.addParam(\"p_\"+rt,\"i32\"),c.addParam(\"q_\"+rt,\"i32\");c.addParam(\"c\",\"i32\"),c.setReturnType(\"i32\");const X=c.getCodeBuilder(),ut=X.i32_const(O.alloc(F)),ot=X.i32_const(O.alloc(F));c.addCode(X.call(bt+\"_one\",ut));for(let rt=0;rt<q;rt++)c.addCode(X.call(P+\"_prepareG1\",X.getLocal(\"p_\"+rt),X.i32_const(me))),c.addCode(X.call(P+\"_prepareG2\",X.getLocal(\"q_\"+rt),X.i32_const(Ce))),c.addCode(X.call(P+\"_millerLoop\",X.i32_const(me),X.i32_const(Ce),ot)),c.addCode(X.call(bt+\"_mul\",ut,ot,ut));c.addCode(X.call(P+\"_finalExponentiation\",ut,ut)),c.addCode(X.call(bt+\"_eq\",ut,X.getLocal(\"c\")))}function Re(){const q=O.addFunction(P+\"_pairing\");q.addParam(\"p\",\"i32\"),q.addParam(\"q\",\"i32\"),q.addParam(\"r\",\"i32\");const c=q.getCodeBuilder(),X=c.i32_const(O.alloc(F));q.addCode(c.call(P+\"_prepareG1\",c.getLocal(\"p\"),c.i32_const(me))),q.addCode(c.call(P+\"_prepareG2\",c.getLocal(\"q\"),c.i32_const(Ce))),q.addCode(c.call(P+\"_millerLoop\",c.i32_const(me),c.i32_const(Ce),X)),q.addCode(c.call(P+\"_finalExponentiation\",X,c.getLocal(\"r\")))}A(),R(),p(),J(),Mt(),nt(),jt();for(let q=0;q<10;q++)Xt(q),O.exportFunction(P+\"__frobeniusMap\"+q);ye(),be();for(let q=1;q<=5;q++)Te(q),O.exportFunction(P+\"_pairingEq\"+q);Re(),O.exportFunction(P+\"_pairing\"),O.exportFunction(P+\"_prepareG1\"),O.exportFunction(P+\"_prepareG2\"),O.exportFunction(P+\"_millerLoop\"),O.exportFunction(P+\"_finalExponentiation\"),O.exportFunction(P+\"_finalExponentiationOld\"),O.exportFunction(P+\"__mulBy024\"),O.exportFunction(P+\"__mulBy024Old\"),O.exportFunction(P+\"__cyclotomicSquare\"),O.exportFunction(P+\"__cyclotomicExp_w0\")},uo}var fo,ic;function Bd(){if(ic)return fo;ic=1;const n=li(),e=Di(),t=Qr(),i=Nr(),o=Gr(),a=Kr(),s=Hr(),l=Zr(),g=jr(),d=Vr(),{bitLength:u,isOdd:w,isNegative:C}=di();return fo=function(m,O){const Q=O||\"bls12381\";if(m.modules[Q])return Q;const P=0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn,G=0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001n,st=Math.floor((u(P-1n)-1)/64)+1,N=st*8,y=N,I=y*2,_=y*12,M=Math.floor((u(G-1n)-1)/64)+1,F=M*8,L=F,D=m.alloc(n.bigInt2BytesLE(G,L)),K=e(m,P,\"f1m\",\"intq\");t(m,G,\"fr\",\"frm\",\"intr\");const $=m.alloc(n.bigInt2BytesLE(ft(4n),y)),S=a(m,\"g1m\",\"f1m\",$);s(m,\"frm\",\"frm\",\"frm\",\"frm_mul\"),l(m,\"pol\",\"frm\"),g(m,\"qap\",\"frm\");const B=i(m,\"f1m_neg\",\"f2m\",\"f1m\"),E=m.alloc([...n.bigInt2BytesLE(ft(4n),y),...n.bigInt2BytesLE(ft(4n),y)]),_t=a(m,\"g2m\",\"f2m\",E);function tt(q,c){const X=m.addFunction(q);X.addParam(\"pG\",\"i32\"),X.addParam(\"pFr\",\"i32\"),X.addParam(\"pr\",\"i32\");const ut=X.getCodeBuilder(),ot=ut.i32_const(m.alloc(F));X.addCode(ut.call(\"frm_fromMontgomery\",ut.getLocal(\"pFr\"),ot),ut.call(c,ut.getLocal(\"pG\"),ot,ut.i32_const(F),ut.getLocal(\"pr\"))),m.exportFunction(q)}tt(\"g1m_timesFr\",\"g1m_timesScalar\"),s(m,\"g1m\",\"g1m\",\"frm\",\"g1m_timesFr\"),tt(\"g2m_timesFr\",\"g2m_timesScalar\"),s(m,\"g2m\",\"g2m\",\"frm\",\"g2m_timesFr\"),tt(\"g1m_timesFrAffine\",\"g1m_timesScalarAffine\"),tt(\"g2m_timesFrAffine\",\"g2m_timesScalarAffine\"),d(m,\"frm_batchApplyKey\",\"fmr\",\"frm\",F,F,F,\"frm_mul\"),d(m,\"g1m_batchApplyKey\",\"g1m\",\"frm\",N*3,N*3,F,\"g1m_timesFr\"),d(m,\"g1m_batchApplyKeyMixed\",\"g1m\",\"frm\",N*2,N*3,F,\"g1m_timesFrAffine\"),d(m,\"g2m_batchApplyKey\",\"g2m\",\"frm\",N*2*3,N*3*2,F,\"g2m_timesFr\"),d(m,\"g2m_batchApplyKeyMixed\",\"g2m\",\"frm\",N*2*2,N*3*2,F,\"g2m_timesFrAffine\");function ft(q){return BigInt(q)*(1n<<BigInt(y*8))%P}const Bt=[3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507n,1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569n,1n],Ct=m.alloc([...n.bigInt2BytesLE(ft(Bt[0]),y),...n.bigInt2BytesLE(ft(Bt[1]),y),...n.bigInt2BytesLE(ft(Bt[2]),y)]),St=[0n,1n,0n],Ot=m.alloc([...n.bigInt2BytesLE(ft(St[0]),y),...n.bigInt2BytesLE(ft(St[1]),y),...n.bigInt2BytesLE(ft(St[2]),y)]),Dt=[[352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160n,3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758n],[1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905n,927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582n],[1n,0n]],x=m.alloc([...n.bigInt2BytesLE(ft(Dt[0][0]),y),...n.bigInt2BytesLE(ft(Dt[0][1]),y),...n.bigInt2BytesLE(ft(Dt[1][0]),y),...n.bigInt2BytesLE(ft(Dt[1][1]),y),...n.bigInt2BytesLE(ft(Dt[2][0]),y),...n.bigInt2BytesLE(ft(Dt[2][1]),y)]),ht=[[0n,0n],[1n,0n],[0n,0n]],yt=m.alloc([...n.bigInt2BytesLE(ft(ht[0][0]),y),...n.bigInt2BytesLE(ft(ht[0][1]),y),...n.bigInt2BytesLE(ft(ht[1][0]),y),...n.bigInt2BytesLE(ft(ht[1][1]),y),...n.bigInt2BytesLE(ft(ht[2][0]),y),...n.bigInt2BytesLE(ft(ht[2][1]),y)]),U=m.alloc([...n.bigInt2BytesLE(ft(1n),y),...n.bigInt2BytesLE(ft(0n),y),...n.bigInt2BytesLE(ft(0n),y),...n.bigInt2BytesLE(ft(0n),y),...n.bigInt2BytesLE(ft(0n),y),...n.bigInt2BytesLE(ft(0n),y),...n.bigInt2BytesLE(ft(0n),y),...n.bigInt2BytesLE(ft(0n),y),...n.bigInt2BytesLE(ft(0n),y),...n.bigInt2BytesLE(ft(0n),y),...n.bigInt2BytesLE(ft(0n),y),...n.bigInt2BytesLE(ft(0n),y)]),r=m.alloc([...n.bigInt2BytesLE(ft(1n),y),...n.bigInt2BytesLE(ft(1n),y)]);function dt(){const q=m.addFunction(B+\"_mulNR\");q.addParam(\"x\",\"i32\"),q.addParam(\"pr\",\"i32\");const c=q.getCodeBuilder(),X=c.i32_const(m.alloc(y)),ut=c.getLocal(\"x\"),ot=c.i32_add(c.getLocal(\"x\"),c.i32_const(y)),rt=c.getLocal(\"pr\"),at=c.i32_add(c.getLocal(\"pr\"),c.i32_const(y));q.addCode(c.call(K+\"_copy\",ut,X),c.call(K+\"_sub\",ut,ot,rt),c.call(K+\"_add\",X,ot,at))}dt();const k=o(m,B+\"_mulNR\",\"f6m\",\"f2m\");function f(){const q=m.addFunction(k+\"_mulNR\");q.addParam(\"x\",\"i32\"),q.addParam(\"pr\",\"i32\");const c=q.getCodeBuilder(),X=c.i32_const(m.alloc(y*2));q.addCode(c.call(B+\"_copy\",c.getLocal(\"x\"),X),c.call(B+\"_mulNR\",c.i32_add(c.getLocal(\"x\"),c.i32_const(N*4)),c.getLocal(\"pr\")),c.call(B+\"_copy\",c.i32_add(c.getLocal(\"x\"),c.i32_const(N*2)),c.i32_add(c.getLocal(\"pr\"),c.i32_const(N*4))),c.call(B+\"_copy\",X,c.i32_add(c.getLocal(\"pr\"),c.i32_const(N*2))))}f();const ct=i(m,k+\"_mulNR\",\"ftm\",k),bt=$t(0xd201000000010000n),H=m.alloc(bt),Z=3*I,V=bt.length-1,Ft=bt.reduce((q,c)=>q+(c!=0?1:0),0)+V+1,qt=3*2*N,W=3*N*2+Ft*Z,b=!0,xt=15132376222941642752n;m.modules[Q]={n64q:st,n64r:M,n8q:N,n8r:F,pG1gen:Ct,pG1zero:Ot,pG1b:$,pG2gen:x,pG2zero:yt,pG2b:E,pq:m.modules.f1m.pq,pr:D,pOneT:U,r:G,q:P,prePSize:qt,preQSize:W};function Vt(q){let c=q;const X=[];for(;c>0n;){if(w(c)){const ut=2-Number(c%4n);X.push(ut),c=c-BigInt(ut)}else X.push(0);c=c>>1n}return X}function $t(q){let c=q;const X=[];for(;c>0n;)w(c)?X.push(1):X.push(0),c=c>>1n;return X}function v(){const q=m.addFunction(Q+\"_prepareG1\");q.addParam(\"pP\",\"i32\"),q.addParam(\"ppreP\",\"i32\");const c=q.getCodeBuilder();q.addCode(c.call(S+\"_normalize\",c.getLocal(\"pP\"),c.getLocal(\"ppreP\")))}function p(){const q=m.addFunction(Q+\"_prepDblStep\");q.addParam(\"R\",\"i32\"),q.addParam(\"r\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"R\"),ut=c.i32_add(c.getLocal(\"R\"),c.i32_const(2*N)),ot=c.i32_add(c.getLocal(\"R\"),c.i32_const(4*N)),rt=c.getLocal(\"r\"),at=c.i32_add(c.getLocal(\"r\"),c.i32_const(2*N)),Lt=c.i32_add(c.getLocal(\"r\"),c.i32_const(4*N)),pt=c.i32_const(m.alloc(I)),Et=c.i32_const(m.alloc(I)),At=c.i32_const(m.alloc(I)),mt=c.i32_const(m.alloc(I)),Rt=c.i32_const(m.alloc(I));q.addCode(c.call(B+\"_square\",X,rt),c.call(B+\"_square\",ut,Et),c.call(B+\"_square\",Et,At),c.call(B+\"_add\",Et,X,at),c.call(B+\"_square\",at,at),c.call(B+\"_sub\",at,rt,at),c.call(B+\"_sub\",at,At,at),c.call(B+\"_add\",at,at,at),c.call(B+\"_add\",rt,rt,mt),c.call(B+\"_add\",mt,rt,mt),c.call(B+\"_add\",X,mt,Lt),c.call(B+\"_square\",mt,Rt),c.call(B+\"_square\",ot,pt),c.call(B+\"_sub\",Rt,at,X),c.call(B+\"_sub\",X,at,X),c.call(B+\"_add\",ot,ut,ot),c.call(B+\"_square\",ot,ot),c.call(B+\"_sub\",ot,Et,ot),c.call(B+\"_sub\",ot,pt,ot),c.call(B+\"_sub\",at,X,ut),c.call(B+\"_mul\",ut,mt,ut),c.call(B+\"_add\",At,At,At),c.call(B+\"_add\",At,At,At),c.call(B+\"_add\",At,At,At),c.call(B+\"_sub\",ut,At,ut),c.call(B+\"_mul\",mt,pt,at),c.call(B+\"_add\",at,at,at),c.call(B+\"_neg\",at,at),c.call(B+\"_square\",Lt,Lt),c.call(B+\"_sub\",Lt,rt,Lt),c.call(B+\"_sub\",Lt,Rt,Lt),c.call(B+\"_add\",Et,Et,Et),c.call(B+\"_add\",Et,Et,Et),c.call(B+\"_sub\",Lt,Et,Lt),c.call(B+\"_mul\",ot,pt,rt),c.call(B+\"_add\",rt,rt,rt))}function A(){const q=m.addFunction(Q+\"_prepAddStep\");q.addParam(\"R\",\"i32\"),q.addParam(\"Q\",\"i32\"),q.addParam(\"r\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"R\"),ut=c.i32_add(c.getLocal(\"R\"),c.i32_const(2*N)),ot=c.i32_add(c.getLocal(\"R\"),c.i32_const(4*N)),rt=c.getLocal(\"Q\"),at=c.i32_add(c.getLocal(\"Q\"),c.i32_const(2*N)),Lt=c.getLocal(\"r\"),pt=c.i32_add(c.getLocal(\"r\"),c.i32_const(2*N)),Et=c.i32_add(c.getLocal(\"r\"),c.i32_const(4*N)),At=c.i32_const(m.alloc(I)),mt=c.i32_const(m.alloc(I)),Rt=c.i32_const(m.alloc(I)),Nt=c.i32_const(m.alloc(I)),kt=c.i32_const(m.alloc(I)),zt=c.i32_const(m.alloc(I)),Gt=c.i32_const(m.alloc(I)),Yt=c.i32_const(m.alloc(I)),Zt=c.i32_const(m.alloc(I)),Jt=c.i32_const(m.alloc(I)),Qt=c.i32_const(m.alloc(I));q.addCode(c.call(B+\"_square\",ot,At),c.call(B+\"_square\",at,mt),c.call(B+\"_mul\",At,rt,Nt),c.call(B+\"_add\",at,ot,pt),c.call(B+\"_square\",pt,pt),c.call(B+\"_sub\",pt,mt,pt),c.call(B+\"_sub\",pt,At,pt),c.call(B+\"_mul\",pt,At,pt),c.call(B+\"_sub\",Nt,X,kt),c.call(B+\"_square\",kt,zt),c.call(B+\"_add\",zt,zt,Gt),c.call(B+\"_add\",Gt,Gt,Gt),c.call(B+\"_mul\",Gt,kt,Yt),c.call(B+\"_sub\",pt,ut,Zt),c.call(B+\"_sub\",Zt,ut,Zt),c.call(B+\"_mul\",Zt,rt,Et),c.call(B+\"_mul\",Gt,X,Jt),c.call(B+\"_square\",Zt,X),c.call(B+\"_sub\",X,Yt,X),c.call(B+\"_sub\",X,Jt,X),c.call(B+\"_sub\",X,Jt,X),c.call(B+\"_add\",ot,kt,ot),c.call(B+\"_square\",ot,ot),c.call(B+\"_sub\",ot,At,ot),c.call(B+\"_sub\",ot,zt,ot),c.call(B+\"_add\",at,ot,Lt),c.call(B+\"_sub\",Jt,X,Qt),c.call(B+\"_mul\",Qt,Zt,Qt),c.call(B+\"_mul\",ut,Yt,Nt),c.call(B+\"_add\",Nt,Nt,Nt),c.call(B+\"_sub\",Qt,Nt,ut),c.call(B+\"_square\",Lt,Lt),c.call(B+\"_sub\",Lt,mt,Lt),c.call(B+\"_square\",ot,Rt),c.call(B+\"_sub\",Lt,Rt,Lt),c.call(B+\"_add\",Et,Et,Et),c.call(B+\"_sub\",Et,Lt,Et),c.call(B+\"_add\",ot,ot,Lt),c.call(B+\"_neg\",Zt,Zt),c.call(B+\"_add\",Zt,Zt,pt))}function R(){const q=m.addFunction(Q+\"_prepareG2\");q.addParam(\"pQ\",\"i32\"),q.addParam(\"ppreQ\",\"i32\"),q.addLocal(\"pCoef\",\"i32\"),q.addLocal(\"i\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"pQ\"),ut=m.alloc(I*3),ot=c.i32_const(ut),rt=c.getLocal(\"ppreQ\");q.addCode(c.call(_t+\"_normalize\",X,rt),c.if(c.call(_t+\"_isZero\",rt),c.ret([])),c.call(_t+\"_copy\",rt,ot),c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"ppreQ\"),c.i32_const(I*3)))),q.addCode(c.setLocal(\"i\",c.i32_const(bt.length-2)),c.block(c.loop(c.call(Q+\"_prepDblStep\",ot,c.getLocal(\"pCoef\")),c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(Z))),c.if(c.i32_load8_s(c.getLocal(\"i\"),H),[...c.call(Q+\"_prepAddStep\",ot,rt,c.getLocal(\"pCoef\")),...c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(Z)))]),c.br_if(1,c.i32_eqz(c.getLocal(\"i\"))),c.setLocal(\"i\",c.i32_sub(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))))}function j(){const q=m.addFunction(k+\"_mul1\");q.addParam(\"pA\",\"i32\"),q.addParam(\"pC1\",\"i32\"),q.addParam(\"pR\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"pA\"),ut=c.i32_add(c.getLocal(\"pA\"),c.i32_const(y*2)),ot=c.i32_add(c.getLocal(\"pA\"),c.i32_const(y*4)),rt=c.getLocal(\"pC1\"),at=c.getLocal(\"pR\"),Lt=c.i32_add(c.getLocal(\"pR\"),c.i32_const(y*2)),pt=c.i32_add(c.getLocal(\"pR\"),c.i32_const(y*4)),Et=c.i32_const(m.alloc(y*2)),At=c.i32_const(m.alloc(y*2));q.addCode(c.call(B+\"_add\",X,ut,Et),c.call(B+\"_add\",ut,ot,At),c.call(B+\"_mul\",ut,rt,pt),c.call(B+\"_mul\",At,rt,at),c.call(B+\"_sub\",at,pt,at),c.call(B+\"_mulNR\",at,at),c.call(B+\"_mul\",Et,rt,Lt),c.call(B+\"_sub\",Lt,pt,Lt))}j();function J(){const q=m.addFunction(k+\"_mul01\");q.addParam(\"pA\",\"i32\"),q.addParam(\"pC0\",\"i32\"),q.addParam(\"pC1\",\"i32\"),q.addParam(\"pR\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"pA\"),ut=c.i32_add(c.getLocal(\"pA\"),c.i32_const(y*2)),ot=c.i32_add(c.getLocal(\"pA\"),c.i32_const(y*4)),rt=c.getLocal(\"pC0\"),at=c.getLocal(\"pC1\"),Lt=c.getLocal(\"pR\"),pt=c.i32_add(c.getLocal(\"pR\"),c.i32_const(y*2)),Et=c.i32_add(c.getLocal(\"pR\"),c.i32_const(y*4)),At=c.i32_const(m.alloc(y*2)),mt=c.i32_const(m.alloc(y*2)),Rt=c.i32_const(m.alloc(y*2)),Nt=c.i32_const(m.alloc(y*2));q.addCode(c.call(B+\"_mul\",X,rt,At),c.call(B+\"_mul\",ut,at,mt),c.call(B+\"_add\",X,ut,Rt),c.call(B+\"_add\",X,ot,Nt),c.call(B+\"_add\",ut,ot,Lt),c.call(B+\"_mul\",Lt,at,Lt),c.call(B+\"_sub\",Lt,mt,Lt),c.call(B+\"_mulNR\",Lt,Lt),c.call(B+\"_add\",Lt,At,Lt),c.call(B+\"_add\",rt,at,pt),c.call(B+\"_mul\",pt,Rt,pt),c.call(B+\"_sub\",pt,At,pt),c.call(B+\"_sub\",pt,mt,pt),c.call(B+\"_mul\",Nt,rt,Et),c.call(B+\"_sub\",Et,At,Et),c.call(B+\"_add\",Et,mt,Et))}J();function nt(){const q=m.addFunction(ct+\"_mul014\");q.addParam(\"pA\",\"i32\"),q.addParam(\"pC0\",\"i32\"),q.addParam(\"pC1\",\"i32\"),q.addParam(\"pC4\",\"i32\"),q.addParam(\"pR\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"pA\"),ut=c.i32_add(c.getLocal(\"pA\"),c.i32_const(y*6)),ot=c.getLocal(\"pC0\"),rt=c.getLocal(\"pC1\"),at=c.getLocal(\"pC4\"),Lt=c.i32_const(m.alloc(y*6)),pt=c.i32_const(m.alloc(y*6)),Et=c.i32_const(m.alloc(y*2)),At=c.getLocal(\"pR\"),mt=c.i32_add(c.getLocal(\"pR\"),c.i32_const(y*6));q.addCode(c.call(k+\"_mul01\",X,ot,rt,Lt),c.call(k+\"_mul1\",ut,at,pt),c.call(B+\"_add\",rt,at,Et),c.call(k+\"_add\",ut,X,mt),c.call(k+\"_mul01\",mt,ot,Et,mt),c.call(k+\"_sub\",mt,Lt,mt),c.call(k+\"_sub\",mt,pt,mt),c.call(k+\"_copy\",pt,At),c.call(k+\"_mulNR\",At,At),c.call(k+\"_add\",At,Lt,At))}nt();function Mt(){const q=m.addFunction(Q+\"_ell\");q.addParam(\"pP\",\"i32\"),q.addParam(\"pCoefs\",\"i32\"),q.addParam(\"pF\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"pP\"),ut=c.i32_add(c.getLocal(\"pP\"),c.i32_const(N)),ot=c.getLocal(\"pF\"),rt=c.getLocal(\"pCoefs\"),at=c.i32_add(c.getLocal(\"pCoefs\"),c.i32_const(y)),Lt=c.i32_add(c.getLocal(\"pCoefs\"),c.i32_const(y*2)),pt=c.i32_add(c.getLocal(\"pCoefs\"),c.i32_const(y*3)),Et=c.i32_add(c.getLocal(\"pCoefs\"),c.i32_const(y*4)),At=m.alloc(y*2),mt=c.i32_const(At),Rt=c.i32_const(At),Nt=c.i32_const(At+y),kt=m.alloc(y*2),zt=c.i32_const(kt),Gt=c.i32_const(kt),Yt=c.i32_const(kt+y);q.addCode(c.call(K+\"_mul\",rt,ut,Rt),c.call(K+\"_mul\",at,ut,Nt),c.call(K+\"_mul\",Lt,X,Gt),c.call(K+\"_mul\",pt,X,Yt),c.call(ct+\"_mul014\",ot,Et,zt,mt,ot))}Mt();function jt(){const q=m.addFunction(Q+\"_millerLoop\");q.addParam(\"ppreP\",\"i32\"),q.addParam(\"ppreQ\",\"i32\"),q.addParam(\"r\",\"i32\"),q.addLocal(\"pCoef\",\"i32\"),q.addLocal(\"i\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"ppreP\"),ut=c.getLocal(\"pCoef\"),ot=c.getLocal(\"r\");q.addCode(c.call(ct+\"_one\",ot),c.if(c.call(S+\"_isZero\",X),c.ret([])),c.if(c.call(S+\"_isZero\",c.getLocal(\"ppreQ\")),c.ret([])),c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"ppreQ\"),c.i32_const(I*3))),c.setLocal(\"i\",c.i32_const(bt.length-2)),c.block(c.loop(c.call(Q+\"_ell\",X,ut,ot),c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(Z))),c.if(c.i32_load8_s(c.getLocal(\"i\"),H),[...c.call(Q+\"_ell\",X,ut,ot),...c.setLocal(\"pCoef\",c.i32_add(c.getLocal(\"pCoef\"),c.i32_const(Z)))]),c.call(ct+\"_square\",ot,ot),c.br_if(1,c.i32_eq(c.getLocal(\"i\"),c.i32_const(1))),c.setLocal(\"i\",c.i32_sub(c.getLocal(\"i\"),c.i32_const(1))),c.br(0))),c.call(Q+\"_ell\",X,ut,ot)),q.addCode(c.call(ct+\"_conjugate\",ot,ot))}function Xt(q){const c=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n,151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n,0n],[2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n,1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n,877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n],[4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n,0n],[151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n,3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n,2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n,0n],[877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n,3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n]]],X=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[0n,4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[0n,1n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[0n,793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n]],[[1n,0n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n,0n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n,0n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n,0n]]],ut=m.addFunction(ct+\"_frobeniusMap\"+q);ut.addParam(\"x\",\"i32\"),ut.addParam(\"r\",\"i32\");const ot=ut.getCodeBuilder();for(let at=0;at<6;at++){const Lt=at==0?ot.getLocal(\"x\"):ot.i32_add(ot.getLocal(\"x\"),ot.i32_const(at*I)),pt=Lt,Et=ot.i32_add(ot.getLocal(\"x\"),ot.i32_const(at*I+y)),At=at==0?ot.getLocal(\"r\"):ot.i32_add(ot.getLocal(\"r\"),ot.i32_const(at*I)),mt=At,Rt=ot.i32_add(ot.getLocal(\"r\"),ot.i32_const(at*I+y)),Nt=rt(c[Math.floor(at/3)][q%12],X[at%3][q%6]),kt=m.alloc([...n.bigInt2BytesLE(ft(Nt[0]),N),...n.bigInt2BytesLE(ft(Nt[1]),N)]);q%2==1?ut.addCode(ot.call(K+\"_copy\",pt,mt),ot.call(K+\"_neg\",Et,Rt),ot.call(B+\"_mul\",At,ot.i32_const(kt),At)):ut.addCode(ot.call(B+\"_mul\",Lt,ot.i32_const(kt),At))}function rt(at,Lt){const pt=at[0],Et=at[1],At=Lt[0],mt=Lt[1],Rt=[(pt*At-Et*mt)%P,(pt*mt+Et*At)%P];return C(Rt[0])&&(Rt[0]=Rt[0]+P),Rt}}function ne(){const q=m.addFunction(Q+\"__cyclotomicSquare\");q.addParam(\"x\",\"i32\"),q.addParam(\"r\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"x\"),ut=c.i32_add(c.getLocal(\"x\"),c.i32_const(I)),ot=c.i32_add(c.getLocal(\"x\"),c.i32_const(2*I)),rt=c.i32_add(c.getLocal(\"x\"),c.i32_const(3*I)),at=c.i32_add(c.getLocal(\"x\"),c.i32_const(4*I)),Lt=c.i32_add(c.getLocal(\"x\"),c.i32_const(5*I)),pt=c.getLocal(\"r\"),Et=c.i32_add(c.getLocal(\"r\"),c.i32_const(I)),At=c.i32_add(c.getLocal(\"r\"),c.i32_const(2*I)),mt=c.i32_add(c.getLocal(\"r\"),c.i32_const(3*I)),Rt=c.i32_add(c.getLocal(\"r\"),c.i32_const(4*I)),Nt=c.i32_add(c.getLocal(\"r\"),c.i32_const(5*I)),kt=c.i32_const(m.alloc(I)),zt=c.i32_const(m.alloc(I)),Gt=c.i32_const(m.alloc(I)),Yt=c.i32_const(m.alloc(I)),Zt=c.i32_const(m.alloc(I)),Jt=c.i32_const(m.alloc(I)),Qt=c.i32_const(m.alloc(I)),Kt=c.i32_const(m.alloc(I));q.addCode(c.call(B+\"_mul\",X,at,Qt),c.call(B+\"_mulNR\",at,kt),c.call(B+\"_add\",X,kt,kt),c.call(B+\"_add\",X,at,Kt),c.call(B+\"_mul\",Kt,kt,kt),c.call(B+\"_mulNR\",Qt,Kt),c.call(B+\"_add\",Qt,Kt,Kt),c.call(B+\"_sub\",kt,Kt,kt),c.call(B+\"_add\",Qt,Qt,zt),c.call(B+\"_mul\",rt,ot,Qt),c.call(B+\"_mulNR\",ot,Gt),c.call(B+\"_add\",rt,Gt,Gt),c.call(B+\"_add\",rt,ot,Kt),c.call(B+\"_mul\",Kt,Gt,Gt),c.call(B+\"_mulNR\",Qt,Kt),c.call(B+\"_add\",Qt,Kt,Kt),c.call(B+\"_sub\",Gt,Kt,Gt),c.call(B+\"_add\",Qt,Qt,Yt),c.call(B+\"_mul\",ut,Lt,Qt),c.call(B+\"_mulNR\",Lt,Zt),c.call(B+\"_add\",ut,Zt,Zt),c.call(B+\"_add\",ut,Lt,Kt),c.call(B+\"_mul\",Kt,Zt,Zt),c.call(B+\"_mulNR\",Qt,Kt),c.call(B+\"_add\",Qt,Kt,Kt),c.call(B+\"_sub\",Zt,Kt,Zt),c.call(B+\"_add\",Qt,Qt,Jt),c.call(B+\"_sub\",kt,X,pt),c.call(B+\"_add\",pt,pt,pt),c.call(B+\"_add\",kt,pt,pt),c.call(B+\"_add\",zt,at,Rt),c.call(B+\"_add\",Rt,Rt,Rt),c.call(B+\"_add\",zt,Rt,Rt),c.call(B+\"_mul\",Jt,c.i32_const(r),Kt),c.call(B+\"_add\",Kt,rt,mt),c.call(B+\"_add\",mt,mt,mt),c.call(B+\"_add\",Kt,mt,mt),c.call(B+\"_sub\",Zt,ot,At),c.call(B+\"_add\",At,At,At),c.call(B+\"_add\",Zt,At,At),c.call(B+\"_sub\",Gt,ut,Et),c.call(B+\"_add\",Et,Et,Et),c.call(B+\"_add\",Gt,Et,Et),c.call(B+\"_add\",Yt,Lt,Nt),c.call(B+\"_add\",Nt,Nt,Nt),c.call(B+\"_add\",Yt,Nt,Nt))}function te(q,c,X){const ut=Vt(q).map(At=>At==-1?255:At),ot=m.alloc(ut),rt=m.addFunction(Q+\"__cyclotomicExp_\"+X);rt.addParam(\"x\",\"i32\"),rt.addParam(\"r\",\"i32\"),rt.addLocal(\"bit\",\"i32\"),rt.addLocal(\"i\",\"i32\");const at=rt.getCodeBuilder(),Lt=at.getLocal(\"x\"),pt=at.getLocal(\"r\"),Et=at.i32_const(m.alloc(_));rt.addCode(at.call(ct+\"_conjugate\",Lt,Et),at.call(ct+\"_one\",pt),at.if(at.teeLocal(\"bit\",at.i32_load8_s(at.i32_const(ut.length-1),ot)),at.if(at.i32_eq(at.getLocal(\"bit\"),at.i32_const(1)),at.call(ct+\"_mul\",pt,Lt,pt),at.call(ct+\"_mul\",pt,Et,pt))),at.setLocal(\"i\",at.i32_const(ut.length-2)),at.block(at.loop(at.call(Q+\"__cyclotomicSquare\",pt,pt),at.if(at.teeLocal(\"bit\",at.i32_load8_s(at.getLocal(\"i\"),ot)),at.if(at.i32_eq(at.getLocal(\"bit\"),at.i32_const(1)),at.call(ct+\"_mul\",pt,Lt,pt),at.call(ct+\"_mul\",pt,Et,pt))),at.br_if(1,at.i32_eqz(at.getLocal(\"i\"))),at.setLocal(\"i\",at.i32_sub(at.getLocal(\"i\"),at.i32_const(1))),at.br(0)))),rt.addCode(at.call(ct+\"_conjugate\",pt,pt))}function Me(){ne(),te(xt,b,\"w0\");const q=m.addFunction(Q+\"_finalExponentiation\");q.addParam(\"x\",\"i32\"),q.addParam(\"r\",\"i32\");const c=q.getCodeBuilder(),X=c.getLocal(\"x\"),ut=c.getLocal(\"r\"),ot=c.i32_const(m.alloc(_)),rt=c.i32_const(m.alloc(_)),at=c.i32_const(m.alloc(_)),Lt=c.i32_const(m.alloc(_)),pt=c.i32_const(m.alloc(_)),Et=c.i32_const(m.alloc(_)),At=c.i32_const(m.alloc(_));q.addCode(c.call(ct+\"_frobeniusMap6\",X,ot),c.call(ct+\"_inverse\",X,rt),c.call(ct+\"_mul\",ot,rt,at),c.call(ct+\"_copy\",at,rt),c.call(ct+\"_frobeniusMap2\",at,at),c.call(ct+\"_mul\",at,rt,at),c.call(Q+\"__cyclotomicSquare\",at,rt),c.call(ct+\"_conjugate\",rt,rt),c.call(Q+\"__cyclotomicExp_w0\",at,Lt),c.call(Q+\"__cyclotomicSquare\",Lt,pt),c.call(ct+\"_mul\",rt,Lt,Et),c.call(Q+\"__cyclotomicExp_w0\",Et,rt),c.call(Q+\"__cyclotomicExp_w0\",rt,ot),c.call(Q+\"__cyclotomicExp_w0\",ot,At),c.call(ct+\"_mul\",At,pt,At),c.call(Q+\"__cyclotomicExp_w0\",At,pt),c.call(ct+\"_conjugate\",Et,Et),c.call(ct+\"_mul\",pt,Et,pt),c.call(ct+\"_mul\",pt,at,pt),c.call(ct+\"_conjugate\",at,Et),c.call(ct+\"_mul\",rt,at,rt),c.call(ct+\"_frobeniusMap3\",rt,rt),c.call(ct+\"_mul\",At,Et,At),c.call(ct+\"_frobeniusMap1\",At,At),c.call(ct+\"_mul\",Lt,ot,Lt),c.call(ct+\"_frobeniusMap2\",Lt,Lt),c.call(ct+\"_mul\",Lt,rt,Lt),c.call(ct+\"_mul\",Lt,At,Lt),c.call(ct+\"_mul\",Lt,pt,ut))}function ge(){const q=m.addFunction(Q+\"_finalExponentiationOld\");q.addParam(\"x\",\"i32\"),q.addParam(\"r\",\"i32\");const X=m.alloc(n.bigInt2BytesLE(322277361516934140462891564586510139908379969514828494218366688025288661041104682794998680497580008899973249814104447692778988208376779573819485263026159588510513834876303014016798809919343532899164848730280942609956670917565618115867287399623286813270357901731510188149934363360381614501334086825442271920079363289954510565375378443704372994881406797882676971082200626541916413184642520269678897559532260949334760604962086348898118982248842634379637598665468817769075878555493752214492790122785850202957575200176084204422751485957336465472324810982833638490904279282696134323072515220044451592646885410572234451732790590013479358343841220074174848221722017083597872017638514103174122784843925578370430843522959600095676285723737049438346544753168912974976791528535276317256904336520179281145394686565050419250614107803233314658825463117900250701199181529205942363159325765991819433914303908860460720581408201373164047773794825411011922305820065611121544561808414055302212057471395719432072209245600258134364584636810093520285711072578721435517884103526483832733289802426157301542744476740008494780363354305116978805620671467071400711358839553375340724899735460480144599782014906586543813292157922220645089192130209334926661588737007768565838519456601560804957985667880395221049249803753582637708560n,544)),ut=q.getCodeBuilder();q.addCode(ut.call(ct+\"_exp\",ut.getLocal(\"x\"),ut.i32_const(X),ut.i32_const(544),ut.getLocal(\"r\")))}const be=m.alloc(qt),ye=m.alloc(W);function me(q){const c=m.addFunction(Q+\"_pairingEq\"+q);for(let rt=0;rt<q;rt++)c.addParam(\"p_\"+rt,\"i32\"),c.addParam(\"q_\"+rt,\"i32\");c.addParam(\"c\",\"i32\"),c.setReturnType(\"i32\");const X=c.getCodeBuilder(),ut=X.i32_const(m.alloc(_)),ot=X.i32_const(m.alloc(_));c.addCode(X.call(ct+\"_one\",ut));for(let rt=0;rt<q;rt++)c.addCode(X.call(Q+\"_prepareG1\",X.getLocal(\"p_\"+rt),X.i32_const(be))),c.addCode(X.call(Q+\"_prepareG2\",X.getLocal(\"q_\"+rt),X.i32_const(ye))),c.addCode(X.if(X.i32_eqz(X.call(S+\"_inGroupAffine\",X.i32_const(be))),X.ret(X.i32_const(0))),X.if(X.i32_eqz(X.call(_t+\"_inGroupAffine\",X.i32_const(ye))),X.ret(X.i32_const(0)))),c.addCode(X.call(Q+\"_millerLoop\",X.i32_const(be),X.i32_const(ye),ot)),c.addCode(X.call(ct+\"_mul\",ut,ot,ut));c.addCode(X.call(Q+\"_finalExponentiation\",ut,ut)),c.addCode(X.call(ct+\"_eq\",ut,X.getLocal(\"c\")))}function Ce(){const q=m.addFunction(Q+\"_pairing\");q.addParam(\"p\",\"i32\"),q.addParam(\"q\",\"i32\"),q.addParam(\"r\",\"i32\");const c=q.getCodeBuilder(),X=c.i32_const(m.alloc(_));q.addCode(c.call(Q+\"_prepareG1\",c.getLocal(\"p\"),c.i32_const(be))),q.addCode(c.call(Q+\"_prepareG2\",c.getLocal(\"q\"),c.i32_const(ye))),q.addCode(c.call(Q+\"_millerLoop\",c.i32_const(be),c.i32_const(ye),X)),q.addCode(c.call(Q+\"_finalExponentiation\",X,c.getLocal(\"r\")))}function Te(){const q=m.addFunction(_t+\"_inGroupAffine\");q.addParam(\"p\",\"i32\"),q.setReturnType(\"i32\");const c=q.getCodeBuilder(),X=[2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279894n,2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279893n],ut=4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,ot=[2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n,2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n],rt=c.i32_const(m.alloc([...n.bigInt2BytesLE(ft(X[0]),N),...n.bigInt2BytesLE(ft(X[1]),N)])),at=c.i32_const(m.alloc(n.bigInt2BytesLE(ft(ut),N))),Lt=c.i32_const(m.alloc([...n.bigInt2BytesLE(ft(ot[0]),N),...n.bigInt2BytesLE(ft(ot[1]),N)])),pt=c.i32_const(m.alloc(n.bigInt2BytesLE(xt,8))),Et=c.getLocal(\"p\"),At=c.i32_add(c.getLocal(\"p\"),c.i32_const(I)),mt=c.i32_const(m.alloc(y)),Rt=c.i32_const(m.alloc(I)),Nt=c.i32_const(m.alloc(I)),kt=m.alloc(I*2),zt=c.i32_const(kt),Gt=c.i32_const(kt),Yt=c.i32_const(kt),Zt=c.i32_const(kt+y),Jt=c.i32_const(kt+I),Qt=c.i32_const(kt+I),Kt=c.i32_const(kt+I+y),Ee=m.alloc(I*3),Pe=c.i32_const(Ee),De=c.i32_const(Ee),mn=c.i32_const(Ee),ke=c.i32_const(Ee+y),Qi=c.i32_const(Ee+I),Ye=c.i32_const(Ee+I),rn=c.i32_const(Ee+I+y),Ni=c.i32_const(Ee+I*2);q.addCode(c.if(c.call(_t+\"_isZeroAffine\",c.getLocal(\"p\")),c.ret(c.i32_const(1))),c.if(c.i32_eqz(c.call(_t+\"_inCurveAffine\",c.getLocal(\"p\"))),c.ret(c.i32_const(0))),c.call(B+\"_mul\",Et,rt,Rt),c.call(B+\"_mul\",At,rt,Nt),c.call(B+\"_mul1\",Rt,at,Gt),c.call(B+\"_neg\",Nt,Jt),c.call(B+\"_neg\",Rt,De),c.call(B+\"_mul\",Nt,Lt,Qi),c.call(K+\"_sub\",Yt,Zt,mt),c.call(K+\"_add\",Yt,Zt,Zt),c.call(K+\"_copy\",mt,Yt),c.call(K+\"_sub\",Qt,Kt,mt),c.call(K+\"_add\",Qt,Kt,Kt),c.call(K+\"_copy\",mt,Qt),c.call(K+\"_add\",mn,ke,mt),c.call(K+\"_sub\",mn,ke,ke),c.call(K+\"_copy\",mt,mn),c.call(K+\"_sub\",rn,Ye,mt),c.call(K+\"_add\",Ye,rn,rn),c.call(K+\"_copy\",mt,Ye),c.call(B+\"_one\",Ni),c.call(_t+\"_timesScalar\",Pe,pt,c.i32_const(8),Pe),c.call(_t+\"_addMixed\",Pe,zt,Pe),c.ret(c.call(_t+\"_eqMixed\",Pe,c.getLocal(\"p\"))));const wn=m.addFunction(_t+\"_inGroup\");wn.addParam(\"pIn\",\"i32\"),wn.setReturnType(\"i32\");const Ke=wn.getCodeBuilder(),gi=Ke.i32_const(m.alloc(I*2));wn.addCode(Ke.call(_t+\"_toAffine\",Ke.getLocal(\"pIn\"),gi),Ke.ret(Ke.call(_t+\"_inGroupAffine\",gi)))}function Re(){const q=m.addFunction(S+\"_inGroupAffine\");q.addParam(\"p\",\"i32\"),q.setReturnType(\"i32\");const c=q.getCodeBuilder(),X=4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,ut=793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,ot=(xt*xt-1n)/3n,rt=c.i32_const(m.alloc(n.bigInt2BytesLE(ft(X),N))),at=c.i32_const(m.alloc(n.bigInt2BytesLE(ft(ut),N))),Lt=c.i32_const(m.alloc(n.bigInt2BytesLE(ot,16))),pt=c.getLocal(\"p\"),Et=c.i32_add(c.getLocal(\"p\"),c.i32_const(y)),At=m.alloc(y*3),mt=c.i32_const(At),Rt=c.i32_const(At),Nt=c.i32_const(At+y),kt=m.alloc(y*2),zt=c.i32_const(kt),Gt=c.i32_const(kt),Yt=c.i32_const(kt+y);q.addCode(c.if(c.call(S+\"_isZeroAffine\",c.getLocal(\"p\")),c.ret(c.i32_const(1))),c.if(c.i32_eqz(c.call(S+\"_inCurveAffine\",c.getLocal(\"p\"))),c.ret(c.i32_const(0))),c.call(K+\"_mul\",pt,rt,Rt),c.call(K+\"_copy\",Et,Nt),c.call(K+\"_mul\",pt,at,Gt),c.call(K+\"_copy\",Et,Yt),c.call(S+\"_doubleAffine\",mt,mt),c.call(S+\"_subMixed\",mt,c.getLocal(\"p\"),mt),c.call(S+\"_subMixed\",mt,zt,mt),c.call(S+\"_timesScalar\",mt,Lt,c.i32_const(16),mt),c.ret(c.call(S+\"_eqMixed\",mt,zt)));const Zt=m.addFunction(S+\"_inGroup\");Zt.addParam(\"pIn\",\"i32\"),Zt.setReturnType(\"i32\");const Jt=Zt.getCodeBuilder(),Qt=Jt.i32_const(m.alloc(y*2));Zt.addCode(Jt.call(S+\"_toAffine\",Jt.getLocal(\"pIn\"),Qt),Jt.ret(Jt.call(S+\"_inGroupAffine\",Qt)))}for(let q=0;q<10;q++)Xt(q),m.exportFunction(ct+\"_frobeniusMap\"+q);Re(),Te(),A(),p(),v(),R(),jt(),ge(),Me();for(let q=1;q<=5;q++)me(q),m.exportFunction(Q+\"_pairingEq\"+q);Ce(),m.exportFunction(Q+\"_pairing\"),m.exportFunction(Q+\"_prepareG1\"),m.exportFunction(Q+\"_prepareG2\"),m.exportFunction(Q+\"_millerLoop\"),m.exportFunction(Q+\"_finalExponentiation\"),m.exportFunction(Q+\"_finalExponentiationOld\"),m.exportFunction(Q+\"__cyclotomicSquare\"),m.exportFunction(Q+\"__cyclotomicExp_w0\"),m.exportFunction(k+\"_mul1\"),m.exportFunction(k+\"_mul01\"),m.exportFunction(ct+\"_mul014\"),m.exportFunction(S+\"_inGroupAffine\"),m.exportFunction(S+\"_inGroup\"),m.exportFunction(_t+\"_inGroupAffine\"),m.exportFunction(_t+\"_inGroup\")},fo}var oc;function xd(){return oc||(oc=1,qn.buildBn128=Ed(),qn.buildBls12381=Bd(),qn.buildF1m=Di()),qn}var $r=xd();function Zo(n){if(typeof n==\"bigint\"||n.eq!==void 0)return n.toString(10);if(n instanceof Uint8Array)return Xn(n,0);if(Array.isArray(n))return n.map(Zo);if(typeof n==\"object\"){const e={};return Object.keys(n).forEach(i=>{e[i]=Zo(n[i])}),e}else return n}function jo(n){if(typeof n==\"string\"&&/^[0-9]+$/.test(n))return BigInt(n);if(typeof n==\"string\"&&/^0x[0-9a-fA-F]+$/.test(n))return BigInt(n);if(Array.isArray(n))return n.map(jo);if(typeof n==\"object\"){if(n===null)return null;const e={};return Object.keys(n).forEach(i=>{e[i]=jo(n[i])}),e}else return n}function vd(n){let e=BigInt(0),t=n.length,i=0;const o=new DataView(n.buffer,n.byteOffset,n.byteLength);for(;t>0;)t>=4?(t-=4,e+=BigInt(o.getUint32(t))<<BigInt(i*8),i+=4):t>=2?(t-=2,e+=BigInt(o.getUint16(t))<<BigInt(i*8),i+=2):(t-=1,e+=BigInt(o.getUint8(t))<<BigInt(i*8),i+=1);return e}function Fd(n,e){let t=n;const i=new Uint8Array(e),o=new DataView(i.buffer);let a=e;for(;a>0;)a-4>=0?(a-=4,o.setUint32(a,Number(t&BigInt(4294967295))),t=t>>BigInt(32)):a-2>=0?(a-=2,o.setUint16(a,Number(t&BigInt(65535))),t=t>>BigInt(16)):(a-=1,o.setUint8(a,Number(t&BigInt(255))),t=t>>BigInt(8));if(t)throw new Error(\"Number does not fit in this length\");return i}function Sd(n){let e=BigInt(0),t=0;const i=new DataView(n.buffer,n.byteOffset,n.byteLength);for(;t<n.length;)t+4<=n.length?(e+=BigInt(i.getUint32(t,!0))<<BigInt(t*8),t+=4):t+4<=n.length?(e+=BigInt(i.getUint16(t,!0))<<BigInt(t*8),t+=2):(e+=BigInt(i.getUint8(t,!0))<<BigInt(t*8),t+=1);return e}function Yr(n,e){let t=n;typeof e>\"u\"&&(e=Math.floor((ri(n)-1)/8)+1,e==0&&(e=1));const i=new Uint8Array(e),o=new DataView(i.buffer);let a=0;for(;a<e;)a+4<=e?(o.setUint32(a,Number(t&BigInt(4294967295)),!0),a+=4,t=t>>BigInt(32)):a+2<=e?(o.setUint16(Number(a,t&BigInt(65535)),!0),a+=2,t=t>>BigInt(16)):(o.setUint8(Number(a,t&BigInt(255)),!0),a+=1,t=t>>BigInt(8));if(t)throw new Error(\"Number does not fit in this length\");return i}function Vo(n,e){if(typeof e==\"bigint\"||e.eq!==void 0)return e.toString(10);if(e instanceof Uint8Array)return n.toString(n.e(e));if(Array.isArray(e))return e.map(Vo.bind(this,n));if(typeof e==\"object\"){const t={};return Object.keys(e).forEach(o=>{t[o]=Vo(n,e[o])}),t}else return e}function $o(n,e){if(typeof e==\"string\"&&/^[0-9]+$/.test(e))return n.e(e);if(typeof e==\"string\"&&/^0x[0-9a-fA-F]+$/.test(e))return n.e(e);if(Array.isArray(e))return e.map($o.bind(this,n));if(typeof e==\"object\"){if(e===null)return null;const t={};return Object.keys(e).forEach(o=>{t[o]=$o(n,e[o])}),t}else return e}const Hn=[];for(let n=0;n<256;n++)Hn[n]=Od(n,8);function Od(n,e){let t=0,i=n;for(let o=0;o<e;o++)t<<=1,t=t|i&1,i>>=1;return t}function Wr(n,e){return(Hn[n>>>24]|Hn[n>>>16&255]<<8|Hn[n>>>8&255]<<16|Hn[n&255]<<24)>>>32-e}function we(n){return(n&4294901760?(n&=4294901760,16):0)|(n&4278255360?(n&=4278255360,8):0)|(n&4042322160?(n&=4042322160,4):0)|(n&3435973836?(n&=3435973836,2):0)|(n&2863311530)!==0}function Xr(n,e){const t=n.byteLength/e,i=we(t);if(t!=1<<i)throw new Error(\"Invalid number of pointers\");for(let o=0;o<t;o++){const a=Wr(o,i);if(o>a){const s=n.slice(o*e,(o+1)*e);n.set(n.slice(a*e,(a+1)*e),o*e),n.set(s,a*e)}}}function pa(n,e){const t=new Uint8Array(e*n.length);for(let i=0;i<n.length;i++)t.set(n[i],i*e);return t}function Oi(n,e){const t=n.byteLength/e,i=new Array(t);for(let o=0;o<t;o++)i[o]=n.slice(o*e,o*e+e);return i}const Pd=Object.freeze(Object.defineProperty({__proto__:null,array2buffer:pa,beBuff2int:vd,beInt2Buff:Fd,bitReverse:Wr,buffReverseBits:Xr,buffer2array:Oi,leBuff2int:Sd,leInt2Buff:Yr,log2:we,stringifyBigInts:Zo,stringifyFElements:Vo,unstringifyBigInts:jo,unstringifyFElements:$o},Symbol.toStringTag,{value:\"Module\"})),pe=1<<30;class ce{constructor(e){this.buffers=[],this.byteLength=e;for(let t=0;t<e;t+=pe){const i=Math.min(e-t,pe);this.buffers.push(new Uint8Array(i))}}slice(e,t){t===void 0&&(t=this.byteLength),e===void 0&&(e=0);const i=t-e,o=Math.floor(e/pe),a=Math.floor((e+i-1)/pe);if(o==a||i==0)return this.buffers[o].slice(e%pe,e%pe+i);let s,l=o,g=e%pe,d=i;for(;d>0;){const u=g+d>pe?pe-g:d,w=new Uint8Array(this.buffers[l].buffer,this.buffers[l].byteOffset+g,u);if(u==i)return w.slice();s||(i<=pe?s=new Uint8Array(i):s=new ce(i)),s.set(w,i-d),d=d-u,l++,g=0}return s}set(e,t){t===void 0&&(t=0);const i=e.byteLength;if(i==0)return;const o=Math.floor(t/pe),a=Math.floor((t+i-1)/pe);if(o==a)return e instanceof ce&&e.buffers.length==1?this.buffers[o].set(e.buffers[0],t%pe):this.buffers[o].set(e,t%pe);let s=o,l=t%pe,g=i;for(;g>0;){const d=l+g>pe?pe-l:g,u=e.slice(i-g,i-g+d);new Uint8Array(this.buffers[s].buffer,this.buffers[s].byteOffset+l,d).set(u),g=g-d,s++,l=0}}}function tn(n,e,t,i){return async function(a){const s=Math.floor(a.byteLength/t);if(s*t!==a.byteLength)throw new Error(\"Invalid buffer size\");const l=Math.floor(s/n.concurrency),g=[];for(let C=0;C<n.concurrency;C++){let h;if(C<n.concurrency-1?h=l:h=s-C*l,h==0)continue;const O=[{cmd:\"ALLOCSET\",var:0,buff:a.slice(C*l*t,C*l*t+h*t)},{cmd:\"ALLOC\",var:1,len:i*h},{cmd:\"CALL\",fnName:e,params:[{var:0},{val:h},{var:1}]},{cmd:\"GET\",out:0,var:1,len:i*h}];g.push(n.queueAction(O))}const d=await Promise.all(g);let u;a instanceof ce?u=new ce(s*i):u=new Uint8Array(s*i);let w=0;for(let C=0;C<d.length;C++)u.set(d[C][0],w),w+=d[C][0].byteLength;return u}}class ac{constructor(e,t,i,o){if(this.tm=e,this.prefix=t,this.p=o,this.n8=i,this.type=\"F1\",this.m=1,this.half=xn(o,ln),this.bitLength=ri(o),this.mask=$e(Fi(ln,this.bitLength),ln),this.pOp1=e.alloc(i),this.pOp2=e.alloc(i),this.pOp3=e.alloc(i),this.tm.instance.exports[t+\"_zero\"](this.pOp1),this.zero=this.tm.getBuff(this.pOp1,this.n8),this.tm.instance.exports[t+\"_one\"](this.pOp1),this.one=this.tm.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one),this.n64=Math.floor(i/8),this.n32=Math.floor(i/4),this.n64*8!=this.n8)throw new Error(\"n8 must be a multiple of 8\");this.half=xn(this.p,ln),this.nqr=this.two;let a=this.exp(this.nqr,this.half);for(;!this.eq(a,this.negone);)this.nqr=this.add(this.nqr,this.one),a=this.exp(this.nqr,this.half);this.shift=this.mul(this.nqr,this.nqr),this.shiftInv=this.inv(this.shift),this.s=0;let s=$e(this.p,ln);for(;!la(s);)this.s=this.s+1,s=xn(s,ln);this.w=[],this.w[this.s]=this.exp(this.nqr,s);for(let l=this.s-1;l>=0;l--)this.w[l]=this.square(this.w[l+1]);if(!this.eq(this.w[0],this.one))throw new Error(\"Error calculating roots of unity\");this.batchToMontgomery=tn(e,t+\"_batchToMontgomery\",this.n8,this.n8),this.batchFromMontgomery=tn(e,t+\"_batchFromMontgomery\",this.n8,this.n8)}op2(e,t,i){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,i),this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(e,t,i){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,i),!!this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp2)}op1(e,t){return this.tm.setBuff(this.pOp1,t),this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(e,t){return this.tm.setBuff(this.pOp1,t),!!this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp3)}add(e,t){return this.op2(\"_add\",e,t)}eq(e,t){return this.op2Bool(\"_eq\",e,t)}isZero(e){return this.op1Bool(\"_isZero\",e)}sub(e,t){return this.op2(\"_sub\",e,t)}neg(e){return this.op1(\"_neg\",e)}inv(e){return this.op1(\"_inverse\",e)}toMontgomery(e){return this.op1(\"_toMontgomery\",e)}fromMontgomery(e){return this.op1(\"_fromMontgomery\",e)}mul(e,t){return this.op2(\"_mul\",e,t)}div(e,t){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,t),this.tm.instance.exports[this.prefix+\"_inverse\"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+\"_mul\"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(e){return this.op1(\"_square\",e)}isSquare(e){return this.op1Bool(\"_isSquare\",e)}sqrt(e){return this.op1(\"_sqrt\",e)}exp(e,t){return t instanceof Uint8Array||(t=On(ue(t))),this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,t),this.tm.instance.exports[this.prefix+\"_exp\"](this.pOp1,this.pOp2,t.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}isNegative(e){return this.op1Bool(\"_isNegative\",e)}e(e,t){if(e instanceof Uint8Array)return e;let i=ue(e,t);Ir(i)?(i=xr(i),Ho(i,this.p)&&(i=qe(i,this.p)),i=$e(this.p,i)):Ho(i,this.p)&&(i=qe(i,this.p));const o=Yr(i,this.n8);return this.toMontgomery(o)}toString(e,t){const i=this.fromMontgomery(e),o=Xn(i,0);return Pr(o,t)}fromRng(e){let t;const i=new Uint8Array(this.n8);do{t=Ur;for(let o=0;o<this.n64;o++)t=da(t,Fi(e.nextU64(),64*o));t=ua(t,this.mask)}while(Fr(t,this.p));return Wn(i,0,t,this.n8),i}random(){return this.fromRng(_a())}toObject(e){const t=this.fromMontgomery(e);return Xn(t,0)}fromObject(e){const t=new Uint8Array(this.n8);return Wn(t,0,e,this.n8),this.toMontgomery(t)}toRprLE(e,t,i){e.set(this.fromMontgomery(i),t)}toRprBE(e,t,i){const o=this.fromMontgomery(i);for(let a=0;a<this.n8/2;a++){const s=o[a];o[a]=o[this.n8-1-a],o[this.n8-1-a]=s}e.set(o,t)}fromRprLE(e,t){t=t||0;const i=e.slice(t,t+this.n8);return this.toMontgomery(i)}async batchInverse(e){let t=!1;const i=this.n8,o=this.n8;Array.isArray(e)?(e=pa(e,i),t=!0):e=e.slice(0,e.byteLength);const a=Math.floor(e.byteLength/i);if(a*i!==e.byteLength)throw new Error(\"Invalid buffer size\");const s=Math.floor(a/this.tm.concurrency),l=[];for(let w=0;w<this.tm.concurrency;w++){let C;if(w<this.tm.concurrency-1?C=s:C=a-w*s,C==0)continue;const m=[{cmd:\"ALLOCSET\",var:0,buff:e.slice(w*s*i,w*s*i+C*i)},{cmd:\"ALLOC\",var:1,len:o*C},{cmd:\"CALL\",fnName:this.prefix+\"_batchInverse\",params:[{var:0},{val:i},{val:C},{var:1},{val:o}]},{cmd:\"GET\",out:0,var:1,len:o*C}];l.push(this.tm.queueAction(m))}const g=await Promise.all(l);let d;e instanceof ce?d=new ce(a*o):d=new Uint8Array(a*o);let u=0;for(let w=0;w<g.length;w++)d.set(g[w][0],u),u+=g[w][0].byteLength;return t?Oi(d,o):d}}class cc{constructor(e,t,i){this.tm=e,this.prefix=t,this.F=i,this.type=\"F2\",this.m=i.m*2,this.n8=this.F.n8*2,this.n32=this.F.n32*2,this.n64=this.F.n64*2,this.pOp1=e.alloc(i.n8*2),this.pOp2=e.alloc(i.n8*2),this.pOp3=e.alloc(i.n8*2),this.tm.instance.exports[t+\"_zero\"](this.pOp1),this.zero=e.getBuff(this.pOp1,this.n8),this.tm.instance.exports[t+\"_one\"](this.pOp1),this.one=e.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one)}op2(e,t,i){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,i),this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(e,t,i){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,i),!!this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp2)}op1(e,t){return this.tm.setBuff(this.pOp1,t),this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(e,t){return this.tm.setBuff(this.pOp1,t),!!this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp3)}add(e,t){return this.op2(\"_add\",e,t)}eq(e,t){return this.op2Bool(\"_eq\",e,t)}isZero(e){return this.op1Bool(\"_isZero\",e)}sub(e,t){return this.op2(\"_sub\",e,t)}neg(e){return this.op1(\"_neg\",e)}inv(e){return this.op1(\"_inverse\",e)}isNegative(e){return this.op1Bool(\"_isNegative\",e)}toMontgomery(e){return this.op1(\"_toMontgomery\",e)}fromMontgomery(e){return this.op1(\"_fromMontgomery\",e)}mul(e,t){return this.op2(\"_mul\",e,t)}mul1(e,t){return this.op2(\"_mul1\",e,t)}div(e,t){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,t),this.tm.instance.exports[this.prefix+\"_inverse\"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+\"_mul\"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(e){return this.op1(\"_square\",e)}isSquare(e){return this.op1Bool(\"_isSquare\",e)}sqrt(e){return this.op1(\"_sqrt\",e)}exp(e,t){return t instanceof Uint8Array||(t=On(ue(t))),this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,t),this.tm.instance.exports[this.prefix+\"_exp\"](this.pOp1,this.pOp2,t.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}e(e,t){if(e instanceof Uint8Array)return e;if(Array.isArray(e)&&e.length==2){const i=this.F.e(e[0],t),o=this.F.e(e[1],t),a=new Uint8Array(this.F.n8*2);return a.set(i),a.set(o,this.F.n8*2),a}else throw new Error(\"invalid F2\")}toString(e,t){const i=this.F.toString(e.slice(0,this.F.n8),t),o=this.F.toString(e.slice(this.F.n8),t);return`[${i}, ${o}]`}fromRng(e){const t=this.F.fromRng(e),i=this.F.fromRng(e),o=new Uint8Array(this.F.n8*2);return o.set(t),o.set(i,this.F.n8),o}random(){return this.fromRng(_a())}toObject(e){const t=this.F.toObject(e.slice(0,this.F.n8)),i=this.F.toObject(e.slice(this.F.n8,this.F.n8*2));return[t,i]}fromObject(e){const t=new Uint8Array(this.F.n8*2),i=this.F.fromObject(e[0]),o=this.F.fromObject(e[1]);return t.set(i),t.set(o,this.F.n8),t}c1(e){return e.slice(0,this.F.n8)}c2(e){return e.slice(this.F.n8)}}class Ud{constructor(e,t,i){this.tm=e,this.prefix=t,this.F=i,this.type=\"F3\",this.m=i.m*3,this.n8=this.F.n8*3,this.n32=this.F.n32*3,this.n64=this.F.n64*3,this.pOp1=e.alloc(i.n8*3),this.pOp2=e.alloc(i.n8*3),this.pOp3=e.alloc(i.n8*3),this.tm.instance.exports[t+\"_zero\"](this.pOp1),this.zero=e.getBuff(this.pOp1,this.n8),this.tm.instance.exports[t+\"_one\"](this.pOp1),this.one=e.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one)}op2(e,t,i){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,i),this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(e,t,i){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,i),!!this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp2)}op1(e,t){return this.tm.setBuff(this.pOp1,t),this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(e,t){return this.tm.setBuff(this.pOp1,t),!!this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp3)}eq(e,t){return this.op2Bool(\"_eq\",e,t)}isZero(e){return this.op1Bool(\"_isZero\",e)}add(e,t){return this.op2(\"_add\",e,t)}sub(e,t){return this.op2(\"_sub\",e,t)}neg(e){return this.op1(\"_neg\",e)}inv(e){return this.op1(\"_inverse\",e)}isNegative(e){return this.op1Bool(\"_isNegative\",e)}toMontgomery(e){return this.op1(\"_toMontgomery\",e)}fromMontgomery(e){return this.op1(\"_fromMontgomery\",e)}mul(e,t){return this.op2(\"_mul\",e,t)}div(e,t){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,t),this.tm.instance.exports[this.prefix+\"_inverse\"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+\"_mul\"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(e){return this.op1(\"_square\",e)}isSquare(e){return this.op1Bool(\"_isSquare\",e)}sqrt(e){return this.op1(\"_sqrt\",e)}exp(e,t){return t instanceof Uint8Array||(t=On(ue(t))),this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,t),this.tm.instance.exports[this.prefix+\"_exp\"](this.pOp1,this.pOp2,t.byteLength,this.pOp3),this.getBuff(this.pOp3,this.n8)}e(e,t){if(e instanceof Uint8Array)return e;if(Array.isArray(e)&&e.length==3){const i=this.F.e(e[0],t),o=this.F.e(e[1],t),a=this.F.e(e[2],t),s=new Uint8Array(this.F.n8*3);return s.set(i),s.set(o,this.F.n8),s.set(a,this.F.n8*2),s}else throw new Error(\"invalid F3\")}toString(e,t){const i=this.F.toString(e.slice(0,this.F.n8),t),o=this.F.toString(e.slice(this.F.n8,this.F.n8*2),t),a=this.F.toString(e.slice(this.F.n8*2),t);return`[${i}, ${o}, ${a}]`}fromRng(e){const t=this.F.fromRng(e),i=this.F.fromRng(e),o=this.F.fromRng(e),a=new Uint8Array(this.F.n8*3);return a.set(t),a.set(i,this.F.n8),a.set(o,this.F.n8*2),a}random(){return this.fromRng(_a())}toObject(e){const t=this.F.toObject(e.slice(0,this.F.n8)),i=this.F.toObject(e.slice(this.F.n8,this.F.n8*2)),o=this.F.toObject(e.slice(this.F.n8*2,this.F.n8*3));return[t,i,o]}fromObject(e){const t=new Uint8Array(this.F.n8*3),i=this.F.fromObject(e[0]),o=this.F.fromObject(e[1]),a=this.F.fromObject(e[2]);return t.set(i),t.set(o,this.F.n8),t.set(a,this.F.n8*2),t}c1(e){return e.slice(0,this.F.n8)}c2(e){return e.slice(this.F.n8,this.F.n8*2)}c3(e){return e.slice(this.F.n8*2)}}class rc{constructor(e,t,i,o,a,s){this.tm=e,this.prefix=t,this.F=i,this.pOp1=e.alloc(i.n8*3),this.pOp2=e.alloc(i.n8*3),this.pOp3=e.alloc(i.n8*3),this.tm.instance.exports[t+\"_zero\"](this.pOp1),this.zero=this.tm.getBuff(this.pOp1,i.n8*3),this.tm.instance.exports[t+\"_zeroAffine\"](this.pOp1),this.zeroAffine=this.tm.getBuff(this.pOp1,i.n8*2),this.one=this.tm.getBuff(o,i.n8*3),this.g=this.one,this.oneAffine=this.tm.getBuff(o,i.n8*2),this.gAffine=this.oneAffine,this.b=this.tm.getBuff(a,i.n8),s&&(this.cofactor=On(s)),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one),this.batchLEMtoC=tn(e,t+\"_batchLEMtoC\",i.n8*2,i.n8),this.batchLEMtoU=tn(e,t+\"_batchLEMtoU\",i.n8*2,i.n8*2),this.batchCtoLEM=tn(e,t+\"_batchCtoLEM\",i.n8,i.n8*2),this.batchUtoLEM=tn(e,t+\"_batchUtoLEM\",i.n8*2,i.n8*2),this.batchToJacobian=tn(e,t+\"_batchToJacobian\",i.n8*2,i.n8*3),this.batchToAffine=tn(e,t+\"_batchToAffine\",i.n8*3,i.n8*2)}op2(e,t,i){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,i),this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}op2bool(e,t,i){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,i),!!this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp2,this.pOp3)}op1(e,t){return this.tm.setBuff(this.pOp1,t),this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}op1Affine(e,t){return this.tm.setBuff(this.pOp1,t),this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*2)}op1Bool(e,t){return this.tm.setBuff(this.pOp1,t),!!this.tm.instance.exports[this.prefix+e](this.pOp1,this.pOp3)}add(e,t){if(e.byteLength==this.F.n8*3){if(t.byteLength==this.F.n8*3)return this.op2(\"_add\",e,t);if(t.byteLength==this.F.n8*2)return this.op2(\"_addMixed\",e,t);throw new Error(\"invalid point size\")}else if(e.byteLength==this.F.n8*2){if(t.byteLength==this.F.n8*3)return this.op2(\"_addMixed\",t,e);if(t.byteLength==this.F.n8*2)return this.op2(\"_addAffine\",e,t);throw new Error(\"invalid point size\")}else throw new Error(\"invalid point size\")}sub(e,t){if(e.byteLength==this.F.n8*3){if(t.byteLength==this.F.n8*3)return this.op2(\"_sub\",e,t);if(t.byteLength==this.F.n8*2)return this.op2(\"_subMixed\",e,t);throw new Error(\"invalid point size\")}else if(e.byteLength==this.F.n8*2){if(t.byteLength==this.F.n8*3)return this.op2(\"_subMixed\",t,e);if(t.byteLength==this.F.n8*2)return this.op2(\"_subAffine\",e,t);throw new Error(\"invalid point size\")}else throw new Error(\"invalid point size\")}neg(e){if(e.byteLength==this.F.n8*3)return this.op1(\"_neg\",e);if(e.byteLength==this.F.n8*2)return this.op1Affine(\"_negAffine\",e);throw new Error(\"invalid point size\")}double(e){if(e.byteLength==this.F.n8*3)return this.op1(\"_double\",e);if(e.byteLength==this.F.n8*2)return this.op1(\"_doubleAffine\",e);throw new Error(\"invalid point size\")}isZero(e){if(e.byteLength==this.F.n8*3)return this.op1Bool(\"_isZero\",e);if(e.byteLength==this.F.n8*2)return this.op1Bool(\"_isZeroAffine\",e);throw new Error(\"invalid point size\")}timesScalar(e,t){t instanceof Uint8Array||(t=On(ue(t)));let i;if(e.byteLength==this.F.n8*3)i=this.prefix+\"_timesScalar\";else if(e.byteLength==this.F.n8*2)i=this.prefix+\"_timesScalarAffine\";else throw new Error(\"invalid point size\");return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,t),this.tm.instance.exports[i](this.pOp1,this.pOp2,t.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}timesFr(e,t){let i;if(e.byteLength==this.F.n8*3)i=this.prefix+\"_timesFr\";else if(e.byteLength==this.F.n8*2)i=this.prefix+\"_timesFrAffine\";else throw new Error(\"invalid point size\");return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,t),this.tm.instance.exports[i](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.F.n8*3)}eq(e,t){if(e.byteLength==this.F.n8*3){if(t.byteLength==this.F.n8*3)return this.op2bool(\"_eq\",e,t);if(t.byteLength==this.F.n8*2)return this.op2bool(\"_eqMixed\",e,t);throw new Error(\"invalid point size\")}else if(e.byteLength==this.F.n8*2){if(t.byteLength==this.F.n8*3)return this.op2bool(\"_eqMixed\",t,e);if(t.byteLength==this.F.n8*2)return this.op2bool(\"_eqAffine\",e,t);throw new Error(\"invalid point size\")}else throw new Error(\"invalid point size\")}toAffine(e){if(e.byteLength==this.F.n8*3)return this.op1Affine(\"_toAffine\",e);if(e.byteLength==this.F.n8*2)return e;throw new Error(\"invalid point size\")}toJacobian(e){if(e.byteLength==this.F.n8*3)return e;if(e.byteLength==this.F.n8*2)return this.op1(\"_toJacobian\",e);throw new Error(\"invalid point size\")}toRprUncompressed(e,t,i){if(this.tm.setBuff(this.pOp1,i),i.byteLength==this.F.n8*3)this.tm.instance.exports[this.prefix+\"_toAffine\"](this.pOp1,this.pOp1);else if(i.byteLength!=this.F.n8*2)throw new Error(\"invalid point size\");this.tm.instance.exports[this.prefix+\"_LEMtoU\"](this.pOp1,this.pOp1);const o=this.tm.getBuff(this.pOp1,this.F.n8*2);e.set(o,t)}fromRprUncompressed(e,t){const i=e.slice(t,t+this.F.n8*2);return this.tm.setBuff(this.pOp1,i),this.tm.instance.exports[this.prefix+\"_UtoLEM\"](this.pOp1,this.pOp1),this.tm.getBuff(this.pOp1,this.F.n8*2)}toRprCompressed(e,t,i){if(this.tm.setBuff(this.pOp1,i),i.byteLength==this.F.n8*3)this.tm.instance.exports[this.prefix+\"_toAffine\"](this.pOp1,this.pOp1);else if(i.byteLength!=this.F.n8*2)throw new Error(\"invalid point size\");this.tm.instance.exports[this.prefix+\"_LEMtoC\"](this.pOp1,this.pOp1);const o=this.tm.getBuff(this.pOp1,this.F.n8);e.set(o,t)}fromRprCompressed(e,t){const i=e.slice(t,t+this.F.n8);return this.tm.setBuff(this.pOp1,i),this.tm.instance.exports[this.prefix+\"_CtoLEM\"](this.pOp1,this.pOp2),this.tm.getBuff(this.pOp2,this.F.n8*2)}toUncompressed(e){const t=new Uint8Array(this.F.n8*2);return this.toRprUncompressed(t,0,e),t}toRprLEM(e,t,i){if(i.byteLength==this.F.n8*2){e.set(i,t);return}else if(i.byteLength==this.F.n8*3){this.tm.setBuff(this.pOp1,i),this.tm.instance.exports[this.prefix+\"_toAffine\"](this.pOp1,this.pOp1);const o=this.tm.getBuff(this.pOp1,this.F.n8*2);e.set(o,t)}else throw new Error(\"invalid point size\")}fromRprLEM(e,t){return t=t||0,e.slice(t,t+this.F.n8*2)}toString(e,t){if(e.byteLength==this.F.n8*3){const i=this.F.toString(e.slice(0,this.F.n8),t),o=this.F.toString(e.slice(this.F.n8,this.F.n8*2),t),a=this.F.toString(e.slice(this.F.n8*2),t);return`[ ${i}, ${o}, ${a} ]`}else if(e.byteLength==this.F.n8*2){const i=this.F.toString(e.slice(0,this.F.n8),t),o=this.F.toString(e.slice(this.F.n8),t);return`[ ${i}, ${o} ]`}else throw new Error(\"invalid point size\")}isValid(e){if(this.isZero(e))return!0;const t=this.F,i=this.toAffine(e),o=i.slice(0,this.F.n8),a=i.slice(this.F.n8,this.F.n8*2),s=t.add(t.mul(t.square(o),o),this.b),l=t.square(a);return t.eq(s,l)}fromRng(e){const t=this.F;let i=[],o,a;do i[0]=t.fromRng(e),o=e.nextBool(),a=t.add(t.mul(t.square(i[0]),i[0]),this.b);while(!t.isSquare(a));i[1]=t.sqrt(a);const s=t.isNegative(i[1]);o^s&&(i[1]=t.neg(i[1]));let l=new Uint8Array(this.F.n8*2);return l.set(i[0]),l.set(i[1],this.F.n8),this.cofactor&&(l=this.timesScalar(l,this.cofactor)),l}toObject(e){if(this.isZero(e))return[this.F.toObject(this.F.zero),this.F.toObject(this.F.one),this.F.toObject(this.F.zero)];const t=this.F.toObject(e.slice(0,this.F.n8)),i=this.F.toObject(e.slice(this.F.n8,this.F.n8*2));let o;return e.byteLength==this.F.n8*3?o=this.F.toObject(e.slice(this.F.n8*2,this.F.n8*3)):o=this.F.toObject(this.F.one),[t,i,o]}fromObject(e){const t=this.F.fromObject(e[0]),i=this.F.fromObject(e[1]);let o;if(e.length==3?o=this.F.fromObject(e[2]):o=this.F.one,this.F.isZero(o,this.F.one))return this.zeroAffine;if(this.F.eq(o,this.F.one)){const a=new Uint8Array(this.F.n8*2);return a.set(t),a.set(i,this.F.n8),a}else{const a=new Uint8Array(this.F.n8*3);return a.set(t),a.set(i,this.F.n8),a.set(o,this.F.n8*2),a}}e(e){return e instanceof Uint8Array?e:this.fromObject(e)}x(e){return this.toAffine(e).slice(0,this.F.n8)}y(e){return this.toAffine(e).slice(this.F.n8)}}function Jr(n){let t,i;n&&(n.onmessage=function(u){let w;if(u.data?w=u.data:w=u,w[0].cmd==\"INIT\")o(w[0]).then(function(){n.postMessage(w.result)});else if(w[0].cmd==\"TERMINATE\")n.close();else{const C=d(w);n.postMessage(C)}});async function o(u){const w=new Uint8Array(u.code),C=await WebAssembly.compile(w);i=new WebAssembly.Memory({initial:u.init,maximum:32767}),t=await WebAssembly.instantiate(C,{env:{memory:i}})}function a(u){const w=new Uint32Array(i.buffer,0,1);for(;w[0]&3;)w[0]++;const C=w[0];if(w[0]+=u,w[0]+u>i.buffer.byteLength){const h=i.buffer.byteLength/65536;let m=Math.floor((w[0]+u)/65536)+1;m>32767&&(m=32767),i.grow(m-h)}return C}function s(u){const w=a(u.byteLength);return g(w,u),w}function l(u,w){const C=new Uint8Array(i.buffer);return new Uint8Array(C.buffer,C.byteOffset+u,w)}function g(u,w){new Uint8Array(i.buffer).set(new Uint8Array(w),u)}function d(u){if(u[0].cmd==\"INIT\")return o(u[0]);const w={vars:[],out:[]},h=new Uint32Array(i.buffer,0,1)[0];for(let O=0;O<u.length;O++)switch(u[O].cmd){case\"ALLOCSET\":w.vars[u[O].var]=s(u[O].buff);break;case\"ALLOC\":w.vars[u[O].var]=a(u[O].len);break;case\"SET\":g(w.vars[u[O].var],u[O].buff);break;case\"CALL\":{const Q=[];for(let P=0;P<u[O].params.length;P++){const G=u[O].params[P];typeof G.var<\"u\"?Q.push(w.vars[G.var]+(G.offset||0)):typeof G.val<\"u\"&&Q.push(G.val)}t.exports[u[O].fnName](...Q);break}case\"GET\":w.out[u[O].out]=l(w.vars[u[O].var],u[O].len).slice();break;default:throw new Error(\"Invalid cmd\")}const m=new Uint32Array(i.buffer,0,1);return m[0]=h,w.out}return d}var bi;function Md(){if(typeof bi>\"u\"){var n=new ArrayBuffer(2),e=new Uint8Array(n),t=new Uint16Array(n);if(e[0]=1,e[1]=2,t[0]===258)bi=\"BE\";else if(t[0]===513)bi=\"LE\";else throw new Error(\"unable to figure out endianess\")}return bi}function Td(){return typeof hn.location<\"u\"?hn.location.hostname:\"\"}function Rd(){return[]}function Dd(){return 0}function kd(){return Number.MAX_VALUE}function zd(){return Number.MAX_VALUE}function qd(){return[]}function Qd(){return\"Browser\"}function Nd(){return typeof hn.navigator<\"u\"?hn.navigator.appVersion:\"\"}function Gd(){}function Kd(){}function ts(){return\"/tmp\"}var Hd=ts,Zd=`\n`;const jd={EOL:Zd,tmpdir:Hd,tmpDir:ts,networkInterfaces:Gd,getNetworkInterfaces:Kd,release:Nd,type:Qd,cpus:qd,totalmem:zd,freemem:kd,uptime:Dd,loadavg:Rd,hostname:Td,endianness:Md};var _o,sc;function Vd(){return sc||(sc=1,_o=Worker),_o}var $d=Vd();const Yd=mr($d),ho=25;class lc{constructor(){this.promise=new Promise((e,t)=>{this.reject=t,this.resolve=e})}}function Wd(n){return new Promise(e=>setTimeout(e,n))}function Xd(n){return globalThis.btoa(n)}const Jd=Xd(\"(\"+Jr.toString()+\")(self)\"),tu=\"data:application/javascript;base64,\"+Jd;async function eu(n,e){const t=new nu;t.memory=new WebAssembly.Memory({initial:ho}),t.u8=new Uint8Array(t.memory.buffer),t.u32=new Uint32Array(t.memory.buffer);const i=await WebAssembly.compile(n.code);if(t.instance=await WebAssembly.instantiate(i,{env:{memory:t.memory}}),t.singleThread=e,t.initalPFree=t.u32[0],t.pq=n.pq,t.pr=n.pr,t.pG1gen=n.pG1gen,t.pG1zero=n.pG1zero,t.pG2gen=n.pG2gen,t.pG2zero=n.pG2zero,t.pOneT=n.pOneT,e)t.code=n.code,t.taskManager=Jr(),await t.taskManager([{cmd:\"INIT\",init:ho,code:t.code.slice()}]),t.concurrency=1;else{t.workers=[],t.pendingDeferreds=[],t.working=[];let a;typeof navigator==\"object\"&&navigator.hardwareConcurrency?a=navigator.hardwareConcurrency:a=jd.cpus().length,a==0&&(a=2),a>64&&(a=64),t.concurrency=a;for(let l=0;l<a;l++)t.workers[l]=new Yd(tu),t.workers[l].addEventListener(\"message\",o(l)),t.working[l]=!1;const s=[];for(let l=0;l<t.workers.length;l++){const g=n.code.slice();s.push(t.postAction(l,[{cmd:\"INIT\",init:ho,code:g}],[g.buffer]))}await Promise.all(s)}return t;function o(a){return function(s){let l;s&&s.data?l=s.data:l=s,t.working[a]=!1,t.pendingDeferreds[a].resolve(l),t.processWorks()}}}class nu{constructor(){this.actionQueue=[],this.oldPFree=0}startSyncOp(){if(this.oldPFree!=0)throw new Error(\"Sync operation in progress\");this.oldPFree=this.u32[0]}endSyncOp(){if(this.oldPFree==0)throw new Error(\"No sync operation in progress\");this.u32[0]=this.oldPFree,this.oldPFree=0}postAction(e,t,i,o){if(this.working[e])throw new Error(\"Posting a job t a working worker\");return this.working[e]=!0,this.pendingDeferreds[e]=o||new lc,this.workers[e].postMessage(t,i),this.pendingDeferreds[e].promise}processWorks(){for(let e=0;e<this.workers.length&&this.actionQueue.length>0;e++)if(this.working[e]==!1){const t=this.actionQueue.shift();this.postAction(e,t.data,t.transfers,t.deferred)}}queueAction(e,t){const i=new lc;if(this.singleThread){const o=this.taskManager(e);i.resolve(o)}else this.actionQueue.push({data:e,transfers:t,deferred:i}),this.processWorks();return i.promise}resetMemory(){this.u32[0]=this.initalPFree}allocBuff(e){const t=this.alloc(e.byteLength);return this.setBuff(t,e),t}getBuff(e,t){return this.u8.slice(e,e+t)}setBuff(e,t){this.u8.set(new Uint8Array(t),e)}alloc(e){for(;this.u32[0]&3;)this.u32[0]++;const t=this.u32[0];return this.u32[0]+=e,t}async terminate(){for(let e=0;e<this.workers.length;e++)this.workers[e].postMessage([{cmd:\"TERMINATE\"}]);await Wd(200)}}function go(n,e){const t=n[e],i=n.Fr,o=n.tm;n[e].batchApplyKey=async function(a,s,l,g,d){g=g||\"affine\",d=d||\"affine\";let u,w,C,h,m;if(e==\"G1\")g==\"jacobian\"?(C=t.F.n8*3,u=\"g1m_batchApplyKey\"):(C=t.F.n8*2,u=\"g1m_batchApplyKeyMixed\"),h=t.F.n8*3,d==\"jacobian\"?m=t.F.n8*3:(w=\"g1m_batchToAffine\",m=t.F.n8*2);else if(e==\"G2\")g==\"jacobian\"?(C=t.F.n8*3,u=\"g2m_batchApplyKey\"):(C=t.F.n8*2,u=\"g2m_batchApplyKeyMixed\"),h=t.F.n8*3,d==\"jacobian\"?m=t.F.n8*3:(w=\"g2m_batchToAffine\",m=t.F.n8*2);else if(e==\"Fr\")u=\"frm_batchApplyKey\",C=t.n8,h=t.n8,m=t.n8;else throw new Error(\"Invalid group: \"+e);const O=Math.floor(a.byteLength/C),Q=Math.floor(O/o.concurrency),P=[];l=i.e(l);let G=i.e(s);for(let I=0;I<o.concurrency;I++){let _;if(I<o.concurrency-1?_=Q:_=O-I*Q,_==0)continue;const M=[];M.push({cmd:\"ALLOCSET\",var:0,buff:a.slice(I*Q*C,I*Q*C+_*C)}),M.push({cmd:\"ALLOCSET\",var:1,buff:G}),M.push({cmd:\"ALLOCSET\",var:2,buff:l}),M.push({cmd:\"ALLOC\",var:3,len:_*Math.max(h,m)}),M.push({cmd:\"CALL\",fnName:u,params:[{var:0},{val:_},{var:1},{var:2},{var:3}]}),w&&M.push({cmd:\"CALL\",fnName:w,params:[{var:3},{val:_},{var:3}]}),M.push({cmd:\"GET\",out:0,var:3,len:_*m}),P.push(o.queueAction(M)),G=i.mul(G,i.exp(l,_))}const st=await Promise.all(P);let N;a instanceof ce?N=new ce(O*m):N=new Uint8Array(O*m);let y=0;for(let I=0;I<st.length;I++)N.set(st[I][0],y),y+=st[I][0].byteLength;return N}}function iu(n){const e=n.tm;n.pairing=function(i,o){e.startSyncOp();const a=e.allocBuff(n.G1.toJacobian(i)),s=e.allocBuff(n.G2.toJacobian(o)),l=e.alloc(n.Gt.n8);e.instance.exports[n.name+\"_pairing\"](a,s,l);const g=e.getBuff(l,n.Gt.n8);return e.endSyncOp(),g},n.pairingEq=async function(){let i,o;arguments.length%2==1?(i=arguments[arguments.length-1],o=(arguments.length-1)/2):(i=n.Gt.one,o=arguments.length/2);const a=[];for(let u=0;u<o;u++){const w=[],C=n.G1.toJacobian(arguments[u*2]);w.push({cmd:\"ALLOCSET\",var:0,buff:C}),w.push({cmd:\"ALLOC\",var:1,len:n.prePSize});const h=n.G2.toJacobian(arguments[u*2+1]);w.push({cmd:\"ALLOCSET\",var:2,buff:h}),w.push({cmd:\"ALLOC\",var:3,len:n.preQSize}),w.push({cmd:\"ALLOC\",var:4,len:n.Gt.n8}),w.push({cmd:\"CALL\",fnName:n.name+\"_prepareG1\",params:[{var:0},{var:1}]}),w.push({cmd:\"CALL\",fnName:n.name+\"_prepareG2\",params:[{var:2},{var:3}]}),w.push({cmd:\"CALL\",fnName:n.name+\"_millerLoop\",params:[{var:1},{var:3},{var:4}]}),w.push({cmd:\"GET\",out:0,var:4,len:n.Gt.n8}),a.push(e.queueAction(w))}const s=await Promise.all(a);e.startSyncOp();const l=e.alloc(n.Gt.n8);e.instance.exports.ftm_one(l);for(let u=0;u<s.length;u++){const w=e.allocBuff(s[u][0]);e.instance.exports.ftm_mul(l,w,l)}e.instance.exports[n.name+\"_finalExponentiation\"](l,l);const g=e.allocBuff(i),d=!!e.instance.exports.ftm_eq(l,g);return e.endSyncOp(),d},n.prepareG1=function(t){this.tm.startSyncOp();const i=this.tm.allocBuff(t),o=this.tm.alloc(this.prePSize);this.tm.instance.exports[this.name+\"_prepareG1\"](i,o);const a=this.tm.getBuff(o,this.prePSize);return this.tm.endSyncOp(),a},n.prepareG2=function(t){this.tm.startSyncOp();const i=this.tm.allocBuff(t),o=this.tm.alloc(this.preQSize);this.tm.instance.exports[this.name+\"_prepareG2\"](i,o);const a=this.tm.getBuff(o,this.preQSize);return this.tm.endSyncOp(),a},n.millerLoop=function(t,i){this.tm.startSyncOp();const o=this.tm.allocBuff(t),a=this.tm.allocBuff(i),s=this.tm.alloc(this.Gt.n8);this.tm.instance.exports[this.name+\"_millerLoop\"](o,a,s);const l=this.tm.getBuff(s,this.Gt.n8);return this.tm.endSyncOp(),l},n.finalExponentiation=function(t){this.tm.startSyncOp();const i=this.tm.allocBuff(t),o=this.tm.alloc(this.Gt.n8);this.tm.instance.exports[this.name+\"_finalExponentiation\"](i,o);const a=this.tm.getBuff(o,this.Gt.n8);return this.tm.endSyncOp(),a}}const dc=[1,1,1,1,2,3,4,5,6,7,7,8,9,10,11,12,13,13,14,15,16,16,17,17,17,17,17,17,17,17,17,17];function uc(n,e){const t=n[e],i=t.tm;async function o(s,l,g,d,u){if(!(s instanceof Uint8Array))throw d&&d.error(`${u} _multiExpChunk buffBases is not Uint8Array`),new Error(`${u} _multiExpChunk buffBases is not Uint8Array`);if(!(l instanceof Uint8Array))throw d&&d.error(`${u} _multiExpChunk buffScalars is not Uint8Array`),new Error(`${u} _multiExpChunk buffScalars is not Uint8Array`);g=g||\"affine\";let w,C;if(e==\"G1\")g==\"affine\"?(C=\"g1m_multiexpAffine_chunk\",w=t.F.n8*2):(C=\"g1m_multiexp_chunk\",w=t.F.n8*3);else if(e==\"G2\")g==\"affine\"?(C=\"g2m_multiexpAffine_chunk\",w=t.F.n8*2):(C=\"g2m_multiexp_chunk\",w=t.F.n8*3);else throw new Error(\"Invalid group\");const h=Math.floor(s.byteLength/w);if(h==0)return t.zero;const m=Math.floor(l.byteLength/h);if(m*h!=l.byteLength)throw new Error(\"Scalar size does not match\");const O=dc[we(h)],Q=Math.floor((m*8-1)/O)+1,P=[];for(let N=0;N<Q;N++){const y=[{cmd:\"ALLOCSET\",var:0,buff:s},{cmd:\"ALLOCSET\",var:1,buff:l},{cmd:\"ALLOC\",var:2,len:t.F.n8*3},{cmd:\"CALL\",fnName:C,params:[{var:0},{var:1},{val:m},{val:h},{val:N*O},{val:Math.min(m*8-N*O,O)},{var:2}]},{cmd:\"GET\",out:0,var:2,len:t.F.n8*3}];P.push(t.tm.queueAction(y))}const G=await Promise.all(P);let st=t.zero;for(let N=G.length-1;N>=0;N--){if(!t.isZero(st))for(let y=0;y<O;y++)st=t.double(st);st=t.add(st,G[N][0])}return st}async function a(s,l,g,d,u){let h;if(e==\"G1\")g==\"affine\"?h=t.F.n8*2:h=t.F.n8*3;else if(e==\"G2\")g==\"affine\"?h=t.F.n8*2:h=t.F.n8*3;else throw new Error(\"Invalid group\");const m=Math.floor(s.byteLength/h),O=Math.floor(l.byteLength/m);if(O*m!=l.byteLength)throw new Error(\"Scalar size does not match\");const Q=dc[we(m)],P=Math.floor((O*8-1)/Q)+1;let G;G=Math.floor(m/(i.concurrency/P)),G>4194304&&(G=4194304),G<1024&&(G=1024);const st=[];for(let I=0;I<m;I+=G){d&&d.debug(`Multiexp start: ${u}: ${I}/${m}`);const _=Math.min(m-I,G),M=s.slice(I*h,(I+_)*h),F=l.slice(I*O,(I+_)*O);st.push(o(M,F,g,d,u).then(L=>(d&&d.debug(`Multiexp end: ${u}: ${I}/${m}`),L)))}const N=await Promise.all(st);let y=t.zero;for(let I=N.length-1;I>=0;I--)y=t.add(y,N[I]);return y}t.multiExp=async function(l,g,d,u){return await a(l,g,\"jacobian\",d,u)},t.multiExpAffine=async function(l,g,d,u){return await a(l,g,\"affine\",d,u)}}function po(n,e){const t=n[e],i=n.Fr,o=t.tm;async function a(d,u,w,C,h,m){w=w||\"affine\",C=C||\"affine\";const O=14;let Q,P,G,st,N,y,I,_;e==\"G1\"?(w==\"affine\"?(Q=t.F.n8*2,st=\"g1m_batchToJacobian\"):Q=t.F.n8*3,P=t.F.n8*3,u&&(_=\"g1m_fftFinal\"),I=\"g1m_fftJoin\",y=\"g1m_fftMix\",C==\"affine\"?(G=t.F.n8*2,N=\"g1m_batchToAffine\"):G=t.F.n8*3):e==\"G2\"?(w==\"affine\"?(Q=t.F.n8*2,st=\"g2m_batchToJacobian\"):Q=t.F.n8*3,P=t.F.n8*3,u&&(_=\"g2m_fftFinal\"),I=\"g2m_fftJoin\",y=\"g2m_fftMix\",C==\"affine\"?(G=t.F.n8*2,N=\"g2m_batchToAffine\"):G=t.F.n8*3):e==\"Fr\"&&(Q=t.n8,P=t.n8,G=t.n8,u&&(_=\"frm_fftFinal\"),y=\"frm_fftMix\",I=\"frm_fftJoin\");let M=!1;Array.isArray(d)?(d=pa(d,Q),M=!0):d=d.slice(0,d.byteLength);const F=d.byteLength/Q,L=we(F);if(1<<L!=F)throw new Error(\"fft must be multiple of 2\");if(L==i.s+1){let tt;return u?tt=await l(d,w,C,h,m):tt=await s(d,w,C,h,m),M?Oi(tt,G):tt}let D;u&&(D=i.inv(i.e(F)));let K;Xr(d,Q);let $,S=Math.min(1<<O,F),B=F/S;for(;B<o.concurrency&&S>=16;)B*=2,S/=2;const E=we(S),_t=[];for(let tt=0;tt<B;tt++){h&&h.debug(`${m}: fft ${L} mix start: ${tt}/${B}`);const ft=[];ft.push({cmd:\"ALLOC\",var:0,len:P*S});const Bt=d.slice(S*tt*Q,S*(tt+1)*Q);ft.push({cmd:\"SET\",var:0,buff:Bt}),st&&ft.push({cmd:\"CALL\",fnName:st,params:[{var:0},{val:S},{var:0}]});for(let Ct=1;Ct<=E;Ct++)ft.push({cmd:\"CALL\",fnName:y,params:[{var:0},{val:S},{val:Ct}]});E==L?(_&&(ft.push({cmd:\"ALLOCSET\",var:1,buff:D}),ft.push({cmd:\"CALL\",fnName:_,params:[{var:0},{val:S},{var:1}]})),N&&ft.push({cmd:\"CALL\",fnName:N,params:[{var:0},{val:S},{var:0}]}),ft.push({cmd:\"GET\",out:0,var:0,len:S*G})):ft.push({cmd:\"GET\",out:0,var:0,len:P*S}),_t.push(o.queueAction(ft).then(Ct=>(h&&h.debug(`${m}: fft ${L} mix end: ${tt}/${B}`),Ct)))}$=await Promise.all(_t);for(let tt=0;tt<B;tt++)$[tt]=$[tt][0];for(let tt=E+1;tt<=L;tt++){h&&h.debug(`${m}: fft ${L} join: ${tt}/${L}`);const ft=1<<L-tt,Bt=B/ft,Ct=[];for(let Ot=0;Ot<ft;Ot++)for(let Dt=0;Dt<Bt/2;Dt++){const x=i.exp(i.w[tt],Dt*S),ht=i.w[tt],yt=Ot*Bt+Dt,U=Ot*Bt+Dt+Bt/2,r=[];r.push({cmd:\"ALLOCSET\",var:0,buff:$[yt]}),r.push({cmd:\"ALLOCSET\",var:1,buff:$[U]}),r.push({cmd:\"ALLOCSET\",var:2,buff:x}),r.push({cmd:\"ALLOCSET\",var:3,buff:ht}),r.push({cmd:\"CALL\",fnName:I,params:[{var:0},{var:1},{val:S},{var:2},{var:3}]}),tt==L?(_&&(r.push({cmd:\"ALLOCSET\",var:4,buff:D}),r.push({cmd:\"CALL\",fnName:_,params:[{var:0},{val:S},{var:4}]}),r.push({cmd:\"CALL\",fnName:_,params:[{var:1},{val:S},{var:4}]})),N&&(r.push({cmd:\"CALL\",fnName:N,params:[{var:0},{val:S},{var:0}]}),r.push({cmd:\"CALL\",fnName:N,params:[{var:1},{val:S},{var:1}]})),r.push({cmd:\"GET\",out:0,var:0,len:S*G}),r.push({cmd:\"GET\",out:1,var:1,len:S*G})):(r.push({cmd:\"GET\",out:0,var:0,len:S*P}),r.push({cmd:\"GET\",out:1,var:1,len:S*P})),Ct.push(o.queueAction(r).then(dt=>(h&&h.debug(`${m}: fft ${L} join ${tt}/${L} ${Ot+1}/${ft} ${Dt}/${Bt/2}`),dt)))}const St=await Promise.all(Ct);for(let Ot=0;Ot<ft;Ot++)for(let Dt=0;Dt<Bt/2;Dt++){const x=Ot*Bt+Dt,ht=Ot*Bt+Dt+Bt/2,yt=St.shift();$[x]=yt[0],$[ht]=yt[1]}}if(d instanceof ce?K=new ce(F*G):K=new Uint8Array(F*G),u){K.set($[0].slice((S-1)*G));let tt=G;for(let ft=B-1;ft>0;ft--)K.set($[ft],tt),tt+=S*G,delete $[ft];K.set($[0].slice(0,(S-1)*G),tt),delete $[0]}else for(let tt=0;tt<B;tt++)K.set($[tt],S*G*tt),delete $[tt];return M?Oi(K,G):K}async function s(d,u,w,C,h){let m,O;m=d.slice(0,d.byteLength/2),O=d.slice(d.byteLength/2,d.byteLength);const Q=[];[m,O]=await g(m,O,\"fftJoinExt\",i.one,i.shift,u,\"jacobian\",C,h),Q.push(a(m,!1,\"jacobian\",w,C,h)),Q.push(a(O,!1,\"jacobian\",w,C,h));const P=await Promise.all(Q);let G;return P[0].byteLength>1<<28?G=new ce(P[0].byteLength*2):G=new Uint8Array(P[0].byteLength*2),G.set(P[0]),G.set(P[1],P[0].byteLength),G}async function l(d,u,w,C,h){let m,O;m=d.slice(0,d.byteLength/2),O=d.slice(d.byteLength/2,d.byteLength);const Q=[];Q.push(a(m,!0,u,\"jacobian\",C,h)),Q.push(a(O,!0,u,\"jacobian\",C,h)),[m,O]=await Promise.all(Q);const P=await g(m,O,\"fftJoinExtInv\",i.one,i.shiftInv,\"jacobian\",w,C,h);let G;return P[0].byteLength>1<<28?G=new ce(P[0].byteLength*2):G=new Uint8Array(P[0].byteLength*2),G.set(P[0]),G.set(P[1],P[0].byteLength),G}async function g(d,u,w,C,h,m,O,Q,P){let N,y,I,_,M,F;if(e==\"G1\")m==\"affine\"?(M=t.F.n8*2,y=\"g1m_batchToJacobian\"):M=t.F.n8*3,F=t.F.n8*3,N=\"g1m_\"+w,O==\"affine\"?(I=\"g1m_batchToAffine\",_=t.F.n8*2):_=t.F.n8*3;else if(e==\"G2\")m==\"affine\"?(M=t.F.n8*2,y=\"g2m_batchToJacobian\"):M=t.F.n8*3,N=\"g2m_\"+w,F=t.F.n8*3,O==\"affine\"?(I=\"g2m_batchToAffine\",_=t.F.n8*2):_=t.F.n8*3;else if(e==\"Fr\")M=i.n8,_=i.n8,F=i.n8,N=\"frm_\"+w;else throw new Error(\"Invalid group\");if(d.byteLength!=u.byteLength)throw new Error(\"Invalid buffer size\");const L=Math.floor(d.byteLength/M);if(L!=1<<we(L))throw new Error(\"Invalid number of points\");let D=Math.floor(L/o.concurrency);D<16&&(D=16),D>65536&&(D=65536);const K=[];for(let _t=0;_t<L;_t+=D){Q&&Q.debug(`${P}: fftJoinExt Start: ${_t}/${L}`);const tt=Math.min(L-_t,D),ft=i.mul(C,i.exp(h,_t)),Bt=[],Ct=d.slice(_t*M,(_t+tt)*M),St=u.slice(_t*M,(_t+tt)*M);Bt.push({cmd:\"ALLOC\",var:0,len:F*tt}),Bt.push({cmd:\"SET\",var:0,buff:Ct}),Bt.push({cmd:\"ALLOC\",var:1,len:F*tt}),Bt.push({cmd:\"SET\",var:1,buff:St}),Bt.push({cmd:\"ALLOCSET\",var:2,buff:ft}),Bt.push({cmd:\"ALLOCSET\",var:3,buff:h}),y&&(Bt.push({cmd:\"CALL\",fnName:y,params:[{var:0},{val:tt},{var:0}]}),Bt.push({cmd:\"CALL\",fnName:y,params:[{var:1},{val:tt},{var:1}]})),Bt.push({cmd:\"CALL\",fnName:N,params:[{var:0},{var:1},{val:tt},{var:2},{var:3},{val:i.s}]}),I&&(Bt.push({cmd:\"CALL\",fnName:I,params:[{var:0},{val:tt},{var:0}]}),Bt.push({cmd:\"CALL\",fnName:I,params:[{var:1},{val:tt},{var:1}]})),Bt.push({cmd:\"GET\",out:0,var:0,len:tt*_}),Bt.push({cmd:\"GET\",out:1,var:1,len:tt*_}),K.push(o.queueAction(Bt).then(Ot=>(Q&&Q.debug(`${P}: fftJoinExt End: ${_t}/${L}`),Ot)))}const $=await Promise.all(K);let S,B;L*_>1<<28?(S=new ce(L*_),B=new ce(L*_)):(S=new Uint8Array(L*_),B=new Uint8Array(L*_));let E=0;for(let _t=0;_t<$.length;_t++)S.set($[_t][0],E),B.set($[_t][1],E),E+=$[_t][0].byteLength;return[S,B]}t.fft=async function(d,u,w,C,h){return await a(d,!1,u,w,C,h)},t.ifft=async function(d,u,w,C,h){return await a(d,!0,u,w,C,h)},t.lagrangeEvaluations=async function(d,u,w,C,h){u=u||\"affine\",w=w||\"affine\";let m;if(e==\"G1\")u==\"affine\"?m=t.F.n8*2:m=t.F.n8*3;else if(e==\"G2\")u==\"affine\"?m=t.F.n8*2:m=t.F.n8*3;else if(e==\"Fr\")m=i.n8;else throw new Error(\"Invalid group\");const O=d.byteLength/m,Q=we(O);if(2**Q*m!=d.byteLength)throw C&&C.error(\"lagrangeEvaluations iinvalid input size\"),new Error(\"lagrangeEvaluations invalid Input size\");if(Q<=i.s)return await t.ifft(d,u,w,C,h);if(Q>i.s+1)throw C&&C.error(\"lagrangeEvaluations input too big\"),new Error(\"lagrangeEvaluations input too big\");let P=d.slice(0,d.byteLength/2),G=d.slice(d.byteLength/2,d.byteLength);const st=i.exp(i.shift,O/2),N=i.inv(i.sub(i.one,st));[P,G]=await g(P,G,\"prepareLagrangeEvaluation\",N,i.shiftInv,u,\"jacobian\",C,h+\" prep\");const y=[];y.push(a(P,!0,\"jacobian\",w,C,h+\" t0\")),y.push(a(G,!0,\"jacobian\",w,C,h+\" t1\")),[P,G]=await Promise.all(y);let I;return P.byteLength>1<<28?I=new ce(P.byteLength*2):I=new Uint8Array(P.byteLength*2),I.set(P),I.set(G,P.byteLength),I},t.fftMix=async function(u){const w=t.F.n8*3;let C,h;if(e==\"G1\")C=\"g1m_fftMix\",h=\"g1m_fftJoin\";else if(e==\"G2\")C=\"g2m_fftMix\",h=\"g2m_fftJoin\";else if(e==\"Fr\")C=\"frm_fftMix\",h=\"frm_fftJoin\";else throw new Error(\"Invalid group\");const m=Math.floor(u.byteLength/w),O=we(m);let Q=1<<we(o.concurrency);m<=Q*2&&(Q=1);const P=m/Q,G=we(P),st=[];for(let M=0;M<Q;M++){const F=[],L=u.slice(M*P*w,(M+1)*P*w);F.push({cmd:\"ALLOCSET\",var:0,buff:L});for(let D=1;D<=G;D++)F.push({cmd:\"CALL\",fnName:C,params:[{var:0},{val:P},{val:D}]});F.push({cmd:\"GET\",out:0,var:0,len:P*w}),st.push(o.queueAction(F))}const N=await Promise.all(st),y=[];for(let M=0;M<N.length;M++)y[M]=N[M][0];for(let M=G+1;M<=O;M++){const F=1<<O-M,L=Q/F,D=[];for(let $=0;$<F;$++)for(let S=0;S<L/2;S++){const B=i.exp(i.w[M],S*P),E=i.w[M],_t=$*L+S,tt=$*L+S+L/2,ft=[];ft.push({cmd:\"ALLOCSET\",var:0,buff:y[_t]}),ft.push({cmd:\"ALLOCSET\",var:1,buff:y[tt]}),ft.push({cmd:\"ALLOCSET\",var:2,buff:B}),ft.push({cmd:\"ALLOCSET\",var:3,buff:E}),ft.push({cmd:\"CALL\",fnName:h,params:[{var:0},{var:1},{val:P},{var:2},{var:3}]}),ft.push({cmd:\"GET\",out:0,var:0,len:P*w}),ft.push({cmd:\"GET\",out:1,var:1,len:P*w}),D.push(o.queueAction(ft))}const K=await Promise.all(D);for(let $=0;$<F;$++)for(let S=0;S<L/2;S++){const B=$*L+S,E=$*L+S+L/2,_t=K.shift();y[B]=_t[0],y[E]=_t[1]}}let I;u instanceof ce?I=new ce(m*w):I=new Uint8Array(m*w);let _=0;for(let M=0;M<Q;M++)I.set(y[M],_),_+=y[M].byteLength;return I},t.fftJoin=async function(u,w,C,h){const m=t.F.n8*3;let O;if(e==\"G1\")O=\"g1m_fftJoin\";else if(e==\"G2\")O=\"g2m_fftJoin\";else if(e==\"Fr\")O=\"frm_fftJoin\";else throw new Error(\"Invalid group\");if(u.byteLength!=w.byteLength)throw new Error(\"Invalid buffer size\");const Q=Math.floor(u.byteLength/m);if(Q!=1<<we(Q))throw new Error(\"Invalid number of points\");let P=1<<we(o.concurrency);Q<=P*2&&(P=1);const G=Q/P,st=[];for(let M=0;M<P;M++){const F=[],L=i.mul(C,i.exp(h,M*G)),D=u.slice(M*G*m,(M+1)*G*m),K=w.slice(M*G*m,(M+1)*G*m);F.push({cmd:\"ALLOCSET\",var:0,buff:D}),F.push({cmd:\"ALLOCSET\",var:1,buff:K}),F.push({cmd:\"ALLOCSET\",var:2,buff:L}),F.push({cmd:\"ALLOCSET\",var:3,buff:h}),F.push({cmd:\"CALL\",fnName:O,params:[{var:0},{var:1},{val:G},{var:2},{var:3}]}),F.push({cmd:\"GET\",out:0,var:0,len:G*m}),F.push({cmd:\"GET\",out:1,var:1,len:G*m}),st.push(o.queueAction(F))}const N=await Promise.all(st);let y,I;u instanceof ce?(y=new ce(Q*m),I=new ce(Q*m)):(y=new Uint8Array(Q*m),I=new Uint8Array(Q*m));let _=0;for(let M=0;M<N.length;M++)y.set(N[M][0],_),I.set(N[M][1],_),_+=N[M][0].byteLength;return[y,I]},t.fftFinal=async function(u,w){const C=t.F.n8*3,h=t.F.n8*2;let m,O;if(e==\"G1\")m=\"g1m_fftFinal\",O=\"g1m_batchToAffine\";else if(e==\"G2\")m=\"g2m_fftFinal\",O=\"g2m_batchToAffine\";else throw new Error(\"Invalid group\");const Q=Math.floor(u.byteLength/C);if(Q!=1<<we(Q))throw new Error(\"Invalid number of points\");const P=Math.floor(Q/o.concurrency),G=[];for(let I=0;I<o.concurrency;I++){let _;if(I<o.concurrency-1?_=P:_=Q-I*P,_==0)continue;const M=[],F=u.slice(I*P*C,(I*P+_)*C);M.push({cmd:\"ALLOCSET\",var:0,buff:F}),M.push({cmd:\"ALLOCSET\",var:1,buff:w}),M.push({cmd:\"CALL\",fnName:m,params:[{var:0},{val:_},{var:1}]}),M.push({cmd:\"CALL\",fnName:O,params:[{var:0},{val:_},{var:0}]}),M.push({cmd:\"GET\",out:0,var:0,len:_*h}),G.push(o.queueAction(M))}const st=await Promise.all(G);let N;u instanceof ce?N=new ce(Q*h):N=new Uint8Array(Q*h);let y=0;for(let I=st.length-1;I>=0;I--)N.set(st[I][0],y),y+=st[I][0].byteLength;return N}}async function es(n){const e=await eu(n.wasm,n.singleThread),t={};return t.q=ue(n.wasm.q.toString()),t.r=ue(n.wasm.r.toString()),t.name=n.name,t.tm=e,t.prePSize=n.wasm.prePSize,t.preQSize=n.wasm.preQSize,t.Fr=new ac(e,\"frm\",n.n8r,n.r),t.F1=new ac(e,\"f1m\",n.n8q,n.q),t.F2=new cc(e,\"f2m\",t.F1),t.G1=new rc(e,\"g1m\",t.F1,n.wasm.pG1gen,n.wasm.pG1b,n.cofactorG1),t.G2=new rc(e,\"g2m\",t.F2,n.wasm.pG2gen,n.wasm.pG2b,n.cofactorG2),t.F6=new Ud(e,\"f6m\",t.F2),t.F12=new cc(e,\"ftm\",t.F6),t.Gt=t.F12,go(t,\"G1\"),go(t,\"G2\"),go(t,\"Fr\"),uc(t,\"G1\"),uc(t,\"G2\"),po(t,\"G1\"),po(t,\"G2\"),po(t,\"Fr\"),iu(t),t.array2buffer=function(i,o){const a=new Uint8Array(o*i.length);for(let s=0;s<i.length;s++)a.set(i[s],s*o);return a},t.buffer2array=function(i,o){const a=i.byteLength/o,s=new Array(a);for(let l=0;l<a;l++)s[l]=i.slice(l*o,l*o+o);return s},t}function Mn(n){return BigInt(n)}function ns(n){return n<0n}function ou(n){return n===0n}function au(n){return ns(n)?n.toString(2).length-1:n.toString(2).length}function Lo(n){const e=[],t=Mn(n);return e.push(Number(t&0xFFn)),e.push(Number(t>>8n&0xFFn)),e.push(Number(t>>16n&0xFFn)),e.push(Number(t>>24n&0xFFn)),e}function cu(n){for(var e=[],t=0;t<n.length;t++){var i=n.charCodeAt(t);i<128?e.push(i):i<2048?e.push(192|i>>6,128|i&63):i<55296||i>=57344?e.push(224|i>>12,128|i>>6&63,128|i&63):(t++,i=65536+((i&1023)<<10|n.charCodeAt(t)&1023),e.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|i&63))}return e}function Nn(n){const e=cu(n);return[...Wt(e.length),...e]}function is(n){const e=[];let t=Mn(n);if(ns(t))throw new Error(\"Number cannot be negative\");for(;!ou(t);)e.push(Number(t&0x7Fn)),t=t>>7n;e.length==0&&e.push(0);for(let i=0;i<e.length-1;i++)e[i]=e[i]|128;return e}function os(n){let e,t;const i=au(n);n<0?(t=!0,e=(1n<<BigInt(i))+n):(t=!1,e=Mn(n));const o=7-i%7,a=(1n<<BigInt(o))-1n<<BigInt(i),s=(1<<7-o)-1|128,l=is(e+a);return t||(l[l.length-1]=l[l.length-1]&s),l}function Yo(n){let e=Mn(n);if(e>0xFFFFFFFFn)throw new Error(\"Number too big\");if(e>0x7FFFFFFFn&&(e=e-0x100000000n),e<-2147483648n)throw new Error(\"Number too small\");return os(e)}function ru(n){let e=Mn(n);if(e>0xFFFFFFFFFFFFFFFFn)throw new Error(\"Number too big\");if(e>0x7FFFFFFFFFFFFFFFn&&(e=e-0x10000000000000000n),e<-9223372036854775808n)throw new Error(\"Number too small\");return os(e)}function Wt(n){let e=Mn(n);if(e>0xFFFFFFFFn)throw new Error(\"Number too big\");return is(e)}function fc(n){return Array.from(n,function(e){return(\"0\"+(e&255).toString(16)).slice(-2)}).join(\"\")}class su{constructor(e){this.func=e,this.functionName=e.functionName,this.module=e.module}setLocal(e,t){const i=this.func.localIdxByName[e];if(i===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[...t,33,...Wt(i)]}teeLocal(e,t){const i=this.func.localIdxByName[e];if(i===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[...t,34,...Wt(i)]}getLocal(e){const t=this.func.localIdxByName[e];if(t===void 0)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${e} `);return[32,...Wt(t)]}i64_load8_s(e,t,i){const o=t||0,a=i===void 0?0:i;return[...e,48,a,...Wt(o)]}i64_load8_u(e,t,i){const o=t||0,a=i===void 0?0:i;return[...e,49,a,...Wt(o)]}i64_load16_s(e,t,i){const o=t||0,a=i===void 0?1:i;return[...e,50,a,...Wt(o)]}i64_load16_u(e,t,i){const o=t||0,a=i===void 0?1:i;return[...e,51,a,...Wt(o)]}i64_load32_s(e,t,i){const o=t||0,a=i===void 0?2:i;return[...e,52,a,...Wt(o)]}i64_load32_u(e,t,i){const o=t||0,a=i===void 0?2:i;return[...e,53,a,...Wt(o)]}i64_load(e,t,i){const o=t||0,a=i===void 0?3:i;return[...e,41,a,...Wt(o)]}i64_store(e,t,i,o){let a,s,l;return Array.isArray(t)?(a=0,s=3,l=t):Array.isArray(i)?(a=t,s=3,l=i):Array.isArray(o)&&(a=t,s=i,l=o),[...e,...l,55,s,...Wt(a)]}i64_store32(e,t,i,o){let a,s,l;return Array.isArray(t)?(a=0,s=2,l=t):Array.isArray(i)?(a=t,s=2,l=i):Array.isArray(o)&&(a=t,s=i,l=o),[...e,...l,62,s,...Wt(a)]}i64_store16(e,t,i,o){let a,s,l;return Array.isArray(t)?(a=0,s=1,l=t):Array.isArray(i)?(a=t,s=1,l=i):Array.isArray(o)&&(a=t,s=i,l=o),[...e,...l,61,s,...Wt(a)]}i64_store8(e,t,i,o){let a,s,l;return Array.isArray(t)?(a=0,s=0,l=t):Array.isArray(i)?(a=t,s=0,l=i):Array.isArray(o)&&(a=t,s=i,l=o),[...e,...l,60,s,...Wt(a)]}i32_load8_s(e,t,i){const o=t||0,a=i===void 0?0:i;return[...e,44,a,...Wt(o)]}i32_load8_u(e,t,i){const o=t||0,a=i===void 0?0:i;return[...e,45,a,...Wt(o)]}i32_load16_s(e,t,i){const o=t||0,a=i===void 0?1:i;return[...e,46,a,...Wt(o)]}i32_load16_u(e,t,i){const o=t||0,a=i===void 0?1:i;return[...e,47,a,...Wt(o)]}i32_load(e,t,i){const o=t||0,a=i===void 0?2:i;return[...e,40,a,...Wt(o)]}i32_store(e,t,i,o){let a,s,l;return Array.isArray(t)?(a=0,s=2,l=t):Array.isArray(i)?(a=t,s=2,l=i):Array.isArray(o)&&(a=t,s=i,l=o),[...e,...l,54,s,...Wt(a)]}i32_store16(e,t,i,o){let a,s,l;return Array.isArray(t)?(a=0,s=1,l=t):Array.isArray(i)?(a=t,s=1,l=i):Array.isArray(o)&&(a=t,s=i,l=o),[...e,...l,59,s,...Wt(a)]}i32_store8(e,t,i,o){let a,s,l;return Array.isArray(t)?(a=0,s=0,l=t):Array.isArray(i)?(a=t,s=0,l=i):Array.isArray(o)&&(a=t,s=i,l=o),[...e,...l,58,s,...Wt(a)]}call(e,...t){const i=this.module.functionIdxByName[e];if(i===void 0)throw new Error(`Function not defined: Function: ${e}`);return[...[].concat(...t),16,...Wt(i)]}call_indirect(e,...t){return[...[].concat(...t),...e,17,0,0]}if(e,t,i){return i?[...e,4,64,...t,5,...i,11]:[...e,4,64,...t,11]}block(e){return[2,64,...e,11]}loop(...e){return[3,64,...[].concat(...e),11]}br_if(e,t){return[...t,13,...Wt(e)]}br(e){return[12,...Wt(e)]}ret(e){return[...e,15]}drop(e){return[...e,26]}i64_const(e){return[66,...ru(e)]}i32_const(e){return[65,...Yo(e)]}i64_eqz(e){return[...e,80]}i64_eq(e,t){return[...e,...t,81]}i64_ne(e,t){return[...e,...t,82]}i64_lt_s(e,t){return[...e,...t,83]}i64_lt_u(e,t){return[...e,...t,84]}i64_gt_s(e,t){return[...e,...t,85]}i64_gt_u(e,t){return[...e,...t,86]}i64_le_s(e,t){return[...e,...t,87]}i64_le_u(e,t){return[...e,...t,88]}i64_ge_s(e,t){return[...e,...t,89]}i64_ge_u(e,t){return[...e,...t,90]}i64_add(e,t){return[...e,...t,124]}i64_sub(e,t){return[...e,...t,125]}i64_mul(e,t){return[...e,...t,126]}i64_div_s(e,t){return[...e,...t,127]}i64_div_u(e,t){return[...e,...t,128]}i64_rem_s(e,t){return[...e,...t,129]}i64_rem_u(e,t){return[...e,...t,130]}i64_and(e,t){return[...e,...t,131]}i64_or(e,t){return[...e,...t,132]}i64_xor(e,t){return[...e,...t,133]}i64_shl(e,t){return[...e,...t,134]}i64_shr_s(e,t){return[...e,...t,135]}i64_shr_u(e,t){return[...e,...t,136]}i64_extend_i32_s(e){return[...e,172]}i64_extend_i32_u(e){return[...e,173]}i64_clz(e){return[...e,121]}i64_ctz(e){return[...e,122]}i32_eqz(e){return[...e,69]}i32_eq(e,t){return[...e,...t,70]}i32_ne(e,t){return[...e,...t,71]}i32_lt_s(e,t){return[...e,...t,72]}i32_lt_u(e,t){return[...e,...t,73]}i32_gt_s(e,t){return[...e,...t,74]}i32_gt_u(e,t){return[...e,...t,75]}i32_le_s(e,t){return[...e,...t,76]}i32_le_u(e,t){return[...e,...t,77]}i32_ge_s(e,t){return[...e,...t,78]}i32_ge_u(e,t){return[...e,...t,79]}i32_add(e,t){return[...e,...t,106]}i32_sub(e,t){return[...e,...t,107]}i32_mul(e,t){return[...e,...t,108]}i32_div_s(e,t){return[...e,...t,109]}i32_div_u(e,t){return[...e,...t,110]}i32_rem_s(e,t){return[...e,...t,111]}i32_rem_u(e,t){return[...e,...t,112]}i32_and(e,t){return[...e,...t,113]}i32_or(e,t){return[...e,...t,114]}i32_xor(e,t){return[...e,...t,115]}i32_shl(e,t){return[...e,...t,116]}i32_shr_s(e,t){return[...e,...t,117]}i32_shr_u(e,t){return[...e,...t,118]}i32_rotl(e,t){return[...e,...t,119]}i32_rotr(e,t){return[...e,...t,120]}i32_wrap_i64(e){return[...e,167]}i32_clz(e){return[...e,103]}i32_ctz(e){return[...e,104]}unreachable(){return[0]}current_memory(){return[63,0]}comment(){return[]}}const Ao={i32:127,i64:126,f32:125,f64:124,anyfunc:112,func:96,emptyblock:64};class _c{constructor(e,t,i,o,a){if(i==\"import\")this.fnType=\"import\",this.moduleName=o,this.fieldName=a;else if(i==\"internal\")this.fnType=\"internal\";else throw new Error(\"Invalid function fnType: \"+i);this.module=e,this.fnName=t,this.params=[],this.locals=[],this.localIdxByName={},this.code=[],this.returnType=null,this.nextLocal=0}addParam(e,t){if(this.localIdxByName[e])throw new Error(`param already exists. Function: ${this.fnName}, Param: ${e} `);const i=this.nextLocal++;this.localIdxByName[e]=i,this.params.push({type:t})}addLocal(e,t,i){const o=i||1;if(this.localIdxByName[e])throw new Error(`local already exists. Function: ${this.fnName}, Param: ${e} `);const a=this.nextLocal++;this.localIdxByName[e]=a,this.locals.push({type:t,length:o})}setReturnType(e){if(this.returnType)throw new Error(`returnType already defined. Function: ${this.fnName}`);this.returnType=e}getSignature(){const e=[...Wt(this.params.length),...this.params.map(i=>Ao[i.type])],t=this.returnType?[1,Ao[this.returnType]]:[0];return[96,...e,...t]}getBody(){const e=this.locals.map(i=>[...Wt(i.length),Ao[i.type]]),t=[...Wt(this.locals.length),...[].concat(...e),...this.code,11];return[...Wt(t.length),...t]}addCode(...e){this.code.push(...[].concat(...e))}getCodeBuilder(){return new su(this)}}class as{constructor(){this.functions=[],this.functionIdxByName={},this.nImportFunctions=0,this.nInternalFunctions=0,this.memory={pagesSize:1,moduleName:\"env\",fieldName:\"memory\"},this.free=8,this.datas=[],this.modules={},this.exports=[],this.functionsTable=[]}build(){return this._setSignatures(),new Uint8Array([...Lo(1836278016),...Lo(1),...this._buildType(),...this._buildImport(),...this._buildFunctionDeclarations(),...this._buildFunctionsTable(),...this._buildExports(),...this._buildElements(),...this._buildCode(),...this._buildData()])}addFunction(e){if(typeof this.functionIdxByName[e]<\"u\")throw new Error(`Function already defined: ${e}`);const t=this.functions.length;return this.functionIdxByName[e]=t,this.functions.push(new _c(this,e,\"internal\")),this.nInternalFunctions++,this.functions[t]}addIimportFunction(e,t,i){if(typeof this.functionIdxByName[e]<\"u\")throw new Error(`Function already defined: ${e}`);if(this.functions.length>0&&this.functions[this.functions.length-1].type==\"internal\")throw new Error(`Import functions must be declared before internal: ${e}`);let o=i||e;const a=this.functions.length;return this.functionIdxByName[e]=a,this.functions.push(new _c(this,e,\"import\",t,o)),this.nImportFunctions++,this.functions[a]}setMemory(e,t,i){this.memory={pagesSize:e,moduleName:t||\"env\",fieldName:i||\"memory\"}}exportFunction(e,t){const i=t||e;if(typeof this.functionIdxByName[e]>\"u\")throw new Error(`Function not defined: ${e}`);const o=this.functionIdxByName[e];i!=e&&(this.functionIdxByName[i]=o),this.exports.push({exportName:i,idx:o})}addFunctionToTable(e){const t=this.functionIdxByName[e];this.functionsTable.push(t)}addData(e,t){this.datas.push({offset:e,bytes:t})}alloc(e,t){let i,o;(Array.isArray(e)||ArrayBuffer.isView(e))&&typeof t>\"u\"?(i=e.length,o=e):(i=e,o=t),i=(i-1>>3)+1<<3;const a=this.free;return this.free+=i,o&&this.addData(a,o),a}allocString(e){const i=new globalThis.TextEncoder().encode(e);return this.alloc([...i,0])}_setSignatures(){this.signatures=[];const e={};if(this.functionsTable.length>0){const t=this.functions[this.functionsTable[0]].getSignature(),i=\"s_\"+fc(t);e[i]=0,this.signatures.push(t)}for(let t=0;t<this.functions.length;t++){const i=this.functions[t].getSignature(),o=\"s_\"+fc(i);typeof e[o]>\"u\"&&(e[o]=this.signatures.length,this.signatures.push(i)),this.functions[t].signatureIdx=e[o]}}_buildSection(e,t){return[e,...Wt(t.length),...t]}_buildType(){return this._buildSection(1,[...Wt(this.signatures.length),...[].concat(...this.signatures)])}_buildImport(){const e=[];e.push([...Nn(this.memory.moduleName),...Nn(this.memory.fieldName),2,0,...Wt(this.memory.pagesSize)]);for(let t=0;t<this.nImportFunctions;t++)e.push([...Nn(this.functions[t].moduleName),...Nn(this.functions[t].fieldName),0,...Wt(this.functions[t].signatureIdx)]);return this._buildSection(2,Wt(e.length).concat(...e))}_buildFunctionDeclarations(){const e=[];for(let t=this.nImportFunctions;t<this.nImportFunctions+this.nInternalFunctions;t++)e.push(...Wt(this.functions[t].signatureIdx));return this._buildSection(3,[...Wt(e.length),...e])}_buildFunctionsTable(){return this.functionsTable.length==0?[]:this._buildSection(4,[...Wt(1),112,0,...Wt(this.functionsTable.length)])}_buildElements(){if(this.functionsTable.length==0)return[];const e=[];for(let t=0;t<this.functionsTable.length;t++)e.push(...Wt(this.functionsTable[t]));return this._buildSection(9,[...Wt(1),...Wt(0),65,...Yo(0),11,...Wt(this.functionsTable.length),...e])}_buildExports(){const e=[];for(let t=0;t<this.exports.length;t++)e.push([...Nn(this.exports[t].exportName),0,...Wt(this.exports[t].idx)]);return this._buildSection(7,Wt(e.length).concat(...e))}_buildCode(){const e=[];for(let t=this.nImportFunctions;t<this.nImportFunctions+this.nInternalFunctions;t++)e.push(this.functions[t].getBody());return this._buildSection(10,Wt(e.length).concat(...e))}_buildData(){const e=[];e.push([0,65,0,11,4,...Lo(this.free)]);for(let t=0;t<this.datas.length;t++)e.push([0,65,...Yo(this.datas[t].offset),11,...Wt(this.datas[t].bytes.length),...this.datas[t].bytes]);return this._buildSection(11,Wt(e.length).concat(...e))}}globalThis.curve_bn128=null;async function lu(n,e){const t=new as;t.setMemory(25),$r.buildBn128(t);const i={};i.code=t.build(),i.pq=t.modules.f1m.pq,i.pr=t.modules.frm.pq,i.pG1gen=t.modules.bn128.pG1gen,i.pG1zero=t.modules.bn128.pG1zero,i.pG1b=t.modules.bn128.pG1b,i.pG2gen=t.modules.bn128.pG2gen,i.pG2zero=t.modules.bn128.pG2zero,i.pG2b=t.modules.bn128.pG2b,i.pOneT=t.modules.bn128.pOneT,i.prePSize=t.modules.bn128.prePSize,i.preQSize=t.modules.bn128.preQSize,i.n8q=32,i.n8r=32,i.q=t.modules.bn128.q,i.r=t.modules.bn128.r;const o={name:\"bn128\",wasm:i,q:ue(\"21888242871839275222246405745257275088696311157297823662689037894645226208583\"),r:ue(\"21888242871839275222246405745257275088548364400416034343698204186575808495617\"),n8q:32,n8r:32,cofactorG2:ue(\"30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d\",16),singleThread:!0},a=await es(o);return a.terminate=async function(){o.singleThread||(globalThis.curve_bn128=null,await this.tm.terminate())},a}globalThis.curve_bls12381=null;async function du(n,e){const t=new as;t.setMemory(25),$r.buildBls12381(t);const i={};if(i.code=t.build(),i.pq=t.modules.f1m.pq,i.pr=t.modules.frm.pq,i.pG1gen=t.modules.bls12381.pG1gen,i.pG1zero=t.modules.bls12381.pG1zero,i.pG1b=t.modules.bls12381.pG1b,i.pG2gen=t.modules.bls12381.pG2gen,i.pG2zero=t.modules.bls12381.pG2zero,i.pG2b=t.modules.bls12381.pG2b,i.pOneT=t.modules.bls12381.pOneT,i.prePSize=t.modules.bls12381.prePSize,i.preQSize=t.modules.bls12381.preQSize,i.n8q=48,i.n8r=32,i.q=t.modules.bls12381.q,i.r=t.modules.bls12381.r,globalThis.curve_bls12381)return globalThis.curve_bls12381;const o={name:\"bls12381\",wasm:i,q:ue(\"1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab\",16),r:ue(\"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001\",16),n8q:48,n8r:32,cofactorG1:ue(\"0x396c8c005555e1568c00aaab0000aaab\",16),cofactorG2:ue(\"0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5\",16),singleThread:!1},a=await es(o);return a.terminate=async function(){o.singleThread||(globalThis.curve_bls12381=null,await this.tm.terminate())},globalThis.curve_bls12381=a,a}ue(\"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001\",16);ue(\"21888242871839275222246405745257275088548364400416034343698204186575808495617\");ue(\"1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab\",16);ue(\"21888242871839275222246405745257275088696311157297823662689037894645226208583\");const se=Fl,La=Pd;async function cs(n,e,t,i){if(t=t||4096*64,typeof e!=\"number\"&&[\"w+\",\"wx+\",\"r\",\"ax+\",\"a+\"].indexOf(e)<0)throw new Error(\"Invalid open option\");const o=await fa.promises.open(n,e),a=await o.stat();return new uu(o,a,t,i,n)}class uu{constructor(e,t,i,o,a){for(this.fileName=a,this.fd=e,this.pos=0,this.pageSize=o||256;this.pageSize<t.blksize;)this.pageSize*=2;this.totalSize=t.size,this.totalPages=Math.floor((t.size-1)/this.pageSize)+1,this.maxPagesLoaded=Math.floor(i/this.pageSize)+1,this.pages={},this.pendingLoads=[],this.writing=!1,this.reading=!1,this.avBuffs=[],this.history={}}_loadPage(e){const t=this,i=new Promise((o,a)=>{t.pendingLoads.push({page:e,resolve:o,reject:a})});return t.__statusPage(\"After Load request: \",e),i}__statusPage(e,t){const i=[],o=this;if(!o.logHistory)return;i.push(\"==\"+e+\" \"+t);let a=\"\";for(let s=0;s<o.pendingLoads.length;s++)o.pendingLoads[s].page==t&&(a=a+\" \"+s);if(a&&i.push(\"Pending loads:\"+a),typeof o.pages[t]<\"u\"){const s=o.pages[t];i.push(\"Loaded\"),i.push(\"pendingOps: \"+s.pendingOps),s.loading&&i.push(\"loading: \"+s.loading),s.writing&&i.push(\"writing\"),s.dirty&&i.push(\"dirty\")}i.push(\"==\"),o.history[t]||(o.history[t]=[]),o.history[t].push(i)}__printHistory(e){const t=this;t.history[e]||console.log(\"Empty History \",e),console.log(\"History \"+e);for(let i=0;i<t.history[e].length;i++)for(let o=0;o<t.history[e][i].length;o++)console.log(\"-> \"+t.history[e][i][o])}_triggerLoad(){const e=this;if(e.reading||e.pendingLoads.length==0)return;const t=Object.keys(e.pages),i=[];for(let l=0;l<t.length;l++){const g=e.pages[parseInt(t[l])];g.dirty==!1&&g.pendingOps==0&&!g.writing&&!g.loading&&i.push(parseInt(t[l]))}let o=e.maxPagesLoaded-t.length;const a=[];for(;e.pendingLoads.length>0&&(typeof e.pages[e.pendingLoads[0].page]<\"u\"||o>0||i.length>0);){const l=e.pendingLoads.shift();if(typeof e.pages[l.page]<\"u\"){e.pages[l.page].pendingOps++;const g=i.indexOf(l.page);g>=0&&i.splice(g,1),e.pages[l.page].loading?e.pages[l.page].loading.push(l):l.resolve(),e.__statusPage(\"After Load (cached): \",l.page)}else{if(o)o--;else{const g=i.shift();e.__statusPage(\"Before Unload: \",g),e.avBuffs.unshift(e.pages[g]),delete e.pages[g],e.__statusPage(\"After Unload: \",g)}l.page>=e.totalPages?(e.pages[l.page]=s(),l.resolve(),e.__statusPage(\"After Load (new): \",l.page)):(e.reading=!0,e.pages[l.page]=s(),e.pages[l.page].loading=[l],a.push(e.fd.read(e.pages[l.page].buff,0,e.pageSize,l.page*e.pageSize).then(g=>{e.pages[l.page].size=g.bytesRead;const d=e.pages[l.page].loading;delete e.pages[l.page].loading;for(let u=0;u<d.length;u++)d[u].resolve();return e.__statusPage(\"After Load (loaded): \",l.page),g},g=>{l.reject(g)})),e.__statusPage(\"After Load (loading): \",l.page))}}Promise.all(a).then(()=>{e.reading=!1,e.pendingLoads.length>0&&setImmediate(e._triggerLoad.bind(e)),e._tryClose()});function s(){if(e.avBuffs.length>0){const l=e.avBuffs.shift();return l.dirty=!1,l.pendingOps=1,l.size=0,l}else return{dirty:!1,buff:new Uint8Array(e.pageSize),pendingOps:1,size:0}}}_triggerWrite(){const e=this;if(e.writing)return;const t=Object.keys(e.pages),i=[];for(let o=0;o<t.length;o++){const a=e.pages[parseInt(t[o])];a.dirty&&(a.dirty=!1,a.writing=!0,e.writing=!0,i.push(e.fd.write(a.buff,0,a.size,parseInt(t[o])*e.pageSize).then(()=>{a.writing=!1},s=>{console.log(\"ERROR Writing: \"+s),e.error=s,e._tryClose()})))}e.writing&&Promise.all(i).then(()=>{e.writing=!1,setImmediate(e._triggerWrite.bind(e)),e._tryClose(),e.pendingLoads.length>0&&setImmediate(e._triggerLoad.bind(e))})}_getDirtyPage(){for(let e in this.pages)if(this.pages[e].dirty)return e;return-1}async write(e,t){if(e.byteLength==0)return;const i=this;if(typeof t>\"u\"&&(t=i.pos),i.pos=t+e.byteLength,i.totalSize<t+e.byteLength&&(i.totalSize=t+e.byteLength),i.pendingClose)throw new Error(\"Writing a closing file\");const o=Math.floor(t/i.pageSize),a=Math.floor((t+e.byteLength-1)/i.pageSize),s=[];for(let u=o;u<=a;u++)s.push(i._loadPage(u));i._triggerLoad();let l=o,g=t%i.pageSize,d=e.byteLength;for(;d>0;){await s[l-o];const u=g+d>i.pageSize?i.pageSize-g:d,w=e.slice(e.byteLength-d,e.byteLength-d+u);new Uint8Array(i.pages[l].buff.buffer,g,u).set(w),i.pages[l].dirty=!0,i.pages[l].pendingOps--,i.pages[l].size=Math.max(g+u,i.pages[l].size),l>=i.totalPages&&(i.totalPages=l+1),d=d-u,l++,g=0,i.writing||setImmediate(i._triggerWrite.bind(i))}}async read(e,t){const i=this;let o=new Uint8Array(e);return await i.readToBuffer(o,0,e,t),o}async readToBuffer(e,t,i,o){if(i==0)return;const a=this;if(i>a.pageSize*a.maxPagesLoaded*.8){const C=Math.floor(i*1.1);this.maxPagesLoaded=Math.floor(C/a.pageSize)+1}if(typeof o>\"u\"&&(o=a.pos),a.pos=o+i,a.pendingClose)throw new Error(\"Reading a closing file\");const s=Math.floor(o/a.pageSize),l=Math.floor((o+i-1)/a.pageSize),g=[];for(let C=s;C<=l;C++)g.push(a._loadPage(C));a._triggerLoad();let d=s,u=o%a.pageSize,w=o+i>a.totalSize?i-(o+i-a.totalSize):i;for(;w>0;){await g[d-s],a.__statusPage(\"After Await (read): \",d);const C=u+w>a.pageSize?a.pageSize-u:w,h=new Uint8Array(a.pages[d].buff.buffer,a.pages[d].buff.byteOffset+u,C);e.set(h,t+i-w),a.pages[d].pendingOps--,a.__statusPage(\"After Op done: \",d),w=w-C,d++,u=0,a.pendingLoads.length>0&&setImmediate(a._triggerLoad.bind(a))}this.pos=o+i}_tryClose(){const e=this;!e.pendingClose||(e.error&&e.pendingCloseReject(e.error),e._getDirtyPage()>=0||e.writing||e.reading||e.pendingLoads.length>0)||e.pendingClose()}close(){const e=this;if(e.pendingClose)throw new Error(\"Closing the file twice\");return new Promise((t,i)=>{e.pendingClose=t,e.pendingCloseReject=i,e._tryClose()}).then(()=>{e.fd.close()},t=>{throw e.fd.close(),t})}async discard(){await this.close(),await fa.promises.unlink(this.fileName)}async writeULE32(e,t){const i=this,o=new Uint8Array(4);new DataView(o.buffer).setUint32(0,e,!0),await i.write(o,t)}async writeUBE32(e,t){const i=this,o=new Uint8Array(4);new DataView(o.buffer).setUint32(0,e,!1),await i.write(o,t)}async writeULE64(e,t){const i=this,o=new Uint8Array(8),a=new DataView(o.buffer);a.setUint32(0,e&4294967295,!0),a.setUint32(4,Math.floor(e/4294967296),!0),await i.write(o,t)}async readULE32(e){const i=await this.read(4,e);return new Uint32Array(i.buffer)[0]}async readUBE32(e){const i=await this.read(4,e);return new DataView(i.buffer).getUint32(0,!1)}async readULE64(e){const i=await this.read(8,e),o=new Uint32Array(i.buffer);return o[1]*4294967296+o[0]}async readString(e){const t=this;if(t.pendingClose)throw new Error(\"Reading a closing file\");let i=typeof e>\"u\"?t.pos:e,o=Math.floor(i/t.pageSize),a=!1,s=\"\";for(;!a;){let l=t._loadPage(o);t._triggerLoad(),await l,t.__statusPage(\"After Await (read): \",o);let g=i%t.pageSize;const d=new Uint8Array(t.pages[o].buff.buffer,t.pages[o].buff.byteOffset+g,t.pageSize-g);let u=d.findIndex(w=>w===0);a=u!==-1,a?(s+=new TextDecoder().decode(d.slice(0,u)),t.pos=o*this.pageSize+g+u+1):(s+=new TextDecoder().decode(d),t.pos=o*this.pageSize+g+d.length),t.pages[o].pendingOps--,t.__statusPage(\"After Op done: \",o),i=t.pos,o++,t.pendingLoads.length>0&&setImmediate(t._triggerLoad.bind(t))}return s}}function fu(n){const e=n.initialSize||1048576,t=new ss;return t.o=n,t.o.data=new Uint8Array(e),t.allocSize=e,t.totalSize=0,t.readOnly=!1,t.pos=0,t}function _u(n){const e=new ss;return e.o=n,e.allocSize=n.data.byteLength,e.totalSize=n.data.byteLength,e.readOnly=!0,e.pos=0,e}const Wo=new Uint8Array(4),hc=new DataView(Wo.buffer),rs=new Uint8Array(8),gc=new DataView(rs.buffer);class ss{constructor(){this.pageSize=16384}_resizeIfNeeded(e){if(e>this.allocSize){const t=Math.max(this.allocSize+1048576,Math.floor(this.allocSize*1.1),e),i=new Uint8Array(t);i.set(this.o.data),this.o.data=i,this.allocSize=t}}async write(e,t){if(typeof t>\"u\"&&(t=this.pos),this.readOnly)throw new Error(\"Writing a read only file\");this._resizeIfNeeded(t+e.byteLength),this.o.data.set(e.slice(),t),t+e.byteLength>this.totalSize&&(this.totalSize=t+e.byteLength),this.pos=t+e.byteLength}async readToBuffer(e,t,i,o){if(typeof o>\"u\"&&(o=this.pos),this.readOnly&&o+i>this.totalSize)throw new Error(\"Reading out of bounds\");this._resizeIfNeeded(o+i);const s=new Uint8Array(this.o.data.buffer,this.o.data.byteOffset+o,i);e.set(s,t),this.pos=o+i}async read(e,t){const i=this,o=new Uint8Array(e);return await i.readToBuffer(o,0,e,t),o}close(){this.o.data.byteLength!=this.totalSize&&(this.o.data=this.o.data.slice(0,this.totalSize))}async discard(){}async writeULE32(e,t){const i=this;hc.setUint32(0,e,!0),await i.write(Wo,t)}async writeUBE32(e,t){const i=this;hc.setUint32(0,e,!1),await i.write(Wo,t)}async writeULE64(e,t){const i=this;gc.setUint32(0,e&4294967295,!0),gc.setUint32(4,Math.floor(e/4294967296),!0),await i.write(rs,t)}async readULE32(e){const i=await this.read(4,e);return new Uint32Array(i.buffer)[0]}async readUBE32(e){const i=await this.read(4,e);return new DataView(i.buffer).getUint32(0,!1)}async readULE64(e){const i=await this.read(8,e),o=new Uint32Array(i.buffer);return o[1]*4294967296+o[0]}async readString(e){const t=this;let i=typeof e>\"u\"?t.pos:e;if(i>this.totalSize){if(this.readOnly)throw new Error(\"Reading out of bounds\");this._resizeIfNeeded(e)}const o=new Uint8Array(t.o.data.buffer,i,this.totalSize-i);let a=o.findIndex(g=>g===0),s=a!==-1,l=\"\";return s?(l=new TextDecoder().decode(o.slice(0,a)),t.pos=i+a+1):t.pos=i,l}}const _e=1<<22;function hu(n){const e=n.initialSize||0,t=new ds;t.o=n;const i=e?Math.floor((e-1)/_e)+1:0;t.o.data=[];for(let o=0;o<i-1;o++)t.o.data.push(new Uint8Array(_e));return i&&t.o.data.push(new Uint8Array(e-_e*(i-1))),t.totalSize=0,t.readOnly=!1,t.pos=0,t}function gu(n){const e=new ds;return e.o=n,e.totalSize=(n.data.length-1)*_e+n.data[n.data.length-1].byteLength,e.readOnly=!0,e.pos=0,e}const Xo=new Uint8Array(4),pc=new DataView(Xo.buffer),ls=new Uint8Array(8),Lc=new DataView(ls.buffer);class ds{constructor(){this.pageSize=16384}_resizeIfNeeded(e){if(e<=this.totalSize)return;if(this.readOnly)throw new Error(\"Reading out of file bounds\");const t=Math.floor((e-1)/_e)+1;for(let i=Math.max(this.o.data.length-1,0);i<t;i++){const o=i<t-1?_e:e-(t-1)*_e,a=new Uint8Array(o);i==this.o.data.length-1&&a.set(this.o.data[i]),this.o.data[i]=a}this.totalSize=e}async write(e,t){const i=this;if(typeof t>\"u\"&&(t=i.pos),this.readOnly)throw new Error(\"Writing a read only file\");this._resizeIfNeeded(t+e.byteLength);let a=Math.floor(t/_e),s=t%_e,l=e.byteLength;for(;l>0;){const g=s+l>_e?_e-s:l,d=e.slice(e.byteLength-l,e.byteLength-l+g);new Uint8Array(i.o.data[a].buffer,s,g).set(d),l=l-g,a++,s=0}this.pos=t+e.byteLength}async readToBuffer(e,t,i,o){const a=this;if(typeof o>\"u\"&&(o=a.pos),this.readOnly&&o+i>this.totalSize)throw new Error(\"Reading out of bounds\");this._resizeIfNeeded(o+i);let l=Math.floor(o/_e),g=o%_e,d=i;for(;d>0;){const u=g+d>_e?_e-g:d,w=new Uint8Array(a.o.data[l].buffer,g,u);e.set(w,t+i-d),d=d-u,l++,g=0}this.pos=o+i}async read(e,t){const i=this,o=new Uint8Array(e);return await i.readToBuffer(o,0,e,t),o}close(){}async discard(){}async writeULE32(e,t){const i=this;pc.setUint32(0,e,!0),await i.write(Xo,t)}async writeUBE32(e,t){const i=this;pc.setUint32(0,e,!1),await i.write(Xo,t)}async writeULE64(e,t){const i=this;Lc.setUint32(0,e&4294967295,!0),Lc.setUint32(4,Math.floor(e/4294967296),!0),await i.write(ls,t)}async readULE32(e){const i=await this.read(4,e);return new Uint32Array(i.buffer)[0]}async readUBE32(e){const i=await this.read(4,e);return new DataView(i.buffer).getUint32(0,!1)}async readULE64(e){const i=await this.read(8,e),o=new Uint32Array(i.buffer);return o[1]*4294967296+o[0]}async readString(e){const t=this,i=2048;let o=typeof e>\"u\"?t.pos:e;if(o>this.totalSize){if(this.readOnly)throw new Error(\"Reading out of bounds\");this._resizeIfNeeded(e)}let a=!1,s=\"\";for(;!a;){let l=Math.floor(o/_e),g=o%_e;if(t.o.data[l]===void 0)throw new Error(\"ERROR\");let d=Math.min(i,t.o.data[l].length-g);const u=new Uint8Array(t.o.data[l].buffer,g,d);let w=u.findIndex(C=>C===0);a=w!==-1,a?(s+=new TextDecoder().decode(u.slice(0,w)),t.pos=l*_e+g+w+1):(s+=new TextDecoder().decode(u),t.pos=l*_e+g+u.length),o=t.pos}return s}}var pu=0,Lu=2,Au=512,bu=1024;const yu=65536,mu=8192;async function us(n,e,t){if(typeof n==\"string\"&&(n={type:\"file\",fileName:n,cacheSize:yu,pageSize:mu}),n.type==\"file\")return await cs(n.fileName,bu|Au|Lu,n.cacheSize,n.pageSize);if(n.type==\"mem\")return fu(n);if(n.type==\"bigMem\")return hu(n);throw new Error(\"Invalid FastFile type: \"+n.type)}async function Aa(n,e,t){if(n instanceof Uint8Array&&(n={type:\"mem\",data:n}),typeof n==\"string\"&&(n={type:\"mem\",data:await fetch(n).then(function(o){return o.arrayBuffer()}).then(function(o){return new Uint8Array(o)})}),n.type==\"file\")return await cs(n.fileName,pu,n.cacheSize,n.pageSize);if(n.type==\"mem\")return await _u(n);if(n.type==\"bigMem\")return await gu(n);throw new Error(\"Invalid FastFile type: \"+n.type)}async function wu(n,e,t,i,o){const a=await Aa(n),s=await a.read(4);let l=\"\";for(let w=0;w<4;w++)l+=String.fromCharCode(s[w]);if(l!=e)throw new Error(n+\": Invalid File format\");if(await a.readULE32()>t)throw new Error(\"Version not supported\");const d=await a.readULE32();let u=[];for(let w=0;w<d;w++){let C=await a.readULE32(),h=await a.readULE64();typeof u[C]>\"u\"&&(u[C]=[]),u[C].push({p:a.pos,size:h}),a.pos+=h}return{fd:a,sections:u}}async function Iu(n,e,t,i,o,a){const s=await us(n),l=new Uint8Array(4);for(let g=0;g<4;g++)l[g]=e.charCodeAt(g);return await s.write(l,0),await s.writeULE32(t),await s.writeULE32(i),s}async function Ac(n,e){if(typeof n.writingSection<\"u\")throw new Error(\"Already writing a section\");await n.writeULE32(e),n.writingSection={pSectionSize:n.pos},await n.writeULE64(0)}async function bc(n){if(typeof n.writingSection>\"u\")throw new Error(\"Not writing a section\");const e=n.pos-n.writingSection.pSectionSize-8,t=n.pos;n.pos=n.writingSection.pSectionSize,await n.writeULE64(e),n.pos=t,delete n.writingSection}async function Cu(n,e,t){if(typeof n.readingSection<\"u\")throw new Error(\"Already reading a section\");if(!e[t])throw new Error(n.fileName+\": Missing section \"+t);if(e[t].length>1)throw new Error(n.fileName+\": Section Duplicated \"+t);n.pos=e[t][0].p,n.readingSection=e[t][0]}async function fs(n,e){if(typeof n.readingSection>\"u\")throw new Error(\"Not reading a section\");if(n.pos-n.readingSection.p!=n.readingSection.size)throw new Error(\"Invalid section size reading\");delete n.readingSection}async function Eu(n,e,t,i){const o=new Uint8Array(t);se.toRprLE(o,0,e,t),await n.write(o,i)}async function Jo(n,e,t){const i=await n.read(e,t);return se.fromRprLE(i,0,e)}async function Bu(n,e,t,i,o){if(i=typeof i>\"u\"?0:i,o=typeof o>\"u\"?e[t][0].size-i:o,i+o>e[t][0].size)throw new Error(\"Reading out of the range of the section\");let a;return o<1<<30?a=new Uint8Array(o):a=new ce(o),await n.readToBuffer(a,0,o,e[t][0].p+i),a}function yc(n){return String.fromCharCode(97+n)}async function ba(n,e,t){const i=n+yc(e),o=\"zky\"+yc(e),a=await vi.getItem(i),s=await Aa(new Uint8Array(a)),l=await s.read(4);let g=\"\";for(let C=0;C<4;C++)g+=String.fromCharCode(l[C]);if(g!=o)throw new Error(i+\": Invalid File format\");if(await s.readULE32()>t)throw new Error(\"Version not supported\");if(await s.readULE32()!=1)throw new Error(\"More than one section found\");let w=await s.readULE64();return s.readingSection={size:w,p:s.pos},s}async function _s(n,e){if(typeof n.readingSection>\"u\")throw new Error(\"Not reading a section\");if(n.pos-n.readingSection.p!=n.readingSection.size)throw new Error(\"Invalid section size reading\");await n.close(),delete n.readingSection}async function In(n,e,t){const i=await ba(n,e,t);let o;return i.readingSection.size<1<<30?o=new Uint8Array(i.readingSection.size):o=new ce(i.readingSection.size),await i.readToBuffer(o,0,i.readingSection.size,i.pos),await _s(i),o}se.e(\"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001\",16);se.e(\"21888242871839275222246405745257275088548364400416034343698204186575808495617\");const xu=se.e(\"1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab\",16),vu=se.e(\"21888242871839275222246405745257275088696311157297823662689037894645226208583\");async function Fu(n){let e;if(se.eq(n,vu))e=await lu();else if(se.eq(n,xu))e=await du();else throw new Error(`Curve not supported: ${se.toString(n)}`);return e}var Ue={exports:{}},bo,mc;function Su(){if(mc)return bo;mc=1,bo=e;class n extends Error{}n.prototype.name=\"AssertionError\";function e(t,i){if(!t){var o=new n(i);throw Error.captureStackTrace&&Error.captureStackTrace(o,e),o}}return bo}var yi={exports:{}},yo,wc;function Ou(){if(wc)return yo;wc=1;function n(i){return i.length}function e(i){const o=i.byteLength;let a=\"\";for(let s=0;s<o;s++)a+=String.fromCharCode(i[s]);return a}function t(i,o,a=0,s=n(o)){const l=Math.min(s,i.byteLength-a);for(let g=0;g<l;g++)i[a+g]=o.charCodeAt(g);return l}return yo={byteLength:n,toString:e,write:t},yo}var mo,Ic;function Pu(){if(Ic)return mo;Ic=1;const n=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",e=new Uint8Array(256);for(let a=0;a<n.length;a++)e[n.charCodeAt(a)]=a;e[45]=62,e[95]=63;function t(a){let s=a.length;return a.charCodeAt(s-1)===61&&s--,s>1&&a.charCodeAt(s-1)===61&&s--,s*3>>>2}function i(a){const s=a.byteLength;let l=\"\";for(let g=0;g<s;g+=3)l+=n[a[g]>>2]+n[(a[g]&3)<<4|a[g+1]>>4]+n[(a[g+1]&15)<<2|a[g+2]>>6]+n[a[g+2]&63];return s%3===2?l=l.substring(0,l.length-1)+\"=\":s%3===1&&(l=l.substring(0,l.length-2)+\"==\"),l}function o(a,s,l=0,g=t(s)){const d=Math.min(g,a.byteLength-l);for(let u=0,w=0;w<d;u+=4){const C=e[s.charCodeAt(u)],h=e[s.charCodeAt(u+1)],m=e[s.charCodeAt(u+2)],O=e[s.charCodeAt(u+3)];a[w++]=C<<2|h>>4,a[w++]=(h&15)<<4|m>>2,a[w++]=(m&3)<<6|O&63}return d}return mo={byteLength:t,toString:i,write:o},mo}var wo,Cc;function Uu(){if(Cc)return wo;Cc=1;function n(o){return o.length>>>1}function e(o){const a=o.byteLength;o=new DataView(o.buffer,o.byteOffset,a);let s=\"\",l=0;for(let g=a-a%4;l<g;l+=4)s+=o.getUint32(l).toString(16).padStart(8,\"0\");for(;l<a;l++)s+=o.getUint8(l).toString(16).padStart(2,\"0\");return s}function t(o,a,s=0,l=n(a)){const g=Math.min(l,o.byteLength-s);for(let d=0;d<g;d++){const u=i(a.charCodeAt(d*2)),w=i(a.charCodeAt(d*2+1));if(u===void 0||w===void 0)return o.subarray(0,d);o[s+d]=u<<4|w}return g}wo={byteLength:n,toString:e,write:t};function i(o){if(o>=48&&o<=57)return o-48;if(o>=65&&o<=70)return o-65+10;if(o>=97&&o<=102)return o-97+10}return wo}var Io,Ec;function Mu(){if(Ec)return Io;Ec=1;function n(i){let o=0;for(let a=0,s=i.length;a<s;a++){const l=i.charCodeAt(a);if(l>=55296&&l<=56319&&a+1<s){const g=i.charCodeAt(a+1);if(g>=56320&&g<=57343){o+=4,a++;continue}}l<=127?o+=1:l<=2047?o+=2:o+=3}return o}let e;if(typeof TextDecoder<\"u\"){const i=new TextDecoder;e=function(a){return i.decode(a)}}else e=function(o){const a=o.byteLength;let s=\"\",l=0;for(;l<a;){let g=o[l];if(g<=127){s+=String.fromCharCode(g),l++;continue}let d=0,u=0;if(g<=223?(d=1,u=g&31):g<=239?(d=2,u=g&15):g<=244&&(d=3,u=g&7),a-l-d>0){let w=0;for(;w<d;)g=o[l+w+1],u=u<<6|g&63,w+=1}else u=65533,d=a-l;s+=String.fromCodePoint(u),l+=d+1}return s};let t;if(typeof TextEncoder<\"u\"){const i=new TextEncoder;t=function(a,s,l=0,g=n(s)){const d=Math.min(g,a.byteLength-l);return i.encodeInto(s,a.subarray(l,l+d)),d}}else t=function(o,a,s=0,l=n(a)){const g=Math.min(l,o.byteLength-s);o=o.subarray(s,s+g);let d=0,u=0;for(;d<a.length;){const w=a.codePointAt(d);if(w<=127){o[u++]=w,d++;continue}let C=0,h=0;for(w<=2047?(C=6,h=192):w<=65535?(C=12,h=224):w<=2097151&&(C=18,h=240),o[u++]=h|w>>C,C-=6;C>=0;)o[u++]=128|w>>C&63,C-=6;d+=w>=65536?2:1}return g};return Io={byteLength:n,toString:e,write:t},Io}var Co,Bc;function Tu(){if(Bc)return Co;Bc=1;function n(i){return i.length*2}function e(i){const o=i.byteLength;let a=\"\";for(let s=0;s<o-1;s+=2)a+=String.fromCharCode(i[s]+i[s+1]*256);return a}function t(i,o,a=0,s=n(o)){const l=Math.min(s,i.byteLength-a);let g=l;for(let d=0;d<o.length&&!((g-=2)<0);++d){const u=o.charCodeAt(d),w=u>>8,C=u%256;i[a+d*2]=C,i[a+d*2+1]=w}return l}return Co={byteLength:n,toString:e,write:t},Co}var xc;function Ru(){return xc||(xc=1,function(n,e){const t=Ou(),i=Pu(),o=Uu(),a=Mu(),s=Tu(),l=new Uint8Array(Uint16Array.of(255).buffer)[0]===255;function g(H){switch(H){case\"ascii\":return t;case\"base64\":return i;case\"hex\":return o;case\"utf8\":case\"utf-8\":case void 0:case null:return a;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return s;default:throw new Error(`Unknown encoding: ${H}`)}}function d(H){return H instanceof Uint8Array}function u(H){try{return g(H),!0}catch{return!1}}function w(H,Z,V){const gt=new Uint8Array(H);return Z!==void 0&&e.fill(gt,Z,0,gt.byteLength,V),gt}function C(H){return new Uint8Array(H)}function h(H){return new Uint8Array(H)}function m(H,Z){return g(Z).byteLength(H)}function O(H,Z){if(H===Z)return 0;const V=Math.min(H.byteLength,Z.byteLength);H=new DataView(H.buffer,H.byteOffset,H.byteLength),Z=new DataView(Z.buffer,Z.byteOffset,Z.byteLength);let gt=0;for(let Ft=V-V%4;gt<Ft;gt+=4){const qt=H.getUint32(gt,l),W=Z.getUint32(gt,l);if(qt!==W)break}for(;gt<V;gt++){const Ft=H.getUint8(gt),qt=Z.getUint8(gt);if(Ft<qt)return-1;if(Ft>qt)return 1}return H.byteLength>Z.byteLength?1:H.byteLength<Z.byteLength?-1:0}function Q(H,Z){Z===void 0&&(Z=H.reduce((Ft,qt)=>Ft+qt.byteLength,0));const V=new Uint8Array(Z);let gt=0;for(const Ft of H){if(gt+Ft.byteLength>V.byteLength){const qt=Ft.subarray(0,V.byteLength-gt);return V.set(qt,gt),V}V.set(Ft,gt),gt+=Ft.byteLength}return V}function P(H,Z,V=0,gt=0,Ft=H.byteLength){if(Ft>0&&Ft<gt||Ft===gt||H.byteLength===0||Z.byteLength===0)return 0;if(V<0)throw new RangeError(\"targetStart is out of range\");if(gt<0||gt>=H.byteLength)throw new RangeError(\"sourceStart is out of range\");if(Ft<0)throw new RangeError(\"sourceEnd is out of range\");V>=Z.byteLength&&(V=Z.byteLength),Ft>H.byteLength&&(Ft=H.byteLength),Z.byteLength-V<Ft-gt&&(Ft=Z.length-V+gt);const qt=Ft-gt;return H===Z?Z.copyWithin(V,gt,Ft):Z.set(H.subarray(gt,Ft),V),qt}function G(H,Z){if(H===Z)return!0;if(H.byteLength!==Z.byteLength)return!1;const V=H.byteLength;H=new DataView(H.buffer,H.byteOffset,H.byteLength),Z=new DataView(Z.buffer,Z.byteOffset,Z.byteLength);let gt=0;for(let Ft=V-V%4;gt<Ft;gt+=4)if(H.getUint32(gt,l)!==Z.getUint32(gt,l))return!1;for(;gt<V;gt++)if(H.getUint8(gt)!==Z.getUint8(gt))return!1;return!0}function st(H,Z,V,gt,Ft){if(typeof Z==\"string\"?typeof V==\"string\"?(Ft=V,V=0,gt=H.byteLength):typeof gt==\"string\"&&(Ft=gt,gt=H.byteLength):typeof Z==\"number\"?Z=Z&255:typeof Z==\"boolean\"&&(Z=+Z),V<0||H.byteLength<V||H.byteLength<gt)throw new RangeError(\"Out of range index\");if(V===void 0&&(V=0),gt===void 0&&(gt=H.byteLength),gt<=V)return H;if(Z||(Z=0),typeof Z==\"number\")for(let qt=V;qt<gt;++qt)H[qt]=Z;else{Z=d(Z)?Z:N(Z,Ft);const qt=Z.byteLength;for(let W=0;W<gt-V;++W)H[W+V]=Z[W%qt]}return H}function N(H,Z,V){return typeof H==\"string\"?y(H,Z):Array.isArray(H)?I(H):ArrayBuffer.isView(H)?_(H):M(H,Z,V)}function y(H,Z){const V=g(Z),gt=new Uint8Array(V.byteLength(H));return V.write(gt,H,0,gt.byteLength),gt}function I(H){const Z=new Uint8Array(H.length);return Z.set(H),Z}function _(H){const Z=new Uint8Array(H.byteLength);return Z.set(H),Z}function M(H,Z,V){return new Uint8Array(H,Z,V)}function F(H,Z,V,gt){return D(H,Z,V,gt)!==-1}function L(H,Z,V,gt,Ft){if(H.byteLength===0)return-1;if(typeof V==\"string\"?(gt=V,V=0):V===void 0?V=Ft?0:H.length-1:V<0&&(V+=H.byteLength),V>=H.byteLength){if(Ft)return-1;V=H.byteLength-1}else if(V<0)if(Ft)V=0;else return-1;if(typeof Z==\"string\")Z=N(Z,gt);else if(typeof Z==\"number\")return Z=Z&255,Ft?H.indexOf(Z,V):H.lastIndexOf(Z,V);if(Z.byteLength===0)return-1;if(Ft){let qt=-1;for(let W=V;W<H.byteLength;W++)if(H[W]===Z[qt===-1?0:W-qt]){if(qt===-1&&(qt=W),W-qt+1===Z.byteLength)return qt}else qt!==-1&&(W-=W-qt),qt=-1}else{V+Z.byteLength>H.byteLength&&(V=H.byteLength-Z.byteLength);for(let qt=V;qt>=0;qt--){let W=!0;for(let b=0;b<Z.byteLength;b++)if(H[qt+b]!==Z[b]){W=!1;break}if(W)return qt}}return-1}function D(H,Z,V,gt){return L(H,Z,V,gt,!0)}function K(H,Z,V,gt){return L(H,Z,V,gt,!1)}function $(H,Z,V){const gt=H[Z];H[Z]=H[V],H[V]=gt}function S(H){const Z=H.byteLength;if(Z%2!==0)throw new RangeError(\"Buffer size must be a multiple of 16-bits\");for(let V=0;V<Z;V+=2)$(H,V,V+1);return H}function B(H){const Z=H.byteLength;if(Z%4!==0)throw new RangeError(\"Buffer size must be a multiple of 32-bits\");for(let V=0;V<Z;V+=4)$(H,V,V+3),$(H,V+1,V+2);return H}function E(H){const Z=H.byteLength;if(Z%8!==0)throw new RangeError(\"Buffer size must be a multiple of 64-bits\");for(let V=0;V<Z;V+=8)$(H,V,V+7),$(H,V+1,V+6),$(H,V+2,V+5),$(H,V+3,V+4);return H}function _t(H){return H}function tt(H,Z,V=0,gt=H.byteLength){const Ft=H.byteLength;return V>=Ft||gt<=V?\"\":(V<0&&(V=0),gt>Ft&&(gt=Ft),(V!==0||gt<Ft)&&(H=H.subarray(V,gt)),g(Z).toString(H))}function ft(H,Z,V,gt,Ft){return V===void 0?Ft=\"utf8\":gt===void 0&&typeof V==\"string\"?(Ft=V,V=void 0):Ft===void 0&&typeof gt==\"string\"&&(Ft=gt,gt=void 0),g(Ft).write(H,Z,V,gt)}function Bt(H,Z,V){return V===void 0&&(V=0),new DataView(H.buffer,H.byteOffset,H.byteLength).setFloat64(V,Z,!0),V+8}function Ct(H,Z,V){return V===void 0&&(V=0),new DataView(H.buffer,H.byteOffset,H.byteLength).setFloat32(V,Z,!0),V+4}function St(H,Z,V){return V===void 0&&(V=0),new DataView(H.buffer,H.byteOffset,H.byteLength).setUint32(V,Z,!0),V+4}function Ot(H,Z,V){return V===void 0&&(V=0),new DataView(H.buffer,H.byteOffset,H.byteLength).setInt32(V,Z,!0),V+4}function Dt(H,Z){return Z===void 0&&(Z=0),new DataView(H.buffer,H.byteOffset,H.byteLength).getFloat64(Z,!0)}function x(H,Z){return Z===void 0&&(Z=0),new DataView(H.buffer,H.byteOffset,H.byteLength).getFloat32(Z,!0)}function ht(H,Z){return Z===void 0&&(Z=0),new DataView(H.buffer,H.byteOffset,H.byteLength).getUint32(Z,!0)}function yt(H,Z){return Z===void 0&&(Z=0),new DataView(H.buffer,H.byteOffset,H.byteLength).getInt32(Z,!0)}function U(H,Z,V){return V===void 0&&(V=0),new DataView(H.buffer,H.byteOffset,H.byteLength).setFloat64(V,Z,!1),V+8}function r(H,Z,V){return V===void 0&&(V=0),new DataView(H.buffer,H.byteOffset,H.byteLength).setFloat32(V,Z,!1),V+4}function dt(H,Z,V){return V===void 0&&(V=0),new DataView(H.buffer,H.byteOffset,H.byteLength).setUint32(V,Z,!1),V+4}function k(H,Z,V){return V===void 0&&(V=0),new DataView(H.buffer,H.byteOffset,H.byteLength).setInt32(V,Z,!1),V+4}function f(H,Z){return Z===void 0&&(Z=0),new DataView(H.buffer,H.byteOffset,H.byteLength).getFloat64(Z,!1)}function ct(H,Z){return Z===void 0&&(Z=0),new DataView(H.buffer,H.byteOffset,H.byteLength).getFloat32(Z,!1)}function It(H,Z){return Z===void 0&&(Z=0),new DataView(H.buffer,H.byteOffset,H.byteLength).getUint32(Z,!1)}function bt(H,Z){return Z===void 0&&(Z=0),new DataView(H.buffer,H.byteOffset,H.byteLength).getInt32(Z,!1)}n.exports=e={isBuffer:d,isEncoding:u,alloc:w,allocUnsafe:C,allocUnsafeSlow:h,byteLength:m,compare:O,concat:Q,copy:P,equals:G,fill:st,from:N,includes:F,indexOf:D,lastIndexOf:K,swap16:S,swap32:B,swap64:E,toBuffer:_t,toString:tt,write:ft,writeDoubleLE:Bt,writeFloatLE:Ct,writeUInt32LE:St,writeInt32LE:Ot,readDoubleLE:Dt,readFloatLE:x,readUInt32LE:ht,readInt32LE:yt,writeDoubleBE:U,writeFloatBE:r,writeUInt32BE:dt,writeInt32BE:k,readDoubleBE:f,readFloatBE:ct,readUInt32BE:It,readInt32BE:bt}}(yi,yi.exports)),yi.exports}var Eo,vc;function Du(){if(vc)return Eo;vc=1;var n=(a,s)=>function(){return s||(0,a[Object.keys(a)[0]])((s={exports:{}}).exports,s),s.exports},e=(()=>{for(var a=new Uint8Array(128),s=0;s<64;s++)a[s<26?s+65:s<52?s+71:s<62?s-4:s*4-205]=s;return l=>{for(var g=l.length,d=new Uint8Array((g-(l[g-1]==\"=\")-(l[g-2]==\"=\"))*3/4|0),u=0,w=0;u<g;){var C=a[l.charCodeAt(u++)],h=a[l.charCodeAt(u++)],m=a[l.charCodeAt(u++)],O=a[l.charCodeAt(u++)];d[w++]=C<<2|h>>4,d[w++]=h<<4|m>>2,d[w++]=m<<6|O}return d}})(),t=n({\"wasm-binary:./blake2b.wat\"(a,s){s.exports=e(\"AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMKvz8EwAIAIABCADcDACAAQgA3AwggAEIANwMQIABCADcDGCAAQgA3AyAgAEIANwMoIABCADcDMCAAQgA3AzggAEIANwNAIABCADcDSCAAQgA3A1AgAEIANwNYIABCADcDYCAAQgA3A2ggAEIANwNwIABCADcDeCAAQoiS853/zPmE6gBBACkDAIU3A4ABIABCu86qptjQ67O7f0EIKQMAhTcDiAEgAEKr8NP0r+68tzxBECkDAIU3A5ABIABC8e30+KWn/aelf0EYKQMAhTcDmAEgAELRhZrv+s+Uh9EAQSApAwCFNwOgASAAQp/Y+dnCkdqCm39BKCkDAIU3A6gBIABC6/qG2r+19sEfQTApAwCFNwOwASAAQvnC+JuRo7Pw2wBBOCkDAIU3A7gBIABCADcDwAEgAEIANwPIASAAQgA3A9ABC20BA38gAEHAAWohAyAAQcgBaiEEIAQpAwCnIQUCQANAIAEgAkYNASAFQYABRgRAIAMgAykDACAFrXw3AwBBACEFIAAQAwsgACAFaiABLQAAOgAAIAVBAWohBSABQQFqIQEMAAsLIAQgBa03AwALYQEDfyAAQcABaiEBIABByAFqIQIgASABKQMAIAIpAwB8NwMAIABCfzcD0AEgAikDAKchAwJAA0AgA0GAAUYNASAAIANqQQA6AAAgA0EBaiEDDAALCyACIAOtNwMAIAAQAwuqOwIgfgl/IABBgAFqISEgAEGIAWohIiAAQZABaiEjIABBmAFqISQgAEGgAWohJSAAQagBaiEmIABBsAFqIScgAEG4AWohKCAhKQMAIQEgIikDACECICMpAwAhAyAkKQMAIQQgJSkDACEFICYpAwAhBiAnKQMAIQcgKCkDACEIQoiS853/zPmE6gAhCUK7zqqm2NDrs7t/IQpCq/DT9K/uvLc8IQtC8e30+KWn/aelfyEMQtGFmu/6z5SH0QAhDUKf2PnZwpHagpt/IQ5C6/qG2r+19sEfIQ9C+cL4m5Gjs/DbACEQIAApAwAhESAAKQMIIRIgACkDECETIAApAxghFCAAKQMgIRUgACkDKCEWIAApAzAhFyAAKQM4IRggACkDQCEZIAApA0ghGiAAKQNQIRsgACkDWCEcIAApA2AhHSAAKQNoIR4gACkDcCEfIAApA3ghICANIAApA8ABhSENIA8gACkD0AGFIQ8gASAFIBF8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSASfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgE3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBR8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAVfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFnx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBd8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAYfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgGXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBp8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAbfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgHHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIB18fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAefHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgH3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFICB8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAffHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgG3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBV8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAZfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHICB8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAefHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggF3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBJ8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAdfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgEXx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBN8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAcfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggGHx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBZ8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAUfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHHx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBl8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAdfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgEXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBZ8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByATfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggIHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIB58fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAbfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgH3x8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBR8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAXfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBJ8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAafHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFXx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBh8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAafHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFHx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBJ8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAefHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHXx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBx8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAffHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgE3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBd8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAWfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgG3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBV8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCARfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgIHx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBl8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAafHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEXx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBZ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAYfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgE3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBV8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAbfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggIHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIB98fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiASfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgHHx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB18fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAXfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggGXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBR8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAefHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgE3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIB18fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAXfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgG3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBF8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAcfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggGXx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBR8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAVfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBh8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAWfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggIHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB98fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSASfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgGnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB18fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAWfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgEnx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGICB8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAffHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHnx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBV8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAbfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBh8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAXfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBp8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCATfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGXx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBx8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAefHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgHHx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBh8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAffHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBJ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAUfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBZ8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiARfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgIHx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBV8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAZfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggF3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBN8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAbfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgF3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFICB8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAffHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGnx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBx8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAUfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggEXx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBl8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAdfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgE3x8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIB58fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAYfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggEnx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBV8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAbfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBt8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSATfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgGXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBV8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAYfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgF3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBJ8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAWfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgIHx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBx8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAafHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgH3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBR8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAdfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgHnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBF8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgISAhKQMAIAEgCYWFNwMAICIgIikDACACIAqFhTcDACAjICMpAwAgAyALhYU3AwAgJCAkKQMAIAQgDIWFNwMAICUgJSkDACAFIA2FhTcDACAmICYpAwAgBiAOhYU3AwAgJyAnKQMAIAcgD4WFNwMAICggKCkDACAIIBCFhTcDAAs=\")}}),i=t(),o=WebAssembly.compile(i);return Eo=async a=>(await WebAssembly.instantiate(await o,a)).exports,Eo}var Fc;function ku(){if(Fc)return Ue.exports;Fc=1;var n=Su(),e=Ru(),t=null,i=typeof WebAssembly<\"u\"&&Du()().then(m=>{t=m}),o=64,a=[];Ue.exports=C;var s=Ue.exports.BYTES_MIN=16,l=Ue.exports.BYTES_MAX=64;Ue.exports.BYTES=32;var g=Ue.exports.KEYBYTES_MIN=16,d=Ue.exports.KEYBYTES_MAX=64;Ue.exports.KEYBYTES=32;var u=Ue.exports.SALTBYTES=16,w=Ue.exports.PERSONALBYTES=16;function C(m,O,Q,P,G){if(!(this instanceof C))return new C(m,O,Q,P,G);if(!t)throw new Error(\"WASM not loaded. Wait for Blake2b.ready(cb)\");m||(m=32),G!==!0&&(n(m>=s,\"digestLength must be at least \"+s+\", was given \"+m),n(m<=l,\"digestLength must be at most \"+l+\", was given \"+m),O!=null&&(n(O instanceof Uint8Array,\"key must be Uint8Array or Buffer\"),n(O.length>=g,\"key must be at least \"+g+\", was given \"+O.length),n(O.length<=d,\"key must be at least \"+d+\", was given \"+O.length)),Q!=null&&(n(Q instanceof Uint8Array,\"salt must be Uint8Array or Buffer\"),n(Q.length===u,\"salt must be exactly \"+u+\", was given \"+Q.length)),P!=null&&(n(P instanceof Uint8Array,\"personal must be Uint8Array or Buffer\"),n(P.length===w,\"personal must be exactly \"+w+\", was given \"+P.length))),a.length||(a.push(o),o+=216),this.digestLength=m,this.finalized=!1,this.pointer=a.pop(),this._memory=new Uint8Array(t.memory.buffer),this._memory.fill(0,0,64),this._memory[0]=this.digestLength,this._memory[1]=O?O.length:0,this._memory[2]=1,this._memory[3]=1,Q&&this._memory.set(Q,32),P&&this._memory.set(P,48),this.pointer+216>this._memory.length&&this._realloc(this.pointer+216),t.blake2b_init(this.pointer,this.digestLength),O&&(this.update(O),this._memory.fill(0,o,o+O.length),this._memory[this.pointer+200]=128)}C.prototype._realloc=function(m){t.memory.grow(Math.max(0,Math.ceil(Math.abs(m-this._memory.length)/65536))),this._memory=new Uint8Array(t.memory.buffer)},C.prototype.update=function(m){return n(this.finalized===!1,\"Hash instance finalized\"),n(m instanceof Uint8Array,\"input must be Uint8Array or Buffer\"),o+m.length>this._memory.length&&this._realloc(o+m.length),this._memory.set(m,o),t.blake2b_update(this.pointer,o,o+m.length),this},C.prototype.digest=function(m){if(n(this.finalized===!1,\"Hash instance finalized\"),this.finalized=!0,a.push(this.pointer),t.blake2b_final(this.pointer),!m||m===\"binary\")return this._memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(typeof m==\"string\")return e.toString(this._memory,m,this.pointer+128,this.pointer+128+this.digestLength);n(m instanceof Uint8Array&&m.length>=this.digestLength,\"input must be Uint8Array or Buffer\");for(var O=0;O<this.digestLength;O++)m[O]=this._memory[this.pointer+128+O];return m},C.prototype.final=C.prototype.digest,C.WASM=t,C.SUPPORTED=typeof WebAssembly<\"u\",C.ready=function(m){return m||(m=h),i?i.then(()=>m(),m):m(new Error(\"WebAssembly not supported\"))},C.prototype.ready=C.ready,C.prototype.getPartialHash=function(){return this._memory.slice(this.pointer,this.pointer+216)},C.prototype.setPartialHash=function(m){this._memory.set(m,this.pointer)};function h(){}return Ue.exports}ku();function hs(n){return(n&4294901760?(n&=4294901760,16):0)|(n&4278255360?(n&=4278255360,8):0)|(n&4042322160?(n&=4042322160,4):0)|(n&3435973836?(n&=3435973836,2):0)|(n&2863311530)!==0}async function Bo(n,e,t){const i=await n.read(e.G1.F.n8*2),o=e.G1.fromRprLEM(i,0);return t?e.G1.toObject(o):o}async function xo(n,e,t){const i=await n.read(e.G2.F.n8*2),o=e.G2.fromRprLEM(i,0);return t?e.G2.toObject(o):o}async function zu(n,e){const t=await ba(n,1,e),i=await t.readULE32();if(await _s(t),i==1)return await qu(n,e);throw new Error(\"Protocol not supported: \")}async function qu(n,e,t){const i={};i.protocol=\"groth16\";const o=await ba(n,2,e),a=await o.readULE32();i.n8q=a,i.q=await Jo(o,a);const s=await o.readULE32();return i.n8r=s,i.r=await Jo(o,s),i.curve=await Fu(i.q),i.nVars=await o.readULE32(),i.nPublic=await o.readULE32(),i.domainSize=await o.readULE32(),i.power=hs(i.domainSize),i.vk_alpha_1=await Bo(o,i.curve,t),i.vk_beta_1=await Bo(o,i.curve,t),i.vk_beta_2=await xo(o,i.curve,t),i.vk_gamma_2=await xo(o,i.curve,t),i.vk_delta_1=await Bo(o,i.curve,t),i.vk_delta_2=await xo(o,i.curve,t),await fs(o),i}async function Qu(n,e,t){await Ac(n,1);const i=(Math.floor((se.bitLength(t)-1)/64)+1)*8;if(await n.writeULE32(i),await Eu(n,t,i),e.byteLength%i!=0)throw new Error(\"Invalid witness length\");await n.writeULE32(e.byteLength/i),await bc(n),await Ac(n,2),await n.write(e),await bc(n)}async function Nu(n,e){await Cu(n,e,1);const t=await n.readULE32(),i=await Jo(n,t),o=await n.readULE32();return await fs(n),{n8:t,q:i,nWitness:o}}const{stringifyBigInts:Sc}=La;async function Gu(n,e,t){const{fd:i,sections:o}=await wu(e,\"wtns\",2),a=await Nu(i,o),s=2,l=await zu(n,s);if(l.protocol!=\"groth16\")throw new Error(\"zkey file is not groth16\");if(!se.eq(l.r,a.q))throw new Error(\"Curve of the witness does not match the curve of the proving key\");if(a.nWitness!=l.nVars)throw new Error(`Invalid witness length. Circuit: ${l.nVars}, witness: ${a.nWitness}`);const g=l.curve,d=g.Fr,u=g.G1,w=g.G2,C=hs(l.domainSize),h=await Bu(i,o,2),m=await In(n,4,s),[O,Q,P]=await Ku(g,l,h,m),G=C==d.s?g.Fr.shift:g.Fr.w[C+1],st=await d.ifft(O,\"\",\"\",t,\"IFFT_A\"),N=await d.batchApplyKey(st,d.e(1),G),y=await d.fft(N,\"\",\"\",t,\"FFT_A\"),I=await d.ifft(Q,\"\",\"\",t,\"IFFT_B\"),_=await d.batchApplyKey(I,d.e(1),G),M=await d.fft(_,\"\",\"\",t,\"FFT_B\"),F=await d.ifft(P,\"\",\"\",t,\"IFFT_C\"),L=await d.batchApplyKey(F,d.e(1),G),D=await d.fft(L,\"\",\"\",t,\"FFT_C\"),K=await Hu(g,l,y,M,D);let $={};const S=await In(n,5,s);$.pi_a=await g.G1.multiExpAffine(S,h,t,\"multiexp A\");const B=await In(n,6,s);let E=await g.G1.multiExpAffine(B,h,t,\"multiexp B1\");const _t=await In(n,7,s);$.pi_b=await g.G2.multiExpAffine(_t,h,t,\"multiexp B2\");const tt=await In(n,8,s);$.pi_c=await g.G1.multiExpAffine(tt,h.slice((l.nPublic+1)*g.Fr.n8),t,\"multiexp C\");const ft=await In(n,9,s),Bt=await g.G1.multiExpAffine(ft,K,t,\"multiexp H\"),Ct=g.Fr.random(),St=g.Fr.random();$.pi_a=u.add($.pi_a,l.vk_alpha_1),$.pi_a=u.add($.pi_a,u.timesFr(l.vk_delta_1,Ct)),$.pi_b=w.add($.pi_b,l.vk_beta_2),$.pi_b=w.add($.pi_b,w.timesFr(l.vk_delta_2,St)),E=u.add(E,l.vk_beta_1),E=u.add(E,u.timesFr(l.vk_delta_1,St)),$.pi_c=u.add($.pi_c,Bt),$.pi_c=u.add($.pi_c,u.timesFr($.pi_a,St)),$.pi_c=u.add($.pi_c,u.timesFr(E,Ct)),$.pi_c=u.add($.pi_c,u.timesFr(l.vk_delta_1,d.neg(d.mul(Ct,St))));let Ot=[];for(let Dt=1;Dt<=l.nPublic;Dt++){const x=h.slice(Dt*d.n8,Dt*d.n8+d.n8);Ot.push(se.fromRprLE(x))}return $.pi_a=u.toObject(u.toAffine($.pi_a)),$.pi_b=w.toObject(w.toAffine($.pi_b)),$.pi_c=u.toObject(u.toAffine($.pi_c)),$.protocol=\"groth16\",$.curve=g.name,await i.close(),$=Sc($),Ot=Sc(Ot),await g.terminate(),{proof:$,publicSignals:Ot}}async function Ku(n,e,t,i,o){const a=n.Fr.n8,s=4*3+e.n8r,l=(i.byteLength-4)/s,g=new ce(e.domainSize*a),d=new ce(e.domainSize*a),u=new ce(e.domainSize*a),w=[g,d];for(let C=0;C<l;C++){const h=i.slice(4+C*s,4+C*s+s),m=new DataView(h.buffer),O=m.getUint32(0,!0),Q=m.getUint32(4,!0),P=m.getUint32(8,!0),G=h.slice(12,12+a);w[O].set(n.Fr.add(w[O].slice(Q*a,Q*a+a),n.Fr.mul(G,t.slice(P*a,P*a+a))),Q*a)}for(let C=0;C<e.domainSize;C++)u.set(n.Fr.mul(g.slice(C*a,C*a+a),d.slice(C*a,C*a+a)),C*a);return[g,d,u]}async function Hu(n,e,t,i,o,a){const l=n.Fr.n8,g=Math.floor(t.byteLength/n.Fr.n8),d=[];for(let h=0;h<g;h+=4194304){const m=Math.min(g-h,4194304),O=[],Q=t.slice(h*l,(h+m)*l),P=i.slice(h*l,(h+m)*l),G=o.slice(h*l,(h+m)*l);O.push({cmd:\"ALLOCSET\",var:0,buff:Q}),O.push({cmd:\"ALLOCSET\",var:1,buff:P}),O.push({cmd:\"ALLOCSET\",var:2,buff:G}),O.push({cmd:\"ALLOC\",var:3,len:m*l}),O.push({cmd:\"CALL\",fnName:\"qap_joinABC\",params:[{var:0},{var:1},{var:2},{val:m},{var:3}]}),O.push({cmd:\"CALL\",fnName:\"frm_batchFromMontgomery\",params:[{var:3},{val:m},{var:3}]}),O.push({cmd:\"GET\",out:0,var:3,len:m*l}),d.push(n.tm.queueAction(O))}const u=await Promise.all(d);let w;t instanceof ce?w=new ce(t.byteLength):w=new Uint8Array(t.byteLength);let C=0;for(let h=0;h<u.length;h++)w.set(u[h][0],C),C+=u[h][0].byteLength;return w}function gs(n){var e=[];return t(e,n),e;function t(i,o){if(Array.isArray(o))for(let a=0;a<o.length;a++)t(i,o[a]);else i.push(o)}}function ps(n){const e=BigInt(2)**BigInt(64);let t=BigInt(\"0xCBF29CE484222325\");for(var i=0;i<n.length;i++)t^=BigInt(n[i].charCodeAt()),t*=BigInt(1099511628211),t%=e;let o=t.toString(16),a=16-o.length;return o=\"0\".repeat(a).concat(o),o}function Zu(n,e){const t=[];let i=BigInt(n);const o=BigInt(4294967296);for(;i;)t.unshift(Number(i%o)),i=i/o;if(e)for(var a=e-t.length;a>0;)t.unshift(0),a--;return t}async function ju(n,e){e=e||{};let t=32767,i,o=!1;for(;!o;)try{i=new WebAssembly.Memory({initial:t}),o=!0}catch(Q){if(t===1)throw Q;console.warn(\"Could not allocate \"+t*1024*64+\" bytes. This may cause severe instability. Trying with \"+t*1024*64/2+\" bytes\"),t=Math.floor(t/2)}const a=await WebAssembly.compile(n);let s,l=\"\",g=\"\",d=1,u=0,w=0;const C=await WebAssembly.instantiate(a,{env:{memory:i},runtime:{exceptionHandler:function(Q){let P;throw Q==1?P=\"Signal not found. \":Q==2?P=\"Too many signals set. \":Q==3?P=\"Signal already set. \":Q==4?P=\"Assert Failed. \":Q==5?P=\"Not enough memory. \":Q==6?P=\"Input signal array access exceeds the size. \":P=\"Unknown error. \",console.error(\"ERROR: \",Q,l),new Error(P+l)},printErrorMessage:function(){l+=m()+`\n`},writeBufferMessage:function(){const Q=m();Q===`\n`?(console.log(g),g=\"\"):(g!==\"\"&&(g+=\" \"),g+=Q)},showSharedRWMemory:function(){const Q=C.exports.getFieldNumLen32(),P=new Uint32Array(Q);for(let G=0;G<Q;G++)P[Q-1-G]=C.exports.readSharedRWMemory(G);if(d>=2&&(u>=1||w>=7)){g!==\"\"&&(g+=\" \");const G=se.fromArray(P,4294967296).toString();g+=G}else console.log(se.fromArray(P,4294967296))},error:function(Q,P,G,st,N,y){let I;throw Q==7?I=O(P)+\" \"+s.getFr(st).toString()+\" != \"+s.getFr(N).toString()+\" \"+O(y):Q==9?I=O(P)+\" \"+s.getFr(st).toString()+\" \"+O(N):Q==5&&e.sym?I=O(P)+\" \"+e.sym.labelIdx2Name[N]:I=O(P)+\" \"+G+\" \"+st+\" \"+N+\" \"+y,console.log(\"ERROR: \",Q,I),new Error(I)},log:function(Q){console.log(s.getFr(Q).toString())},logGetSignal:function(Q,P){e.logGetSignal&&e.logGetSignal(Q,s.getFr(P))},logSetSignal:function(Q,P){e.logSetSignal&&e.logSetSignal(Q,s.getFr(P))},logStartComponent:function(Q){e.logStartComponent&&e.logStartComponent(Q)},logFinishComponent:function(Q){e.logFinishComponent&&e.logFinishComponent(Q)}}});typeof C.exports.getVersion==\"function\"&&(d=C.exports.getVersion()),typeof C.exports.getMinorVersion==\"function\"&&(u=C.exports.getMinorVersion()),typeof C.exports.getPatchVersion==\"function\"&&(w=C.exports.getPatchVersion());const h=e&&(e.sanityCheck||e.logGetSignal||e.logSetSignal||e.logStartComponent||e.logFinishComponent);return d===2?s=new $u(C,h):s=new Vu(i,C,h),s;function m(){for(var Q=\"\",P=C.exports.getMessageChar();P!=0;)Q+=String.fromCharCode(P),P=C.exports.getMessageChar();return Q}function O(Q){const P=new Uint8Array(i.buffer),G=[];for(let st=0;P[Q+st]>0;st++)G.push(P[Q+st]);return String.fromCharCode.apply(null,G)}}class Vu{constructor(e,t,i){this.memory=e,this.i32=new Uint32Array(e.buffer),this.instance=t,this.n32=(this.instance.exports.getFrLen()>>2)-2;const o=this.instance.exports.getPRawPrime(),a=new Array(this.n32);for(let s=0;s<this.n32;s++)a[this.n32-1-s]=this.i32[(o>>2)+s];this.prime=se.fromArray(a,4294967296),this.Fr=new yd(this.prime),this.mask32=se.fromString(\"FFFFFFFF\",16),this.NVars=this.instance.exports.getNVars(),this.n64=Math.floor((this.Fr.bitLength-1)/64)+1,this.R=this.Fr.e(se.shiftLeft(1,this.n64*64)),this.RInv=this.Fr.inv(this.R),this.sanityCheck=i}circom_version(){return 1}async _doCalculateWitness(e,t){this.instance.exports.init(this.sanityCheck||t?1:0);const i=this.allocInt(),o=this.allocFr();Object.keys(e).forEach(s=>{const l=ps(s),g=parseInt(l.slice(0,8),16),d=parseInt(l.slice(8,16),16);try{this.instance.exports.getSignalOffset32(i,0,g,d)}catch{throw new Error(`Signal ${s} is not an input of the circuit.`)}const u=this.getInt(i),w=gs(e[s]);for(let C=0;C<w.length;C++)this.setFr(o,w[C]),this.instance.exports.setSignal(0,0,u+C,o)})}async calculateWitness(e,t){const i=this,o=i.i32[0],a=[];await i._doCalculateWitness(e,t);for(let s=0;s<i.NVars;s++){const l=i.instance.exports.getPWitness(s);a.push(i.getFr(l))}return i.i32[0]=o,a}async calculateBinWitness(e,t){const i=this,o=i.i32[0];await i._doCalculateWitness(e,t);const a=i.instance.exports.getWitnessBuffer();i.i32[0]=o;const s=i.memory.buffer.slice(a,a+i.NVars*i.n64*8);return new Uint8Array(s)}allocInt(){const e=this.i32[0];return this.i32[0]=e+8,e}allocFr(){const e=this.i32[0];return this.i32[0]=e+this.n32*4+8,e}getInt(e){return this.i32[e>>2]}setInt(e,t){this.i32[e>>2]=t}getFr(e){const t=this,i=e>>2;if(t.i32[i+1]&2147483648){const a=new Array(t.n32);for(let l=0;l<t.n32;l++)a[t.n32-1-l]=t.i32[i+2+l];const s=t.Fr.e(se.fromArray(a,4294967296));return t.i32[i+1]&1073741824?o(s):s}else return t.i32[i]&2147483648?t.Fr.e(t.i32[i]-4294967296):t.Fr.e(t.i32[i]);function o(a){return t.Fr.mul(t.RInv,a)}}setFr(e,t){const i=this;t=i.Fr.e(t);const o=i.Fr.neg(i.Fr.e(\"80000000\",16)),a=i.Fr.e(\"7FFFFFFF\",16);if(i.Fr.geq(t,o)&&i.Fr.leq(t,a)){let l;i.Fr.geq(t,i.Fr.zero)?l=se.toNumber(t):(l=se.toNumber(i.Fr.sub(t,o)),l=l-2147483648,l=4294967296+l),i.i32[e>>2]=l,i.i32[(e>>2)+1]=0;return}i.i32[e>>2]=0,i.i32[(e>>2)+1]=2147483648;const s=se.toArray(t,4294967296);for(let l=0;l<i.n32;l++){const g=s.length-1-l;g>=0?i.i32[(e>>2)+2+l]=s[g]:i.i32[(e>>2)+2+l]=0}}}class $u{constructor(e,t){this.instance=e,this.version=this.instance.exports.getVersion(),this.n32=this.instance.exports.getFieldNumLen32(),this.instance.exports.getRawPrime();const i=new Array(this.n32);for(let o=0;o<this.n32;o++)i[this.n32-1-o]=this.instance.exports.readSharedRWMemory(o);this.prime=se.fromArray(i,4294967296),this.witnessSize=this.instance.exports.getWitnessSize(),this.sanityCheck=t}circom_version(){return this.instance.exports.getVersion()}async _doCalculateWitness(e,t){this.instance.exports.init(this.sanityCheck||t?1:0);const i=Object.keys(e);var o=0;if(i.forEach(a=>{const s=ps(a),l=parseInt(s.slice(0,8),16),g=parseInt(s.slice(8,16),16),d=gs(e[a]);for(let u=0;u<d.length;u++){const w=Zu(d[u],this.n32);for(let C=0;C<this.n32;C++)this.instance.exports.writeSharedRWMemory(C,w[this.n32-1-C]);try{this.instance.exports.setInputSignal(l,g,u),o++}catch(C){throw new Error(C)}}}),o<this.instance.exports.getInputSize())throw new Error(`Not all inputs have been set. Only ${o} out of ${this.instance.exports.getInputSize()}`)}async calculateWitness(e,t){const i=[];await this._doCalculateWitness(e,t);for(let o=0;o<this.witnessSize;o++){this.instance.exports.getWitness(o);const a=new Uint32Array(this.n32);for(let s=0;s<this.n32;s++)a[this.n32-1-s]=this.instance.exports.readSharedRWMemory(s);i.push(se.fromArray(a,4294967296))}return i}async calculateWTNSBin(e,t){const i=new Uint32Array(this.witnessSize*this.n32+this.n32+11),o=new Uint8Array(i.buffer);await this._doCalculateWitness(e,t),o[0]=119,o[1]=116,o[2]=110,o[3]=115,i[1]=2,i[2]=2,i[3]=1;const a=this.n32*4,l=(8+a).toString(16);i[4]=parseInt(l.slice(0,8),16),i[5]=parseInt(l.slice(8,16),16),i[6]=a,this.instance.exports.getRawPrime();var g=7;for(let w=0;w<this.n32;w++)i[g+w]=this.instance.exports.readSharedRWMemory(w);g+=this.n32,i[g]=this.witnessSize,g++,i[g]=2,g++;const u=(a*this.witnessSize).toString(16);i[g]=parseInt(u.slice(0,8),16),i[g+1]=parseInt(u.slice(8,16),16),g+=2;for(let w=0;w<this.witnessSize;w++){this.instance.exports.getWitness(w);for(let C=0;C<this.n32;C++)i[g+C]=this.instance.exports.readSharedRWMemory(C);g+=this.n32}return o}}const{unstringifyBigInts:Yu}=La;async function Wu(n,e,t,i){const o=Yu(n),a=await Aa(e),s=await a.read(a.totalSize);await a.close();const l=await ju(s);if(l.circom_version()==1){const g=await l.calculateBinWitness(o),d=await Iu(t,\"wtns\",2,2);await Qu(d,g,l.prime),await d.close()}else{const g=await us(t),d=await l.calculateWTNSBin(o);await g.write(d),await g.close()}}const{unstringifyBigInts:Xu}=La;async function Ju(n,e,t,i){const o=Xu(n),a={type:\"mem\"};console.time(\"witness calculation\"),await Wu(o,e,a),console.timeEnd(\"witness calculation\"),console.time(\"groth16 prove\");const s=await Gu(t,a,i);return console.timeEnd(\"groth16 prove\"),s}se.e(\"73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001\",16);se.e(\"21888242871839275222246405745257275088548364400416034343698204186575808495617\");var vo={};function Ls(n,e){for(var t=0,i=n.length-1;i>=0;i--){var o=n[i];o===\".\"?n.splice(i,1):o===\"..\"?(n.splice(i,1),t++):t&&(n.splice(i,1),t--)}if(e)for(;t--;t)n.unshift(\"..\");return n}var tf=/^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/,ya=function(n){return tf.exec(n).slice(1)};function Pi(){for(var n=\"\",e=!1,t=arguments.length-1;t>=-1&&!e;t--){var i=t>=0?arguments[t]:\"/\";if(typeof i!=\"string\")throw new TypeError(\"Arguments to path.resolve must be strings\");if(!i)continue;n=i+\"/\"+n,e=i.charAt(0)===\"/\"}return n=Ls(Ia(n.split(\"/\"),function(o){return!!o}),!e).join(\"/\"),(e?\"/\":\"\")+n||\".\"}function ma(n){var e=wa(n),t=nf(n,-1)===\"/\";return n=Ls(Ia(n.split(\"/\"),function(i){return!!i}),!e).join(\"/\"),!n&&!e&&(n=\".\"),n&&t&&(n+=\"/\"),(e?\"/\":\"\")+n}function wa(n){return n.charAt(0)===\"/\"}function As(){var n=Array.prototype.slice.call(arguments,0);return ma(Ia(n,function(e,t){if(typeof e!=\"string\")throw new TypeError(\"Arguments to path.join must be strings\");return e}).join(\"/\"))}function bs(n,e){n=Pi(n).substr(1),e=Pi(e).substr(1);function t(d){for(var u=0;u<d.length&&d[u]===\"\";u++);for(var w=d.length-1;w>=0&&d[w]===\"\";w--);return u>w?[]:d.slice(u,w-u+1)}for(var i=t(n.split(\"/\")),o=t(e.split(\"/\")),a=Math.min(i.length,o.length),s=a,l=0;l<a;l++)if(i[l]!==o[l]){s=l;break}for(var g=[],l=s;l<i.length;l++)g.push(\"..\");return g=g.concat(o.slice(s)),g.join(\"/\")}var ys=\"/\",ms=\":\";function ws(n){var e=ya(n),t=e[0],i=e[1];return!t&&!i?\".\":(i&&(i=i.substr(0,i.length-1)),t+i)}function Is(n,e){var t=ya(n)[2];return e&&t.substr(-1*e.length)===e&&(t=t.substr(0,t.length-e.length)),t}function Cs(n){return ya(n)[3]}const ef={extname:Cs,basename:Is,dirname:ws,sep:ys,delimiter:ms,relative:bs,join:As,isAbsolute:wa,normalize:ma,resolve:Pi};function Ia(n,e){if(n.filter)return n.filter(e);for(var t=[],i=0;i<n.length;i++)e(n[i],i,n)&&t.push(n[i]);return t}var nf=\"ab\".substr(-1)===\"b\"?function(n,e,t){return n.substr(e,t)}:function(n,e,t){return e<0&&(e=n.length+e),n.substr(e,t)};const of=Object.freeze(Object.defineProperty({__proto__:null,basename:Is,default:ef,delimiter:ms,dirname:ws,extname:Cs,isAbsolute:wa,join:As,normalize:ma,relative:bs,resolve:Pi,sep:ys},Symbol.toStringTag,{value:\"Module\"})),af=wr(of);var Fo={},Oc;function cf(){return Oc||(Oc=1,function(n){var e=/[|\\\\{}()[\\]^$+*?.]/g,t=Object.prototype.hasOwnProperty,i=function(d,u){return t.apply(d,[u])};n.escapeRegExpChars=function(d){return d?String(d).replace(e,\"\\\\$&\"):\"\"};var o={\"&\":\"&amp;\",\"<\":\"&lt;\",\">\":\"&gt;\",'\"':\"&#34;\",\"'\":\"&#39;\"},a=/[&<>'\"]/g;function s(d){return o[d]||d}var l=`var _ENCODE_HTML_RULES = {\n \"&\": \"&amp;\"\n , \"<\": \"&lt;\"\n , \">\": \"&gt;\"\n , '\"': \"&#34;\"\n , \"'\": \"&#39;\"\n }\n , _MATCH_HTML = /[&<>'\"]/g;\nfunction encode_char(c) {\n return _ENCODE_HTML_RULES[c] || c;\n};\n`;n.escapeXML=function(d){return d==null?\"\":String(d).replace(a,s)};function g(){return Function.prototype.toString.call(this)+`;\n`+l}try{typeof Object.defineProperty==\"function\"?Object.defineProperty(n.escapeXML,\"toString\",{value:g}):n.escapeXML.toString=g}catch{console.warn(\"Unable to set escapeXML.toString (is the Function prototype frozen?)\")}n.shallowCopy=function(d,u){if(u=u||{},d!=null)for(var w in u)i(u,w)&&(w===\"__proto__\"||w===\"constructor\"||(d[w]=u[w]));return d},n.shallowCopyFromList=function(d,u,w){if(w=w||[],u=u||{},d!=null)for(var C=0;C<w.length;C++){var h=w[C];if(typeof u[h]<\"u\"){if(!i(u,h)||h===\"__proto__\"||h===\"constructor\")continue;d[h]=u[h]}}return d},n.cache={_data:{},set:function(d,u){this._data[d]=u},get:function(d){return this._data[d]},remove:function(d){delete this._data[d]},reset:function(){this._data={}}},n.hyphenToCamel=function(d){return d.replace(/-[a-z]/g,function(u){return u[1].toUpperCase()})},n.createNullProtoObjWherePossible=function(){return typeof Object.create==\"function\"?function(){return Object.create(null)}:{__proto__:null}instanceof Object?function(){return{}}:function(){return{__proto__:null}}}(),n.hasOwnOnlyObject=function(d){var u=n.createNullProtoObjWherePossible();for(var w in d)i(d,w)&&(u[w]=d[w]);return u}}(Fo)),Fo}const rf=\"ejs\",sf=\"Embedded JavaScript templates\",lf=[\"template\",\"engine\",\"ejs\"],df=\"3.1.10\",uf=\"Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)\",ff=\"Apache-2.0\",_f={ejs:\"./bin/cli.js\"},hf=\"./lib/ejs.js\",gf=\"ejs.min.js\",pf=\"ejs.min.js\",Lf={type:\"git\",url:\"git://github.com/mde/ejs.git\"},Af=\"https://github.com/mde/ejs/issues\",bf=\"https://github.com/mde/ejs\",yf={jake:\"^10.8.5\"},mf={browserify:\"^16.5.1\",eslint:\"^6.8.0\",\"git-directory-deploy\":\"^1.5.1\",jsdoc:\"^4.0.2\",\"lru-cache\":\"^4.0.1\",mocha:\"^10.2.0\",\"uglify-js\":\"^3.3.16\"},wf={node:\">=0.10.0\"},If={test:\"npx jake test\"},Cf={name:rf,description:sf,keywords:lf,version:df,author:uf,license:ff,bin:_f,main:hf,jsdelivr:gf,unpkg:pf,repository:Lf,bugs:Af,homepage:bf,dependencies:yf,devDependencies:mf,engines:wf,scripts:If};var Pc;function Ef(){return Pc||(Pc=1,function(n){/**\n * @file Embedded JavaScript templating engine. {@link http://ejs.co}\n * @author Matthew Eernisse <mde@fleegix.org>\n * @author Tiancheng \"Timothy\" Gu <timothygu99@gmail.com>\n * @project EJS\n * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}\n */var e=Ld,t=af,i=cf(),o=!1,a=Cf.version,s=\"<\",l=\">\",g=\"%\",d=\"locals\",u=\"ejs\",w=\"(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)\",C=[\"delimiter\",\"scope\",\"context\",\"debug\",\"compileDebug\",\"client\",\"_with\",\"rmWhitespace\",\"strict\",\"filename\",\"async\"],h=C.concat(\"cache\"),m=/^\\uFEFF/,O=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/;n.cache=i.cache,n.fileLoader=e.readFileSync,n.localsName=d,n.promiseImpl=new Function(\"return this;\")().Promise,n.resolveInclude=function(F,L,D){var K=t.dirname,$=t.extname,S=t.resolve,B=S(D?L:K(L),F),E=$(F);return E||(B+=\".ejs\"),B};function Q(F,L){var D;if(L.some(function(K){return D=n.resolveInclude(F,K,!0),e.existsSync(D)}))return D}function P(F,L){var D,K,$=L.views,S=/^[A-Za-z]+:\\\\|^\\//.exec(F);if(S&&S.length)F=F.replace(/^\\/*/,\"\"),Array.isArray(L.root)?D=Q(F,L.root):D=n.resolveInclude(F,L.root||\"/\",!0);else if(L.filename&&(K=n.resolveInclude(F,L.filename),e.existsSync(K)&&(D=K)),!D&&Array.isArray($)&&(D=Q(F,$)),!D&&typeof L.includer!=\"function\")throw new Error('Could not find the include file \"'+L.escapeFunction(F)+'\"');return D}function G(F,L){var D,K=F.filename,$=arguments.length>1;if(F.cache){if(!K)throw new Error(\"cache option requires a filename\");if(D=n.cache.get(K),D)return D;$||(L=N(K).toString().replace(m,\"\"))}else if(!$){if(!K)throw new Error(\"Internal EJS error: no file name or template provided\");L=N(K).toString().replace(m,\"\")}return D=n.compile(L,F),F.cache&&n.cache.set(K,D),D}function st(F,L,D){var K;if(D){try{K=G(F)(L)}catch($){return D($)}D(null,K)}else{if(typeof n.promiseImpl==\"function\")return new n.promiseImpl(function($,S){try{K=G(F)(L),$(K)}catch(B){S(B)}});throw new Error(\"Please provide a callback function\")}}function N(F){return n.fileLoader(F)}function y(F,L){var D=i.shallowCopy(i.createNullProtoObjWherePossible(),L);if(D.filename=P(F,D),typeof L.includer==\"function\"){var K=L.includer(F,D.filename);if(K&&(K.filename&&(D.filename=K.filename),K.template))return G(D,K.template)}return G(D)}function I(F,L,D,K,$){var S=L.split(`\n`),B=Math.max(K-3,0),E=Math.min(S.length,K+3),_t=$(D),tt=S.slice(B,E).map(function(ft,Bt){var Ct=Bt+B+1;return(Ct==K?\" >> \":\" \")+Ct+\"| \"+ft}).join(`\n`);throw F.path=_t,F.message=(_t||\"ejs\")+\":\"+K+`\n`+tt+`\n\n`+F.message,F}function _(F){return F.replace(/;(\\s*$)/,\"$1\")}n.compile=function(L,D){var K;return D&&D.scope&&(o||(console.warn(\"`scope` option is deprecated and will be removed in EJS 3\"),o=!0),D.context||(D.context=D.scope),delete D.scope),K=new M(L,D),K.compile()},n.render=function(F,L,D){var K=L||i.createNullProtoObjWherePossible(),$=D||i.createNullProtoObjWherePossible();return arguments.length==2&&i.shallowCopyFromList($,K,C),G($,F)(K)},n.renderFile=function(){var F=Array.prototype.slice.call(arguments),L=F.shift(),D,K={filename:L},$,S;return typeof arguments[arguments.length-1]==\"function\"&&(D=F.pop()),F.length?($=F.shift(),F.length?i.shallowCopy(K,F.pop()):($.settings&&($.settings.views&&(K.views=$.settings.views),$.settings[\"view cache\"]&&(K.cache=!0),S=$.settings[\"view options\"],S&&i.shallowCopy(K,S)),i.shallowCopyFromList(K,$,h)),K.filename=L):$=i.createNullProtoObjWherePossible(),st(K,$,D)},n.Template=M,n.clearCache=function(){n.cache.reset()};function M(F,L){var D=i.hasOwnOnlyObject(L),K=i.createNullProtoObjWherePossible();this.templateText=F,this.mode=null,this.truncate=!1,this.currentLine=1,this.source=\"\",K.client=D.client||!1,K.escapeFunction=D.escape||D.escapeFunction||i.escapeXML,K.compileDebug=D.compileDebug!==!1,K.debug=!!D.debug,K.filename=D.filename,K.openDelimiter=D.openDelimiter||n.openDelimiter||s,K.closeDelimiter=D.closeDelimiter||n.closeDelimiter||l,K.delimiter=D.delimiter||n.delimiter||g,K.strict=D.strict||!1,K.context=D.context,K.cache=D.cache||!1,K.rmWhitespace=D.rmWhitespace,K.root=D.root,K.includer=D.includer,K.outputFunctionName=D.outputFunctionName,K.localsName=D.localsName||n.localsName||d,K.views=D.views,K.async=D.async,K.destructuredLocals=D.destructuredLocals,K.legacyInclude=typeof D.legacyInclude<\"u\"?!!D.legacyInclude:!0,K.strict?K._with=!1:K._with=typeof D._with<\"u\"?D._with:!0,this.opts=K,this.regex=this.createRegex()}M.modes={EVAL:\"eval\",ESCAPED:\"escaped\",RAW:\"raw\",COMMENT:\"comment\",LITERAL:\"literal\"},M.prototype={createRegex:function(){var F=w,L=i.escapeRegExpChars(this.opts.delimiter),D=i.escapeRegExpChars(this.opts.openDelimiter),K=i.escapeRegExpChars(this.opts.closeDelimiter);return F=F.replace(/%/g,L).replace(/</g,D).replace(/>/g,K),new RegExp(F)},compile:function(){var F,L,D=this.opts,K=\"\",$=\"\",S=D.escapeFunction,B,E=D.filename?JSON.stringify(D.filename):\"undefined\";if(!this.source){if(this.generateSource(),K+=` var __output = \"\";\n function __append(s) { if (s !== undefined && s !== null) __output += s }\n`,D.outputFunctionName){if(!O.test(D.outputFunctionName))throw new Error(\"outputFunctionName is not a valid JS identifier.\");K+=\" var \"+D.outputFunctionName+` = __append;\n`}if(D.localsName&&!O.test(D.localsName))throw new Error(\"localsName is not a valid JS identifier.\");if(D.destructuredLocals&&D.destructuredLocals.length){for(var _t=\" var __locals = (\"+D.localsName+` || {}),\n`,tt=0;tt<D.destructuredLocals.length;tt++){var ft=D.destructuredLocals[tt];if(!O.test(ft))throw new Error(\"destructuredLocals[\"+tt+\"] is not a valid JS identifier.\");tt>0&&(_t+=`,\n `),_t+=ft+\" = __locals.\"+ft}K+=_t+`;\n`}D._with!==!1&&(K+=\" with (\"+D.localsName+` || {}) {\n`,$+=` }\n`),$+=` return __output;\n`,this.source=K+this.source+$}D.compileDebug?F=`var __line = 1\n , __lines = `+JSON.stringify(this.templateText)+`\n , __filename = `+E+`;\ntry {\n`+this.source+`} catch (e) {\n rethrow(e, __lines, __filename, __line, escapeFn);\n}\n`:F=this.source,D.client&&(F=\"escapeFn = escapeFn || \"+S.toString()+`;\n`+F,D.compileDebug&&(F=\"rethrow = rethrow || \"+I.toString()+`;\n`+F)),D.strict&&(F=`\"use strict\";\n`+F),D.debug&&console.log(F),D.compileDebug&&D.filename&&(F=F+`\n//# sourceURL=`+E+`\n`);try{if(D.async)try{B=new Function(\"return (async function(){}).constructor;\")()}catch(Ot){throw Ot instanceof SyntaxError?new Error(\"This environment does not support async/await\"):Ot}else B=Function;L=new B(D.localsName+\", escapeFn, include, rethrow\",F)}catch(Ot){throw Ot instanceof SyntaxError&&(D.filename&&(Ot.message+=\" in \"+D.filename),Ot.message+=` while compiling ejs\n\n`,Ot.message+=`If the above error is not helpful, you may want to try EJS-Lint:\n`,Ot.message+=\"https://github.com/RyanZim/EJS-Lint\",D.async||(Ot.message+=`\n`,Ot.message+=\"Or, if you meant to create an async function, pass `async: true` as an option.\")),Ot}var Bt=D.client?L:function(Dt){var x=function(ht,yt){var U=i.shallowCopy(i.createNullProtoObjWherePossible(),Dt);return yt&&(U=i.shallowCopy(U,yt)),y(ht,D)(U)};return L.apply(D.context,[Dt||i.createNullProtoObjWherePossible(),S,x,I])};if(D.filename&&typeof Object.defineProperty==\"function\"){var Ct=D.filename,St=t.basename(Ct,t.extname(Ct));try{Object.defineProperty(Bt,\"name\",{value:St,writable:!1,enumerable:!1,configurable:!0})}catch{}}return Bt},generateSource:function(){var F=this.opts;F.rmWhitespace&&(this.templateText=this.templateText.replace(/[\\r\\n]+/g,`\n`).replace(/^\\s+|\\s+$/gm,\"\")),this.templateText=this.templateText.replace(/[ \\t]*<%_/gm,\"<%_\").replace(/_%>[ \\t]*/gm,\"_%>\");var L=this,D=this.parseTemplateText(),K=this.opts.delimiter,$=this.opts.openDelimiter,S=this.opts.closeDelimiter;D&&D.length&&D.forEach(function(B,E){var _t;if(B.indexOf($+K)===0&&B.indexOf($+K+K)!==0&&(_t=D[E+2],!(_t==K+S||_t==\"-\"+K+S||_t==\"_\"+K+S)))throw new Error('Could not find matching close tag for \"'+B+'\".');L.scanLine(B)})},parseTemplateText:function(){for(var F=this.templateText,L=this.regex,D=L.exec(F),K=[],$;D;)$=D.index,$!==0&&(K.push(F.substring(0,$)),F=F.slice($)),K.push(D[0]),F=F.slice(D[0].length),D=L.exec(F);return F&&K.push(F),K},_addOutput:function(F){if(this.truncate&&(F=F.replace(/^(?:\\r\\n|\\r|\\n)/,\"\"),this.truncate=!1),!F)return F;F=F.replace(/\\\\/g,\"\\\\\\\\\"),F=F.replace(/\\n/g,\"\\\\n\"),F=F.replace(/\\r/g,\"\\\\r\"),F=F.replace(/\"/g,'\\\\\"'),this.source+=' ; __append(\"'+F+`\")\n`},scanLine:function(F){var L=this,D=this.opts.delimiter,K=this.opts.openDelimiter,$=this.opts.closeDelimiter,S=0;switch(S=F.split(`\n`).length-1,F){case K+D:case K+D+\"_\":this.mode=M.modes.EVAL;break;case K+D+\"=\":this.mode=M.modes.ESCAPED;break;case K+D+\"-\":this.mode=M.modes.RAW;break;case K+D+\"#\":this.mode=M.modes.COMMENT;break;case K+D+D:this.mode=M.modes.LITERAL,this.source+=' ; __append(\"'+F.replace(K+D+D,K+D)+`\")\n`;break;case D+D+$:this.mode=M.modes.LITERAL,this.source+=' ; __append(\"'+F.replace(D+D+$,D+$)+`\")\n`;break;case D+$:case\"-\"+D+$:case\"_\"+D+$:this.mode==M.modes.LITERAL&&this._addOutput(F),this.mode=null,this.truncate=F.indexOf(\"-\")===0||F.indexOf(\"_\")===0;break;default:if(this.mode){switch(this.mode){case M.modes.EVAL:case M.modes.ESCAPED:case M.modes.RAW:F.lastIndexOf(\"//\")>F.lastIndexOf(`\n`)&&(F+=`\n`)}switch(this.mode){case M.modes.EVAL:this.source+=\" ; \"+F+`\n`;break;case M.modes.ESCAPED:this.source+=\" ; __append(escapeFn(\"+_(F)+`))\n`;break;case M.modes.RAW:this.source+=\" ; __append(\"+_(F)+`)\n`;break;case M.modes.COMMENT:break;case M.modes.LITERAL:this._addOutput(F);break}}else this._addOutput(F)}L.opts.compileDebug&&S&&(this.currentLine+=S,this.source+=\" ; __line = \"+this.currentLine+`\n`)}},n.escapeXML=i.escapeXML,n.__express=n.renderFile,n.VERSION=a,n.name=u,typeof window<\"u\"&&(window.ejs=n)}(vo)),vo}Ef();var So={exports:{}},Uc;function Bf(){return Uc||(Uc=1,function(n){(function(){var e=\"input is invalid type\",t=\"finalize already called\",i=typeof window==\"object\",o=i?window:{};o.JS_SHA3_NO_WINDOW&&(i=!1);var a=!i&&typeof self==\"object\",s=!o.JS_SHA3_NO_NODE_JS&&typeof Zi==\"object\"&&Zi.versions&&Zi.versions.node;s?o=Kn:a&&(o=self);var l=!o.JS_SHA3_NO_COMMON_JS&&!0&&n.exports,g=!o.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<\"u\",d=\"0123456789abcdef\".split(\"\"),u=[31,7936,2031616,520093696],w=[4,1024,262144,67108864],C=[1,256,65536,16777216],h=[6,1536,393216,100663296],m=[0,8,16,24],O=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],Q=[224,256,384,512],P=[128,256],G=[\"hex\",\"buffer\",\"arrayBuffer\",\"array\",\"digest\"],st={128:168,256:136};(o.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)===\"[object Array]\"}),g&&(o.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x==\"object\"&&x.buffer&&x.buffer.constructor===ArrayBuffer});for(var N=function(x,ht,yt){return function(U){return new St(x,ht,x).update(U)[yt]()}},y=function(x,ht,yt){return function(U,r){return new St(x,ht,r).update(U)[yt]()}},I=function(x,ht,yt){return function(U,r,dt,k){return S[\"cshake\"+x].update(U,r,dt,k)[yt]()}},_=function(x,ht,yt){return function(U,r,dt,k){return S[\"kmac\"+x].update(U,r,dt,k)[yt]()}},M=function(x,ht,yt,U){for(var r=0;r<G.length;++r){var dt=G[r];x[dt]=ht(yt,U,dt)}return x},F=function(x,ht){var yt=N(x,ht,\"hex\");return yt.create=function(){return new St(x,ht,x)},yt.update=function(U){return yt.create().update(U)},M(yt,N,x,ht)},L=function(x,ht){var yt=y(x,ht,\"hex\");return yt.create=function(U){return new St(x,ht,U)},yt.update=function(U,r){return yt.create(r).update(U)},M(yt,y,x,ht)},D=function(x,ht){var yt=st[x],U=I(x,ht,\"hex\");return U.create=function(r,dt,k){return!dt&&!k?S[\"shake\"+x].create(r):new St(x,ht,r).bytepad([dt,k],yt)},U.update=function(r,dt,k,f){return U.create(dt,k,f).update(r)},M(U,I,x,ht)},K=function(x,ht){var yt=st[x],U=_(x,ht,\"hex\");return U.create=function(r,dt,k){return new Ot(x,ht,dt).bytepad([\"KMAC\",k],yt).bytepad([r],yt)},U.update=function(r,dt,k,f){return U.create(r,k,f).update(dt)},M(U,_,x,ht)},$=[{name:\"keccak\",padding:C,bits:Q,createMethod:F},{name:\"sha3\",padding:h,bits:Q,createMethod:F},{name:\"shake\",padding:u,bits:P,createMethod:L},{name:\"cshake\",padding:w,bits:P,createMethod:D},{name:\"kmac\",padding:w,bits:P,createMethod:K}],S={},B=[],E=0;E<$.length;++E)for(var _t=$[E],tt=_t.bits,ft=0;ft<tt.length;++ft){var Bt=_t.name+\"_\"+tt[ft];if(B.push(Bt),S[Bt]=_t.createMethod(tt[ft],_t.padding),_t.name!==\"sha3\"){var Ct=_t.name+tt[ft];B.push(Ct),S[Ct]=S[Bt]}}function St(x,ht,yt){this.blocks=[],this.s=[],this.padding=ht,this.outputBits=yt,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(x<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=yt>>5,this.extraBytes=(yt&31)>>3;for(var U=0;U<50;++U)this.s[U]=0}St.prototype.update=function(x){if(this.finalized)throw new Error(t);var ht,yt=typeof x;if(yt!==\"string\"){if(yt===\"object\"){if(x===null)throw new Error(e);if(g&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!g||!ArrayBuffer.isView(x)))throw new Error(e)}else throw new Error(e);ht=!0}for(var U=this.blocks,r=this.byteCount,dt=x.length,k=this.blockCount,f=0,ct=this.s,It,bt;f<dt;){if(this.reset)for(this.reset=!1,U[0]=this.block,It=1;It<k+1;++It)U[It]=0;if(ht)for(It=this.start;f<dt&&It<r;++f)U[It>>2]|=x[f]<<m[It++&3];else for(It=this.start;f<dt&&It<r;++f)bt=x.charCodeAt(f),bt<128?U[It>>2]|=bt<<m[It++&3]:bt<2048?(U[It>>2]|=(192|bt>>6)<<m[It++&3],U[It>>2]|=(128|bt&63)<<m[It++&3]):bt<55296||bt>=57344?(U[It>>2]|=(224|bt>>12)<<m[It++&3],U[It>>2]|=(128|bt>>6&63)<<m[It++&3],U[It>>2]|=(128|bt&63)<<m[It++&3]):(bt=65536+((bt&1023)<<10|x.charCodeAt(++f)&1023),U[It>>2]|=(240|bt>>18)<<m[It++&3],U[It>>2]|=(128|bt>>12&63)<<m[It++&3],U[It>>2]|=(128|bt>>6&63)<<m[It++&3],U[It>>2]|=(128|bt&63)<<m[It++&3]);if(this.lastByteIndex=It,It>=r){for(this.start=It-r,this.block=U[k],It=0;It<k;++It)ct[It]^=U[It];Dt(ct),this.reset=!0}else this.start=It}return this},St.prototype.encode=function(x,ht){var yt=x&255,U=1,r=[yt];for(x=x>>8,yt=x&255;yt>0;)r.unshift(yt),x=x>>8,yt=x&255,++U;return ht?r.push(U):r.unshift(U),this.update(r),r.length},St.prototype.encodeString=function(x){var ht,yt=typeof x;if(yt!==\"string\"){if(yt===\"object\"){if(x===null)throw new Error(e);if(g&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!g||!ArrayBuffer.isView(x)))throw new Error(e)}else throw new Error(e);ht=!0}var U=0,r=x.length;if(ht)U=r;else for(var dt=0;dt<x.length;++dt){var k=x.charCodeAt(dt);k<128?U+=1:k<2048?U+=2:k<55296||k>=57344?U+=3:(k=65536+((k&1023)<<10|x.charCodeAt(++dt)&1023),U+=4)}return U+=this.encode(U*8),this.update(x),U},St.prototype.bytepad=function(x,ht){for(var yt=this.encode(ht),U=0;U<x.length;++U)yt+=this.encodeString(x[U]);var r=ht-yt%ht,dt=[];return dt.length=r,this.update(dt),this},St.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var x=this.blocks,ht=this.lastByteIndex,yt=this.blockCount,U=this.s;if(x[ht>>2]|=this.padding[ht&3],this.lastByteIndex===this.byteCount)for(x[0]=x[yt],ht=1;ht<yt+1;++ht)x[ht]=0;for(x[yt-1]|=2147483648,ht=0;ht<yt;++ht)U[ht]^=x[ht];Dt(U)}},St.prototype.toString=St.prototype.hex=function(){this.finalize();for(var x=this.blockCount,ht=this.s,yt=this.outputBlocks,U=this.extraBytes,r=0,dt=0,k=\"\",f;dt<yt;){for(r=0;r<x&&dt<yt;++r,++dt)f=ht[r],k+=d[f>>4&15]+d[f&15]+d[f>>12&15]+d[f>>8&15]+d[f>>20&15]+d[f>>16&15]+d[f>>28&15]+d[f>>24&15];dt%x===0&&(Dt(ht),r=0)}return U&&(f=ht[r],k+=d[f>>4&15]+d[f&15],U>1&&(k+=d[f>>12&15]+d[f>>8&15]),U>2&&(k+=d[f>>20&15]+d[f>>16&15])),k},St.prototype.arrayBuffer=function(){this.finalize();var x=this.blockCount,ht=this.s,yt=this.outputBlocks,U=this.extraBytes,r=0,dt=0,k=this.outputBits>>3,f;U?f=new ArrayBuffer(yt+1<<2):f=new ArrayBuffer(k);for(var ct=new Uint32Array(f);dt<yt;){for(r=0;r<x&&dt<yt;++r,++dt)ct[dt]=ht[r];dt%x===0&&Dt(ht)}return U&&(ct[r]=ht[r],f=f.slice(0,k)),f},St.prototype.buffer=St.prototype.arrayBuffer,St.prototype.digest=St.prototype.array=function(){this.finalize();for(var x=this.blockCount,ht=this.s,yt=this.outputBlocks,U=this.extraBytes,r=0,dt=0,k=[],f,ct;dt<yt;){for(r=0;r<x&&dt<yt;++r,++dt)f=dt<<2,ct=ht[r],k[f]=ct&255,k[f+1]=ct>>8&255,k[f+2]=ct>>16&255,k[f+3]=ct>>24&255;dt%x===0&&Dt(ht)}return U&&(f=dt<<2,ct=ht[r],k[f]=ct&255,U>1&&(k[f+1]=ct>>8&255),U>2&&(k[f+2]=ct>>16&255)),k};function Ot(x,ht,yt){St.call(this,x,ht,yt)}Ot.prototype=new St,Ot.prototype.finalize=function(){return this.encode(this.outputBits,!0),St.prototype.finalize.call(this)};var Dt=function(x){var ht,yt,U,r,dt,k,f,ct,It,bt,H,Z,V,gt,Ft,qt,W,b,xt,Vt,$t,v,p,A,R,j,J,nt,Mt,jt,Xt,ne,te,Me,ge,be,ye,me,Ce,Te,Re,q,c,X,ut,ot,rt,at,Lt,pt,Et,At,mt,Rt,Nt,kt,zt,Gt,Yt,Zt,Jt,Qt,Kt;for(U=0;U<48;U+=2)r=x[0]^x[10]^x[20]^x[30]^x[40],dt=x[1]^x[11]^x[21]^x[31]^x[41],k=x[2]^x[12]^x[22]^x[32]^x[42],f=x[3]^x[13]^x[23]^x[33]^x[43],ct=x[4]^x[14]^x[24]^x[34]^x[44],It=x[5]^x[15]^x[25]^x[35]^x[45],bt=x[6]^x[16]^x[26]^x[36]^x[46],H=x[7]^x[17]^x[27]^x[37]^x[47],Z=x[8]^x[18]^x[28]^x[38]^x[48],V=x[9]^x[19]^x[29]^x[39]^x[49],ht=Z^(k<<1|f>>>31),yt=V^(f<<1|k>>>31),x[0]^=ht,x[1]^=yt,x[10]^=ht,x[11]^=yt,x[20]^=ht,x[21]^=yt,x[30]^=ht,x[31]^=yt,x[40]^=ht,x[41]^=yt,ht=r^(ct<<1|It>>>31),yt=dt^(It<<1|ct>>>31),x[2]^=ht,x[3]^=yt,x[12]^=ht,x[13]^=yt,x[22]^=ht,x[23]^=yt,x[32]^=ht,x[33]^=yt,x[42]^=ht,x[43]^=yt,ht=k^(bt<<1|H>>>31),yt=f^(H<<1|bt>>>31),x[4]^=ht,x[5]^=yt,x[14]^=ht,x[15]^=yt,x[24]^=ht,x[25]^=yt,x[34]^=ht,x[35]^=yt,x[44]^=ht,x[45]^=yt,ht=ct^(Z<<1|V>>>31),yt=It^(V<<1|Z>>>31),x[6]^=ht,x[7]^=yt,x[16]^=ht,x[17]^=yt,x[26]^=ht,x[27]^=yt,x[36]^=ht,x[37]^=yt,x[46]^=ht,x[47]^=yt,ht=bt^(r<<1|dt>>>31),yt=H^(dt<<1|r>>>31),x[8]^=ht,x[9]^=yt,x[18]^=ht,x[19]^=yt,x[28]^=ht,x[29]^=yt,x[38]^=ht,x[39]^=yt,x[48]^=ht,x[49]^=yt,gt=x[0],Ft=x[1],ot=x[11]<<4|x[10]>>>28,rt=x[10]<<4|x[11]>>>28,nt=x[20]<<3|x[21]>>>29,Mt=x[21]<<3|x[20]>>>29,Zt=x[31]<<9|x[30]>>>23,Jt=x[30]<<9|x[31]>>>23,q=x[40]<<18|x[41]>>>14,c=x[41]<<18|x[40]>>>14,Me=x[2]<<1|x[3]>>>31,ge=x[3]<<1|x[2]>>>31,qt=x[13]<<12|x[12]>>>20,W=x[12]<<12|x[13]>>>20,at=x[22]<<10|x[23]>>>22,Lt=x[23]<<10|x[22]>>>22,jt=x[33]<<13|x[32]>>>19,Xt=x[32]<<13|x[33]>>>19,Qt=x[42]<<2|x[43]>>>30,Kt=x[43]<<2|x[42]>>>30,Rt=x[5]<<30|x[4]>>>2,Nt=x[4]<<30|x[5]>>>2,be=x[14]<<6|x[15]>>>26,ye=x[15]<<6|x[14]>>>26,b=x[25]<<11|x[24]>>>21,xt=x[24]<<11|x[25]>>>21,pt=x[34]<<15|x[35]>>>17,Et=x[35]<<15|x[34]>>>17,ne=x[45]<<29|x[44]>>>3,te=x[44]<<29|x[45]>>>3,A=x[6]<<28|x[7]>>>4,R=x[7]<<28|x[6]>>>4,kt=x[17]<<23|x[16]>>>9,zt=x[16]<<23|x[17]>>>9,me=x[26]<<25|x[27]>>>7,Ce=x[27]<<25|x[26]>>>7,Vt=x[36]<<21|x[37]>>>11,$t=x[37]<<21|x[36]>>>11,At=x[47]<<24|x[46]>>>8,mt=x[46]<<24|x[47]>>>8,X=x[8]<<27|x[9]>>>5,ut=x[9]<<27|x[8]>>>5,j=x[18]<<20|x[19]>>>12,J=x[19]<<20|x[18]>>>12,Gt=x[29]<<7|x[28]>>>25,Yt=x[28]<<7|x[29]>>>25,Te=x[38]<<8|x[39]>>>24,Re=x[39]<<8|x[38]>>>24,v=x[48]<<14|x[49]>>>18,p=x[49]<<14|x[48]>>>18,x[0]=gt^~qt&b,x[1]=Ft^~W&xt,x[10]=A^~j&nt,x[11]=R^~J&Mt,x[20]=Me^~be&me,x[21]=ge^~ye&Ce,x[30]=X^~ot&at,x[31]=ut^~rt&Lt,x[40]=Rt^~kt&Gt,x[41]=Nt^~zt&Yt,x[2]=qt^~b&Vt,x[3]=W^~xt&$t,x[12]=j^~nt&jt,x[13]=J^~Mt&Xt,x[22]=be^~me&Te,x[23]=ye^~Ce&Re,x[32]=ot^~at&pt,x[33]=rt^~Lt&Et,x[42]=kt^~Gt&Zt,x[43]=zt^~Yt&Jt,x[4]=b^~Vt&v,x[5]=xt^~$t&p,x[14]=nt^~jt&ne,x[15]=Mt^~Xt&te,x[24]=me^~Te&q,x[25]=Ce^~Re&c,x[34]=at^~pt&At,x[35]=Lt^~Et&mt,x[44]=Gt^~Zt&Qt,x[45]=Yt^~Jt&Kt,x[6]=Vt^~v&gt,x[7]=$t^~p&Ft,x[16]=jt^~ne&A,x[17]=Xt^~te&R,x[26]=Te^~q&Me,x[27]=Re^~c&ge,x[36]=pt^~At&X,x[37]=Et^~mt&ut,x[46]=Zt^~Qt&Rt,x[47]=Jt^~Kt&Nt,x[8]=v^~gt&qt,x[9]=p^~Ft&W,x[18]=ne^~A&j,x[19]=te^~R&J,x[28]=q^~Me&be,x[29]=c^~ge&ye,x[38]=At^~X&ot,x[39]=mt^~ut&rt,x[48]=Qt^~Rt&kt,x[49]=Kt^~Nt&zt,x[0]^=O[U],x[1]^=O[U+1]};if(l)n.exports=S;else for(E=0;E<B.length;++E)o[B[E]]=S[B[E]]})()}(So)),So.exports}Bf();/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const xf=4,Mc=0,Tc=1,vf=2;function Tn(n){let e=n.length;for(;--e>=0;)n[e]=0}const Ff=0,Es=1,Sf=2,Of=3,Pf=258,Ca=29,ui=256,Jn=ui+1+Ca,Fn=30,Ea=19,Bs=2*Jn+1,un=15,Oo=16,Uf=7,Ba=256,xs=16,vs=17,Fs=18,ta=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),xi=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Mf=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ss=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Tf=512,Ze=new Array((Jn+2)*2);Tn(Ze);const Vn=new Array(Fn*2);Tn(Vn);const ti=new Array(Tf);Tn(ti);const ei=new Array(Pf-Of+1);Tn(ei);const xa=new Array(Ca);Tn(xa);const Ui=new Array(Fn);Tn(Ui);function Po(n,e,t,i,o){this.static_tree=n,this.extra_bits=e,this.extra_base=t,this.elems=i,this.max_length=o,this.has_stree=n&&n.length}let Os,Ps,Us;function Uo(n,e){this.dyn_tree=n,this.max_code=0,this.stat_desc=e}const Ms=n=>n<256?ti[n]:ti[256+(n>>>7)],ni=(n,e)=>{n.pending_buf[n.pending++]=e&255,n.pending_buf[n.pending++]=e>>>8&255},Ie=(n,e,t)=>{n.bi_valid>Oo-t?(n.bi_buf|=e<<n.bi_valid&65535,ni(n,n.bi_buf),n.bi_buf=e>>Oo-n.bi_valid,n.bi_valid+=t-Oo):(n.bi_buf|=e<<n.bi_valid&65535,n.bi_valid+=t)},Qe=(n,e,t)=>{Ie(n,t[e*2],t[e*2+1])},Ts=(n,e)=>{let t=0;do t|=n&1,n>>>=1,t<<=1;while(--e>0);return t>>>1},Rf=n=>{n.bi_valid===16?(ni(n,n.bi_buf),n.bi_buf=0,n.bi_valid=0):n.bi_valid>=8&&(n.pending_buf[n.pending++]=n.bi_buf&255,n.bi_buf>>=8,n.bi_valid-=8)},Df=(n,e)=>{const t=e.dyn_tree,i=e.max_code,o=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,g=e.stat_desc.max_length;let d,u,w,C,h,m,O=0;for(C=0;C<=un;C++)n.bl_count[C]=0;for(t[n.heap[n.heap_max]*2+1]=0,d=n.heap_max+1;d<Bs;d++)u=n.heap[d],C=t[t[u*2+1]*2+1]+1,C>g&&(C=g,O++),t[u*2+1]=C,!(u>i)&&(n.bl_count[C]++,h=0,u>=l&&(h=s[u-l]),m=t[u*2],n.opt_len+=m*(C+h),a&&(n.static_len+=m*(o[u*2+1]+h)));if(O!==0){do{for(C=g-1;n.bl_count[C]===0;)C--;n.bl_count[C]--,n.bl_count[C+1]+=2,n.bl_count[g]--,O-=2}while(O>0);for(C=g;C!==0;C--)for(u=n.bl_count[C];u!==0;)w=n.heap[--d],!(w>i)&&(t[w*2+1]!==C&&(n.opt_len+=(C-t[w*2+1])*t[w*2],t[w*2+1]=C),u--)}},Rs=(n,e,t)=>{const i=new Array(un+1);let o=0,a,s;for(a=1;a<=un;a++)o=o+t[a-1]<<1,i[a]=o;for(s=0;s<=e;s++){let l=n[s*2+1];l!==0&&(n[s*2]=Ts(i[l]++,l))}},kf=()=>{let n,e,t,i,o;const a=new Array(un+1);for(t=0,i=0;i<Ca-1;i++)for(xa[i]=t,n=0;n<1<<ta[i];n++)ei[t++]=i;for(ei[t-1]=i,o=0,i=0;i<16;i++)for(Ui[i]=o,n=0;n<1<<xi[i];n++)ti[o++]=i;for(o>>=7;i<Fn;i++)for(Ui[i]=o<<7,n=0;n<1<<xi[i]-7;n++)ti[256+o++]=i;for(e=0;e<=un;e++)a[e]=0;for(n=0;n<=143;)Ze[n*2+1]=8,n++,a[8]++;for(;n<=255;)Ze[n*2+1]=9,n++,a[9]++;for(;n<=279;)Ze[n*2+1]=7,n++,a[7]++;for(;n<=287;)Ze[n*2+1]=8,n++,a[8]++;for(Rs(Ze,Jn+1,a),n=0;n<Fn;n++)Vn[n*2+1]=5,Vn[n*2]=Ts(n,5);Os=new Po(Ze,ta,ui+1,Jn,un),Ps=new Po(Vn,xi,0,Fn,un),Us=new Po(new Array(0),Mf,0,Ea,Uf)},Ds=n=>{let e;for(e=0;e<Jn;e++)n.dyn_ltree[e*2]=0;for(e=0;e<Fn;e++)n.dyn_dtree[e*2]=0;for(e=0;e<Ea;e++)n.bl_tree[e*2]=0;n.dyn_ltree[Ba*2]=1,n.opt_len=n.static_len=0,n.sym_next=n.matches=0},ks=n=>{n.bi_valid>8?ni(n,n.bi_buf):n.bi_valid>0&&(n.pending_buf[n.pending++]=n.bi_buf),n.bi_buf=0,n.bi_valid=0},Rc=(n,e,t,i)=>{const o=e*2,a=t*2;return n[o]<n[a]||n[o]===n[a]&&i[e]<=i[t]},Mo=(n,e,t)=>{const i=n.heap[t];let o=t<<1;for(;o<=n.heap_len&&(o<n.heap_len&&Rc(e,n.heap[o+1],n.heap[o],n.depth)&&o++,!Rc(e,i,n.heap[o],n.depth));)n.heap[t]=n.heap[o],t=o,o<<=1;n.heap[t]=i},Dc=(n,e,t)=>{let i,o,a=0,s,l;if(n.sym_next!==0)do i=n.pending_buf[n.sym_buf+a++]&255,i+=(n.pending_buf[n.sym_buf+a++]&255)<<8,o=n.pending_buf[n.sym_buf+a++],i===0?Qe(n,o,e):(s=ei[o],Qe(n,s+ui+1,e),l=ta[s],l!==0&&(o-=xa[s],Ie(n,o,l)),i--,s=Ms(i),Qe(n,s,t),l=xi[s],l!==0&&(i-=Ui[s],Ie(n,i,l)));while(a<n.sym_next);Qe(n,Ba,e)},ea=(n,e)=>{const t=e.dyn_tree,i=e.stat_desc.static_tree,o=e.stat_desc.has_stree,a=e.stat_desc.elems;let s,l,g=-1,d;for(n.heap_len=0,n.heap_max=Bs,s=0;s<a;s++)t[s*2]!==0?(n.heap[++n.heap_len]=g=s,n.depth[s]=0):t[s*2+1]=0;for(;n.heap_len<2;)d=n.heap[++n.heap_len]=g<2?++g:0,t[d*2]=1,n.depth[d]=0,n.opt_len--,o&&(n.static_len-=i[d*2+1]);for(e.max_code=g,s=n.heap_len>>1;s>=1;s--)Mo(n,t,s);d=a;do s=n.heap[1],n.heap[1]=n.heap[n.heap_len--],Mo(n,t,1),l=n.heap[1],n.heap[--n.heap_max]=s,n.heap[--n.heap_max]=l,t[d*2]=t[s*2]+t[l*2],n.depth[d]=(n.depth[s]>=n.depth[l]?n.depth[s]:n.depth[l])+1,t[s*2+1]=t[l*2+1]=d,n.heap[1]=d++,Mo(n,t,1);while(n.heap_len>=2);n.heap[--n.heap_max]=n.heap[1],Df(n,e),Rs(t,g,n.bl_count)},kc=(n,e,t)=>{let i,o=-1,a,s=e[0*2+1],l=0,g=7,d=4;for(s===0&&(g=138,d=3),e[(t+1)*2+1]=65535,i=0;i<=t;i++)a=s,s=e[(i+1)*2+1],!(++l<g&&a===s)&&(l<d?n.bl_tree[a*2]+=l:a!==0?(a!==o&&n.bl_tree[a*2]++,n.bl_tree[xs*2]++):l<=10?n.bl_tree[vs*2]++:n.bl_tree[Fs*2]++,l=0,o=a,s===0?(g=138,d=3):a===s?(g=6,d=3):(g=7,d=4))},zc=(n,e,t)=>{let i,o=-1,a,s=e[0*2+1],l=0,g=7,d=4;for(s===0&&(g=138,d=3),i=0;i<=t;i++)if(a=s,s=e[(i+1)*2+1],!(++l<g&&a===s)){if(l<d)do Qe(n,a,n.bl_tree);while(--l!==0);else a!==0?(a!==o&&(Qe(n,a,n.bl_tree),l--),Qe(n,xs,n.bl_tree),Ie(n,l-3,2)):l<=10?(Qe(n,vs,n.bl_tree),Ie(n,l-3,3)):(Qe(n,Fs,n.bl_tree),Ie(n,l-11,7));l=0,o=a,s===0?(g=138,d=3):a===s?(g=6,d=3):(g=7,d=4)}},zf=n=>{let e;for(kc(n,n.dyn_ltree,n.l_desc.max_code),kc(n,n.dyn_dtree,n.d_desc.max_code),ea(n,n.bl_desc),e=Ea-1;e>=3&&n.bl_tree[Ss[e]*2+1]===0;e--);return n.opt_len+=3*(e+1)+5+5+4,e},qf=(n,e,t,i)=>{let o;for(Ie(n,e-257,5),Ie(n,t-1,5),Ie(n,i-4,4),o=0;o<i;o++)Ie(n,n.bl_tree[Ss[o]*2+1],3);zc(n,n.dyn_ltree,e-1),zc(n,n.dyn_dtree,t-1)},Qf=n=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&n.dyn_ltree[t*2]!==0)return Mc;if(n.dyn_ltree[9*2]!==0||n.dyn_ltree[10*2]!==0||n.dyn_ltree[13*2]!==0)return Tc;for(t=32;t<ui;t++)if(n.dyn_ltree[t*2]!==0)return Tc;return Mc};let qc=!1;const Nf=n=>{qc||(kf(),qc=!0),n.l_desc=new Uo(n.dyn_ltree,Os),n.d_desc=new Uo(n.dyn_dtree,Ps),n.bl_desc=new Uo(n.bl_tree,Us),n.bi_buf=0,n.bi_valid=0,Ds(n)},zs=(n,e,t,i)=>{Ie(n,(Ff<<1)+(i?1:0),3),ks(n),ni(n,t),ni(n,~t),t&&n.pending_buf.set(n.window.subarray(e,e+t),n.pending),n.pending+=t},Gf=n=>{Ie(n,Es<<1,3),Qe(n,Ba,Ze),Rf(n)},Kf=(n,e,t,i)=>{let o,a,s=0;n.level>0?(n.strm.data_type===vf&&(n.strm.data_type=Qf(n)),ea(n,n.l_desc),ea(n,n.d_desc),s=zf(n),o=n.opt_len+3+7>>>3,a=n.static_len+3+7>>>3,a<=o&&(o=a)):o=a=t+5,t+4<=o&&e!==-1?zs(n,e,t,i):n.strategy===xf||a===o?(Ie(n,(Es<<1)+(i?1:0),3),Dc(n,Ze,Vn)):(Ie(n,(Sf<<1)+(i?1:0),3),qf(n,n.l_desc.max_code+1,n.d_desc.max_code+1,s+1),Dc(n,n.dyn_ltree,n.dyn_dtree)),Ds(n),i&&ks(n)},Hf=(n,e,t)=>(n.pending_buf[n.sym_buf+n.sym_next++]=e,n.pending_buf[n.sym_buf+n.sym_next++]=e>>8,n.pending_buf[n.sym_buf+n.sym_next++]=t,e===0?n.dyn_ltree[t*2]++:(n.matches++,e--,n.dyn_ltree[(ei[t]+ui+1)*2]++,n.dyn_dtree[Ms(e)*2]++),n.sym_next===n.sym_end);var Zf=Nf,jf=zs,Vf=Kf,$f=Hf,Yf=Gf,Wf={_tr_init:Zf,_tr_stored_block:jf,_tr_flush_block:Vf,_tr_tally:$f,_tr_align:Yf};const Xf=(n,e,t,i)=>{let o=n&65535|0,a=n>>>16&65535|0,s=0;for(;t!==0;){s=t>2e3?2e3:t,t-=s;do o=o+e[i++]|0,a=a+o|0;while(--s);o%=65521,a%=65521}return o|a<<16|0};var ii=Xf;const Jf=()=>{let n,e=[];for(var t=0;t<256;t++){n=t;for(var i=0;i<8;i++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return e},t2=new Uint32Array(Jf()),e2=(n,e,t,i)=>{const o=t2,a=i+t;n^=-1;for(let s=i;s<a;s++)n=n>>>8^o[(n^e[s])&255];return n^-1};var he=e2,gn={2:\"need dictionary\",1:\"stream end\",0:\"\",\"-1\":\"file error\",\"-2\":\"stream error\",\"-3\":\"data error\",\"-4\":\"insufficient memory\",\"-5\":\"buffer error\",\"-6\":\"incompatible version\"},bn={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:n2,_tr_stored_block:na,_tr_flush_block:i2,_tr_tally:on,_tr_align:o2}=Wf,{Z_NO_FLUSH:an,Z_PARTIAL_FLUSH:a2,Z_FULL_FLUSH:c2,Z_FINISH:Se,Z_BLOCK:Qc,Z_OK:Le,Z_STREAM_END:Nc,Z_STREAM_ERROR:Ne,Z_DATA_ERROR:r2,Z_BUF_ERROR:To,Z_DEFAULT_COMPRESSION:s2,Z_FILTERED:l2,Z_HUFFMAN_ONLY:mi,Z_RLE:d2,Z_FIXED:u2,Z_DEFAULT_STRATEGY:f2,Z_UNKNOWN:_2,Z_DEFLATED:ki}=bn,h2=9,g2=15,p2=8,L2=29,A2=256,ia=A2+1+L2,b2=30,y2=19,m2=2*ia+1,w2=15,ie=3,nn=258,Ge=nn+ie+1,I2=32,Pn=42,va=57,oa=69,aa=73,ca=91,ra=103,fn=113,Zn=666,Ae=1,Rn=2,pn=3,Dn=4,C2=3,_n=(n,e)=>(n.msg=gn[e],e),Gc=n=>n*2-(n>4?9:0),en=n=>{let e=n.length;for(;--e>=0;)n[e]=0},E2=n=>{let e,t,i,o=n.w_size;e=n.hash_size,i=e;do t=n.head[--i],n.head[i]=t>=o?t-o:0;while(--e);e=o,i=e;do t=n.prev[--i],n.prev[i]=t>=o?t-o:0;while(--e)};let B2=(n,e,t)=>(e<<n.hash_shift^t)&n.hash_mask,cn=B2;const Be=n=>{const e=n.state;let t=e.pending;t>n.avail_out&&(t=n.avail_out),t!==0&&(n.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),n.next_out),n.next_out+=t,e.pending_out+=t,n.total_out+=t,n.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},xe=(n,e)=>{i2(n,n.block_start>=0?n.block_start:-1,n.strstart-n.block_start,e),n.block_start=n.strstart,Be(n.strm)},oe=(n,e)=>{n.pending_buf[n.pending++]=e},Gn=(n,e)=>{n.pending_buf[n.pending++]=e>>>8&255,n.pending_buf[n.pending++]=e&255},sa=(n,e,t,i)=>{let o=n.avail_in;return o>i&&(o=i),o===0?0:(n.avail_in-=o,e.set(n.input.subarray(n.next_in,n.next_in+o),t),n.state.wrap===1?n.adler=ii(n.adler,e,o,t):n.state.wrap===2&&(n.adler=he(n.adler,e,o,t)),n.next_in+=o,n.total_in+=o,o)},qs=(n,e)=>{let t=n.max_chain_length,i=n.strstart,o,a,s=n.prev_length,l=n.nice_match;const g=n.strstart>n.w_size-Ge?n.strstart-(n.w_size-Ge):0,d=n.window,u=n.w_mask,w=n.prev,C=n.strstart+nn;let h=d[i+s-1],m=d[i+s];n.prev_length>=n.good_match&&(t>>=2),l>n.lookahead&&(l=n.lookahead);do if(o=e,!(d[o+s]!==m||d[o+s-1]!==h||d[o]!==d[i]||d[++o]!==d[i+1])){i+=2,o++;do;while(d[++i]===d[++o]&&d[++i]===d[++o]&&d[++i]===d[++o]&&d[++i]===d[++o]&&d[++i]===d[++o]&&d[++i]===d[++o]&&d[++i]===d[++o]&&d[++i]===d[++o]&&i<C);if(a=nn-(C-i),i=C-nn,a>s){if(n.match_start=e,s=a,a>=l)break;h=d[i+s-1],m=d[i+s]}}while((e=w[e&u])>g&&--t!==0);return s<=n.lookahead?s:n.lookahead},Un=n=>{const e=n.w_size;let t,i,o;do{if(i=n.window_size-n.lookahead-n.strstart,n.strstart>=e+(e-Ge)&&(n.window.set(n.window.subarray(e,e+e-i),0),n.match_start-=e,n.strstart-=e,n.block_start-=e,n.insert>n.strstart&&(n.insert=n.strstart),E2(n),i+=e),n.strm.avail_in===0)break;if(t=sa(n.strm,n.window,n.strstart+n.lookahead,i),n.lookahead+=t,n.lookahead+n.insert>=ie)for(o=n.strstart-n.insert,n.ins_h=n.window[o],n.ins_h=cn(n,n.ins_h,n.window[o+1]);n.insert&&(n.ins_h=cn(n,n.ins_h,n.window[o+ie-1]),n.prev[o&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=o,o++,n.insert--,!(n.lookahead+n.insert<ie)););}while(n.lookahead<Ge&&n.strm.avail_in!==0)},Qs=(n,e)=>{let t=n.pending_buf_size-5>n.w_size?n.w_size:n.pending_buf_size-5,i,o,a,s=0,l=n.strm.avail_in;do{if(i=65535,a=n.bi_valid+42>>3,n.strm.avail_out<a||(a=n.strm.avail_out-a,o=n.strstart-n.block_start,i>o+n.strm.avail_in&&(i=o+n.strm.avail_in),i>a&&(i=a),i<t&&(i===0&&e!==Se||e===an||i!==o+n.strm.avail_in)))break;s=e===Se&&i===o+n.strm.avail_in?1:0,na(n,0,0,s),n.pending_buf[n.pending-4]=i,n.pending_buf[n.pending-3]=i>>8,n.pending_buf[n.pending-2]=~i,n.pending_buf[n.pending-1]=~i>>8,Be(n.strm),o&&(o>i&&(o=i),n.strm.output.set(n.window.subarray(n.block_start,n.block_start+o),n.strm.next_out),n.strm.next_out+=o,n.strm.avail_out-=o,n.strm.total_out+=o,n.block_start+=o,i-=o),i&&(sa(n.strm,n.strm.output,n.strm.next_out,i),n.strm.next_out+=i,n.strm.avail_out-=i,n.strm.total_out+=i)}while(s===0);return l-=n.strm.avail_in,l&&(l>=n.w_size?(n.matches=2,n.window.set(n.strm.input.subarray(n.strm.next_in-n.w_size,n.strm.next_in),0),n.strstart=n.w_size,n.insert=n.strstart):(n.window_size-n.strstart<=l&&(n.strstart-=n.w_size,n.window.set(n.window.subarray(n.w_size,n.w_size+n.strstart),0),n.matches<2&&n.matches++,n.insert>n.strstart&&(n.insert=n.strstart)),n.window.set(n.strm.input.subarray(n.strm.next_in-l,n.strm.next_in),n.strstart),n.strstart+=l,n.insert+=l>n.w_size-n.insert?n.w_size-n.insert:l),n.block_start=n.strstart),n.high_water<n.strstart&&(n.high_water=n.strstart),s?Dn:e!==an&&e!==Se&&n.strm.avail_in===0&&n.strstart===n.block_start?Rn:(a=n.window_size-n.strstart,n.strm.avail_in>a&&n.block_start>=n.w_size&&(n.block_start-=n.w_size,n.strstart-=n.w_size,n.window.set(n.window.subarray(n.w_size,n.w_size+n.strstart),0),n.matches<2&&n.matches++,a+=n.w_size,n.insert>n.strstart&&(n.insert=n.strstart)),a>n.strm.avail_in&&(a=n.strm.avail_in),a&&(sa(n.strm,n.window,n.strstart,a),n.strstart+=a,n.insert+=a>n.w_size-n.insert?n.w_size-n.insert:a),n.high_water<n.strstart&&(n.high_water=n.strstart),a=n.bi_valid+42>>3,a=n.pending_buf_size-a>65535?65535:n.pending_buf_size-a,t=a>n.w_size?n.w_size:a,o=n.strstart-n.block_start,(o>=t||(o||e===Se)&&e!==an&&n.strm.avail_in===0&&o<=a)&&(i=o>a?a:o,s=e===Se&&n.strm.avail_in===0&&i===o?1:0,na(n,n.block_start,i,s),n.block_start+=i,Be(n.strm)),s?pn:Ae)},Ro=(n,e)=>{let t,i;for(;;){if(n.lookahead<Ge){if(Un(n),n.lookahead<Ge&&e===an)return Ae;if(n.lookahead===0)break}if(t=0,n.lookahead>=ie&&(n.ins_h=cn(n,n.ins_h,n.window[n.strstart+ie-1]),t=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),t!==0&&n.strstart-t<=n.w_size-Ge&&(n.match_length=qs(n,t)),n.match_length>=ie)if(i=on(n,n.strstart-n.match_start,n.match_length-ie),n.lookahead-=n.match_length,n.match_length<=n.max_lazy_match&&n.lookahead>=ie){n.match_length--;do n.strstart++,n.ins_h=cn(n,n.ins_h,n.window[n.strstart+ie-1]),t=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart;while(--n.match_length!==0);n.strstart++}else n.strstart+=n.match_length,n.match_length=0,n.ins_h=n.window[n.strstart],n.ins_h=cn(n,n.ins_h,n.window[n.strstart+1]);else i=on(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++;if(i&&(xe(n,!1),n.strm.avail_out===0))return Ae}return n.insert=n.strstart<ie-1?n.strstart:ie-1,e===Se?(xe(n,!0),n.strm.avail_out===0?pn:Dn):n.sym_next&&(xe(n,!1),n.strm.avail_out===0)?Ae:Rn},Cn=(n,e)=>{let t,i,o;for(;;){if(n.lookahead<Ge){if(Un(n),n.lookahead<Ge&&e===an)return Ae;if(n.lookahead===0)break}if(t=0,n.lookahead>=ie&&(n.ins_h=cn(n,n.ins_h,n.window[n.strstart+ie-1]),t=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),n.prev_length=n.match_length,n.prev_match=n.match_start,n.match_length=ie-1,t!==0&&n.prev_length<n.max_lazy_match&&n.strstart-t<=n.w_size-Ge&&(n.match_length=qs(n,t),n.match_length<=5&&(n.strategy===l2||n.match_length===ie&&n.strstart-n.match_start>4096)&&(n.match_length=ie-1)),n.prev_length>=ie&&n.match_length<=n.prev_length){o=n.strstart+n.lookahead-ie,i=on(n,n.strstart-1-n.prev_match,n.prev_length-ie),n.lookahead-=n.prev_length-1,n.prev_length-=2;do++n.strstart<=o&&(n.ins_h=cn(n,n.ins_h,n.window[n.strstart+ie-1]),t=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart);while(--n.prev_length!==0);if(n.match_available=0,n.match_length=ie-1,n.strstart++,i&&(xe(n,!1),n.strm.avail_out===0))return Ae}else if(n.match_available){if(i=on(n,0,n.window[n.strstart-1]),i&&xe(n,!1),n.strstart++,n.lookahead--,n.strm.avail_out===0)return Ae}else n.match_available=1,n.strstart++,n.lookahead--}return n.match_available&&(i=on(n,0,n.window[n.strstart-1]),n.match_available=0),n.insert=n.strstart<ie-1?n.strstart:ie-1,e===Se?(xe(n,!0),n.strm.avail_out===0?pn:Dn):n.sym_next&&(xe(n,!1),n.strm.avail_out===0)?Ae:Rn},x2=(n,e)=>{let t,i,o,a;const s=n.window;for(;;){if(n.lookahead<=nn){if(Un(n),n.lookahead<=nn&&e===an)return Ae;if(n.lookahead===0)break}if(n.match_length=0,n.lookahead>=ie&&n.strstart>0&&(o=n.strstart-1,i=s[o],i===s[++o]&&i===s[++o]&&i===s[++o])){a=n.strstart+nn;do;while(i===s[++o]&&i===s[++o]&&i===s[++o]&&i===s[++o]&&i===s[++o]&&i===s[++o]&&i===s[++o]&&i===s[++o]&&o<a);n.match_length=nn-(a-o),n.match_length>n.lookahead&&(n.match_length=n.lookahead)}if(n.match_length>=ie?(t=on(n,1,n.match_length-ie),n.lookahead-=n.match_length,n.strstart+=n.match_length,n.match_length=0):(t=on(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++),t&&(xe(n,!1),n.strm.avail_out===0))return Ae}return n.insert=0,e===Se?(xe(n,!0),n.strm.avail_out===0?pn:Dn):n.sym_next&&(xe(n,!1),n.strm.avail_out===0)?Ae:Rn},v2=(n,e)=>{let t;for(;;){if(n.lookahead===0&&(Un(n),n.lookahead===0)){if(e===an)return Ae;break}if(n.match_length=0,t=on(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++,t&&(xe(n,!1),n.strm.avail_out===0))return Ae}return n.insert=0,e===Se?(xe(n,!0),n.strm.avail_out===0?pn:Dn):n.sym_next&&(xe(n,!1),n.strm.avail_out===0)?Ae:Rn};function ze(n,e,t,i,o){this.good_length=n,this.max_lazy=e,this.nice_length=t,this.max_chain=i,this.func=o}const jn=[new ze(0,0,0,0,Qs),new ze(4,4,8,4,Ro),new ze(4,5,16,8,Ro),new ze(4,6,32,32,Ro),new ze(4,4,16,16,Cn),new ze(8,16,32,32,Cn),new ze(8,16,128,128,Cn),new ze(8,32,128,256,Cn),new ze(32,128,258,1024,Cn),new ze(32,258,258,4096,Cn)],F2=n=>{n.window_size=2*n.w_size,en(n.head),n.max_lazy_match=jn[n.level].max_lazy,n.good_match=jn[n.level].good_length,n.nice_match=jn[n.level].nice_length,n.max_chain_length=jn[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=ie-1,n.match_available=0,n.ins_h=0};function S2(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ki,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(m2*2),this.dyn_dtree=new Uint16Array((2*b2+1)*2),this.bl_tree=new Uint16Array((2*y2+1)*2),en(this.dyn_ltree),en(this.dyn_dtree),en(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(w2+1),this.heap=new Uint16Array(2*ia+1),en(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*ia+1),en(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const fi=n=>{if(!n)return 1;const e=n.state;return!e||e.strm!==n||e.status!==Pn&&e.status!==va&&e.status!==oa&&e.status!==aa&&e.status!==ca&&e.status!==ra&&e.status!==fn&&e.status!==Zn?1:0},Ns=n=>{if(fi(n))return _n(n,Ne);n.total_in=n.total_out=0,n.data_type=_2;const e=n.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?va:e.wrap?Pn:fn,n.adler=e.wrap===2?0:1,e.last_flush=-2,n2(e),Le},Gs=n=>{const e=Ns(n);return e===Le&&F2(n.state),e},O2=(n,e)=>fi(n)||n.state.wrap!==2?Ne:(n.state.gzhead=e,Le),Ks=(n,e,t,i,o,a)=>{if(!n)return Ne;let s=1;if(e===s2&&(e=6),i<0?(s=0,i=-i):i>15&&(s=2,i-=16),o<1||o>h2||t!==ki||i<8||i>15||e<0||e>9||a<0||a>u2||i===8&&s!==1)return _n(n,Ne);i===8&&(i=9);const l=new S2;return n.state=l,l.strm=n,l.status=Pn,l.wrap=s,l.gzhead=null,l.w_bits=i,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=o+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+ie-1)/ie),l.window=new Uint8Array(l.w_size*2),l.head=new Uint16Array(l.hash_size),l.prev=new Uint16Array(l.w_size),l.lit_bufsize=1<<o+6,l.pending_buf_size=l.lit_bufsize*4,l.pending_buf=new Uint8Array(l.pending_buf_size),l.sym_buf=l.lit_bufsize,l.sym_end=(l.lit_bufsize-1)*3,l.level=e,l.strategy=a,l.method=t,Gs(n)},P2=(n,e)=>Ks(n,e,ki,g2,p2,f2),U2=(n,e)=>{if(fi(n)||e>Qc||e<0)return n?_n(n,Ne):Ne;const t=n.state;if(!n.output||n.avail_in!==0&&!n.input||t.status===Zn&&e!==Se)return _n(n,n.avail_out===0?To:Ne);const i=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Be(n),n.avail_out===0)return t.last_flush=-1,Le}else if(n.avail_in===0&&Gc(e)<=Gc(i)&&e!==Se)return _n(n,To);if(t.status===Zn&&n.avail_in!==0)return _n(n,To);if(t.status===Pn&&t.wrap===0&&(t.status=fn),t.status===Pn){let o=ki+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=mi||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,o|=a<<6,t.strstart!==0&&(o|=I2),o+=31-o%31,Gn(t,o),t.strstart!==0&&(Gn(t,n.adler>>>16),Gn(t,n.adler&65535)),n.adler=1,t.status=fn,Be(n),t.pending!==0)return t.last_flush=-1,Le}if(t.status===va){if(n.adler=0,oe(t,31),oe(t,139),oe(t,8),t.gzhead)oe(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),oe(t,t.gzhead.time&255),oe(t,t.gzhead.time>>8&255),oe(t,t.gzhead.time>>16&255),oe(t,t.gzhead.time>>24&255),oe(t,t.level===9?2:t.strategy>=mi||t.level<2?4:0),oe(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(oe(t,t.gzhead.extra.length&255),oe(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(n.adler=he(n.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=oa;else if(oe(t,0),oe(t,0),oe(t,0),oe(t,0),oe(t,0),oe(t,t.level===9?2:t.strategy>=mi||t.level<2?4:0),oe(t,C2),t.status=fn,Be(n),t.pending!==0)return t.last_flush=-1,Le}if(t.status===oa){if(t.gzhead.extra){let o=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let l=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+l),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>o&&(n.adler=he(n.adler,t.pending_buf,t.pending-o,o)),t.gzindex+=l,Be(n),t.pending!==0)return t.last_flush=-1,Le;o=0,a-=l}let s=new Uint8Array(t.gzhead.extra);t.pending_buf.set(s.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>o&&(n.adler=he(n.adler,t.pending_buf,t.pending-o,o)),t.gzindex=0}t.status=aa}if(t.status===aa){if(t.gzhead.name){let o=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>o&&(n.adler=he(n.adler,t.pending_buf,t.pending-o,o)),Be(n),t.pending!==0)return t.last_flush=-1,Le;o=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,oe(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>o&&(n.adler=he(n.adler,t.pending_buf,t.pending-o,o)),t.gzindex=0}t.status=ca}if(t.status===ca){if(t.gzhead.comment){let o=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>o&&(n.adler=he(n.adler,t.pending_buf,t.pending-o,o)),Be(n),t.pending!==0)return t.last_flush=-1,Le;o=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,oe(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>o&&(n.adler=he(n.adler,t.pending_buf,t.pending-o,o))}t.status=ra}if(t.status===ra){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Be(n),t.pending!==0))return t.last_flush=-1,Le;oe(t,n.adler&255),oe(t,n.adler>>8&255),n.adler=0}if(t.status=fn,Be(n),t.pending!==0)return t.last_flush=-1,Le}if(n.avail_in!==0||t.lookahead!==0||e!==an&&t.status!==Zn){let o=t.level===0?Qs(t,e):t.strategy===mi?v2(t,e):t.strategy===d2?x2(t,e):jn[t.level].func(t,e);if((o===pn||o===Dn)&&(t.status=Zn),o===Ae||o===pn)return n.avail_out===0&&(t.last_flush=-1),Le;if(o===Rn&&(e===a2?o2(t):e!==Qc&&(na(t,0,0,!1),e===c2&&(en(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Be(n),n.avail_out===0))return t.last_flush=-1,Le}return e!==Se?Le:t.wrap<=0?Nc:(t.wrap===2?(oe(t,n.adler&255),oe(t,n.adler>>8&255),oe(t,n.adler>>16&255),oe(t,n.adler>>24&255),oe(t,n.total_in&255),oe(t,n.total_in>>8&255),oe(t,n.total_in>>16&255),oe(t,n.total_in>>24&255)):(Gn(t,n.adler>>>16),Gn(t,n.adler&65535)),Be(n),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Le:Nc)},M2=n=>{if(fi(n))return Ne;const e=n.state.status;return n.state=null,e===fn?_n(n,r2):Le},T2=(n,e)=>{let t=e.length;if(fi(n))return Ne;const i=n.state,o=i.wrap;if(o===2||o===1&&i.status!==Pn||i.lookahead)return Ne;if(o===1&&(n.adler=ii(n.adler,e,t,0)),i.wrap=0,t>=i.w_size){o===0&&(en(i.head),i.strstart=0,i.block_start=0,i.insert=0);let g=new Uint8Array(i.w_size);g.set(e.subarray(t-i.w_size,t),0),e=g,t=i.w_size}const a=n.avail_in,s=n.next_in,l=n.input;for(n.avail_in=t,n.next_in=0,n.input=e,Un(i);i.lookahead>=ie;){let g=i.strstart,d=i.lookahead-(ie-1);do i.ins_h=cn(i,i.ins_h,i.window[g+ie-1]),i.prev[g&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=g,g++;while(--d);i.strstart=g,i.lookahead=ie-1,Un(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=ie-1,i.match_available=0,n.next_in=s,n.input=l,n.avail_in=a,i.wrap=o,Le};var R2=P2,D2=Ks,k2=Gs,z2=Ns,q2=O2,Q2=U2,N2=M2,G2=T2,K2=\"pako deflate (from Nodeca project)\",$n={deflateInit:R2,deflateInit2:D2,deflateReset:k2,deflateResetKeep:z2,deflateSetHeader:q2,deflate:Q2,deflateEnd:N2,deflateSetDictionary:G2,deflateInfo:K2};const H2=(n,e)=>Object.prototype.hasOwnProperty.call(n,e);var Z2=function(n){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const t=e.shift();if(t){if(typeof t!=\"object\")throw new TypeError(t+\"must be non-object\");for(const i in t)H2(t,i)&&(n[i]=t[i])}}return n},j2=n=>{let e=0;for(let i=0,o=n.length;i<o;i++)e+=n[i].length;const t=new Uint8Array(e);for(let i=0,o=0,a=n.length;i<a;i++){let s=n[i];t.set(s,o),o+=s.length}return t},zi={assign:Z2,flattenChunks:j2};let Hs=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Hs=!1}const oi=new Uint8Array(256);for(let n=0;n<256;n++)oi[n]=n>=252?6:n>=248?5:n>=240?4:n>=224?3:n>=192?2:1;oi[254]=oi[254]=1;var V2=n=>{if(typeof TextEncoder==\"function\"&&TextEncoder.prototype.encode)return new TextEncoder().encode(n);let e,t,i,o,a,s=n.length,l=0;for(o=0;o<s;o++)t=n.charCodeAt(o),(t&64512)===55296&&o+1<s&&(i=n.charCodeAt(o+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),o++)),l+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(l),a=0,o=0;a<l;o++)t=n.charCodeAt(o),(t&64512)===55296&&o+1<s&&(i=n.charCodeAt(o+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),o++)),t<128?e[a++]=t:t<2048?(e[a++]=192|t>>>6,e[a++]=128|t&63):t<65536?(e[a++]=224|t>>>12,e[a++]=128|t>>>6&63,e[a++]=128|t&63):(e[a++]=240|t>>>18,e[a++]=128|t>>>12&63,e[a++]=128|t>>>6&63,e[a++]=128|t&63);return e};const $2=(n,e)=>{if(e<65534&&n.subarray&&Hs)return String.fromCharCode.apply(null,n.length===e?n:n.subarray(0,e));let t=\"\";for(let i=0;i<e;i++)t+=String.fromCharCode(n[i]);return t};var Y2=(n,e)=>{const t=e||n.length;if(typeof TextDecoder==\"function\"&&TextDecoder.prototype.decode)return new TextDecoder().decode(n.subarray(0,e));let i,o;const a=new Array(t*2);for(o=0,i=0;i<t;){let s=n[i++];if(s<128){a[o++]=s;continue}let l=oi[s];if(l>4){a[o++]=65533,i+=l-1;continue}for(s&=l===2?31:l===3?15:7;l>1&&i<t;)s=s<<6|n[i++]&63,l--;if(l>1){a[o++]=65533;continue}s<65536?a[o++]=s:(s-=65536,a[o++]=55296|s>>10&1023,a[o++]=56320|s&1023)}return $2(a,o)},W2=(n,e)=>{e=e||n.length,e>n.length&&(e=n.length);let t=e-1;for(;t>=0&&(n[t]&192)===128;)t--;return t<0||t===0?e:t+oi[n[t]]>e?t:e},ai={string2buf:V2,buf2string:Y2,utf8border:W2};function X2(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=\"\",this.state=null,this.data_type=2,this.adler=0}var Zs=X2;const js=Object.prototype.toString,{Z_NO_FLUSH:J2,Z_SYNC_FLUSH:t_,Z_FULL_FLUSH:e_,Z_FINISH:n_,Z_OK:Mi,Z_STREAM_END:i_,Z_DEFAULT_COMPRESSION:o_,Z_DEFAULT_STRATEGY:a_,Z_DEFLATED:c_}=bn;function _i(n){this.options=zi.assign({level:o_,method:c_,chunkSize:16384,windowBits:15,memLevel:8,strategy:a_},n||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg=\"\",this.ended=!1,this.chunks=[],this.strm=new Zs,this.strm.avail_out=0;let t=$n.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Mi)throw new Error(gn[t]);if(e.header&&$n.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary==\"string\"?i=ai.string2buf(e.dictionary):js.call(e.dictionary)===\"[object ArrayBuffer]\"?i=new Uint8Array(e.dictionary):i=e.dictionary,t=$n.deflateSetDictionary(this.strm,i),t!==Mi)throw new Error(gn[t]);this._dict_set=!0}}_i.prototype.push=function(n,e){const t=this.strm,i=this.options.chunkSize;let o,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?n_:J2,typeof n==\"string\"?t.input=ai.string2buf(n):js.call(n)===\"[object ArrayBuffer]\"?t.input=new Uint8Array(n):t.input=n,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(a===t_||a===e_)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(o=$n.deflate(t,a),o===i_)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),o=$n.deflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===Mi;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};_i.prototype.onData=function(n){this.chunks.push(n)};_i.prototype.onEnd=function(n){n===Mi&&(this.result=zi.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function Fa(n,e){const t=new _i(e);if(t.push(n,!0),t.err)throw t.msg||gn[t.err];return t.result}function r_(n,e){return e=e||{},e.raw=!0,Fa(n,e)}function s_(n,e){return e=e||{},e.gzip=!0,Fa(n,e)}var l_=_i,d_=Fa,u_=r_,f_=s_,__=bn,h_={Deflate:l_,deflate:d_,deflateRaw:u_,gzip:f_,constants:__};const wi=16209,g_=16191;var p_=function(e,t){let i,o,a,s,l,g,d,u,w,C,h,m,O,Q,P,G,st,N,y,I,_,M,F,L;const D=e.state;i=e.next_in,F=e.input,o=i+(e.avail_in-5),a=e.next_out,L=e.output,s=a-(t-e.avail_out),l=a+(e.avail_out-257),g=D.dmax,d=D.wsize,u=D.whave,w=D.wnext,C=D.window,h=D.hold,m=D.bits,O=D.lencode,Q=D.distcode,P=(1<<D.lenbits)-1,G=(1<<D.distbits)-1;t:do{m<15&&(h+=F[i++]<<m,m+=8,h+=F[i++]<<m,m+=8),st=O[h&P];e:for(;;){if(N=st>>>24,h>>>=N,m-=N,N=st>>>16&255,N===0)L[a++]=st&65535;else if(N&16){y=st&65535,N&=15,N&&(m<N&&(h+=F[i++]<<m,m+=8),y+=h&(1<<N)-1,h>>>=N,m-=N),m<15&&(h+=F[i++]<<m,m+=8,h+=F[i++]<<m,m+=8),st=Q[h&G];n:for(;;){if(N=st>>>24,h>>>=N,m-=N,N=st>>>16&255,N&16){if(I=st&65535,N&=15,m<N&&(h+=F[i++]<<m,m+=8,m<N&&(h+=F[i++]<<m,m+=8)),I+=h&(1<<N)-1,I>g){e.msg=\"invalid distance too far back\",D.mode=wi;break t}if(h>>>=N,m-=N,N=a-s,I>N){if(N=I-N,N>u&&D.sane){e.msg=\"invalid distance too far back\",D.mode=wi;break t}if(_=0,M=C,w===0){if(_+=d-N,N<y){y-=N;do L[a++]=C[_++];while(--N);_=a-I,M=L}}else if(w<N){if(_+=d+w-N,N-=w,N<y){y-=N;do L[a++]=C[_++];while(--N);if(_=0,w<y){N=w,y-=N;do L[a++]=C[_++];while(--N);_=a-I,M=L}}}else if(_+=w-N,N<y){y-=N;do L[a++]=C[_++];while(--N);_=a-I,M=L}for(;y>2;)L[a++]=M[_++],L[a++]=M[_++],L[a++]=M[_++],y-=3;y&&(L[a++]=M[_++],y>1&&(L[a++]=M[_++]))}else{_=a-I;do L[a++]=L[_++],L[a++]=L[_++],L[a++]=L[_++],y-=3;while(y>2);y&&(L[a++]=L[_++],y>1&&(L[a++]=L[_++]))}}else if(N&64){e.msg=\"invalid distance code\",D.mode=wi;break t}else{st=Q[(st&65535)+(h&(1<<N)-1)];continue n}break}}else if(N&64)if(N&32){D.mode=g_;break t}else{e.msg=\"invalid literal/length code\",D.mode=wi;break t}else{st=O[(st&65535)+(h&(1<<N)-1)];continue e}break}}while(i<o&&a<l);y=m>>3,i-=y,m-=y<<3,h&=(1<<m)-1,e.next_in=i,e.next_out=a,e.avail_in=i<o?5+(o-i):5-(i-o),e.avail_out=a<l?257+(l-a):257-(a-l),D.hold=h,D.bits=m};const En=15,Kc=852,Hc=592,Zc=0,Do=1,jc=2,L_=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),A_=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),b_=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),y_=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),m_=(n,e,t,i,o,a,s,l)=>{const g=l.bits;let d=0,u=0,w=0,C=0,h=0,m=0,O=0,Q=0,P=0,G=0,st,N,y,I,_,M=null,F;const L=new Uint16Array(En+1),D=new Uint16Array(En+1);let K=null,$,S,B;for(d=0;d<=En;d++)L[d]=0;for(u=0;u<i;u++)L[e[t+u]]++;for(h=g,C=En;C>=1&&L[C]===0;C--);if(h>C&&(h=C),C===0)return o[a++]=1<<24|64<<16|0,o[a++]=1<<24|64<<16|0,l.bits=1,0;for(w=1;w<C&&L[w]===0;w++);for(h<w&&(h=w),Q=1,d=1;d<=En;d++)if(Q<<=1,Q-=L[d],Q<0)return-1;if(Q>0&&(n===Zc||C!==1))return-1;for(D[1]=0,d=1;d<En;d++)D[d+1]=D[d]+L[d];for(u=0;u<i;u++)e[t+u]!==0&&(s[D[e[t+u]]++]=u);if(n===Zc?(M=K=s,F=20):n===Do?(M=L_,K=A_,F=257):(M=b_,K=y_,F=0),G=0,u=0,d=w,_=a,m=h,O=0,y=-1,P=1<<h,I=P-1,n===Do&&P>Kc||n===jc&&P>Hc)return 1;for(;;){$=d-O,s[u]+1<F?(S=0,B=s[u]):s[u]>=F?(S=K[s[u]-F],B=M[s[u]-F]):(S=96,B=0),st=1<<d-O,N=1<<m,w=N;do N-=st,o[_+(G>>O)+N]=$<<24|S<<16|B|0;while(N!==0);for(st=1<<d-1;G&st;)st>>=1;if(st!==0?(G&=st-1,G+=st):G=0,u++,--L[d]===0){if(d===C)break;d=e[t+s[u]]}if(d>h&&(G&I)!==y){for(O===0&&(O=h),_+=w,m=d-O,Q=1<<m;m+O<C&&(Q-=L[m+O],!(Q<=0));)m++,Q<<=1;if(P+=1<<m,n===Do&&P>Kc||n===jc&&P>Hc)return 1;y=G&I,o[y]=h<<24|m<<16|_-a|0}}return G!==0&&(o[_+G]=d-O<<24|64<<16|0),l.bits=h,0};var Yn=m_;const w_=0,Vs=1,$s=2,{Z_FINISH:Vc,Z_BLOCK:I_,Z_TREES:Ii,Z_OK:Ln,Z_STREAM_END:C_,Z_NEED_DICT:E_,Z_STREAM_ERROR:Oe,Z_DATA_ERROR:Ys,Z_MEM_ERROR:Ws,Z_BUF_ERROR:B_,Z_DEFLATED:$c}=bn,qi=16180,Yc=16181,Wc=16182,Xc=16183,Jc=16184,tr=16185,er=16186,nr=16187,ir=16188,or=16189,Ti=16190,He=16191,ko=16192,ar=16193,zo=16194,cr=16195,rr=16196,sr=16197,lr=16198,Ci=16199,Ei=16200,dr=16201,ur=16202,fr=16203,_r=16204,hr=16205,qo=16206,gr=16207,pr=16208,le=16209,Xs=16210,Js=16211,x_=852,v_=592,F_=15,S_=F_,Lr=n=>(n>>>24&255)+(n>>>8&65280)+((n&65280)<<8)+((n&255)<<24);function O_(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const yn=n=>{if(!n)return 1;const e=n.state;return!e||e.strm!==n||e.mode<qi||e.mode>Js?1:0},tl=n=>{if(yn(n))return Oe;const e=n.state;return n.total_in=n.total_out=e.total=0,n.msg=\"\",e.wrap&&(n.adler=e.wrap&1),e.mode=qi,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(x_),e.distcode=e.distdyn=new Int32Array(v_),e.sane=1,e.back=-1,Ln},el=n=>{if(yn(n))return Oe;const e=n.state;return e.wsize=0,e.whave=0,e.wnext=0,tl(n)},nl=(n,e)=>{let t;if(yn(n))return Oe;const i=n.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Oe:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=t,i.wbits=e,el(n))},il=(n,e)=>{if(!n)return Oe;const t=new O_;n.state=t,t.strm=n,t.window=null,t.mode=qi;const i=nl(n,e);return i!==Ln&&(n.state=null),i},P_=n=>il(n,S_);let Ar=!0,Qo,No;const U_=n=>{if(Ar){Qo=new Int32Array(512),No=new Int32Array(32);let e=0;for(;e<144;)n.lens[e++]=8;for(;e<256;)n.lens[e++]=9;for(;e<280;)n.lens[e++]=7;for(;e<288;)n.lens[e++]=8;for(Yn(Vs,n.lens,0,288,Qo,0,n.work,{bits:9}),e=0;e<32;)n.lens[e++]=5;Yn($s,n.lens,0,32,No,0,n.work,{bits:5}),Ar=!1}n.lencode=Qo,n.lenbits=9,n.distcode=No,n.distbits=5},ol=(n,e,t,i)=>{let o;const a=n.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(o=a.wsize-a.wnext,o>i&&(o=i),a.window.set(e.subarray(t-i,t-i+o),a.wnext),i-=o,i?(a.window.set(e.subarray(t-i,t),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=o,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=o))),0},M_=(n,e)=>{let t,i,o,a,s,l,g,d,u,w,C,h,m,O,Q=0,P,G,st,N,y,I,_,M;const F=new Uint8Array(4);let L,D;const K=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(yn(n)||!n.output||!n.input&&n.avail_in!==0)return Oe;t=n.state,t.mode===He&&(t.mode=ko),s=n.next_out,o=n.output,g=n.avail_out,a=n.next_in,i=n.input,l=n.avail_in,d=t.hold,u=t.bits,w=l,C=g,M=Ln;t:for(;;)switch(t.mode){case qi:if(t.wrap===0){t.mode=ko;break}for(;u<16;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}if(t.wrap&2&&d===35615){t.wbits===0&&(t.wbits=15),t.check=0,F[0]=d&255,F[1]=d>>>8&255,t.check=he(t.check,F,2,0),d=0,u=0,t.mode=Yc;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((d&255)<<8)+(d>>8))%31){n.msg=\"incorrect header check\",t.mode=le;break}if((d&15)!==$c){n.msg=\"unknown compression method\",t.mode=le;break}if(d>>>=4,u-=4,_=(d&15)+8,t.wbits===0&&(t.wbits=_),_>15||_>t.wbits){n.msg=\"invalid window size\",t.mode=le;break}t.dmax=1<<t.wbits,t.flags=0,n.adler=t.check=1,t.mode=d&512?or:He,d=0,u=0;break;case Yc:for(;u<16;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}if(t.flags=d,(t.flags&255)!==$c){n.msg=\"unknown compression method\",t.mode=le;break}if(t.flags&57344){n.msg=\"unknown header flags set\",t.mode=le;break}t.head&&(t.head.text=d>>8&1),t.flags&512&&t.wrap&4&&(F[0]=d&255,F[1]=d>>>8&255,t.check=he(t.check,F,2,0)),d=0,u=0,t.mode=Wc;case Wc:for(;u<32;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}t.head&&(t.head.time=d),t.flags&512&&t.wrap&4&&(F[0]=d&255,F[1]=d>>>8&255,F[2]=d>>>16&255,F[3]=d>>>24&255,t.check=he(t.check,F,4,0)),d=0,u=0,t.mode=Xc;case Xc:for(;u<16;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}t.head&&(t.head.xflags=d&255,t.head.os=d>>8),t.flags&512&&t.wrap&4&&(F[0]=d&255,F[1]=d>>>8&255,t.check=he(t.check,F,2,0)),d=0,u=0,t.mode=Jc;case Jc:if(t.flags&1024){for(;u<16;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}t.length=d,t.head&&(t.head.extra_len=d),t.flags&512&&t.wrap&4&&(F[0]=d&255,F[1]=d>>>8&255,t.check=he(t.check,F,2,0)),d=0,u=0}else t.head&&(t.head.extra=null);t.mode=tr;case tr:if(t.flags&1024&&(h=t.length,h>l&&(h=l),h&&(t.head&&(_=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(a,a+h),_)),t.flags&512&&t.wrap&4&&(t.check=he(t.check,i,h,a)),l-=h,a+=h,t.length-=h),t.length))break t;t.length=0,t.mode=er;case er:if(t.flags&2048){if(l===0)break t;h=0;do _=i[a+h++],t.head&&_&&t.length<65536&&(t.head.name+=String.fromCharCode(_));while(_&&h<l);if(t.flags&512&&t.wrap&4&&(t.check=he(t.check,i,h,a)),l-=h,a+=h,_)break t}else t.head&&(t.head.name=null);t.length=0,t.mode=nr;case nr:if(t.flags&4096){if(l===0)break t;h=0;do _=i[a+h++],t.head&&_&&t.length<65536&&(t.head.comment+=String.fromCharCode(_));while(_&&h<l);if(t.flags&512&&t.wrap&4&&(t.check=he(t.check,i,h,a)),l-=h,a+=h,_)break t}else t.head&&(t.head.comment=null);t.mode=ir;case ir:if(t.flags&512){for(;u<16;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}if(t.wrap&4&&d!==(t.check&65535)){n.msg=\"header crc mismatch\",t.mode=le;break}d=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),n.adler=t.check=0,t.mode=He;break;case or:for(;u<32;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}n.adler=t.check=Lr(d),d=0,u=0,t.mode=Ti;case Ti:if(t.havedict===0)return n.next_out=s,n.avail_out=g,n.next_in=a,n.avail_in=l,t.hold=d,t.bits=u,E_;n.adler=t.check=1,t.mode=He;case He:if(e===I_||e===Ii)break t;case ko:if(t.last){d>>>=u&7,u-=u&7,t.mode=qo;break}for(;u<3;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}switch(t.last=d&1,d>>>=1,u-=1,d&3){case 0:t.mode=ar;break;case 1:if(U_(t),t.mode=Ci,e===Ii){d>>>=2,u-=2;break t}break;case 2:t.mode=rr;break;case 3:n.msg=\"invalid block type\",t.mode=le}d>>>=2,u-=2;break;case ar:for(d>>>=u&7,u-=u&7;u<32;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}if((d&65535)!==(d>>>16^65535)){n.msg=\"invalid stored block lengths\",t.mode=le;break}if(t.length=d&65535,d=0,u=0,t.mode=zo,e===Ii)break t;case zo:t.mode=cr;case cr:if(h=t.length,h){if(h>l&&(h=l),h>g&&(h=g),h===0)break t;o.set(i.subarray(a,a+h),s),l-=h,a+=h,g-=h,s+=h,t.length-=h;break}t.mode=He;break;case rr:for(;u<14;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}if(t.nlen=(d&31)+257,d>>>=5,u-=5,t.ndist=(d&31)+1,d>>>=5,u-=5,t.ncode=(d&15)+4,d>>>=4,u-=4,t.nlen>286||t.ndist>30){n.msg=\"too many length or distance symbols\",t.mode=le;break}t.have=0,t.mode=sr;case sr:for(;t.have<t.ncode;){for(;u<3;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}t.lens[K[t.have++]]=d&7,d>>>=3,u-=3}for(;t.have<19;)t.lens[K[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,L={bits:t.lenbits},M=Yn(w_,t.lens,0,19,t.lencode,0,t.work,L),t.lenbits=L.bits,M){n.msg=\"invalid code lengths set\",t.mode=le;break}t.have=0,t.mode=lr;case lr:for(;t.have<t.nlen+t.ndist;){for(;Q=t.lencode[d&(1<<t.lenbits)-1],P=Q>>>24,G=Q>>>16&255,st=Q&65535,!(P<=u);){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}if(st<16)d>>>=P,u-=P,t.lens[t.have++]=st;else{if(st===16){for(D=P+2;u<D;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}if(d>>>=P,u-=P,t.have===0){n.msg=\"invalid bit length repeat\",t.mode=le;break}_=t.lens[t.have-1],h=3+(d&3),d>>>=2,u-=2}else if(st===17){for(D=P+3;u<D;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}d>>>=P,u-=P,_=0,h=3+(d&7),d>>>=3,u-=3}else{for(D=P+7;u<D;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}d>>>=P,u-=P,_=0,h=11+(d&127),d>>>=7,u-=7}if(t.have+h>t.nlen+t.ndist){n.msg=\"invalid bit length repeat\",t.mode=le;break}for(;h--;)t.lens[t.have++]=_}}if(t.mode===le)break;if(t.lens[256]===0){n.msg=\"invalid code -- missing end-of-block\",t.mode=le;break}if(t.lenbits=9,L={bits:t.lenbits},M=Yn(Vs,t.lens,0,t.nlen,t.lencode,0,t.work,L),t.lenbits=L.bits,M){n.msg=\"invalid literal/lengths set\",t.mode=le;break}if(t.distbits=6,t.distcode=t.distdyn,L={bits:t.distbits},M=Yn($s,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,L),t.distbits=L.bits,M){n.msg=\"invalid distances set\",t.mode=le;break}if(t.mode=Ci,e===Ii)break t;case Ci:t.mode=Ei;case Ei:if(l>=6&&g>=258){n.next_out=s,n.avail_out=g,n.next_in=a,n.avail_in=l,t.hold=d,t.bits=u,p_(n,C),s=n.next_out,o=n.output,g=n.avail_out,a=n.next_in,i=n.input,l=n.avail_in,d=t.hold,u=t.bits,t.mode===He&&(t.back=-1);break}for(t.back=0;Q=t.lencode[d&(1<<t.lenbits)-1],P=Q>>>24,G=Q>>>16&255,st=Q&65535,!(P<=u);){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}if(G&&!(G&240)){for(N=P,y=G,I=st;Q=t.lencode[I+((d&(1<<N+y)-1)>>N)],P=Q>>>24,G=Q>>>16&255,st=Q&65535,!(N+P<=u);){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}d>>>=N,u-=N,t.back+=N}if(d>>>=P,u-=P,t.back+=P,t.length=st,G===0){t.mode=hr;break}if(G&32){t.back=-1,t.mode=He;break}if(G&64){n.msg=\"invalid literal/length code\",t.mode=le;break}t.extra=G&15,t.mode=dr;case dr:if(t.extra){for(D=t.extra;u<D;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}t.length+=d&(1<<t.extra)-1,d>>>=t.extra,u-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=ur;case ur:for(;Q=t.distcode[d&(1<<t.distbits)-1],P=Q>>>24,G=Q>>>16&255,st=Q&65535,!(P<=u);){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}if(!(G&240)){for(N=P,y=G,I=st;Q=t.distcode[I+((d&(1<<N+y)-1)>>N)],P=Q>>>24,G=Q>>>16&255,st=Q&65535,!(N+P<=u);){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}d>>>=N,u-=N,t.back+=N}if(d>>>=P,u-=P,t.back+=P,G&64){n.msg=\"invalid distance code\",t.mode=le;break}t.offset=st,t.extra=G&15,t.mode=fr;case fr:if(t.extra){for(D=t.extra;u<D;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}t.offset+=d&(1<<t.extra)-1,d>>>=t.extra,u-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){n.msg=\"invalid distance too far back\",t.mode=le;break}t.mode=_r;case _r:if(g===0)break t;if(h=C-g,t.offset>h){if(h=t.offset-h,h>t.whave&&t.sane){n.msg=\"invalid distance too far back\",t.mode=le;break}h>t.wnext?(h-=t.wnext,m=t.wsize-h):m=t.wnext-h,h>t.length&&(h=t.length),O=t.window}else O=o,m=s-t.offset,h=t.length;h>g&&(h=g),g-=h,t.length-=h;do o[s++]=O[m++];while(--h);t.length===0&&(t.mode=Ei);break;case hr:if(g===0)break t;o[s++]=t.length,g--,t.mode=Ei;break;case qo:if(t.wrap){for(;u<32;){if(l===0)break t;l--,d|=i[a++]<<u,u+=8}if(C-=g,n.total_out+=C,t.total+=C,t.wrap&4&&C&&(n.adler=t.check=t.flags?he(t.check,o,C,s-C):ii(t.check,o,C,s-C)),C=g,t.wrap&4&&(t.flags?d:Lr(d))!==t.check){n.msg=\"incorrect data check\",t.mode=le;break}d=0,u=0}t.mode=gr;case gr:if(t.wrap&&t.flags){for(;u<32;){if(l===0)break t;l--,d+=i[a++]<<u,u+=8}if(t.wrap&4&&d!==(t.total&4294967295)){n.msg=\"incorrect length check\",t.mode=le;break}d=0,u=0}t.mode=pr;case pr:M=C_;break t;case le:M=Ys;break t;case Xs:return Ws;case Js:default:return Oe}return n.next_out=s,n.avail_out=g,n.next_in=a,n.avail_in=l,t.hold=d,t.bits=u,(t.wsize||C!==n.avail_out&&t.mode<le&&(t.mode<qo||e!==Vc))&&ol(n,n.output,n.next_out,C-n.avail_out),w-=n.avail_in,C-=n.avail_out,n.total_in+=w,n.total_out+=C,t.total+=C,t.wrap&4&&C&&(n.adler=t.check=t.flags?he(t.check,o,C,n.next_out-C):ii(t.check,o,C,n.next_out-C)),n.data_type=t.bits+(t.last?64:0)+(t.mode===He?128:0)+(t.mode===Ci||t.mode===zo?256:0),(w===0&&C===0||e===Vc)&&M===Ln&&(M=B_),M},T_=n=>{if(yn(n))return Oe;let e=n.state;return e.window&&(e.window=null),n.state=null,Ln},R_=(n,e)=>{if(yn(n))return Oe;const t=n.state;return t.wrap&2?(t.head=e,e.done=!1,Ln):Oe},D_=(n,e)=>{const t=e.length;let i,o,a;return yn(n)||(i=n.state,i.wrap!==0&&i.mode!==Ti)?Oe:i.mode===Ti&&(o=1,o=ii(o,e,t,0),o!==i.check)?Ys:(a=ol(n,e,t,t),a?(i.mode=Xs,Ws):(i.havedict=1,Ln))};var k_=el,z_=nl,q_=tl,Q_=P_,N_=il,G_=M_,K_=T_,H_=R_,Z_=D_,j_=\"pako inflate (from Nodeca project)\",je={inflateReset:k_,inflateReset2:z_,inflateResetKeep:q_,inflateInit:Q_,inflateInit2:N_,inflate:G_,inflateEnd:K_,inflateGetHeader:H_,inflateSetDictionary:Z_,inflateInfo:j_};function V_(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=\"\",this.comment=\"\",this.hcrc=0,this.done=!1}var $_=V_;const al=Object.prototype.toString,{Z_NO_FLUSH:Y_,Z_FINISH:W_,Z_OK:ci,Z_STREAM_END:Go,Z_NEED_DICT:Ko,Z_STREAM_ERROR:X_,Z_DATA_ERROR:br,Z_MEM_ERROR:J_}=bn;function hi(n){this.options=zi.assign({chunkSize:1024*64,windowBits:15,to:\"\"},n||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(n&&n.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg=\"\",this.ended=!1,this.chunks=[],this.strm=new Zs,this.strm.avail_out=0;let t=je.inflateInit2(this.strm,e.windowBits);if(t!==ci)throw new Error(gn[t]);if(this.header=new $_,je.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary==\"string\"?e.dictionary=ai.string2buf(e.dictionary):al.call(e.dictionary)===\"[object ArrayBuffer]\"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=je.inflateSetDictionary(this.strm,e.dictionary),t!==ci)))throw new Error(gn[t])}hi.prototype.push=function(n,e){const t=this.strm,i=this.options.chunkSize,o=this.options.dictionary;let a,s,l;if(this.ended)return!1;for(e===~~e?s=e:s=e===!0?W_:Y_,al.call(n)===\"[object ArrayBuffer]\"?t.input=new Uint8Array(n):t.input=n,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),a=je.inflate(t,s),a===Ko&&o&&(a=je.inflateSetDictionary(t,o),a===ci?a=je.inflate(t,s):a===br&&(a=Ko));t.avail_in>0&&a===Go&&t.state.wrap>0&&n[t.next_in]!==0;)je.inflateReset(t),a=je.inflate(t,s);switch(a){case X_:case br:case Ko:case J_:return this.onEnd(a),this.ended=!0,!1}if(l=t.avail_out,t.next_out&&(t.avail_out===0||a===Go))if(this.options.to===\"string\"){let g=ai.utf8border(t.output,t.next_out),d=t.next_out-g,u=ai.buf2string(t.output,g);t.next_out=d,t.avail_out=i-d,d&&t.output.set(t.output.subarray(g,g+d),0),this.onData(u)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===ci&&l===0)){if(a===Go)return a=je.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};hi.prototype.onData=function(n){this.chunks.push(n)};hi.prototype.onEnd=function(n){n===ci&&(this.options.to===\"string\"?this.result=this.chunks.join(\"\"):this.result=zi.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function Sa(n,e){const t=new hi(e);if(t.push(n),t.err)throw t.msg||gn[t.err];return t.result}function th(n,e){return e=e||{},e.raw=!0,Sa(n,e)}var eh=hi,nh=Sa,ih=th,oh=Sa,ah=bn,ch={Inflate:eh,inflate:nh,inflateRaw:ih,ungzip:oh,constants:ah};const{Deflate:rh,deflate:sh,deflateRaw:lh,gzip:dh}=h_,{Inflate:uh,inflate:fh,inflateRaw:_h,ungzip:hh}=ch;var gh=rh,ph=sh,Lh=lh,Ah=dh,bh=uh,yh=fh,mh=_h,wh=hh,Ih=bn,Ch={Deflate:gh,deflate:ph,deflateRaw:Lh,gzip:Ah,Inflate:bh,inflate:yh,inflateRaw:mh,ungzip:wh,constants:Ih};const yr=\"circuit\";async function Eh(n,e){for(let t=1;t<=e;t++){console.log(`download attempt ${t} for ${n}`);const i=await fetch(n,{method:\"GET\"});if(i.status===200)return i}throw new Error(`Error downloading ${n} after ${e} retries`)}const Bh=async n=>Ch.ungzip(n).buffer;async function xh(n,e,t=!1){const o=await(await Eh(n,3)).arrayBuffer();if(!t)await vi.setItem(e,o);else{const a=await Bh(o);await vi.setItem(e,a),console.log(\"stored file in localforage\",e)}console.log(`Storage of ${e} successful!`)}self.onmessage=async function(n){const{chunkedZkeyUrls:e,inputs:t,wasmUrl:i}=n.data;self.postMessage({type:\"message\",message:\"Worker started\"}),self.postMessage({type:\"progress\",message:\"Downloading zkeys\"}),await Promise.all(e.map(async({suffix:o,url:a})=>{await xh(a,`${yr}.zkey${o}`,!0)})),self.postMessage({type:\"message\",message:\"Download complete\"});try{self.postMessage({type:\"progress\",message:\"Proving\"});const{proof:o,publicSignals:a}=await Ju(JSON.parse(t),i,`${yr}.zkey`);await vi.clear(),self.postMessage({type:\"result\",message:{proof:o,publicSignals:a}}),console.log(\"shutting down worker\"),self.close()}catch(o){self.postMessage({type:\"error\",error:o.message}),self.close()}};\n";