/**
 * Minified by jsDelivr using Terser v5.19.2.
 * Original file: /npm/@depay/worldcoin-precompiled@1.2.0/dist/umd/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WorldcoinPrecompiled={})}(this,(function(t){"use strict";function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function n(t,e,n,r,o,i,a){try{var u=t[i](a),s=u.value}catch(t){return void n(t)}u.done?e(s):Promise.resolve(s).then(r,o)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function u(t){n(a,o,i,u,s,"next",t)}function s(t){n(a,o,i,u,s,"throw",t)}u(void 0)}))}}function o(t,e,n){return e=f(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,p()?Reflect.construct(e,n||[],f(t).constructor):e.apply(t,n))}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,b(r.key),r)}}function u(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,n){return(e=b(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},c.apply(null,arguments)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&y(t,e)}function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(p=function(){return!!t})()}function h(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function d(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?h(Object(n),!0).forEach((function(e){s(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function v(){v=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof w?e:w,a=Object.create(i.prototype),u=new k(r||[]);return o(a,"_invoke",{value:I(t,n,u)}),a}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",g={};function w(){}function m(){}function b(){}var E={};c(E,a,(function(){return this}));var _=Object.getPrototypeOf,O=_&&_(_(U([])));O&&O!==n&&r.call(O,a)&&(E=O);var A=b.prototype=w.prototype=Object.create(E);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function n(o,i,a,u){var s=l(t[o],t,i);if("throw"!==s.type){var c=s.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(f).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,u)}))}u(s.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function I(e,n,r){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var s=B(u,r);if(s){if(s===g)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=l(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function B(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,B(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=l(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function U(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return m.prototype=b,o(A,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:m,configurable:!0}),m.displayName=c(b,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,s,"GeneratorFunction")),t.prototype=Object.create(A),t},e.awrap=function(t){return{__await:t}},x(S.prototype),c(S.prototype,u,(function(){return this})),e.AsyncIterator=S,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new S(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(A),c(A,s,"Generator"),c(A,a,(function(){return this})),c(A,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=U,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return u.type="throw",u.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:U(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function y(t,e){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},y(t,e)}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],s=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);s=!0);}catch(t){c=!0,o=t}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||_(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(t,e,n,r){var o=c(f(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function m(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function E(t){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(t)}function _(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}function O(t){var e="function"==typeof Map?new Map:void 0;return O=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(p())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&y(o,n.prototype),o}(t,arguments,f(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),y(n,t)},O(t)}function A(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function x(t){var e=t.default;if("function"==typeof e){var n=function(){return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}for(var S={},I={byteLength:function(t){var e=M(t),n=e[0],r=e[1];return 3*(n+r)/4-r},toByteArray:function(t){var e,n,r=M(t),o=r[0],i=r[1],a=new T(function(t,e,n){return 3*(e+n)/4-n}(0,o,i)),u=0,s=i>0?o-4:o;for(n=0;n<s;n+=4)e=L[t.charCodeAt(n)]<<18|L[t.charCodeAt(n+1)]<<12|L[t.charCodeAt(n+2)]<<6|L[t.charCodeAt(n+3)],a[u++]=e>>16&255,a[u++]=e>>8&255,a[u++]=255&e;2===i&&(e=L[t.charCodeAt(n)]<<2|L[t.charCodeAt(n+1)]>>4,a[u++]=255&e);1===i&&(e=L[t.charCodeAt(n)]<<10|L[t.charCodeAt(n+1)]<<4|L[t.charCodeAt(n+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e);return a},fromByteArray:function(t){for(var e,n=t.length,r=n%3,o=[],i=16383,a=0,u=n-r;a<u;a+=i)o.push(R(t,a,a+i>u?u:a+i));1===r?(e=t[n-1],o.push(B[e>>2]+B[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],o.push(B[e>>10]+B[e>>4&63]+B[e<<2&63]+"="));return o.join("")}},B=[],L=[],T="undefined"!=typeof Uint8Array?Uint8Array:Array,k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",U=0;U<64;++U)B[U]=k[U],L[k.charCodeAt(U)]=U;function M(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function R(t,e,n){for(var r,o,i=[],a=e;a<n;a+=3)r=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),i.push(B[(o=r)>>18&63]+B[o>>12&63]+B[o>>6&63]+B[63&o]);return i.join("")}L["-".charCodeAt(0)]=62,L["_".charCodeAt(0)]=63;var P={};
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function j(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).strict;return!!t&&("string"==typeof t&&(void 0===e||e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")))}function C(t){return j(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}P.read=function(t,e,n,r,o){var i,a,u=8*o-r-1,s=(1<<u)-1,c=s>>1,f=-7,l=n?o-1:0,p=n?-1:1,h=t[e+l];for(l+=p,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+t[e+l],l+=p,f-=8);for(a=i&(1<<-f)-1,i>>=-f,f+=r;f>0;a=256*a+t[e+l],l+=p,f-=8);if(0===i)i=1-c;else{if(i===s)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),i-=c}return(h?-1:1)*a*Math.pow(2,i-r)},P.write=function(t,e,n,r,o,i){var a,u,s,c=8*i-o-1,f=(1<<c)-1,l=f>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,d=r?1:-1,v=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-a))<1&&(a--,s*=2),(e+=a+l>=1?p/s:p*Math.pow(2,1-l))*s>=2&&(a++,s/=2),a+l>=f?(u=0,a=f):a+l>=1?(u=(e*s-1)*Math.pow(2,o),a+=l):(u=e*Math.pow(2,l-1)*Math.pow(2,o),a=0));o>=8;t[n+h]=255&u,h+=d,u/=256,o-=8);for(a=a<<o|u,c+=o;c>0;t[n+h]=255&a,h+=d,a/=256,c-=8);t[n+h-d]|=128*v},function(t){var e=I,n=P,r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},t.INSPECT_MAX_BYTES=50;var a=2147483647;function s(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return f(t,e,n)}function f(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var n=0|g(t,e),r=s(n),o=r.write(t,e);o!==n&&(r=r.slice(0,o));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(tt(t,Uint8Array)){var e=new Uint8Array(t);return v(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+E(t));if(tt(t,ArrayBuffer)||t&&tt(t.buffer,ArrayBuffer))return v(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(tt(t,SharedArrayBuffer)||t&&tt(t.buffer,SharedArrayBuffer)))return v(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return c.from(r,e,n);var o=function(t){if(c.isBuffer(t)){var e=0|y(t.length),n=s(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||et(t.length)?s(0):d(t);if("Buffer"===t.type&&Array.isArray(t.data))return d(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+E(t))}function p(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return p(t),s(t<0?0:0|y(t))}function d(t){for(var e=t.length<0?0:0|y(t.length),n=s(e),r=0;r<e;r+=1)n[r]=255&t[r];return n}function v(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,c.prototype),r}function y(t){if(t>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function g(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||tt(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+E(t));var n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return J(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(t).length;default:if(o)return r?-1:J(t).length;e=(""+e).toLowerCase(),o=!0}}function w(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,n);case"utf8":case"utf-8":return T(this,e,n);case"ascii":return U(this,e,n);case"latin1":case"binary":return M(this,e,n);case"base64":return L(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function b(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),et(n=+n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:_(t,e,n,r,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):_(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function _(t,e,n,r,o){var i,a=1,u=t.length,s=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,u/=2,s/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(o){var f=-1;for(i=n;i<u;i++)if(c(t,i)===c(e,-1===f?0:i-f)){if(-1===f&&(f=i),i-f+1===s)return f*a}else-1!==f&&(i-=i-f),f=-1}else for(n+s>u&&(n=u-s),i=n;i>=0;i--){for(var l=!0,p=0;p<s;p++)if(c(t,i+p)!==c(e,p)){l=!1;break}if(l)return i}return-1}function O(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i,a=e.length;for(r>a/2&&(r=a/2),i=0;i<r;++i){var u=parseInt(e.substr(2*i,2),16);if(et(u))return i;t[n+i]=u}return i}function A(t,e,n,r){return Q(J(e,t.length-n),t,n,r)}function x(t,e,n,r){return Q(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function S(t,e,n,r){return Q(Z(e),t,n,r)}function B(t,e,n,r){return Q(function(t,e){for(var n,r,o,i=[],a=0;a<t.length&&!((e-=2)<0);++a)r=(n=t.charCodeAt(a))>>8,o=n%256,i.push(o),i.push(r);return i}(e,t.length-n),t,n,r)}function L(t,n,r){return 0===n&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(n,r))}function T(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var i=t[o],a=null,u=i>239?4:i>223?3:i>191?2:1;if(o+u<=n){var s=void 0,c=void 0,f=void 0,l=void 0;switch(u){case 1:i<128&&(a=i);break;case 2:128==(192&(s=t[o+1]))&&(l=(31&i)<<6|63&s)>127&&(a=l);break;case 3:s=t[o+1],c=t[o+2],128==(192&s)&&128==(192&c)&&(l=(15&i)<<12|(63&s)<<6|63&c)>2047&&(l<55296||l>57343)&&(a=l);break;case 4:s=t[o+1],c=t[o+2],f=t[o+3],128==(192&s)&&128==(192&c)&&128==(192&f)&&(l=(15&i)<<18|(63&s)<<12|(63&c)<<6|63&f)>65535&&l<1114112&&(a=l)}}null===a?(a=65533,u=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),o+=u}return function(t){var e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=k));return n}(r)}t.kMaxLength=a,c.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(t,e,n){return f(t,e,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(t,e,n){return function(t,e,n){return p(t),t<=0?s(t):void 0!==e?"string"==typeof n?s(t).fill(e,n):s(t).fill(e):s(t)}(t,e,n)},c.allocUnsafe=function(t){return h(t)},c.allocUnsafeSlow=function(t){return h(t)},c.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==c.prototype},c.compare=function(t,e){if(tt(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),tt(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var n=t.length,r=e.length,o=0,i=Math.min(n,r);o<i;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?1:0},c.isEncoding=function(t){switch(String(t).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}},c.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=c.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var i=t[n];if(tt(i,Uint8Array))o+i.length>r.length?(c.isBuffer(i)||(i=c.from(i)),i.copy(r,o)):Uint8Array.prototype.set.call(r,i,o);else{if(!c.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,o)}o+=i.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},c.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},c.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},c.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?T(this,0,t):w.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},r&&(c.prototype[r]=c.prototype.inspect),c.prototype.compare=function(t,e,n,r,o){if(tt(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+E(t));if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),u=Math.min(i,a),s=this.slice(r,o),f=t.slice(e,n),l=0;l<u;++l)if(s[l]!==f[l]){i=s[l],a=f[l];break}return i<a?-1:a<i?1:0},c.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return b(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return b(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return O(this,t,e,n);case"utf8":case"utf-8":return A(this,t,e,n);case"ascii":case"latin1":case"binary":return x(this,t,e,n);case"base64":return S(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function U(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function M(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function R(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var o="",i=e;i<n;++i)o+=nt[t[i]];return o}function j(t,e,n){for(var r=t.slice(e,n),o="",i=0;i<r.length-1;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function C(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function z(t,e,n,r,o,i){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function D(t,e,n,r,o){Y(e,r,o,t,n,7);var i=Number(e&BigInt(4294967295));t[n++]=i,i>>=8,t[n++]=i,i>>=8,t[n++]=i,i>>=8,t[n++]=i;var a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,n}function N(t,e,n,r,o){Y(e,r,o,t,n,7);var i=Number(e&BigInt(4294967295));t[n+7]=i,i>>=8,t[n+6]=i,i>>=8,t[n+5]=i,i>>=8,t[n+4]=i;var a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=a,a>>=8,t[n+2]=a,a>>=8,t[n+1]=a,a>>=8,t[n]=a,n+8}function F(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function V(t,e,r,o,i){return e=+e,r>>>=0,i||F(t,0,r,4),n.write(t,e,r,o,23,4),r+4}function q(t,e,r,o,i){return e=+e,r>>>=0,i||F(t,0,r,8),n.write(t,e,r,o,52,8),r+8}c.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var r=this.subarray(t,e);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||C(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||C(t,e,this.length);for(var r=this[t+--e],o=1;e>0&&(o*=256);)r+=this[t+--e]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=rt((function(t){H(t>>>=0,"offset");var e=this[t],n=this[t+7];void 0!==e&&void 0!==n||X(t,this.length-8);var r=e+this[++t]*Math.pow(2,8)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,24),o=this[++t]+this[++t]*Math.pow(2,8)+this[++t]*Math.pow(2,16)+n*Math.pow(2,24);return BigInt(r)+(BigInt(o)<<BigInt(32))})),c.prototype.readBigUInt64BE=rt((function(t){H(t>>>=0,"offset");var e=this[t],n=this[t+7];void 0!==e&&void 0!==n||X(t,this.length-8);var r=e*Math.pow(2,24)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,8)+this[++t],o=this[++t]*Math.pow(2,24)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,8)+n;return(BigInt(r)<<BigInt(32))+BigInt(o)})),c.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||C(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||C(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},c.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=rt((function(t){H(t>>>=0,"offset");var e=this[t],n=this[t+7];void 0!==e&&void 0!==n||X(t,this.length-8);var r=this[t+4]+this[t+5]*Math.pow(2,8)+this[t+6]*Math.pow(2,16)+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+this[++t]*Math.pow(2,8)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,24))})),c.prototype.readBigInt64BE=rt((function(t){H(t>>>=0,"offset");var e=this[t],n=this[t+7];void 0!==e&&void 0!==n||X(t,this.length-8);var r=(e<<24)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,8)+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*Math.pow(2,24)+this[++t]*Math.pow(2,16)+this[++t]*Math.pow(2,8)+n)})),c.prototype.readFloatLE=function(t,e){return t>>>=0,e||C(t,4,this.length),n.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),n.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),n.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),n.read(this,t,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e>>>=0,n>>>=0,r)||z(this,t,e,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[e]=255&t;++i<n&&(o*=256);)this[e+i]=t/o&255;return e+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e>>>=0,n>>>=0,r)||z(this,t,e,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||z(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||z(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||z(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||z(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||z(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigUInt64LE=rt((function(t){return D(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=rt((function(t){return N(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var o=Math.pow(2,8*n-1);z(this,t,e,n,o-1,-o)}var i=0,a=1,u=0;for(this[e]=255&t;++i<n&&(a*=256);)t<0&&0===u&&0!==this[e+i-1]&&(u=1),this[e+i]=(t/a>>0)-u&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var o=Math.pow(2,8*n-1);z(this,t,e,n,o-1,-o)}var i=n-1,a=1,u=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/a>>0)-u&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||z(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||z(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||z(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||z(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||z(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigInt64LE=rt((function(t){return D(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=rt((function(t){return N(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,n){return V(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return V(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return q(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return q(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var o=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),o},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){var o=t.charCodeAt(0);("utf8"===r&&o<128||"latin1"===r)&&(t=o)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{var a=c.isBuffer(t)?t:c.from(t,r),u=a.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=a[i%u]}return this};var G={};function K(t,e,n){G[t]=function(n){function r(){var n;return i(this,r),n=o(this,r),Object.defineProperty(n,"message",{value:e.apply(n,arguments),writable:!0,configurable:!0}),n.name="".concat(n.name," [").concat(t,"]"),n.stack,delete n.name,n}return l(r,n),u(r,[{key:"code",get:function(){return t},set:function(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}},{key:"toString",value:function(){return"".concat(this.name," [").concat(t,"]: ").concat(this.message)}}])}(n)}function W(t){for(var e="",n=t.length,r="-"===t[0]?1:0;n>=r+4;n-=3)e="_".concat(t.slice(n-3,n)).concat(e);return"".concat(t.slice(0,n)).concat(e)}function Y(t,e,n,r,o,i){if(t>n||t<e){var a,u="bigint"==typeof e?"n":"";throw a=i>3?0===e||e===BigInt(0)?">= 0".concat(u," and < 2").concat(u," ** ").concat(8*(i+1)).concat(u):">= -(2".concat(u," ** ").concat(8*(i+1)-1).concat(u,") and < 2 ** ")+"".concat(8*(i+1)-1).concat(u):">= ".concat(e).concat(u," and <= ").concat(n).concat(u),new G.ERR_OUT_OF_RANGE("value",a,t)}!function(t,e,n){H(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||X(e,t.length-(n+1))}(r,o,i)}function H(t,e){if("number"!=typeof t)throw new G.ERR_INVALID_ARG_TYPE(e,"number",t)}function X(t,e,n){if(Math.floor(t)!==t)throw H(t,n),new G.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new G.ERR_BUFFER_OUT_OF_BOUNDS;throw new G.ERR_OUT_OF_RANGE(n||"offset",">= ".concat(n?1:0," and <= ").concat(e),t)}K("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?"".concat(t," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),K("ERR_INVALID_ARG_TYPE",(function(t,e){return'The "'.concat(t,'" argument must be of type number. Received type ').concat(E(e))}),TypeError),K("ERR_OUT_OF_RANGE",(function(t,e,n){var r='The value of "'.concat(t,'" is out of range.'),o=n;return Number.isInteger(n)&&Math.abs(n)>Math.pow(2,32)?o=W(String(n)):"bigint"==typeof n&&(o=String(n),(n>Math.pow(BigInt(2),BigInt(32))||n<-Math.pow(BigInt(2),BigInt(32)))&&(o=W(o)),o+="n"),r+=" It must be ".concat(e,". Received ").concat(o)}),RangeError);var $=/[^+/0-9A-Za-z-_]/g;function J(t,e){var n;e=e||1/0;for(var r=t.length,o=null,i=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Z(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace($,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Q(t,e,n,r){var o;for(o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function tt(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function et(t){return t!=t}var nt=function(){for(var t="0123456789abcdef",e=new Array(256),n=0;n<16;++n)for(var r=16*n,o=0;o<16;++o)e[r+o]=t[n]+t[o];return e}();function rt(t){return"undefined"==typeof BigInt?ot:t}function ot(){throw new Error("BigInt not supported")}}(S);var z="2.21.7",D={getDocsUrl:function(t){var e=t.docsBaseUrl,n=t.docsPath,r=void 0===n?"":n,o=t.docsSlug;return r?"".concat(null!=e?e:"https://viem.sh").concat(r).concat(o?"#".concat(o):""):void 0},version:z},N=function(t){function e(t){var n,r,a,u,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i(this,e);var c,f=s.cause instanceof e?s.cause.details:null!==(c=s.cause)&&void 0!==c&&c.message?s.cause.message:s.details,l=s.cause instanceof e&&s.cause.docsPath||s.docsPath,p=null===(n=(r=D).getDocsUrl)||void 0===n?void 0:n.call(r,d(d({},s),{},{docsPath:l}));return u=o(this,e,[[t||"An error occurred.",""].concat(m(s.metaMessages?[].concat(m(s.metaMessages),[""]):[]),m(p?["Docs: ".concat(p)]:[]),m(f?["Details: ".concat(f)]:[]),m(D.version?["Version: ".concat(D.version)]:[])).join("\n"),s.cause?{cause:s.cause}:void 0]),Object.defineProperty(u,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),u.details=f,u.docsPath=l,u.metaMessages=s.metaMessages,u.name=null!==(a=s.name)&&void 0!==a?a:u.name,u.shortMessage=t,u.version=z,u}return l(e,t),u(e,[{key:"walk",value:function(t){return F(this,t)}}])}(O(Error));function F(t,e){return null!=e&&e(t)?t:t&&"object"===E(t)&&"cause"in t?F(t.cause,e):e?null:t}var V=function(t){function e(t){var n=t.expectedLength,r=t.givenLength;return i(this,e),o(this,e,[["ABI encoding params/values length mismatch.","Expected length (params): ".concat(n),"Given length (values): ".concat(r)].join("\n"),{name:"AbiEncodingLengthMismatchError"}])}return l(e,t),u(e)}(N),q=function(t){function e(t){var n=t.expectedSize,r=t.givenSize;return i(this,e),o(this,e,["Expected bytes".concat(n,", got bytes").concat(r,"."),{name:"BytesSizeMismatchError"}])}return l(e,t),u(e)}(N),G=function(t){function e(t){return i(this,e),o(this,e,['Type "'.concat(t,'" is not supported for packed encoding.'),{name:"UnsupportedPackedAbiType"}])}return l(e,t),u(e)}(N),K=function(t){function e(t){var n=t.size,r=t.targetSize,a=t.type;return i(this,e),o(this,e,["".concat(a.charAt(0).toUpperCase()).concat(a.slice(1).toLowerCase()," size (").concat(n,") exceeds padding size (").concat(r,")."),{name:"SizeExceedsPaddingSizeError"}])}return l(e,t),u(e)}(N);function W(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.dir,r=e.size,o=void 0===r?32:r;return"string"==typeof t?function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.dir,r=e.size,o=void 0===r?32:r;if(null===o)return t;var i=t.replace("0x","");if(i.length>2*o)throw new K({size:Math.ceil(i.length/2),targetSize:o,type:"hex"});return"0x".concat(i["right"===n?"padEnd":"padStart"](2*o,"0"))}(t,{dir:n,size:o}):function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.dir,r=e.size,o=void 0===r?32:r;if(null===o)return t;if(t.length>o)throw new K({size:t.length,targetSize:o,type:"bytes"});for(var i=new Uint8Array(o),a=0;a<o;a++){var u="right"===n;i[u?a:o-a-1]=t[u?a:t.length-a-1]}return i}(t,{dir:n,size:o})}var Y=function(t){function e(t){var n=t.max,r=t.min,a=t.signed,u=t.size,s=t.value;return i(this,e),o(this,e,['Number "'.concat(s,'" is not in safe ').concat(u?"".concat(8*u,"-bit ").concat(a?"signed":"unsigned"," "):"","integer range ").concat(n?"(".concat(r," to ").concat(n,")"):"(above ".concat(r,")")),{name:"IntegerOutOfRangeError"}])}return l(e,t),u(e)}(N),H=function(t){function e(t){var n=t.givenSize,r=t.maxSize;return i(this,e),o(this,e,["Size cannot exceed ".concat(r," bytes. Given size: ").concat(n," bytes."),{name:"SizeOverflowError"}])}return l(e,t),u(e)}(N);function X(t,e){var n=e.size;if(C(t)>n)throw new H({givenSize:C(t),maxSize:n})}var $=Array.from({length:256},(function(t,e){return e.toString(16).padStart(2,"0")}));function J(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n="0x".concat(Number(t));return"number"==typeof e.size?(X(n,{size:e.size}),W(n,{size:e.size})):n}function Z(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n="",r=0;r<t.length;r++)n+=$[t[r]];var o="0x".concat(n);return"number"==typeof e.size?(X(o,{size:e.size}),W(o,{dir:"right",size:e.size})):o}function Q(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.signed,o=n.size,i=BigInt(t);o?e=r?(1n<<8n*BigInt(o)-1n)-1n:Math.pow(2n,8n*BigInt(o))-1n:"number"==typeof t&&(e=BigInt(Number.MAX_SAFE_INTEGER));var a="bigint"==typeof e&&r?-e-1n:0;if(e&&i>e||i<a){var u="bigint"==typeof t?"n":"";throw new Y({max:e?"".concat(e).concat(u):void 0,min:"".concat(a).concat(u),signed:r,size:o,value:"".concat(t).concat(u)})}var s="0x".concat((r&&i<0?(1n<<BigInt(8*o))+BigInt(i):i).toString(16));return o?W(s,{size:o}):s}var tt=new TextEncoder;function et(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Z(tt.encode(t),e)}var nt=new TextEncoder;function rt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"number"==typeof t||"bigint"==typeof t?function(t,e){var n=Q(t,e);return at(n)}(t,e):"boolean"==typeof t?function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new Uint8Array(1);if(n[0]=Number(t),"number"==typeof e.size)return X(n,{size:e.size}),W(n,{size:e.size});return n}(t,e):j(t)?at(t,e):ut(t,e)}var ot={zero:48,nine:57,A:65,F:70,a:97,f:102};function it(t){return t>=ot.zero&&t<=ot.nine?t-ot.zero:t>=ot.A&&t<=ot.F?t-(ot.A-10):t>=ot.a&&t<=ot.f?t-(ot.a-10):void 0}function at(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t;e.size&&(X(n,{size:e.size}),n=W(n,{dir:"right",size:e.size}));var r=n.slice(2);r.length%2&&(r="0".concat(r));for(var o=r.length/2,i=new Uint8Array(o),a=0,u=0;a<o;a++){var s=it(r.charCodeAt(u++)),c=it(r.charCodeAt(u++));if(void 0===s||void 0===c)throw new N('Invalid byte sequence ("'.concat(r[u-2]).concat(r[u-1],'" in "').concat(r,'").'));i[a]=16*s+c}return i}function ut(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=nt.encode(t);return"number"==typeof e.size?(X(n,{size:e.size}),W(n,{dir:"right",size:e.size})):n}function st(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, not ".concat(t))}function ct(t){if(!((e=t)instanceof Uint8Array||null!=e&&"object"===E(e)&&"Uint8Array"===e.constructor.name))throw new Error("Uint8Array expected");for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];if(r.length>0&&!r.includes(t.length))throw new Error("Uint8Array expected of length ".concat(r,", not of length=").concat(t.length))}function ft(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}var lt=BigInt(Math.pow(2,32)-1),pt=BigInt(32);function ht(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?{h:Number(t&lt),l:Number(t>>pt&lt)}:{h:0|Number(t>>pt&lt),l:0|Number(t&lt)}}function dt(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint32Array(t.length),r=new Uint32Array(t.length),o=0;o<t.length;o++){var i=ht(t[o],e),a=[i.h,i.l];n[o]=a[0],r[o]=a[1]}return[n,r]}var vt=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function yt(t){for(var e=0;e<t.length;e++)t[e]=(n=t[e])<<24&4278190080|n<<8&16711680|n>>>8&65280|n>>>24&255;var n}function gt(t){return"string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got ".concat(E(t)));return new Uint8Array((new TextEncoder).encode(t))}(t)),ct(t),t}var wt=function(){return u((function t(){i(this,t)}),[{key:"clone",value:function(){return this._cloneInto()}}])}();for(var mt=[],bt=[],Et=[],_t=BigInt(0),Ot=BigInt(1),At=BigInt(2),xt=BigInt(7),St=BigInt(256),It=BigInt(113),Bt=0,Lt=Ot,Tt=1,kt=0;Bt<24;Bt++){var Ut=[kt,(2*Tt+3*kt)%5];Tt=Ut[0],kt=Ut[1],mt.push(2*(5*kt+Tt)),bt.push((Bt+1)*(Bt+2)/2%64);for(var Mt=_t,Rt=0;Rt<7;Rt++)(Lt=(Lt<<Ot^(Lt>>xt)*It)%St)&At&&(Mt^=Ot<<(Ot<<BigInt(Rt))-Ot);Et.push(Mt)}var Pt=g(dt(Et,!0),2),jt=Pt[0],Ct=Pt[1],zt=function(t,e,n){return n>32?function(t,e,n){return e<<n-32|t>>>64-n}(t,e,n):function(t,e,n){return t<<n|e>>>32-n}(t,e,n)},Dt=function(t,e,n){return n>32?function(t,e,n){return t<<n-32|e>>>64-n}(t,e,n):function(t,e,n){return e<<n|t>>>32-n}(t,e,n)};var Nt=function(t){function e(t,n,r){var a,u,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:24;if(i(this,e),(a=o(this,e)).blockLen=t,a.suffix=n,a.outputLen=r,a.enableXOF=s,a.rounds=c,a.pos=0,a.posOut=0,a.finished=!1,a.destroyed=!1,st(r),0>=a.blockLen||a.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");return a.state=new Uint8Array(200),a.state32=(u=a.state,new Uint32Array(u.buffer,u.byteOffset,Math.floor(u.byteLength/4))),a}return l(e,t),u(e,[{key:"keccak",value:function(){vt||yt(this.state32),function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24,n=new Uint32Array(10),r=24-e;r<24;r++){for(var o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(var i=0;i<10;i+=2)for(var a=(i+8)%10,u=(i+2)%10,s=n[u],c=n[u+1],f=zt(s,c,1)^n[a],l=Dt(s,c,1)^n[a+1],p=0;p<50;p+=10)t[i+p]^=f,t[i+p+1]^=l;for(var h=t[2],d=t[3],v=0;v<24;v++){var y=bt[v],g=zt(h,d,y),w=Dt(h,d,y),m=mt[v];h=t[m],d=t[m+1],t[m]=g,t[m+1]=w}for(var b=0;b<50;b+=10){for(var E=0;E<10;E++)n[E]=t[b+E];for(var _=0;_<10;_++)t[b+_]^=~n[(_+2)%10]&n[(_+4)%10]}t[0]^=jt[r],t[1]^=Ct[r]}n.fill(0)}(this.state32,this.rounds),vt||yt(this.state32),this.posOut=0,this.pos=0}},{key:"update",value:function(t){ft(this);for(var e=this.blockLen,n=this.state,r=(t=gt(t)).length,o=0;o<r;){for(var i=Math.min(e-this.pos,r-o),a=0;a<i;a++)n[this.pos++]^=t[o++];this.pos===e&&this.keccak()}return this}},{key:"finish",value:function(){if(!this.finished){this.finished=!0;var t=this.state,e=this.suffix,n=this.pos,r=this.blockLen;t[n]^=e,0!=(128&e)&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}}},{key:"writeInto",value:function(t){ft(this,!1),ct(t),this.finish();for(var e=this.state,n=this.blockLen,r=0,o=t.length;r<o;){this.posOut>=n&&this.keccak();var i=Math.min(n-this.posOut,o-r);t.set(e.subarray(this.posOut,this.posOut+i),r),this.posOut+=i,r+=i}return t}},{key:"xofInto",value:function(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}},{key:"xof",value:function(t){return st(t),this.xofInto(new Uint8Array(t))}},{key:"digestInto",value:function(t){if(function(t,e){ct(t);var n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least ".concat(n))}(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}},{key:"digest",value:function(){return this.digestInto(new Uint8Array(this.outputLen))}},{key:"destroy",value:function(){this.destroyed=!0,this.state.fill(0)}},{key:"_cloneInto",value:function(t){var n=this.blockLen,r=this.suffix,o=this.outputLen,i=this.rounds,a=this.enableXOF;return t||(t=new e(n,r,o,a,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=o,t.enableXOF=a,t.destroyed=this.destroyed,t}}])}(wt),Ft=function(t,e,n){return o=function(t){return r().update(gt(t)).digest()},i=(r=function(){return new Nt(e,t,n)})(),o.outputLen=i.outputLen,o.blockLen=i.blockLen,o.create=function(){return r()},o;var r,o,i}(1,136,32);function Vt(t,e){var n=e||"hex",r=Ft(j(t,{strict:!1})?rt(t):t);return"bytes"===n?r:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"number"==typeof t||"bigint"==typeof t?Q(t,e):"string"==typeof t?et(t,e):"boolean"==typeof t?J(t,e):Z(t,e)}(r)}var qt=function(t){function e(t){var n=t.address;return i(this,e),o(this,e,['Address "'.concat(n,'" is invalid.'),{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"}])}return l(e,t),u(e)}(N),Gt=function(t){function e(t){var n;return i(this,e),n=o(this,e),Object.defineProperty(n,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n.maxSize=t,n}return l(e,t),u(e,[{key:"get",value:function(t){var n=w(e,"get",this,3)([t]);return w(e,"has",this,3)([t])&&void 0!==n&&(this.delete(t),w(e,"set",this,3)([t,n])),n}},{key:"set",value:function(t,n){if(w(e,"set",this,3)([t,n]),this.maxSize&&this.size>this.maxSize){var r=this.keys().next().value;r&&this.delete(r)}return this}}])}(O(Map)),Kt=new Gt(8192);var Wt=/^0x[a-fA-F0-9]{40}$/,Yt=new Gt(8192);function Ht(t,e){var n=(null!=e?e:{}).strict,r=void 0===n||n,o="".concat(t,".").concat(r);if(Yt.has(o))return Yt.get(o);var i=!(!Wt.test(t)||t.toLowerCase()!==t&&r&&function(t,e){if(Kt.has("".concat(t,".").concat(e)))return Kt.get("".concat(t,".").concat(e));for(var n=e?"".concat(e).concat(t.toLowerCase()):t.substring(2).toLowerCase(),r=Vt(ut(n),"bytes"),o=(e?n.substring("".concat(e,"0x").length):n).split(""),i=0;i<40;i+=2)r[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(15&r[i>>1])>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());var a="0x".concat(o.join(""));return Kt.set("".concat(t,".").concat(e),a),a}(t)!==t);return Yt.set(o,i),i}function Xt(t){return"0x".concat(t.reduce((function(t,e){return t+e.replace("0x","")}),""))}var $t=/^(.*)\[([0-9]*)\]$/,Jt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Zt=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Qt(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("address"===t){var r=e;if(!Ht(r))throw new qt({address:r});return W(r.toLowerCase(),{size:n?32:null})}if("string"===t)return et(e);if("bytes"===t)return e;if("bool"===t)return W(J(e),{size:n?32:1});var o=t.match(Zt);if(o){var i=g(o,3);i[0];var a=i[1],u=i[2],s=void 0===u?"256":u,c=Number.parseInt(s)/8;return Q(e,{size:n?32:c,signed:"int"===a})}var f=t.match(Jt);if(f){var l=g(f,2);l[0];var p=l[1];if(Number.parseInt(p)!==(e.length-2)/2)throw new q({expectedSize:Number.parseInt(p),givenSize:(e.length-2)/2});return W(e,{dir:"right",size:n?32:null})}var h=t.match($t);if(h&&Array.isArray(e)){var d=g(h,2);d[0];for(var v=d[1],y=[],w=0;w<e.length;w++)y.push(Qt(v,e[w],!0));return 0===y.length?"0x":Xt(y)}throw new G(t)}function te(t){return(e=t)&&"object"===E(e)&&"BYTES_PER_ELEMENT"in e&&1===e.BYTES_PER_ELEMENT&&"Uint8Array"===e.constructor.name||j(t)?ne(t):function(t){var e=S.Buffer.from(t);return ne(e)}(t);var e}function ee(t){var e=t.reduce((function(t,e){var n=g(t,2),r=n[0],o=n[1],i=g(e,2),a=i[0],u=i[1];return r.push(a),o.push(u),[r,o]}),[[],[]]),n=g(e,2);return ne(function(t,e){if(t.length!==e.length)throw new V({expectedLength:t.length,givenLength:e.length});for(var n=[],r=0;r<t.length;r++){var o=t[r],i=e[r];n.push(Qt(o,i))}return Xt(n)}(n[0],n[1]))}function ne(t){var e=BigInt(Vt(t))>>8n,n=e.toString(16);return{hash:e,digest:"0x".concat(n.padStart(64,"0"))}}var re,oe,ie=function(t){return t&&"string"!=typeof t?ee(t.types.map((function(e,n){return[e,t.values[n]]}))):te(null!=t?t:"")},ae=function(t){return t?"string"==typeof t?t:t.types.map((function(e,n){return"".concat(e,"(").concat(t.values[n],")")})).join(","):""},ue=function(t){var e,n=new Set,r=function(t,r){var o="function"==typeof t?t(e):t;if(!Object.is(o,e)){var i=e;e=(null!=r?r:"object"!==E(o)||null===o)?o:Object.assign({},e,o),n.forEach((function(t){return t(e,i)}))}},o=function(){return e},i={setState:r,getState:o,getInitialState:function(){return a},subscribe:function(t){return n.add(t),function(){return n.delete(t)}},destroy:function(){"production"!==(d(d({},Object.fromEntries(Object.entries({}).filter((function(t){var e=g(t,1)[0];return/^VITE_/.test(e)})))),{},{NODE_ENV:"product",MODE:"product",BASE_URL:"/",DEV:!0,PROD:!1})?"product":void 0)&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=e=t(r,o,i);return i},se={},ce={exports:{}},fe=x(Object.freeze({__proto__:null,default:se})),le={exports:{}},pe={};function he(){return re||(re=1,function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=fe,e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];!function(t,n,r){var o=e.ReactDebugCurrentFrame.getStackAddendum();""!==o&&(n+="%s",r=r.concat([o]));var i=r.map((function(t){return String(t)}));i.unshift("Warning: "+n),Function.prototype.apply.call(console[t],console,i)}("error",t,r)}var r="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},o=t.useState,i=t.useEffect,a=t.useLayoutEffect,u=t.useDebugValue,s=!1,c=!1;function f(t){var e=t.getSnapshot,n=t.value;try{var o=e();return!r(n,o)}catch(t){return!0}}var l=!!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement)?function(t,e,n){return e()}:function(e,l,p){s||void 0!==t.startTransition&&(s=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=l();if(!c){var d=l();r(h,d)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}var v=o({inst:{value:h,getSnapshot:l}}),y=v[0].inst,g=v[1];return a((function(){y.value=h,y.getSnapshot=l,f(y)&&g({inst:y})}),[e,h,l]),i((function(){f(y)&&g({inst:y});return e((function(){f(y)&&g({inst:y})}))}),[e]),u(h),h},p=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:l;pe.useSyncExternalStore=p,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),pe}function de(){return oe||(oe=1,function(t){t.exports=he()}(le)),le.exports}var ve,ye={};!function(t){t.exports=(ve||(ve=1,function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=fe,e=de(),n="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e},r=e.useSyncExternalStore,o=t.useRef,i=t.useEffect,a=t.useMemo,u=t.useDebugValue;ye.useSyncExternalStoreWithSelector=function(t,e,s,c,f){var l,p=o(null);null===p.current?(l={hasValue:!1,value:null},p.current=l):l=p.current;var h=a((function(){var t,r,o=!1,i=function(e){if(!o){o=!0,t=e;var i=c(e);if(void 0!==f&&l.hasValue){var a=l.value;if(f(a,i))return r=a,a}return r=i,i}var u=r;if(n(t,e))return u;var s=c(e);return void 0!==f&&f(u,s)?u:(t=e,r=s,s)},a=void 0===s?null:s;return[function(){return i(e())},null===a?void 0:function(){return i(a())}]}),[e,s,c,f]),d=h[0],v=h[1],y=r(t,d,v);return i((function(){l.hasValue=!0,l.value=y}),[y]),u(y),y},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),ye)}(ce);var ge=se.useDebugValue,we=A(ce.exports).useSyncExternalStoreWithSelector,me=!1,be=function(t){return t};var Ee=function(t){"production"!==(d(d({},Object.fromEntries(Object.entries({}).filter((function(t){var e=g(t,1)[0];return/^VITE_/.test(e)})))),{},{NODE_ENV:"product",MODE:"product",BASE_URL:"/",DEV:!0,PROD:!1})?"product":void 0)&&"function"!=typeof t&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");var e="function"==typeof t?function(t){return t?ue(t):ue}(t):t,n=function(t,n){return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:be,n=arguments.length>2?arguments[2]:void 0;"production"!==(d(d({},Object.fromEntries(Object.entries({}).filter((function(t){var e=g(t,1)[0];return/^VITE_/.test(e)})))),{},{NODE_ENV:"product",MODE:"product",BASE_URL:"/",DEV:!0,PROD:!1})?"product":void 0)&&n&&!me&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),me=!0);var r=we(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return ge(r),r}(e,t,n)};return Object.assign(n,e),n},_e=function(t){return t.ConnectionFailed="connection_failed",t.VerificationRejected="verification_rejected",t.MaxVerificationsReached="max_verifications_reached",t.CredentialUnavailable="credential_unavailable",t.MalformedRequest="malformed_request",t.InvalidNetwork="invalid_network",t.InclusionProofFailed="inclusion_proof_failed",t.InclusionProofPending="inclusion_proof_pending",t.UnexpectedResponse="unexpected_response",t.FailedByHostApp="failed_by_host_app",t.GenericError="generic_error",t}(_e||{}),Oe=function(t){return t.Orb="orb",t.Device="device",t}(Oe||{});function Ae(t,e){try{new URL(t)}catch(t){return{valid:!1,errors:["Failed to parse Bridge URL."]}}var n=new URL(t),r=[];return e&&["localhost","127.0.0.1"].includes(n.hostname)?(console.log("Using staging app_id with localhost bridge_url. Skipping validation."),{valid:!0}):("https:"!==n.protocol&&r.push("Bridge URL must use HTTPS."),n.port&&r.push("Bridge URL must use the default port (443)."),"/"!==n.pathname&&r.push("Bridge URL must not have a path."),n.search&&r.push("Bridge URL must not have query parameters."),n.hash&&r.push("Bridge URL must not have a fragment."),n.hostname.endsWith(".worldcoin.org")||n.hostname.endsWith(".toolsforhumanity.com")||console.warn("Bridge URL should be a subdomain of worldcoin.org or toolsforhumanity.com. The user's identity wallet may refuse to connect. This is a temporary measure and may be removed in the future."),r.length?{valid:!1,errors:r}:{valid:!0})}var xe,Se,Ie=function(t){return S.Buffer.from(t).toString("base64")},Be=function(t){return S.Buffer.from(t,"base64")},Le=function(t){switch(t){case"device":return["orb","device"];case"orb":return["orb"];default:throw new Error("Unknown verification level: ".concat(t))}},Te=function(t){switch(t){case"orb":return"orb";case"device":return"device";default:throw new Error("Unknown credential_type: ".concat(t))}},ke=new TextEncoder,Ue=new TextDecoder,Me=function(){var t=r(v().mark((function t(){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=window.crypto.getRandomValues(new Uint8Array(12)),t.next=3,window.crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);case 3:return t.t1=t.sent,t.abrupt("return",{iv:t.t0,key:t.t1});case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),Re=function(){var t=r(v().mark((function t(e){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=Ie,t.next=3,window.crypto.subtle.exportKey("raw",e);case 3:return t.t1=t.sent,t.abrupt("return",(0,t.t0)(t.t1));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Pe=function(){var t=r(v().mark((function t(e,n,r){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=Ie(n),t.t1=Ie,t.next=4,window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,ke.encode(r));case 4:return t.t2=t.sent,t.t3=(0,t.t1)(t.t2),t.abrupt("return",{iv:t.t0,payload:t.t3});case 7:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),je=function(){var t=r(v().mark((function t(e,n,r){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=Ue,t.next=3,window.crypto.subtle.decrypt({name:"AES-GCM",iv:n},e,Be(r));case 3:return t.t1=t.sent,t.abrupt("return",t.t0.decode.call(t.t0,t.t1));case 5:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),Ce="https://bridge.worldcoin.org";xe=function(t,e){return{iv:null,key:null,result:null,errorCode:null,requestId:null,connectorURI:null,bridge_url:Ce,verificationState:"loading_widget",createClient:(o=r(v().mark((function e(n){var r,o,i,a,u,s,c,f,l,p,h,d,y;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.bridge_url,o=n.app_id,i=n.verification_level,a=n.action_description,u=n.action,s=n.signal,e.next=3,Me();case 3:if(c=e.sent,f=c.key,l=c.iv,!r){e.next=12;break}if((p=Ae(r,o.includes("staging"))).valid){e.next=12;break}throw console.error(p.errors.join("\n")),t({verificationState:"failed"}),new Error("Invalid bridge_url. Please check the console for more details.");case 12:return e.t0=fetch,e.t1=new URL("/request",null!=r?r:Ce),e.t2={"Content-Type":"application/json"},e.t3=JSON,e.next=18,Pe(f,l,JSON.stringify({app_id:o,action_description:a,action:ae(u),signal:ie(s).digest,credential_types:Le(null!=i?i:"orb"),verification_level:null!=i?i:"orb"}));case 18:return e.t4=e.sent,e.t5=e.t3.stringify.call(e.t3,e.t4),e.t6={method:"POST",headers:e.t2,body:e.t5},e.next=23,(0,e.t0)(e.t1,e.t6);case 23:if((h=e.sent).ok){e.next=27;break}throw t({verificationState:"failed"}),new Error("Failed to create client");case 27:return e.next=29,h.json();case 29:return d=e.sent,y=d.request_id,e.t7=t,e.t8=l,e.t9=f,e.t10=y,e.t11=null!=r?r:Ce,e.t12="https://worldcoin.org/verify?t=wld&i=".concat(y,"&k="),e.t13=encodeURIComponent,e.next=40,Re(f);case 40:e.t14=e.sent,e.t15=(0,e.t13)(e.t14),e.t16=e.t12.concat.call(e.t12,e.t15).concat(r&&r!==Ce?"&b=".concat(encodeURIComponent(r)):""),e.t17={iv:e.t8,key:e.t9,requestId:e.t10,bridge_url:e.t11,verificationState:"awaiting_connection",connectorURI:e.t16},(0,e.t7)(e.t17);case 45:case"end":return e.stop()}}),e)}))),function(t){return o.apply(this,arguments)}),pollForUpdates:(n=r(v().mark((function n(){var r,o,i,a,u,s;return v().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=e().key){n.next=3;break}throw new Error("No keypair found. Please call `createClient` first.");case 3:return n.next=5,fetch(new URL("/response/".concat(e().requestId),e().bridge_url));case 5:if((o=n.sent).ok){n.next=8;break}return n.abrupt("return",t({errorCode:"connection_failed",verificationState:"failed"}));case 8:return n.next=10,o.json();case 10:if(i=n.sent,a=i.response,"completed"==(u=i.status)){n.next=15;break}return n.abrupt("return",t({verificationState:"retrieved"==u?"awaiting_app":"awaiting_connection"}));case 15:return n.t0=JSON,n.next=18,je(r,Be(a.iv),a.payload);case 18:if(n.t1=n.sent,!("error_code"in(s=n.t0.parse.call(n.t0,n.t1)))){n.next=22;break}return n.abrupt("return",t({errorCode:s.error_code,verificationState:"failed"}));case 22:"credential_type"in s&&(s=d({verification_level:Te(s.credential_type)},s)),t({result:s,key:null,requestId:null,connectorURI:null,verificationState:"confirmed"});case 24:case"end":return n.stop()}}),n)}))),function(){return n.apply(this,arguments)}),reset:function(){t({iv:null,key:null,result:null,errorCode:null,requestId:null,connectorURI:null,verificationState:"loading_widget"})}};var n,o},xe&&Ee(xe);var ze=function(t){var e,n;if(window.webkit)null===(e=window.webkit)||void 0===e||null===(e=e.messageHandlers)||void 0===e||null===(e=e.minikit)||void 0===e||null===(n=e.postMessage)||void 0===n||n.call(e,t);else if(window.Android){var r,o;null===(r=(o=window.Android).postMessage)||void 0===r||r.call(o,JSON.stringify(t))}},De=function(t){return t.MiniAppVerifyAction="miniapp-verify-action",t.MiniAppPayment="miniapp-payment",t.MiniAppWalletAuth="miniapp-wallet-auth",t.MiniAppSendTransaction="miniapp-send-transaction",t.MiniAppSignMessage="miniapp-sign-message",t.MiniAppSignTypedData="miniapp-sign-typed-data",t}(De||{});s(s({},"USDCE",6),"WLD",18),s(s(s(s(s(s(s(s(s(s(Se={},_e.VerificationRejected,"You’ve cancelled the request in World App."),_e.MaxVerificationsReached,"You have already verified the maximum number of times for this action."),_e.CredentialUnavailable,"It seems you do not have the verification level required by this app."),_e.MalformedRequest,"There was a problem with this request. Please try again or contact the app owner."),_e.InvalidNetwork,"Invalid network. If you are the app owner, visit docs.worldcoin.org/test for details."),_e.InclusionProofFailed,"There was an issue fetching your credential. Please try again."),_e.InclusionProofPending,"Your identity is still being registered. Please wait a few minutes and try again."),_e.UnexpectedResponse,"Unexpected response from your wallet. Please try again."),_e.FailedByHostApp,"Verification failed by the app. Please contact the app owner for details."),_e.GenericError,"Something unexpected went wrong. Please try again."),s(Se,_e.ConnectionFailed,"Connection to your wallet failed. Please try again."),s(s(s(s(s(s(s({},"input_error","There was a problem with this request. Please try again or contact the app owner."),"payment_rejected","You’ve cancelled the payment in World App."),"invalid_receiver","The receiver address is invalid. Please contact the app owner."),"insufficient_balance","You do not have enough balance to complete this transaction."),"transaction_failed","The transaction failed. Please try again."),"generic_error","Something unexpected went wrong. Please try again."),"user_blocked","User's region is blocked from making payments."),s(s(s({},"malformed_request","Provided parameters in the request are invalid."),"user_rejected","User rejected the request."),"generic_error","Something unexpected went wrong."),s(s(s(s(s(s(s(s(s({},"invalid_operation","Transaction included an operation that was invalid"),"user_rejected","User rejected the request."),"input_error","Invalid payload."),"simulation_failed","The transaction simulation failed."),"transaction_failed","The transaction failed. Please try again later."),"generic_error","Something unexpected went wrong. Please try again."),"disallowed_operation","The operation requested is not allowed. Please refer to the docs."),"invalid_contract","The contract address is not allowed for your application. Please check your developer portal configurations"),"malicious_operation","The operation requested is considered malicious."),s(s(s({},"invalid_message","Invalid message requested"),"user_rejected","User rejected the request."),"generic_error","Something unexpected went wrong.");var Ne,Fe,Ve,qe,Ge,Ke,We=s(s(s(s(s({},"unknown","Failed to install MiniKit."),"already_installed","MiniKit is already installed."),"outside_of_worldapp","MiniApp launched outside of WorldApp."),"not_on_client","Window object is not available."),"app_out_of_date","WorldApp is out of date. Please update the app."),Ye=function(){var t=r(v().mark((function t(e){var n,r,o;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("https://usernames.worldcoin.org/api/v1/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({addresses:[e]})});case 2:return r=t.sent,t.next=5,r.json();case 5:return o=t.sent,t.abrupt("return",null!==(n=o[0])&&void 0!==n?n:{username:null,profilePictureUrl:null});case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),He=function(t){ze(t)},Xe=function(){function t(){i(this,t)}return u(t,null,[{key:"sendInit",value:function(){ze({command:"init",payload:{version:this.MINIKIT_VERSION}})}},{key:"subscribe",value:function(e,n){if("miniapp-wallet-auth"===e){var r=n;this.listeners[e]=function(e){"success"===e.status&&(t.walletAddress=e.address,Ye(e.address).then((function(n){t.user={username:n.username,profilePictureUrl:n.profilePictureUrl,walletAddress:e.address}}))),r(e)}}else this.listeners[e]=n}},{key:"unsubscribe",value:function(t){delete this.listeners[t]}},{key:"trigger",value:function(t,e){this.listeners[t]?this.listeners[t](e):console.error("No handler for event ".concat(t))}},{key:"awaitCommand",value:(e=r(v().mark((function t(e,n,r){var o=this;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){var n=null;o.subscribe(e,(function(r){o.unsubscribe(e),t({commandPayload:n,finalPayload:r})})),n=r()})));case 1:case"end":return t.stop()}}),t)}))),function(t,n,r){return e.apply(this,arguments)})},{key:"commandsValid",value:function(e){return Object.entries(this.commandVersion).every((function(n){var r=g(n,2),o=r[0],i=r[1],a=e.find((function(t){return t.name===o}));return a?t.isCommandAvailable[o]=!0:console.error("Command ".concat(o," is not supported by the app. Try updating the app version")),!!a&&a.supported_versions.includes(i)}))}},{key:"install",value:function(e){if("undefined"==typeof window||Boolean(window.MiniKit))return{success:!1,errorCode:"already_installed",errorMessage:We.already_installed};if(e?t.appId=e:console.warn("App ID not provided during install"),!window.WorldApp)return{success:!1,errorCode:"outside_of_worldapp",errorMessage:We.outside_of_worldapp};try{window.MiniKit=t,this.sendInit()}catch(t){return console.error(We.unknown,t),{success:!1,errorCode:"unknown",errorMessage:We.unknown}}return this.commandsValid(window.WorldApp.supported_commands)?{success:!0}:{success:!1,errorCode:"app_out_of_date",errorMessage:We.app_out_of_date}}},{key:"isInstalled",value:function(t){t&&console.log("MiniKit is alive!");var e=Boolean(window.MiniKit);return e||console.error("MiniKit is not installed. Make sure you're running the application inside of World App"),e}}]);var e}();Xe.MINIKIT_VERSION=1,Xe.commandVersion=s(s(s(s(s(s({},"verify",1),"pay",1),"wallet-auth",1),"send-transaction",1),"sign-message",1),"sign-typed-data",1),Xe.isCommandAvailable=s(s(s(s(s(s({},"verify",!1),"pay",!1),"wallet-auth",!1),"send-transaction",!1),"sign-message",!1),"sign-typed-data",!1),Xe.listeners=s(s(s(s(s(s({},"miniapp-verify-action",(function(){})),"miniapp-payment",(function(){})),"miniapp-wallet-auth",(function(){})),"miniapp-send-transaction",(function(){})),"miniapp-sign-message",(function(){})),"miniapp-sign-typed-data",(function(){})),Xe.appId=null,Xe.walletAddress=null,Xe.user=null,Xe.commands={verify:function(t){if("undefined"==typeof window||!Xe.isCommandAvailable.verify)return console.error("'verify' command is unavailable. Check MiniKit.install() or update the app version"),null;var e=(new Date).toISOString(),n={action:ae(t.action),signal:ie(t.signal).digest,verification_level:t.verification_level||Oe.Orb,timestamp:e};return He({command:"verify",version:Xe.commandVersion.verify,payload:n}),n},pay:function(t){if("undefined"==typeof window||!Xe.isCommandAvailable.pay)return console.error("'pay' command is unavailable. Check MiniKit.install() or update the app version"),null;if(!function(t){return t.tokens.some((function(t){return"USDCE"==t.symbol&&parseFloat(t.token_amount)<.1}))?(console.error("USDCE amount should be greater than $0.1"),!1):!(t.reference.length>36&&(console.error("Reference must not exceed 36 characters"),1))}(t))return null;var e=d(d({},t),{},{network:"worldchain"});return He({command:"pay",version:Xe.commandVersion.pay,payload:e}),e},walletAuth:function(t){var e,n,r,o,i,a;if("undefined"==typeof window||!Xe.isCommandAvailable["wallet-auth"])return console.error("'walletAuth' command is unavailable. Check MiniKit.install() or update the app version"),null;var u,s=(u=t).nonce?u.nonce.length<8?{valid:!1,message:"'nonce' must be at least 8 characters"}:u.statement&&u.statement.includes("\n")?{valid:!1,message:"'statement' must not contain newlines"}:u.expirationTime&&new Date(u.expirationTime)<new Date?{valid:!1,message:"'expirationTime' must be in the future"}:u.expirationTime&&new Date(u.expirationTime)>new Date(Date.now()+6048e5)?{valid:!1,message:"'expirationTime' must be within 7 days"}:u.notBefore&&new Date(u.notBefore)>new Date(Date.now()+6048e5)?{valid:!1,message:"'notBefore' must be within 7 days"}:{valid:!0}:{valid:!1,message:"'nonce' is required"};if(!s.valid)return console.error("Failed to validate wallet auth input:\n\n --\x3e",s.message),null;var c=null;try{c=new URL(window.location.href).protocol.split(":")[0]}catch(t){return console.error("Failed to get current URL",t),null}var f={siweMessage:function(t){var e="";return t.scheme?e+="".concat(t.scheme,"://").concat(t.domain," wants you to sign in with your Ethereum account:\n"):e+="".concat(t.domain," wants you to sign in with your Ethereum account:\n"),t.address?e+="".concat(t.address,"\n"):e+="{address}\n",e+="\n",t.statement&&(e+="".concat(t.statement,"\n")),e+="\n",e+="URI: ".concat(t.uri,"\n"),e+="Version: ".concat(t.version,"\n"),e+="Chain ID: ".concat(t.chain_id,"\n"),e+="Nonce: ".concat(t.nonce,"\n"),e+="Issued At: ".concat(t.issued_at,"\n"),t.expiration_time&&(e+="Expiration Time: ".concat(t.expiration_time,"\n")),t.not_before&&(e+="Not Before: ".concat(t.not_before,"\n")),t.request_id&&(e+="Request ID: ".concat(t.request_id,"\n")),e}({scheme:c,domain:window.location.host,statement:null!==(e=t.statement)&&void 0!==e?e:void 0,uri:window.location.href,version:1,chain_id:10,nonce:t.nonce,issued_at:(new Date).toISOString(),expiration_time:null!==(n=null===(r=t.expirationTime)||void 0===r?void 0:r.toISOString())&&void 0!==n?n:void 0,not_before:null!==(o=null===(i=t.notBefore)||void 0===i?void 0:i.toISOString())&&void 0!==o?o:void 0,request_id:null!==(a=t.requestId)&&void 0!==a?a:void 0})};return He({command:"wallet-auth",version:Xe.commandVersion["wallet-auth"],payload:f}),f},sendTransaction:function(t){return"undefined"!=typeof window&&Xe.isCommandAvailable["send-transaction"]?(He({command:"send-transaction",version:1,payload:t}),t):(console.error("'sendTransaction' command is unavailable. Check MiniKit.install() or update the app version"),null)},signMessage:function(t){return"undefined"!=typeof window&&Xe.isCommandAvailable["sign-message"]?(He({command:"sign-message",version:1,payload:t}),t):(console.error("'signMessage' command is unavailable. Check MiniKit.install() or update the app version"),null)},signTypedData:function(t){return"undefined"!=typeof window&&Xe.isCommandAvailable["sign-typed-data"]?(He({command:"sign-typed-data",version:1,payload:t}),t):(console.error("'signTypedData' command is unavailable. Check MiniKit.install() or update the app version"),null)}},Xe.commandsAsync={verify:(Ke=r(v().mark((function t(e){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(){var t=r(v().mark((function t(n,r){var o;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Xe.awaitCommand("miniapp-verify-action","verify",(function(){return Xe.commands.verify(e)}));case 3:o=t.sent,n(o),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),r(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}()));case 1:case"end":return t.stop()}}),t)}))),function(t){return Ke.apply(this,arguments)}),pay:(Ge=r(v().mark((function t(e){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(){var t=r(v().mark((function t(n,r){var o;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Xe.awaitCommand("miniapp-payment","pay",(function(){return Xe.commands.pay(e)}));case 3:o=t.sent,n(o),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),r(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}()));case 1:case"end":return t.stop()}}),t)}))),function(t){return Ge.apply(this,arguments)}),walletAuth:(qe=r(v().mark((function t(e){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(){var t=r(v().mark((function t(n,r){var o;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Xe.awaitCommand("miniapp-wallet-auth","wallet-auth",(function(){return Xe.commands.walletAuth(e)}));case 3:return o=t.sent,t.abrupt("return",n(o));case 7:t.prev=7,t.t0=t.catch(0),r(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}()));case 1:case"end":return t.stop()}}),t)}))),function(t){return qe.apply(this,arguments)}),sendTransaction:(Ve=r(v().mark((function t(e){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(){var t=r(v().mark((function t(n,r){var o;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Xe.awaitCommand("miniapp-send-transaction","send-transaction",(function(){return Xe.commands.sendTransaction(e)}));case 3:return o=t.sent,t.abrupt("return",n(o));case 7:t.prev=7,t.t0=t.catch(0),r(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}()));case 1:case"end":return t.stop()}}),t)}))),function(t){return Ve.apply(this,arguments)}),signMessage:(Fe=r(v().mark((function t(e){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(){var t=r(v().mark((function t(n,r){var o;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Xe.awaitCommand("miniapp-sign-message","sign-message",(function(){return Xe.commands.signMessage(e)}));case 3:return o=t.sent,t.abrupt("return",n(o));case 7:t.prev=7,t.t0=t.catch(0),r(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}()));case 1:case"end":return t.stop()}}),t)}))),function(t){return Fe.apply(this,arguments)}),signTypedData:(Ne=r(v().mark((function t(e){return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(){var t=r(v().mark((function t(n,r){var o;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Xe.awaitCommand("miniapp-sign-typed-data","sign-typed-data",(function(){return Xe.commands.signTypedData(e)}));case 3:return o=t.sent,t.abrupt("return",n(o));case 7:t.prev=7,t.t0=t.catch(0),r(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}()));case 1:case"end":return t.stop()}}),t)}))),function(t){return Ne.apply(this,arguments)})};var $e=Xe;t.MiniKit=$e,t.ResponseEvent=De,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=/sm/b0e9e60cb0bceb2f85b96d5f96a288dfd94a7cb19c3d942e9d1a95ea0171edac.map