@imtbl/sdk 0.4.1-alpha → 0.4.1-alpha.1

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.
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).immutable={})}(this,(function(e){"use strict";e.Environment=void 0,function(e){e.PRODUCTION="production",e.SANDBOX="sandbox"}(e.Environment||(e.Environment={}));class t{environment;apiKey;constructor(e){this.environment=e.environment,this.apiKey=e.apiKey}}function r(e,t){return function(){return e.apply(t,arguments)}}const{toString:n}=Object.prototype,{getPrototypeOf:i}=Object,a=(o=Object.create(null),e=>{const t=n.call(e);return o[t]||(o[t]=t.slice(8,-1).toLowerCase())});var o;const s=e=>(e=e.toLowerCase(),t=>a(t)===e),f=e=>t=>typeof t===e,{isArray:u}=Array,c=f("undefined");const d=s("ArrayBuffer");const l=f("string"),p=f("function"),h=f("number"),m=e=>null!==e&&"object"==typeof e,b=e=>{if("object"!==a(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},y=s("Date"),g=s("File"),v=s("Blob"),w=s("FileList"),_=s("URLSearchParams");function E(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),u(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function T(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,S=e=>!c(e)&&e!==A;const k=(O="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>O&&e instanceof O);var O;const R=s("HTMLFormElement"),x=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),I=s("RegExp"),C=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};E(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},N="abcdefghijklmnopqrstuvwxyz",P="0123456789",M={DIGIT:P,ALPHA:N,ALPHA_DIGIT:N+N.toUpperCase()+P};const B=s("AsyncFunction");var D={isArray:u,isArrayBuffer:d,isBuffer:function(e){return null!==e&&!c(e)&&null!==e.constructor&&!c(e.constructor)&&p(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||p(e.append)&&("formdata"===(t=a(e))||"object"===t&&p(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&d(e.buffer),t},isString:l,isNumber:h,isBoolean:e=>!0===e||!1===e,isObject:m,isPlainObject:b,isUndefined:c,isDate:y,isFile:g,isBlob:v,isRegExp:I,isFunction:p,isStream:e=>m(e)&&p(e.pipe),isURLSearchParams:_,isTypedArray:k,isFileList:w,forEach:E,merge:function e(){const{caseless:t}=S(this)&&this||{},r={},n=(n,i)=>{const a=t&&T(r,i)||i;b(r[a])&&b(n)?r[a]=e(r[a],n):b(n)?r[a]=e({},n):u(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&E(arguments[e],n);return r},extend:(e,t,n,{allOwnKeys:i}={})=>(E(t,((t,i)=>{n&&p(t)?e[i]=r(t,n):e[i]=t}),{allOwnKeys:i}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let a,o,s;const f={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)s=a[o],n&&!n(s,e,t)||f[s]||(t[s]=e[s],f[s]=!0);e=!1!==r&&i(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:a,kindOfTest:s,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(u(e))return e;let t=e.length;if(!h(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:R,hasOwnProperty:x,hasOwnProp:x,reduceDescriptors:C,freezeMethods:e=>{C(e,((t,r)=>{if(p(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];p(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return u(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:T,global:A,isContextDefined:S,ALPHABET:M,generateString:(e=16,t=M.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&p(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(m(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=u(e)?[]:{};return E(e,((e,t)=>{const a=r(e,n+1);!c(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:B,isThenable:e=>e&&(m(e)||p(e))&&p(e.then)&&p(e.catch)};function F(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}D.inherits(F,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:D.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const L=F.prototype,U={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{U[e]={value:e}})),Object.defineProperties(F,U),Object.defineProperty(L,"isAxiosError",{value:!0}),F.from=(e,t,r,n,i,a)=>{const o=Object.create(L);return D.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),F.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function j(e){return D.isPlainObject(e)||D.isArray(e)}function q(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function z(e,t,r){return e?e.concat(t).map((function(e,t){return e=q(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const H=D.toFlatObject(D,{},null,(function(e){return/^is[A-Z]/.test(e)}));function V(e,t,r){if(!D.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=D.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!D.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&D.isSpecCompliantForm(t);if(!D.isFunction(i))throw new TypeError("visitor must be a function");function f(e){if(null===e)return"";if(D.isDate(e))return e.toISOString();if(!s&&D.isBlob(e))throw new F("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(e)||D.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(D.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(D.isArray(e)&&function(e){return D.isArray(e)&&!e.some(j)}(e)||(D.isFileList(e)||D.endsWith(r,"[]"))&&(s=D.toArray(e)))return r=q(r),s.forEach((function(e,n){!D.isUndefined(e)&&null!==e&&t.append(!0===o?z([r],n,a):null===o?r:r+"[]",f(e))})),!1;return!!j(e)||(t.append(z(i,r,a),f(e)),!1)}const c=[],d=Object.assign(H,{defaultVisitor:u,convertValue:f,isVisitable:j});if(!D.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!D.isUndefined(r)){if(-1!==c.indexOf(r))throw Error("Circular reference detected in "+n.join("."));c.push(r),D.forEach(r,(function(r,a){!0===(!(D.isUndefined(r)||null===r)&&i.call(t,r,D.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),c.pop()}}(e),t}function G(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function K(e,t){this._pairs=[],e&&V(e,this,t)}const W=K.prototype;function X(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $(e,t,r){if(!t)return e;const n=r&&r.encode||X,i=r&&r.serialize;let a;if(a=i?i(t,r):D.isURLSearchParams(t)?t.toString():new K(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}W.append=function(e,t){this._pairs.push([e,t])},W.toString=function(e){const t=e?function(t){return e.call(this,t,G)}:G;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var J=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){D.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Y={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Q={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:K,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function Z(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&D.isArray(n)?n.length:a,s)return D.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&D.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&D.isArray(n[a])&&(n[a]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}(n[a])),!o}if(D.isFormData(e)&&D.isFunction(e.entries)){const r={};return D.forEachEntry(e,((e,n)=>{t(function(e){return D.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const ee={"Content-Type":void 0};const te={transitional:Y,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=D.isObject(e);i&&D.isHTMLForm(e)&&(e=new FormData(e));if(D.isFormData(e))return n&&n?JSON.stringify(Z(e)):e;if(D.isArrayBuffer(e)||D.isBuffer(e)||D.isStream(e)||D.isFile(e)||D.isBlob(e))return e;if(D.isArrayBufferView(e))return e.buffer;if(D.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return V(e,new Q.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Q.isNode&&D.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=D.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return V(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(D.isString(e))try{return(t||JSON.parse)(e),D.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||te.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&D.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw F.from(e,F.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Q.classes.FormData,Blob:Q.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};D.forEach(["delete","get","head"],(function(e){te.headers[e]={}})),D.forEach(["post","put","patch"],(function(e){te.headers[e]=D.merge(ee)}));var re=te;const ne=D.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const ie=Symbol("internals");function ae(e){return e&&String(e).trim().toLowerCase()}function oe(e){return!1===e||null==e?e:D.isArray(e)?e.map(oe):String(e)}function se(e,t,r,n,i){return D.isFunction(n)?n.call(this,t,r):(i&&(t=r),D.isString(t)?D.isString(n)?-1!==t.indexOf(n):D.isRegExp(n)?n.test(t):void 0:void 0)}let fe=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=ae(t);if(!i)throw new Error("header name must be a non-empty string");const a=D.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=oe(e))}const a=(e,t)=>D.forEach(e,((e,r)=>i(e,r,t)));return D.isPlainObject(e)||e instanceof this.constructor?a(e,t):D.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?a((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&ne[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=ae(e)){const r=D.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(D.isFunction(t))return t.call(this,e,r);if(D.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ae(e)){const r=D.findKey(this,e);return!(!r||void 0===this[r]||t&&!se(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=ae(e)){const i=D.findKey(r,e);!i||t&&!se(0,r[i],i,t)||(delete r[i],n=!0)}}return D.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!se(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return D.forEach(this,((n,i)=>{const a=D.findKey(r,i);if(a)return t[a]=oe(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=oe(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return D.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&D.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[ie]=this[ie]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=ae(e);t[n]||(!function(e,t){const r=D.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return D.isArray(e)?e.forEach(n):n(e),this}};fe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),D.freezeMethods(fe.prototype),D.freezeMethods(fe);var ue=fe;function ce(e,t){const r=this||re,n=t||r,i=ue.from(n.headers);let a=n.data;return D.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function de(e){return!(!e||!e.__CANCEL__)}function le(e,t,r){F.call(this,null==e?"canceled":e,F.ERR_CANCELED,t,r),this.name="CanceledError"}D.inherits(le,F,{__CANCEL__:!0});var pe=Q.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),D.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),D.isString(n)&&o.push("path="+n),D.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function he(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var me=Q.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=D.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function be(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,o=0;return t=void 0!==t?t:1e3,function(s){const f=Date.now(),u=n[o];i||(i=f),r[a]=s,n[a]=f;let c=o,d=0;for(;c!==a;)d+=r[c++],c%=e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),f-i<t)return;const l=u&&f-u;return l?Math.round(1e3*d/l):void 0}}(50,250);return i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,s=a-r,f=n(s);r=a;const u={loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:f||void 0,estimated:f&&o&&a<=o?(o-a)/f:void 0,event:i};u[t?"download":"upload"]=!0,e(u)}}var ye="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=ue.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}D.isFormData(n)&&(Q.isStandardBrowserEnv||Q.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let f=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const u=he(e.baseURL,e.url);function c(){if(!f)return;const n=ue.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new F("Request failed with status code "+r.status,[F.ERR_BAD_REQUEST,F.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),s()}),(function(e){r(e),s()}),{data:a&&"text"!==a&&"json"!==a?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:n,config:e,request:f}),f=null}if(f.open(e.method.toUpperCase(),$(u,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,"onloadend"in f?f.onloadend=c:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(c)},f.onabort=function(){f&&(r(new F("Request aborted",F.ECONNABORTED,e,f)),f=null)},f.onerror=function(){r(new F("Network Error",F.ERR_NETWORK,e,f)),f=null},f.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Y;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new F(t,n.clarifyTimeoutError?F.ETIMEDOUT:F.ECONNABORTED,e,f)),f=null},Q.isStandardBrowserEnv){const t=(e.withCredentials||me(u))&&e.xsrfCookieName&&pe.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in f&&D.forEach(i.toJSON(),(function(e,t){f.setRequestHeader(t,e)})),D.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&"json"!==a&&(f.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",be(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",be(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{f&&(r(!t||t.type?new le(null,e,f):t),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===Q.protocols.indexOf(d)?r(new F("Unsupported protocol "+d+":",F.ERR_BAD_REQUEST,e)):f.send(n||null)}))};const ge={http:null,xhr:ye};D.forEach(ge,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var ve=e=>{e=D.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=D.isString(r)?ge[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new F(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(D.hasOwnProp(ge,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!D.isFunction(n))throw new TypeError("adapter is not a function");return n};function we(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new le(null,e)}function _e(e){we(e),e.headers=ue.from(e.headers),e.data=ce.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ve(e.adapter||re.adapter)(e).then((function(t){return we(e),t.data=ce.call(e,e.transformResponse,t),t.headers=ue.from(t.headers),t}),(function(t){return de(t)||(we(e),t&&t.response&&(t.response.data=ce.call(e,e.transformResponse,t.response),t.response.headers=ue.from(t.response.headers))),Promise.reject(t)}))}const Ee=e=>e instanceof ue?e.toJSON():e;function Te(e,t){t=t||{};const r={};function n(e,t,r){return D.isPlainObject(e)&&D.isPlainObject(t)?D.merge.call({caseless:r},e,t):D.isPlainObject(t)?D.merge({},t):D.isArray(t)?t.slice():t}function i(e,t,r){return D.isUndefined(t)?D.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!D.isUndefined(t))return n(void 0,t)}function o(e,t){return D.isUndefined(t)?D.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,a){return a in t?n(r,i):a in e?n(void 0,r):void 0}const f={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(e,t)=>i(Ee(e),Ee(t),!0)};return D.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=f[n]||i,o=a(e[n],t[n],n);D.isUndefined(o)&&a!==s||(r[n]=o)})),r}const Ae="1.4.0",Se={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Se[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const ke={};Se.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,a)=>{if(!1===e)throw new F(n(i," has been removed"+(t?" in "+t:"")),F.ERR_DEPRECATED);return t&&!ke[i]&&(ke[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}};var Oe={assertOptions:function(e,t,r){if("object"!=typeof e)throw new F("options must be an object",F.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],o=t[a];if(o){const t=e[a],r=void 0===t||o(t,a,e);if(!0!==r)throw new F("option "+a+" must be "+r,F.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new F("Unknown option "+a,F.ERR_BAD_OPTION)}},validators:Se};const Re=Oe.validators;let xe=class{constructor(e){this.defaults=e,this.interceptors={request:new J,response:new J}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Te(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&Oe.assertOptions(r,{silentJSONParsing:Re.transitional(Re.boolean),forcedJSONParsing:Re.transitional(Re.boolean),clarifyTimeoutError:Re.transitional(Re.boolean)},!1),null!=n&&(D.isFunction(n)?t.paramsSerializer={serialize:n}:Oe.assertOptions(n,{encode:Re.function,serialize:Re.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&D.merge(i.common,i[t.method]),a&&D.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=ue.concat(a,i);const o=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const f=[];let u;this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)}));let c,d=0;if(!s){const e=[_e.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,f),c=e.length,u=Promise.resolve(t);d<c;)u=u.then(e[d++],e[d++]);return u}c=o.length;let l=t;for(d=0;d<c;){const e=o[d++],t=o[d++];try{l=e(l)}catch(e){t.call(this,e);break}}try{u=_e.call(this,l)}catch(e){return Promise.reject(e)}for(d=0,c=f.length;d<c;)u=u.then(f[d++],f[d++]);return u}getUri(e){return $(he((e=Te(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};D.forEach(["delete","get","head","options"],(function(e){xe.prototype[e]=function(t,r){return this.request(Te(r||{},{method:e,url:t,data:(r||{}).data}))}})),D.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(Te(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}xe.prototype[e]=t(),xe.prototype[e+"Form"]=t(!0)}));var Ie=xe;var Ce=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new le(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let t;const r=new e((function(e){t=e}));return{token:r,cancel:t}}};const Ne={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ne).forEach((([e,t])=>{Ne[t]=e}));var Pe=Ne;const Me=function e(t){const n=new Ie(t),i=r(Ie.prototype.request,n);return D.extend(i,Ie.prototype,n,{allOwnKeys:!0}),D.extend(i,n,null,{allOwnKeys:!0}),i.create=function(r){return e(Te(t,r))},i}(re);Me.Axios=Ie,Me.CanceledError=le,Me.CancelToken=Ce,Me.isCancel=de,Me.VERSION=Ae,Me.toFormData=V,Me.AxiosError=F,Me.Cancel=Me.CanceledError,Me.all=function(e){return Promise.all(e)},Me.spread=function(e){return function(t){return e.apply(null,t)}},Me.isAxiosError=function(e){return D.isObject(e)&&!0===e.isAxiosError},Me.mergeConfig=Te,Me.AxiosHeaders=ue,Me.formToJSON=e=>Z(D.isHTMLForm(e)?new FormData(e):e),Me.HttpStatusCode=Pe,Me.default=Me;var Be=Me;const De="https://indexer-mr.sandbox.imtbl.com".replace(/\/+$/,"");let Fe=class{basePath;axios;configuration;constructor(e,t=De,r=Be){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}},Le=class extends Error{field;name="RequiredError";constructor(e,t){super(t),this.field=e}};const Ue="https://example.com",je=function(e,t,r){if(null==r)throw new Le(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function qe(e,t,r=""){"object"==typeof t?Array.isArray(t)?t.forEach((t=>qe(e,t,r))):Object.keys(t).forEach((n=>qe(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t)}const ze=function(e,...t){const r=new URLSearchParams(e.search);qe(r,t),e.search=r.toString()},He=function(e,t,r){const n="string"!=typeof e;return(n&&r&&r.isJsonMime?r.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},Ve=function(e){return e.pathname+e.search+e.hash},Ge=function(e,t,r,n){return(i=t,a=r)=>{const o={...e.options,url:(n?.basePath||a)+e.url};return i.request(o)}},Ke=function(e){return{getActivity:async(t,r,n={})=>{je("getActivity","chainName",t),je("getActivity","activityId",r);const i="/v1/chains/{chain_name}/activities/{activity_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{activity_id}",encodeURIComponent(String(r))),a=new URL(i,Ue);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};ze(a,{});let f=o&&o.headers?o.headers:{};return s.headers={...f,...n.headers},{url:Ve(a),options:s}},listActivities:async(t,r,n,i,a,o,s,f,u,c,d={})=>{je("listActivities","chainName",t);const l="/v1/chains/{chain_name}/activities".replace("{chain_name}",encodeURIComponent(String(t))),p=new URL(l,Ue);let h;e&&(h=e.baseOptions);const m={method:"GET",...h,...d},b={};void 0!==r&&(b.contract_address=r),void 0!==n&&(b.token_id=n),void 0!==i&&(b.account_address=i),void 0!==a&&(b.activity_type=a),void 0!==o&&(b.from_indexed_at=o instanceof Date?o.toISOString():o),void 0!==s&&(b.to_indexed_at=s instanceof Date?s.toISOString():s),void 0!==f&&(b.transaction_hash=f),void 0!==u&&(b.page_cursor=u),void 0!==c&&(b.page_size=c),ze(p,b);let y=h&&h.headers?h.headers:{};return m.headers={...y,...d.headers},{url:Ve(p),options:m}}}},We=function(e){const t=Ke(e);return{async getActivity(r,n,i){const a=await t.getActivity(r,n,i);return Ge(a,Be,De,e)},async listActivities(r,n,i,a,o,s,f,u,c,d,l){const p=await t.listActivities(r,n,i,a,o,s,f,u,c,d,l);return Ge(p,Be,De,e)}}};class Xe extends Fe{getActivity(e,t){return We(this.configuration).getActivity(e.chainName,e.activityId,t).then((e=>e(this.axios,this.basePath)))}listActivities(e,t){return We(this.configuration).listActivities(e.chainName,e.contractAddress,e.tokenId,e.accountAddress,e.activityType,e.fromIndexedAt,e.toIndexedAt,e.transactionHash,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const $e=function(e){return{listChains:async(t,r,n={})=>{const i=new URL("/v1/chains",Ue);let a;e&&(a=e.baseOptions);const o={method:"GET",...a,...n},s={};void 0!==t&&(s.page_cursor=t),void 0!==r&&(s.page_size=r),ze(i,s);let f=a&&a.headers?a.headers:{};return o.headers={...f,...n.headers},{url:Ve(i),options:o}}}},Je=function(e){const t=$e(e);return{async listChains(r,n,i){const a=await t.listChains(r,n,i);return Ge(a,Be,De,e)}}};class Ye extends Fe{listChains(e={},t){return Je(this.configuration).listChains(e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const Qe=function(e){return{getCollection:async(t,r,n={})=>{je("getCollection","contractAddress",t),je("getCollection","chainName",r);const i="/v1/chains/{chain_name}/collections/{contract_address}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),a=new URL(i,Ue);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};ze(a,{});let f=o&&o.headers?o.headers:{};return s.headers={...f,...n.headers},{url:Ve(a),options:s}},listCollections:async(t,r,n,i={})=>{je("listCollections","chainName",t);const a="/v1/chains/{chain_name}/collections".replace("{chain_name}",encodeURIComponent(String(t))),o=new URL(a,Ue);let s;e&&(s=e.baseOptions);const f={method:"GET",...s,...i},u={};void 0!==r&&(u.page_cursor=r),void 0!==n&&(u.page_size=n),ze(o,u);let c=s&&s.headers?s.headers:{};return f.headers={...c,...i.headers},{url:Ve(o),options:f}}}},Ze=function(e){const t=Qe(e);return{async getCollection(r,n,i){const a=await t.getCollection(r,n,i);return Ge(a,Be,De,e)},async listCollections(r,n,i,a){const o=await t.listCollections(r,n,i,a);return Ge(o,Be,De,e)}}};class et extends Fe{getCollection(e,t){return Ze(this.configuration).getCollection(e.contractAddress,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listCollections(e,t){return Ze(this.configuration).listCollections(e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const tt=function(e){return{listNFTOwners:async(t,r,n,i,a,o={})=>{je("listNFTOwners","contractAddress",t),je("listNFTOwners","tokenId",r),je("listNFTOwners","chainName",n);const s="/v1/chains/{chain_name}/collections/{contract_address}/nfts/{token_id}/owners".replace("{contract_address}",encodeURIComponent(String(t))).replace("{token_id}",encodeURIComponent(String(r))).replace("{chain_name}",encodeURIComponent(String(n))),f=new URL(s,Ue);let u;e&&(u=e.baseOptions);const c={method:"GET",...u,...o},d={};void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),ze(f,d);let l=u&&u.headers?u.headers:{};return c.headers={...l,...o.headers},{url:Ve(f),options:c}}}},rt=function(e){const t=tt(e);return{async listNFTOwners(r,n,i,a,o,s){const f=await t.listNFTOwners(r,n,i,a,o,s);return Ge(f,Be,De,e)}}};class nt extends Fe{listNFTOwners(e,t){return rt(this.configuration).listNFTOwners(e.contractAddress,e.tokenId,e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const it=function(e){return{getNFT:async(t,r,n,i={})=>{je("getNFT","contractAddress",t),je("getNFT","tokenId",r),je("getNFT","chainName",n);const a="/v1/chains/{chain_name}/collections/{contract_address}/nfts/{token_id}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{token_id}",encodeURIComponent(String(r))).replace("{chain_name}",encodeURIComponent(String(n))),o=new URL(a,Ue);let s;e&&(s=e.baseOptions);const f={method:"GET",...s,...i};ze(o,{});let u=s&&s.headers?s.headers:{};return f.headers={...u,...i.headers},{url:Ve(o),options:f}},listNFTs:async(t,r,n,i,a={})=>{je("listNFTs","contractAddress",t),je("listNFTs","chainName",r);const o="/v1/chains/{chain_name}/collections/{contract_address}/nfts".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),s=new URL(o,Ue);let f;e&&(f=e.baseOptions);const u={method:"GET",...f,...a},c={};void 0!==n&&(c.page_cursor=n),void 0!==i&&(c.page_size=i),ze(s,c);let d=f&&f.headers?f.headers:{};return u.headers={...d,...a.headers},{url:Ve(s),options:u}},listNFTsByAccountAddress:async(t,r,n,i,a,o={})=>{je("listNFTsByAccountAddress","accountAddress",t),je("listNFTsByAccountAddress","chainName",r);const s="/v1/chains/{chain_name}/accounts/{account_address}/nfts".replace("{account_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),f=new URL(s,Ue);let u;e&&(u=e.baseOptions);const c={method:"GET",...u,...o},d={};void 0!==n&&(d.contract_address=n),void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),ze(f,d);let l=u&&u.headers?u.headers:{};return c.headers={...l,...o.headers},{url:Ve(f),options:c}}}},at=function(e){const t=it(e);return{async getNFT(r,n,i,a){const o=await t.getNFT(r,n,i,a);return Ge(o,Be,De,e)},async listNFTs(r,n,i,a,o){const s=await t.listNFTs(r,n,i,a,o);return Ge(s,Be,De,e)},async listNFTsByAccountAddress(r,n,i,a,o,s){const f=await t.listNFTsByAccountAddress(r,n,i,a,o,s);return Ge(f,Be,De,e)}}};class ot extends Fe{getNFT(e,t){return at(this.configuration).getNFT(e.contractAddress,e.tokenId,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listNFTs(e,t){return at(this.configuration).listNFTs(e.contractAddress,e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}listNFTsByAccountAddress(e,t){return at(this.configuration).listNFTsByAccountAddress(e.accountAddress,e.chainName,e.contractAddress,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const st=function(e){return{createListing:async(t,r,n={})=>{je("createListing","chainName",t),je("createListing","createListingRequestBody",r);const i="/v1/chains/{chain_name}/orders/listings".replace("{chain_name}",encodeURIComponent(String(t))),a=new URL(i,Ue);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},f={};f["Content-Type"]="application/json",ze(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...f,...u,...n.headers},s.data=He(r,s,e),{url:Ve(a),options:s}},getListing:async(t,r,n={})=>{je("getListing","chainName",t),je("getListing","listingId",r);const i="/v1/chains/{chain_name}/orders/listings/{listing_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{listing_id}",encodeURIComponent(String(r))),a=new URL(i,Ue);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};ze(a,{});let f=o&&o.headers?o.headers:{};return s.headers={...f,...n.headers},{url:Ve(a),options:s}},listListings:async(t,r,n,i,a,o,s,f,u,c={})=>{je("listListings","chainName",t);const d="/v1/chains/{chain_name}/orders/listings".replace("{chain_name}",encodeURIComponent(String(t))),l=new URL(d,Ue);let p;e&&(p=e.baseOptions);const h={method:"GET",...p,...c},m={};void 0!==r&&(m.status=r),void 0!==n&&(m.sell_item_contract_address=n),void 0!==i&&(m.buy_item_contract_address=i),void 0!==a&&(m.sell_item_token_id=a),void 0!==o&&(m.page_size=o),void 0!==s&&(m.sort_by=s),void 0!==f&&(m.sort_direction=f),void 0!==u&&(m.page_cursor=u),ze(l,m);let b=p&&p.headers?p.headers:{};return h.headers={...b,...c.headers},{url:Ve(l),options:h}}}},ft=function(e){const t=st(e);return{async createListing(r,n,i){const a=await t.createListing(r,n,i);return Ge(a,Be,De,e)},async getListing(r,n,i){const a=await t.getListing(r,n,i);return Ge(a,Be,De,e)},async listListings(r,n,i,a,o,s,f,u,c,d){const l=await t.listListings(r,n,i,a,o,s,f,u,c,d);return Ge(l,Be,De,e)}}};class ut extends Fe{createListing(e,t){return ft(this.configuration).createListing(e.chainName,e.createListingRequestBody,t).then((e=>e(this.axios,this.basePath)))}getListing(e,t){return ft(this.configuration).getListing(e.chainName,e.listingId,t).then((e=>e(this.axios,this.basePath)))}listListings(e,t){return ft(this.configuration).listListings(e.chainName,e.status,e.sellItemContractAddress,e.buyItemContractAddress,e.sellItemTokenId,e.pageSize,e.sortBy,e.sortDirection,e.pageCursor,t).then((e=>e(this.axios,this.basePath)))}}const ct=function(e){return{createCounterfactualAddress:async(t,r={})=>{je("createCounterfactualAddress","createCounterfactualAddressRequest",t);const n=new URL("/passport-mr/v1/counterfactual-address",Ue);let i;e&&(i=e.baseOptions);const a={method:"POST",...i,...r},o={};await async function(e,t){if(t&&t.accessToken){const r="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+r}}(o,e),o["Content-Type"]="application/json",ze(n,{});let s=i&&i.headers?i.headers:{};return a.headers={...o,...s,...r.headers},a.data=He(t,a,e),{url:Ve(n),options:a}}}},dt=function(e){const t=ct(e);return{async createCounterfactualAddress(r,n){const i=await t.createCounterfactualAddress(r,n);return Ge(i,Be,De,e)}}};class lt extends Fe{createCounterfactualAddress(e,t){return dt(this.configuration).createCounterfactualAddress(e.createCounterfactualAddressRequest,t).then((e=>e(this.axios,this.basePath)))}}const pt=function(e){return{getERC20Token:async(t,r,n={})=>{je("getERC20Token","contractAddress",t),je("getERC20Token","chainName",r);const i="/v1/chains/{chain_name}/tokens/{contract_address}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),a=new URL(i,Ue);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};ze(a,{});let f=o&&o.headers?o.headers:{};return s.headers={...f,...n.headers},{url:Ve(a),options:s}},listERC20Tokens:async(t,r,n,i={})=>{je("listERC20Tokens","chainName",t);const a="/v1/chains/{chain_name}/tokens".replace("{chain_name}",encodeURIComponent(String(t))),o=new URL(a,Ue);let s;e&&(s=e.baseOptions);const f={method:"GET",...s,...i},u={};void 0!==r&&(u.page_cursor=r),void 0!==n&&(u.page_size=n),ze(o,u);let c=s&&s.headers?s.headers:{};return f.headers={...c,...i.headers},{url:Ve(o),options:f}}}},ht=function(e){const t=pt(e);return{async getERC20Token(r,n,i){const a=await t.getERC20Token(r,n,i);return Ge(a,Be,De,e)},async listERC20Tokens(r,n,i,a){const o=await t.listERC20Tokens(r,n,i,a);return Ge(o,Be,De,e)}}};var mt=Object.freeze({__proto__:null,APIError400AllOfCodeEnum:{ValidationError:"VALIDATION_ERROR"},APIError401AllOfCodeEnum:{UnauthorisedRequest:"UNAUTHORISED_REQUEST"},APIError403AllOfCodeEnum:{AuthenticationError:"AUTHENTICATION_ERROR"},APIError404AllOfCodeEnum:{ResourceNotFound:"RESOURCE_NOT_FOUND"},APIError429AllOfCodeEnum:{TooManyRequestsError:"TOO_MANY_REQUESTS_ERROR"},APIError500AllOfCodeEnum:{InternalServerError:"INTERNAL_SERVER_ERROR"},ActivitiesApi:Xe,ActivitiesApiAxiosParamCreator:Ke,ActivitiesApiFactory:function(e,t,r){const n=We(e);return{getActivity:(e,i,a)=>n.getActivity(e,i,a).then((e=>e(r,t))),listActivities:(e,i,a,o,s,f,u,c,d,l,p)=>n.listActivities(e,i,a,o,s,f,u,c,d,l,p).then((e=>e(r,t)))}},ActivitiesApiFp:We,ActivityType:{Mint:"mint",Burn:"burn",Transfer:"transfer",Sale:"sale"},ChainsApi:Ye,ChainsApiAxiosParamCreator:$e,ChainsApiFactory:function(e,t,r){const n=Je(e);return{listChains:(e,i,a)=>n.listChains(e,i,a).then((e=>e(r,t)))}},ChainsApiFp:Je,CollectionContractType:{Erc721:"ERC721"},CollectionsApi:et,CollectionsApiAxiosParamCreator:Qe,CollectionsApiFactory:function(e,t,r){const n=Ze(e);return{getCollection:(e,i,a)=>n.getCollection(e,i,a).then((e=>e(r,t))),listCollections:(e,i,a,o)=>n.listCollections(e,i,a,o).then((e=>e(r,t)))}},CollectionsApiFp:Ze,Configuration:class{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}},CreateOrderProtocolDataOrderTypeEnum:{FullRestricted:"FULL_RESTRICTED"},ERC20ItemItemTypeEnum:{Erc20:"ERC20"},ERC721ItemItemTypeEnum:{Erc721:"ERC721"},FeeFeeTypeEnum:{Royalty:"ROYALTY"},NFTContractType:{Erc721:"ERC721"},NativeItemItemTypeEnum:{Native:"NATIVE"},NftOwnersApi:nt,NftOwnersApiAxiosParamCreator:tt,NftOwnersApiFactory:function(e,t,r){const n=rt(e);return{listNFTOwners:(e,i,a,o,s,f)=>n.listNFTOwners(e,i,a,o,s,f).then((e=>e(r,t)))}},NftOwnersApiFp:rt,NftsApi:ot,NftsApiAxiosParamCreator:it,NftsApiFactory:function(e,t,r){const n=at(e);return{getNFT:(e,i,a,o)=>n.getNFT(e,i,a,o).then((e=>e(r,t))),listNFTs:(e,i,a,o,s)=>n.listNFTs(e,i,a,o,s).then((e=>e(r,t))),listNFTsByAccountAddress:(e,i,a,o,s,f)=>n.listNFTsByAccountAddress(e,i,a,o,s,f).then((e=>e(r,t)))}},NftsApiFp:at,OrderStatus:{Pending:"PENDING",Active:"ACTIVE",Inactive:"INACTIVE",Filled:"FILLED",Cancelled:"CANCELLED",Expired:"EXPIRED"},OrdersApi:ut,OrdersApiAxiosParamCreator:st,OrdersApiFactory:function(e,t,r){const n=ft(e);return{createListing:(e,i,a)=>n.createListing(e,i,a).then((e=>e(r,t))),getListing:(e,i,a)=>n.getListing(e,i,a).then((e=>e(r,t))),listListings:(e,i,a,o,s,f,u,c,d,l)=>n.listListings(e,i,a,o,s,f,u,c,d,l).then((e=>e(r,t)))}},OrdersApiFp:ft,PassportApi:lt,PassportApiAxiosParamCreator:ct,PassportApiFactory:function(e,t,r){const n=dt(e);return{createCounterfactualAddress:(e,i)=>n.createCounterfactualAddress(e,i).then((e=>e(r,t)))}},PassportApiFp:dt,SaleFeeTypeEnum:{Royalty:"ROYALTY"},TokenContractType:{Erc20:"ERC20"},TokensApi:class extends Fe{getERC20Token(e,t){return ht(this.configuration).getERC20Token(e.contractAddress,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listERC20Tokens(e,t){return ht(this.configuration).listERC20Tokens(e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}},TokensApiAxiosParamCreator:pt,TokensApiFactory:function(e,t,r){const n=ht(e);return{getERC20Token:(e,i,a)=>n.getERC20Token(e,i,a).then((e=>e(r,t))),listERC20Tokens:(e,i,a,o)=>n.listERC20Tokens(e,i,a,o).then((e=>e(r,t)))}},TokensApiFp:ht});class bt{config;activitiesApi;chainsApi;collectionApi;nftOwnersApi;nftsApi;ordersApi;passportApi;constructor(e){this.config=e,this.activitiesApi=new Xe(e.indexer),this.chainsApi=new Ye(e.indexer),this.collectionApi=new et(e.indexer),this.nftOwnersApi=new nt(e.indexer),this.nftsApi=new ot(e.indexer),this.ordersApi=new ut(e.orderBook),this.passportApi=new lt(e.passport)}}const yt={"x-sdk-version":"ts-immutable-sdk-0.4.1-alpha"},gt=({basePath:e,headers:t})=>{if(!e.trim())throw Error("basePath can not be empty");const r={basePath:e,baseOptions:{headers:{...yt,...t||{}}}};return new class{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}(r)},vt=()=>({indexer:gt({basePath:"https://indexer-mr.imtbl.com"}),orderBook:gt({basePath:"https://order-book-mr.imtbl.com"}),passport:gt({basePath:"https://api.immutable.com"})}),wt=()=>({indexer:gt({basePath:"https://indexer-mr.sandbox.imtbl.com"}),orderBook:gt({basePath:"https://order-book-mr.sandbox.imtbl.com"}),passport:gt({basePath:"https://api.sandbox.immutable.com"})});function _t(e,t){return function(){return e.apply(t,arguments)}}const{toString:Et}=Object.prototype,{getPrototypeOf:Tt}=Object,At=(e=>t=>{const r=Et.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),St=e=>(e=e.toLowerCase(),t=>At(t)===e),kt=e=>t=>typeof t===e,{isArray:Ot}=Array,Rt=kt("undefined");const xt=St("ArrayBuffer");const It=kt("string"),Ct=kt("function"),Nt=kt("number"),Pt=e=>null!==e&&"object"==typeof e,Mt=e=>{if("object"!==At(e))return!1;const t=Tt(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},Bt=St("Date"),Dt=St("File"),Ft=St("Blob"),Lt=St("FileList"),Ut=St("URLSearchParams");function jt(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),Ot(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function qt(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const zt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ht=e=>!Rt(e)&&e!==zt;const Vt=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&Tt(Uint8Array)),Gt=St("HTMLFormElement"),Kt=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Wt=St("RegExp"),Xt=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};jt(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},$t="abcdefghijklmnopqrstuvwxyz",Jt="0123456789",Yt={DIGIT:Jt,ALPHA:$t,ALPHA_DIGIT:$t+$t.toUpperCase()+Jt};const Qt=St("AsyncFunction");var Zt={isArray:Ot,isArrayBuffer:xt,isBuffer:function(e){return null!==e&&!Rt(e)&&null!==e.constructor&&!Rt(e.constructor)&&Ct(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Ct(e.append)&&("formdata"===(t=At(e))||"object"===t&&Ct(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&xt(e.buffer),t},isString:It,isNumber:Nt,isBoolean:e=>!0===e||!1===e,isObject:Pt,isPlainObject:Mt,isUndefined:Rt,isDate:Bt,isFile:Dt,isBlob:Ft,isRegExp:Wt,isFunction:Ct,isStream:e=>Pt(e)&&Ct(e.pipe),isURLSearchParams:Ut,isTypedArray:Vt,isFileList:Lt,forEach:jt,merge:function e(){const{caseless:t}=Ht(this)&&this||{},r={},n=(n,i)=>{const a=t&&qt(r,i)||i;Mt(r[a])&&Mt(n)?r[a]=e(r[a],n):Mt(n)?r[a]=e({},n):Ot(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&jt(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(jt(t,((t,n)=>{r&&Ct(t)?e[n]=_t(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,a,o;const s={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],n&&!n(o,e,t)||s[o]||(t[o]=e[o],s[o]=!0);e=!1!==r&&Tt(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:At,kindOfTest:St,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(Ot(e))return e;let t=e.length;if(!Nt(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Gt,hasOwnProperty:Kt,hasOwnProp:Kt,reduceDescriptors:Xt,freezeMethods:e=>{Xt(e,((t,r)=>{if(Ct(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Ct(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return Ot(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:qt,global:zt,isContextDefined:Ht,ALPHABET:Yt,generateString:(e=16,t=Yt.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&Ct(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Pt(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=Ot(e)?[]:{};return jt(e,((e,t)=>{const a=r(e,n+1);!Rt(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:Qt,isThenable:e=>e&&(Pt(e)||Ct(e))&&Ct(e.then)&&Ct(e.catch)};function er(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}Zt.inherits(er,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Zt.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const tr=er.prototype,rr={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{rr[e]={value:e}})),Object.defineProperties(er,rr),Object.defineProperty(tr,"isAxiosError",{value:!0}),er.from=(e,t,r,n,i,a)=>{const o=Object.create(tr);return Zt.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),er.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function nr(e){return Zt.isPlainObject(e)||Zt.isArray(e)}function ir(e){return Zt.endsWith(e,"[]")?e.slice(0,-2):e}function ar(e,t,r){return e?e.concat(t).map((function(e,t){return e=ir(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const or=Zt.toFlatObject(Zt,{},null,(function(e){return/^is[A-Z]/.test(e)}));function sr(e,t,r){if(!Zt.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=Zt.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Zt.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Zt.isSpecCompliantForm(t);if(!Zt.isFunction(i))throw new TypeError("visitor must be a function");function f(e){if(null===e)return"";if(Zt.isDate(e))return e.toISOString();if(!s&&Zt.isBlob(e))throw new er("Blob is not supported. Use a Buffer instead.");return Zt.isArrayBuffer(e)||Zt.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(Zt.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Zt.isArray(e)&&function(e){return Zt.isArray(e)&&!e.some(nr)}(e)||(Zt.isFileList(e)||Zt.endsWith(r,"[]"))&&(s=Zt.toArray(e)))return r=ir(r),s.forEach((function(e,n){!Zt.isUndefined(e)&&null!==e&&t.append(!0===o?ar([r],n,a):null===o?r:r+"[]",f(e))})),!1;return!!nr(e)||(t.append(ar(i,r,a),f(e)),!1)}const c=[],d=Object.assign(or,{defaultVisitor:u,convertValue:f,isVisitable:nr});if(!Zt.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Zt.isUndefined(r)){if(-1!==c.indexOf(r))throw Error("Circular reference detected in "+n.join("."));c.push(r),Zt.forEach(r,(function(r,a){!0===(!(Zt.isUndefined(r)||null===r)&&i.call(t,r,Zt.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),c.pop()}}(e),t}function fr(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ur(e,t){this._pairs=[],e&&sr(e,this,t)}const cr=ur.prototype;function dr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function lr(e,t,r){if(!t)return e;const n=r&&r.encode||dr,i=r&&r.serialize;let a;if(a=i?i(t,r):Zt.isURLSearchParams(t)?t.toString():new ur(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}cr.append=function(e,t){this._pairs.push([e,t])},cr.toString=function(e){const t=e?function(t){return e.call(this,t,fr)}:fr;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var pr=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Zt.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},hr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var mr={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ur,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function br(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&Zt.isArray(n)?n.length:a,s)return Zt.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&Zt.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&Zt.isArray(n[a])&&(n[a]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}(n[a])),!o}if(Zt.isFormData(e)&&Zt.isFunction(e.entries)){const r={};return Zt.forEachEntry(e,((e,n)=>{t(function(e){return Zt.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const yr={"Content-Type":void 0};const gr={transitional:hr,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=Zt.isObject(e);i&&Zt.isHTMLForm(e)&&(e=new FormData(e));if(Zt.isFormData(e))return n&&n?JSON.stringify(br(e)):e;if(Zt.isArrayBuffer(e)||Zt.isBuffer(e)||Zt.isStream(e)||Zt.isFile(e)||Zt.isBlob(e))return e;if(Zt.isArrayBufferView(e))return e.buffer;if(Zt.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return sr(e,new mr.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return mr.isNode&&Zt.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=Zt.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return sr(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(Zt.isString(e))try{return(t||JSON.parse)(e),Zt.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||gr.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&Zt.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw er.from(e,er.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:mr.classes.FormData,Blob:mr.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Zt.forEach(["delete","get","head"],(function(e){gr.headers[e]={}})),Zt.forEach(["post","put","patch"],(function(e){gr.headers[e]=Zt.merge(yr)}));var vr=gr;const wr=Zt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const _r=Symbol("internals");function Er(e){return e&&String(e).trim().toLowerCase()}function Tr(e){return!1===e||null==e?e:Zt.isArray(e)?e.map(Tr):String(e)}function Ar(e,t,r,n,i){return Zt.isFunction(n)?n.call(this,t,r):(i&&(t=r),Zt.isString(t)?Zt.isString(n)?-1!==t.indexOf(n):Zt.isRegExp(n)?n.test(t):void 0:void 0)}let Sr=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=Er(t);if(!i)throw new Error("header name must be a non-empty string");const a=Zt.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=Tr(e))}const a=(e,t)=>Zt.forEach(e,((e,r)=>i(e,r,t)));return Zt.isPlainObject(e)||e instanceof this.constructor?a(e,t):Zt.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?a((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&wr[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=Er(e)){const r=Zt.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(Zt.isFunction(t))return t.call(this,e,r);if(Zt.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Er(e)){const r=Zt.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ar(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=Er(e)){const i=Zt.findKey(r,e);!i||t&&!Ar(0,r[i],i,t)||(delete r[i],n=!0)}}return Zt.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!Ar(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return Zt.forEach(this,((n,i)=>{const a=Zt.findKey(r,i);if(a)return t[a]=Tr(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=Tr(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Zt.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&Zt.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[_r]=this[_r]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Er(e);t[n]||(!function(e,t){const r=Zt.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return Zt.isArray(e)?e.forEach(n):n(e),this}};Sr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Zt.freezeMethods(Sr.prototype),Zt.freezeMethods(Sr);var kr=Sr;function Or(e,t){const r=this||vr,n=t||r,i=kr.from(n.headers);let a=n.data;return Zt.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function Rr(e){return!(!e||!e.__CANCEL__)}function xr(e,t,r){er.call(this,null==e?"canceled":e,er.ERR_CANCELED,t,r),this.name="CanceledError"}Zt.inherits(xr,er,{__CANCEL__:!0});var Ir=mr.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),Zt.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Zt.isString(n)&&o.push("path="+n),Zt.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Cr(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Nr=mr.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=Zt.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function Pr(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,o=0;return t=void 0!==t?t:1e3,function(s){const f=Date.now(),u=n[o];i||(i=f),r[a]=s,n[a]=f;let c=o,d=0;for(;c!==a;)d+=r[c++],c%=e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),f-i<t)return;const l=u&&f-u;return l?Math.round(1e3*d/l):void 0}}(50,250);return i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,s=a-r,f=n(s);r=a;const u={loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:f||void 0,estimated:f&&o&&a<=o?(o-a)/f:void 0,event:i};u[t?"download":"upload"]=!0,e(u)}}var Mr="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=kr.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}Zt.isFormData(n)&&(mr.isStandardBrowserEnv||mr.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let f=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const u=Cr(e.baseURL,e.url);function c(){if(!f)return;const n=kr.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new er("Request failed with status code "+r.status,[er.ERR_BAD_REQUEST,er.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),s()}),(function(e){r(e),s()}),{data:a&&"text"!==a&&"json"!==a?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:n,config:e,request:f}),f=null}if(f.open(e.method.toUpperCase(),lr(u,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,"onloadend"in f?f.onloadend=c:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(c)},f.onabort=function(){f&&(r(new er("Request aborted",er.ECONNABORTED,e,f)),f=null)},f.onerror=function(){r(new er("Network Error",er.ERR_NETWORK,e,f)),f=null},f.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||hr;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new er(t,n.clarifyTimeoutError?er.ETIMEDOUT:er.ECONNABORTED,e,f)),f=null},mr.isStandardBrowserEnv){const t=(e.withCredentials||Nr(u))&&e.xsrfCookieName&&Ir.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in f&&Zt.forEach(i.toJSON(),(function(e,t){f.setRequestHeader(t,e)})),Zt.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&"json"!==a&&(f.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",Pr(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",Pr(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{f&&(r(!t||t.type?new xr(null,e,f):t),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===mr.protocols.indexOf(d)?r(new er("Unsupported protocol "+d+":",er.ERR_BAD_REQUEST,e)):f.send(n||null)}))};const Br={http:null,xhr:Mr};Zt.forEach(Br,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var Dr=e=>{e=Zt.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=Zt.isString(r)?Br[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new er(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(Zt.hasOwnProp(Br,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!Zt.isFunction(n))throw new TypeError("adapter is not a function");return n};function Fr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new xr(null,e)}function Lr(e){Fr(e),e.headers=kr.from(e.headers),e.data=Or.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Dr(e.adapter||vr.adapter)(e).then((function(t){return Fr(e),t.data=Or.call(e,e.transformResponse,t),t.headers=kr.from(t.headers),t}),(function(t){return Rr(t)||(Fr(e),t&&t.response&&(t.response.data=Or.call(e,e.transformResponse,t.response),t.response.headers=kr.from(t.response.headers))),Promise.reject(t)}))}const Ur=e=>e instanceof kr?e.toJSON():e;function jr(e,t){t=t||{};const r={};function n(e,t,r){return Zt.isPlainObject(e)&&Zt.isPlainObject(t)?Zt.merge.call({caseless:r},e,t):Zt.isPlainObject(t)?Zt.merge({},t):Zt.isArray(t)?t.slice():t}function i(e,t,r){return Zt.isUndefined(t)?Zt.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!Zt.isUndefined(t))return n(void 0,t)}function o(e,t){return Zt.isUndefined(t)?Zt.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,a){return a in t?n(r,i):a in e?n(void 0,r):void 0}const f={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(e,t)=>i(Ur(e),Ur(t),!0)};return Zt.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=f[n]||i,o=a(e[n],t[n],n);Zt.isUndefined(o)&&a!==s||(r[n]=o)})),r}const qr="1.4.0",zr={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{zr[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Hr={};zr.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,a)=>{if(!1===e)throw new er(n(i," has been removed"+(t?" in "+t:"")),er.ERR_DEPRECATED);return t&&!Hr[i]&&(Hr[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}};var Vr={assertOptions:function(e,t,r){if("object"!=typeof e)throw new er("options must be an object",er.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],o=t[a];if(o){const t=e[a],r=void 0===t||o(t,a,e);if(!0!==r)throw new er("option "+a+" must be "+r,er.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new er("Unknown option "+a,er.ERR_BAD_OPTION)}},validators:zr};const Gr=Vr.validators;let Kr=class{constructor(e){this.defaults=e,this.interceptors={request:new pr,response:new pr}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=jr(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&Vr.assertOptions(r,{silentJSONParsing:Gr.transitional(Gr.boolean),forcedJSONParsing:Gr.transitional(Gr.boolean),clarifyTimeoutError:Gr.transitional(Gr.boolean)},!1),null!=n&&(Zt.isFunction(n)?t.paramsSerializer={serialize:n}:Vr.assertOptions(n,{encode:Gr.function,serialize:Gr.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&Zt.merge(i.common,i[t.method]),a&&Zt.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=kr.concat(a,i);const o=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const f=[];let u;this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)}));let c,d=0;if(!s){const e=[Lr.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,f),c=e.length,u=Promise.resolve(t);d<c;)u=u.then(e[d++],e[d++]);return u}c=o.length;let l=t;for(d=0;d<c;){const e=o[d++],t=o[d++];try{l=e(l)}catch(e){t.call(this,e);break}}try{u=Lr.call(this,l)}catch(e){return Promise.reject(e)}for(d=0,c=f.length;d<c;)u=u.then(f[d++],f[d++]);return u}getUri(e){return lr(Cr((e=jr(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};Zt.forEach(["delete","get","head","options"],(function(e){Kr.prototype[e]=function(t,r){return this.request(jr(r||{},{method:e,url:t,data:(r||{}).data}))}})),Zt.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(jr(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Kr.prototype[e]=t(),Kr.prototype[e+"Form"]=t(!0)}));var Wr=Kr;var Xr=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new xr(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let t;const r=new e((function(e){t=e}));return{token:r,cancel:t}}};const $r={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries($r).forEach((([e,t])=>{$r[t]=e}));var Jr=$r;const Yr=function e(t){const r=new Wr(t),n=_t(Wr.prototype.request,r);return Zt.extend(n,Wr.prototype,r,{allOwnKeys:!0}),Zt.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(jr(t,r))},n}(vr);Yr.Axios=Wr,Yr.CanceledError=xr,Yr.CancelToken=Xr,Yr.isCancel=Rr,Yr.VERSION=qr,Yr.toFormData=sr,Yr.AxiosError=er,Yr.Cancel=Yr.CanceledError,Yr.all=function(e){return Promise.all(e)},Yr.spread=function(e){return function(t){return e.apply(null,t)}},Yr.isAxiosError=function(e){return Zt.isObject(e)&&!0===e.isAxiosError},Yr.mergeConfig=jr,Yr.AxiosHeaders=kr,Yr.formToJSON=e=>br(Zt.isHTMLForm(e)?new FormData(e):e),Yr.HttpStatusCode=Jr,Yr.default=Yr;var Qr=Yr;class Zr extends Error{code;details;link;traceId;constructor({message:e,code:t,details:r,link:n,trace_id:i}){super(e),this.code=t,this.details=r,this.link=n,this.traceId=i}}const en={sdkVersion:"ts-immutable-sdk-multi-rollup-api-client-0.4.1-alpha"},tn=({basePath:e,headers:t})=>{if(!e.trim())throw Error("basePath can not be empty");const r={basePath:e,baseOptions:{headers:{...t||{},...en}}};return new mt.Configuration(r)},rn=()=>tn({basePath:"https://indexer-mr.sandbox.imtbl.com"});class nn{apiConfig;baseConfig;constructor({baseConfig:t,overrides:r}){if(this.baseConfig=t,r)this.apiConfig=tn(r);else switch(t.environment){case e.Environment.SANDBOX:this.apiConfig=rn();break;case e.Environment.PRODUCTION:this.apiConfig=tn({basePath:"https://indexer-mr.imtbl.com"});break;default:this.apiConfig=rn()}}}function an(e){if(Qr.isAxiosError(e)&&e.response){const t=e.response.data;return t.code&&t.message?new Zr({code:t.code,message:t.message,details:t.details||null,link:t.link||"",trace_id:t.trace_id||""}):new Zr({code:e.code??e.response?.status.toString()??"unknown_error_code",message:String(e),details:null,link:"",trace_id:""})}return new Zr({code:"unknown_error_code",message:String(e),details:null,link:"",trace_id:""})}var on="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function sn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function fn(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){if(this instanceof e){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(t,r))}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var un={exports:{}},cn="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},dn=[],ln=[],pn="undefined"!=typeof Uint8Array?Uint8Array:Array,hn=!1;function mn(){hn=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)dn[t]=e[t],ln[e.charCodeAt(t)]=t;ln["-".charCodeAt(0)]=62,ln["_".charCodeAt(0)]=63}function bn(e,t,r){for(var n,i,a=[],o=t;o<r;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],a.push(dn[(i=n)>>18&63]+dn[i>>12&63]+dn[i>>6&63]+dn[63&i]);return a.join("")}function yn(e){var t;hn||mn();for(var r=e.length,n=r%3,i="",a=[],o=16383,s=0,f=r-n;s<f;s+=o)a.push(bn(e,s,s+o>f?f:s+o));return 1===n?(t=e[r-1],i+=dn[t>>2],i+=dn[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=dn[t>>10],i+=dn[t>>4&63],i+=dn[t<<2&63],i+="="),a.push(i),a.join("")}function gn(e,t,r,n,i){var a,o,s=8*i-n-1,f=(1<<s)-1,u=f>>1,c=-7,d=r?i-1:0,l=r?-1:1,p=e[t+d];for(d+=l,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+e[t+d],d+=l,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+e[t+d],d+=l,c-=8);if(0===a)a=1-u;else{if(a===f)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=u}return(p?-1:1)*o*Math.pow(2,a-n)}function vn(e,t,r,n,i,a){var o,s,f,u=8*a-i-1,c=(1<<u)-1,d=c>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,h=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-o))<1&&(o--,f*=2),(t+=o+d>=1?l/f:l*Math.pow(2,1-d))*f>=2&&(o++,f/=2),o+d>=c?(s=0,o=c):o+d>=1?(s=(t*f-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+p]=255&s,p+=h,s/=256,i-=8);for(o=o<<i|s,u+=i;u>0;e[r+p]=255&o,p+=h,o/=256,u-=8);e[r+p-h]|=128*m}var wn={}.toString,_n=Array.isArray||function(e){return"[object Array]"==wn.call(e)};Sn.TYPED_ARRAY_SUPPORT=void 0===cn.TYPED_ARRAY_SUPPORT||cn.TYPED_ARRAY_SUPPORT;var En=Tn();function Tn(){return Sn.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function An(e,t){if(Tn()<t)throw new RangeError("Invalid typed array length");return Sn.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Sn.prototype:(null===e&&(e=new Sn(t)),e.length=t),e}function Sn(e,t,r){if(!(Sn.TYPED_ARRAY_SUPPORT||this instanceof Sn))return new Sn(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Rn(this,e)}return kn(this,e,t,r)}function kn(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);Sn.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Sn.prototype:e=xn(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!Sn.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|Nn(t,r);e=An(e,n);var i=e.write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(Cn(t)){var r=0|In(t.length);return 0===(e=An(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?An(e,0):xn(e,t);if("Buffer"===t.type&&_n(t.data))return xn(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function On(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function Rn(e,t){if(On(t),e=An(e,t<0?0:0|In(t)),!Sn.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function xn(e,t){var r=t.length<0?0:0|In(t.length);e=An(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function In(e){if(e>=Tn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Tn().toString(16)+" bytes");return 0|e}function Cn(e){return!(null==e||!e._isBuffer)}function Nn(e,t){if(Cn(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return ai(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return oi(e).length;default:if(n)return ai(e).length;t=(""+t).toLowerCase(),n=!0}}function Pn(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Xn(this,t,r);case"utf8":case"utf-8":return Vn(this,t,r);case"ascii":return Kn(this,t,r);case"latin1":case"binary":return Wn(this,t,r);case"base64":return Hn(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $n(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Mn(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Bn(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=Sn.from(t,n)),Cn(t))return 0===t.length?-1:Dn(e,t,r,n,i);if("number"==typeof t)return t&=255,Sn.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Dn(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Dn(e,t,r,n,i){var a,o=1,s=e.length,f=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,f/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=r;a<s;a++)if(u(e,a)===u(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===f)return c*o}else-1!==c&&(a-=a-c),c=-1}else for(r+f>s&&(r=s-f),a=r;a>=0;a--){for(var d=!0,l=0;l<f;l++)if(u(e,a+l)!==u(t,l)){d=!1;break}if(d)return a}return-1}function Fn(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[r+o]=s}return o}function Ln(e,t,r,n){return si(ai(t,e.length-r),e,r,n)}function Un(e,t,r,n){return si(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function jn(e,t,r,n){return Un(e,t,r,n)}function qn(e,t,r,n){return si(oi(t),e,r,n)}function zn(e,t,r,n){return si(function(e,t){for(var r,n,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function Hn(e,t,r){return 0===t&&r===e.length?yn(e):yn(e.slice(t,r))}function Vn(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,f,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(a=e[i+1]))&&(f=(31&u)<<6|63&a)>127&&(c=f);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(f=(15&u)<<12|(63&a)<<6|63&o)>2047&&(f<55296||f>57343)&&(c=f);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(f=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&f<1114112&&(c=f)}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d}return function(e){var t=e.length;if(t<=Gn)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Gn));return r}(n)}Sn.poolSize=8192,Sn._augment=function(e){return e.__proto__=Sn.prototype,e},Sn.from=function(e,t,r){return kn(null,e,t,r)},Sn.TYPED_ARRAY_SUPPORT&&(Sn.prototype.__proto__=Uint8Array.prototype,Sn.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Sn[Symbol.species]),Sn.alloc=function(e,t,r){return function(e,t,r,n){return On(t),t<=0?An(e,t):void 0!==r?"string"==typeof n?An(e,t).fill(r,n):An(e,t).fill(r):An(e,t)}(null,e,t,r)},Sn.allocUnsafe=function(e){return Rn(null,e)},Sn.allocUnsafeSlow=function(e){return Rn(null,e)},Sn.isBuffer=fi,Sn.compare=function(e,t){if(!Cn(e)||!Cn(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},Sn.isEncoding=function(e){switch(String(e).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}},Sn.concat=function(e,t){if(!_n(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Sn.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=Sn.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(!Cn(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},Sn.byteLength=Nn,Sn.prototype._isBuffer=!0,Sn.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Mn(this,t,t+1);return this},Sn.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Mn(this,t,t+3),Mn(this,t+1,t+2);return this},Sn.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Mn(this,t,t+7),Mn(this,t+1,t+6),Mn(this,t+2,t+5),Mn(this,t+3,t+4);return this},Sn.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Vn(this,0,e):Pn.apply(this,arguments)},Sn.prototype.equals=function(e){if(!Cn(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Sn.compare(this,e)},Sn.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Sn.prototype.compare=function(e,t,r,n,i){if(!Cn(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(a,o),f=this.slice(n,i),u=e.slice(t,r),c=0;c<s;++c)if(f[c]!==u[c]){a=f[c],o=u[c];break}return a<o?-1:o<a?1:0},Sn.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},Sn.prototype.indexOf=function(e,t,r){return Bn(this,e,t,r,!0)},Sn.prototype.lastIndexOf=function(e,t,r){return Bn(this,e,t,r,!1)},Sn.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return Fn(this,e,t,r);case"utf8":case"utf-8":return Ln(this,e,t,r);case"ascii":return Un(this,e,t,r);case"latin1":case"binary":return jn(this,e,t,r);case"base64":return qn(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zn(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},Sn.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Gn=4096;function Kn(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function Wn(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function Xn(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=ii(e[a]);return i}function $n(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function Jn(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function Yn(e,t,r,n,i,a){if(!Cn(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function Qn(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);i<a;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function Zn(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);i<a;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function ei(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ti(e,t,r,n,i){return i||ei(e,0,r,4),vn(e,t,r,n,23,4),r+4}function ri(e,t,r,n,i){return i||ei(e,0,r,8),vn(e,t,r,n,52,8),r+8}Sn.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Sn.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=Sn.prototype;else{var i=t-e;r=new Sn(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},Sn.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Jn(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},Sn.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Jn(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},Sn.prototype.readUInt8=function(e,t){return t||Jn(e,1,this.length),this[e]},Sn.prototype.readUInt16LE=function(e,t){return t||Jn(e,2,this.length),this[e]|this[e+1]<<8},Sn.prototype.readUInt16BE=function(e,t){return t||Jn(e,2,this.length),this[e]<<8|this[e+1]},Sn.prototype.readUInt32LE=function(e,t){return t||Jn(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Sn.prototype.readUInt32BE=function(e,t){return t||Jn(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Sn.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Jn(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},Sn.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Jn(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},Sn.prototype.readInt8=function(e,t){return t||Jn(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Sn.prototype.readInt16LE=function(e,t){t||Jn(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Sn.prototype.readInt16BE=function(e,t){t||Jn(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Sn.prototype.readInt32LE=function(e,t){return t||Jn(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Sn.prototype.readInt32BE=function(e,t){return t||Jn(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Sn.prototype.readFloatLE=function(e,t){return t||Jn(e,4,this.length),gn(this,e,!0,23,4)},Sn.prototype.readFloatBE=function(e,t){return t||Jn(e,4,this.length),gn(this,e,!1,23,4)},Sn.prototype.readDoubleLE=function(e,t){return t||Jn(e,8,this.length),gn(this,e,!0,52,8)},Sn.prototype.readDoubleBE=function(e,t){return t||Jn(e,8,this.length),gn(this,e,!1,52,8)},Sn.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||Yn(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},Sn.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||Yn(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},Sn.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,1,255,0),Sn.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Sn.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,2,65535,0),Sn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Qn(this,e,t,!0),t+2},Sn.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,2,65535,0),Sn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Qn(this,e,t,!1),t+2},Sn.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,4,4294967295,0),Sn.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Zn(this,e,t,!0),t+4},Sn.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,4,4294967295,0),Sn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Zn(this,e,t,!1),t+4},Sn.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Yn(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},Sn.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Yn(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},Sn.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,1,127,-128),Sn.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Sn.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,2,32767,-32768),Sn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Qn(this,e,t,!0),t+2},Sn.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,2,32767,-32768),Sn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Qn(this,e,t,!1),t+2},Sn.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,4,2147483647,-2147483648),Sn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Zn(this,e,t,!0),t+4},Sn.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Sn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Zn(this,e,t,!1),t+4},Sn.prototype.writeFloatLE=function(e,t,r){return ti(this,e,t,!0,r)},Sn.prototype.writeFloatBE=function(e,t,r){return ti(this,e,t,!1,r)},Sn.prototype.writeDoubleLE=function(e,t,r){return ri(this,e,t,!0,r)},Sn.prototype.writeDoubleBE=function(e,t,r){return ri(this,e,t,!1,r)},Sn.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,a=n-r;if(this===e&&r<t&&t<n)for(i=a-1;i>=0;--i)e[i+t]=this[i+r];else if(a<1e3||!Sn.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},Sn.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Sn.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var o=Cn(e)?e:ai(new Sn(e,n).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var ni=/[^+\/0-9A-Za-z-_]/g;function ii(e){return e<16?"0"+e.toString(16):e.toString(16)}function ai(e,t){var r;t=t||1/0;for(var n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function oi(e){return function(e){var t,r,n,i,a,o;hn||mn();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[s-2]?2:"="===e[s-1]?1:0,o=new pn(3*s/4-a),n=a>0?s-4:s;var f=0;for(t=0,r=0;t<n;t+=4,r+=3)i=ln[e.charCodeAt(t)]<<18|ln[e.charCodeAt(t+1)]<<12|ln[e.charCodeAt(t+2)]<<6|ln[e.charCodeAt(t+3)],o[f++]=i>>16&255,o[f++]=i>>8&255,o[f++]=255&i;return 2===a?(i=ln[e.charCodeAt(t)]<<2|ln[e.charCodeAt(t+1)]>>4,o[f++]=255&i):1===a&&(i=ln[e.charCodeAt(t)]<<10|ln[e.charCodeAt(t+1)]<<4|ln[e.charCodeAt(t+2)]>>2,o[f++]=i>>8&255,o[f++]=255&i),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(ni,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function si(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function fi(e){return null!=e&&(!!e._isBuffer||ui(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&ui(e.slice(0,0))}(e))}function ui(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var ci=fn(Object.freeze({__proto__:null,Buffer:Sn,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),Sn.alloc(+e)},isBuffer:fi,kMaxLength:En}));!function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:ci.Buffer}catch(e){}function o(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function s(e,t,r){var n=o(e,r);return r-1>=t&&(n|=o(e,r-1)<<4),n}function f(e,t,n,i){for(var a=0,o=0,s=Math.min(e.length,n),f=t;f<s;f++){var u=e.charCodeAt(f)-48;a*=i,o=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&o<i,"Invalid character"),a+=o}return a}function u(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===n)for(i=e.length-1,a=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===n)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this._strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,a=0,o=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=s(e,t,n)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=s(e,t,n)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var a=e.length-r,o=a%n,s=Math.min(a,a-o)+r,u=0,c=r;c<s;c+=n)u=f(e,c,c+n,t),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var d=1;for(u=f(e,c,e.length,t),c=0;c<o;c++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){u(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(e){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],f=(16777215&(s<<i|a)).toString(16);a=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),n=0!==a||o!==this.length-1?d[6-f.length]+f+n:f+n}for(0!==a&&(n=a.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=l[e],c=p[e];n="";var h=this.clone();for(h.negative=0;!h.isZero();){var m=h.modrn(c).toString(e);n=(h=h.idivn(c)).isZero()?m+n:d[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},a&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function h(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,f=o/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var c=f>>>26,d=67108863&f,l=Math.min(u,t.length-1),p=Math.max(0,u-e.length+1);p<=l;p++){var h=u-p|0;c+=(o=(i=0|e.words[h])*(a=0|t.words[p])+d)/67108864|0,d=67108863&o}r.words[u]=0|d,f=0|c}return 0!==f?r.words[u]=0|f:r.length--,r._strip()}i.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),a=n||Math.max(1,i);r(i<=a,"byte array longer than desired length"),r(a>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,a);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,i),o},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|n;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===a?(r<e.length&&(e[r++]=o>>24&255),n=0,a=0):(n=o>>>24,a+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|n;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===a?(r>=0&&(e[r--]=o>>24&255),n=0,a=0):(n=o>>>24,a+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,a=0;a<n.length;a++)t=(0|r.words[a])+(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!==i&&a<r.length;a++)t=(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var a=0,o=0;o<n.length;o++)a=(t=(0|r.words[o])-(0|n.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!==a&&o<r.length;o++)a=(t=(0|r.words[o])+a)>>26,this.words[o]=67108863&t;if(0===a&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var n,i,a,o=e.words,s=t.words,f=r.words,u=0,c=0|o[0],d=8191&c,l=c>>>13,p=0|o[1],h=8191&p,m=p>>>13,b=0|o[2],y=8191&b,g=b>>>13,v=0|o[3],w=8191&v,_=v>>>13,E=0|o[4],T=8191&E,A=E>>>13,S=0|o[5],k=8191&S,O=S>>>13,R=0|o[6],x=8191&R,I=R>>>13,C=0|o[7],N=8191&C,P=C>>>13,M=0|o[8],B=8191&M,D=M>>>13,F=0|o[9],L=8191&F,U=F>>>13,j=0|s[0],q=8191&j,z=j>>>13,H=0|s[1],V=8191&H,G=H>>>13,K=0|s[2],W=8191&K,X=K>>>13,$=0|s[3],J=8191&$,Y=$>>>13,Q=0|s[4],Z=8191&Q,ee=Q>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],fe=8191&se,ue=se>>>13,ce=0|s[8],de=8191&ce,le=ce>>>13,pe=0|s[9],he=8191&pe,me=pe>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(u+(n=Math.imul(d,q))|0)+((8191&(i=(i=Math.imul(d,z))+Math.imul(l,q)|0))<<13)|0;u=((a=Math.imul(l,z))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(h,q),i=(i=Math.imul(h,z))+Math.imul(m,q)|0,a=Math.imul(m,z);var ye=(u+(n=n+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,G)|0)+Math.imul(l,V)|0))<<13)|0;u=((a=a+Math.imul(l,G)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,q),i=(i=Math.imul(y,z))+Math.imul(g,q)|0,a=Math.imul(g,z),n=n+Math.imul(h,V)|0,i=(i=i+Math.imul(h,G)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,G)|0;var ge=(u+(n=n+Math.imul(d,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(l,W)|0))<<13)|0;u=((a=a+Math.imul(l,X)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,a=Math.imul(_,z),n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(g,V)|0,a=a+Math.imul(g,G)|0,n=n+Math.imul(h,W)|0,i=(i=i+Math.imul(h,X)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,X)|0;var ve=(u+(n=n+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(l,J)|0))<<13)|0;u=((a=a+Math.imul(l,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(T,q),i=(i=Math.imul(T,z))+Math.imul(A,q)|0,a=Math.imul(A,z),n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(g,W)|0,a=a+Math.imul(g,X)|0,n=n+Math.imul(h,J)|0,i=(i=i+Math.imul(h,Y)|0)+Math.imul(m,J)|0,a=a+Math.imul(m,Y)|0;var we=(u+(n=n+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(l,Z)|0))<<13)|0;u=((a=a+Math.imul(l,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(k,q),i=(i=Math.imul(k,z))+Math.imul(O,q)|0,a=Math.imul(O,z),n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(A,V)|0,a=a+Math.imul(A,G)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,W)|0,a=a+Math.imul(_,X)|0,n=n+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(g,J)|0,a=a+Math.imul(g,Y)|0,n=n+Math.imul(h,Z)|0,i=(i=i+Math.imul(h,ee)|0)+Math.imul(m,Z)|0,a=a+Math.imul(m,ee)|0;var _e=(u+(n=n+Math.imul(d,re)|0)|0)+((8191&(i=(i=i+Math.imul(d,ne)|0)+Math.imul(l,re)|0))<<13)|0;u=((a=a+Math.imul(l,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(x,q),i=(i=Math.imul(x,z))+Math.imul(I,q)|0,a=Math.imul(I,z),n=n+Math.imul(k,V)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(O,V)|0,a=a+Math.imul(O,G)|0,n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(A,W)|0,a=a+Math.imul(A,X)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,J)|0,a=a+Math.imul(_,Y)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(g,Z)|0,a=a+Math.imul(g,ee)|0,n=n+Math.imul(h,re)|0,i=(i=i+Math.imul(h,ne)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ne)|0;var Ee=(u+(n=n+Math.imul(d,ae)|0)|0)+((8191&(i=(i=i+Math.imul(d,oe)|0)+Math.imul(l,ae)|0))<<13)|0;u=((a=a+Math.imul(l,oe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(N,q),i=(i=Math.imul(N,z))+Math.imul(P,q)|0,a=Math.imul(P,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(I,V)|0,a=a+Math.imul(I,G)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(O,W)|0,a=a+Math.imul(O,X)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(A,J)|0,a=a+Math.imul(A,Y)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Z)|0,a=a+Math.imul(_,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(g,re)|0,a=a+Math.imul(g,ne)|0,n=n+Math.imul(h,ae)|0,i=(i=i+Math.imul(h,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0;var Te=(u+(n=n+Math.imul(d,fe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(l,fe)|0))<<13)|0;u=((a=a+Math.imul(l,ue)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,z))+Math.imul(D,q)|0,a=Math.imul(D,z),n=n+Math.imul(N,V)|0,i=(i=i+Math.imul(N,G)|0)+Math.imul(P,V)|0,a=a+Math.imul(P,G)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(I,W)|0,a=a+Math.imul(I,X)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(O,J)|0,a=a+Math.imul(O,Y)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(A,Z)|0,a=a+Math.imul(A,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,a=a+Math.imul(_,ne)|0,n=n+Math.imul(y,ae)|0,i=(i=i+Math.imul(y,oe)|0)+Math.imul(g,ae)|0,a=a+Math.imul(g,oe)|0,n=n+Math.imul(h,fe)|0,i=(i=i+Math.imul(h,ue)|0)+Math.imul(m,fe)|0,a=a+Math.imul(m,ue)|0;var Ae=(u+(n=n+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(l,de)|0))<<13)|0;u=((a=a+Math.imul(l,le)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(L,q),i=(i=Math.imul(L,z))+Math.imul(U,q)|0,a=Math.imul(U,z),n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(D,V)|0,a=a+Math.imul(D,G)|0,n=n+Math.imul(N,W)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(P,W)|0,a=a+Math.imul(P,X)|0,n=n+Math.imul(x,J)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(I,J)|0,a=a+Math.imul(I,Y)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(O,Z)|0,a=a+Math.imul(O,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(A,re)|0,a=a+Math.imul(A,ne)|0,n=n+Math.imul(w,ae)|0,i=(i=i+Math.imul(w,oe)|0)+Math.imul(_,ae)|0,a=a+Math.imul(_,oe)|0,n=n+Math.imul(y,fe)|0,i=(i=i+Math.imul(y,ue)|0)+Math.imul(g,fe)|0,a=a+Math.imul(g,ue)|0,n=n+Math.imul(h,de)|0,i=(i=i+Math.imul(h,le)|0)+Math.imul(m,de)|0,a=a+Math.imul(m,le)|0;var Se=(u+(n=n+Math.imul(d,he)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(l,he)|0))<<13)|0;u=((a=a+Math.imul(l,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,V),i=(i=Math.imul(L,G))+Math.imul(U,V)|0,a=Math.imul(U,G),n=n+Math.imul(B,W)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(D,W)|0,a=a+Math.imul(D,X)|0,n=n+Math.imul(N,J)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(P,J)|0,a=a+Math.imul(P,Y)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(I,Z)|0,a=a+Math.imul(I,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(O,re)|0,a=a+Math.imul(O,ne)|0,n=n+Math.imul(T,ae)|0,i=(i=i+Math.imul(T,oe)|0)+Math.imul(A,ae)|0,a=a+Math.imul(A,oe)|0,n=n+Math.imul(w,fe)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(_,fe)|0,a=a+Math.imul(_,ue)|0,n=n+Math.imul(y,de)|0,i=(i=i+Math.imul(y,le)|0)+Math.imul(g,de)|0,a=a+Math.imul(g,le)|0;var ke=(u+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(m,he)|0))<<13)|0;u=((a=a+Math.imul(m,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,W),i=(i=Math.imul(L,X))+Math.imul(U,W)|0,a=Math.imul(U,X),n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(D,J)|0,a=a+Math.imul(D,Y)|0,n=n+Math.imul(N,Z)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(P,Z)|0,a=a+Math.imul(P,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(I,re)|0,a=a+Math.imul(I,ne)|0,n=n+Math.imul(k,ae)|0,i=(i=i+Math.imul(k,oe)|0)+Math.imul(O,ae)|0,a=a+Math.imul(O,oe)|0,n=n+Math.imul(T,fe)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(A,fe)|0,a=a+Math.imul(A,ue)|0,n=n+Math.imul(w,de)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(_,de)|0,a=a+Math.imul(_,le)|0;var Oe=(u+(n=n+Math.imul(y,he)|0)|0)+((8191&(i=(i=i+Math.imul(y,me)|0)+Math.imul(g,he)|0))<<13)|0;u=((a=a+Math.imul(g,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,J),i=(i=Math.imul(L,Y))+Math.imul(U,J)|0,a=Math.imul(U,Y),n=n+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(D,Z)|0,a=a+Math.imul(D,ee)|0,n=n+Math.imul(N,re)|0,i=(i=i+Math.imul(N,ne)|0)+Math.imul(P,re)|0,a=a+Math.imul(P,ne)|0,n=n+Math.imul(x,ae)|0,i=(i=i+Math.imul(x,oe)|0)+Math.imul(I,ae)|0,a=a+Math.imul(I,oe)|0,n=n+Math.imul(k,fe)|0,i=(i=i+Math.imul(k,ue)|0)+Math.imul(O,fe)|0,a=a+Math.imul(O,ue)|0,n=n+Math.imul(T,de)|0,i=(i=i+Math.imul(T,le)|0)+Math.imul(A,de)|0,a=a+Math.imul(A,le)|0;var Re=(u+(n=n+Math.imul(w,he)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(_,he)|0))<<13)|0;u=((a=a+Math.imul(_,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(L,Z),i=(i=Math.imul(L,ee))+Math.imul(U,Z)|0,a=Math.imul(U,ee),n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(D,re)|0,a=a+Math.imul(D,ne)|0,n=n+Math.imul(N,ae)|0,i=(i=i+Math.imul(N,oe)|0)+Math.imul(P,ae)|0,a=a+Math.imul(P,oe)|0,n=n+Math.imul(x,fe)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(I,fe)|0,a=a+Math.imul(I,ue)|0,n=n+Math.imul(k,de)|0,i=(i=i+Math.imul(k,le)|0)+Math.imul(O,de)|0,a=a+Math.imul(O,le)|0;var xe=(u+(n=n+Math.imul(T,he)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(A,he)|0))<<13)|0;u=((a=a+Math.imul(A,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(L,re),i=(i=Math.imul(L,ne))+Math.imul(U,re)|0,a=Math.imul(U,ne),n=n+Math.imul(B,ae)|0,i=(i=i+Math.imul(B,oe)|0)+Math.imul(D,ae)|0,a=a+Math.imul(D,oe)|0,n=n+Math.imul(N,fe)|0,i=(i=i+Math.imul(N,ue)|0)+Math.imul(P,fe)|0,a=a+Math.imul(P,ue)|0,n=n+Math.imul(x,de)|0,i=(i=i+Math.imul(x,le)|0)+Math.imul(I,de)|0,a=a+Math.imul(I,le)|0;var Ie=(u+(n=n+Math.imul(k,he)|0)|0)+((8191&(i=(i=i+Math.imul(k,me)|0)+Math.imul(O,he)|0))<<13)|0;u=((a=a+Math.imul(O,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(L,ae),i=(i=Math.imul(L,oe))+Math.imul(U,ae)|0,a=Math.imul(U,oe),n=n+Math.imul(B,fe)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(D,fe)|0,a=a+Math.imul(D,ue)|0,n=n+Math.imul(N,de)|0,i=(i=i+Math.imul(N,le)|0)+Math.imul(P,de)|0,a=a+Math.imul(P,le)|0;var Ce=(u+(n=n+Math.imul(x,he)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(I,he)|0))<<13)|0;u=((a=a+Math.imul(I,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,fe),i=(i=Math.imul(L,ue))+Math.imul(U,fe)|0,a=Math.imul(U,ue),n=n+Math.imul(B,de)|0,i=(i=i+Math.imul(B,le)|0)+Math.imul(D,de)|0,a=a+Math.imul(D,le)|0;var Ne=(u+(n=n+Math.imul(N,he)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(P,he)|0))<<13)|0;u=((a=a+Math.imul(P,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(L,de),i=(i=Math.imul(L,le))+Math.imul(U,de)|0,a=Math.imul(U,le);var Pe=(u+(n=n+Math.imul(B,he)|0)|0)+((8191&(i=(i=i+Math.imul(B,me)|0)+Math.imul(D,he)|0))<<13)|0;u=((a=a+Math.imul(D,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Me=(u+(n=Math.imul(L,he))|0)+((8191&(i=(i=Math.imul(L,me))+Math.imul(U,he)|0))<<13)|0;return u=((a=Math.imul(U,me))+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,f[0]=be,f[1]=ye,f[2]=ge,f[3]=ve,f[4]=we,f[5]=_e,f[6]=Ee,f[7]=Te,f[8]=Ae,f[9]=Se,f[10]=ke,f[11]=Oe,f[12]=Re,f[13]=xe,f[14]=Ie,f[15]=Ce,f[16]=Ne,f[17]=Pe,f[18]=Me,0!==u&&(f[19]=u,r.length++),r};function b(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,a=0;a<r.length-1;a++){var o=i;i=0;for(var s=67108863&n,f=Math.min(a,t.length-1),u=Math.max(0,a-e.length+1);u<=f;u++){var c=a-u,d=(0|e.words[c])*(0|t.words[u]),l=67108863&d;s=67108863&(l=l+s|0),i+=(o=(o=o+(d/67108864|0)|0)+(l>>>26)|0)>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r._strip()}function y(e,t,r){return b(e,t,r)}Math.imul||(m=h),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?h(this,e,t):r<1024?b(this,e,t):y(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),y(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,i=0;i<this.length;i++){var a=(0|this.words[i])*e,o=(67108863&a)+(67108863&n);n>>=26,n+=a/67108864|0,n+=o>>>26,this.words[i]=67108863&o}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=e.words[n]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var a=r.sqr();n<t.length;n++,a=a.sqr())0!==t[n]&&(r=r.mul(a));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,a=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,f=(0|this.words[t])-s<<n;this.words[t]=f|o,o=s>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,f=n;if(i-=o,i=Math.max(0,i),f){for(var u=0;u<o;u++)f.words[u]=this.words[u];f.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var c=0;for(u=this.length-1;u>=0&&(0!==c||u>=i);u--){var d=0|this.words[u];this.words[u]=c<<26-a|d>>>a,c=d&s}return f&&0!==c&&(f.words[f.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var i,a,o=e.length+n;this._expand(o);var s=0;for(i=0;i<e.length;i++){a=(0|this.words[i+n])+s;var f=(0|e.words[i])*t;s=((a-=67108863&f)>>26)-(f/67108864|0),this.words[i+n]=67108863&a}for(;i<this.length-n;i++)s=(a=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&a;if(0===s)return this._strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(a=-(0|this.words[i])+s)>>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),a=e,o=0|a.words[a.length-1];0!==(r=26-this._countBits(o))&&(a=a.ushln(r),n.iushln(r),o=0|a.words[a.length-1]);var s,f=n.length-a.length;if("mod"!==t){(s=new i(null)).length=f+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var c=n.clone()._ishlnsubmul(a,1,f);0===c.negative&&(n=c,s&&(s.words[f]=1));for(var d=f-1;d>=0;d--){var l=67108864*(0|n.words[a.length+d])+(0|n.words[a.length+d-1]);for(l=Math.min(l/o|0,67108863),n._ishlnsubmul(a,l,d);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(a,1,d),n.isZero()||(n.negative^=1);s&&(s.words[d]=l)}return s&&s._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(a=s.div.neg()),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:a,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(a=s.div.neg()),{div:a,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,o,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,a=this.length-1;a>=0;a--)i=(n*i+(0|this.words[a]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var a=(0|this.words[i])+67108864*n;this.words[i]=a/e|0,n=a%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new i(1),o=new i(0),s=new i(0),f=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var c=n.clone(),d=t.clone();!t.isZero();){for(var l=0,p=1;0==(t.words[0]&p)&&l<26;++l,p<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(c),o.isub(d)),a.iushrn(1),o.iushrn(1);for(var h=0,m=1;0==(n.words[0]&m)&&h<26;++h,m<<=1);if(h>0)for(n.iushrn(h);h-- >0;)(s.isOdd()||f.isOdd())&&(s.iadd(c),f.isub(d)),s.iushrn(1),f.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s),o.isub(f)):(n.isub(t),s.isub(a),f.isub(o))}return{a:s,b:f,gcd:n.iushln(u)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,o=new i(1),s=new i(0),f=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(f),o.iushrn(1);for(var d=0,l=1;0==(n.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(n.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(f),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s)):(n.isub(t),s.isub(o))}return(a=0===t.cmpn(1)?o:s).cmpn(0)<0&&a.iadd(e),a},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var a=t;t=r,r=a}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var a=i,o=n;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new A(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function T(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){A.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},n(w,v),w.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&r)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(_,v),n(E,v),n(T,v),T.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new _;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new T}return g[e]=t,t},A.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);r(!a.isZero());var s=new i(1).toRed(this),f=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(f);)c.redIAdd(f);for(var d=this.pow(c,a),l=this.pow(e,a.addn(1).iushrn(1)),p=this.pow(e,a),h=o;0!==p.cmp(s);){for(var m=p,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b<h);var y=this.pow(d,new i(1).iushln(h-b-1));l=l.redMul(y),d=y.redSqr(),p=p.redMul(d),h=b}return l},A.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var a=r[0],o=0,s=0,f=t.bitLength()%26;for(0===f&&(f=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],c=f-1;c>=0;c--){var d=u>>c&1;a!==r[0]&&(a=this.sqr(a)),0!==d||0!==o?(o<<=1,o|=d,(4===++s||0===n&&0===c)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}f=26}return a},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new S(e)},n(S,A),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,on)}(un);var di=un.exports,li=sn(di);let pi=!1,hi=!1;const mi={debug:1,default:2,info:2,warning:3,error:4,off:5};let bi=mi.default,yi=null;const gi=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var vi,wi;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(vi||(vi={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(wi||(wi={}));const _i="0123456789abcdef";let Ei=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==mi[r]&&this.throwArgumentError("invalid log level name","logLevel",e),bi>mi[r]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(hi)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=_i[t[e]>>4],r+=_i[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const a=t;let o="";switch(r){case wi.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case wi.CALL_EXCEPTION:case wi.INSUFFICIENT_FUNDS:case wi.MISSING_NEW:case wi.NONCE_EXPIRED:case wi.REPLACEMENT_UNDERPRICED:case wi.TRANSACTION_REPLACED:case wi.UNPREDICTABLE_GAS_LIMIT:o=r}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=a,s.code=r,Object.keys(n).forEach((function(e){s[e]=n[e]})),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){gi&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:gi})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return yi||(yi=new e("logger/5.7.0")),yi}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),pi){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}hi=!!t,pi=!!r}static setLogLevel(t){const r=mi[t.toLowerCase()];null!=r?bi=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};Ei.errors=wi,Ei.levels=vi;var Ti=Object.freeze({__proto__:null,get ErrorCode(){return wi},get LogLevel(){return vi},Logger:Ei});const Ai=new Ei("bytes/5.7.0");function Si(e){return!!e.toHexString}function ki(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return ki(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Oi(e){return Mi(e)&&!(e.length%2)||xi(e)}function Ri(e){return"number"==typeof e&&e==e&&e%1==0}function xi(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Ri(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!Ri(r)||r<0||r>=256)return!1}return!0}function Ii(e,t){if(t||(t={}),"number"==typeof e){Ai.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),ki(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Si(e)&&(e=e.toHexString()),Mi(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":Ai.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return ki(new Uint8Array(n))}return xi(e)?ki(new Uint8Array(e)):Ai.throwArgumentError("invalid arrayify value","value",e)}function Ci(e){const t=e.map((e=>Ii(e))),r=t.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(r);return t.reduce(((e,t)=>(n.set(t,e),e+t.length)),0),ki(n)}function Ni(e){let t=Ii(e);if(0===t.length)return t;let r=0;for(;r<t.length&&0===t[r];)r++;return r&&(t=t.slice(r)),t}function Pi(e,t){(e=Ii(e)).length>t&&Ai.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),ki(r)}function Mi(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const Bi="0123456789abcdef";function Di(e,t){if(t||(t={}),"number"==typeof e){Ai.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Bi[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Si(e))return e.toHexString();if(Mi(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":Ai.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(xi(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=Bi[(240&n)>>4]+Bi[15&n]}return t}return Ai.throwArgumentError("invalid hexlify value","value",e)}function Fi(e){if("string"!=typeof e)e=Di(e);else if(!Mi(e)||e.length%2)return null;return(e.length-2)/2}function Li(e,t,r){return"string"!=typeof e?e=Di(e):(!Mi(e)||e.length%2)&&Ai.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function Ui(e){let t="0x";return e.forEach((e=>{t+=Di(e).substring(2)})),t}function ji(e){const t=qi(Di(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function qi(e){"string"!=typeof e&&(e=Di(e)),Mi(e)||Ai.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}function zi(e,t){for("string"!=typeof e?e=Di(e):Mi(e)||Ai.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Ai.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function Hi(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Oi(e)){let r=Ii(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=Di(r.slice(0,32)),t.s=Di(r.slice(32,64))):65===r.length?(t.r=Di(r.slice(0,32)),t.s=Di(r.slice(32,64)),t.v=r[64]):Ai.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:Ai.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=Di(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const r=Pi(Ii(t._vs),32);t._vs=Di(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&Ai.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=Di(r);null==t.s?t.s=i:t.s!==i&&Ai.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?Ai.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const r=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==r&&Ai.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&Mi(t.r)?t.r=zi(t.r,32):Ai.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&Mi(t.s)?t.s=zi(t.s,32):Ai.throwArgumentError("signature missing or invalid s","signature",e);const r=Ii(t.s);r[0]>=128&&Ai.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=Di(r);t._vs&&(Mi(t._vs)||Ai.throwArgumentError("signature invalid _vs","signature",e),t._vs=zi(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&Ai.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function Vi(e){return Di(Ci([(e=Hi(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var Gi=Object.freeze({__proto__:null,arrayify:Ii,concat:Ci,hexConcat:Ui,hexDataLength:Fi,hexDataSlice:Li,hexStripZeros:qi,hexValue:ji,hexZeroPad:zi,hexlify:Di,isBytes:xi,isBytesLike:Oi,isHexString:Mi,joinSignature:Vi,splitSignature:Hi,stripZeros:Ni,zeroPad:Pi});const Ki="bignumber/5.7.0";var Wi=li.BN;const Xi=new Ei(Ki),$i={},Ji=9007199254740991;let Yi=!1,Qi=class e{constructor(e,t){e!==$i&&Xi.throwError("cannot call constructor directly; use BigNumber.from",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return ea(ta(this).fromTwos(e))}toTwos(e){return ea(ta(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return ea(ta(this).add(ta(e)))}sub(e){return ea(ta(this).sub(ta(e)))}div(t){return e.from(t).isZero()&&ra("division-by-zero","div"),ea(ta(this).div(ta(t)))}mul(e){return ea(ta(this).mul(ta(e)))}mod(e){const t=ta(e);return t.isNeg()&&ra("division-by-zero","mod"),ea(ta(this).umod(t))}pow(e){const t=ta(e);return t.isNeg()&&ra("negative-power","pow"),ea(ta(this).pow(t))}and(e){const t=ta(e);return(this.isNegative()||t.isNeg())&&ra("unbound-bitwise-result","and"),ea(ta(this).and(t))}or(e){const t=ta(e);return(this.isNegative()||t.isNeg())&&ra("unbound-bitwise-result","or"),ea(ta(this).or(t))}xor(e){const t=ta(e);return(this.isNegative()||t.isNeg())&&ra("unbound-bitwise-result","xor"),ea(ta(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&ra("negative-width","mask"),ea(ta(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&ra("negative-width","shl"),ea(ta(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&ra("negative-width","shr"),ea(ta(this).shrn(e))}eq(e){return ta(this).eq(ta(e))}lt(e){return ta(this).lt(ta(e))}lte(e){return ta(this).lte(ta(e))}gt(e){return ta(this).gt(ta(e))}gte(e){return ta(this).gte(ta(e))}isNegative(){return"-"===this._hex[0]}isZero(){return ta(this).isZero()}toNumber(){try{return ta(this).toNumber()}catch(e){ra("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Xi.throwError("this platform does not support BigInt",Ei.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Yi||(Yi=!0,Xi.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Xi.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ei.errors.UNEXPECTED_ARGUMENT,{}):Xi.throwError("BigNumber.toString does not accept parameters",Ei.errors.UNEXPECTED_ARGUMENT,{})),ta(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e($i,Zi(t)):t.match(/^-?[0-9]+$/)?new e($i,Zi(new Wi(t))):Xi.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&ra("underflow","BigNumber.from",t),(t>=Ji||t<=-Ji)&&ra("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(xi(r))return e.from(Di(r));if(r)if(r.toHexString){const t=r.toHexString();if("string"==typeof t)return e.from(t)}else{let t=r._hex;if(null==t&&"BigNumber"===r.type&&(t=r.hex),"string"==typeof t&&(Mi(t)||"-"===t[0]&&Mi(t.substring(1))))return e.from(t)}return Xi.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function Zi(e){if("string"!=typeof e)return Zi(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Xi.throwArgumentError("invalid hex","value",e),"0x00"===(e=Zi(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function ea(e){return Qi.from(Zi(e))}function ta(e){const t=Qi.from(e).toHexString();return"-"===t[0]?new Wi("-"+t.substring(3),16):new Wi(t.substring(2),16)}function ra(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Xi.throwError(e,Ei.errors.NUMERIC_FAULT,n)}const na=new Ei(Ki),ia={},aa=Qi.from(0),oa=Qi.from(-1);function sa(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),na.throwError(e,Ei.errors.NUMERIC_FAULT,i)}let fa="0";for(;fa.length<256;)fa+=fa;function ua(e){if("number"!=typeof e)try{e=Qi.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+fa.substring(0,e):na.throwArgumentError("invalid decimal size","decimals",e)}function ca(e,t){null==t&&(t=0);const r=ua(t),n=(e=Qi.from(e)).lt(aa);n&&(e=e.mul(oa));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=e.div(r).toString();return e=1===r.length?a:a+"."+i,n&&(e="-"+e),e}function da(e,t){null==t&&(t=0);const r=ua(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||na.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&na.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&na.throwArgumentError("too many decimal points","value",e);let a=i[0],o=i[1];for(a||(a="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>r.length-1&&sa("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=Qi.from(a),f=Qi.from(o);let u=s.mul(r).add(f);return n&&(u=u.mul(oa)),u}class la{constructor(e,t,r,n){e!==ia&&na.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=ua(n),Object.freeze(this)}static from(e){if(e instanceof la)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,r=128,n=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||na.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(e){const i=(t,r,n)=>null==e[t]?n:(typeof e[t]!==r&&na.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&na.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&na.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new la(ia,t,r,n)}}class pa{constructor(e,t,r,n){e!==ia&&na.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&na.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=da(this._value,this.format.decimals),r=da(e._value,e.format.decimals);return pa.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=da(this._value,this.format.decimals),r=da(e._value,e.format.decimals);return pa.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=da(this._value,this.format.decimals),r=da(e._value,e.format.decimals);return pa.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=da(this._value,this.format.decimals),r=da(e._value,e.format.decimals);return pa.fromValue(t.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=pa.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(ha.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=pa.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(ha.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&na.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=pa.from("1"+fa.substring(0,e),this.format),n=ma.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&na.throwArgumentError("invalid byte width","width",e);return zi(Qi.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return pa.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(Qi.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Mi(e)||"bigint"==typeof e||xi(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),pa.fromString(ca(e,t),la.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=la.from(t),n=da(e,r.decimals);!r.signed&&n.lt(aa)&&sa("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=zi(i,r.width/8));const a=ca(n,r.decimals);return new pa(ia,i,a,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=la.from(t);if(Ii(e).length>r.width/8)throw new Error("overflow");let n=Qi.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),a=ca(n,r.decimals);return new pa(ia,i,a,r)}static from(e,t){if("string"==typeof e)return pa.fromString(e,t);if(xi(e))return pa.fromBytes(e,t);try{return pa.fromValue(e,0,t)}catch(e){if(e.code!==Ei.errors.INVALID_ARGUMENT)throw e}return na.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const ha=pa.from(1),ma=pa.from("0.5");var ba=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{f(n.next(e))}catch(e){a(e)}}function s(e){try{f(n.throw(e))}catch(e){a(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}f((n=n.apply(e,t||[])).next())}))};const ya=new Ei("properties/5.7.0");function ga(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function va(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function wa(e){return ba(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const r=e[t];return Promise.resolve(r).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function _a(e,t){e&&"object"==typeof e||ya.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||ya.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}function Ea(e){const t={};for(const r in e)t[r]=e[r];return t}const Ta={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Aa(e){if(null==e||Ta[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;r<t.length;r++){let n=null;try{n=e[t[r]]}catch(e){continue}if(!Aa(n))return!1}return!0}return ya.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Sa(e){if(Aa(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>ka(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&ga(t,r,ka(n))}return t}return ya.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function ka(e){return Sa(e)}let Oa=class{constructor(e){for(const t in e)this[t]=ka(e[t])}};var Ra=Object.freeze({__proto__:null,Description:Oa,checkProperties:_a,deepCopy:ka,defineReadOnly:ga,getStatic:va,resolveProperties:wa,shallowCopy:Ea});const xa="abi/5.7.0",Ia=new Ei(xa),Ca={};let Na={calldata:!0,memory:!0,storage:!0},Pa={calldata:!0,memory:!0};function Ma(e,t){if("bytes"===e||"string"===e){if(Na[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Pa[t])return!0;return(Na[t]||"payable"===t)&&Ia.throwArgumentError("invalid modifier","name",t),!1}function Ba(e,t){for(let r in t)ga(e,r,t[r])}const Da=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Fa=new RegExp(/^(.*)\[([0-9]*)\]$/);let La=class e{constructor(t,r){t!==Ca&&Ia.throwError("use fromString",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Ba(this,r);let n=this.type.match(Fa);Ba(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:e.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=Da.sighash),Da[e]||Ia.throwArgumentError("invalid format type","format",e),e===Da.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((t=>JSON.parse(t.format(e))))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==Da.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===Da.full?", ":",")+")"):t+=this.type,e!==Da.sighash&&(!0===this.indexed&&(t+=" indexed"),e===Da.full&&this.name&&(t+=" "+this.name)),t}static from(t,r){return"string"==typeof t?e.fromString(t,r):e.fromObject(t)}static fromObject(t){return e.isParamType(t)?t:new e(Ca,{name:t.name||null,type:$a(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(e.fromObject):null})}static fromString(t,r){return n=function(e,t){let r=e;function n(t){Ia.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");let a={type:"",name:"",state:{allowType:!0}},o=a;for(let r=0;r<e.length;r++){let a=e[r];switch(a){case"(":o.state.allowType&&""===o.type?o.type="tuple":o.state.allowParams||n(r),o.state.allowType=!1,o.type=$a(o.type),o.components=[i(o)],o=o.components[0];break;case")":delete o.state,"indexed"===o.name&&(t||n(r),o.indexed=!0,o.name=""),Ma(o.type,o.name)&&(o.name=""),o.type=$a(o.type);let e=o;o=o.parent,o||n(r),delete e.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,"indexed"===o.name&&(t||n(r),o.indexed=!0,o.name=""),Ma(o.type,o.name)&&(o.name=""),o.type=$a(o.type);let s=i(o.parent);o.parent.components.push(s),delete o.parent,o=s;break;case" ":o.state.allowType&&""!==o.type&&(o.type=$a(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&("indexed"===o.name?(t||n(r),o.indexed&&n(r),o.indexed=!0,o.name=""):Ma(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||n(r),o.type+=a,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(r),o.type+=a,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=a,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=a,delete o.state.allowArray):o.state.readArray?o.type+=a:n(r)}}return o.parent&&Ia.throwArgumentError("unexpected eof","param",e),delete a.state,"indexed"===o.name?(t||n(r.length-7),o.indexed&&n(r.length-7),o.indexed=!0,o.name=""):Ma(o.type,o.name)&&(o.name=""),a.type=$a(a.type),a}(t,!!r),e.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}static isParamType(e){return!(null==e||!e._isParamType)}};function Ua(e,t){return function(e){e=e.trim();let t=[],r="",n=0;for(let i=0;i<e.length;i++){let a=e[i];","===a&&0===n?(t.push(r),r=""):(r+=a,"("===a?n++:")"===a&&(n--,-1===n&&Ia.throwArgumentError("unbalanced parenthesis","value",e)))}r&&t.push(r);return t}(e).map((e=>La.fromString(e,t)))}let ja=class e{constructor(e,t){e!==Ca&&Ia.throwError("use a static from method",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Ba(this,t),this._isFragment=!0,Object.freeze(this)}static from(t){return e.isFragment(t)?t:"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isFragment(t))return t;switch(t.type){case"function":return Ka.fromObject(t);case"event":return qa.fromObject(t);case"constructor":return Ga.fromObject(t);case"error":return Xa.fromObject(t);case"fallback":case"receive":return null}return Ia.throwArgumentError("invalid fragment object","value",t)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?qa.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Ka.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Ga.fromString(e.trim()):"error"===e.split(" ")[0]?Xa.fromString(e.substring(5).trim()):Ia.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}},qa=class e extends ja{format(e){if(e||(e=Da.sighash),Da[e]||Ia.throwArgumentError("invalid format type","format",e),e===Da.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Da.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Da.full?", ":",")+") ",e!==Da.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isEventFragment(t))return t;"event"!==t.type&&Ia.throwArgumentError("invalid event object","value",t);const r={name:Ya(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(La.fromObject):[],type:"event"};return new e(Ca,r)}static fromString(t){let r=t.match(Qa);r||Ia.throwArgumentError("invalid event string","value",t);let n=!1;return r[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":n=!0;break;case"":break;default:Ia.warn("unknown modifier: "+e)}})),e.fromObject({name:r[1].trim(),anonymous:n,inputs:Ua(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}};function za(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&Ia.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||Ia.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Qi.from(r[1]),r[0]):e}function Ha(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function Va(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&Ia.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&Ia.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||Ia.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&Ia.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&Ia.throwArgumentError("unable to determine stateMutability","value",e),t}let Ga=class e extends ja{format(e){if(e||(e=Da.sighash),Da[e]||Ia.throwArgumentError("invalid format type","format",e),e===Da.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});e===Da.sighash&&Ia.throwError("cannot format a constructor for sighash",Ei.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===Da.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isConstructorFragment(t))return t;"constructor"!==t.type&&Ia.throwArgumentError("invalid constructor object","value",t);let r=Va(t);r.constant&&Ia.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(La.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Qi.from(t.gas):null};return new e(Ca,n)}static fromString(t){let r={type:"constructor"},n=(t=za(t,r)).match(Qa);return n&&"constructor"===n[1].trim()||Ia.throwArgumentError("invalid constructor string","value",t),r.inputs=Ua(n[2].trim(),!1),Ha(n[3].trim(),r),e.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}},Ka=class e extends Ga{format(e){if(e||(e=Da.sighash),Da[e]||Ia.throwArgumentError("invalid format type","format",e),e===Da.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e)))),outputs:this.outputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Da.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Da.full?", ":",")+") ",e!==Da.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((t=>t.format(e))).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isFunctionFragment(t))return t;"function"!==t.type&&Ia.throwArgumentError("invalid function object","value",t);let r=Va(t);const n={type:t.type,name:Ya(t.name),constant:r.constant,inputs:t.inputs?t.inputs.map(La.fromObject):[],outputs:t.outputs?t.outputs.map(La.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Qi.from(t.gas):null};return new e(Ca,n)}static fromString(t){let r={type:"function"},n=(t=za(t,r)).split(" returns ");n.length>2&&Ia.throwArgumentError("invalid function string","value",t);let i=n[0].match(Qa);if(i||Ia.throwArgumentError("invalid function signature","value",t),r.name=i[1].trim(),r.name&&Ya(r.name),r.inputs=Ua(i[2],!1),Ha(i[3].trim(),r),n.length>1){let e=n[1].match(Qa);""==e[1].trim()&&""==e[3].trim()||Ia.throwArgumentError("unexpected tokens","value",t),r.outputs=Ua(e[2],!1)}else r.outputs=[];return e.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}};function Wa(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||Ia.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}let Xa=class e extends ja{format(e){if(e||(e=Da.sighash),Da[e]||Ia.throwArgumentError("invalid format type","format",e),e===Da.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Da.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Da.full?", ":",")+") ",t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isErrorFragment(t))return t;"error"!==t.type&&Ia.throwArgumentError("invalid error object","value",t);const r={type:t.type,name:Ya(t.name),inputs:t.inputs?t.inputs.map(La.fromObject):[]};return Wa(new e(Ca,r))}static fromString(t){let r={type:"error"},n=t.match(Qa);return n||Ia.throwArgumentError("invalid error signature","value",t),r.name=n[1].trim(),r.name&&Ya(r.name),r.inputs=Ua(n[2],!1),Wa(e.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}};function $a(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const Ja=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ya(e){return e&&e.match(Ja)||Ia.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const Qa=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Za=new Ei(xa);function eo(e){const t=[],r=function(e,n){if(Array.isArray(n))for(let i in n){const a=e.slice();a.push(i);try{r(a,n[i])}catch(e){t.push({path:a,error:e})}}};return r([],e),t}let to=class{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){Za.throwArgumentError(e,this.localName,t)}},ro=class{constructor(e){ga(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return Ui(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(Ci(e._data))}writeBytes(e){let t=Ii(e);const r=t.length%this.wordSize;return r&&(t=Ci([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=Ii(Qi.from(e));return t.length>this.wordSize&&Za.throwError("value out-of-bounds",Ei.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Ci([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}};var no={exports:{}};
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).immutable={})}(this,(function(e){"use strict";e.Environment=void 0,function(e){e.PRODUCTION="production",e.SANDBOX="sandbox"}(e.Environment||(e.Environment={}));class t{environment;apiKey;constructor(e){this.environment=e.environment,this.apiKey=e.apiKey}}function r(e,t){return function(){return e.apply(t,arguments)}}const{toString:n}=Object.prototype,{getPrototypeOf:i}=Object,a=(o=Object.create(null),e=>{const t=n.call(e);return o[t]||(o[t]=t.slice(8,-1).toLowerCase())});var o;const s=e=>(e=e.toLowerCase(),t=>a(t)===e),f=e=>t=>typeof t===e,{isArray:u}=Array,c=f("undefined");const d=s("ArrayBuffer");const l=f("string"),p=f("function"),h=f("number"),m=e=>null!==e&&"object"==typeof e,b=e=>{if("object"!==a(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},y=s("Date"),g=s("File"),v=s("Blob"),w=s("FileList"),_=s("URLSearchParams");function E(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),u(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function T(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,S=e=>!c(e)&&e!==A;const k=(O="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>O&&e instanceof O);var O;const R=s("HTMLFormElement"),x=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),I=s("RegExp"),C=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};E(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},N="abcdefghijklmnopqrstuvwxyz",P="0123456789",M={DIGIT:P,ALPHA:N,ALPHA_DIGIT:N+N.toUpperCase()+P};const B=s("AsyncFunction");var D={isArray:u,isArrayBuffer:d,isBuffer:function(e){return null!==e&&!c(e)&&null!==e.constructor&&!c(e.constructor)&&p(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||p(e.append)&&("formdata"===(t=a(e))||"object"===t&&p(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&d(e.buffer),t},isString:l,isNumber:h,isBoolean:e=>!0===e||!1===e,isObject:m,isPlainObject:b,isUndefined:c,isDate:y,isFile:g,isBlob:v,isRegExp:I,isFunction:p,isStream:e=>m(e)&&p(e.pipe),isURLSearchParams:_,isTypedArray:k,isFileList:w,forEach:E,merge:function e(){const{caseless:t}=S(this)&&this||{},r={},n=(n,i)=>{const a=t&&T(r,i)||i;b(r[a])&&b(n)?r[a]=e(r[a],n):b(n)?r[a]=e({},n):u(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&E(arguments[e],n);return r},extend:(e,t,n,{allOwnKeys:i}={})=>(E(t,((t,i)=>{n&&p(t)?e[i]=r(t,n):e[i]=t}),{allOwnKeys:i}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let a,o,s;const f={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)s=a[o],n&&!n(s,e,t)||f[s]||(t[s]=e[s],f[s]=!0);e=!1!==r&&i(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:a,kindOfTest:s,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(u(e))return e;let t=e.length;if(!h(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:R,hasOwnProperty:x,hasOwnProp:x,reduceDescriptors:C,freezeMethods:e=>{C(e,((t,r)=>{if(p(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];p(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return u(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:T,global:A,isContextDefined:S,ALPHABET:M,generateString:(e=16,t=M.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&p(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(m(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=u(e)?[]:{};return E(e,((e,t)=>{const a=r(e,n+1);!c(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:B,isThenable:e=>e&&(m(e)||p(e))&&p(e.then)&&p(e.catch)};function F(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}D.inherits(F,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:D.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const L=F.prototype,U={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{U[e]={value:e}})),Object.defineProperties(F,U),Object.defineProperty(L,"isAxiosError",{value:!0}),F.from=(e,t,r,n,i,a)=>{const o=Object.create(L);return D.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),F.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function j(e){return D.isPlainObject(e)||D.isArray(e)}function q(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function z(e,t,r){return e?e.concat(t).map((function(e,t){return e=q(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const H=D.toFlatObject(D,{},null,(function(e){return/^is[A-Z]/.test(e)}));function V(e,t,r){if(!D.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=D.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!D.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&D.isSpecCompliantForm(t);if(!D.isFunction(i))throw new TypeError("visitor must be a function");function f(e){if(null===e)return"";if(D.isDate(e))return e.toISOString();if(!s&&D.isBlob(e))throw new F("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(e)||D.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(D.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(D.isArray(e)&&function(e){return D.isArray(e)&&!e.some(j)}(e)||(D.isFileList(e)||D.endsWith(r,"[]"))&&(s=D.toArray(e)))return r=q(r),s.forEach((function(e,n){!D.isUndefined(e)&&null!==e&&t.append(!0===o?z([r],n,a):null===o?r:r+"[]",f(e))})),!1;return!!j(e)||(t.append(z(i,r,a),f(e)),!1)}const c=[],d=Object.assign(H,{defaultVisitor:u,convertValue:f,isVisitable:j});if(!D.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!D.isUndefined(r)){if(-1!==c.indexOf(r))throw Error("Circular reference detected in "+n.join("."));c.push(r),D.forEach(r,(function(r,a){!0===(!(D.isUndefined(r)||null===r)&&i.call(t,r,D.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),c.pop()}}(e),t}function G(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function K(e,t){this._pairs=[],e&&V(e,this,t)}const W=K.prototype;function X(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $(e,t,r){if(!t)return e;const n=r&&r.encode||X,i=r&&r.serialize;let a;if(a=i?i(t,r):D.isURLSearchParams(t)?t.toString():new K(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}W.append=function(e,t){this._pairs.push([e,t])},W.toString=function(e){const t=e?function(t){return e.call(this,t,G)}:G;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var J=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){D.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Y={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Q={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:K,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function Z(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&D.isArray(n)?n.length:a,s)return D.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&D.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&D.isArray(n[a])&&(n[a]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}(n[a])),!o}if(D.isFormData(e)&&D.isFunction(e.entries)){const r={};return D.forEachEntry(e,((e,n)=>{t(function(e){return D.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const ee={"Content-Type":void 0};const te={transitional:Y,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=D.isObject(e);i&&D.isHTMLForm(e)&&(e=new FormData(e));if(D.isFormData(e))return n&&n?JSON.stringify(Z(e)):e;if(D.isArrayBuffer(e)||D.isBuffer(e)||D.isStream(e)||D.isFile(e)||D.isBlob(e))return e;if(D.isArrayBufferView(e))return e.buffer;if(D.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return V(e,new Q.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Q.isNode&&D.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=D.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return V(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(D.isString(e))try{return(t||JSON.parse)(e),D.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||te.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&D.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw F.from(e,F.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Q.classes.FormData,Blob:Q.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};D.forEach(["delete","get","head"],(function(e){te.headers[e]={}})),D.forEach(["post","put","patch"],(function(e){te.headers[e]=D.merge(ee)}));var re=te;const ne=D.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const ie=Symbol("internals");function ae(e){return e&&String(e).trim().toLowerCase()}function oe(e){return!1===e||null==e?e:D.isArray(e)?e.map(oe):String(e)}function se(e,t,r,n,i){return D.isFunction(n)?n.call(this,t,r):(i&&(t=r),D.isString(t)?D.isString(n)?-1!==t.indexOf(n):D.isRegExp(n)?n.test(t):void 0:void 0)}let fe=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=ae(t);if(!i)throw new Error("header name must be a non-empty string");const a=D.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=oe(e))}const a=(e,t)=>D.forEach(e,((e,r)=>i(e,r,t)));return D.isPlainObject(e)||e instanceof this.constructor?a(e,t):D.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?a((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&ne[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=ae(e)){const r=D.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(D.isFunction(t))return t.call(this,e,r);if(D.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ae(e)){const r=D.findKey(this,e);return!(!r||void 0===this[r]||t&&!se(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=ae(e)){const i=D.findKey(r,e);!i||t&&!se(0,r[i],i,t)||(delete r[i],n=!0)}}return D.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!se(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return D.forEach(this,((n,i)=>{const a=D.findKey(r,i);if(a)return t[a]=oe(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=oe(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return D.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&D.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[ie]=this[ie]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=ae(e);t[n]||(!function(e,t){const r=D.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return D.isArray(e)?e.forEach(n):n(e),this}};fe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),D.freezeMethods(fe.prototype),D.freezeMethods(fe);var ue=fe;function ce(e,t){const r=this||re,n=t||r,i=ue.from(n.headers);let a=n.data;return D.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function de(e){return!(!e||!e.__CANCEL__)}function le(e,t,r){F.call(this,null==e?"canceled":e,F.ERR_CANCELED,t,r),this.name="CanceledError"}D.inherits(le,F,{__CANCEL__:!0});var pe=Q.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),D.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),D.isString(n)&&o.push("path="+n),D.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function he(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var me=Q.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=D.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function be(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,o=0;return t=void 0!==t?t:1e3,function(s){const f=Date.now(),u=n[o];i||(i=f),r[a]=s,n[a]=f;let c=o,d=0;for(;c!==a;)d+=r[c++],c%=e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),f-i<t)return;const l=u&&f-u;return l?Math.round(1e3*d/l):void 0}}(50,250);return i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,s=a-r,f=n(s);r=a;const u={loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:f||void 0,estimated:f&&o&&a<=o?(o-a)/f:void 0,event:i};u[t?"download":"upload"]=!0,e(u)}}var ye="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=ue.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}D.isFormData(n)&&(Q.isStandardBrowserEnv||Q.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let f=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const u=he(e.baseURL,e.url);function c(){if(!f)return;const n=ue.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new F("Request failed with status code "+r.status,[F.ERR_BAD_REQUEST,F.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),s()}),(function(e){r(e),s()}),{data:a&&"text"!==a&&"json"!==a?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:n,config:e,request:f}),f=null}if(f.open(e.method.toUpperCase(),$(u,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,"onloadend"in f?f.onloadend=c:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(c)},f.onabort=function(){f&&(r(new F("Request aborted",F.ECONNABORTED,e,f)),f=null)},f.onerror=function(){r(new F("Network Error",F.ERR_NETWORK,e,f)),f=null},f.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Y;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new F(t,n.clarifyTimeoutError?F.ETIMEDOUT:F.ECONNABORTED,e,f)),f=null},Q.isStandardBrowserEnv){const t=(e.withCredentials||me(u))&&e.xsrfCookieName&&pe.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in f&&D.forEach(i.toJSON(),(function(e,t){f.setRequestHeader(t,e)})),D.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&"json"!==a&&(f.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",be(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",be(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{f&&(r(!t||t.type?new le(null,e,f):t),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===Q.protocols.indexOf(d)?r(new F("Unsupported protocol "+d+":",F.ERR_BAD_REQUEST,e)):f.send(n||null)}))};const ge={http:null,xhr:ye};D.forEach(ge,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var ve=e=>{e=D.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=D.isString(r)?ge[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new F(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(D.hasOwnProp(ge,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!D.isFunction(n))throw new TypeError("adapter is not a function");return n};function we(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new le(null,e)}function _e(e){we(e),e.headers=ue.from(e.headers),e.data=ce.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ve(e.adapter||re.adapter)(e).then((function(t){return we(e),t.data=ce.call(e,e.transformResponse,t),t.headers=ue.from(t.headers),t}),(function(t){return de(t)||(we(e),t&&t.response&&(t.response.data=ce.call(e,e.transformResponse,t.response),t.response.headers=ue.from(t.response.headers))),Promise.reject(t)}))}const Ee=e=>e instanceof ue?e.toJSON():e;function Te(e,t){t=t||{};const r={};function n(e,t,r){return D.isPlainObject(e)&&D.isPlainObject(t)?D.merge.call({caseless:r},e,t):D.isPlainObject(t)?D.merge({},t):D.isArray(t)?t.slice():t}function i(e,t,r){return D.isUndefined(t)?D.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!D.isUndefined(t))return n(void 0,t)}function o(e,t){return D.isUndefined(t)?D.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,a){return a in t?n(r,i):a in e?n(void 0,r):void 0}const f={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(e,t)=>i(Ee(e),Ee(t),!0)};return D.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=f[n]||i,o=a(e[n],t[n],n);D.isUndefined(o)&&a!==s||(r[n]=o)})),r}const Ae="1.4.0",Se={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Se[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const ke={};Se.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,a)=>{if(!1===e)throw new F(n(i," has been removed"+(t?" in "+t:"")),F.ERR_DEPRECATED);return t&&!ke[i]&&(ke[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}};var Oe={assertOptions:function(e,t,r){if("object"!=typeof e)throw new F("options must be an object",F.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],o=t[a];if(o){const t=e[a],r=void 0===t||o(t,a,e);if(!0!==r)throw new F("option "+a+" must be "+r,F.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new F("Unknown option "+a,F.ERR_BAD_OPTION)}},validators:Se};const Re=Oe.validators;let xe=class{constructor(e){this.defaults=e,this.interceptors={request:new J,response:new J}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Te(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&Oe.assertOptions(r,{silentJSONParsing:Re.transitional(Re.boolean),forcedJSONParsing:Re.transitional(Re.boolean),clarifyTimeoutError:Re.transitional(Re.boolean)},!1),null!=n&&(D.isFunction(n)?t.paramsSerializer={serialize:n}:Oe.assertOptions(n,{encode:Re.function,serialize:Re.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&D.merge(i.common,i[t.method]),a&&D.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=ue.concat(a,i);const o=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const f=[];let u;this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)}));let c,d=0;if(!s){const e=[_e.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,f),c=e.length,u=Promise.resolve(t);d<c;)u=u.then(e[d++],e[d++]);return u}c=o.length;let l=t;for(d=0;d<c;){const e=o[d++],t=o[d++];try{l=e(l)}catch(e){t.call(this,e);break}}try{u=_e.call(this,l)}catch(e){return Promise.reject(e)}for(d=0,c=f.length;d<c;)u=u.then(f[d++],f[d++]);return u}getUri(e){return $(he((e=Te(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};D.forEach(["delete","get","head","options"],(function(e){xe.prototype[e]=function(t,r){return this.request(Te(r||{},{method:e,url:t,data:(r||{}).data}))}})),D.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(Te(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}xe.prototype[e]=t(),xe.prototype[e+"Form"]=t(!0)}));var Ie=xe;var Ce=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new le(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let t;const r=new e((function(e){t=e}));return{token:r,cancel:t}}};const Ne={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ne).forEach((([e,t])=>{Ne[t]=e}));var Pe=Ne;const Me=function e(t){const n=new Ie(t),i=r(Ie.prototype.request,n);return D.extend(i,Ie.prototype,n,{allOwnKeys:!0}),D.extend(i,n,null,{allOwnKeys:!0}),i.create=function(r){return e(Te(t,r))},i}(re);Me.Axios=Ie,Me.CanceledError=le,Me.CancelToken=Ce,Me.isCancel=de,Me.VERSION=Ae,Me.toFormData=V,Me.AxiosError=F,Me.Cancel=Me.CanceledError,Me.all=function(e){return Promise.all(e)},Me.spread=function(e){return function(t){return e.apply(null,t)}},Me.isAxiosError=function(e){return D.isObject(e)&&!0===e.isAxiosError},Me.mergeConfig=Te,Me.AxiosHeaders=ue,Me.formToJSON=e=>Z(D.isHTMLForm(e)?new FormData(e):e),Me.HttpStatusCode=Pe,Me.default=Me;var Be=Me;const De="https://indexer-mr.sandbox.imtbl.com".replace(/\/+$/,"");let Fe=class{basePath;axios;configuration;constructor(e,t=De,r=Be){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}},Le=class extends Error{field;name="RequiredError";constructor(e,t){super(t),this.field=e}};const Ue="https://example.com",je=function(e,t,r){if(null==r)throw new Le(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function qe(e,t,r=""){"object"==typeof t?Array.isArray(t)?t.forEach((t=>qe(e,t,r))):Object.keys(t).forEach((n=>qe(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t)}const ze=function(e,...t){const r=new URLSearchParams(e.search);qe(r,t),e.search=r.toString()},He=function(e,t,r){const n="string"!=typeof e;return(n&&r&&r.isJsonMime?r.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},Ve=function(e){return e.pathname+e.search+e.hash},Ge=function(e,t,r,n){return(i=t,a=r)=>{const o={...e.options,url:(n?.basePath||a)+e.url};return i.request(o)}},Ke=function(e){return{getActivity:async(t,r,n={})=>{je("getActivity","chainName",t),je("getActivity","activityId",r);const i="/v1/chains/{chain_name}/activities/{activity_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{activity_id}",encodeURIComponent(String(r))),a=new URL(i,Ue);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};ze(a,{});let f=o&&o.headers?o.headers:{};return s.headers={...f,...n.headers},{url:Ve(a),options:s}},listActivities:async(t,r,n,i,a,o,s,f,u,c,d={})=>{je("listActivities","chainName",t);const l="/v1/chains/{chain_name}/activities".replace("{chain_name}",encodeURIComponent(String(t))),p=new URL(l,Ue);let h;e&&(h=e.baseOptions);const m={method:"GET",...h,...d},b={};void 0!==r&&(b.contract_address=r),void 0!==n&&(b.token_id=n),void 0!==i&&(b.account_address=i),void 0!==a&&(b.activity_type=a),void 0!==o&&(b.from_indexed_at=o instanceof Date?o.toISOString():o),void 0!==s&&(b.to_indexed_at=s instanceof Date?s.toISOString():s),void 0!==f&&(b.transaction_hash=f),void 0!==u&&(b.page_cursor=u),void 0!==c&&(b.page_size=c),ze(p,b);let y=h&&h.headers?h.headers:{};return m.headers={...y,...d.headers},{url:Ve(p),options:m}}}},We=function(e){const t=Ke(e);return{async getActivity(r,n,i){const a=await t.getActivity(r,n,i);return Ge(a,Be,De,e)},async listActivities(r,n,i,a,o,s,f,u,c,d,l){const p=await t.listActivities(r,n,i,a,o,s,f,u,c,d,l);return Ge(p,Be,De,e)}}};class Xe extends Fe{getActivity(e,t){return We(this.configuration).getActivity(e.chainName,e.activityId,t).then((e=>e(this.axios,this.basePath)))}listActivities(e,t){return We(this.configuration).listActivities(e.chainName,e.contractAddress,e.tokenId,e.accountAddress,e.activityType,e.fromIndexedAt,e.toIndexedAt,e.transactionHash,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const $e=function(e){return{listChains:async(t,r,n={})=>{const i=new URL("/v1/chains",Ue);let a;e&&(a=e.baseOptions);const o={method:"GET",...a,...n},s={};void 0!==t&&(s.page_cursor=t),void 0!==r&&(s.page_size=r),ze(i,s);let f=a&&a.headers?a.headers:{};return o.headers={...f,...n.headers},{url:Ve(i),options:o}}}},Je=function(e){const t=$e(e);return{async listChains(r,n,i){const a=await t.listChains(r,n,i);return Ge(a,Be,De,e)}}};class Ye extends Fe{listChains(e={},t){return Je(this.configuration).listChains(e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const Qe=function(e){return{getCollection:async(t,r,n={})=>{je("getCollection","contractAddress",t),je("getCollection","chainName",r);const i="/v1/chains/{chain_name}/collections/{contract_address}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),a=new URL(i,Ue);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};ze(a,{});let f=o&&o.headers?o.headers:{};return s.headers={...f,...n.headers},{url:Ve(a),options:s}},listCollections:async(t,r,n,i={})=>{je("listCollections","chainName",t);const a="/v1/chains/{chain_name}/collections".replace("{chain_name}",encodeURIComponent(String(t))),o=new URL(a,Ue);let s;e&&(s=e.baseOptions);const f={method:"GET",...s,...i},u={};void 0!==r&&(u.page_cursor=r),void 0!==n&&(u.page_size=n),ze(o,u);let c=s&&s.headers?s.headers:{};return f.headers={...c,...i.headers},{url:Ve(o),options:f}}}},Ze=function(e){const t=Qe(e);return{async getCollection(r,n,i){const a=await t.getCollection(r,n,i);return Ge(a,Be,De,e)},async listCollections(r,n,i,a){const o=await t.listCollections(r,n,i,a);return Ge(o,Be,De,e)}}};class et extends Fe{getCollection(e,t){return Ze(this.configuration).getCollection(e.contractAddress,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listCollections(e,t){return Ze(this.configuration).listCollections(e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const tt=function(e){return{listNFTOwners:async(t,r,n,i,a,o={})=>{je("listNFTOwners","contractAddress",t),je("listNFTOwners","tokenId",r),je("listNFTOwners","chainName",n);const s="/v1/chains/{chain_name}/collections/{contract_address}/nfts/{token_id}/owners".replace("{contract_address}",encodeURIComponent(String(t))).replace("{token_id}",encodeURIComponent(String(r))).replace("{chain_name}",encodeURIComponent(String(n))),f=new URL(s,Ue);let u;e&&(u=e.baseOptions);const c={method:"GET",...u,...o},d={};void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),ze(f,d);let l=u&&u.headers?u.headers:{};return c.headers={...l,...o.headers},{url:Ve(f),options:c}}}},rt=function(e){const t=tt(e);return{async listNFTOwners(r,n,i,a,o,s){const f=await t.listNFTOwners(r,n,i,a,o,s);return Ge(f,Be,De,e)}}};class nt extends Fe{listNFTOwners(e,t){return rt(this.configuration).listNFTOwners(e.contractAddress,e.tokenId,e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const it=function(e){return{getNFT:async(t,r,n,i={})=>{je("getNFT","contractAddress",t),je("getNFT","tokenId",r),je("getNFT","chainName",n);const a="/v1/chains/{chain_name}/collections/{contract_address}/nfts/{token_id}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{token_id}",encodeURIComponent(String(r))).replace("{chain_name}",encodeURIComponent(String(n))),o=new URL(a,Ue);let s;e&&(s=e.baseOptions);const f={method:"GET",...s,...i};ze(o,{});let u=s&&s.headers?s.headers:{};return f.headers={...u,...i.headers},{url:Ve(o),options:f}},listNFTs:async(t,r,n,i,a={})=>{je("listNFTs","contractAddress",t),je("listNFTs","chainName",r);const o="/v1/chains/{chain_name}/collections/{contract_address}/nfts".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),s=new URL(o,Ue);let f;e&&(f=e.baseOptions);const u={method:"GET",...f,...a},c={};void 0!==n&&(c.page_cursor=n),void 0!==i&&(c.page_size=i),ze(s,c);let d=f&&f.headers?f.headers:{};return u.headers={...d,...a.headers},{url:Ve(s),options:u}},listNFTsByAccountAddress:async(t,r,n,i,a,o={})=>{je("listNFTsByAccountAddress","accountAddress",t),je("listNFTsByAccountAddress","chainName",r);const s="/v1/chains/{chain_name}/accounts/{account_address}/nfts".replace("{account_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),f=new URL(s,Ue);let u;e&&(u=e.baseOptions);const c={method:"GET",...u,...o},d={};void 0!==n&&(d.contract_address=n),void 0!==i&&(d.page_cursor=i),void 0!==a&&(d.page_size=a),ze(f,d);let l=u&&u.headers?u.headers:{};return c.headers={...l,...o.headers},{url:Ve(f),options:c}}}},at=function(e){const t=it(e);return{async getNFT(r,n,i,a){const o=await t.getNFT(r,n,i,a);return Ge(o,Be,De,e)},async listNFTs(r,n,i,a,o){const s=await t.listNFTs(r,n,i,a,o);return Ge(s,Be,De,e)},async listNFTsByAccountAddress(r,n,i,a,o,s){const f=await t.listNFTsByAccountAddress(r,n,i,a,o,s);return Ge(f,Be,De,e)}}};class ot extends Fe{getNFT(e,t){return at(this.configuration).getNFT(e.contractAddress,e.tokenId,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listNFTs(e,t){return at(this.configuration).listNFTs(e.contractAddress,e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}listNFTsByAccountAddress(e,t){return at(this.configuration).listNFTsByAccountAddress(e.accountAddress,e.chainName,e.contractAddress,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}}const st=function(e){return{createListing:async(t,r,n={})=>{je("createListing","chainName",t),je("createListing","createListingRequestBody",r);const i="/v1/chains/{chain_name}/orders/listings".replace("{chain_name}",encodeURIComponent(String(t))),a=new URL(i,Ue);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},f={};f["Content-Type"]="application/json",ze(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...f,...u,...n.headers},s.data=He(r,s,e),{url:Ve(a),options:s}},getListing:async(t,r,n={})=>{je("getListing","chainName",t),je("getListing","listingId",r);const i="/v1/chains/{chain_name}/orders/listings/{listing_id}".replace("{chain_name}",encodeURIComponent(String(t))).replace("{listing_id}",encodeURIComponent(String(r))),a=new URL(i,Ue);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};ze(a,{});let f=o&&o.headers?o.headers:{};return s.headers={...f,...n.headers},{url:Ve(a),options:s}},listListings:async(t,r,n,i,a,o,s,f,u,c={})=>{je("listListings","chainName",t);const d="/v1/chains/{chain_name}/orders/listings".replace("{chain_name}",encodeURIComponent(String(t))),l=new URL(d,Ue);let p;e&&(p=e.baseOptions);const h={method:"GET",...p,...c},m={};void 0!==r&&(m.status=r),void 0!==n&&(m.sell_item_contract_address=n),void 0!==i&&(m.buy_item_contract_address=i),void 0!==a&&(m.sell_item_token_id=a),void 0!==o&&(m.page_size=o),void 0!==s&&(m.sort_by=s),void 0!==f&&(m.sort_direction=f),void 0!==u&&(m.page_cursor=u),ze(l,m);let b=p&&p.headers?p.headers:{};return h.headers={...b,...c.headers},{url:Ve(l),options:h}}}},ft=function(e){const t=st(e);return{async createListing(r,n,i){const a=await t.createListing(r,n,i);return Ge(a,Be,De,e)},async getListing(r,n,i){const a=await t.getListing(r,n,i);return Ge(a,Be,De,e)},async listListings(r,n,i,a,o,s,f,u,c,d){const l=await t.listListings(r,n,i,a,o,s,f,u,c,d);return Ge(l,Be,De,e)}}};class ut extends Fe{createListing(e,t){return ft(this.configuration).createListing(e.chainName,e.createListingRequestBody,t).then((e=>e(this.axios,this.basePath)))}getListing(e,t){return ft(this.configuration).getListing(e.chainName,e.listingId,t).then((e=>e(this.axios,this.basePath)))}listListings(e,t){return ft(this.configuration).listListings(e.chainName,e.status,e.sellItemContractAddress,e.buyItemContractAddress,e.sellItemTokenId,e.pageSize,e.sortBy,e.sortDirection,e.pageCursor,t).then((e=>e(this.axios,this.basePath)))}}const ct=function(e){return{createCounterfactualAddress:async(t,r={})=>{je("createCounterfactualAddress","createCounterfactualAddressRequest",t);const n=new URL("/passport-mr/v1/counterfactual-address",Ue);let i;e&&(i=e.baseOptions);const a={method:"POST",...i,...r},o={};await async function(e,t){if(t&&t.accessToken){const r="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+r}}(o,e),o["Content-Type"]="application/json",ze(n,{});let s=i&&i.headers?i.headers:{};return a.headers={...o,...s,...r.headers},a.data=He(t,a,e),{url:Ve(n),options:a}}}},dt=function(e){const t=ct(e);return{async createCounterfactualAddress(r,n){const i=await t.createCounterfactualAddress(r,n);return Ge(i,Be,De,e)}}};class lt extends Fe{createCounterfactualAddress(e,t){return dt(this.configuration).createCounterfactualAddress(e.createCounterfactualAddressRequest,t).then((e=>e(this.axios,this.basePath)))}}const pt=function(e){return{getERC20Token:async(t,r,n={})=>{je("getERC20Token","contractAddress",t),je("getERC20Token","chainName",r);const i="/v1/chains/{chain_name}/tokens/{contract_address}".replace("{contract_address}",encodeURIComponent(String(t))).replace("{chain_name}",encodeURIComponent(String(r))),a=new URL(i,Ue);let o;e&&(o=e.baseOptions);const s={method:"GET",...o,...n};ze(a,{});let f=o&&o.headers?o.headers:{};return s.headers={...f,...n.headers},{url:Ve(a),options:s}},listERC20Tokens:async(t,r,n,i={})=>{je("listERC20Tokens","chainName",t);const a="/v1/chains/{chain_name}/tokens".replace("{chain_name}",encodeURIComponent(String(t))),o=new URL(a,Ue);let s;e&&(s=e.baseOptions);const f={method:"GET",...s,...i},u={};void 0!==r&&(u.page_cursor=r),void 0!==n&&(u.page_size=n),ze(o,u);let c=s&&s.headers?s.headers:{};return f.headers={...c,...i.headers},{url:Ve(o),options:f}}}},ht=function(e){const t=pt(e);return{async getERC20Token(r,n,i){const a=await t.getERC20Token(r,n,i);return Ge(a,Be,De,e)},async listERC20Tokens(r,n,i,a){const o=await t.listERC20Tokens(r,n,i,a);return Ge(o,Be,De,e)}}};var mt=Object.freeze({__proto__:null,APIError400AllOfCodeEnum:{ValidationError:"VALIDATION_ERROR"},APIError401AllOfCodeEnum:{UnauthorisedRequest:"UNAUTHORISED_REQUEST"},APIError403AllOfCodeEnum:{AuthenticationError:"AUTHENTICATION_ERROR"},APIError404AllOfCodeEnum:{ResourceNotFound:"RESOURCE_NOT_FOUND"},APIError429AllOfCodeEnum:{TooManyRequestsError:"TOO_MANY_REQUESTS_ERROR"},APIError500AllOfCodeEnum:{InternalServerError:"INTERNAL_SERVER_ERROR"},ActivitiesApi:Xe,ActivitiesApiAxiosParamCreator:Ke,ActivitiesApiFactory:function(e,t,r){const n=We(e);return{getActivity:(e,i,a)=>n.getActivity(e,i,a).then((e=>e(r,t))),listActivities:(e,i,a,o,s,f,u,c,d,l,p)=>n.listActivities(e,i,a,o,s,f,u,c,d,l,p).then((e=>e(r,t)))}},ActivitiesApiFp:We,ActivityType:{Mint:"mint",Burn:"burn",Transfer:"transfer",Sale:"sale"},ChainsApi:Ye,ChainsApiAxiosParamCreator:$e,ChainsApiFactory:function(e,t,r){const n=Je(e);return{listChains:(e,i,a)=>n.listChains(e,i,a).then((e=>e(r,t)))}},ChainsApiFp:Je,CollectionContractType:{Erc721:"ERC721"},CollectionsApi:et,CollectionsApiAxiosParamCreator:Qe,CollectionsApiFactory:function(e,t,r){const n=Ze(e);return{getCollection:(e,i,a)=>n.getCollection(e,i,a).then((e=>e(r,t))),listCollections:(e,i,a,o)=>n.listCollections(e,i,a,o).then((e=>e(r,t)))}},CollectionsApiFp:Ze,Configuration:class{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}},CreateOrderProtocolDataOrderTypeEnum:{FullRestricted:"FULL_RESTRICTED"},ERC20ItemItemTypeEnum:{Erc20:"ERC20"},ERC721ItemItemTypeEnum:{Erc721:"ERC721"},FeeFeeTypeEnum:{Royalty:"ROYALTY"},NFTContractType:{Erc721:"ERC721"},NativeItemItemTypeEnum:{Native:"NATIVE"},NftOwnersApi:nt,NftOwnersApiAxiosParamCreator:tt,NftOwnersApiFactory:function(e,t,r){const n=rt(e);return{listNFTOwners:(e,i,a,o,s,f)=>n.listNFTOwners(e,i,a,o,s,f).then((e=>e(r,t)))}},NftOwnersApiFp:rt,NftsApi:ot,NftsApiAxiosParamCreator:it,NftsApiFactory:function(e,t,r){const n=at(e);return{getNFT:(e,i,a,o)=>n.getNFT(e,i,a,o).then((e=>e(r,t))),listNFTs:(e,i,a,o,s)=>n.listNFTs(e,i,a,o,s).then((e=>e(r,t))),listNFTsByAccountAddress:(e,i,a,o,s,f)=>n.listNFTsByAccountAddress(e,i,a,o,s,f).then((e=>e(r,t)))}},NftsApiFp:at,OrderStatus:{Pending:"PENDING",Active:"ACTIVE",Inactive:"INACTIVE",Filled:"FILLED",Cancelled:"CANCELLED",Expired:"EXPIRED"},OrdersApi:ut,OrdersApiAxiosParamCreator:st,OrdersApiFactory:function(e,t,r){const n=ft(e);return{createListing:(e,i,a)=>n.createListing(e,i,a).then((e=>e(r,t))),getListing:(e,i,a)=>n.getListing(e,i,a).then((e=>e(r,t))),listListings:(e,i,a,o,s,f,u,c,d,l)=>n.listListings(e,i,a,o,s,f,u,c,d,l).then((e=>e(r,t)))}},OrdersApiFp:ft,PassportApi:lt,PassportApiAxiosParamCreator:ct,PassportApiFactory:function(e,t,r){const n=dt(e);return{createCounterfactualAddress:(e,i)=>n.createCounterfactualAddress(e,i).then((e=>e(r,t)))}},PassportApiFp:dt,SaleFeeTypeEnum:{Royalty:"ROYALTY"},TokenContractType:{Erc20:"ERC20"},TokensApi:class extends Fe{getERC20Token(e,t){return ht(this.configuration).getERC20Token(e.contractAddress,e.chainName,t).then((e=>e(this.axios,this.basePath)))}listERC20Tokens(e,t){return ht(this.configuration).listERC20Tokens(e.chainName,e.pageCursor,e.pageSize,t).then((e=>e(this.axios,this.basePath)))}},TokensApiAxiosParamCreator:pt,TokensApiFactory:function(e,t,r){const n=ht(e);return{getERC20Token:(e,i,a)=>n.getERC20Token(e,i,a).then((e=>e(r,t))),listERC20Tokens:(e,i,a,o)=>n.listERC20Tokens(e,i,a,o).then((e=>e(r,t)))}},TokensApiFp:ht});class bt{config;activitiesApi;chainsApi;collectionApi;nftOwnersApi;nftsApi;ordersApi;passportApi;constructor(e){this.config=e,this.activitiesApi=new Xe(e.indexer),this.chainsApi=new Ye(e.indexer),this.collectionApi=new et(e.indexer),this.nftOwnersApi=new nt(e.indexer),this.nftsApi=new ot(e.indexer),this.ordersApi=new ut(e.orderBook),this.passportApi=new lt(e.passport)}}const yt={"x-sdk-version":"ts-immutable-sdk-0.4.1-alpha.1"},gt=({basePath:e,headers:t})=>{if(!e.trim())throw Error("basePath can not be empty");const r={basePath:e,baseOptions:{headers:{...yt,...t||{}}}};return new class{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}(r)},vt=()=>({indexer:gt({basePath:"https://indexer-mr.imtbl.com"}),orderBook:gt({basePath:"https://order-book-mr.imtbl.com"}),passport:gt({basePath:"https://api.immutable.com"})}),wt=()=>({indexer:gt({basePath:"https://indexer-mr.sandbox.imtbl.com"}),orderBook:gt({basePath:"https://order-book-mr.sandbox.imtbl.com"}),passport:gt({basePath:"https://api.sandbox.immutable.com"})});function _t(e,t){return function(){return e.apply(t,arguments)}}const{toString:Et}=Object.prototype,{getPrototypeOf:Tt}=Object,At=(e=>t=>{const r=Et.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),St=e=>(e=e.toLowerCase(),t=>At(t)===e),kt=e=>t=>typeof t===e,{isArray:Ot}=Array,Rt=kt("undefined");const xt=St("ArrayBuffer");const It=kt("string"),Ct=kt("function"),Nt=kt("number"),Pt=e=>null!==e&&"object"==typeof e,Mt=e=>{if("object"!==At(e))return!1;const t=Tt(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},Bt=St("Date"),Dt=St("File"),Ft=St("Blob"),Lt=St("FileList"),Ut=St("URLSearchParams");function jt(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),Ot(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function qt(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const zt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ht=e=>!Rt(e)&&e!==zt;const Vt=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&Tt(Uint8Array)),Gt=St("HTMLFormElement"),Kt=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Wt=St("RegExp"),Xt=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};jt(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},$t="abcdefghijklmnopqrstuvwxyz",Jt="0123456789",Yt={DIGIT:Jt,ALPHA:$t,ALPHA_DIGIT:$t+$t.toUpperCase()+Jt};const Qt=St("AsyncFunction");var Zt={isArray:Ot,isArrayBuffer:xt,isBuffer:function(e){return null!==e&&!Rt(e)&&null!==e.constructor&&!Rt(e.constructor)&&Ct(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Ct(e.append)&&("formdata"===(t=At(e))||"object"===t&&Ct(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&xt(e.buffer),t},isString:It,isNumber:Nt,isBoolean:e=>!0===e||!1===e,isObject:Pt,isPlainObject:Mt,isUndefined:Rt,isDate:Bt,isFile:Dt,isBlob:Ft,isRegExp:Wt,isFunction:Ct,isStream:e=>Pt(e)&&Ct(e.pipe),isURLSearchParams:Ut,isTypedArray:Vt,isFileList:Lt,forEach:jt,merge:function e(){const{caseless:t}=Ht(this)&&this||{},r={},n=(n,i)=>{const a=t&&qt(r,i)||i;Mt(r[a])&&Mt(n)?r[a]=e(r[a],n):Mt(n)?r[a]=e({},n):Ot(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&jt(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(jt(t,((t,n)=>{r&&Ct(t)?e[n]=_t(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,a,o;const s={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],n&&!n(o,e,t)||s[o]||(t[o]=e[o],s[o]=!0);e=!1!==r&&Tt(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:At,kindOfTest:St,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(Ot(e))return e;let t=e.length;if(!Nt(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Gt,hasOwnProperty:Kt,hasOwnProp:Kt,reduceDescriptors:Xt,freezeMethods:e=>{Xt(e,((t,r)=>{if(Ct(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Ct(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return Ot(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:qt,global:zt,isContextDefined:Ht,ALPHABET:Yt,generateString:(e=16,t=Yt.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&Ct(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Pt(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=Ot(e)?[]:{};return jt(e,((e,t)=>{const a=r(e,n+1);!Rt(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:Qt,isThenable:e=>e&&(Pt(e)||Ct(e))&&Ct(e.then)&&Ct(e.catch)};function er(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}Zt.inherits(er,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Zt.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const tr=er.prototype,rr={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{rr[e]={value:e}})),Object.defineProperties(er,rr),Object.defineProperty(tr,"isAxiosError",{value:!0}),er.from=(e,t,r,n,i,a)=>{const o=Object.create(tr);return Zt.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),er.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function nr(e){return Zt.isPlainObject(e)||Zt.isArray(e)}function ir(e){return Zt.endsWith(e,"[]")?e.slice(0,-2):e}function ar(e,t,r){return e?e.concat(t).map((function(e,t){return e=ir(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const or=Zt.toFlatObject(Zt,{},null,(function(e){return/^is[A-Z]/.test(e)}));function sr(e,t,r){if(!Zt.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=Zt.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Zt.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Zt.isSpecCompliantForm(t);if(!Zt.isFunction(i))throw new TypeError("visitor must be a function");function f(e){if(null===e)return"";if(Zt.isDate(e))return e.toISOString();if(!s&&Zt.isBlob(e))throw new er("Blob is not supported. Use a Buffer instead.");return Zt.isArrayBuffer(e)||Zt.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(Zt.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Zt.isArray(e)&&function(e){return Zt.isArray(e)&&!e.some(nr)}(e)||(Zt.isFileList(e)||Zt.endsWith(r,"[]"))&&(s=Zt.toArray(e)))return r=ir(r),s.forEach((function(e,n){!Zt.isUndefined(e)&&null!==e&&t.append(!0===o?ar([r],n,a):null===o?r:r+"[]",f(e))})),!1;return!!nr(e)||(t.append(ar(i,r,a),f(e)),!1)}const c=[],d=Object.assign(or,{defaultVisitor:u,convertValue:f,isVisitable:nr});if(!Zt.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Zt.isUndefined(r)){if(-1!==c.indexOf(r))throw Error("Circular reference detected in "+n.join("."));c.push(r),Zt.forEach(r,(function(r,a){!0===(!(Zt.isUndefined(r)||null===r)&&i.call(t,r,Zt.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),c.pop()}}(e),t}function fr(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ur(e,t){this._pairs=[],e&&sr(e,this,t)}const cr=ur.prototype;function dr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function lr(e,t,r){if(!t)return e;const n=r&&r.encode||dr,i=r&&r.serialize;let a;if(a=i?i(t,r):Zt.isURLSearchParams(t)?t.toString():new ur(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}cr.append=function(e,t){this._pairs.push([e,t])},cr.toString=function(e){const t=e?function(t){return e.call(this,t,fr)}:fr;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var pr=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Zt.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},hr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var mr={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ur,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function br(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&Zt.isArray(n)?n.length:a,s)return Zt.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&Zt.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&Zt.isArray(n[a])&&(n[a]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}(n[a])),!o}if(Zt.isFormData(e)&&Zt.isFunction(e.entries)){const r={};return Zt.forEachEntry(e,((e,n)=>{t(function(e){return Zt.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const yr={"Content-Type":void 0};const gr={transitional:hr,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=Zt.isObject(e);i&&Zt.isHTMLForm(e)&&(e=new FormData(e));if(Zt.isFormData(e))return n&&n?JSON.stringify(br(e)):e;if(Zt.isArrayBuffer(e)||Zt.isBuffer(e)||Zt.isStream(e)||Zt.isFile(e)||Zt.isBlob(e))return e;if(Zt.isArrayBufferView(e))return e.buffer;if(Zt.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return sr(e,new mr.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return mr.isNode&&Zt.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=Zt.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return sr(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(Zt.isString(e))try{return(t||JSON.parse)(e),Zt.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||gr.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&Zt.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw er.from(e,er.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:mr.classes.FormData,Blob:mr.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Zt.forEach(["delete","get","head"],(function(e){gr.headers[e]={}})),Zt.forEach(["post","put","patch"],(function(e){gr.headers[e]=Zt.merge(yr)}));var vr=gr;const wr=Zt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const _r=Symbol("internals");function Er(e){return e&&String(e).trim().toLowerCase()}function Tr(e){return!1===e||null==e?e:Zt.isArray(e)?e.map(Tr):String(e)}function Ar(e,t,r,n,i){return Zt.isFunction(n)?n.call(this,t,r):(i&&(t=r),Zt.isString(t)?Zt.isString(n)?-1!==t.indexOf(n):Zt.isRegExp(n)?n.test(t):void 0:void 0)}let Sr=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=Er(t);if(!i)throw new Error("header name must be a non-empty string");const a=Zt.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=Tr(e))}const a=(e,t)=>Zt.forEach(e,((e,r)=>i(e,r,t)));return Zt.isPlainObject(e)||e instanceof this.constructor?a(e,t):Zt.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?a((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&wr[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=Er(e)){const r=Zt.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(Zt.isFunction(t))return t.call(this,e,r);if(Zt.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Er(e)){const r=Zt.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ar(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=Er(e)){const i=Zt.findKey(r,e);!i||t&&!Ar(0,r[i],i,t)||(delete r[i],n=!0)}}return Zt.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!Ar(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return Zt.forEach(this,((n,i)=>{const a=Zt.findKey(r,i);if(a)return t[a]=Tr(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=Tr(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Zt.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&Zt.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[_r]=this[_r]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Er(e);t[n]||(!function(e,t){const r=Zt.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return Zt.isArray(e)?e.forEach(n):n(e),this}};Sr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Zt.freezeMethods(Sr.prototype),Zt.freezeMethods(Sr);var kr=Sr;function Or(e,t){const r=this||vr,n=t||r,i=kr.from(n.headers);let a=n.data;return Zt.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function Rr(e){return!(!e||!e.__CANCEL__)}function xr(e,t,r){er.call(this,null==e?"canceled":e,er.ERR_CANCELED,t,r),this.name="CanceledError"}Zt.inherits(xr,er,{__CANCEL__:!0});var Ir=mr.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),Zt.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Zt.isString(n)&&o.push("path="+n),Zt.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Cr(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Nr=mr.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=Zt.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function Pr(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,o=0;return t=void 0!==t?t:1e3,function(s){const f=Date.now(),u=n[o];i||(i=f),r[a]=s,n[a]=f;let c=o,d=0;for(;c!==a;)d+=r[c++],c%=e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),f-i<t)return;const l=u&&f-u;return l?Math.round(1e3*d/l):void 0}}(50,250);return i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,s=a-r,f=n(s);r=a;const u={loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:f||void 0,estimated:f&&o&&a<=o?(o-a)/f:void 0,event:i};u[t?"download":"upload"]=!0,e(u)}}var Mr="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=kr.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}Zt.isFormData(n)&&(mr.isStandardBrowserEnv||mr.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let f=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const u=Cr(e.baseURL,e.url);function c(){if(!f)return;const n=kr.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new er("Request failed with status code "+r.status,[er.ERR_BAD_REQUEST,er.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),s()}),(function(e){r(e),s()}),{data:a&&"text"!==a&&"json"!==a?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:n,config:e,request:f}),f=null}if(f.open(e.method.toUpperCase(),lr(u,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,"onloadend"in f?f.onloadend=c:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(c)},f.onabort=function(){f&&(r(new er("Request aborted",er.ECONNABORTED,e,f)),f=null)},f.onerror=function(){r(new er("Network Error",er.ERR_NETWORK,e,f)),f=null},f.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||hr;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new er(t,n.clarifyTimeoutError?er.ETIMEDOUT:er.ECONNABORTED,e,f)),f=null},mr.isStandardBrowserEnv){const t=(e.withCredentials||Nr(u))&&e.xsrfCookieName&&Ir.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in f&&Zt.forEach(i.toJSON(),(function(e,t){f.setRequestHeader(t,e)})),Zt.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&"json"!==a&&(f.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",Pr(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",Pr(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{f&&(r(!t||t.type?new xr(null,e,f):t),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===mr.protocols.indexOf(d)?r(new er("Unsupported protocol "+d+":",er.ERR_BAD_REQUEST,e)):f.send(n||null)}))};const Br={http:null,xhr:Mr};Zt.forEach(Br,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var Dr=e=>{e=Zt.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=Zt.isString(r)?Br[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new er(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(Zt.hasOwnProp(Br,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!Zt.isFunction(n))throw new TypeError("adapter is not a function");return n};function Fr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new xr(null,e)}function Lr(e){Fr(e),e.headers=kr.from(e.headers),e.data=Or.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Dr(e.adapter||vr.adapter)(e).then((function(t){return Fr(e),t.data=Or.call(e,e.transformResponse,t),t.headers=kr.from(t.headers),t}),(function(t){return Rr(t)||(Fr(e),t&&t.response&&(t.response.data=Or.call(e,e.transformResponse,t.response),t.response.headers=kr.from(t.response.headers))),Promise.reject(t)}))}const Ur=e=>e instanceof kr?e.toJSON():e;function jr(e,t){t=t||{};const r={};function n(e,t,r){return Zt.isPlainObject(e)&&Zt.isPlainObject(t)?Zt.merge.call({caseless:r},e,t):Zt.isPlainObject(t)?Zt.merge({},t):Zt.isArray(t)?t.slice():t}function i(e,t,r){return Zt.isUndefined(t)?Zt.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!Zt.isUndefined(t))return n(void 0,t)}function o(e,t){return Zt.isUndefined(t)?Zt.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,a){return a in t?n(r,i):a in e?n(void 0,r):void 0}const f={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(e,t)=>i(Ur(e),Ur(t),!0)};return Zt.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=f[n]||i,o=a(e[n],t[n],n);Zt.isUndefined(o)&&a!==s||(r[n]=o)})),r}const qr="1.4.0",zr={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{zr[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Hr={};zr.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,a)=>{if(!1===e)throw new er(n(i," has been removed"+(t?" in "+t:"")),er.ERR_DEPRECATED);return t&&!Hr[i]&&(Hr[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}};var Vr={assertOptions:function(e,t,r){if("object"!=typeof e)throw new er("options must be an object",er.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],o=t[a];if(o){const t=e[a],r=void 0===t||o(t,a,e);if(!0!==r)throw new er("option "+a+" must be "+r,er.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new er("Unknown option "+a,er.ERR_BAD_OPTION)}},validators:zr};const Gr=Vr.validators;let Kr=class{constructor(e){this.defaults=e,this.interceptors={request:new pr,response:new pr}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=jr(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&Vr.assertOptions(r,{silentJSONParsing:Gr.transitional(Gr.boolean),forcedJSONParsing:Gr.transitional(Gr.boolean),clarifyTimeoutError:Gr.transitional(Gr.boolean)},!1),null!=n&&(Zt.isFunction(n)?t.paramsSerializer={serialize:n}:Vr.assertOptions(n,{encode:Gr.function,serialize:Gr.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&Zt.merge(i.common,i[t.method]),a&&Zt.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=kr.concat(a,i);const o=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const f=[];let u;this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)}));let c,d=0;if(!s){const e=[Lr.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,f),c=e.length,u=Promise.resolve(t);d<c;)u=u.then(e[d++],e[d++]);return u}c=o.length;let l=t;for(d=0;d<c;){const e=o[d++],t=o[d++];try{l=e(l)}catch(e){t.call(this,e);break}}try{u=Lr.call(this,l)}catch(e){return Promise.reject(e)}for(d=0,c=f.length;d<c;)u=u.then(f[d++],f[d++]);return u}getUri(e){return lr(Cr((e=jr(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};Zt.forEach(["delete","get","head","options"],(function(e){Kr.prototype[e]=function(t,r){return this.request(jr(r||{},{method:e,url:t,data:(r||{}).data}))}})),Zt.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(jr(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Kr.prototype[e]=t(),Kr.prototype[e+"Form"]=t(!0)}));var Wr=Kr;var Xr=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new xr(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let t;const r=new e((function(e){t=e}));return{token:r,cancel:t}}};const $r={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries($r).forEach((([e,t])=>{$r[t]=e}));var Jr=$r;const Yr=function e(t){const r=new Wr(t),n=_t(Wr.prototype.request,r);return Zt.extend(n,Wr.prototype,r,{allOwnKeys:!0}),Zt.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(jr(t,r))},n}(vr);Yr.Axios=Wr,Yr.CanceledError=xr,Yr.CancelToken=Xr,Yr.isCancel=Rr,Yr.VERSION=qr,Yr.toFormData=sr,Yr.AxiosError=er,Yr.Cancel=Yr.CanceledError,Yr.all=function(e){return Promise.all(e)},Yr.spread=function(e){return function(t){return e.apply(null,t)}},Yr.isAxiosError=function(e){return Zt.isObject(e)&&!0===e.isAxiosError},Yr.mergeConfig=jr,Yr.AxiosHeaders=kr,Yr.formToJSON=e=>br(Zt.isHTMLForm(e)?new FormData(e):e),Yr.HttpStatusCode=Jr,Yr.default=Yr;var Qr=Yr;class Zr extends Error{code;details;link;traceId;constructor({message:e,code:t,details:r,link:n,trace_id:i}){super(e),this.code=t,this.details=r,this.link=n,this.traceId=i}}const en={sdkVersion:"ts-immutable-sdk-multi-rollup-api-client-0.4.1-alpha.1"},tn=({basePath:e,headers:t})=>{if(!e.trim())throw Error("basePath can not be empty");const r={basePath:e,baseOptions:{headers:{...t||{},...en}}};return new mt.Configuration(r)},rn=()=>tn({basePath:"https://indexer-mr.sandbox.imtbl.com"});class nn{apiConfig;baseConfig;constructor({baseConfig:t,overrides:r}){if(this.baseConfig=t,r)this.apiConfig=tn(r);else switch(t.environment){case e.Environment.SANDBOX:this.apiConfig=rn();break;case e.Environment.PRODUCTION:this.apiConfig=tn({basePath:"https://indexer-mr.imtbl.com"});break;default:this.apiConfig=rn()}}}function an(e){if(Qr.isAxiosError(e)&&e.response){const t=e.response.data;return t.code&&t.message?new Zr({code:t.code,message:t.message,details:t.details||null,link:t.link||"",trace_id:t.trace_id||""}):new Zr({code:e.code??e.response?.status.toString()??"unknown_error_code",message:String(e),details:null,link:"",trace_id:""})}return new Zr({code:"unknown_error_code",message:String(e),details:null,link:"",trace_id:""})}var on="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function sn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function fn(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){if(this instanceof e){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(t,r))}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var un={exports:{}},cn="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},dn=[],ln=[],pn="undefined"!=typeof Uint8Array?Uint8Array:Array,hn=!1;function mn(){hn=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)dn[t]=e[t],ln[e.charCodeAt(t)]=t;ln["-".charCodeAt(0)]=62,ln["_".charCodeAt(0)]=63}function bn(e,t,r){for(var n,i,a=[],o=t;o<r;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],a.push(dn[(i=n)>>18&63]+dn[i>>12&63]+dn[i>>6&63]+dn[63&i]);return a.join("")}function yn(e){var t;hn||mn();for(var r=e.length,n=r%3,i="",a=[],o=16383,s=0,f=r-n;s<f;s+=o)a.push(bn(e,s,s+o>f?f:s+o));return 1===n?(t=e[r-1],i+=dn[t>>2],i+=dn[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=dn[t>>10],i+=dn[t>>4&63],i+=dn[t<<2&63],i+="="),a.push(i),a.join("")}function gn(e,t,r,n,i){var a,o,s=8*i-n-1,f=(1<<s)-1,u=f>>1,c=-7,d=r?i-1:0,l=r?-1:1,p=e[t+d];for(d+=l,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+e[t+d],d+=l,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+e[t+d],d+=l,c-=8);if(0===a)a=1-u;else{if(a===f)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=u}return(p?-1:1)*o*Math.pow(2,a-n)}function vn(e,t,r,n,i,a){var o,s,f,u=8*a-i-1,c=(1<<u)-1,d=c>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,h=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-o))<1&&(o--,f*=2),(t+=o+d>=1?l/f:l*Math.pow(2,1-d))*f>=2&&(o++,f/=2),o+d>=c?(s=0,o=c):o+d>=1?(s=(t*f-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+p]=255&s,p+=h,s/=256,i-=8);for(o=o<<i|s,u+=i;u>0;e[r+p]=255&o,p+=h,o/=256,u-=8);e[r+p-h]|=128*m}var wn={}.toString,_n=Array.isArray||function(e){return"[object Array]"==wn.call(e)};Sn.TYPED_ARRAY_SUPPORT=void 0===cn.TYPED_ARRAY_SUPPORT||cn.TYPED_ARRAY_SUPPORT;var En=Tn();function Tn(){return Sn.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function An(e,t){if(Tn()<t)throw new RangeError("Invalid typed array length");return Sn.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Sn.prototype:(null===e&&(e=new Sn(t)),e.length=t),e}function Sn(e,t,r){if(!(Sn.TYPED_ARRAY_SUPPORT||this instanceof Sn))return new Sn(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Rn(this,e)}return kn(this,e,t,r)}function kn(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);Sn.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Sn.prototype:e=xn(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!Sn.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|Nn(t,r);e=An(e,n);var i=e.write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(Cn(t)){var r=0|In(t.length);return 0===(e=An(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?An(e,0):xn(e,t);if("Buffer"===t.type&&_n(t.data))return xn(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function On(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function Rn(e,t){if(On(t),e=An(e,t<0?0:0|In(t)),!Sn.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function xn(e,t){var r=t.length<0?0:0|In(t.length);e=An(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function In(e){if(e>=Tn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Tn().toString(16)+" bytes");return 0|e}function Cn(e){return!(null==e||!e._isBuffer)}function Nn(e,t){if(Cn(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return ai(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return oi(e).length;default:if(n)return ai(e).length;t=(""+t).toLowerCase(),n=!0}}function Pn(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Xn(this,t,r);case"utf8":case"utf-8":return Vn(this,t,r);case"ascii":return Kn(this,t,r);case"latin1":case"binary":return Wn(this,t,r);case"base64":return Hn(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $n(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Mn(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Bn(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=Sn.from(t,n)),Cn(t))return 0===t.length?-1:Dn(e,t,r,n,i);if("number"==typeof t)return t&=255,Sn.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Dn(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Dn(e,t,r,n,i){var a,o=1,s=e.length,f=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,f/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=r;a<s;a++)if(u(e,a)===u(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===f)return c*o}else-1!==c&&(a-=a-c),c=-1}else for(r+f>s&&(r=s-f),a=r;a>=0;a--){for(var d=!0,l=0;l<f;l++)if(u(e,a+l)!==u(t,l)){d=!1;break}if(d)return a}return-1}function Fn(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[r+o]=s}return o}function Ln(e,t,r,n){return si(ai(t,e.length-r),e,r,n)}function Un(e,t,r,n){return si(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function jn(e,t,r,n){return Un(e,t,r,n)}function qn(e,t,r,n){return si(oi(t),e,r,n)}function zn(e,t,r,n){return si(function(e,t){for(var r,n,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function Hn(e,t,r){return 0===t&&r===e.length?yn(e):yn(e.slice(t,r))}function Vn(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,f,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(a=e[i+1]))&&(f=(31&u)<<6|63&a)>127&&(c=f);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(f=(15&u)<<12|(63&a)<<6|63&o)>2047&&(f<55296||f>57343)&&(c=f);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(f=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&f<1114112&&(c=f)}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d}return function(e){var t=e.length;if(t<=Gn)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Gn));return r}(n)}Sn.poolSize=8192,Sn._augment=function(e){return e.__proto__=Sn.prototype,e},Sn.from=function(e,t,r){return kn(null,e,t,r)},Sn.TYPED_ARRAY_SUPPORT&&(Sn.prototype.__proto__=Uint8Array.prototype,Sn.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Sn[Symbol.species]),Sn.alloc=function(e,t,r){return function(e,t,r,n){return On(t),t<=0?An(e,t):void 0!==r?"string"==typeof n?An(e,t).fill(r,n):An(e,t).fill(r):An(e,t)}(null,e,t,r)},Sn.allocUnsafe=function(e){return Rn(null,e)},Sn.allocUnsafeSlow=function(e){return Rn(null,e)},Sn.isBuffer=fi,Sn.compare=function(e,t){if(!Cn(e)||!Cn(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},Sn.isEncoding=function(e){switch(String(e).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}},Sn.concat=function(e,t){if(!_n(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Sn.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=Sn.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(!Cn(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},Sn.byteLength=Nn,Sn.prototype._isBuffer=!0,Sn.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Mn(this,t,t+1);return this},Sn.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Mn(this,t,t+3),Mn(this,t+1,t+2);return this},Sn.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Mn(this,t,t+7),Mn(this,t+1,t+6),Mn(this,t+2,t+5),Mn(this,t+3,t+4);return this},Sn.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Vn(this,0,e):Pn.apply(this,arguments)},Sn.prototype.equals=function(e){if(!Cn(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Sn.compare(this,e)},Sn.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Sn.prototype.compare=function(e,t,r,n,i){if(!Cn(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(a,o),f=this.slice(n,i),u=e.slice(t,r),c=0;c<s;++c)if(f[c]!==u[c]){a=f[c],o=u[c];break}return a<o?-1:o<a?1:0},Sn.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},Sn.prototype.indexOf=function(e,t,r){return Bn(this,e,t,r,!0)},Sn.prototype.lastIndexOf=function(e,t,r){return Bn(this,e,t,r,!1)},Sn.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return Fn(this,e,t,r);case"utf8":case"utf-8":return Ln(this,e,t,r);case"ascii":return Un(this,e,t,r);case"latin1":case"binary":return jn(this,e,t,r);case"base64":return qn(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zn(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},Sn.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Gn=4096;function Kn(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function Wn(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function Xn(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=ii(e[a]);return i}function $n(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function Jn(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function Yn(e,t,r,n,i,a){if(!Cn(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function Qn(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);i<a;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function Zn(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);i<a;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function ei(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ti(e,t,r,n,i){return i||ei(e,0,r,4),vn(e,t,r,n,23,4),r+4}function ri(e,t,r,n,i){return i||ei(e,0,r,8),vn(e,t,r,n,52,8),r+8}Sn.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Sn.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=Sn.prototype;else{var i=t-e;r=new Sn(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},Sn.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Jn(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},Sn.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Jn(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},Sn.prototype.readUInt8=function(e,t){return t||Jn(e,1,this.length),this[e]},Sn.prototype.readUInt16LE=function(e,t){return t||Jn(e,2,this.length),this[e]|this[e+1]<<8},Sn.prototype.readUInt16BE=function(e,t){return t||Jn(e,2,this.length),this[e]<<8|this[e+1]},Sn.prototype.readUInt32LE=function(e,t){return t||Jn(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Sn.prototype.readUInt32BE=function(e,t){return t||Jn(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Sn.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Jn(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},Sn.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Jn(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},Sn.prototype.readInt8=function(e,t){return t||Jn(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Sn.prototype.readInt16LE=function(e,t){t||Jn(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Sn.prototype.readInt16BE=function(e,t){t||Jn(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Sn.prototype.readInt32LE=function(e,t){return t||Jn(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Sn.prototype.readInt32BE=function(e,t){return t||Jn(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Sn.prototype.readFloatLE=function(e,t){return t||Jn(e,4,this.length),gn(this,e,!0,23,4)},Sn.prototype.readFloatBE=function(e,t){return t||Jn(e,4,this.length),gn(this,e,!1,23,4)},Sn.prototype.readDoubleLE=function(e,t){return t||Jn(e,8,this.length),gn(this,e,!0,52,8)},Sn.prototype.readDoubleBE=function(e,t){return t||Jn(e,8,this.length),gn(this,e,!1,52,8)},Sn.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||Yn(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},Sn.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||Yn(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},Sn.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,1,255,0),Sn.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Sn.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,2,65535,0),Sn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Qn(this,e,t,!0),t+2},Sn.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,2,65535,0),Sn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Qn(this,e,t,!1),t+2},Sn.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,4,4294967295,0),Sn.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Zn(this,e,t,!0),t+4},Sn.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,4,4294967295,0),Sn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Zn(this,e,t,!1),t+4},Sn.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Yn(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},Sn.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Yn(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},Sn.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,1,127,-128),Sn.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Sn.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,2,32767,-32768),Sn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Qn(this,e,t,!0),t+2},Sn.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,2,32767,-32768),Sn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Qn(this,e,t,!1),t+2},Sn.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,4,2147483647,-2147483648),Sn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Zn(this,e,t,!0),t+4},Sn.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Yn(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Sn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Zn(this,e,t,!1),t+4},Sn.prototype.writeFloatLE=function(e,t,r){return ti(this,e,t,!0,r)},Sn.prototype.writeFloatBE=function(e,t,r){return ti(this,e,t,!1,r)},Sn.prototype.writeDoubleLE=function(e,t,r){return ri(this,e,t,!0,r)},Sn.prototype.writeDoubleBE=function(e,t,r){return ri(this,e,t,!1,r)},Sn.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,a=n-r;if(this===e&&r<t&&t<n)for(i=a-1;i>=0;--i)e[i+t]=this[i+r];else if(a<1e3||!Sn.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},Sn.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Sn.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var o=Cn(e)?e:ai(new Sn(e,n).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var ni=/[^+\/0-9A-Za-z-_]/g;function ii(e){return e<16?"0"+e.toString(16):e.toString(16)}function ai(e,t){var r;t=t||1/0;for(var n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function oi(e){return function(e){var t,r,n,i,a,o;hn||mn();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[s-2]?2:"="===e[s-1]?1:0,o=new pn(3*s/4-a),n=a>0?s-4:s;var f=0;for(t=0,r=0;t<n;t+=4,r+=3)i=ln[e.charCodeAt(t)]<<18|ln[e.charCodeAt(t+1)]<<12|ln[e.charCodeAt(t+2)]<<6|ln[e.charCodeAt(t+3)],o[f++]=i>>16&255,o[f++]=i>>8&255,o[f++]=255&i;return 2===a?(i=ln[e.charCodeAt(t)]<<2|ln[e.charCodeAt(t+1)]>>4,o[f++]=255&i):1===a&&(i=ln[e.charCodeAt(t)]<<10|ln[e.charCodeAt(t+1)]<<4|ln[e.charCodeAt(t+2)]>>2,o[f++]=i>>8&255,o[f++]=255&i),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(ni,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function si(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function fi(e){return null!=e&&(!!e._isBuffer||ui(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&ui(e.slice(0,0))}(e))}function ui(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var ci=fn(Object.freeze({__proto__:null,Buffer:Sn,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),Sn.alloc(+e)},isBuffer:fi,kMaxLength:En}));!function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:ci.Buffer}catch(e){}function o(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function s(e,t,r){var n=o(e,r);return r-1>=t&&(n|=o(e,r-1)<<4),n}function f(e,t,n,i){for(var a=0,o=0,s=Math.min(e.length,n),f=t;f<s;f++){var u=e.charCodeAt(f)-48;a*=i,o=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&o<i,"Invalid character"),a+=o}return a}function u(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===n)for(i=e.length-1,a=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===n)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this._strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,a=0,o=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=s(e,t,n)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=s(e,t,n)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var a=e.length-r,o=a%n,s=Math.min(a,a-o)+r,u=0,c=r;c<s;c+=n)u=f(e,c,c+n,t),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var d=1;for(u=f(e,c,e.length,t),c=0;c<o;c++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){u(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c}catch(e){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],f=(16777215&(s<<i|a)).toString(16);a=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),n=0!==a||o!==this.length-1?d[6-f.length]+f+n:f+n}for(0!==a&&(n=a.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=l[e],c=p[e];n="";var h=this.clone();for(h.negative=0;!h.isZero();){var m=h.modrn(c).toString(e);n=(h=h.idivn(c)).isZero()?m+n:d[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},a&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function h(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],a=0|t.words[0],o=i*a,s=67108863&o,f=o/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var c=f>>>26,d=67108863&f,l=Math.min(u,t.length-1),p=Math.max(0,u-e.length+1);p<=l;p++){var h=u-p|0;c+=(o=(i=0|e.words[h])*(a=0|t.words[p])+d)/67108864|0,d=67108863&o}r.words[u]=0|d,f=0|c}return 0!==f?r.words[u]=0|f:r.length--,r._strip()}i.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),a=n||Math.max(1,i);r(i<=a,"byte array longer than desired length"),r(a>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,a);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,i),o},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|n;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===a?(r<e.length&&(e[r++]=o>>24&255),n=0,a=0):(n=o>>>24,a+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|n;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===a?(r>=0&&(e[r--]=o>>24&255),n=0,a=0):(n=o>>>24,a+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,a=0;a<n.length;a++)t=(0|r.words[a])+(0|n.words[a])+i,this.words[a]=67108863&t,i=t>>>26;for(;0!==i&&a<r.length;a++)t=(0|r.words[a])+i,this.words[a]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var a=0,o=0;o<n.length;o++)a=(t=(0|r.words[o])-(0|n.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!==a&&o<r.length;o++)a=(t=(0|r.words[o])+a)>>26,this.words[o]=67108863&t;if(0===a&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var n,i,a,o=e.words,s=t.words,f=r.words,u=0,c=0|o[0],d=8191&c,l=c>>>13,p=0|o[1],h=8191&p,m=p>>>13,b=0|o[2],y=8191&b,g=b>>>13,v=0|o[3],w=8191&v,_=v>>>13,E=0|o[4],T=8191&E,A=E>>>13,S=0|o[5],k=8191&S,O=S>>>13,R=0|o[6],x=8191&R,I=R>>>13,C=0|o[7],N=8191&C,P=C>>>13,M=0|o[8],B=8191&M,D=M>>>13,F=0|o[9],L=8191&F,U=F>>>13,j=0|s[0],q=8191&j,z=j>>>13,H=0|s[1],V=8191&H,G=H>>>13,K=0|s[2],W=8191&K,X=K>>>13,$=0|s[3],J=8191&$,Y=$>>>13,Q=0|s[4],Z=8191&Q,ee=Q>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],ae=8191&ie,oe=ie>>>13,se=0|s[7],fe=8191&se,ue=se>>>13,ce=0|s[8],de=8191&ce,le=ce>>>13,pe=0|s[9],he=8191&pe,me=pe>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(u+(n=Math.imul(d,q))|0)+((8191&(i=(i=Math.imul(d,z))+Math.imul(l,q)|0))<<13)|0;u=((a=Math.imul(l,z))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(h,q),i=(i=Math.imul(h,z))+Math.imul(m,q)|0,a=Math.imul(m,z);var ye=(u+(n=n+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,G)|0)+Math.imul(l,V)|0))<<13)|0;u=((a=a+Math.imul(l,G)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,q),i=(i=Math.imul(y,z))+Math.imul(g,q)|0,a=Math.imul(g,z),n=n+Math.imul(h,V)|0,i=(i=i+Math.imul(h,G)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,G)|0;var ge=(u+(n=n+Math.imul(d,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(l,W)|0))<<13)|0;u=((a=a+Math.imul(l,X)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,a=Math.imul(_,z),n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(g,V)|0,a=a+Math.imul(g,G)|0,n=n+Math.imul(h,W)|0,i=(i=i+Math.imul(h,X)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,X)|0;var ve=(u+(n=n+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(l,J)|0))<<13)|0;u=((a=a+Math.imul(l,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(T,q),i=(i=Math.imul(T,z))+Math.imul(A,q)|0,a=Math.imul(A,z),n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,V)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(g,W)|0,a=a+Math.imul(g,X)|0,n=n+Math.imul(h,J)|0,i=(i=i+Math.imul(h,Y)|0)+Math.imul(m,J)|0,a=a+Math.imul(m,Y)|0;var we=(u+(n=n+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(l,Z)|0))<<13)|0;u=((a=a+Math.imul(l,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(k,q),i=(i=Math.imul(k,z))+Math.imul(O,q)|0,a=Math.imul(O,z),n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(A,V)|0,a=a+Math.imul(A,G)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,W)|0,a=a+Math.imul(_,X)|0,n=n+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(g,J)|0,a=a+Math.imul(g,Y)|0,n=n+Math.imul(h,Z)|0,i=(i=i+Math.imul(h,ee)|0)+Math.imul(m,Z)|0,a=a+Math.imul(m,ee)|0;var _e=(u+(n=n+Math.imul(d,re)|0)|0)+((8191&(i=(i=i+Math.imul(d,ne)|0)+Math.imul(l,re)|0))<<13)|0;u=((a=a+Math.imul(l,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(x,q),i=(i=Math.imul(x,z))+Math.imul(I,q)|0,a=Math.imul(I,z),n=n+Math.imul(k,V)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(O,V)|0,a=a+Math.imul(O,G)|0,n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(A,W)|0,a=a+Math.imul(A,X)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,J)|0,a=a+Math.imul(_,Y)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(g,Z)|0,a=a+Math.imul(g,ee)|0,n=n+Math.imul(h,re)|0,i=(i=i+Math.imul(h,ne)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ne)|0;var Ee=(u+(n=n+Math.imul(d,ae)|0)|0)+((8191&(i=(i=i+Math.imul(d,oe)|0)+Math.imul(l,ae)|0))<<13)|0;u=((a=a+Math.imul(l,oe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(N,q),i=(i=Math.imul(N,z))+Math.imul(P,q)|0,a=Math.imul(P,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(I,V)|0,a=a+Math.imul(I,G)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(O,W)|0,a=a+Math.imul(O,X)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(A,J)|0,a=a+Math.imul(A,Y)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Z)|0,a=a+Math.imul(_,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(g,re)|0,a=a+Math.imul(g,ne)|0,n=n+Math.imul(h,ae)|0,i=(i=i+Math.imul(h,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0;var Te=(u+(n=n+Math.imul(d,fe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ue)|0)+Math.imul(l,fe)|0))<<13)|0;u=((a=a+Math.imul(l,ue)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,z))+Math.imul(D,q)|0,a=Math.imul(D,z),n=n+Math.imul(N,V)|0,i=(i=i+Math.imul(N,G)|0)+Math.imul(P,V)|0,a=a+Math.imul(P,G)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(I,W)|0,a=a+Math.imul(I,X)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(O,J)|0,a=a+Math.imul(O,Y)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(A,Z)|0,a=a+Math.imul(A,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,a=a+Math.imul(_,ne)|0,n=n+Math.imul(y,ae)|0,i=(i=i+Math.imul(y,oe)|0)+Math.imul(g,ae)|0,a=a+Math.imul(g,oe)|0,n=n+Math.imul(h,fe)|0,i=(i=i+Math.imul(h,ue)|0)+Math.imul(m,fe)|0,a=a+Math.imul(m,ue)|0;var Ae=(u+(n=n+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(l,de)|0))<<13)|0;u=((a=a+Math.imul(l,le)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(L,q),i=(i=Math.imul(L,z))+Math.imul(U,q)|0,a=Math.imul(U,z),n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(D,V)|0,a=a+Math.imul(D,G)|0,n=n+Math.imul(N,W)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(P,W)|0,a=a+Math.imul(P,X)|0,n=n+Math.imul(x,J)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(I,J)|0,a=a+Math.imul(I,Y)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(O,Z)|0,a=a+Math.imul(O,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(A,re)|0,a=a+Math.imul(A,ne)|0,n=n+Math.imul(w,ae)|0,i=(i=i+Math.imul(w,oe)|0)+Math.imul(_,ae)|0,a=a+Math.imul(_,oe)|0,n=n+Math.imul(y,fe)|0,i=(i=i+Math.imul(y,ue)|0)+Math.imul(g,fe)|0,a=a+Math.imul(g,ue)|0,n=n+Math.imul(h,de)|0,i=(i=i+Math.imul(h,le)|0)+Math.imul(m,de)|0,a=a+Math.imul(m,le)|0;var Se=(u+(n=n+Math.imul(d,he)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(l,he)|0))<<13)|0;u=((a=a+Math.imul(l,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,V),i=(i=Math.imul(L,G))+Math.imul(U,V)|0,a=Math.imul(U,G),n=n+Math.imul(B,W)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(D,W)|0,a=a+Math.imul(D,X)|0,n=n+Math.imul(N,J)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(P,J)|0,a=a+Math.imul(P,Y)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(I,Z)|0,a=a+Math.imul(I,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(O,re)|0,a=a+Math.imul(O,ne)|0,n=n+Math.imul(T,ae)|0,i=(i=i+Math.imul(T,oe)|0)+Math.imul(A,ae)|0,a=a+Math.imul(A,oe)|0,n=n+Math.imul(w,fe)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(_,fe)|0,a=a+Math.imul(_,ue)|0,n=n+Math.imul(y,de)|0,i=(i=i+Math.imul(y,le)|0)+Math.imul(g,de)|0,a=a+Math.imul(g,le)|0;var ke=(u+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(m,he)|0))<<13)|0;u=((a=a+Math.imul(m,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,W),i=(i=Math.imul(L,X))+Math.imul(U,W)|0,a=Math.imul(U,X),n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(D,J)|0,a=a+Math.imul(D,Y)|0,n=n+Math.imul(N,Z)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(P,Z)|0,a=a+Math.imul(P,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(I,re)|0,a=a+Math.imul(I,ne)|0,n=n+Math.imul(k,ae)|0,i=(i=i+Math.imul(k,oe)|0)+Math.imul(O,ae)|0,a=a+Math.imul(O,oe)|0,n=n+Math.imul(T,fe)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(A,fe)|0,a=a+Math.imul(A,ue)|0,n=n+Math.imul(w,de)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(_,de)|0,a=a+Math.imul(_,le)|0;var Oe=(u+(n=n+Math.imul(y,he)|0)|0)+((8191&(i=(i=i+Math.imul(y,me)|0)+Math.imul(g,he)|0))<<13)|0;u=((a=a+Math.imul(g,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,J),i=(i=Math.imul(L,Y))+Math.imul(U,J)|0,a=Math.imul(U,Y),n=n+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(D,Z)|0,a=a+Math.imul(D,ee)|0,n=n+Math.imul(N,re)|0,i=(i=i+Math.imul(N,ne)|0)+Math.imul(P,re)|0,a=a+Math.imul(P,ne)|0,n=n+Math.imul(x,ae)|0,i=(i=i+Math.imul(x,oe)|0)+Math.imul(I,ae)|0,a=a+Math.imul(I,oe)|0,n=n+Math.imul(k,fe)|0,i=(i=i+Math.imul(k,ue)|0)+Math.imul(O,fe)|0,a=a+Math.imul(O,ue)|0,n=n+Math.imul(T,de)|0,i=(i=i+Math.imul(T,le)|0)+Math.imul(A,de)|0,a=a+Math.imul(A,le)|0;var Re=(u+(n=n+Math.imul(w,he)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(_,he)|0))<<13)|0;u=((a=a+Math.imul(_,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(L,Z),i=(i=Math.imul(L,ee))+Math.imul(U,Z)|0,a=Math.imul(U,ee),n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(D,re)|0,a=a+Math.imul(D,ne)|0,n=n+Math.imul(N,ae)|0,i=(i=i+Math.imul(N,oe)|0)+Math.imul(P,ae)|0,a=a+Math.imul(P,oe)|0,n=n+Math.imul(x,fe)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(I,fe)|0,a=a+Math.imul(I,ue)|0,n=n+Math.imul(k,de)|0,i=(i=i+Math.imul(k,le)|0)+Math.imul(O,de)|0,a=a+Math.imul(O,le)|0;var xe=(u+(n=n+Math.imul(T,he)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(A,he)|0))<<13)|0;u=((a=a+Math.imul(A,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(L,re),i=(i=Math.imul(L,ne))+Math.imul(U,re)|0,a=Math.imul(U,ne),n=n+Math.imul(B,ae)|0,i=(i=i+Math.imul(B,oe)|0)+Math.imul(D,ae)|0,a=a+Math.imul(D,oe)|0,n=n+Math.imul(N,fe)|0,i=(i=i+Math.imul(N,ue)|0)+Math.imul(P,fe)|0,a=a+Math.imul(P,ue)|0,n=n+Math.imul(x,de)|0,i=(i=i+Math.imul(x,le)|0)+Math.imul(I,de)|0,a=a+Math.imul(I,le)|0;var Ie=(u+(n=n+Math.imul(k,he)|0)|0)+((8191&(i=(i=i+Math.imul(k,me)|0)+Math.imul(O,he)|0))<<13)|0;u=((a=a+Math.imul(O,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(L,ae),i=(i=Math.imul(L,oe))+Math.imul(U,ae)|0,a=Math.imul(U,oe),n=n+Math.imul(B,fe)|0,i=(i=i+Math.imul(B,ue)|0)+Math.imul(D,fe)|0,a=a+Math.imul(D,ue)|0,n=n+Math.imul(N,de)|0,i=(i=i+Math.imul(N,le)|0)+Math.imul(P,de)|0,a=a+Math.imul(P,le)|0;var Ce=(u+(n=n+Math.imul(x,he)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(I,he)|0))<<13)|0;u=((a=a+Math.imul(I,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,fe),i=(i=Math.imul(L,ue))+Math.imul(U,fe)|0,a=Math.imul(U,ue),n=n+Math.imul(B,de)|0,i=(i=i+Math.imul(B,le)|0)+Math.imul(D,de)|0,a=a+Math.imul(D,le)|0;var Ne=(u+(n=n+Math.imul(N,he)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(P,he)|0))<<13)|0;u=((a=a+Math.imul(P,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(L,de),i=(i=Math.imul(L,le))+Math.imul(U,de)|0,a=Math.imul(U,le);var Pe=(u+(n=n+Math.imul(B,he)|0)|0)+((8191&(i=(i=i+Math.imul(B,me)|0)+Math.imul(D,he)|0))<<13)|0;u=((a=a+Math.imul(D,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Me=(u+(n=Math.imul(L,he))|0)+((8191&(i=(i=Math.imul(L,me))+Math.imul(U,he)|0))<<13)|0;return u=((a=Math.imul(U,me))+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,f[0]=be,f[1]=ye,f[2]=ge,f[3]=ve,f[4]=we,f[5]=_e,f[6]=Ee,f[7]=Te,f[8]=Ae,f[9]=Se,f[10]=ke,f[11]=Oe,f[12]=Re,f[13]=xe,f[14]=Ie,f[15]=Ce,f[16]=Ne,f[17]=Pe,f[18]=Me,0!==u&&(f[19]=u,r.length++),r};function b(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,a=0;a<r.length-1;a++){var o=i;i=0;for(var s=67108863&n,f=Math.min(a,t.length-1),u=Math.max(0,a-e.length+1);u<=f;u++){var c=a-u,d=(0|e.words[c])*(0|t.words[u]),l=67108863&d;s=67108863&(l=l+s|0),i+=(o=(o=o+(d/67108864|0)|0)+(l>>>26)|0)>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r._strip()}function y(e,t,r){return b(e,t,r)}Math.imul||(m=h),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?h(this,e,t):r<1024?b(this,e,t):y(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),y(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,i=0;i<this.length;i++){var a=(0|this.words[i])*e,o=(67108863&a)+(67108863&n);n>>=26,n+=a/67108864|0,n+=o>>>26,this.words[i]=67108863&o}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=e.words[n]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var a=r.sqr();n<t.length;n++,a=a.sqr())0!==t[n]&&(r=r.mul(a));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,a=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,f=(0|this.words[t])-s<<n;this.words[t]=f|o,o=s>>>26-n}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,f=n;if(i-=o,i=Math.max(0,i),f){for(var u=0;u<o;u++)f.words[u]=this.words[u];f.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var c=0;for(u=this.length-1;u>=0&&(0!==c||u>=i);u--){var d=0|this.words[u];this.words[u]=c<<26-a|d>>>a,c=d&s}return f&&0!==c&&(f.words[f.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var i,a,o=e.length+n;this._expand(o);var s=0;for(i=0;i<e.length;i++){a=(0|this.words[i+n])+s;var f=(0|e.words[i])*t;s=((a-=67108863&f)>>26)-(f/67108864|0),this.words[i+n]=67108863&a}for(;i<this.length-n;i++)s=(a=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&a;if(0===s)return this._strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(a=-(0|this.words[i])+s)>>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),a=e,o=0|a.words[a.length-1];0!==(r=26-this._countBits(o))&&(a=a.ushln(r),n.iushln(r),o=0|a.words[a.length-1]);var s,f=n.length-a.length;if("mod"!==t){(s=new i(null)).length=f+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var c=n.clone()._ishlnsubmul(a,1,f);0===c.negative&&(n=c,s&&(s.words[f]=1));for(var d=f-1;d>=0;d--){var l=67108864*(0|n.words[a.length+d])+(0|n.words[a.length+d-1]);for(l=Math.min(l/o|0,67108863),n._ishlnsubmul(a,l,d);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(a,1,d),n.isZero()||(n.negative^=1);s&&(s.words[d]=l)}return s&&s._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(a=s.div.neg()),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:a,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(a=s.div.neg()),{div:a,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,o,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,a=this.length-1;a>=0;a--)i=(n*i+(0|this.words[a]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var a=(0|this.words[i])+67108864*n;this.words[i]=a/e|0,n=a%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new i(1),o=new i(0),s=new i(0),f=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var c=n.clone(),d=t.clone();!t.isZero();){for(var l=0,p=1;0==(t.words[0]&p)&&l<26;++l,p<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(c),o.isub(d)),a.iushrn(1),o.iushrn(1);for(var h=0,m=1;0==(n.words[0]&m)&&h<26;++h,m<<=1);if(h>0)for(n.iushrn(h);h-- >0;)(s.isOdd()||f.isOdd())&&(s.iadd(c),f.isub(d)),s.iushrn(1),f.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s),o.isub(f)):(n.isub(t),s.isub(a),f.isub(o))}return{a:s,b:f,gcd:n.iushln(u)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,o=new i(1),s=new i(0),f=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(f),o.iushrn(1);for(var d=0,l=1;0==(n.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(n.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(f),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s)):(n.isub(t),s.isub(o))}return(a=0===t.cmpn(1)?o:s).cmpn(0)<0&&a.iadd(e),a},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var a=t;t=r,r=a}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var a=i,o=n;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new A(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function T(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){A.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},n(w,v),w.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var a=e.words[9];for(t.words[t.length++]=a&r,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(o&r)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(_,v),n(E,v),n(T,v),T.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new _;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new T}return g[e]=t,t},A.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);r(!a.isZero());var s=new i(1).toRed(this),f=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(f);)c.redIAdd(f);for(var d=this.pow(c,a),l=this.pow(e,a.addn(1).iushrn(1)),p=this.pow(e,a),h=o;0!==p.cmp(s);){for(var m=p,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b<h);var y=this.pow(d,new i(1).iushln(h-b-1));l=l.redMul(y),d=y.redSqr(),p=p.redMul(d),h=b}return l},A.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var a=r[0],o=0,s=0,f=t.bitLength()%26;for(0===f&&(f=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],c=f-1;c>=0;c--){var d=u>>c&1;a!==r[0]&&(a=this.sqr(a)),0!==d||0!==o?(o<<=1,o|=d,(4===++s||0===n&&0===c)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}f=26}return a},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new S(e)},n(S,A),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,on)}(un);var di=un.exports,li=sn(di);let pi=!1,hi=!1;const mi={debug:1,default:2,info:2,warning:3,error:4,off:5};let bi=mi.default,yi=null;const gi=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var vi,wi;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(vi||(vi={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(wi||(wi={}));const _i="0123456789abcdef";let Ei=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==mi[r]&&this.throwArgumentError("invalid log level name","logLevel",e),bi>mi[r]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(hi)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=_i[t[e]>>4],r+=_i[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const a=t;let o="";switch(r){case wi.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case wi.CALL_EXCEPTION:case wi.INSUFFICIENT_FUNDS:case wi.MISSING_NEW:case wi.NONCE_EXPIRED:case wi.REPLACEMENT_UNDERPRICED:case wi.TRANSACTION_REPLACED:case wi.UNPREDICTABLE_GAS_LIMIT:o=r}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=a,s.code=r,Object.keys(n).forEach((function(e){s[e]=n[e]})),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){gi&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:gi})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return yi||(yi=new e("logger/5.7.0")),yi}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),pi){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}hi=!!t,pi=!!r}static setLogLevel(t){const r=mi[t.toLowerCase()];null!=r?bi=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};Ei.errors=wi,Ei.levels=vi;var Ti=Object.freeze({__proto__:null,get ErrorCode(){return wi},get LogLevel(){return vi},Logger:Ei});const Ai=new Ei("bytes/5.7.0");function Si(e){return!!e.toHexString}function ki(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return ki(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Oi(e){return Mi(e)&&!(e.length%2)||xi(e)}function Ri(e){return"number"==typeof e&&e==e&&e%1==0}function xi(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Ri(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!Ri(r)||r<0||r>=256)return!1}return!0}function Ii(e,t){if(t||(t={}),"number"==typeof e){Ai.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),ki(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Si(e)&&(e=e.toHexString()),Mi(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":Ai.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return ki(new Uint8Array(n))}return xi(e)?ki(new Uint8Array(e)):Ai.throwArgumentError("invalid arrayify value","value",e)}function Ci(e){const t=e.map((e=>Ii(e))),r=t.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(r);return t.reduce(((e,t)=>(n.set(t,e),e+t.length)),0),ki(n)}function Ni(e){let t=Ii(e);if(0===t.length)return t;let r=0;for(;r<t.length&&0===t[r];)r++;return r&&(t=t.slice(r)),t}function Pi(e,t){(e=Ii(e)).length>t&&Ai.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),ki(r)}function Mi(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const Bi="0123456789abcdef";function Di(e,t){if(t||(t={}),"number"==typeof e){Ai.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Bi[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Si(e))return e.toHexString();if(Mi(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":Ai.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(xi(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=Bi[(240&n)>>4]+Bi[15&n]}return t}return Ai.throwArgumentError("invalid hexlify value","value",e)}function Fi(e){if("string"!=typeof e)e=Di(e);else if(!Mi(e)||e.length%2)return null;return(e.length-2)/2}function Li(e,t,r){return"string"!=typeof e?e=Di(e):(!Mi(e)||e.length%2)&&Ai.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function Ui(e){let t="0x";return e.forEach((e=>{t+=Di(e).substring(2)})),t}function ji(e){const t=qi(Di(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function qi(e){"string"!=typeof e&&(e=Di(e)),Mi(e)||Ai.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}function zi(e,t){for("string"!=typeof e?e=Di(e):Mi(e)||Ai.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Ai.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function Hi(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Oi(e)){let r=Ii(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=Di(r.slice(0,32)),t.s=Di(r.slice(32,64))):65===r.length?(t.r=Di(r.slice(0,32)),t.s=Di(r.slice(32,64)),t.v=r[64]):Ai.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:Ai.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=Di(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const r=Pi(Ii(t._vs),32);t._vs=Di(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&Ai.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=Di(r);null==t.s?t.s=i:t.s!==i&&Ai.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?Ai.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const r=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==r&&Ai.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&Mi(t.r)?t.r=zi(t.r,32):Ai.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&Mi(t.s)?t.s=zi(t.s,32):Ai.throwArgumentError("signature missing or invalid s","signature",e);const r=Ii(t.s);r[0]>=128&&Ai.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=Di(r);t._vs&&(Mi(t._vs)||Ai.throwArgumentError("signature invalid _vs","signature",e),t._vs=zi(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&Ai.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function Vi(e){return Di(Ci([(e=Hi(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var Gi=Object.freeze({__proto__:null,arrayify:Ii,concat:Ci,hexConcat:Ui,hexDataLength:Fi,hexDataSlice:Li,hexStripZeros:qi,hexValue:ji,hexZeroPad:zi,hexlify:Di,isBytes:xi,isBytesLike:Oi,isHexString:Mi,joinSignature:Vi,splitSignature:Hi,stripZeros:Ni,zeroPad:Pi});const Ki="bignumber/5.7.0";var Wi=li.BN;const Xi=new Ei(Ki),$i={},Ji=9007199254740991;let Yi=!1,Qi=class e{constructor(e,t){e!==$i&&Xi.throwError("cannot call constructor directly; use BigNumber.from",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return ea(ta(this).fromTwos(e))}toTwos(e){return ea(ta(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return ea(ta(this).add(ta(e)))}sub(e){return ea(ta(this).sub(ta(e)))}div(t){return e.from(t).isZero()&&ra("division-by-zero","div"),ea(ta(this).div(ta(t)))}mul(e){return ea(ta(this).mul(ta(e)))}mod(e){const t=ta(e);return t.isNeg()&&ra("division-by-zero","mod"),ea(ta(this).umod(t))}pow(e){const t=ta(e);return t.isNeg()&&ra("negative-power","pow"),ea(ta(this).pow(t))}and(e){const t=ta(e);return(this.isNegative()||t.isNeg())&&ra("unbound-bitwise-result","and"),ea(ta(this).and(t))}or(e){const t=ta(e);return(this.isNegative()||t.isNeg())&&ra("unbound-bitwise-result","or"),ea(ta(this).or(t))}xor(e){const t=ta(e);return(this.isNegative()||t.isNeg())&&ra("unbound-bitwise-result","xor"),ea(ta(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&ra("negative-width","mask"),ea(ta(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&ra("negative-width","shl"),ea(ta(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&ra("negative-width","shr"),ea(ta(this).shrn(e))}eq(e){return ta(this).eq(ta(e))}lt(e){return ta(this).lt(ta(e))}lte(e){return ta(this).lte(ta(e))}gt(e){return ta(this).gt(ta(e))}gte(e){return ta(this).gte(ta(e))}isNegative(){return"-"===this._hex[0]}isZero(){return ta(this).isZero()}toNumber(){try{return ta(this).toNumber()}catch(e){ra("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Xi.throwError("this platform does not support BigInt",Ei.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Yi||(Yi=!0,Xi.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Xi.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ei.errors.UNEXPECTED_ARGUMENT,{}):Xi.throwError("BigNumber.toString does not accept parameters",Ei.errors.UNEXPECTED_ARGUMENT,{})),ta(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e($i,Zi(t)):t.match(/^-?[0-9]+$/)?new e($i,Zi(new Wi(t))):Xi.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&ra("underflow","BigNumber.from",t),(t>=Ji||t<=-Ji)&&ra("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(xi(r))return e.from(Di(r));if(r)if(r.toHexString){const t=r.toHexString();if("string"==typeof t)return e.from(t)}else{let t=r._hex;if(null==t&&"BigNumber"===r.type&&(t=r.hex),"string"==typeof t&&(Mi(t)||"-"===t[0]&&Mi(t.substring(1))))return e.from(t)}return Xi.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function Zi(e){if("string"!=typeof e)return Zi(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Xi.throwArgumentError("invalid hex","value",e),"0x00"===(e=Zi(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function ea(e){return Qi.from(Zi(e))}function ta(e){const t=Qi.from(e).toHexString();return"-"===t[0]?new Wi("-"+t.substring(3),16):new Wi(t.substring(2),16)}function ra(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Xi.throwError(e,Ei.errors.NUMERIC_FAULT,n)}const na=new Ei(Ki),ia={},aa=Qi.from(0),oa=Qi.from(-1);function sa(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),na.throwError(e,Ei.errors.NUMERIC_FAULT,i)}let fa="0";for(;fa.length<256;)fa+=fa;function ua(e){if("number"!=typeof e)try{e=Qi.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+fa.substring(0,e):na.throwArgumentError("invalid decimal size","decimals",e)}function ca(e,t){null==t&&(t=0);const r=ua(t),n=(e=Qi.from(e)).lt(aa);n&&(e=e.mul(oa));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=e.div(r).toString();return e=1===r.length?a:a+"."+i,n&&(e="-"+e),e}function da(e,t){null==t&&(t=0);const r=ua(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||na.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&na.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&na.throwArgumentError("too many decimal points","value",e);let a=i[0],o=i[1];for(a||(a="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>r.length-1&&sa("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=Qi.from(a),f=Qi.from(o);let u=s.mul(r).add(f);return n&&(u=u.mul(oa)),u}class la{constructor(e,t,r,n){e!==ia&&na.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=ua(n),Object.freeze(this)}static from(e){if(e instanceof la)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,r=128,n=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||na.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(e){const i=(t,r,n)=>null==e[t]?n:(typeof e[t]!==r&&na.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&na.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&na.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new la(ia,t,r,n)}}class pa{constructor(e,t,r,n){e!==ia&&na.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&na.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=da(this._value,this.format.decimals),r=da(e._value,e.format.decimals);return pa.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=da(this._value,this.format.decimals),r=da(e._value,e.format.decimals);return pa.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=da(this._value,this.format.decimals),r=da(e._value,e.format.decimals);return pa.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=da(this._value,this.format.decimals),r=da(e._value,e.format.decimals);return pa.fromValue(t.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=pa.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(ha.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=pa.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(ha.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&na.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=pa.from("1"+fa.substring(0,e),this.format),n=ma.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&na.throwArgumentError("invalid byte width","width",e);return zi(Qi.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return pa.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(Qi.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Mi(e)||"bigint"==typeof e||xi(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),pa.fromString(ca(e,t),la.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=la.from(t),n=da(e,r.decimals);!r.signed&&n.lt(aa)&&sa("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=zi(i,r.width/8));const a=ca(n,r.decimals);return new pa(ia,i,a,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=la.from(t);if(Ii(e).length>r.width/8)throw new Error("overflow");let n=Qi.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),a=ca(n,r.decimals);return new pa(ia,i,a,r)}static from(e,t){if("string"==typeof e)return pa.fromString(e,t);if(xi(e))return pa.fromBytes(e,t);try{return pa.fromValue(e,0,t)}catch(e){if(e.code!==Ei.errors.INVALID_ARGUMENT)throw e}return na.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const ha=pa.from(1),ma=pa.from("0.5");var ba=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{f(n.next(e))}catch(e){a(e)}}function s(e){try{f(n.throw(e))}catch(e){a(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}f((n=n.apply(e,t||[])).next())}))};const ya=new Ei("properties/5.7.0");function ga(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function va(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function wa(e){return ba(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const r=e[t];return Promise.resolve(r).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function _a(e,t){e&&"object"==typeof e||ya.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||ya.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}function Ea(e){const t={};for(const r in e)t[r]=e[r];return t}const Ta={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Aa(e){if(null==e||Ta[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;r<t.length;r++){let n=null;try{n=e[t[r]]}catch(e){continue}if(!Aa(n))return!1}return!0}return ya.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Sa(e){if(Aa(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>ka(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&ga(t,r,ka(n))}return t}return ya.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function ka(e){return Sa(e)}let Oa=class{constructor(e){for(const t in e)this[t]=ka(e[t])}};var Ra=Object.freeze({__proto__:null,Description:Oa,checkProperties:_a,deepCopy:ka,defineReadOnly:ga,getStatic:va,resolveProperties:wa,shallowCopy:Ea});const xa="abi/5.7.0",Ia=new Ei(xa),Ca={};let Na={calldata:!0,memory:!0,storage:!0},Pa={calldata:!0,memory:!0};function Ma(e,t){if("bytes"===e||"string"===e){if(Na[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Pa[t])return!0;return(Na[t]||"payable"===t)&&Ia.throwArgumentError("invalid modifier","name",t),!1}function Ba(e,t){for(let r in t)ga(e,r,t[r])}const Da=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Fa=new RegExp(/^(.*)\[([0-9]*)\]$/);let La=class e{constructor(t,r){t!==Ca&&Ia.throwError("use fromString",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Ba(this,r);let n=this.type.match(Fa);Ba(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:e.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=Da.sighash),Da[e]||Ia.throwArgumentError("invalid format type","format",e),e===Da.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((t=>JSON.parse(t.format(e))))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==Da.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===Da.full?", ":",")+")"):t+=this.type,e!==Da.sighash&&(!0===this.indexed&&(t+=" indexed"),e===Da.full&&this.name&&(t+=" "+this.name)),t}static from(t,r){return"string"==typeof t?e.fromString(t,r):e.fromObject(t)}static fromObject(t){return e.isParamType(t)?t:new e(Ca,{name:t.name||null,type:$a(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(e.fromObject):null})}static fromString(t,r){return n=function(e,t){let r=e;function n(t){Ia.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");let a={type:"",name:"",state:{allowType:!0}},o=a;for(let r=0;r<e.length;r++){let a=e[r];switch(a){case"(":o.state.allowType&&""===o.type?o.type="tuple":o.state.allowParams||n(r),o.state.allowType=!1,o.type=$a(o.type),o.components=[i(o)],o=o.components[0];break;case")":delete o.state,"indexed"===o.name&&(t||n(r),o.indexed=!0,o.name=""),Ma(o.type,o.name)&&(o.name=""),o.type=$a(o.type);let e=o;o=o.parent,o||n(r),delete e.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,"indexed"===o.name&&(t||n(r),o.indexed=!0,o.name=""),Ma(o.type,o.name)&&(o.name=""),o.type=$a(o.type);let s=i(o.parent);o.parent.components.push(s),delete o.parent,o=s;break;case" ":o.state.allowType&&""!==o.type&&(o.type=$a(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&("indexed"===o.name?(t||n(r),o.indexed&&n(r),o.indexed=!0,o.name=""):Ma(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||n(r),o.type+=a,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(r),o.type+=a,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=a,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=a,delete o.state.allowArray):o.state.readArray?o.type+=a:n(r)}}return o.parent&&Ia.throwArgumentError("unexpected eof","param",e),delete a.state,"indexed"===o.name?(t||n(r.length-7),o.indexed&&n(r.length-7),o.indexed=!0,o.name=""):Ma(o.type,o.name)&&(o.name=""),a.type=$a(a.type),a}(t,!!r),e.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}static isParamType(e){return!(null==e||!e._isParamType)}};function Ua(e,t){return function(e){e=e.trim();let t=[],r="",n=0;for(let i=0;i<e.length;i++){let a=e[i];","===a&&0===n?(t.push(r),r=""):(r+=a,"("===a?n++:")"===a&&(n--,-1===n&&Ia.throwArgumentError("unbalanced parenthesis","value",e)))}r&&t.push(r);return t}(e).map((e=>La.fromString(e,t)))}let ja=class e{constructor(e,t){e!==Ca&&Ia.throwError("use a static from method",Ei.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Ba(this,t),this._isFragment=!0,Object.freeze(this)}static from(t){return e.isFragment(t)?t:"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isFragment(t))return t;switch(t.type){case"function":return Ka.fromObject(t);case"event":return qa.fromObject(t);case"constructor":return Ga.fromObject(t);case"error":return Xa.fromObject(t);case"fallback":case"receive":return null}return Ia.throwArgumentError("invalid fragment object","value",t)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?qa.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Ka.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Ga.fromString(e.trim()):"error"===e.split(" ")[0]?Xa.fromString(e.substring(5).trim()):Ia.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}},qa=class e extends ja{format(e){if(e||(e=Da.sighash),Da[e]||Ia.throwArgumentError("invalid format type","format",e),e===Da.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Da.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Da.full?", ":",")+") ",e!==Da.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isEventFragment(t))return t;"event"!==t.type&&Ia.throwArgumentError("invalid event object","value",t);const r={name:Ya(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(La.fromObject):[],type:"event"};return new e(Ca,r)}static fromString(t){let r=t.match(Qa);r||Ia.throwArgumentError("invalid event string","value",t);let n=!1;return r[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":n=!0;break;case"":break;default:Ia.warn("unknown modifier: "+e)}})),e.fromObject({name:r[1].trim(),anonymous:n,inputs:Ua(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}};function za(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&Ia.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||Ia.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Qi.from(r[1]),r[0]):e}function Ha(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function Va(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&Ia.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&Ia.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||Ia.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&Ia.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&Ia.throwArgumentError("unable to determine stateMutability","value",e),t}let Ga=class e extends ja{format(e){if(e||(e=Da.sighash),Da[e]||Ia.throwArgumentError("invalid format type","format",e),e===Da.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});e===Da.sighash&&Ia.throwError("cannot format a constructor for sighash",Ei.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===Da.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isConstructorFragment(t))return t;"constructor"!==t.type&&Ia.throwArgumentError("invalid constructor object","value",t);let r=Va(t);r.constant&&Ia.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(La.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Qi.from(t.gas):null};return new e(Ca,n)}static fromString(t){let r={type:"constructor"},n=(t=za(t,r)).match(Qa);return n&&"constructor"===n[1].trim()||Ia.throwArgumentError("invalid constructor string","value",t),r.inputs=Ua(n[2].trim(),!1),Ha(n[3].trim(),r),e.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}},Ka=class e extends Ga{format(e){if(e||(e=Da.sighash),Da[e]||Ia.throwArgumentError("invalid format type","format",e),e===Da.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e)))),outputs:this.outputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Da.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Da.full?", ":",")+") ",e!==Da.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((t=>t.format(e))).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isFunctionFragment(t))return t;"function"!==t.type&&Ia.throwArgumentError("invalid function object","value",t);let r=Va(t);const n={type:t.type,name:Ya(t.name),constant:r.constant,inputs:t.inputs?t.inputs.map(La.fromObject):[],outputs:t.outputs?t.outputs.map(La.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Qi.from(t.gas):null};return new e(Ca,n)}static fromString(t){let r={type:"function"},n=(t=za(t,r)).split(" returns ");n.length>2&&Ia.throwArgumentError("invalid function string","value",t);let i=n[0].match(Qa);if(i||Ia.throwArgumentError("invalid function signature","value",t),r.name=i[1].trim(),r.name&&Ya(r.name),r.inputs=Ua(i[2],!1),Ha(i[3].trim(),r),n.length>1){let e=n[1].match(Qa);""==e[1].trim()&&""==e[3].trim()||Ia.throwArgumentError("unexpected tokens","value",t),r.outputs=Ua(e[2],!1)}else r.outputs=[];return e.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}};function Wa(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||Ia.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}let Xa=class e extends ja{format(e){if(e||(e=Da.sighash),Da[e]||Ia.throwArgumentError("invalid format type","format",e),e===Da.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Da.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Da.full?", ":",")+") ",t.trim()}static from(t){return"string"==typeof t?e.fromString(t):e.fromObject(t)}static fromObject(t){if(e.isErrorFragment(t))return t;"error"!==t.type&&Ia.throwArgumentError("invalid error object","value",t);const r={type:t.type,name:Ya(t.name),inputs:t.inputs?t.inputs.map(La.fromObject):[]};return Wa(new e(Ca,r))}static fromString(t){let r={type:"error"},n=t.match(Qa);return n||Ia.throwArgumentError("invalid error signature","value",t),r.name=n[1].trim(),r.name&&Ya(r.name),r.inputs=Ua(n[2],!1),Wa(e.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}};function $a(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const Ja=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ya(e){return e&&e.match(Ja)||Ia.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const Qa=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Za=new Ei(xa);function eo(e){const t=[],r=function(e,n){if(Array.isArray(n))for(let i in n){const a=e.slice();a.push(i);try{r(a,n[i])}catch(e){t.push({path:a,error:e})}}};return r([],e),t}let to=class{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){Za.throwArgumentError(e,this.localName,t)}},ro=class{constructor(e){ga(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return Ui(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(Ci(e._data))}writeBytes(e){let t=Ii(e);const r=t.length%this.wordSize;return r&&(t=Ci([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=Ii(Qi.from(e));return t.length>this.wordSize&&Za.throwError("value out-of-bounds",Ei.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Ci([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}};var no={exports:{}};
2
2
  /**
3
3
  * [js-sha3]{@link https://github.com/emn178/js-sha3}
4
4
  *
@@ -28,7 +28,7 @@ e.exports=r=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exp
28
28
  * @author Chen, Yi-Cyuan [emn178@gmail.com]
29
29
  * @copyright Chen, Yi-Cyuan 2015-2018
30
30
  * @license MIT
31
- */gP=vP,function(){var e="input is invalid type",t="object"==typeof window,r=t?window:{};r.JS_SHA3_NO_WINDOW&&(t=!1);var n=!t&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?r=uC:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&gP.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,o="0123456789abcdef".split(""),s=[4,1024,262144,67108864],f=[0,8,16,24],u=[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],c=[224,256,384,512],d=[128,256],l=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var h=function(e,t,r){return function(n){return new x(e,t,e).update(n)[r]()}},m=function(e,t,r){return function(n,i){return new x(e,t,i).update(n)[r]()}},b=function(e,t,r){return function(t,n,i,a){return _["cshake"+e].update(t,n,i,a)[r]()}},y=function(e,t,r){return function(t,n,i,a){return _["kmac"+e].update(t,n,i,a)[r]()}},g=function(e,t,r,n){for(var i=0;i<l.length;++i){var a=l[i];e[a]=t(r,n,a)}return e},v=function(e,t){var r=h(e,t,"hex");return r.create=function(){return new x(e,t,e)},r.update=function(e){return r.create().update(e)},g(r,h,e,t)},w=[{name:"keccak",padding:[1,256,65536,16777216],bits:c,createMethod:v},{name:"sha3",padding:[6,1536,393216,100663296],bits:c,createMethod:v},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(e,t){var r=m(e,t,"hex");return r.create=function(r){return new x(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},g(r,m,e,t)}},{name:"cshake",padding:s,bits:d,createMethod:function(e,t){var r=p[e],n=b(e,0,"hex");return n.create=function(n,i,a){return i||a?new x(e,t,n).bytepad([i,a],r):_["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},g(n,b,e,t)}},{name:"kmac",padding:s,bits:d,createMethod:function(e,t){var r=p[e],n=y(e,0,"hex");return n.create=function(n,i,a){return new I(e,t,i).bytepad(["KMAC",a],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},g(n,y,e,t)}}],_={},E=[],T=0;T<w.length;++T)for(var A=w[T],S=A.bits,k=0;k<S.length;++k){var O=A.name+"_"+S[k];if(E.push(O),_[O]=A.createMethod(S[k],A.padding),"sha3"!==A.name){var R=A.name+S[k];E.push(R),_[R]=_[O]}}function x(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function I(e,t,r){x.call(this,e,t,r)}x.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var i,o,s=this.blocks,u=this.byteCount,c=t.length,d=this.blockCount,l=0,p=this.s;l<c;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<d+1;++i)s[i]=0;if(r)for(i=this.start;l<c&&i<u;++l)s[i>>2]|=t[l]<<f[3&i++];else for(i=this.start;l<c&&i<u;++l)(o=t.charCodeAt(l))<128?s[i>>2]|=o<<f[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<f[3&i++],s[i>>2]|=(128|63&o)<<f[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<f[3&i++],s[i>>2]|=(128|o>>6&63)<<f[3&i++],s[i>>2]|=(128|63&o)<<f[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++l)),s[i>>2]|=(240|o>>18)<<f[3&i++],s[i>>2]|=(128|o>>12&63)<<f[3&i++],s[i>>2]|=(128|o>>6&63)<<f[3&i++],s[i>>2]|=(128|63&o)<<f[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=s[d],i=0;i<d;++i)p[i]^=s[i];C(p),this.reset=!0}else this.start=i}return this},x.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},x.prototype.encodeString=function(t){var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}var i=0,o=t.length;if(r)i=o;else for(var s=0;s<t.length;++s){var f=t.charCodeAt(s);f<128?i+=1:f<2048?i+=2:f<55296||f>=57344?i+=3:(f=65536+((1023&f)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},x.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,a=[];return a.length=i,this.update(a),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];C(n)}},x.prototype.toString=x.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,s=0,f="";s<n;){for(a=0;a<t&&s<n;++a,++s)e=r[a],f+=o[e>>4&15]+o[15&e]+o[e>>12&15]+o[e>>8&15]+o[e>>20&15]+o[e>>16&15]+o[e>>28&15]+o[e>>24&15];s%t==0&&(C(r),a=0)}return i&&(e=r[a],f+=o[e>>4&15]+o[15&e],i>1&&(f+=o[e>>12&15]+o[e>>8&15]),i>2&&(f+=o[e>>20&15]+o[e>>16&15])),f},x.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,o=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var f=new Uint32Array(e);o<n;){for(a=0;a<t&&o<n;++a,++o)f[o]=r[a];o%t==0&&C(r)}return i&&(f[a]=r[a],e=e.slice(0,s)),e},x.prototype.buffer=x.prototype.arrayBuffer,x.prototype.digest=x.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,a=this.extraBytes,o=0,s=0,f=[];s<i;){for(o=0;o<r&&s<i;++o,++s)e=s<<2,t=n[o],f[e]=255&t,f[e+1]=t>>8&255,f[e+2]=t>>16&255,f[e+3]=t>>24&255;s%r==0&&C(n)}return a&&(e=s<<2,t=n[o],f[e]=255&t,a>1&&(f[e+1]=t>>8&255),a>2&&(f[e+2]=t>>16&255)),f},I.prototype=new x,I.prototype.finalize=function(){return this.encode(this.outputBits,!0),x.prototype.finalize.call(this)};var C=function(e){var t,r,n,i,a,o,s,f,c,d,l,p,h,m,b,y,g,v,w,_,E,T,A,S,k,O,R,x,I,C,N,P,M,B,D,F,L,U,j,q,z,H,V,G,K,W,X,$,J,Y,Q,Z,ee,te,re,ne,ie,ae,oe,se,fe,ue,ce;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],a=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],f=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],t=(p=e[8]^e[18]^e[28]^e[38]^e[48])^(o<<1|s>>>31),r=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|o>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(f<<1|c>>>31),r=a^(c<<1|f>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=o^(d<<1|l>>>31),r=s^(l<<1|d>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=f^(p<<1|h>>>31),r=c^(h<<1|p>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=d^(i<<1|a>>>31),r=l^(a<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,m=e[0],b=e[1],W=e[11]<<4|e[10]>>>28,X=e[10]<<4|e[11]>>>28,x=e[20]<<3|e[21]>>>29,I=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,fe=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,V=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,D=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,$=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,C=e[33]<<13|e[32]>>>19,N=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,F=e[14]<<6|e[15]>>>26,L=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,Y=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,P=e[45]<<29|e[44]>>>3,M=e[44]<<29|e[45]>>>3,S=e[6]<<28|e[7]>>>4,k=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,j=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,E=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,K=e[9]<<27|e[8]>>>5,O=e[18]<<20|e[19]>>>12,R=e[19]<<20|e[18]>>>12,ae=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,T=e[48]<<14|e[49]>>>18,A=e[49]<<14|e[48]>>>18,e[0]=m^~y&v,e[1]=b^~g&w,e[10]=S^~O&x,e[11]=k^~R&I,e[20]=B^~F&U,e[21]=D^~L&j,e[30]=G^~W&$,e[31]=K^~X&J,e[40]=te^~ne&ae,e[41]=re^~ie&oe,e[2]=y^~v&_,e[3]=g^~w&E,e[12]=O^~x&C,e[13]=R^~I&N,e[22]=F^~U&q,e[23]=L^~j&z,e[32]=W^~$&Y,e[33]=X^~J&Q,e[42]=ne^~ae&se,e[43]=ie^~oe&fe,e[4]=v^~_&T,e[5]=w^~E&A,e[14]=x^~C&P,e[15]=I^~N&M,e[24]=U^~q&H,e[25]=j^~z&V,e[34]=$^~Y&Z,e[35]=J^~Q&ee,e[44]=ae^~se&ue,e[45]=oe^~fe&ce,e[6]=_^~T&m,e[7]=E^~A&b,e[16]=C^~P&S,e[17]=N^~M&k,e[26]=q^~H&B,e[27]=z^~V&D,e[36]=Y^~Z&G,e[37]=Q^~ee&K,e[46]=se^~ue&te,e[47]=fe^~ce&re,e[8]=T^~m&y,e[9]=A^~b&g,e[18]=P^~S&O,e[19]=M^~k&R,e[28]=H^~B&F,e[29]=V^~D&L,e[38]=Z^~G&W,e[39]=ee^~K&X,e[48]=ue^~te&ne,e[49]=ce^~re&ie,e[0]^=u[n],e[1]^=u[n+1]};if(i)gP.exports=_;else for(T=0;T<E.length;++T)r[E[T]]=_[E[T]]}();var wP=vP.exports;function _P(e){return"0x"+wP.keccak_256(Ii(e))}let EP=!1,TP=!1;const AP={debug:1,default:2,info:2,warning:3,error:4,off:5};let SP=AP.default,kP=null;const OP=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var RP,xP;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(RP||(RP={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(xP||(xP={}));const IP="0123456789abcdef";let CP=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==AP[r]&&this.throwArgumentError("invalid log level name","logLevel",e),SP>AP[r]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(TP)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=IP[t[e]>>4],r+=IP[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const a=t;let o="";switch(r){case xP.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case xP.CALL_EXCEPTION:case xP.INSUFFICIENT_FUNDS:case xP.MISSING_NEW:case xP.NONCE_EXPIRED:case xP.REPLACEMENT_UNDERPRICED:case xP.TRANSACTION_REPLACED:case xP.UNPREDICTABLE_GAS_LIMIT:o=r}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=a,s.code=r,Object.keys(n).forEach((function(e){s[e]=n[e]})),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){OP&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:OP})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return kP||(kP=new e("logger/5.7.0")),kP}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),EP){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}TP=!!t,EP=!!r}static setLogLevel(t){const r=AP[t.toLowerCase()];null!=r?SP=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};CP.errors=xP,CP.levels=RP;var NP=li.BN;const PP=new CP("bignumber/5.7.0"),MP={};let BP=!1,DP=class e{constructor(e,t){e!==MP&&PP.throwError("cannot call constructor directly; use BigNumber.from",CP.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return LP(UP(this).fromTwos(e))}toTwos(e){return LP(UP(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return LP(UP(this).add(UP(e)))}sub(e){return LP(UP(this).sub(UP(e)))}div(t){return e.from(t).isZero()&&jP("division-by-zero","div"),LP(UP(this).div(UP(t)))}mul(e){return LP(UP(this).mul(UP(e)))}mod(e){const t=UP(e);return t.isNeg()&&jP("division-by-zero","mod"),LP(UP(this).umod(t))}pow(e){const t=UP(e);return t.isNeg()&&jP("negative-power","pow"),LP(UP(this).pow(t))}and(e){const t=UP(e);return(this.isNegative()||t.isNeg())&&jP("unbound-bitwise-result","and"),LP(UP(this).and(t))}or(e){const t=UP(e);return(this.isNegative()||t.isNeg())&&jP("unbound-bitwise-result","or"),LP(UP(this).or(t))}xor(e){const t=UP(e);return(this.isNegative()||t.isNeg())&&jP("unbound-bitwise-result","xor"),LP(UP(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&jP("negative-width","mask"),LP(UP(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&jP("negative-width","shl"),LP(UP(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&jP("negative-width","shr"),LP(UP(this).shrn(e))}eq(e){return UP(this).eq(UP(e))}lt(e){return UP(this).lt(UP(e))}lte(e){return UP(this).lte(UP(e))}gt(e){return UP(this).gt(UP(e))}gte(e){return UP(this).gte(UP(e))}isNegative(){return"-"===this._hex[0]}isZero(){return UP(this).isZero()}toNumber(){try{return UP(this).toNumber()}catch(e){jP("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return PP.throwError("this platform does not support BigInt",CP.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?BP||(BP=!0,PP.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?PP.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",CP.errors.UNEXPECTED_ARGUMENT,{}):PP.throwError("BigNumber.toString does not accept parameters",CP.errors.UNEXPECTED_ARGUMENT,{})),UP(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(MP,FP(t)):t.match(/^-?[0-9]+$/)?new e(MP,FP(new NP(t))):PP.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&jP("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&jP("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(xi(r))return e.from(Di(r));if(r)if(r.toHexString){const t=r.toHexString();if("string"==typeof t)return e.from(t)}else{let t=r._hex;if(null==t&&"BigNumber"===r.type&&(t=r.hex),"string"==typeof t&&(Mi(t)||"-"===t[0]&&Mi(t.substring(1))))return e.from(t)}return PP.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function FP(e){if("string"!=typeof e)return FP(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&PP.throwArgumentError("invalid hex","value",e),"0x00"===(e=FP(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function LP(e){return DP.from(FP(e))}function UP(e){const t=DP.from(e).toHexString();return"-"===t[0]?new NP("-"+t.substring(3),16):new NP(t.substring(2),16)}function jP(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),PP.throwError(e,CP.errors.NUMERIC_FAULT,n)}const qP=new CP("bignumber/5.7.0"),zP={},HP=DP.from(0),VP=DP.from(-1);function GP(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),qP.throwError(e,CP.errors.NUMERIC_FAULT,i)}let KP="0";for(;KP.length<256;)KP+=KP;function WP(e){if("number"!=typeof e)try{e=DP.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+KP.substring(0,e):qP.throwArgumentError("invalid decimal size","decimals",e)}function XP(e,t){null==t&&(t=0);const r=WP(t),n=(e=DP.from(e)).lt(HP);n&&(e=e.mul(VP));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=e.div(r).toString();return e=1===r.length?a:a+"."+i,n&&(e="-"+e),e}function $P(e,t){null==t&&(t=0);const r=WP(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||qP.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&qP.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&qP.throwArgumentError("too many decimal points","value",e);let a=i[0],o=i[1];for(a||(a="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>r.length-1&&GP("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=DP.from(a),f=DP.from(o);let u=s.mul(r).add(f);return n&&(u=u.mul(VP)),u}let JP=class e{constructor(e,t,r,n){e!==zP&&qP.throwError("cannot use FixedFormat constructor; use FixedFormat.from",CP.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=WP(n),Object.freeze(this)}static from(t){if(t instanceof e)return t;"number"==typeof t&&(t=`fixed128x${t}`);let r=!0,n=128,i=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)r=!1;else{const e=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);e||qP.throwArgumentError("invalid fixed format","format",t),r="u"!==e[1],n=parseInt(e[2]),i=parseInt(e[3])}else if(t){const e=(e,r,n)=>null==t[e]?n:(typeof t[e]!==r&&qP.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);r=e("signed","boolean",r),n=e("width","number",n),i=e("decimals","number",i)}return n%8&&qP.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&qP.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new e(zP,r,n,i)}},YP=class e{constructor(e,t,r,n){e!==zP&&qP.throwError("cannot use FixedNumber constructor; use FixedNumber.from",CP.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&qP.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(t){this._checkFormat(t);const r=$P(this._value,this.format.decimals),n=$P(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const r=$P(this._value,this.format.decimals),n=$P(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const r=$P(this._value,this.format.decimals),n=$P(t._value,t.format.decimals);return e.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const r=$P(this._value,this.format.decimals),n=$P(t._value,t.format.decimals);return e.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let r=e.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(QP.toFormat(r.format))),r}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let r=e.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(QP.toFormat(r.format))),r}round(t){null==t&&(t=0);const r=this.toString().split(".");if(1===r.length&&r.push("0"),(t<0||t>80||t%1)&&qP.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;const n=e.from("1"+KP.substring(0,t),this.format),i=ZP.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&qP.throwArgumentError("invalid byte width","width",e);return zi(DP.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return e.fromString(this._value,t)}static fromValue(t,r,n){return null!=n||null==r||function(e){return null!=e&&(DP.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Mi(e)||"bigint"==typeof e||xi(e))}(r)||(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(XP(t,r),JP.from(n))}static fromString(t,r){null==r&&(r="fixed");const n=JP.from(r),i=$P(t,n.decimals);!n.signed&&i.lt(HP)&&GP("unsigned value cannot be negative","overflow","value",t);let a=null;n.signed?a=i.toTwos(n.width).toHexString():(a=i.toHexString(),a=zi(a,n.width/8));const o=XP(i,n.decimals);return new e(zP,a,o,n)}static fromBytes(t,r){null==r&&(r="fixed");const n=JP.from(r);if(Ii(t).length>n.width/8)throw new Error("overflow");let i=DP.from(t);n.signed&&(i=i.fromTwos(n.width));const a=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=XP(i,n.decimals);return new e(zP,a,o,n)}static from(t,r){if("string"==typeof t)return e.fromString(t,r);if(xi(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(t){if(t.code!==CP.errors.INVALID_ARGUMENT)throw t}return qP.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}};const QP=YP.from(1),ZP=YP.from("0.5"),eM=new CP("strings/5.7.0");var tM,rM;function nM(e,t=tM.current){t!=tM.current&&(eM.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const a=65536+((1023&n)<<10)+(1023&i);r.push(a>>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(63&a|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return Ii(r)}function iM(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])})),n}function aM(e){let t=0;return e.split(",").map((e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}}))}function oM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function sM(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oM(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function fM(e,t,r){return uM.apply(this,arguments)}function uM(){return(uM=fC(pC.mark((function e(t,r,n){var i,a,o,s,f,u,c,d;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.users.map((function(e){return{ether_key:e.user,tokens:e.tokens.map((function(e){return sM({id:e.id,blueprint:e.blueprint},e.royalties&&e.royalties.length>0&&{royalties:e.royalties.map((function(e){return{recipient:e.recipient,percentage:e.percentage}}))})}))}})),a=r.royalties,o=sM(sM({contract_address:r.contract_address},a&&a.length>0&&{royalties:a.map((function(e){return{recipient:e.recipient,percentage:e.percentage}}))}),{},{users:i,auth_signature:""}),s=_P(nM(JSON.stringify(o))),e.next=6,yC(s,t);case 6:return f=e.sent,u=sM(sM({users:o.users.map((function(e){return{user:e.ether_key,tokens:e.tokens}}))},a&&a.length>0&&{royalties:a}),{},{contract_address:r.contract_address,auth_signature:f}),c={mintTokensRequestV2:[u]},e.next=11,n.mintTokens(c);case 11:return d=e.sent,e.abrupt("return",d.data);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cM(e){switch(e.type){case"ERC721":return{type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return{type:"ERC20",data:{token_address:e.tokenAddress}};case"ETH":return{type:"ETH",data:{decimals:18}}}}function dM(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return lM(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?lM(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function lM(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function pM(e){return hM.apply(this,arguments)}function hM(){return(hM=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p,h,m,b;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ethSigner,i=t.starkSigner,a=t.request,o=t.transfersApi,e.next=3,n.getAddress();case 3:return s=e.sent,f="ERC721"===a.type?"1":a.amount,e.next=7,o.getSignableTransferV1({getSignableTransferRequest:{sender:s,token:cM(a),amount:f,receiver:a.receiver}});case 7:return u=e.sent,c=u.data,d=c.signable_message,l=c.payload_hash,e.next=11,yC(d,n);case 11:return p=e.sent,e.next=14,i.signMessage(l);case 14:return h=e.sent,m={sender_stark_key:u.data.sender_stark_key,sender_vault_id:u.data.sender_vault_id,receiver_stark_key:u.data.receiver_stark_key,receiver_vault_id:u.data.receiver_vault_id,asset_id:u.data.asset_id,amount:u.data.amount,nonce:u.data.nonce,expiration_timestamp:u.data.expiration_timestamp,stark_signature:h},e.next=18,o.createTransferV1({createTransferRequest:m,xImxEthAddress:s,xImxEthSignature:p});case 18:return b=e.sent,e.abrupt("return",{sent_signature:null==b?void 0:b.data.sent_signature,status:null==b||null===(r=b.data.status)||void 0===r?void 0:r.toString(),time:null==b?void 0:b.data.time,transfer_id:null==b?void 0:b.data.transfer_id});case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mM(e){return bM.apply(this,arguments)}function bM(){return(bM=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p,h,m,b,y,g;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.transfersApi,e.next=3,r.getAddress();case 3:return o=e.sent,s=i.map((function(e){return{amount:"1",token:cM({type:"ERC721",tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver}})),e.next=7,a.getSignableTransfer({getSignableTransferRequestV2:{sender_ether_key:o,signable_requests:s}});case 7:if(f=e.sent,void 0!==(u=f.data.signable_message)){e.next=11;break}throw new Error("Invalid response from Signable registration offchain");case 11:return e.next=13,yC(u,r);case 13:c=e.sent,d=[],l=dM(f.data.signable_responses),e.prev=16,l.s();case 18:if((p=l.n()).done){e.next=27;break}return h=p.value,e.next=22,n.signMessage(h.payload_hash);case 22:m=e.sent,b={sender_vault_id:h.sender_vault_id,receiver_stark_key:h.receiver_stark_key,receiver_vault_id:h.receiver_vault_id,asset_id:h.asset_id,amount:h.amount,nonce:h.nonce,expiration_timestamp:h.expiration_timestamp,stark_signature:m},d.push(b);case 25:e.next=18;break;case 27:e.next=32;break;case 29:e.prev=29,e.t0=e.catch(16),l.e(e.t0);case 32:return e.prev=32,l.f(),e.finish(32);case 35:return y={sender_stark_key:f.data.sender_stark_key,requests:d},e.next=38,a.createTransfer({createTransferRequestV2:y,xImxEthAddress:o,xImxEthSignature:c});case 38:return g=e.sent,e.abrupt("return",{transfer_ids:null==g?void 0:g.data.transfer_ids});case 40:case"end":return e.stop()}}),e,null,[[16,29,32,35]])})))).apply(this,arguments)}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(tM||(tM={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(rM||(rM={})),aM("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),iM("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),iM("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),iM("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(e){if(e.length%4!=0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t})),aM("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const yM=new CP("units/5.7.0"),gM=["wei","kwei","mwei","gwei","szabo","finney","ether"];function vM(e,t){if("string"!=typeof e&&yM.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=gM.indexOf(t);-1!==e&&(t=3*e)}return $P(e,null!=t?t:18)}function wM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wM(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function EM(e,t,r,n,i,a,o){return TM.apply(this,arguments)}function TM(){return(TM=fC(pC.mark((function e(t,r,n,i,a,o,s){var f,u,c;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return f=e.sent,e.next=5,bP(f,i,s);case 5:return u=e.sent,e.next=8,o.populateTransaction.registerAndDepositEth(f,i,u.operator_signature,n,a);case 8:return c=e.sent,e.abrupt("return",t.sendTransaction(_M(_M({},c),{},{value:r})));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function AM(e,t,r,n,i,a){return SM.apply(this,arguments)}function SM(){return(SM=fC(pC.mark((function e(t,r,n,i,a,o){var s;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction["deposit(uint256,uint256,uint256)"](i,n,a);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(_M(_M({},s),{},{value:r})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kM(e,t,r,n,i,a){return OM.apply(this,arguments)}function OM(){return(OM=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u,c,d,l,p,h,m,b,y;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,f={decimals:18},u=vM(r.amount,"wei"),c={user:s,token:{type:r.type,data:f},amount:u.toString()},e.next=8,n.getSignableDeposit({getSignableDepositRequest:c});case 8:return d=e.sent,e.next=11,a.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type}}});case 11:return l=e.sent,p=l.data.asset_type,h=d.data.stark_key,m=d.data.vault_id,b=$I.connect(o.ethConfiguration.coreContractAddress,t),y=aC.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,hP(h,y);case 19:if(e.sent){e.next=24;break}return e.abrupt("return",EM(t,u,p,h,m,b,i));case 24:return e.abrupt("return",AM(t,u,p,h,m,b));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function RM(e,t,r,n,i,a){return xM.apply(this,arguments)}function xM(){return(xM=fC(pC.mark((function e(t,r,n,i,a,o){var s;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction.depositERC20(i,n,a,r);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(s));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function IM(e,t,r,n,i,a,o){return CM.apply(this,arguments)}function CM(){return(CM=fC(pC.mark((function e(t,r,n,i,a,o,s){var f,u,c;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return f=e.sent,e.next=5,bP(f,i,s);case 5:return u=e.sent,e.next=8,o.populateTransaction.registerAndDepositERC20(f,i,u.operator_signature,n,a,r);case 8:return c=e.sent,e.abrupt("return",t.sendTransaction(c));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function NM(e,t,r,n,i,a,o){return PM.apply(this,arguments)}function PM(){return(PM=fC(pC.mark((function e(t,r,n,i,a,o,s){var f,u,c,d,l,p,h,m,b,y,g,v,w,_,E,T;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return f=e.sent,e.next=5,a.getToken({address:r.tokenAddress});case 5:return u=e.sent,c=parseInt(u.data.decimals),d={decimals:c,token_address:r.tokenAddress},l=vM(r.amount,0),p=VI.connect(r.tokenAddress,t),e.next=12,p.populateTransaction.approve(s.ethConfiguration.coreContractAddress,l);case 12:return h=e.sent,e.next=15,t.sendTransaction(h);case 15:return m={user:f,token:{type:r.type,data:d},amount:l.toString()},e.next=18,n.getSignableDeposit({getSignableDepositRequest:m});case 18:return b=e.sent,e.next=21,o.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type,data:{token_address:r.tokenAddress}}}});case 21:return y=e.sent,g=y.data.asset_type,v=b.data.stark_key,w=b.data.vault_id,_=DP.from(b.data.amount),E=$I.connect(s.ethConfiguration.coreContractAddress,t),T=aC.connect(s.ethConfiguration.registrationContractAddress,t),e.next=30,hP(v,T);case 30:if(e.sent){e.next=35;break}return e.abrupt("return",IM(t,_,g,v,w,E,i));case 35:return e.abrupt("return",RM(t,_,g,v,w,E));case 36:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function MM(e,t,r,n,i,a){return BM.apply(this,arguments)}function BM(){return(BM=fC(pC.mark((function e(t,r,n,i,a,o){var s;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction.depositNft(i,n,a,r);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(s));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function DM(e,t,r,n,i,a){return FM.apply(this,arguments)}function FM(){return(FM=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u,c,d,l,p,h,m,b,y,g,v,w;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,f={token_address:r.tokenAddress,token_id:r.tokenId},u={user:s,token:{type:r.type,data:f},amount:"1".toString()},e.next=8,n.getSignableDeposit({getSignableDepositRequest:u});case 8:return c=e.sent,e.next=11,a.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type,data:{token_address:r.tokenAddress,token_id:r.tokenId}}}});case 11:return d=e.sent,l=d.data.asset_type,p=c.data.stark_key,h=c.data.vault_id,m=$I.connect(o.ethConfiguration.coreContractAddress,t),b=aC.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,hP(p,b);case 19:return y=e.sent,g=KI.connect(r.tokenAddress,t),v=o.ethConfiguration.coreContractAddress,e.next=24,g.isApprovedForAll(s,v);case 24:if(e.sent){e.next=28;break}return e.next=28,g.setApprovalForAll(v,!0);case 28:if(y){e.next=34;break}return e.next=31,bP(s,p,i);case 31:return w=e.sent,e.next=34,m.registerUser(s,p,w.operator_signature);case 34:return e.abrupt("return",MM(t,r.tokenId,l,p,h,m));case 35:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var LM=function(e){if(void 0!==e)return e;throw new Error("undefined field exception")};function UM(e){return jM.apply(this,arguments)}function jM(){return(jM=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p,h;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.withdrawalsApi,a="ERC721"===t.type?"1":t.amount,e.t0=i,e.next=5,r.getAddress();case 5:return e.t1=e.sent,e.t2=cM(t),e.t3=a,e.t4={user:e.t1,token:e.t2,amount:e.t3},e.t5={getSignableWithdrawalRequest:e.t4},e.next=12,e.t0.getSignableWithdrawal.call(e.t0,e.t5);case 12:return o=e.sent,s=o.data,f=s.signable_message,u=s.payload_hash,e.next=16,n.signMessage(u);case 16:return c=e.sent,e.next=19,_C(f,r);case 19:return d=e.sent,l=d.ethAddress,p=d.ethSignature,e.next=24,i.createWithdrawal({createWithdrawalRequest:{stark_key:LM(o.data.stark_key),amount:a,asset_id:LM(o.data.asset_id),vault_id:LM(o.data.vault_id),nonce:LM(o.data.nonce),stark_signature:c},xImxEthAddress:l,xImxEthSignature:p});case 24:return h=e.sent,e.abrupt("return",h.data);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function zM(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qM(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function HM(e,t,r,n){return VM.apply(this,arguments)}function VM(){return(VM=fC(pC.mark((function e(t,r,n,i){var a;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.encodeAsset({assetType:t,encodeAssetRequest:{token:zM({type:r},i&&{data:i})}});case 2:return a=e.sent,e.abrupt("return",a.data);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function GM(e,t,r,n,i){return KM.apply(this,arguments)}function KM(){return(KM=fC(pC.mark((function e(t,r,n,i,a){var o,s,f;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return o=e.sent,e.next=5,bP(o,n,a);case 5:return s=e.sent,e.next=8,i.populateTransaction.registerAndWithdraw(o,n,s.operator_signature,r);case 8:return f=e.sent,e.abrupt("return",t.sendTransaction(f));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function WM(e,t,r,n){return XM.apply(this,arguments)}function XM(){return(XM=fC(pC.mark((function e(t,r,n,i){var a;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.populateTransaction.withdraw(n,r);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(a));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $M(e,t,r,n,i,a){return JM.apply(this,arguments)}function JM(){return(JM=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,HM("asset","ERC20",i,{token_address:n.tokenAddress});case 2:return s=e.sent,f=$I.connect(o.ethConfiguration.coreContractAddress,t),u=aC.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,hP(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",GM(t,s.asset_type,r,u,a));case 12:return e.abrupt("return",WM(t,s.asset_type,r,f));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function YM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function QM(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?YM(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ZM(e,t,r,n,i){return eB.apply(this,arguments)}function eB(){return(eB=fC(pC.mark((function e(t,r,n,i,a){var o;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.populateTransaction.withdrawAndMint(n,r,i);case 2:return o=e.sent,e.abrupt("return",t.sendTransaction(o));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tB(e,t,r,n,i,a){return rB.apply(this,arguments)}function rB(){return(rB=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,e.next=5,bP(s,n,o);case 5:return f=e.sent,e.next=8,a.populateTransaction.regsiterAndWithdrawAndMint(s,n,f.operator_signature,r,i);case 8:return u=e.sent,e.abrupt("return",t.sendTransaction(u));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nB(e){var t=e.data.id,r=e.data.blueprint||"";return My(dy("{".concat(t,"}:{").concat(r,"}")))}function iB(e,t,r,n,i,a){return aB.apply(this,arguments)}function aB(){return(aB=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u,c;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,HM("mintable-asset","ERC721",i,QM({id:n.data.id,token_address:n.data.tokenAddress},n.data.blueprint&&{blueprint:n.data.blueprint}));case 2:return s=e.sent,f=nB(n),u=$I.connect(o.ethConfiguration.coreContractAddress,t),c=aC.connect(o.ethConfiguration.registrationContractAddress,t),e.next=8,hP(r,c);case 8:if(e.sent){e.next=13;break}return e.abrupt("return",tB(t,s.asset_type,r,f,c,a));case 13:return e.abrupt("return",ZM(t,s.asset_type,r,f,u));case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oB(e,t,r,n,i,a){return sB.apply(this,arguments)}function sB(){return(sB=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,e.next=5,bP(s,n,o);case 5:return f=e.sent,e.next=8,a.populateTransaction.registerAndWithdrawNft(s,n,f.operator_signature,r,i);case 8:return u=e.sent,e.abrupt("return",t.sendTransaction(u));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fB(e,t,r,n,i){return uB.apply(this,arguments)}function uB(){return(uB=fC(pC.mark((function e(t,r,n,i,a){var o;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.populateTransaction.withdrawNft(n,r,i);case 2:return o=e.sent,e.abrupt("return",t.sendTransaction(o));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cB(e,t,r,n,i,a){return dB.apply(this,arguments)}function dB(){return(dB=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,HM("asset","ERC721",i,{token_id:n.tokenId,token_address:n.tokenAddress});case 2:return s=e.sent,f=$I.connect(o.ethConfiguration.coreContractAddress,t),u=aC.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,hP(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",oB(t,s.asset_type,r,n.tokenId,u,a));case 12:return e.abrupt("return",fB(t,s.asset_type,r,n.tokenId,f));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lB(e,t,r,n,i,a,o){return pB.apply(this,arguments)}function pB(){return(pB=fC(pC.mark((function e(t,r,n,i,a,o,s){var f,u;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f=n.tokenAddress,u=n.tokenId,e.next=4,a.getMintableTokenDetailsByClientTokenId({tokenAddress:f,tokenId:u}).then((function(e){return iB(t,r,{type:"ERC721",data:{id:u,tokenAddress:f,blueprint:e.data.blueprint}},i,o,s)})).catch((function(e){var a;if(404===(null===(a=e.response)||void 0===a?void 0:a.status))return cB(t,r,n,i,o,s);throw e}));case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function hB(e,t,r,n,i){return mB.apply(this,arguments)}function mB(){return(mB=fC(pC.mark((function e(t,r,n,i,a){var o,s,f;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return o=e.sent,e.next=5,bP(o,n,a);case 5:return s=e.sent,e.next=8,i.populateTransaction.registerAndWithdraw(o,n,s.operator_signature,r);case 8:return f=e.sent,e.abrupt("return",t.sendTransaction(f));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bB(e,t,r,n){return yB.apply(this,arguments)}function yB(){return(yB=fC(pC.mark((function e(t,r,n,i){var a;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.populateTransaction.withdraw(n,r);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(a));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gB(e,t,r,n,i){return vB.apply(this,arguments)}function vB(){return(vB=fC(pC.mark((function e(t,r,n,i,a){var o,s,f;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,HM("asset","ETH",n);case 2:return o=e.sent,s=$I.connect(a.ethConfiguration.coreContractAddress,t),f=aC.connect(a.ethConfiguration.registrationContractAddress,t),e.next=7,hP(r,f);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",hB(t,o.asset_type,r,f,i));case 12:return e.abrupt("return",bB(t,o.asset_type,r,s));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wB(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _B(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wB(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wB(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function EB(e){return TB.apply(this,arguments)}function TB(){return(TB=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p,h,m,b,y,g;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.ordersApi,e.next=3,r.getAddress();case 3:return o=e.sent,s="ERC721"===i.sell.type?"1":i.sell.amount,f="ERC721"===i.buy.type?"1":i.buy.amount,u={user:o,amount_buy:f,token_buy:cM(i.buy),amount_sell:s,token_sell:cM(i.sell),fees:i.fees,expiration_timestamp:i.expiration_timestamp,split_fees:!0},e.next=9,a.getSignableOrder({getSignableOrderRequestV3:u});case 9:return c=e.sent,d=c.data,l=d.signable_message,p=d.payload_hash,e.next=13,yC(l,r);case 13:return h=e.sent,e.next=16,n.signMessage(p);case 16:return m=e.sent,b=c.data,y={createOrderRequest:{amount_buy:b.amount_buy,amount_sell:b.amount_sell,asset_id_buy:b.asset_id_buy,asset_id_sell:b.asset_id_sell,expiration_timestamp:b.expiration_timestamp,include_fees:!0,fees:i.fees,nonce:b.nonce,stark_key:b.stark_key,stark_signature:m,vault_id_buy:b.vault_id_buy,vault_id_sell:b.vault_id_sell},xImxEthAddress:o,xImxEthSignature:h},e.next=21,a.createOrderV3(y);case 21:return g=e.sent,e.abrupt("return",_B({},g.data));case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function AB(e){return SB.apply(this,arguments)}function SB(){return(SB=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.ordersApi,e.next=3,a.getSignableCancelOrderV3({getSignableCancelOrderRequest:{order_id:i.order_id}});case 3:return o=e.sent,s=o.data,f=s.signable_message,u=s.payload_hash,e.next=7,yC(f,r);case 7:return c=e.sent,e.next=10,n.signMessage(u);case 10:return d=e.sent,e.next=13,r.getAddress();case 13:return l=e.sent,e.next=16,a.cancelOrderV3({id:i.order_id.toString(),cancelOrderRequest:{order_id:i.order_id,stark_signature:d},xImxEthAddress:l,xImxEthSignature:c});case 16:return p=e.sent,e.abrupt("return",{order_id:p.data.order_id,status:p.data.status});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kB(e){return OB.apply(this,arguments)}function OB(){return(OB=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.tradesApi,e.next=3,r.getAddress();case 3:return o=e.sent,e.next=6,a.getSignableTrade({getSignableTradeRequest:{user:o,order_id:i.order_id,fees:i.fees}});case 6:return s=e.sent,f=s.data,u=f.signable_message,c=f.payload_hash,e.next=10,yC(u,r);case 10:return d=e.sent,e.next=13,n.signMessage(c);case 13:return l=e.sent,e.next=16,a.createTradeV3({createTradeRequest:{amount_buy:s.data.amount_buy,amount_sell:s.data.amount_sell,asset_id_buy:s.data.asset_id_buy,asset_id_sell:s.data.asset_id_sell,expiration_timestamp:s.data.expiration_timestamp,fee_info:s.data.fee_info,fees:i.fees,include_fees:!0,nonce:s.data.nonce,order_id:i.order_id,stark_key:s.data.stark_key,vault_id_buy:s.data.vault_id_buy,vault_id_sell:s.data.vault_id_sell,stark_signature:l},xImxEthAddress:o,xImxEthSignature:d});case 16:return p=e.sent,e.abrupt("return",p.data);case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function RB(e){return xB.apply(this,arguments)}function xB(){return(xB=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p,h,m,b;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ethSigner,i=t.starkSigner,a=t.request,o=t.exchangesApi,e.next=3,n.getAddress();case 3:return s=e.sent,f=a.amount,e.next=7,o.getExchangeSignableTransfer({id:a.transactionID,getSignableTransferRequest:{sender:s,token:cM(a),amount:f,receiver:a.receiver}});case 7:return u=e.sent,c=u.data,d=c.signable_message,l=c.payload_hash,e.next=11,yC(d,n);case 11:return p=e.sent,e.next=14,i.signMessage(l);case 14:return h=e.sent,m={sender_stark_key:u.data.sender_stark_key,sender_vault_id:u.data.sender_vault_id,receiver_stark_key:u.data.receiver_stark_key,receiver_vault_id:u.data.receiver_vault_id,asset_id:u.data.asset_id,amount:u.data.amount,nonce:u.data.nonce,expiration_timestamp:u.data.expiration_timestamp,stark_signature:h},e.next=18,o.createExchangeTransfer({id:a.transactionID,createTransferRequest:m,xImxEthAddress:s,xImxEthSignature:p});case 18:return b=e.sent,e.abrupt("return",{sent_signature:null==b?void 0:b.data.sent_signature,status:null==b||null===(r=b.data.status)||void 0===r?void 0:r.toString(),time:null==b?void 0:b.data.time,transfer_id:null==b?void 0:b.data.transfer_id});case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function IB(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function CB(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?IB(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):IB(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var NB=function(){function e(t){UI(this,e),this.config=t;var r=t.apiConfiguration;this.config=t,this.depositsApi=new lN(r),this.encodingApi=new bN(r),this.mintsApi=new NN(r),this.ordersApi=new jN(r),this.tokensApi=new XN(r),this.tradesApi=new QN(r),this.transfersApi=new rP(r),this.usersApi=new oP(r),this.withdrawalsApi=new cP(r),this.projectsApi=new VN(r),this.collectionsApi=new fN(r),this.metadataApi=new AN(r),this.metadataRefreshesApi=new RN(r),this.exchangesApi=new wN(r)}var t,r,n,i,a,o,s,f,u,c,d,l,p,h,m,b,y,g,v,w,_,E,T,A,S,k,O,R;return qI(e,[{key:"isChainValid",value:function(e){return e===this.config.ethConfiguration.chainID}},{key:"validateChain",value:(R=fC(pC.mark((function e(t){var r;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getChainId();case 2:if(r=e.sent,this.isChainValid(r)){e.next=5;break}throw new Error("The wallet used for this operation is not from the correct network.");case 5:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"registerOffchain",value:(O=fC(pC.mark((function e(t){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",lP(CB(CB({},t),{},{usersApi:this.usersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"isRegisteredOnchain",value:(k=fC(pC.mark((function e(t){var r,n;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return r=aC.connect(this.config.ethConfiguration.registrationContractAddress,t.ethSigner),e.next=5,t.starkSigner.getAddress();case 5:return n=e.sent,e.abrupt("return",hP(n,r));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"mint",value:(S=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",fM(t,r,this.mintsApi));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"transfer",value:(A=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",pM(CB(CB({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"exchangeTransfer",value:(T=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",RB(CB(CB({},t),{},{request:r,exchangesApi:this.exchangesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"batchNftTransfer",value:(E=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",mM(CB(CB({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"deposit",value:(_=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=r.type,e.next="ETH"===e.t0?3:"ERC20"===e.t0?4:"ERC721"===e.t0?5:6;break;case 3:return e.abrupt("return",this.depositEth(t,r));case 4:return e.abrupt("return",this.depositERC20(t,r));case 5:return e.abrupt("return",this.depositERC721(t,r));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"depositEth",value:(w=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",kM(t,r,this.depositsApi,this.usersApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"depositERC20",value:(v=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",NM(t,r,this.depositsApi,this.usersApi,this.tokensApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"depositERC721",value:(g=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",DM(t,r,this.depositsApi,this.usersApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"prepareWithdrawal",value:(y=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",UM(CB(CB(CB({},t),r),{},{withdrawalsApi:this.withdrawalsApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"completeWithdrawal",value:function(e,t,r){switch(r.type){case"ETH":return this.completeEthWithdrawal(e,t);case"ERC20":return this.completeERC20Withdrawal(e,t,r);case"ERC721":return this.completeERC721Withdrawal(e,t,r)}}},{key:"completeEthWithdrawal",value:(b=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",gB(t,r,this.encodingApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"completeERC20Withdrawal",value:(m=fC(pC.mark((function e(t,r,n){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",$M(t,r,n,this.encodingApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return m.apply(this,arguments)})},{key:"completeERC721Withdrawal",value:function(){var e=fC(pC.mark((function e(t,r,n){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",lB(t,r,n,this.encodingApi,this.mintsApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"createOrder",value:(h=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",EB(CB(CB({},t),{},{request:r,ordersApi:this.ordersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"cancelOrder",value:(p=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",AB(CB(CB({},t),{},{request:r,ordersApi:this.ordersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"createTrade",value:(l=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",kB(CB(CB({},t),{},{request:r,tradesApi:this.tradesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"createProject",value:(d=fC(pC.mark((function e(t,r){var n;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return n=e.sent,e.abrupt("return",this.projectsApi.createProject({iMXSignature:n.signature,iMXTimestamp:n.timestamp,createProjectRequest:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"getProject",value:(c=fC(pC.mark((function e(t,r){var n;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return n=e.sent,e.abrupt("return",this.projectsApi.getProject({id:r,iMXSignature:n.signature,iMXTimestamp:n.timestamp}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"getProjects",value:(u=fC(pC.mark((function e(t,r,n,i,a){var o;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return o=e.sent,e.abrupt("return",this.projectsApi.getProjects({iMXSignature:o.signature,iMXTimestamp:o.timestamp,pageSize:r,cursor:n,orderBy:i,direction:a}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return u.apply(this,arguments)})},{key:"createCollection",value:(f=fC(pC.mark((function e(t,r){var n;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return n=e.sent,e.abrupt("return",this.collectionsApi.createCollection({iMXSignature:n.signature,iMXTimestamp:n.timestamp,createCollectionRequest:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"updateCollection",value:(s=fC(pC.mark((function e(t,r,n){var i;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return i=e.sent,e.abrupt("return",this.collectionsApi.updateCollection({iMXSignature:i.signature,iMXTimestamp:i.timestamp,address:r,updateCollectionRequest:n}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return s.apply(this,arguments)})},{key:"addMetadataSchemaToCollection",value:(o=fC(pC.mark((function e(t,r,n){var i;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return i=e.sent,e.abrupt("return",this.metadataApi.addMetadataSchemaToCollection({iMXSignature:i.signature,iMXTimestamp:i.timestamp,addMetadataSchemaToCollectionRequest:n,address:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return o.apply(this,arguments)})},{key:"updateMetadataSchemaByName",value:(a=fC(pC.mark((function e(t,r,n,i){var a;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return a=e.sent,e.abrupt("return",this.metadataApi.updateMetadataSchemaByName({iMXSignature:a.signature,iMXTimestamp:a.timestamp,address:r,name:n,metadataSchemaRequest:i}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return a.apply(this,arguments)})},{key:"listMetadataRefreshes",value:(i=fC(pC.mark((function e(t,r,n,i){var a,o;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return a=e.sent,e.next=5,t.getAddress();case 5:return o=e.sent,e.abrupt("return",this.metadataRefreshesApi.getAListOfMetadataRefreshes({xImxEthSignature:a.signature,xImxEthTimestamp:a.timestamp,xImxEthAddress:o,collectionAddress:r,pageSize:n,cursor:i}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return i.apply(this,arguments)})},{key:"getMetadataRefreshErrors",value:(n=fC(pC.mark((function e(t,r,n,i){var a,o;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return a=e.sent,e.next=5,t.getAddress();case 5:return o=e.sent,e.abrupt("return",this.metadataRefreshesApi.getMetadataRefreshErrors({xImxEthSignature:a.signature,xImxEthTimestamp:a.timestamp,xImxEthAddress:o,refreshId:r,pageSize:n,cursor:i}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"getMetadataRefreshResults",value:(r=fC(pC.mark((function e(t,r){var n,i;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return n=e.sent,e.next=5,t.getAddress();case 5:return i=e.sent,e.abrupt("return",this.metadataRefreshesApi.getMetadataRefreshResults({xImxEthSignature:n.signature,xImxEthTimestamp:n.timestamp,xImxEthAddress:i,refreshId:r}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"createMetadataRefresh",value:(t=fC(pC.mark((function e(t,r){var n,i;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return n=e.sent,e.next=5,t.getAddress();case 5:return i=e.sent,e.abrupt("return",this.metadataRefreshesApi.requestAMetadataRefresh({xImxEthSignature:n.signature,xImxEthTimestamp:n.timestamp,xImxEthAddress:i,createMetadataRefreshRequest:r}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}();var PB=function(e){ZI(r,LC(Error));var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=JI(e);if(t){var i=JI(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return rC(this,r)}}(r);function r(e){var n,i=e.code,a=e.details,o=e.message;return UI(this,r),(n=t.call(this,o)).code=i,n.details=a,n}return qI(r)}();function MB(e){if(LI.isAxiosError(e)&&e.response){var t,r,n,i=e.response.data;return i.code&&i.message?new PB({code:i.code,details:i.details,message:i.message}):new PB({code:null!==(t=null!==(r=e.code)&&void 0!==r?r:null===(n=e.response)||void 0===n?void 0:n.status.toString())&&void 0!==t?t:"unknown_error_code",message:String(e)})}return new PB({code:"unknown_error_code",message:String(e)})}var BB=function(){function e(t){UI(this,e),this.depositsApi=new lN(t.apiConfiguration),this.mintsApi=new NN(t.apiConfiguration),this.ordersApi=new jN(t.apiConfiguration),this.tokensApi=new XN(t.apiConfiguration),this.tradesApi=new QN(t.apiConfiguration),this.transfersApi=new rP(t.apiConfiguration),this.exchangeApi=new wN(t.apiConfiguration),this.usersApi=new oP(t.apiConfiguration),this.withdrawalsApi=new cP(t.apiConfiguration),this.balanceApi=new iN(t.apiConfiguration),this.assetApi=new eN(t.apiConfiguration),this.collectionApi=new fN(t.apiConfiguration),this.metadataApi=new AN(t.apiConfiguration),this.metadataRefreshesApi=new RN(t.apiConfiguration),this.nftCheckoutPrimaryApi=new DN(t.apiConfiguration),this.projectsApi=new VN(t.apiConfiguration),this.workflows=new NB(t)}var t,r,n;return qI(e,[{key:"deposit",value:function(e,t){return this.workflows.deposit(e,t).catch((function(e){throw MB(e)}))}},{key:"getDeposit",value:function(e){return this.depositsApi.getDeposit(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listDeposits",value:function(e){return this.depositsApi.listDeposits(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"registerOffchain",value:function(e){return this.workflows.registerOffchain(e).catch((function(e){throw MB(e)}))}},{key:"isRegisteredOnchain",value:function(e){return this.workflows.isRegisteredOnchain(e).catch((function(e){throw MB(e)}))}},{key:"getUser",value:function(e){return this.usersApi.getUsers({user:e}).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getAsset",value:function(e){return this.assetApi.getAsset(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listAssets",value:function(e){return this.assetApi.listAssets(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"createCollection",value:function(e,t){return this.workflows.createCollection(e,t).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getCollection",value:function(e){return this.collectionApi.getCollection(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listCollectionFilters",value:function(e){return this.collectionApi.listCollectionFilters(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listCollections",value:function(e){return this.collectionApi.listCollections(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"updateCollection",value:function(e,t,r){return this.workflows.updateCollection(e,t,r).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"addMetadataSchemaToCollection",value:function(e,t,r){return this.workflows.addMetadataSchemaToCollection(e,t,r).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getMetadataSchema",value:function(e){return this.metadataApi.getMetadataSchema(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"updateMetadataSchemaByName",value:function(e,t,r,n){return this.workflows.updateMetadataSchemaByName(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listMetadataRefreshes",value:function(e,t,r,n){return this.workflows.listMetadataRefreshes(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getMetadataRefreshErrors",value:function(e,t,r,n){return this.workflows.getMetadataRefreshErrors(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getMetadataRefreshResults",value:function(e,t){return this.workflows.getMetadataRefreshResults(e,t).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"createMetadataRefresh",value:function(e,t){return this.workflows.createMetadataRefresh(e,t).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"createProject",value:(n=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.createProject(t,r).then((function(e){return e.data})).catch((function(e){throw MB(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getProject",value:(r=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.getProject(t,r).then((function(e){return e.data})).catch((function(e){throw MB(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getProjects",value:(t=fC(pC.mark((function e(t,r,n,i,a){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.getProjects(t,r,n,i,a).then((function(e){return e.data})).catch((function(e){throw MB(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r,n,i,a){return t.apply(this,arguments)})},{key:"getBalance",value:function(e){return this.balanceApi.getBalance(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listBalances",value:function(e){return this.balanceApi.listBalances(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getMint",value:function(e){return this.mintsApi.getMint(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listMints",value:function(e){return this.mintsApi.listMints(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"mint",value:function(e,t){return this.workflows.mint(e,t).catch((function(e){throw MB(e)}))}},{key:"listWithdrawals",value:function(e){return this.withdrawalsApi.listWithdrawals(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getWithdrawal",value:function(e){return this.withdrawalsApi.getWithdrawal(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"prepareWithdrawal",value:function(e,t){return this.workflows.prepareWithdrawal(e,t).catch((function(e){throw MB(e)}))}},{key:"completeWithdrawal",value:function(e,t,r){return this.workflows.completeWithdrawal(e,t,r).catch((function(e){throw MB(e)}))}},{key:"getOrder",value:function(e){return this.ordersApi.getOrderV3(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listOrders",value:function(e){return this.ordersApi.listOrdersV3(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"createOrder",value:function(e,t){return this.workflows.createOrder(e,t).catch((function(e){throw MB(e)}))}},{key:"cancelOrder",value:function(e,t){return this.workflows.cancelOrder(e,t).catch((function(e){throw MB(e)}))}},{key:"getTrade",value:function(e){return this.tradesApi.getTrade(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listTrades",value:function(e){return this.tradesApi.listTradesV3(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"createTrade",value:function(e,t){return this.workflows.createTrade(e,t).catch((function(e){throw MB(e)}))}},{key:"getToken",value:function(e){return this.tokensApi.getToken(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listTokens",value:function(e){return this.tokensApi.listTokens(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getTransfer",value:function(e){return this.transfersApi.getTransfer(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listTransfers",value:function(e){return this.transfersApi.listTransfers(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"transfer",value:function(e,t){return this.workflows.transfer(e,t).catch((function(e){throw MB(e)}))}},{key:"batchNftTransfer",value:function(e,t){return this.workflows.batchNftTransfer(e,t).catch((function(e){throw MB(e)}))}},{key:"createExchange",value:function(e){return this.exchangeApi.createExchange(e).catch((function(e){throw MB(e)}))}},{key:"getExchange",value:function(e){return this.exchangeApi.getExchange(e).catch((function(e){throw MB(e)}))}},{key:"getExchanges",value:function(e){return this.exchangeApi.getExchanges(e).catch((function(e){throw MB(e)}))}},{key:"exchangeTransfer",value:function(e,t){return this.workflows.exchangeTransfer(e,t).catch((function(e){throw MB(e)}))}},{key:"createNftPrimary",value:function(e){return this.nftCheckoutPrimaryApi.createNftPrimary(e).catch((function(e){throw MB(e)}))}},{key:"getCurrenciesNFTCheckoutPrimary",value:function(e){return this.nftCheckoutPrimaryApi.getCurrenciesNFTCheckoutPrimary(e).catch((function(e){throw MB(e)}))}},{key:"getNftPrimaryTransaction",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransaction(e).catch((function(e){throw MB(e)}))}},{key:"getNftPrimaryTransactions",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransactions(e).catch((function(e){throw MB(e)}))}}]),e}();function DB(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function FB(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?DB(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):DB(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var LB={"x-sdk-version":"imx-core-sdk-ts-".concat("2.0.2")},UB=function(e){var t=e.coreContractAddress,r=e.registrationContractAddress,n=e.chainID,i=e.basePath,a=e.headers,o=e.sdkVersion;if(!i.trim())throw Error("basePath can not be empty");return o&&(LB["x-sdk-version"]=o),a=FB(FB({},a||{}),LB),{apiConfiguration:new dP({basePath:i,baseOptions:{headers:a}}),ethConfiguration:{coreContractAddress:t,registrationContractAddress:r,chainID:n}}},jB={get PRODUCTION(){return UB({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"})},get SANDBOX(){return UB({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"})},createConfig:UB},qB=new li("08000000 00000010 ffffffff ffffffff b781126d cae7b232 1e66a241 adc64d2f",16);new Fy.ec(new Fy.curves.PresetCurve({type:"short",prime:null,p:"08000000 00000011 00000000 00000000 00000000 00000000 00000000 00000001",a:"00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001",b:"06f21413 efbe40de 150e596d 72f7a8c5 609ad26c 15c915c1 f4cdfcb9 9cee9e89",n:qB.toString("hex"),hash:Xc.sha256,gRed:!1,g:["1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca","5668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"]}));var zB=function(){var e=new li("1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000",16);return e.sub(e.mod(qB))};function HB(e,t){return new li(Xc.sha256().update(ay(Cy(e)+Oy(ly(t),2))).digest("hex"),16)}function VB(e){for(var t=zB(),r=HB(e.toString("hex",64),0),n=0;r.gte(t);n++)r=HB(r.toString("hex"),n);return r.umod(qB).toString("hex")}function GB(e){for(var t=zB(),r=HB(e.toString("hex",64),0),n=1;r.gte(t);n++)r=HB(r.toString("hex"),n);return r.umod(qB).toString("hex")}function KB(e){var t=zB();return HB(e.toString("hex",64),0).gte(t)}function WB(e){return XB.apply(this,arguments)}function XB(){return(XB=fC(pC.mark((function e(t){var r,n;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=new BB(jB.PRODUCTION),e.next=4,r.getUser(t);case 4:if(!((n=e.sent).accounts.length>0)){e.next=7;break}return e.abrupt("return",{starkPublicKey:n.accounts[0],accountNotFound:!1});case 7:e.next=14;break;case 9:if(e.prev=9,e.t0=e.catch(0),!(e.t0 instanceof PB&&"account_not_found"==e.t0.code)){e.next=13;break}return e.abrupt("return",{starkPublicKey:"",accountNotFound:!0});case 13:throw e.t0;case 14:case"end":return e.stop()}}),e,null,[[0,9]])})))).apply(this,arguments)}function $B(e,t){var r=ZR.hdkey.fromMasterSeed(Buffer.from(e.slice(2),"hex")).derivePath(t).getWallet().getPrivateKey();return new li(r)}function JB(e,t,r){return YB.apply(this,arguments)}function YB(){return(YB=fC(pC.mark((function e(t,r,n){var i,a,o,s,f,u,c,d;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=$B(t,r),a=GB(i),KB(i)){e.next=4;break}return e.abrupt("return",a);case 4:return e.next=6,WB(n);case 6:if(void 0!==(o=e.sent)){e.next=9;break}throw new Error("Error fetching stark public key from IMX");case 9:if(!o.accountNotFound){e.next=11;break}return e.abrupt("return",a);case 11:return s=new li(Cy(o.starkPublicKey),16),e.next=14,DC(a).getAddress();case 14:if(f=e.sent,!s.eq(new li(Cy(f),16))){e.next=17;break}return e.abrupt("return",a);case 17:return u=VB(i),e.next=20,DC(u).getAddress();case 20:if(f=e.sent,!s.eq(new li(Cy(f),16))){e.next=23;break}return e.abrupt("return",u);case 23:return c=MC(t,r),d=PC(c),e.next=27,DC(d).getAddress();case 27:if(f=e.sent,!s.eq(new li(Cy(f),16))){e.next=30;break}return e.abrupt("return",d);case 30:throw new Error("Can not deterministically generate stark private key - please contact support");case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function QB(e){return ZB.apply(this,arguments)}function ZB(){return(ZB=fC(pC.mark((function e(t){var r,n,i,a,o;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return r=e.sent.toLowerCase(),e.next=5,t.signMessage("Only sign this request if you’ve initiated an action with Immutable X.");case 5:return n=e.sent,i=Hi(n).s,a=CC("starkex","immutablex",r,"1"),e.next=10,JB(i,a,r);case 10:return o=e.sent,e.abrupt("return",o.padStart(64,"0"));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}CP.errors.INSUFFICIENT_FUNDS,CP.errors.NONCE_EXPIRED,CP.errors.REPLACEMENT_UNDERPRICED;const eD=({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n})=>jB.createConfig({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n,sdkVersion:"ts-immutable-sdk-0.4.1-alpha"}),tD=()=>eD({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"});class rD{immutableXConfig;baseConfig;constructor({baseConfig:t,overrides:r}){if(this.baseConfig=t,r)this.immutableXConfig=r.immutableXConfig;else switch(t.environment){case e.Environment.SANDBOX:this.immutableXConfig=tD();break;case e.Environment.PRODUCTION:this.immutableXConfig=eD({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"});break;default:this.immutableXConfig=tD()}}}class nD{immutableX;depositsApi;mintsApi;ordersApi;tokensApi;tradesApi;transfersApi;exchangeApi;nftCheckoutPrimaryApi;usersApi;withdrawalsApi;balanceApi;assetApi;collectionApi;metadataApi;metadataRefreshesApi;projectsApi;constructor(e){const t=new rD(e);this.immutableX=new BB(t.immutableXConfig),this.depositsApi=this.immutableX.depositsApi,this.mintsApi=this.immutableX.mintsApi,this.ordersApi=this.immutableX.ordersApi,this.tokensApi=this.immutableX.tokensApi,this.tradesApi=this.immutableX.tradesApi,this.transfersApi=this.immutableX.transfersApi,this.exchangeApi=this.immutableX.exchangeApi,this.usersApi=this.immutableX.usersApi,this.withdrawalsApi=this.immutableX.withdrawalsApi,this.balanceApi=this.immutableX.balanceApi,this.assetApi=this.immutableX.assetApi,this.collectionApi=this.immutableX.collectionApi,this.metadataApi=this.immutableX.metadataApi,this.metadataRefreshesApi=this.immutableX.metadataRefreshesApi,this.nftCheckoutPrimaryApi=this.immutableX.nftCheckoutPrimaryApi,this.projectsApi=this.immutableX.projectsApi}getDeposit(e){return this.immutableX.getDeposit(e)}listDeposits(e){return this.immutableX.listDeposits(e)}getUser(e){return this.immutableX.getUser(e)}getAsset(e){return this.immutableX.getAsset(e)}listAssets(e){return this.immutableX.listAssets(e)}createCollection(e,t){return this.immutableX.createCollection(e,t)}getCollection(e){return this.immutableX.getCollection(e)}listCollectionFilters(e){return this.immutableX.listCollectionFilters(e)}listCollections(e){return this.collectionApi.listCollections(e).then((e=>e.data))}updateCollection(e,t,r){return this.immutableX.updateCollection(e,t,r)}addMetadataSchemaToCollection(e,t,r){return this.immutableX.addMetadataSchemaToCollection(e,t,r)}getMetadataSchema(e){return this.immutableX.getMetadataSchema(e)}updateMetadataSchemaByName(e,t,r,n){return this.immutableX.updateMetadataSchemaByName(e,t,r,n)}listMetadataRefreshes(e,t,r,n){return this.immutableX.listMetadataRefreshes(e,t,r,n)}getMetadataRefreshErrors(e,t,r,n){return this.immutableX.getMetadataRefreshErrors(e,t,r,n)}getMetadataRefreshResults(e,t){return this.immutableX.getMetadataRefreshResults(e,t)}createMetadataRefresh(e,t){return this.immutableX.createMetadataRefresh(e,t)}async createProject(e,t){return this.immutableX.createProject(e,t)}async getProject(e,t){return this.immutableX.getProject(e,t)}async getProjects(e,t,r,n,i){return this.immutableX.getProjects(e,t,r,n,i)}getBalance(e){return this.immutableX.getBalance(e)}listBalances(e){return this.immutableX.listBalances(e)}getMint(e){return this.immutableX.getMint(e)}listMints(e){return this.immutableX.listMints(e)}mint(e,t){return this.immutableX.mint(e,t)}listWithdrawals(e){return this.immutableX.listWithdrawals(e)}getWithdrawal(e){return this.immutableX.getWithdrawal(e)}getOrder(e){return this.immutableX.getOrder(e)}listOrders(e){return this.immutableX.listOrders(e)}getTrade(e){return this.immutableX.getTrade(e)}listTrades(e){return this.immutableX.listTrades(e)}getToken(e){return this.immutableX.getToken(e)}listTokens(e){return this.immutableX.listTokens(e)}getTransfer(e){return this.immutableX.getTransfer(e)}listTransfers(e){return this.immutableX.listTransfers(e)}createExchange(e){return this.immutableX.createExchange(e).then((e=>e.data))}getExchange(e){return this.immutableX.getExchange(e).then((e=>e.data))}getExchanges(e){return this.immutableX.getExchanges(e).then((e=>e.data))}exchangeTransfer(e,t){return this.immutableX.exchangeTransfer(e,t)}createNftPrimary(e){return this.immutableX.createNftPrimary(e).then((e=>e.data))}getCurrenciesNFTCheckoutPrimary(e){return this.immutableX.getCurrenciesNFTCheckoutPrimary(e).then((e=>e.data))}getNftPrimaryTransaction(e){return this.immutableX.getNftPrimaryTransaction(e).then((e=>e.data))}getNftPrimaryTransactions(e){return this.immutableX.getNftPrimaryTransactions(e).then((e=>e.data))}}var iD={exports:{}};!function(e,t){e.exports=function(){var e=e||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==on&&on.crypto&&(r=on.crypto),!r)try{r=Gy}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},o=a.lib={},s=o.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},f=o.WordArray=s.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var o=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=o<<24-(n+a)%4*8}else for(var s=0;s<i;s+=4)t[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new f.init(t,e)}}),u=a.enc={},c=u.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new f.init(r,t/2)}},d=u.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new f.init(r,t)}},l=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,a=n.sigBytes,o=this.blockSize,s=a/(4*o),u=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*o,c=e.min(4*u,a);if(u){for(var d=0;d<u;d+=o)this._doProcessBlock(i,d);r=i.splice(0,u),n.sigBytes-=c}return new f.init(r,c)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});o.Hasher=p.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}});var h=a.algo={};return a}(Math);return e}()}(iD);var aD=iD.exports,oD=sn(aD),sD={exports:{}};!function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=[],f=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(s[i]=r(t.pow(n,.5))),f[i]=r(t.pow(n,1/3)),i++),n++}();var u=[],c=o.SHA256=a.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],c=r[5],d=r[6],l=r[7],p=0;p<64;p++){if(p<16)u[p]=0|e[t+p];else{var h=u[p-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,b=u[p-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;u[p]=m+u[p-7]+y+u[p-16]}var g=n&i^n&a^i&a,v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=l+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&c^~s&d)+f[p]+u[p];l=d,d=c,c=s,s=o+w|0,o=a,a=i,i=n,n=w+(v+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0,r[5]=r[5]+c|0,r[6]=r[6]+d|0,r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=a._createHelper(c),r.HmacSHA256=a._createHmacHelper(c)}(Math),e.SHA256}(aD)}(sD);var fD=sn(sD.exports),uD={exports:{}};!function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var i=[],a=0,o=0;o<t;o++)if(o%4){var s=n[e.charCodeAt(o-1)]<<o%4*2|n[e.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=s<<24-a%4*8,a++}return r.create(i,a)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],a=0;a<r;a+=3)for(var o=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<r;s++)i.push(n.charAt(o>>>6*(3-s)&63));var f=n.charAt(64);if(f)for(;i.length%4;)i.push(f);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<r.length;a++)i[r.charCodeAt(a)]=a}var o=r.charAt(64);if(o){var s=e.indexOf(o);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(aD)}(uD);var cD=sn(uD.exports),dD={exports:{}};!function(e,t){e.exports=function(e){return e.enc.Utf8}(aD)}(dD);var lD=sn(dD.exports);function pD(e){this.message=e}pD.prototype=new Error,pD.prototype.name="InvalidCharacterError";var hD="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new pD("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,a=0,o="";n=t.charAt(a++);~n&&(r=i%4?64*r+n:n,i++%4)?o+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return o};function mD(e){this.message=e}function bD(e,t){if("string"!=typeof e)throw new mD("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(hD(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return hD(t)}}(e.split(".")[r]))}catch(e){throw new mD("Invalid token specified: "+e.message)}}mD.prototype=new Error,mD.prototype.name="InvalidTokenError";var yD,gD,vD,wD={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},_D=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(_D||{});(vD=_D||(_D={})).reset=function(){yD=3,gD=wD},vD.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");yD=e},vD.setLogger=function(e){gD=e};var ED=class{constructor(e){this._name=e}debug(...e){yD>=4&&gD.debug(ED._format(this._name,this._method),...e)}info(...e){yD>=3&&gD.info(ED._format(this._name,this._method),...e)}warn(...e){yD>=2&&gD.warn(ED._format(this._name,this._method),...e)}error(...e){yD>=1&&gD.error(ED._format(this._name,this._method),...e)}throw(e){throw this.error(e),e}create(e){const t=Object.create(this);return t._method=e,t.debug("begin"),t}static createStatic(e,t){const r=new ED(`${e}.${t}`);return r.debug("begin"),r}static _format(e,t){const r=`[${e}]`;return t?`${r} ${t}:`:r}static debug(e,...t){yD>=4&&gD.debug(ED._format(e),...t)}static info(e,...t){yD>=3&&gD.info(ED._format(e),...t)}static warn(e,...t){yD>=2&&gD.warn(ED._format(e),...t)}static error(e,...t){yD>=1&&gD.error(ED._format(e),...t)}};_D.reset();var TD=class{static _randomWord(){return oD.lib.WordArray.random(1).words[0]}static generateUUIDv4(){const e="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^TD._randomWord()&15>>+e/4).toString(16)));return e.replace(/-/g,"")}static generateCodeVerifier(){return TD.generateUUIDv4()+TD.generateUUIDv4()+TD.generateUUIDv4()}static generateCodeChallenge(e){try{const t=fD(e);return cD.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(e){throw ED.error("CryptoUtils.generateCodeChallenge",e),e}}static generateBasicAuth(e,t){const r=lD.parse([e,t].join(":"));return cD.stringify(r)}},AD=class{constructor(e){this._name=e,this._logger=new ED(`Event('${this._name}')`),this._callbacks=[]}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){const t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}raise(...e){this._logger.debug("raise:",...e);for(const t of this._callbacks)t(...e)}},SD=class{static decode(e){try{return bD(e)}catch(e){throw ED.error("JwtUtils.decode",e),e}}},kD=class{static center({...e}){var t;return null==e.width&&(e.width=null!=(t=[800,720,600,480].find((e=>e<=window.outerWidth/1.618)))?t:360),null!=e.left||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),null!=e.height&&(null!=e.top||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter((([,e])=>null!=e)).map((([e,t])=>`${e}=${"boolean"!=typeof t?t:t?"yes":"no"}`)).join(",")}},OD=class extends AD{constructor(){super(...arguments),this._logger=new ED(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const e=this._expiration-OD.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=OD.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(e){const t=this._logger.create("init");e=Math.max(Math.floor(e),1);const r=OD.getEpochTime()+e;if(this.expiration===r&&this._timerHandle)return void t.debug("skipping since already initialized for expiration at",this.expiration);this.cancel(),t.debug("using duration",e),this._expiration=r;const n=Math.min(e,5);this._timerHandle=setInterval(this._callback,1e3*n)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},RD=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");const r=new URL(e,"http://127.0.0.1")["fragment"===t?"hash":"search"];return new URLSearchParams(r.slice(1))}},xD=class extends Error{constructor(e,t){var r,n,i;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw ED.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=null!=(r=e.error_description)?r:null,this.error_uri=null!=(n=e.error_uri)?n:null,this.state=e.userState,this.session_state=null!=(i=e.session_state)?i:null}},ID=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},CD=class{constructor(e){this._logger=new ED("AccessTokenEvents"),this._expiringTimer=new OD("Access token expiring"),this._expiredTimer=new OD("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}load(e){const t=this._logger.create("load");if(e.access_token&&void 0!==e.expires_in){const r=e.expires_in;if(t.debug("access token present, remaining duration:",r),r>0){let e=r-this._expiringNotificationTimeInSeconds;e<=0&&(e=1),t.debug("registering expiring timer, raising in",e,"seconds"),this._expiringTimer.init(e)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const n=r+1;t.debug("registering expired timer, raising in",n,"seconds"),this._expiredTimer.init(n)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},ND=class{constructor(){this._logger=new ED("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},PD=class{constructor(e=[],t=null,r={}){this._jwtHandler=t,this._extraHeaders=r,this._logger=new ED("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){const{timeoutInSeconds:r,...n}=t;if(!r)return await fetch(e,n);const i=new AbortController,a=setTimeout((()=>i.abort()),1e3*r);try{return await fetch(e,{...t,signal:i.signal})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw new ID("Network timed out");throw e}finally{clearTimeout(a)}}async getJson(e,{token:t,credentials:r}={}){const n=this._logger.create("getJson"),i={Accept:this._contentTypes.join(", ")};let a;t&&(n.debug("token passed, setting Authorization header"),i.Authorization="Bearer "+t),this.appendExtraHeaders(i);try{n.debug("url:",e),a=await this.fetchWithTimeout(e,{method:"GET",headers:i,credentials:r})}catch(e){throw n.error("Network Error"),e}n.debug("HTTP response received, status",a.status);const o=a.headers.get("Content-Type");if(o&&!this._contentTypes.find((e=>o.startsWith(e)))&&n.throw(new Error(`Invalid response Content-Type: ${null!=o?o:"undefined"}, from URL: ${e}`)),a.ok&&this._jwtHandler&&(null==o?void 0:o.startsWith("application/jwt")))return await this._jwtHandler(await a.text());let s;try{s=await a.json()}catch(e){if(n.error("Error parsing JSON response",e),a.ok)throw e;throw new Error(`${a.statusText} (${a.status})`)}if(!a.ok){if(n.error("Error from server:",s),s.error)throw new xD(s);throw new Error(`${a.statusText} (${a.status}): ${JSON.stringify(s)}`)}return s}async postForm(e,{body:t,basicAuth:r,timeoutInSeconds:n,initCredentials:i}){const a=this._logger.create("postForm"),o={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"};let s;void 0!==r&&(o.Authorization="Basic "+r),this.appendExtraHeaders(o);try{a.debug("url:",e),s=await this.fetchWithTimeout(e,{method:"POST",headers:o,body:t,timeoutInSeconds:n,credentials:i})}catch(e){throw a.error("Network error"),e}a.debug("HTTP response received, status",s.status);const f=s.headers.get("Content-Type");if(f&&!this._contentTypes.find((e=>f.startsWith(e))))throw new Error(`Invalid response Content-Type: ${null!=f?f:"undefined"}, from URL: ${e}`);const u=await s.text();let c={};if(u)try{c=JSON.parse(u)}catch(e){if(a.error("Error parsing JSON response",e),s.ok)throw e;throw new Error(`${s.statusText} (${s.status})`)}if(!s.ok){if(a.error("Error from server:",c),c.error)throw new xD(c,t);throw new Error(`${s.statusText} (${s.status}): ${JSON.stringify(c)}`)}return c}appendExtraHeaders(e){const t=this._logger.create("appendExtraHeaders"),r=Object.keys(this._extraHeaders),n=["authorization","accept","content-type"];0!==r.length&&r.forEach((r=>{if(n.includes(r.toLocaleLowerCase()))return void t.warn("Protected header could not be overridden",r,n);const i="function"==typeof this._extraHeaders[r]?this._extraHeaders[r]():this._extraHeaders[r];i&&""!==i&&(e[r]=i)}))}},MD=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new ED("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){this._logger.create(`get('${e}')`),e=this._prefix+e;return await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;const t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");const e=await this._store.length,t=[];for(let r=0;r<e;r++){const e=await this._store.key(r);e&&0===e.indexOf(this._prefix)&&t.push(e.substr(this._prefix.length))}return t}},BD=class{constructor({authority:e,metadataUrl:t,metadata:r,signingKeys:n,metadataSeed:i,client_id:a,client_secret:o,response_type:s="code",scope:f="openid",redirect_uri:u,post_logout_redirect_uri:c,client_authentication:d="client_secret_post",prompt:l,display:p,max_age:h,ui_locales:m,acr_values:b,resource:y,response_mode:g="query",filterProtocolClaims:v=!0,loadUserInfo:w=!1,staleStateAgeInSeconds:_=900,clockSkewInSeconds:E=300,userInfoJwtIssuer:T="OP",mergeClaims:A=!1,disablePKCE:S=!1,stateStore:k,refreshTokenCredentials:O,revokeTokenAdditionalContentTypes:R,fetchRequestCredentials:x,refreshTokenAllowedScope:I,extraQueryParams:C={},extraTokenParams:N={},extraHeaders:P={}}){if(this.authority=e,t?this.metadataUrl=t:(this.metadataUrl=e,e&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=r,this.metadataSeed=i,this.signingKeys=n,this.client_id=a,this.client_secret=o,this.response_type=s,this.scope=f,this.redirect_uri=u,this.post_logout_redirect_uri=c,this.client_authentication=d,this.prompt=l,this.display=p,this.max_age=h,this.ui_locales=m,this.acr_values=b,this.resource=y,this.response_mode=g,this.filterProtocolClaims=null==v||v,this.loadUserInfo=!!w,this.staleStateAgeInSeconds=_,this.clockSkewInSeconds=E,this.userInfoJwtIssuer=T,this.mergeClaims=!!A,this.disablePKCE=!!S,this.revokeTokenAdditionalContentTypes=R,x&&O&&console.warn("Both fetchRequestCredentials and refreshTokenCredentials is set. Only fetchRequestCredentials will be used."),this.fetchRequestCredentials=x||(O||"same-origin"),k)this.stateStore=k;else{const e="undefined"!=typeof window?window.localStorage:new ND;this.stateStore=new MD({store:e})}this.refreshTokenAllowedScope=I,this.extraQueryParams=C,this.extraTokenParams=N,this.extraHeaders=P}},DD=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new ED("TokenClient"),this._jsonService=new PD(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:r=this._settings.client_id,client_secret:n=this._settings.client_secret,...i}){const a=this._logger.create("exchangeCode");r||a.throw(new Error("A client_id is required")),t||a.throw(new Error("A redirect_uri is required")),i.code||a.throw(new Error("A code is required"));const o=new URLSearchParams({grant_type:e,redirect_uri:t});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let s;switch(this._settings.client_authentication){case"client_secret_basic":if(!n)throw a.throw(new Error("A client_secret is required")),null;s=TD.generateBasicAuth(r,n);break;case"client_secret_post":o.append("client_id",r),n&&o.append("client_secret",n)}const f=await this._metadataService.getTokenEndpoint(!1);a.debug("got token endpoint");const u=await this._jsonService.postForm(f,{body:o,basicAuth:s,initCredentials:this._settings.fetchRequestCredentials});return a.debug("got response"),u}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,scope:n=this._settings.scope,...i}){const a=this._logger.create("exchangeCredentials");t||a.throw(new Error("A client_id is required"));const o=new URLSearchParams({grant_type:e,scope:n});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let s;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw a.throw(new Error("A client_secret is required")),null;s=TD.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r)}const f=await this._metadataService.getTokenEndpoint(!1);a.debug("got token endpoint");const u=await this._jsonService.postForm(f,{body:o,basicAuth:s,initCredentials:this._settings.fetchRequestCredentials});return a.debug("got response"),u}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,timeoutInSeconds:n,...i}){const a=this._logger.create("exchangeRefreshToken");t||a.throw(new Error("A client_id is required")),i.refresh_token||a.throw(new Error("A refresh_token is required"));const o=new URLSearchParams({grant_type:e});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let s;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw a.throw(new Error("A client_secret is required")),null;s=TD.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r)}const f=await this._metadataService.getTokenEndpoint(!1);a.debug("got token endpoint");const u=await this._jsonService.postForm(f,{body:o,basicAuth:s,timeoutInSeconds:n,initCredentials:this._settings.fetchRequestCredentials});return a.debug("got response"),u}async revoke(e){var t;const r=this._logger.create("revoke");e.token||r.throw(new Error("A token is required"));const n=await this._metadataService.getRevocationEndpoint(!1);r.debug(`got revocation endpoint, revoking ${null!=(t=e.token_type_hint)?t:"default token type"}`);const i=new URLSearchParams;for(const[t,r]of Object.entries(e))null!=r&&i.set(t,r);i.set("client_id",this._settings.client_id),this._settings.client_secret&&i.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(n,{body:i}),r.debug("got response")}},FD=class{constructor(e){this.id=e.id||TD.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=OD.getEpochTime(),this.request_type=e.request_type}toStorageString(){return new ED("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})}static fromStorageString(e){return ED.createStatic("State","fromStorageString"),new FD(JSON.parse(e))}static async clearStaleState(e,t){const r=ED.createStatic("State","clearStaleState"),n=OD.getEpochTime()-t,i=await e.getAllKeys();r.debug("got keys",i);for(let t=0;t<i.length;t++){const a=i[t],o=await e.get(a);let s=!1;if(o)try{const e=FD.fromStorageString(o);r.debug("got item from key:",a,e.created),e.created<=n&&(s=!0)}catch(e){r.error("Error parsing state for key:",a,e),s=!0}else r.debug("no item in storage for key:",a),s=!0;s&&(r.debug("removed item for key:",a),e.remove(a))}}},LD=class extends FD{constructor(e){super(e),!0===e.code_verifier?this.code_verifier=TD.generateCodeVerifier():e.code_verifier&&(this.code_verifier=e.code_verifier),this.code_verifier&&(this.code_challenge=TD.generateCodeChallenge(this.code_verifier)),this.authority=e.authority,this.client_id=e.client_id,this.redirect_uri=e.redirect_uri,this.scope=e.scope,this.client_secret=e.client_secret,this.extraTokenParams=e.extraTokenParams,this.response_mode=e.response_mode,this.skipUserInfo=e.skipUserInfo}toStorageString(){return new ED("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}static fromStorageString(e){ED.createStatic("SigninState","fromStorageString");const t=JSON.parse(e);return new LD(t)}},UD=class{constructor(e){this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-OD.getEpochTime()}set expires_in(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+OD.getEpochTime())}get isOpenId(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}},jD=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],qD=["sub","iss","aud","exp","iat"],zD=class{constructor(e){var t;this.id_token=e.id_token,this.session_state=null!=(t=e.session_state)?t:null,this.access_token=e.access_token,this.refresh_token=e.refresh_token,this.token_type=e.token_type,this.scope=e.scope,this.profile=e.profile,this.expires_at=e.expires_at,this.state=e.userState}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-OD.getEpochTime()}set expires_in(e){void 0!==e&&(this.expires_at=Math.floor(e)+OD.getEpochTime())}get expired(){const e=this.expires_in;if(void 0!==e)return e<=0}get scopes(){var e,t;return null!=(t=null==(e=this.scope)?void 0:e.split(" "))?t:[]}toStorageString(){return new ED("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(e){return ED.createStatic("User","fromStorageString"),new zD(JSON.parse(e))}},HD="oidc-client",VD=class{constructor(){this._abort=new AD("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){const t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);const{url:r,keepOpen:n}=await new Promise(((r,n)=>{const i=i=>{var a;const o=i.data,s=null!=(a=e.scriptOrigin)?a:window.location.origin;if(i.origin===s&&(null==o?void 0:o.source)===HD){try{const r=RD.readParams(o.url,e.response_mode).get("state");if(r||t.warn("no state found in response url"),i.source!==this._window&&r!==e.state)return}catch(e){this._dispose(),n(new Error("Invalid response from window"))}r(o)}};window.addEventListener("message",i,!1),this._disposeHandlers.add((()=>window.removeEventListener("message",i,!1))),this._disposeHandlers.add(this._abort.addHandler((e=>{this._dispose(),n(e)})))}));return t.debug("got response from window"),this._dispose(),n||this.close(),{url:r}}_dispose(){this._logger.create("_dispose");for(const e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,r=!1,n=window.location.origin){e.postMessage({source:HD,url:t,keepOpen:r},n)}},GD={location:!1,toolbar:!1,height:640},KD="_blank",WD=60,XD=2,$D=10,JD=class extends BD{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:r=e.post_logout_redirect_uri,popupWindowFeatures:n=GD,popupWindowTarget:i=KD,redirectMethod:a="assign",redirectTarget:o="self",iframeNotifyParentOrigin:s=e.iframeNotifyParentOrigin,iframeScriptOrigin:f=e.iframeScriptOrigin,silent_redirect_uri:u=e.redirect_uri,silentRequestTimeoutInSeconds:c=$D,automaticSilentRenew:d=!0,validateSubOnSilentRenew:l=!0,includeIdTokenInSilentRenew:p=!1,monitorSession:h=!1,monitorAnonymousSession:m=!1,checkSessionIntervalInSeconds:b=XD,query_status_response_type:y="code",stopCheckSessionOnError:g=!0,revokeTokenTypes:v=["access_token","refresh_token"],revokeTokensOnSignout:w=!1,includeIdTokenInSilentSignout:_=!1,accessTokenExpiringNotificationTimeInSeconds:E=WD,userStore:T}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=r,this.popupWindowFeatures=n,this.popupWindowTarget=i,this.redirectMethod=a,this.redirectTarget=o,this.iframeNotifyParentOrigin=s,this.iframeScriptOrigin=f,this.silent_redirect_uri=u,this.silentRequestTimeoutInSeconds=c,this.automaticSilentRenew=d,this.validateSubOnSilentRenew=l,this.includeIdTokenInSilentRenew=p,this.monitorSession=h,this.monitorAnonymousSession=m,this.checkSessionIntervalInSeconds=b,this.stopCheckSessionOnError=g,this.query_status_response_type=y,this.revokeTokenTypes=v,this.revokeTokensOnSignout=w,this.includeIdTokenInSilentSignout=_,this.accessTokenExpiringNotificationTimeInSeconds=E,T)this.userStore=T;else{const e="undefined"!=typeof window?window.sessionStorage:new ND;this.userStore=new MD({store:e})}}},YD=class extends VD{constructor({silentRequestTimeoutInSeconds:e=$D}){super(),this._logger=new ED("IFrameWindow"),this._timeoutInSeconds=e,this._frame=YD.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const e=window.document.createElement("iframe");return e.style.visibility="hidden",e.style.position="fixed",e.style.left="-1000px",e.style.top="0",e.width="0",e.height="0",e.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),window.document.body.appendChild(e),e}async navigate(e){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);const t=setTimeout((()=>this._abort.raise(new ID("IFrame timed out without a response"))),1e3*this._timeoutInSeconds);return this._disposeHandlers.add((()=>clearTimeout(t))),await super.navigate(e)}close(){var e;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",(e=>{var t;const r=e.target;null==(t=r.parentNode)||t.removeChild(r),this._abort.raise(new Error("IFrame removed from DOM"))}),!0),null==(e=this._frame.contentWindow)||e.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(e,t){return super._notifyParent(window.parent,e,!1,t)}},QD=class extends VD{constructor({popupWindowTarget:e=KD,popupWindowFeatures:t={}}){super(),this._logger=new ED("PopupWindow");const r=kD.center({...GD,...t});this._window=window.open(void 0,e,kD.serialize(r))}async navigate(e){var t;null==(t=this._window)||t.focus();const r=setInterval((()=>{this._window&&!this._window.closed||this._abort.raise(new Error("Popup closed by user"))}),500);return this._disposeHandlers.add((()=>clearInterval(r))),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,e,t)}},ZD=class extends CD{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new ED("UserManagerEvents"),this._userLoaded=new AD("User loaded"),this._userUnloaded=new AD("User unloaded"),this._silentRenewError=new AD("Silent renew error"),this._userSignedIn=new AD("User signed in"),this._userSignedOut=new AD("User signed out"),this._userSessionChanged=new AD("User session changed")}load(e,t=!0){super.load(e),t&&this._userLoaded.raise(e)}unload(){super.unload(),this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}_raiseSilentRenewError(e){this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}_raiseUserSignedIn(){this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}_raiseUserSignedOut(){this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}_raiseUserSessionChanged(){this._userSessionChanged.raise()}},eF=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(eF||{}),tF=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e))(tF||{}),rF=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e))(rF||{}),nF=(e=>(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_auth_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="mc_get_wallet_info",e.ShowUI="mc_wallet",e.NFTPurchase="magic_nft_purchase",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.UpdatePhoneNumber="magic_auth_update_phone_number",e.UpdatePhoneNumberTestMode="magic_auth_update_phone_number_testing_mode",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e))(nF||{}),iF=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e))(iF||{}),aF=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(aF||{}),oF=(e=>(e.Harmony="HARMONY",e))(oF||{}),sF=Object.create,fF=Object.defineProperty,uF=Object.defineProperties,cF=Object.getOwnPropertyDescriptor,dF=Object.getOwnPropertyDescriptors,lF=Object.getOwnPropertyNames,pF=Object.getOwnPropertySymbols,hF=Object.getPrototypeOf,mF=Object.prototype.hasOwnProperty,bF=Object.prototype.propertyIsEnumerable,yF=(e,t,r)=>t in e?fF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gF=(e,t)=>{for(var r in t||(t={}))mF.call(t,r)&&yF(e,r,t[r]);if(pF)for(var r of pF(t))bF.call(t,r)&&yF(e,r,t[r]);return e},vF=(e,t,r)=>new Promise(((n,i)=>{var a=e=>{try{s(r.next(e))}catch(e){i(e)}},o=e=>{try{s(r.throw(e))}catch(e){i(e)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(a,o);s((r=r.apply(e,t)).next())})),wF=((e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports))(((e,t)=>{var r=Object.prototype.hasOwnProperty,n="~";function i(){}function a(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,r,i,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new a(r,i||e,o),f=n?n+t:t;return e._events[f]?e._events[f].fn?e._events[f]=[e._events[f],s]:e._events[f].push(s):(e._events[f]=s,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function f(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),f.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)r.call(e,t)&&i.push(n?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},f.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=new Array(a);i<a;i++)o[i]=r[i].fn;return o},f.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},f.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var f,u,c=this._events[s],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,i),!0;case 5:return c.fn.call(c.context,t,r,i,a),!0;case 6:return c.fn.call(c.context,t,r,i,a,o),!0}for(u=1,f=new Array(d-1);u<d;u++)f[u-1]=arguments[u];c.fn.apply(c.context,f)}else{var l,p=c.length;for(u=0;u<p;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,r);break;case 4:c[u].fn.call(c[u].context,t,r,i);break;default:if(!f)for(l=1,f=new Array(d-1);l<d;l++)f[l-1]=arguments[l];c[u].fn.apply(c[u].context,f)}}return!0},f.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},f.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},f.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!r||o.context===r)&&s(this,a);else{for(var f=0,u=[],c=o.length;f<c;f++)(o[f].fn!==t||i&&!o[f].once||r&&o[f].context!==r)&&u.push(o[f]);u.length?this._events[a]=1===u.length?u[0]:u:s(this,a)}return this},f.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},f.prototype.off=f.prototype.removeListener,f.prototype.addListener=f.prototype.on,f.prefixed=n,f.EventEmitter=f,typeof t<"u"&&(t.exports=f)}));var _F={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16},EF="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},TF=EF,AF=function(e){let t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=_F,n=(t=e.exports={}).re=[],i=t.src=[],a=t.t={},o=0,s=(e,t,r)=>{let s=o++;TF(s,t),a[e]=s,i[s]=t,n[s]=new RegExp(t,r?"g":void 0)};s("NUMERICIDENTIFIER","0|[1-9]\\d*"),s("NUMERICIDENTIFIERLOOSE","[0-9]+"),s("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),s("MAINVERSION",`(${i[a.NUMERICIDENTIFIER]})\\.(${i[a.NUMERICIDENTIFIER]})\\.(${i[a.NUMERICIDENTIFIER]})`),s("MAINVERSIONLOOSE",`(${i[a.NUMERICIDENTIFIERLOOSE]})\\.(${i[a.NUMERICIDENTIFIERLOOSE]})\\.(${i[a.NUMERICIDENTIFIERLOOSE]})`),s("PRERELEASEIDENTIFIER",`(?:${i[a.NUMERICIDENTIFIER]}|${i[a.NONNUMERICIDENTIFIER]})`),s("PRERELEASEIDENTIFIERLOOSE",`(?:${i[a.NUMERICIDENTIFIERLOOSE]}|${i[a.NONNUMERICIDENTIFIER]})`),s("PRERELEASE",`(?:-(${i[a.PRERELEASEIDENTIFIER]}(?:\\.${i[a.PRERELEASEIDENTIFIER]})*))`),s("PRERELEASELOOSE",`(?:-?(${i[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${i[a.PRERELEASEIDENTIFIERLOOSE]})*))`),s("BUILDIDENTIFIER","[0-9A-Za-z-]+"),s("BUILD",`(?:\\+(${i[a.BUILDIDENTIFIER]}(?:\\.${i[a.BUILDIDENTIFIER]})*))`),s("FULLPLAIN",`v?${i[a.MAINVERSION]}${i[a.PRERELEASE]}?${i[a.BUILD]}?`),s("FULL",`^${i[a.FULLPLAIN]}$`),s("LOOSEPLAIN",`[v=\\s]*${i[a.MAINVERSIONLOOSE]}${i[a.PRERELEASELOOSE]}?${i[a.BUILD]}?`),s("LOOSE",`^${i[a.LOOSEPLAIN]}$`),s("GTLT","((?:<|>)?=?)"),s("XRANGEIDENTIFIERLOOSE",`${i[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),s("XRANGEIDENTIFIER",`${i[a.NUMERICIDENTIFIER]}|x|X|\\*`),s("XRANGEPLAIN",`[v=\\s]*(${i[a.XRANGEIDENTIFIER]})(?:\\.(${i[a.XRANGEIDENTIFIER]})(?:\\.(${i[a.XRANGEIDENTIFIER]})(?:${i[a.PRERELEASE]})?${i[a.BUILD]}?)?)?`),s("XRANGEPLAINLOOSE",`[v=\\s]*(${i[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[a.XRANGEIDENTIFIERLOOSE]})(?:${i[a.PRERELEASELOOSE]})?${i[a.BUILD]}?)?)?`),s("XRANGE",`^${i[a.GTLT]}\\s*${i[a.XRANGEPLAIN]}$`),s("XRANGELOOSE",`^${i[a.GTLT]}\\s*${i[a.XRANGEPLAINLOOSE]}$`),s("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),s("COERCERTL",i[a.COERCE],!0),s("LONETILDE","(?:~>?)"),s("TILDETRIM",`(\\s*)${i[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",s("TILDE",`^${i[a.LONETILDE]}${i[a.XRANGEPLAIN]}$`),s("TILDELOOSE",`^${i[a.LONETILDE]}${i[a.XRANGEPLAINLOOSE]}$`),s("LONECARET","(?:\\^)"),s("CARETTRIM",`(\\s*)${i[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",s("CARET",`^${i[a.LONECARET]}${i[a.XRANGEPLAIN]}$`),s("CARETLOOSE",`^${i[a.LONECARET]}${i[a.XRANGEPLAINLOOSE]}$`),s("COMPARATORLOOSE",`^${i[a.GTLT]}\\s*(${i[a.LOOSEPLAIN]})$|^$`),s("COMPARATOR",`^${i[a.GTLT]}\\s*(${i[a.FULLPLAIN]})$|^$`),s("COMPARATORTRIM",`(\\s*)${i[a.GTLT]}\\s*(${i[a.LOOSEPLAIN]}|${i[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",s("HYPHENRANGE",`^\\s*(${i[a.XRANGEPLAIN]})\\s+-\\s+(${i[a.XRANGEPLAIN]})\\s*$`),s("HYPHENRANGELOOSE",`^\\s*(${i[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${i[a.XRANGEPLAINLOOSE]})\\s*$`),s("STAR","(<|>)?=?\\s*\\*"),s("GTE0","^\\s*>=\\s*0.0.0\\s*$"),s("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")})),SF=/^[0-9]+$/,kF=(e,t)=>{let r=SF.test(e),n=SF.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},OF={compareIdentifiers:kF,rcompareIdentifiers:(e,t)=>kF(t,e)},{MAX_LENGTH:RF,MAX_SAFE_INTEGER:xF}=_F,{re:IF,t:CF}=AF,{compareIdentifiers:NF}=OF,PF=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof PF){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid Version: ${e}`);if(e.length>RF)throw new TypeError(`version is longer than ${RF} characters`);TF("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?IF[CF.LOOSE]:IF[CF.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>xF||this.major<0)throw new TypeError("Invalid major version");if(this.minor>xF||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>xF||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<xF)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(TF("SemVer.compare",this.version,this.options,e),!(e instanceof PF)){if("string"==typeof e&&e===this.version)return 0;e=new PF(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof PF||(e=new PF(e,this.options)),NF(this.major,e.major)||NF(this.minor,e.minor)||NF(this.patch,e.patch)}comparePre(e){if(e instanceof PF||(e=new PF(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(TF("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return NF(r,n)}while(++t)}compareBuild(e){e instanceof PF||(e=new PF(e,this.options));let t=0;do{let r=this.build[t],n=e.build[t];if(TF("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return NF(r,n)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}},MF=(e,t,r)=>new PF(e,r).compare(new PF(t,r)),BF=(e,t,r)=>0===MF(e,t,r),DF=(e,t,r)=>0!==MF(e,t,r),FF=(e,t,r)=>MF(e,t,r)>0,LF=(e,t,r)=>MF(e,t,r)>=0,UF=(e,t,r)=>MF(e,t,r)<0,jF=(e,t,r)=>MF(e,t,r)<=0,qF=(e,t,r,n)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return BF(e,r,n);case"!=":return DF(e,r,n);case">":return FF(e,r,n);case">=":return LF(e,r,n);case"<":return UF(e,r,n);case"<=":return jF(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}},zF=Symbol("SemVer ANY"),HF=class{static get ANY(){return zF}constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof HF){if(e.loose===!!t.loose)return e;e=e.value}TF("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===zF?this.value="":this.value=this.operator+this.semver.version,TF("comp",this)}parse(e){let t=this.options.loose?VF[GF.COMPARATORLOOSE]:VF[GF.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new PF(r[2],this.options.loose):this.semver=zF}toString(){return this.value}test(e){if(TF("Comparator.test",e,this.options.loose),this.semver===zF||e===zF)return!0;if("string"==typeof e)try{e=new PF(e,this.options)}catch(e){return!1}return qF(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof HF))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new KF(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new KF(this.value,t).test(e.semver);let r=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),n=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),i=this.semver.version===e.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),o=qF(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),s=qF(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||n||i&&a||o||s}},{re:VF,t:GF}=AF,KF=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof KF)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new KF(e.raw,t);if(e instanceof HF)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let{loose:t}=this.options;e=e.trim();let r=t?WF[XF.HYPHENRANGELOOSE]:WF[XF.HYPHENRANGE];e=e.replace(r,uL(this.options.includePrerelease)),TF("hyphen replace",e),e=e.replace(WF[XF.COMPARATORTRIM],$F),TF("comparator trim",e,WF[XF.COMPARATORTRIM]),e=(e=(e=e.replace(WF[XF.TILDETRIM],JF)).replace(WF[XF.CARETTRIM],YF)).split(/\s+/).join(" ");let n=t?WF[XF.COMPARATORLOOSE]:WF[XF.COMPARATOR];return e.split(" ").map((e=>ZF(e,this.options))).join(" ").split(/\s+/).map((e=>fL(e,this.options))).filter(this.options.loose?e=>!!e.match(n):()=>!0).map((e=>new HF(e,this.options)))}intersects(e,t){if(!(e instanceof KF))throw new TypeError("a Range is required");return this.set.some((r=>QF(r,t)&&e.set.some((e=>QF(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new PF(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(cL(this.set[t],e,this.options))return!0;return!1}},{re:WF,t:XF,comparatorTrimReplace:$F,tildeTrimReplace:JF,caretTrimReplace:YF}=AF,QF=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();for(;r&&n.length;)r=n.every((e=>i.intersects(e,t))),i=n.pop();return r},ZF=(e,t)=>(TF("comp",e,t),e=nL(e,t),TF("caret",e),e=tL(e,t),TF("tildes",e),e=aL(e,t),TF("xrange",e),e=sL(e,t),TF("stars",e),e),eL=e=>!e||"x"===e.toLowerCase()||"*"===e,tL=(e,t)=>e.trim().split(/\s+/).map((e=>rL(e,t))).join(" "),rL=(e,t)=>{let r=t.loose?WF[XF.TILDELOOSE]:WF[XF.TILDE];return e.replace(r,((t,r,n,i,a)=>{let o;return TF("tilde",e,t,r,n,i,a),eL(r)?o="":eL(n)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:eL(i)?o=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:a?(TF("replaceTilde pr",a),o=`>=${r}.${n}.${i}-${a} <${r}.${+n+1}.0-0`):o=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,TF("tilde return",o),o}))},nL=(e,t)=>e.trim().split(/\s+/).map((e=>iL(e,t))).join(" "),iL=(e,t)=>{TF("caret",e,t);let r=t.loose?WF[XF.CARETLOOSE]:WF[XF.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,a,o)=>{let s;return TF("caret",e,t,r,i,a,o),eL(r)?s="":eL(i)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:eL(a)?s="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:o?(TF("replaceCaret pr",o),s="0"===r?"0"===i?`>=${r}.${i}.${a}-${o} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}-${o} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a}-${o} <${+r+1}.0.0-0`):(TF("no pr"),s="0"===r?"0"===i?`>=${r}.${i}.${a}${n} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a} <${+r+1}.0.0-0`),TF("caret return",s),s}))},aL=(e,t)=>(TF("replaceXRanges",e,t),e.split(/\s+/).map((e=>oL(e,t))).join(" ")),oL=(e,t)=>{e=e.trim();let r=t.loose?WF[XF.XRANGELOOSE]:WF[XF.XRANGE];return e.replace(r,((r,n,i,a,o,s)=>{TF("xRange",e,r,n,i,a,o,s);let f=eL(i),u=f||eL(a),c=u||eL(o),d=c;return"="===n&&d&&(n=""),s=t.includePrerelease?"-0":"",f?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&d?(u&&(a=0),o=0,">"===n?(n=">=",u?(i=+i+1,a=0,o=0):(a=+a+1,o=0)):"<="===n&&(n="<",u?i=+i+1:a=+a+1),"<"===n&&(s="-0"),r=`${n+i}.${a}.${o}${s}`):u?r=`>=${i}.0.0${s} <${+i+1}.0.0-0`:c&&(r=`>=${i}.${a}.0${s} <${i}.${+a+1}.0-0`),TF("xRange return",r),r}))},sL=(e,t)=>(TF("replaceStars",e,t),e.trim().replace(WF[XF.STAR],"")),fL=(e,t)=>(TF("replaceGTE0",e,t),e.trim().replace(WF[t.includePrerelease?XF.GTE0PRE:XF.GTE0],"")),uL=e=>(t,r,n,i,a,o,s,f,u,c,d,l,p)=>`${r=eL(n)?"":eL(i)?`>=${n}.0.0${e?"-0":""}`:eL(a)?`>=${n}.${i}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${f=eL(u)?"":eL(c)?`<${+u+1}.0.0-0`:eL(d)?`<${u}.${+c+1}.0-0`:l?`<=${u}.${c}.${d}-${l}`:e?`<${u}.${c}.${+d+1}-0`:`<=${f}`}`.trim(),cL=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(TF(e[r].semver),e[r].semver!==HF.ANY&&e[r].semver.prerelease.length>0){let n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0},dL=(e,t,r)=>{try{t=new KF(t,r)}catch(e){return!1}return t.test(e)},{MAX_LENGTH:lL}=_F,{re:pL,t:hL}=AF,mL=(e,t)=>{if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof PF)return e;if("string"!=typeof e||e.length>lL||!(t.loose?pL[hL.LOOSE]:pL[hL.FULL]).test(e))return null;try{return new PF(e,t)}catch(e){return null}},{re:bL,t:yL}=AF,gL=(e,t)=>{if(e instanceof PF)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=bL[yL.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),bL[yL.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;bL[yL.COERCERTL].lastIndex=-1}else r=e.match(bL[yL.COERCE]);return null===r?null:mL(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function vL(e){return String.fromCharCode(parseInt(e.slice(1),16))}function wL(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function _L(e){return function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,vL))}(JSON.stringify(e))}function EL(e){return JSON.parse(function(e){return decodeURIComponent(Array.from(atob(e),wL).join(""))}(e))}function TL(e){return void 0===e}function AL(e){return function(e){return null===e}(e)||TL(e)}function SL(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var kL={};var OL={"magic-sdk":"magic-sdk","@magic-sdk/react-native":"magic-sdk-rn","@magic-sdk/react-native-bare":"magic-sdk-rn-bare","@magic-sdk/react-native-expo":"magic-sdk-rn-expo"},RL=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,RL.prototype)}},xL=class extends Error{constructor(e){super(),this.__proto__=Error;let t=Number(null==e?void 0:e.code);this.rawMessage=(null==e?void 0:e.message)||"Internal error",this.code=function(e){return!AL(e)&&"number"==typeof e&&Object.values(rF).includes(e)}(t)?t:rF.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(null==e?void 0:e.data)||void 0,Object.setPrototypeOf(this,xL.prototype)}},IL=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},CL=class extends Error{constructor(e,t,r,n){super(`Magic Extension Error (${e.name}): [${t}] ${r}`),this.code=t,this.rawMessage=r,this.data=n,this.__proto__=Error,Object.setPrototypeOf(this,CL.prototype)}},NL=class{constructor(e,t,r){this.code=t,this.rawMessage=r,this.message=`Magic Extension Warning (${e.name}): [${t}] ${r}`}log(){console.warn(this.message)}};function PL(){return new RL(eF.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function ML(){return new RL(eF.MalformedResponse,"Response from the Magic iframe is malformed.")}function BL(e){return new RL(eF.ExtensionNotInitialized,`Extensions must be initialized with a Magic SDK instance before \`Extension.${e}\` can be accessed. Do not invoke \`Extension.${e}\` inside an extension constructor.`)}function DL(e){let t=`Some extensions are incompatible with \`${kL.sdkName}@${kL.version}\`:`;return e.filter((e=>void 0!==e.compat&&null!==e.compat)).forEach((e=>{let r=e.compat[kL.sdkName];"string"==typeof r?t+=`\n - Extension \`${e.name}\` supports version(s) \`${r}\``:r||(t+=`\n - Extension \`${e.name}\` does not support ${kL.platform} environments.`)})),new RL(eF.IncompatibleExtensions,t)}function FL(e){return new RL(eF.InvalidArgument,`Invalid ${(e=>{let t=e+1,r=t%10,n=t%100;return 1===r&&11!==n?`${t}st`:2===r&&12!==n?`${t}nd`:3===r&&13!==n?`${t}rd`:`${t}th`})(e.argument)} argument given to \`${e.procedure}\`.\n Expected: \`${e.expected}\`\n Received: \`${e.received}\``)}function LL(){return new IL(tF.ReactNativeEndpointConfiguration,`CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The \`endpoint\` parameter SHOULD NOT be provided. The Magic \`<iframe>\` is automatically wrapped by a WebView pointed at \`${kL.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}var UL=function*(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}();function jL(){return UL.next().value}var qL=Symbol("Payload pre-processed by Magic SDK");function zL(e){return Object.defineProperty(e,qL,{value:!0,enumerable:!1}),e}function HL(e){var t,r,n;return function(e){return!!e[qL]}(e)||(e.jsonrpc=null!=(t=e.jsonrpc)?t:"2.0",e.id=jL(),e.method=null!=(r=e.method)?r:"noop",e.params=null!=(n=e.params)?n:[],zL(e)),e}function VL(e,t=[]){return zL({params:t,method:e,jsonrpc:"2.0",id:jL()})}var GL=class{constructor(e){e instanceof GL?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):function(e){return!AL(e)&&!(TL(e.jsonrpc)||TL(e.id)||TL(e.result)&&TL(e.error))}(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=void 0,this._error=void 0)}applyError(e){return this._error=e,this}applyResult(e){return this._result=e,this}get hasError(){return void 0!==this._error&&null!==this._error}get hasResult(){return void 0!==this._result}get payload(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}}},KL=((e,t,r)=>(r=null!=e?sF(hF(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of lF(t))!mF.call(e,i)&&i!==r&&fF(e,i,{get:()=>t[i],enumerable:!(n=cF(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:fF(r,"default",{value:e,enumerable:!0}),e)))(wF()),WL=class extends KL.default{};function XL(){let e=new WL;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...n)=>(e[t].apply(e,n),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var $L=Symbol("isPromiEvent");function JL(e){return!!e[$L]}function YL(e){let t=QL(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:n}=XL(),i=Symbol("Promise.then"),a=Symbol("Promise.catch"),o=Symbol("Promise.finally"),s=(e,t)=>(...r)=>{let n=t[e].apply(t,r);return f(n)},f=e=>Object.assign(e,{[$L]:!0,[i]:e[i]||e.then,[a]:e[a]||e.catch,[o]:e[o]||e.finally,then:s(i,e),catch:s(a,e),finally:s(o,e),on:n("on",e),once:n("once",e),addListener:n("addListener",e),off:n("off",e),removeListener:n("removeListener",e),removeAllListeners:n("removeAllListeners",e),emit:r("emit"),eventNames:r("eventNames"),listeners:r("listeners"),listenerCount:r("listenerCount")}),u=f(t.then((e=>(u.emit("done",e),u.emit("settled"),e)),(e=>{throw u.emit("error",e),u.emit("settled"),e})));return u}function QL(e){return new Promise(((t,r)=>{let n=e(t,r);Promise.resolve(n).catch(r)}))}var ZL,eU=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(aF.MAGIC_HANDLE_REQUEST,HL(e)),r=YL(((e,r)=>{t.then((t=>{if(n(),t.hasError)r(new xL(t.payload.error));else{if(!t.hasResult)throw ML();e(t.payload.result)}})).catch((e=>{n(),r(e)}))})),n=this.overlay.on(iF.MAGIC_HANDLE_EVENT,(t=>{var n;let{response:i}=t.data;if(i.id===e.id&&(null==(n=i.result)?void 0:n.event)){let{event:e,params:t=[]}=i.result;r.emit(e,...t)}}));return r}createIntermediaryEvent(e,t){return r=>{let n=VL(nF.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(n)}}},tU=class extends eU{loginWithMagicLink(e){let{email:t,showUI:r=!0,redirectURI:n}=e,i=VL(this.sdk.testMode?nF.LoginWithMagicLinkTestMode:nF.LoginWithMagicLink,[{email:t,showUI:r,redirectURI:n}]);return this.request(i)}loginWithSMS(e){let{phoneNumber:t}=e,r=VL(this.sdk.testMode?nF.LoginWithSmsTestMode:nF.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(r)}loginWithEmailOTP(e){let{email:t,showUI:r}=e,n=VL(this.sdk.testMode?nF.LoginWithEmailOTPTestMode:nF.LoginWithEmailOTP,[{email:t,showUI:r}]);if(!r){let e=this.request(n);return e&&e.on("otp-input-sent",(e=>{this.createIntermediaryEvent("verify-email-otp",n.id)(e)})),e}return this.request(n)}loginWithCredential(e){let t=null!=e?e:"";if(!e&&"web"===kL.platform){t=window.location.search;let e=window.location.origin+window.location.pathname;window.history.replaceState(null,"",e)}let r=VL(this.sdk.testMode?nF.LoginWithCredentialTestMode:nF.LoginWithCredential,[t]);return this.request(r)}},rU={};function nU(e){return(...t)=>vF(this,null,(function*(){return ZL||(ZL=yield kL.configureStorage()),yield ZL.ready(),ZL[e](...t)}))}((e,t)=>{for(var r in t)fF(e,r,{get:t[r],enumerable:!0})})(rU,{clear:()=>sU,getItem:()=>iU,iterate:()=>dU,key:()=>uU,keys:()=>cU,length:()=>fU,removeItem:()=>oU,setItem:()=>aU});var iU=nU("getItem"),aU=nU("setItem"),oU=nU("removeItem"),sU=nU("clear"),fU=nU("length"),uU=nU("key"),cU=nU("keys"),dU=nU("iterate");function lU(){let e=window.crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=191&e[8]|128;let t="";return t+=e[0].toString(16),t+=e[1].toString(16),t+=e[2].toString(16),t+=e[3].toString(16),t+="-",t+=e[4].toString(16),t+=e[5].toString(16),t+="-",t+=e[6].toString(16),t+=e[7].toString(16),t+="-",t+=e[8].toString(16),t+=e[9].toString(16),t+="-",t+=e[10].toString(16),t+=e[11].toString(16),t+=e[12].toString(16),t+=e[13].toString(16),t+=e[14].toString(16),t+=e[15].toString(16),t}var pU="STORE_KEY_PRIVATE_KEY",hU="STORE_KEY_PUBLIC_JWK",mU="ECDSA",bU="P-256",yU={name:mU,namedCurve:bU},gU={name:mU,namedCurve:bU};function vU(){oU(hU),oU(pU)}function wU(){return vF(this,null,(function*(){let e=yield function(){return vF(this,null,(function*(){if(function(){let e="undefined"!=typeof window&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}())return(yield iU(hU))||(yield function(){return vF(this,null,(function*(){let e=null,{subtle:t}=window.crypto,r=yield t.generateKey(yU,!0,["sign"]),n=yield t.exportKey("jwk",r.privateKey);e=yield t.exportKey("jwk",r.publicKey);let i=yield t.importKey("jwk",n,gU,!1,["sign"]);yield aU(pU,i),yield aU(hU,e)}))}()),iU(hU);console.info("webcrypto is not supported")}))}();if(!e)return void console.info("unable to create public key or webcrypto is unsupported");let{subtle:t}=window.crypto,r=yield iU(pU);if(!r||!t)return void console.info("unable to find private key or webcrypto unsupported");let n={iat:Math.floor((new Date).getTime()/1e3),jti:lU()},i={typ:"dpop+jwt",alg:"ES256",jwk:e},a=_U(JSON.stringify(i)),o=_U(JSON.stringify(n)),s=function(e){return(new TextEncoder).encode(e)}(`${a}.${o}`),f={name:mU,hash:{name:"SHA-256"}},u=function(e){let t="";return e.forEach((e=>{t+=String.fromCharCode(e)})),EU(t)}(new Uint8Array(yield t.sign(f,r,s)));return`${a}.${o}.${u}`}))}function _U(e){return EU(function(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))}(e))}function EU(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}var TU=class extends eU{getIdToken(e){let t=VL(this.sdk.testMode?nF.GetIdTokenTestMode:nF.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=VL(this.sdk.testMode?nF.GenerateIdTokenTestMode:nF.GenerateIdToken,[e]);return this.request(t)}getMetadata(){let e=VL(this.sdk.testMode?nF.GetMetadataTestMode:nF.GetMetadata);return this.request(e)}updateEmail(e){let{email:t,showUI:r=!0}=e,n=VL(this.sdk.testMode?nF.UpdateEmailTestMode:nF.UpdateEmail,[{email:t,showUI:r}]);return this.request(n)}isLoggedIn(){let e=VL(this.sdk.testMode?nF.IsLoggedInTestMode:nF.IsLoggedIn);return this.request(e)}logout(){vU();let e=VL(this.sdk.testMode?nF.LogoutTestMode:nF.Logout);return this.request(e)}showSettings(){let e=VL(this.sdk.testMode?nF.UserSettingsTestMode:nF.UserSettings);return this.request(e)}updatePhoneNumber(){let e=VL(this.sdk.testMode?nF.UpdatePhoneNumberTestMode:nF.UpdatePhoneNumber);return this.request(e)}recoverAccount(e){let t=VL(this.sdk.testMode?nF.RecoverAccountTestMode:nF.RecoverAccount,[e]);return this.request(t)}},AU=class extends eU{connectWithUI(){let e=VL(nF.RequestAccounts);return this.request(e)}showUI(){let e=VL(nF.ShowUI);return this.request(e)}getInfo(){let e=VL(nF.GetInfo);return this.request(e)}requestUserInfoWithUI(e){let t=VL(nF.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}disconnect(){vU();let e=VL(nF.Disconnect);return this.request(e)}},{createBoundEmitterMethod:SU,createChainingEmitterMethod:kU}=XL(),OU=class extends eU{constructor(){super(...arguments),this.isMagic=!0,this.on=kU("on",this),this.once=kU("once",this),this.addListener=kU("addListener",this),this.off=kU("off",this),this.removeListener=kU("removeListener",this),this.removeAllListeners=kU("removeAllListeners",this),this.emit=SU("emit"),this.eventNames=SU("eventNames"),this.listeners=SU("listeners"),this.listenerCount=SU("listenerCount")}sendAsync(e,t){if(!t)throw FL({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:null===t?"null":typeof t});if(Array.isArray(e))this.overlay.post(aF.MAGIC_HANDLE_REQUEST,e.map((e=>{let t=HL(e);return this.prefixPayloadMethodForTestMode(t),t}))).then((e=>{t(null,e.map((e=>((e,t)=>uF(e,dF(t)))(gF({},e.payload),{error:e.hasError?new xL(e.payload.error):null}))))}));else{let r=HL(e);this.prefixPayloadMethodForTestMode(r),this.overlay.post(aF.MAGIC_HANDLE_REQUEST,r).then((e=>{t(e.hasError?new xL(e.payload.error):null,e.payload)}))}}send(e,t){if("string"==typeof e){let r=VL(e,Array.isArray(t)?t:[]);return this.request(r)}if(Array.isArray(e)||t)return void this.sendAsync(e,t);let r=new IL(tF.SyncWeb3Method,"Non-async web3 methods are deprecated in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.");return r.log(),new GL(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=VL("eth_accounts");return this.request(e)}request(e){return this.prefixPayloadMethodForTestMode(e),super.request(e)}prefixPayloadMethodForTestMode(e){this.sdk.testMode&&(e.method=`testMode/eth/${e.method}`)}};function RU(e,t){return t?new URL(e,t):new URL(e)}var xU=["request","overlay","sdk"];function IU(e){let t=Object.getPrototypeOf(e),r=[t];for(;t!==eU.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}var CU=class extends eU{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:YL,isPromiEvent:JL,encodeJSON:_L,decodeJSON:EL,createJsonRpcRequestPayload:VL,standardizeJsonRpcRequestPayload:HL,storage:rU};let e=[this,...IU(this)];xU.forEach((t=>{let r=e.map((e=>Object.getOwnPropertyDescriptor(e,t))),n=r.findIndex((e=>!!e)),i=n>0,a=r[n];a&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:a,isPrototypeField:i}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw BL(t)}}))}))}init(e){this.__is_initialized__||(xU.forEach((e=>{if(this.__sdk_access_field_descriptors__.has(e)){let{descriptor:t,isPrototypeField:r}=this.__sdk_access_field_descriptors__.get(e);r?delete this[e]:Object.defineProperty(this,e,t)}})),this.sdk=e,this.__is_initialized__=!0)}createDeprecationWarning(e){let{method:t,removalVersion:r,useInstead:n}=e;return new NL(this,"DEPRECATION_NOTICE",`\`${t}\` will be removed from this Extension in version \`${r}\`.${n?` Use \`${n}\` instead.`:""}`)}createWarning(e,t){return new NL(this,e,t)}createError(e,t,r){return new CL(this,e,t,r)}},NU=class extends CU{};NU.Internal=class extends CU{},NU.Anonymous="anonymous extension";var PU=class extends eU{purchase(e){let t=VL(nF.NFTPurchase,[e]);return this.request(t)}};function MU(e){return!e.compat||null==e.compat[kL.sdkName]||("string"==typeof e.compat[kL.sdkName]?dL(gL(kL.version),e.compat[kL.sdkName]):!!e.compat[kL.sdkName])}function BU(e){var t;let r=null!=(t=null==e?void 0:e.extensions)?t:[],n={},i=[];if(Array.isArray(r)?r.forEach((e=>{MU(e)?(e.init(this),(e.name||e.name!==NU.Anonymous)&&(this[e.name]=e),e instanceof NU.Internal&&(SL(e.config)||(n[e.name]=e.config))):i.push(e)})):Object.keys(r).forEach((e=>{if(MU(r[e])){r[e].init(this);let t=r[e];this[e]=t,t instanceof NU.Internal&&(SL(t.config)||(n[r[e].name]=t.config))}else i.push(r[e])})),i.length)throw DL(i);return n}var DU=class{constructor(e,t){var r;if(this.apiKey=e,!e)throw PL();"react-native"===kL.platform&&(null==t?void 0:t.endpoint)&&LL().log();let{defaultEndpoint:n,version:i}=kL;this.testMode=!(null==t||!t.testMode),this.endpoint=RU(null!=(r=null==t?void 0:t.endpoint)?r:n).origin,this.auth=new tU(this),this.user=new TU(this),this.wallet=new AU(this),this.nft=new PU(this),this.rpcProvider=new OU(this);let a=BU.call(this,t);this.parameters=_L(gF({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:null==t?void 0:t.network,host:RU(this.endpoint).host,sdk:OL[kL.sdkName],version:i,ext:SL(a)?void 0:a,locale:(null==t?void 0:t.locale)||"en_US"},kL.bundleId?{bundleId:kL.bundleId}:{}))}get overlay(){if(!DU.__overlays__.has(this.parameters)){let e=new kL.ViewController(this.endpoint,this.parameters);e.init(),DU.__overlays__.set(this.parameters,e)}return DU.__overlays__.get(this.parameters)}preload(){return vF(this,null,(function*(){yield this.overlay.ready}))}},FU=DU;function LU(e,t){var r;let n=null==(r=t.data.response)?void 0:r.id,i=function(e,t){return t&&Array.isArray(e)?e.find((e=>e.id===t)):e}(e,n);if(n&&i){return{id:n,response:new GL(i).applyResult(t.data.response.result).applyError(t.data.response.error)}}return{}}FU.__overlays__=new Map;var UU=class{constructor(e,t){this.endpoint=e,this.parameters=t,this.messageHandlers=new Set,this.ready=this.waitForReady(),this.listen()}post(e,t){return vF(this,null,(function*(){return QL((r=>vF(this,null,(function*(){yield this.ready;let n=[],i=Array.isArray(t)?t.map((e=>e.id)):[],a=yield function(e,t){return vF(this,null,(function*(){let r,n=yield iU("rt");if("web"===kL.platform)try{r=yield wU()}catch(e){console.error("webcrypto error",e)}return r?n?{msgType:e,payload:t,jwt:r,rt:n}:{msgType:e,payload:t,jwt:r}:{msgType:e,payload:t}}))}(`${e}-${this.parameters}`,t);yield this._post(a);let o=this.on(iF.MAGIC_HANDLE_RESPONSE,(e=>a=>{let{id:o,response:s}=LU(t,a);(function(e){vF(this,null,(function*(){!e.data.rt||(yield aU("rt",e.data.rt))}))})(a),o&&s&&Array.isArray(t)&&i.includes(o)?(n.push(s),n.length===t.length&&(e(),r(n))):o&&s&&!Array.isArray(t)&&o===t.id&&(e(),r(s))})((()=>o())))}))))}))}on(e,t){let r=t.bind(window),n=t=>{t.data.msgType===`${e}-${this.parameters}`&&r(t)};return this.messageHandlers.add(n),()=>this.messageHandlers.delete(n)}waitForReady(){return new Promise((e=>{this.on(iF.MAGIC_OVERLAY_READY,(()=>e()))}))}listen(){this.on(iF.MAGIC_HIDE_OVERLAY,(()=>{this.hideOverlay()})),this.on(iF.MAGIC_SHOW_OVERLAY,(()=>{this.showOverlay()}))}},jU=Object.create,qU=Object.defineProperty,zU=Object.getOwnPropertyDescriptor,HU=Object.getOwnPropertyNames,VU=Object.getPrototypeOf,GU=Object.prototype.hasOwnProperty,KU=(e=>"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(e,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):e)((function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')})),WU=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),XU=(e,t,r)=>(r=null!=e?jU(VU(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of HU(t))!GU.call(e,i)&&i!==r&&qU(e,i,{get:()=>t[i],enumerable:!(n=zU(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:qU(r,"default",{value:e,enumerable:!0}),e)),$U=(e,t,r)=>new Promise(((n,i)=>{var a=e=>{try{s(r.next(e))}catch(e){i(e)}},o=e=>{try{s(r.throw(e))}catch(e){i(e)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(a,o);s((r=r.apply(e,t)).next())})),JU=WU(((e,t)=>{!function(r){if("object"==typeof e&&typeof t<"u")t.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).localforage=r()}}((function(){return function e(t,r,n){function i(o,s){if(!r[o]){if(!t[o]){var f="function"==typeof KU&&KU;if(!s&&f)return f(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};t[o][0].call(c.exports,(function(e){return i(t[o][1][e]||e)}),c,c.exports,e,t,r,n)}return r[o].exports}for(var a="function"==typeof KU&&KU,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){(function(e){var r,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var i=0,a=new n(c),o=e.document.createTextNode("");a.observe(o,{characterData:!0}),r=function(){o.data=i=++i%2}}else if(!e.setImmediate&&typeof e.MessageChannel<"u"){var s=new e.MessageChannel;s.port1.onmessage=c,r=function(){s.port2.postMessage(0)}}else r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){c(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(c,0)};var f,u=[];function c(){f=!0;for(var e,t,r=u.length;r;){for(t=u,u=[],e=-1;++e<r;)t[e]();r=u.length}f=!1}t.exports=function(e){1===u.push(e)&&!f&&r()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(e,t,r){var n=e(1);function i(){}var a={},o=["REJECTED"],s=["FULFILLED"],f=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,e!==i&&p(this,e)}function c(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function d(e,t,r){n((function(){var n;try{n=t(r)}catch(t){return a.reject(e,t)}n===e?a.reject(e,new TypeError("Cannot resolve promise with itself")):a.resolve(e,n)}))}function l(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var r=!1;function n(t){r||(r=!0,a.reject(e,t))}function i(t){r||(r=!0,a.resolve(e,t))}var o=h((function(){t(i,n)}));"error"===o.status&&n(o.value)}function h(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=u,u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===o)return this;var r=new this.constructor(i);this.state!==f?d(r,this.state===s?e:t,this.outcome):this.queue.push(new c(r,e,t));return r},c.prototype.callFulfilled=function(e){a.resolve(this.promise,e)},c.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},c.prototype.callRejected=function(e){a.reject(this.promise,e)},c.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},a.resolve=function(e,t){var r=h(l,t);if("error"===r.status)return a.reject(e,r.value);var n=r.value;if(n)p(e,n);else{e.state=s,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},a.reject=function(e,t){e.state=o,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:a.resolve(new this(i),e)},u.reject=function(e){var t=new this(i);return a.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var o=new Array(r),s=0,f=-1,u=new this(i);++f<r;)c(e[f],f);return u;function c(e,i){t.resolve(e).then((function(e){o[i]=e,++s===r&&!n&&(n=!0,a.resolve(u,o))}),(function(e){n||(n=!0,a.reject(u,e))}))}},u.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var o=-1,s=new this(i);++o<r;)f(e[o]);return s;function f(e){t.resolve(e).then((function(e){n||(n=!0,a.resolve(s,e))}),(function(e){n||(n=!0,a.reject(s,e))}))}}},{1:1}],3:[function(e,t,r){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var i=function(){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}}();function a(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new(typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}typeof Promise>"u"&&e(3);var o=Promise;function s(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function f(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function u(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function c(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var d="local-forage-detect-blob-support",l=void 0,p={},h=Object.prototype.toString,m="readonly",b="readwrite";function y(e){return"boolean"==typeof l?o.resolve(l):function(e){return new o((function(t){var r=e.transaction(d,b),n=a([""]);r.objectStore(d).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return l=e}))}function g(e){var t=p[e.name],r={};r.promise=new o((function(e,t){r.resolve=e,r.reject=t})),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then((function(){return r.promise})):t.dbReady=r.promise}function v(e){var t=p[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function w(e,t){var r=p[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function _(e,t){return new o((function(r,n){if(p[e.name]=p[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);g(e),e.db.close()}var a=[e.name];t&&a.push(e.version);var o=i.open.apply(i,a);t&&(o.onupgradeneeded=function(t){var r=o.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(d)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),n(o.error)},o.onsuccess=function(){var t=o.result;t.onversionchange=function(e){e.target.close()},r(t),v(e)}}))}function E(e){return _(e,!1)}function T(e){return _(e,!0)}function A(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,i=e.version>e.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function S(e){var t=function(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;i<t;i++)n[i]=e.charCodeAt(i);return r}(atob(e.data));return a([t],{type:e.type})}function k(e){return e&&e.__local_forage_encoded_blob}function O(e){var t=this,r=t._initReady().then((function(){var e=p[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return f(r,e,e),r}function R(e,t,r,n){void 0===n&&(n=1);try{var i=e.db.transaction(e.storeName,t);r(null,i)}catch(i){if(n>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return o.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),T(e)})).then((function(){return function(e){g(e);for(var t=p[e.name],r=t.forages,n=0;n<r.length;n++){var i=r[n];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,E(e).then((function(t){return e.db=t,A(e)?T(e):t})).then((function(n){e.db=t.db=n;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=n})).catch((function(t){throw w(e,t),t}))}(e).then((function(){R(e,t,r,n-1)}))})).catch(r);r(i)}}var x={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var i=p[r.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},p[r.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=O);var a=[];function s(){return o.resolve()}for(var f=0;f<i.forages.length;f++){var u=i.forages[f];u!==t&&a.push(u._initReady().catch(s))}var c=i.forages.slice(0);return o.all(a).then((function(){return r.db=i.db,E(r)})).then((function(e){return r.db=e,A(r,t._defaultConfig.version)?T(r):e})).then((function(e){r.db=i.db=e,t._dbInfo=r;for(var n=0;n<c.length;n++){var a=c[n];a!==t&&(a._dbInfo.db=r.db,a._dbInfo.version=r.version)}}))},_support:function(){try{if(!i||!i.open)return!1;var e=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}(),iterate:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){R(r._dbInfo,m,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).openCursor(),s=1;o.onsuccess=function(){var r=o.result;if(r){var n=r.value;k(n)&&(n=S(n));var i=e(n,r.key,s++);void 0!==i?t(i):r.continue()}else t()},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){R(r._dbInfo,m,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),k(e)&&(e=S(e)),t(e)},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},setItem:function(e,t,r){var n=this;e=u(e);var i=new o((function(r,i){var a;n.ready().then((function(){return a=n._dbInfo,"[object Blob]"===h.call(t)?y(a.db).then((function(e){return e?t:function(e){return new o((function(t,r){var n=new FileReader;n.onerror=r,n.onloadend=function(r){var n=btoa(r.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:e.type})},n.readAsBinaryString(e)}))}(t)})):t})).then((function(t){R(n._dbInfo,b,(function(a,o){if(a)return i(a);try{var s=o.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var f=s.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),r(t)},o.onabort=o.onerror=function(){var e=f.error?f.error:f.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return s(i,r),i},removeItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){R(r._dbInfo,b,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).delete(e);a.oncomplete=function(){t()},a.onerror=function(){n(o.error)},a.onabort=function(){var e=o.error?o.error:o.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},clear:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){R(t._dbInfo,b,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=a.error?a.error:a.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return s(r,e),r},length:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){R(t._dbInfo,m,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).count();a.onsuccess=function(){e(a.result)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,e),r},key:function(e,t){var r=this,n=new o((function(t,n){e<0?t(null):r.ready().then((function(){R(r._dbInfo,m,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName),s=!1,f=o.openKeyCursor();f.onsuccess=function(){var r=f.result;r?0===e||s?t(r.key):(s=!0,r.advance(e)):t(null)},f.onerror=function(){n(f.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},keys:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){R(t._dbInfo,m,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];a.onsuccess=function(){var t=a.result;t?(o.push(t.key),t.continue()):e(o)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,e),r},dropInstance:function(e,t){t=c.apply(this,arguments);var r,n=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName),e.name){var a=e.name===n.name&&this._dbInfo.db?o.resolve(this._dbInfo.db):E(e).then((function(t){var r=p[e.name],n=r.forages;r.db=t;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=t;return t}));r=e.storeName?a.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;g(e);var n=p[e.name],a=n.forages;t.close();for(var s=0;s<a.length;s++){var f=a[s];f._dbInfo.db=null,f._dbInfo.version=r}var u=new o((function(t,n){var a=i.open(e.name,r);a.onerror=function(e){a.result.close(),n(e)},a.onupgradeneeded=function(){a.result.deleteObjectStore(e.storeName)},a.onsuccess=function(){var e=a.result;e.close(),t(e)}}));return u.then((function(e){n.db=e;for(var t=0;t<a.length;t++){var r=a[t];r._dbInfo.db=e,v(r._dbInfo)}})).catch((function(t){throw(w(e,t)||o.resolve()).catch((function(){})),t}))}})):a.then((function(t){g(e);var r=p[e.name],n=r.forages;t.close();for(var a=0;a<n.length;a++){n[a]._dbInfo.db=null}var s=new o((function(t,r){var n=i.deleteDatabase(e.name);n.onerror=function(){var e=n.result;e&&e.close(),r(n.error)},n.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}));return s.then((function(e){r.db=e;for(var t=0;t<n.length;t++){v(n[t]._dbInfo)}})).catch((function(t){throw(w(e,t)||o.resolve()).catch((function(){})),t}))}))}else r=o.reject("Invalid arguments");return s(r,t),r}};var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",C=/^~~local_forage_type~([^~]+)~/,N="__lfsc__:",P="arbf",M="blob",B="si08",D="ui08",F="uic8",L="si16",U="si32",j="ur16",q="ui32",z="fl32",H="fl64",V=Object.prototype.toString;function G(e){var t,r,n,i,a,o=.75*e.length,s=e.length,f=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var u=new ArrayBuffer(o),c=new Uint8Array(u);for(t=0;t<s;t+=4)r=I.indexOf(e[t]),n=I.indexOf(e[t+1]),i=I.indexOf(e[t+2]),a=I.indexOf(e[t+3]),c[f++]=r<<2|n>>4,c[f++]=(15&n)<<4|i>>2,c[f++]=(3&i)<<6|63&a;return u}function K(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=I[r[t]>>2],n+=I[(3&r[t])<<4|r[t+1]>>4],n+=I[(15&r[t+1])<<2|r[t+2]>>6],n+=I[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var W={serialize:function(e,t){var r="";if(e&&(r=V.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===V.call(e.buffer))){var n,i=N;e instanceof ArrayBuffer?(n=e,i+=P):(n=e.buffer,"[object Int8Array]"===r?i+=B:"[object Uint8Array]"===r?i+=D:"[object Uint8ClampedArray]"===r?i+=F:"[object Int16Array]"===r?i+=L:"[object Uint16Array]"===r?i+=j:"[object Int32Array]"===r?i+=U:"[object Uint32Array]"===r?i+=q:"[object Float32Array]"===r?i+=z:"[object Float64Array]"===r?i+=H:t(new Error("Failed to get type for BinaryArray"))),t(i+K(n))}else if("[object Blob]"===r){var a=new FileReader;a.onload=function(){var r="~~local_forage_type~"+e.type+"~"+K(this.result);t(N+M+r)},a.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,9)!==N)return JSON.parse(e);var t,r=e.substring(13),n=e.substring(9,13);if(n===M&&C.test(r)){var i=r.match(C);t=i[1],r=r.substring(i[0].length)}var o=G(r);switch(n){case P:return o;case M:return a([o],{type:t});case B:return new Int8Array(o);case D:return new Uint8Array(o);case F:return new Uint8ClampedArray(o);case L:return new Int16Array(o);case j:return new Uint16Array(o);case U:return new Int32Array(o);case q:return new Uint32Array(o);case z:return new Float32Array(o);case H:return new Float64Array(o);default:throw new Error("Unkown type: "+n)}},stringToBuffer:G,bufferToString:K};function X(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function $(e,t,r,n,i,a){e.executeSql(r,n,i,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,s){s.rows.length?a(e,o):X(e,t,(function(){e.executeSql(r,n,i,a)}),a)}),a):a(e,o)}),a)}function J(e,t,r,n){var i=this;e=u(e);var a=new o((function(a,o){i.ready().then((function(){void 0===t&&(t=null);var s=t,f=i._dbInfo;f.serializer.serialize(t,(function(t,u){u?o(u):f.db.transaction((function(r){$(r,f,"INSERT OR REPLACE INTO "+f.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){a(s)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void a(J.apply(i,[e,s,r,n-1]));o(t)}}))}))})).catch(o)}));return s(a,r),a}var Y={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var i=new o((function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction((function(i){X(i,r,(function(){t._dbInfo=r,e()}),(function(e,t){n(t)}))}),n)}));return r.serializer=W,i},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"SELECT * FROM "+i.storeName,[],(function(r,n){for(var a=n.rows,o=a.length,s=0;s<o;s++){var f=a.item(s),u=f.value;if(u&&(u=i.serializer.deserialize(u)),void 0!==(u=e(u,f.key,s+1)))return void t(u)}t()}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=i.serializer.deserialize(n)),t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},setItem:function(e,t,r){return J.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},clear:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){$(t,n,"DELETE FROM "+n.storeName,[],(function(){e()}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,e),r},length:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){$(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(t,r){var n=r.rows.item(0).c;e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,e),r},key:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},keys:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){$(t,n,"SELECT key FROM "+n.storeName,[],(function(t,r){for(var n=[],i=0;i<r.rows.length;i++)n.push(r.rows.item(i).key);e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,e),r},dropInstance:function(e,t){t=c.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;return n=e.name?new o((function(t){var n;n=e.name===r.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:n,storeNames:[e.storeName]}):t(function(e){return new o((function(t,r){e.transaction((function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(r,n){for(var i=[],a=0;a<n.rows.length;a++)i.push(n.rows.item(a).name);t({db:e,storeNames:i})}),(function(e,t){r(t)}))}),(function(e){r(e)}))}))}(n))})).then((function(e){return new o((function(t,r){e.db.transaction((function(n){function i(e){return new o((function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){r(t)}))}))}for(var a=[],s=0,f=e.storeNames.length;s<f;s++)a.push(i(e.storeNames[s]));o.all(a).then((function(){t()})).catch((function(e){r(e)}))}),(function(e){r(e)}))}))})):o.reject("Invalid arguments"),s(n,t),n}};function Q(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function Z(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}()||localStorage.length>0}var ee={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=Q(e,this._defaultConfig),Z()?(this._dbInfo=t,t.serializer=W,o.resolve()):o.reject()},_support:function(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then((function(){for(var t=r._dbInfo,n=t.keyPrefix,i=n.length,a=localStorage.length,o=1,s=0;s<a;s++){var f=localStorage.key(s);if(0===f.indexOf(n)){var u=localStorage.getItem(f);if(u&&(u=t.serializer.deserialize(u)),void 0!==(u=e(u,f.substring(i),o++)))return u}}}));return s(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=r.ready().then((function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n}));return s(n,t),n},setItem:function(e,t,r){var n=this;e=u(e);var i=n.ready().then((function(){void 0===t&&(t=null);var r=t;return new o((function(i,a){var o=n._dbInfo;o.serializer.serialize(t,(function(t,n){if(n)a(n);else try{localStorage.setItem(o.keyPrefix+e,t),i(r)}catch(e){("QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&a(e),a(e)}}))}))}));return s(i,r),i},removeItem:function(e,t){var r=this;e=u(e);var n=r.ready().then((function(){var t=r._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return s(n,t),n},clear:function(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}}));return s(r,e),r},length:function(e){var t=this.keys().then((function(e){return e.length}));return s(t,e),t},key:function(e,t){var r=this,n=r.ready().then((function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch{t=null}return t&&(t=t.substring(n.keyPrefix.length)),t}));return s(n,t),n},keys:function(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo,r=localStorage.length,n=[],i=0;i<r;i++){var a=localStorage.key(i);0===a.indexOf(e.keyPrefix)&&n.push(a.substring(e.keyPrefix.length))}return n}));return s(r,e),r},dropInstance:function(e,t){if(t=c.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,i=this;return n=e.name?new o((function(t){e.storeName?t(Q(e,i._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}})):o.reject("Invalid arguments"),s(n,t),n}},te=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},re=function(e,t){for(var r=e.length,n=0;n<r;){if(te(e[n],t))return!0;n++}return!1},ne=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},oe={INDEXEDDB:x,WEBSQL:Y,LOCALSTORAGE:ee},se=[oe.INDEXEDDB._driver,oe.WEBSQL._driver,oe.LOCALSTORAGE._driver],fe=["dropInstance"],ue=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fe),ce={description:"",driver:se.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var r=arguments;return e.ready().then((function(){return e[t].apply(e,r)}))}}function le(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(ne(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var pe=function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),oe)if(oe.hasOwnProperty(r)){var n=oe[r],i=n._driver;this[r]=i,ie[i]||this.defineDriver(n)}this._defaultConfig=le({},ce),this._config=le({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(typeof e>"u"?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new o((function(t,r){try{var n=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(i);for(var a=ue.concat("_initStorage"),f=0,u=a.length;f<u;f++){var c=a[f];if((!re(fe,c)||e[c])&&"function"!=typeof e[c])return void r(i)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=o.reject(t);return s(r,arguments[arguments.length-1]),r}},r=0,n=fe.length;r<n;r++){var i=fe[r];e[i]||(e[i]=t(i))}}();var d=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,ae[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,r):d(!!e._support):d(!0)}catch(e){r(e)}}));return f(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?o.resolve(ie[e]):o.reject(new Error("Driver not found."));return f(n,t,r),n},e.prototype.getSerializer=function(e){var t=o.resolve(W);return f(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return f(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;ne(e)||(e=[e]);var i=this._getSupportedDrivers(e);function a(){n._config.driver=n.driver()}function s(e){return n._extend(e),a(),n._ready=n._initStorage(n._config),n._ready}var u=null!==this._driverSet?this._driverSet.catch((function(){return o.resolve()})):o.resolve();return this._driverSet=u.then((function(){var e=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then((function(e){n._driver=e._driver,a(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0;return function r(){for(;t<e.length;){var i=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(i).then(s).catch(r)}a();var f=new Error("No available storage method found.");return n._driverSet=o.reject(f),n._driverSet}()}}(i)}))})).catch((function(){a();var e=new Error("No available storage method found.");return n._driverSet=o.reject(e),n._driverSet})),f(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){le(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=ue.length;e<t;e++)de(this,ue[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),he=new pe;t.exports=he},{3:3}]},{},[4])(4)}))})),YU=WU(((e,t)=>{!function(r,n){"object"==typeof e&&typeof t<"u"?n(e):"function"==typeof define&&define.amd?define("localforage-driver-memory",["exports"],n):n(r.LocalforageDriverMemory={})}(typeof self<"u"?self:e,(function(e){var t=/^~~local_forage_type~([^~]+)~/,r=Object.prototype.toString;function n(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var n=new ArrayBuffer(t),i=new Uint8Array(n),a=0,o=0;a<r;a+=4){var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a+1]),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a+2]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a+3]);i[o++]=s<<2|f>>4,i[o++]=(15&f)<<4|u>>2,i[o++]=(3&u)<<6|63&c}return n}function i(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[n]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[n])<<4|t[n+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[n+1])<<2|t[n+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[n+2]];return t.length%3==2?r=r.substring(0,r.length-1)+"=":t.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function a(e){var t,r;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var n=e instanceof Date?new Date(e):e.constructor();try{for(var i=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(Object.keys(e)),o=i.next();!o.done;o=i.next()){var s=o.value;Object.prototype.hasOwnProperty.call(e,s)&&(e.isActiveClone=null,n[s]=a(e[s]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}function o(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function s(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function f(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function u(e,t){var r,n=this;if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var i=this.config();e.name=e.name||i.name,e.storeName=e.storeName||i.storeName}return r=e.name?new Promise((function(t){e.storeName?t(o(e,n._defaultConfig)):t(e.name+"/")})):Promise.reject("Invalid arguments"),{promise:r,callback:t}}function c(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var d={bufferToString:i,deserialize:function(e){if("__lfsc__:"!==e.substring(0,9))return JSON.parse(e);var r,i=e.substring(13),a=e.substring(9,13);if("blob"===a&&t.test(i)){var o=i.match(t);r=o[1],i=i.substring(o[0].length)}var s=n(i);switch(a){case"arbf":return s;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new(typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}([s],{type:r});case"si08":return new Int8Array(s);case"ui08":return new Uint8Array(s);case"uic8":return new Uint8ClampedArray(s);case"si16":return new Int16Array(s);case"ur16":return new Uint16Array(s);case"si32":return new Int32Array(s);case"ui32":return new Uint32Array(s);case"fl32":return new Float32Array(s);case"fl64":return new Float64Array(s);default:throw new Error("Unkown type: "+a)}},serialize:function(e,t){var n="";if(e&&(n=r.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===r.call(e.buffer))){var a=void 0,o="__lfsc__:";e instanceof ArrayBuffer?(a=e,o+="arbf"):(a=e.buffer,"[object Int8Array]"===n?o+="si08":"[object Uint8Array]"===n?o+="ui08":"[object Uint8ClampedArray]"===n?o+="uic8":"[object Int16Array]"===n?o+="si16":"[object Uint16Array]"===n?o+="ur16":"[object Int32Array]"===n?o+="si32":"[object Uint32Array]"===n?o+="ui32":"[object Float32Array]"===n?o+="fl32":"[object Float64Array]"===n?o+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(o+i(a))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var r="~~local_forage_type~"+e.type+"~"+i(this.result);t("__lfsc__:blob"+r)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:n},l={},p=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return l[t]||(l[t]=new e(t)),l[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete l[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?a(e):{},r=o(t,this._defaultConfig),n=p.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=d,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=n,Promise.resolve()},e.clear=function(e){var t=this,r=this.ready().then((function(){t._dbInfo.mStore.clear()}));return s(r,e),r},e.dropInstance=function(e,t){var r=u.apply(this,arguments),n=r.promise,i=r.callback,a=n.then((function(e){p.resolve(e).drop()}));return s(a,i),n},e.getItem=function(e,t){var r=this;e=c(e);var n=this.ready().then((function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)}));return s(n,t),n},e.iterate=function(e,t){var r=this,n=this.ready().then((function(){for(var t=r._dbInfo.mStore,n=t.keys(),i=0;i<n.length;i++){var a=t.get(n[i]);if(a&&(a=r._dbInfo.serializer.deserialize(a)),void 0!==(a=e(a,n[i],i+1)))return a}}));return s(n,t),n},e.key=function(e,t){var r=this,n=this.ready().then((function(){var t;try{void 0===(t=r._dbInfo.mStore.key(e))&&(t=null)}catch{t=null}return t}));return s(n,t),n},e.keys=function(e){var t=this,r=this.ready().then((function(){return t._dbInfo.mStore.keys()}));return s(r,e),r},e.length=function(e){var t=this.keys().then((function(e){return e.length}));return s(t,e),t},e.removeItem=function(e,t){var r=this;e=c(e);var n=this.ready().then((function(){r._dbInfo.mStore.rm(e)}));return s(n,t),n},e.setItem=function(e,t,r){var n=this;e=c(e);var i=this.ready().then((function(){void 0===t&&(t=null);var r=t;return new Promise((function(i,a){n._dbInfo.serializer.serialize(t,(function(t,o){if(o)a(o);else try{n._dbInfo.mStore.set(e,t),i(r)}catch(e){a(e)}}))}))}));return s(i,r),i},Object.defineProperty(e,"__esModule",{value:!0})}))})),QU=XU(JU()),ZU=XU(YU()),ej={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var tj=function(e,t){return Object.assign(kL,t),e}(FU,{platform:"web",sdkName:"magic-sdk",version:"13.6.2",defaultEndpoint:"https://auth.magic.link/",ViewController:class extends UU{constructor(){super(...arguments),this.activeElement=null}init(){this.test="hello",this.iframe=new Promise((e=>{let t=()=>{if(function(e){let t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find((t=>t.src.includes(e))))}(encodeURIComponent(this.parameters)))new IL(tF.DuplicateIframe,"Duplicate iframes found.").log();else{let t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=RU(this.endpoint).host,t.title="Secure Modal",t.src=RU(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,function(e){for(let[t,r]of Object.entries(ej))e.style[t]=r}(t),document.body.appendChild(t),e(t)}};["loaded","interactive","complete"].includes(document.readyState)?t():window.addEventListener("load",t,!1)})),window.addEventListener("message",(e=>{var t;if(e.origin===this.endpoint&&e.data&&e.data.msgType&&this.messageHandlers.size){e.data.response=null!=(t=e.data.response)?t:{};for(let t of this.messageHandlers.values())t(e)}}))}showOverlay(){return $U(this,null,(function*(){let e=yield this.iframe;e.style.display="block",this.activeElement=document.activeElement,e.focus()}))}hideOverlay(){return $U(this,null,(function*(){var e;(yield this.iframe).style.display="none",null!=(e=this.activeElement)&&e.focus&&this.activeElement.focus(),this.activeElement=null}))}_post(e){return $U(this,null,(function*(){let t=yield this.iframe;if(!t||!t.contentWindow)throw new RL(eF.ModalNotReady,"Modal is not ready.");t.contentWindow.postMessage(e,this.endpoint)}))}},configureStorage:()=>$U(void 0,null,(function*(){let e=QU.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(ZU),yield e.setDriver([QU.default.INDEXEDDB,QU.default.LOCALSTORAGE,ZU._driver]),e}))}),rj=(e=>(e.LoginWithOIDC="magic_auth_login_with_oidc",e))(rj||{}),nj=class extends NU.Internal{constructor(){super(...arguments),this.name="openid",this.config={}}loginWithOIDC(e){let t=this.utils.createJsonRpcRequestPayload("magic_auth_login_with_oidc",[e]);return this.request(t)}};function ij(e,t){return function(){return e.apply(t,arguments)}}const{toString:aj}=Object.prototype,{getPrototypeOf:oj}=Object,sj=(e=>t=>{const r=aj.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),fj=e=>(e=e.toLowerCase(),t=>sj(t)===e),uj=e=>t=>typeof t===e,{isArray:cj}=Array,dj=uj("undefined");const lj=fj("ArrayBuffer");const pj=uj("string"),hj=uj("function"),mj=uj("number"),bj=e=>null!==e&&"object"==typeof e,yj=e=>{if("object"!==sj(e))return!1;const t=oj(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},gj=fj("Date"),vj=fj("File"),wj=fj("Blob"),_j=fj("FileList"),Ej=fj("URLSearchParams");function Tj(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),cj(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function Aj(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const Sj="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,kj=e=>!dj(e)&&e!==Sj;const Oj=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&oj(Uint8Array)),Rj=fj("HTMLFormElement"),xj=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Ij=fj("RegExp"),Cj=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Tj(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},Nj="abcdefghijklmnopqrstuvwxyz",Pj="0123456789",Mj={DIGIT:Pj,ALPHA:Nj,ALPHA_DIGIT:Nj+Nj.toUpperCase()+Pj};const Bj=fj("AsyncFunction");var Dj={isArray:cj,isArrayBuffer:lj,isBuffer:function(e){return null!==e&&!dj(e)&&null!==e.constructor&&!dj(e.constructor)&&hj(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||hj(e.append)&&("formdata"===(t=sj(e))||"object"===t&&hj(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&lj(e.buffer),t},isString:pj,isNumber:mj,isBoolean:e=>!0===e||!1===e,isObject:bj,isPlainObject:yj,isUndefined:dj,isDate:gj,isFile:vj,isBlob:wj,isRegExp:Ij,isFunction:hj,isStream:e=>bj(e)&&hj(e.pipe),isURLSearchParams:Ej,isTypedArray:Oj,isFileList:_j,forEach:Tj,merge:function e(){const{caseless:t}=kj(this)&&this||{},r={},n=(n,i)=>{const a=t&&Aj(r,i)||i;yj(r[a])&&yj(n)?r[a]=e(r[a],n):yj(n)?r[a]=e({},n):cj(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Tj(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(Tj(t,((t,n)=>{r&&hj(t)?e[n]=ij(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,a,o;const s={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],n&&!n(o,e,t)||s[o]||(t[o]=e[o],s[o]=!0);e=!1!==r&&oj(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:sj,kindOfTest:fj,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(cj(e))return e;let t=e.length;if(!mj(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Rj,hasOwnProperty:xj,hasOwnProp:xj,reduceDescriptors:Cj,freezeMethods:e=>{Cj(e,((t,r)=>{if(hj(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];hj(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return cj(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:Aj,global:Sj,isContextDefined:kj,ALPHABET:Mj,generateString:(e=16,t=Mj.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&hj(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(bj(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=cj(e)?[]:{};return Tj(e,((e,t)=>{const a=r(e,n+1);!dj(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:Bj,isThenable:e=>e&&(bj(e)||hj(e))&&hj(e.then)&&hj(e.catch)};function Fj(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}Dj.inherits(Fj,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Dj.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Lj=Fj.prototype,Uj={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{Uj[e]={value:e}})),Object.defineProperties(Fj,Uj),Object.defineProperty(Lj,"isAxiosError",{value:!0}),Fj.from=(e,t,r,n,i,a)=>{const o=Object.create(Lj);return Dj.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),Fj.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function jj(e){return Dj.isPlainObject(e)||Dj.isArray(e)}function qj(e){return Dj.endsWith(e,"[]")?e.slice(0,-2):e}function zj(e,t,r){return e?e.concat(t).map((function(e,t){return e=qj(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const Hj=Dj.toFlatObject(Dj,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Vj(e,t,r){if(!Dj.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=Dj.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Dj.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Dj.isSpecCompliantForm(t);if(!Dj.isFunction(i))throw new TypeError("visitor must be a function");function f(e){if(null===e)return"";if(Dj.isDate(e))return e.toISOString();if(!s&&Dj.isBlob(e))throw new Fj("Blob is not supported. Use a Buffer instead.");return Dj.isArrayBuffer(e)||Dj.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(Dj.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Dj.isArray(e)&&function(e){return Dj.isArray(e)&&!e.some(jj)}(e)||(Dj.isFileList(e)||Dj.endsWith(r,"[]"))&&(s=Dj.toArray(e)))return r=qj(r),s.forEach((function(e,n){!Dj.isUndefined(e)&&null!==e&&t.append(!0===o?zj([r],n,a):null===o?r:r+"[]",f(e))})),!1;return!!jj(e)||(t.append(zj(i,r,a),f(e)),!1)}const c=[],d=Object.assign(Hj,{defaultVisitor:u,convertValue:f,isVisitable:jj});if(!Dj.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Dj.isUndefined(r)){if(-1!==c.indexOf(r))throw Error("Circular reference detected in "+n.join("."));c.push(r),Dj.forEach(r,(function(r,a){!0===(!(Dj.isUndefined(r)||null===r)&&i.call(t,r,Dj.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),c.pop()}}(e),t}function Gj(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Kj(e,t){this._pairs=[],e&&Vj(e,this,t)}const Wj=Kj.prototype;function Xj(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $j(e,t,r){if(!t)return e;const n=r&&r.encode||Xj,i=r&&r.serialize;let a;if(a=i?i(t,r):Dj.isURLSearchParams(t)?t.toString():new Kj(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}Wj.append=function(e,t){this._pairs.push([e,t])},Wj.toString=function(e){const t=e?function(t){return e.call(this,t,Gj)}:Gj;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Jj=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Dj.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Yj={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Qj={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Kj,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function Zj(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&Dj.isArray(n)?n.length:a,s)return Dj.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&Dj.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&Dj.isArray(n[a])&&(n[a]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}(n[a])),!o}if(Dj.isFormData(e)&&Dj.isFunction(e.entries)){const r={};return Dj.forEachEntry(e,((e,n)=>{t(function(e){return Dj.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const eq={"Content-Type":void 0};const tq={transitional:Yj,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=Dj.isObject(e);i&&Dj.isHTMLForm(e)&&(e=new FormData(e));if(Dj.isFormData(e))return n&&n?JSON.stringify(Zj(e)):e;if(Dj.isArrayBuffer(e)||Dj.isBuffer(e)||Dj.isStream(e)||Dj.isFile(e)||Dj.isBlob(e))return e;if(Dj.isArrayBufferView(e))return e.buffer;if(Dj.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Vj(e,new Qj.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Qj.isNode&&Dj.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=Dj.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Vj(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(Dj.isString(e))try{return(t||JSON.parse)(e),Dj.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||tq.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&Dj.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw Fj.from(e,Fj.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Qj.classes.FormData,Blob:Qj.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Dj.forEach(["delete","get","head"],(function(e){tq.headers[e]={}})),Dj.forEach(["post","put","patch"],(function(e){tq.headers[e]=Dj.merge(eq)}));var rq=tq;const nq=Dj.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const iq=Symbol("internals");function aq(e){return e&&String(e).trim().toLowerCase()}function oq(e){return!1===e||null==e?e:Dj.isArray(e)?e.map(oq):String(e)}function sq(e,t,r,n,i){return Dj.isFunction(n)?n.call(this,t,r):(i&&(t=r),Dj.isString(t)?Dj.isString(n)?-1!==t.indexOf(n):Dj.isRegExp(n)?n.test(t):void 0:void 0)}class fq{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=aq(t);if(!i)throw new Error("header name must be a non-empty string");const a=Dj.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=oq(e))}const a=(e,t)=>Dj.forEach(e,((e,r)=>i(e,r,t)));return Dj.isPlainObject(e)||e instanceof this.constructor?a(e,t):Dj.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?a((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&nq[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=aq(e)){const r=Dj.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(Dj.isFunction(t))return t.call(this,e,r);if(Dj.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=aq(e)){const r=Dj.findKey(this,e);return!(!r||void 0===this[r]||t&&!sq(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=aq(e)){const i=Dj.findKey(r,e);!i||t&&!sq(0,r[i],i,t)||(delete r[i],n=!0)}}return Dj.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!sq(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return Dj.forEach(this,((n,i)=>{const a=Dj.findKey(r,i);if(a)return t[a]=oq(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=oq(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Dj.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&Dj.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[iq]=this[iq]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=aq(e);t[n]||(!function(e,t){const r=Dj.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return Dj.isArray(e)?e.forEach(n):n(e),this}}fq.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Dj.freezeMethods(fq.prototype),Dj.freezeMethods(fq);var uq=fq;function cq(e,t){const r=this||rq,n=t||r,i=uq.from(n.headers);let a=n.data;return Dj.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function dq(e){return!(!e||!e.__CANCEL__)}function lq(e,t,r){Fj.call(this,null==e?"canceled":e,Fj.ERR_CANCELED,t,r),this.name="CanceledError"}Dj.inherits(lq,Fj,{__CANCEL__:!0});var pq=Qj.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),Dj.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Dj.isString(n)&&o.push("path="+n),Dj.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function hq(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var mq=Qj.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=Dj.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function bq(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,o=0;return t=void 0!==t?t:1e3,function(s){const f=Date.now(),u=n[o];i||(i=f),r[a]=s,n[a]=f;let c=o,d=0;for(;c!==a;)d+=r[c++],c%=e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),f-i<t)return;const l=u&&f-u;return l?Math.round(1e3*d/l):void 0}}(50,250);return i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,s=a-r,f=n(s);r=a;const u={loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:f||void 0,estimated:f&&o&&a<=o?(o-a)/f:void 0,event:i};u[t?"download":"upload"]=!0,e(u)}}var yq="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=uq.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}Dj.isFormData(n)&&(Qj.isStandardBrowserEnv||Qj.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let f=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const u=hq(e.baseURL,e.url);function c(){if(!f)return;const n=uq.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Fj("Request failed with status code "+r.status,[Fj.ERR_BAD_REQUEST,Fj.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),s()}),(function(e){r(e),s()}),{data:a&&"text"!==a&&"json"!==a?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:n,config:e,request:f}),f=null}if(f.open(e.method.toUpperCase(),$j(u,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,"onloadend"in f?f.onloadend=c:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(c)},f.onabort=function(){f&&(r(new Fj("Request aborted",Fj.ECONNABORTED,e,f)),f=null)},f.onerror=function(){r(new Fj("Network Error",Fj.ERR_NETWORK,e,f)),f=null},f.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Yj;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new Fj(t,n.clarifyTimeoutError?Fj.ETIMEDOUT:Fj.ECONNABORTED,e,f)),f=null},Qj.isStandardBrowserEnv){const t=(e.withCredentials||mq(u))&&e.xsrfCookieName&&pq.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in f&&Dj.forEach(i.toJSON(),(function(e,t){f.setRequestHeader(t,e)})),Dj.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&"json"!==a&&(f.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",bq(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",bq(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{f&&(r(!t||t.type?new lq(null,e,f):t),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===Qj.protocols.indexOf(d)?r(new Fj("Unsupported protocol "+d+":",Fj.ERR_BAD_REQUEST,e)):f.send(n||null)}))};const gq={http:null,xhr:yq};Dj.forEach(gq,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var vq=e=>{e=Dj.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=Dj.isString(r)?gq[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new Fj(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(Dj.hasOwnProp(gq,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!Dj.isFunction(n))throw new TypeError("adapter is not a function");return n};function wq(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new lq(null,e)}function _q(e){wq(e),e.headers=uq.from(e.headers),e.data=cq.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return vq(e.adapter||rq.adapter)(e).then((function(t){return wq(e),t.data=cq.call(e,e.transformResponse,t),t.headers=uq.from(t.headers),t}),(function(t){return dq(t)||(wq(e),t&&t.response&&(t.response.data=cq.call(e,e.transformResponse,t.response),t.response.headers=uq.from(t.response.headers))),Promise.reject(t)}))}const Eq=e=>e instanceof uq?e.toJSON():e;function Tq(e,t){t=t||{};const r={};function n(e,t,r){return Dj.isPlainObject(e)&&Dj.isPlainObject(t)?Dj.merge.call({caseless:r},e,t):Dj.isPlainObject(t)?Dj.merge({},t):Dj.isArray(t)?t.slice():t}function i(e,t,r){return Dj.isUndefined(t)?Dj.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!Dj.isUndefined(t))return n(void 0,t)}function o(e,t){return Dj.isUndefined(t)?Dj.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,a){return a in t?n(r,i):a in e?n(void 0,r):void 0}const f={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(e,t)=>i(Eq(e),Eq(t),!0)};return Dj.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=f[n]||i,o=a(e[n],t[n],n);Dj.isUndefined(o)&&a!==s||(r[n]=o)})),r}const Aq="1.4.0",Sq={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Sq[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const kq={};Sq.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,a)=>{if(!1===e)throw new Fj(n(i," has been removed"+(t?" in "+t:"")),Fj.ERR_DEPRECATED);return t&&!kq[i]&&(kq[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}};var Oq={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Fj("options must be an object",Fj.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],o=t[a];if(o){const t=e[a],r=void 0===t||o(t,a,e);if(!0!==r)throw new Fj("option "+a+" must be "+r,Fj.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new Fj("Unknown option "+a,Fj.ERR_BAD_OPTION)}},validators:Sq};const Rq=Oq.validators;class xq{constructor(e){this.defaults=e,this.interceptors={request:new Jj,response:new Jj}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Tq(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&Oq.assertOptions(r,{silentJSONParsing:Rq.transitional(Rq.boolean),forcedJSONParsing:Rq.transitional(Rq.boolean),clarifyTimeoutError:Rq.transitional(Rq.boolean)},!1),null!=n&&(Dj.isFunction(n)?t.paramsSerializer={serialize:n}:Oq.assertOptions(n,{encode:Rq.function,serialize:Rq.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&Dj.merge(i.common,i[t.method]),a&&Dj.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=uq.concat(a,i);const o=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const f=[];let u;this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)}));let c,d=0;if(!s){const e=[_q.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,f),c=e.length,u=Promise.resolve(t);d<c;)u=u.then(e[d++],e[d++]);return u}c=o.length;let l=t;for(d=0;d<c;){const e=o[d++],t=o[d++];try{l=e(l)}catch(e){t.call(this,e);break}}try{u=_q.call(this,l)}catch(e){return Promise.reject(e)}for(d=0,c=f.length;d<c;)u=u.then(f[d++],f[d++]);return u}getUri(e){return $j(hq((e=Tq(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}Dj.forEach(["delete","get","head","options"],(function(e){xq.prototype[e]=function(t,r){return this.request(Tq(r||{},{method:e,url:t,data:(r||{}).data}))}})),Dj.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(Tq(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}xq.prototype[e]=t(),xq.prototype[e+"Form"]=t(!0)}));var Iq=xq;class Cq{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new lq(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;const t=new Cq((function(t){e=t}));return{token:t,cancel:e}}}var Nq=Cq;const Pq={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Pq).forEach((([e,t])=>{Pq[t]=e}));var Mq=Pq;const Bq=function e(t){const r=new Iq(t),n=ij(Iq.prototype.request,r);return Dj.extend(n,Iq.prototype,r,{allOwnKeys:!0}),Dj.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Tq(t,r))},n}(rq);Bq.Axios=Iq,Bq.CanceledError=lq,Bq.CancelToken=Nq,Bq.isCancel=dq,Bq.VERSION=Aq,Bq.toFormData=Vj,Bq.AxiosError=Fj,Bq.Cancel=Bq.CanceledError,Bq.all=function(e){return Promise.all(e)},Bq.spread=function(e){return function(t){return e.apply(null,t)}},Bq.isAxiosError=function(e){return Dj.isObject(e)&&!0===e.isAxiosError},Bq.mergeConfig=Tq,Bq.AxiosHeaders=uq,Bq.formToJSON=e=>Zj(Dj.isHTMLForm(e)?new FormData(e):e),Bq.HttpStatusCode=Mq,Bq.default=Bq;var Dq=Bq;const Fq="https://guardian.sandbox.imtbl.com".replace(/\/+$/,"");class Lq{basePath;axios;configuration;constructor(e,t=Fq,r=Dq){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Uq extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const jq="https://example.com",qq=function(e,t,r){if(null==r)throw new Uq(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},zq=async function(e,t){if(t&&t.accessToken){const r="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+r}};function Hq(e,t,r=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>Hq(e,t,r))):Object.keys(t).forEach((n=>Hq(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t))}const Vq=function(e,...t){const r=new URLSearchParams(e.search);Hq(r,t),e.search=r.toString()},Gq=function(e,t,r){const n="string"!=typeof e;return(n&&r&&r.isJsonMime?r.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},Kq=function(e){return e.pathname+e.search+e.hash},Wq=function(e,t,r,n){return(i=t,a=r)=>{const o={...e.options,url:(n?.basePath||a)+e.url};return i.request(o)}},Xq=function(e){const t=function(e){return{approvePendingTransaction:async(t,r,n={})=>{qq("approvePendingTransaction","payloadHash",t),qq("approvePendingTransaction","transactionApprovalRequest",r);const i="/guardian/v1/transactions/{payloadHash}/approve".replace("{payloadHash}",encodeURIComponent(String(t))),a=new URL(i,jq);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},f={};await zq(f,e),f["Content-Type"]="application/json",Vq(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...f,...u,...n.headers},s.data=Gq(r,s,e),{url:Kq(a),options:s}},evaluateTransaction:async(t,r,n={})=>{qq("evaluateTransaction","id",t),qq("evaluateTransaction","transactionEvaluationRequest",r);const i="/guardian/v1/transactions/{id}/evaluate".replace("{id}",encodeURIComponent(String(t))),a=new URL(i,jq);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},f={};await zq(f,e),f["Content-Type"]="application/json",Vq(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...f,...u,...n.headers},s.data=Gq(r,s,e),{url:Kq(a),options:s}},getTransactionByID:async(t,r,n,i={})=>{qq("getTransactionByID","transactionID",t),qq("getTransactionByID","chainType",r);const a="/guardian/v1/transactions/{transactionID}".replace("{transactionID}",encodeURIComponent(String(t))),o=new URL(a,jq);let s;e&&(s=e.baseOptions);const f={method:"GET",...s,...i},u={},c={};await zq(u,e),void 0!==r&&(c.chainType=r),void 0!==n&&(c.chainID=n),Vq(o,c);let d=s&&s.headers?s.headers:{};return f.headers={...u,...d,...i.headers},{url:Kq(o),options:f}}}}(e);return{async approvePendingTransaction(r,n,i){const a=await t.approvePendingTransaction(r,n,i);return Wq(a,Dq,Fq,e)},async evaluateTransaction(r,n,i){const a=await t.evaluateTransaction(r,n,i);return Wq(a,Dq,Fq,e)},async getTransactionByID(r,n,i,a){const o=await t.getTransactionByID(r,n,i,a);return Wq(o,Dq,Fq,e)}}};class $q extends Lq{approvePendingTransaction(e,t){return Xq(this.configuration).approvePendingTransaction(e.payloadHash,e.transactionApprovalRequest,t).then((e=>e(this.axios,this.basePath)))}evaluateTransaction(e,t){return Xq(this.configuration).evaluateTransaction(e.id,e.transactionEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionByID(e,t){return Xq(this.configuration).getTransactionByID(e.transactionID,e.chainType,e.chainID,t).then((e=>e(this.axios,this.basePath)))}}class Jq{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const Yq="starkex",Qq="evm";function Zq(e){const t=-1!==new li(e,16).cmp(new li(27))?new li(e,16).sub(new li(27)).toNumber():new li(e,16).toNumber();return e.trim()?t:void 0}async function ez(e,t){const r=function(e,t=64){const r=Cy(e);return{r:new li(r.substring(0,t),"hex"),s:new li(r.substring(t,2*t),"hex"),recoveryParam:Zq(r.substring(2*t,2*t+2))}}(await t.signMessage(e));return Py(xy((n=r).r.toString(16),64)+xy(n.s.toString(16),64)+xy(n.recoveryParam?.toString(16)||"",2));var n}function tz(e){switch(e.type){case"ERC721":return{type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return{type:"ERC20",data:{token_address:e.tokenAddress}};default:return{type:"ETH",data:{decimals:18}}}}const rz={erc1271:Object.freeze({__proto__:null,abi:[{type:"function",name:"isValidSignature",constant:!0,inputs:[{type:"bytes32"},{type:"bytes"}],outputs:[{type:"bytes4"}],payable:!1,stateMutability:"view"}],returns:{isValidSignatureBytes32:"0x1626ba7e"}}),factory:Object.freeze({__proto__:null,abi:[{type:"function",name:"deploy",constant:!1,inputs:[{type:"address"},{type:"bytes32"}],outputs:[],payable:!0,stateMutability:"payable"}]}),mainModule:Object.freeze({__proto__:null,abi:[{type:"function",name:"nonce",constant:!0,inputs:[],outputs:[{type:"uint256"}],payable:!1,stateMutability:"view"},{type:"function",name:"readNonce",constant:!0,inputs:[{type:"uint256"}],outputs:[{type:"uint256"}],payable:!1,stateMutability:"view"},{type:"function",name:"updateImplementation",constant:!1,inputs:[{type:"address"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"selfExecute",constant:!1,inputs:[{components:[{type:"bool",name:"delegateCall"},{type:"bool",name:"revertOnError"},{type:"uint256",name:"gasLimit"},{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}],type:"tuple[]"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"execute",constant:!1,inputs:[{components:[{type:"bool",name:"delegateCall"},{type:"bool",name:"revertOnError"},{type:"uint256",name:"gasLimit"},{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}],type:"tuple[]"},{type:"uint256"},{type:"bytes"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"createContract",inputs:[{type:"bytes"}],payable:!0,stateMutability:"payable"}]}),mainModuleUpgradable:Object.freeze({__proto__:null,abi:[{type:"function",name:"updateImageHash",constant:!0,inputs:[{type:"bytes32"}],outputs:[],payable:!1,stateMutability:"view"},{type:"function",name:"imageHash",constant:!0,inputs:[],outputs:[{type:"bytes32"}],payable:!1,stateMutability:"view"}]}),sequenceUtils:Object.freeze({__proto__:null,abi:[{inputs:[{internalType:"address",name:"_factory",type:"address"},{internalType:"address",name:"_mainModule",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"_wallet",type:"address"},{indexed:!0,internalType:"bytes32",name:"_imageHash",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"_threshold",type:"uint256"},{indexed:!1,internalType:"bytes",name:"_signers",type:"bytes"}],name:"RequiredConfig",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"_wallet",type:"address"},{indexed:!0,internalType:"address",name:"_signer",type:"address"}],name:"RequiredSigner",type:"event"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callBalanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callBlockNumber",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_i",type:"uint256"}],name:"callBlockhash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"callChainId",outputs:[{internalType:"uint256",name:"id",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCode",outputs:[{internalType:"bytes",name:"code",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCodeHash",outputs:[{internalType:"bytes32",name:"codeHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCodeSize",outputs:[{internalType:"uint256",name:"size",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callCoinbase",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"callDifficulty",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasLeft",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasLimit",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callOrigin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"callTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"knownImageHashes",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"lastImageHashUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lastSignerUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lastWalletUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"bool",name:"delegateCall",type:"bool"},{internalType:"bool",name:"revertOnError",type:"bool"},{internalType:"uint256",name:"gasLimit",type:"uint256"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],internalType:"struct IModuleCalls.Transaction[]",name:"_txs",type:"tuple[]"}],name:"multiCall",outputs:[{internalType:"bool[]",name:"_successes",type:"bool[]"},{internalType:"bytes[]",name:"_results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"uint256",name:"_threshold",type:"uint256"},{components:[{internalType:"uint256",name:"weight",type:"uint256"},{internalType:"address",name:"signer",type:"address"}],internalType:"struct RequireUtils.Member[]",name:"_members",type:"tuple[]"},{internalType:"bool",name:"_index",type:"bool"}],name:"publishConfig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"uint256",name:"_sizeMembers",type:"uint256"},{internalType:"bytes",name:"_signature",type:"bytes"},{internalType:"bool",name:"_index",type:"bool"}],name:"publishInitialSigners",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"uint256",name:"_nonce",type:"uint256"}],name:"requireMinNonce",outputs:[],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_expiration",type:"uint256"}],name:"requireNonExpired",outputs:[],stateMutability:"view",type:"function"}]}),requireFreshSigner:Object.freeze({__proto__:null,abi:[{inputs:[{internalType:"address",name:"",type:"address"}],name:"requireFreshSigner",outputs:[],stateMutability:"nonpayable",type:"function"}]})};function nz(){return nz=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},nz.apply(this,arguments)}var iz;!function(e){e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.DISABLED=5]="DISABLED"}(iz||(iz={}));function az(e,t){return function(...r){const n=Array.prototype.slice.call(r);return new Promise((async(r,i)=>{try{n.push(((e,t)=>e?i(e):r(t))),await e.apply(t,n)}catch(e){i(e)}}))}}new class{constructor(e){this.config=e,this.logLevel=void 0,this.configure(e)}configure(e){switch(this.config=nz({},this.config,e),this.config.logLevel){case"DEBUG":this.logLevel=iz.DEBUG;break;case"INFO":default:this.logLevel=iz.INFO;break;case"WARN":this.logLevel=iz.WARN;break;case"ERROR":this.logLevel=iz.ERROR;break;case"DISABLED":this.logLevel=iz.DISABLED}void 0===this.config.silence&&(this.config.silence=!1)}debug(e,...t){!0!==this.config.silence&&this.logLevel===iz.DEBUG&&console.log(e,...t)}info(e,...t){!0!==this.config.silence&&this.logLevel<=iz.INFO&&console.log(e,...t)}warn(e,...t){!0!==this.config.silence&&this.logLevel<=iz.WARN&&(console.warn(e,...t),this.config.onwarn&&this.config.onwarn(e,t))}error(e,...t){!0!==this.config.silence&&this.logLevel<=iz.ERROR&&(console.error(e,...t),this.config.onerror&&this.config.onerror(e,t))}}({logLevel:"INFO",silence:!0});const oz=(e=0,t=Number.MAX_SAFE_INTEGER)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e);function sz(){return sz=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sz.apply(this,arguments)}const fz=(e,t=!1)=>(((e,t=!1,r=!1)=>{if(!e)throw new Error("invalid network config: empty config");const n=[];if(Array.isArray(e)?n.push(...e):n.push(e),0===n.length){if(t)throw new Error("invalid network config: empty config");return!1}const i=n.map((e=>e.chainId)).sort(),a=i.filter(((e,t)=>i.indexOf(e)!==t));if(a.length>0){if(t)throw new Error(`invalid network config: duplicate chainIds ${a}`);return!1}n.forEach((e=>e.name=e.name.toLowerCase()));const o=n.map((e=>e.name)).sort(),s=o.filter(((e,t)=>o.indexOf(e)!==t));if(s.length>0){if(t)throw new Error(`invalid network config: duplicate network names ${s}`);return!1}let f=!1,u=!1;for(let e=0;e<n.length;e++){const i=n[e];if(!(i.rpcUrl&&""!==i.rpcUrl||i.provider)){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: rpcUrl or provider must be provided`);return!1}if(!r&&!i.relayer){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: relayer must be provided`);return!1}if(i.isDefaultChain){if(f){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: DefaultChain is already set by another config`);return!1}f=!0}if(i.isAuthChain){if(u&&t)throw new Error(`invalid network config for chainId ${i.chainId}: AuthChain is already set by another config`);u=!0}}if(!f){if(t)throw new Error("invalid network config: DefaultChain must be set");return!1}if(!u){if(t)throw new Error("invalid network config: AuthChain must be set");return!1}})(e,!0,t),e),uz=e=>fz(cz(e)),cz=e=>{if(!e)return[];const t=e.sort(((e,t)=>e.chainId===t.chainId?0:e.chainId<t.chainId?-1:1)),r=t.findIndex((e=>e.isDefaultChain));r>0&&t.splice(0,0,t.splice(r,1)[0]);const n=t.findIndex((e=>e.isAuthChain&&!0!==e.isDefaultChain));return n>0&&t.splice(1,0,t.splice(n,1)[0]),t},dz=(e,t)=>"string"==typeof e?(t=t||{},e.replace(/\$\{\s*([$#@\-\d\w]+)\s*\}/gim,(function(e,r){let n=t[r];return n="function"==typeof n?n():null==n?"":"object"==typeof n||"symbol"==typeof n?n.toString():n.valueOf(),n}))):"";let lz;!function(e){e[e.MAINNET=1]="MAINNET",e[e.ROPSTEN=3]="ROPSTEN",e[e.RINKEBY=4]="RINKEBY",e[e.GOERLI=5]="GOERLI",e[e.KOVAN=42]="KOVAN",e[e.POLYGON=137]="POLYGON",e[e.POLYGON_MUMBAI=80001]="POLYGON_MUMBAI",e[e.POLYGON_ZKEVM=1101]="POLYGON_ZKEVM",e[e.BSC=56]="BSC",e[e.BSC_TESTNET=97]="BSC_TESTNET",e[e.OPTIMISM=10]="OPTIMISM",e[e.OPTIMISM_TESTNET=69]="OPTIMISM_TESTNET",e[e.ARBITRUM=42161]="ARBITRUM",e[e.ARBITRUM_GOERLI=421613]="ARBITRUM_GOERLI",e[e.ARBITRUM_NOVA=42170]="ARBITRUM_NOVA",e[e.AVALANCHE=43114]="AVALANCHE",e[e.AVALANCHE_TESTNET=43113]="AVALANCHE_TESTNET",e[e.FANTOM=250]="FANTOM",e[e.FANTOM_TESTNET=4002]="FANTOM_TESTNET",e[e.GNOSIS=100]="GNOSIS",e[e.AURORA=1313161554]="AURORA",e[e.AURORA_TESTNET=1313161556]="AURORA_TESTNET",e[e.BASE_GOERLI=84531]="BASE_GOERLI"}(lz||(lz={}));const pz=e=>dz("https://${network}-indexer.sequence.app",{network:e}),hz=e=>dz("https://${network}-relayer.sequence.app",{network:e}),mz=e=>dz("https://nodes.sequence.app/${network}",{network:e}),bz={[lz.MAINNET]:{chainId:lz.MAINNET,name:"mainnet",title:"Ethereum",blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[lz.ROPSTEN]:{chainId:lz.ROPSTEN,name:"ropsten",title:"Ropsten",testnet:!0,blockExplorer:{name:"Etherscan (Ropsten)",rootUrl:"https://ropsten.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[lz.RINKEBY]:{chainId:lz.RINKEBY,name:"rinkeby",title:"Rinkeby",testnet:!0,blockExplorer:{name:"Etherscan (Rinkeby)",rootUrl:"https://rinkeby.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",disabled:!0},[lz.GOERLI]:{chainId:lz.GOERLI,name:"goerli",title:"Goerli",testnet:!0,blockExplorer:{name:"Etherscan (Goerli)",rootUrl:"https://goerli.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[lz.KOVAN]:{chainId:lz.KOVAN,name:"kovan",title:"Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"}},[lz.POLYGON]:{chainId:lz.POLYGON,name:"polygon",title:"Polygon",blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"}},[lz.POLYGON_MUMBAI]:{chainId:lz.POLYGON_MUMBAI,name:"mumbai",title:"Polygon Mumbai",testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"}},[lz.POLYGON_ZKEVM]:{chainId:lz.POLYGON_ZKEVM,name:"polygon-zkevm",title:"Polygon zkEVM",blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"}},[lz.BSC]:{chainId:lz.BSC,name:"bsc",title:"BNB Smart Chain",blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"}},[lz.BSC_TESTNET]:{chainId:lz.BSC_TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"}},[lz.OPTIMISM]:{chainId:lz.OPTIMISM,name:"optimism",title:"Optimism",blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"}},[lz.OPTIMISM_TESTNET]:{chainId:lz.OPTIMISM_TESTNET,name:"optimism-testnet",title:"Optimistic Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Optimism Testnet)",rootUrl:"https://kovan-optimistic.etherscan.io/"}},[lz.ARBITRUM]:{chainId:lz.ARBITRUM,name:"arbitrum",title:"Arbitrum One",blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"}},[lz.ARBITRUM_GOERLI]:{chainId:lz.ARBITRUM_GOERLI,name:"arbitrum-goerli",title:"Arbitrum Goerli",testnet:!0,blockExplorer:{name:"Arbiscan (Testnet)",rootUrl:"https://testnet.arbiscan.io/"}},[lz.ARBITRUM_NOVA]:{chainId:lz.ARBITRUM_NOVA,name:"arbitrum-nova",title:"Arbitrum Nova",blockExplorer:{name:"Nova Explorer",rootUrl:"https://nova-explorer.arbitrum.io/"}},[lz.AVALANCHE]:{chainId:lz.AVALANCHE,name:"avalanche",title:"Avalanche",blockExplorer:{name:"Snowtrace",rootUrl:"https://snowtrace.io/"}},[lz.AVALANCHE_TESTNET]:{chainId:lz.AVALANCHE_TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",testnet:!0,blockExplorer:{name:"Snowtrace (Testnet)",rootUrl:"https://testnet.snowtrace.io/"}},[lz.FANTOM]:{chainId:lz.FANTOM,name:"fantom",title:"Fantom",blockExplorer:{name:"FTMScan",rootUrl:"https://ftmscan.com/"}},[lz.FANTOM_TESTNET]:{chainId:lz.FANTOM_TESTNET,name:"fantom-testnet",title:"Fantom Testnet",testnet:!0,blockExplorer:{name:"FTMScan (Testnet)",rootUrl:"https://testnet.ftmscan.com/"}},[lz.GNOSIS]:{chainId:lz.GNOSIS,name:"gnosis",title:"Gnosis Chain",blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"}},[lz.AURORA]:{chainId:lz.AURORA,name:"aurora",title:"Aurora",blockExplorer:{name:"Aurora Explorer",rootUrl:"https://aurorascan.dev/"}},[lz.AURORA_TESTNET]:{chainId:lz.AURORA_TESTNET,name:"aurora-testnet",title:"Aurora Testnet",blockExplorer:{name:"Aurora Explorer (Testnet)",rootUrl:"https://testnet.aurorascan.dev/"}},[lz.BASE_GOERLI]:{chainId:lz.BASE_GOERLI,name:"base-goerli",title:"Base Goerli",blockExplorer:{name:"Base Goerli Explorer",rootUrl:"https://goerli.basescan.org/"}}};uz([sz({},bz[lz.MAINNET],{rpcUrl:mz("mainnet"),relayer:{url:hz("mainnet")},indexerUrl:pz("mainnet")}),sz({},bz[lz.POLYGON],{rpcUrl:mz("polygon"),relayer:{url:hz("polygon")},indexerUrl:pz("polygon"),isDefaultChain:!0,isAuthChain:!0}),sz({},bz[lz.BSC],{rpcUrl:mz("bsc"),indexerUrl:pz("bsc"),relayer:{url:hz("bsc")}}),sz({},bz[lz.AVALANCHE],{rpcUrl:mz("avalanche"),indexerUrl:pz("avalanche"),relayer:{url:hz("avalanche")}}),sz({},bz[lz.ARBITRUM],{rpcUrl:mz("arbitrum"),indexerUrl:pz("arbitrum"),relayer:{url:hz("arbitrum")}}),sz({},bz[lz.ARBITRUM_NOVA],{rpcUrl:mz("arbitrum-nova"),indexerUrl:pz("arbitrum-nova"),relayer:{url:hz("arbitrum-nova")}}),sz({},bz[lz.OPTIMISM],{rpcUrl:mz("optimism"),indexerUrl:pz("optimism"),relayer:{url:hz("optimism")}}),sz({},bz[lz.POLYGON_ZKEVM],{rpcUrl:mz("polygon-zkevm"),indexerUrl:pz("polygon-zkevm"),relayer:{url:hz("polygon-zkevm")}}),sz({},bz[lz.GNOSIS],{rpcUrl:mz("gnosis"),indexerUrl:pz("gnosis"),relayer:{url:hz("gnosis")}})]),uz([sz({},bz[lz.RINKEBY],{rpcUrl:mz("rinkeby"),relayer:{url:hz("rinkeby")},indexerUrl:pz("rinkeby")}),sz({},bz[lz.GOERLI],{rpcUrl:mz("goerli"),relayer:{url:hz("goerli")},indexerUrl:pz("goerli")}),sz({},bz[lz.POLYGON_MUMBAI],{rpcUrl:mz("mumbai"),relayer:{url:hz("mumbai")},indexerUrl:pz("mumbai"),isDefaultChain:!0,isAuthChain:!0}),sz({},bz[lz.BSC_TESTNET],{rpcUrl:mz("bsc-testnet"),relayer:{url:hz("bsc-testnet")},indexerUrl:pz("bsc-testnet")}),sz({},bz[lz.ARBITRUM_GOERLI],{rpcUrl:mz("arbitrum-goerli"),relayer:{url:hz("arbitrum-goerli")},indexerUrl:pz("arbitrum-goerli")}),sz({},bz[lz.BASE_GOERLI],{rpcUrl:mz("base-goerli"),relayer:{url:hz("base-goerli")},indexerUrl:pz("base-goerli")})]);const yz="2.0";function gz(){return gz=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},gz.apply(this,arguments)}let vz;function wz(e,t){return e.reduce((function(e,r,n){return t(r,n)?e[0].push(r):e[1].push(r),e}),[[],[]])}!function(e){e.ethCall="eth_call",e.ethGetBalance="eth_getBalance",e.ethGetCode="eth_getCode"}(vz||(vz={}));const _z={batchSize:50,timeWindow:50,contract:"0xd130B43062D875a4B7aF3f8fc036Bc6e9D3E1B3E",verbose:!1};let Ez=class e{constructor(t){var r=this;if(this.batchableJsonRpcMethods=[vz.ethCall,vz.ethGetCode,vz.ethGetBalance],this.multicallInterface=new Df(rz.sequenceUtils.abi),this.options=void 0,this.timeout=void 0,this.queue=[],this.scheduleExecution=()=>{this.queue.length>0&&(this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(this.run,this.options.timeWindow))},this.handle=(e,t,r)=>this.batchableJsonRpcMethods.find((e=>e===t.method))?(this.queue.push({request:t,callback:r,next:e}),this.options.verbose&&console.log("Scheduling call",t.method),void this.scheduleExecution()):(this.options.verbose&&console.log("Forwarded call",t.method),e(t,r)),this.run=async function(){r.options.verbose&&console.log("Processing multicall");const e=Math.min(r.options.batchSize,r.queue.length);if(0===e)return;if(1===e)return r.forward(r.queue[0]),r.queue=[],void(r.options.verbose&&console.log("Skip multicall, single item"));r.options.verbose&&console.log("Resolving",e);var t=r.queue.slice(0,e);r.queue=e===r.queue.length?[]:r.queue.slice(e),r.options.verbose&&console.log("Updated queue",r.queue.length),0!==r.queue.length&&r.scheduleExecution();const n=t[0].next;let i;var[t,a]=wz(t,(e=>{try{if(e.next!==n)return!1;switch(e.request.method){case vz.ethCall:if(e.request.params[0].from||e.request.params[0].gasPrice||e.request.params[0].value)return!1;case vz.ethGetBalance:case vz.ethGetCode:const t=function(e){if(void 0===e)return"latest";switch(e){case"earliest":case"latest":case"pending":return e}return Qi.from(e)}(e.request.params[1]);if(void 0===i&&(i=t),!function(e,t){return e===t||(Qi.isBigNumber(e)?!!Qi.isBigNumber(t)&&e.eq(t):!Qi.isBigNumber(t)&&e===t)}(t,i))return!1}return!0}catch(e){return!1}}));if(0!==a.length&&(r.options.verbose&&console.log("Forwarding incompatible calls",a.length),r.forward(a),0===t.length))return;let o=t.map((e=>{try{switch(e.request.method){case vz.ethCall:return{delegateCall:!1,revertOnError:!1,target:e.request.params[0].to,data:e.request.params[0].data,gasLimit:e.request.params[0].gas?e.request.params[0].gas:0,value:0};case vz.ethGetCode:return{delegateCall:!1,revertOnError:!1,target:r.options.contract,gasLimit:0,value:0,data:r.multicallInterface.encodeFunctionData(r.multicallInterface.getFunction("callCode"),[e.request.params[0]])};case vz.ethGetBalance:return{delegateCall:!1,revertOnError:!1,target:r.options.contract,gasLimit:0,value:0,data:r.multicallInterface.encodeFunctionData(r.multicallInterface.getFunction("callBalanceOf"),[e.request.params[0]])};default:return null}}catch(e){return null}}));var[t,a]=wz(t,((e,t)=>void 0!==o[t]));if(o=o.filter((e=>e)),0!==a.length&&(r.options.verbose&&console.log("Forwarding calls on error",a.length),r.forward(a),0===t.length))return;let s;try{s=r.multicallInterface.encodeFunctionData(r.multicallInterface.getFunction("multiCall"),[o])}catch(e){return void r.forward(t)}const f=oz(),u=await async function(e,t){try{return await e}catch(e){return t instanceof Function?t(e):t}}(az(n)({id:f,jsonrpc:yz,method:vz.ethCall,params:[{to:r.options.contract,value:0,data:s},Qi.isBigNumber(i)?i.toNumber():i]}),(e=>({jsonrpc:yz,id:f,result:void 0,error:e})));if(u.error)return r.forward(t);let c;try{c=r.multicallInterface.decodeFunctionResult(r.multicallInterface.getFunction("multiCall"),u.result)}catch(e){return void r.forward(t)}r.options.verbose&&console.log("Got response for",t.length),t.forEach(((e,t)=>{if(c[0][t])switch(e.request.method){case vz.ethCall:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:c[1][t]});break;case vz.ethGetCode:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:xs.decode(["bytes"],c[1][t])[0]});break;case vz.ethGetBalance:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:xs.decode(["uint256"],c[1][t])[0]})}else r.forward(e)}))},this.options=t?gz({},e.DefaultOptions,t):e.DefaultOptions,this.options.batchSize<=0)throw new Error(`Invalid batch size of ${this.options.batchSize}`)}forward(e){Array.isArray(e)?e.forEach((e=>e.next(e.request,e.callback))):e.next(e.request,e.callback)}static isMulticall(t){return t&&void 0!==t.handle&&void 0!==t.conf&&e.isMulticallOptions(t.options)}static isMulticallOptions(e){return void 0!==e&&void 0!==e.batchSize&&void 0!==e.timeWindow&&void 0!==e.contract}};Ez.DefaultOptions=gz({},_z);const Tz=["getNetwork","getBlockNumber","getGasPrice","getTransactionCount","getStorageAt","sendTransaction","estimateGas","getBlock","getTransaction","getTransactionReceipt","getLogs","emit","litenerCount","addListener","removeListener","waitForTransaction","detectNetwork","getBlockWithTransactions"];var Az=Object.freeze({__proto__:null,ProxyMethods:Tz,MulticallProvider:class extends Wh{constructor(e,t){var r;super(e.getNetwork()),r=this,this.provider=e,this.multicall=void 0,this.listenerCount=this.provider.listenerCount,this.getResolver=async function(e){const t=r.provider;if(t.getResolver){const n=await t.getResolver(await e);return n?new Vh(r,n.address,n.name):null}return t.getResolver(await e)},this.next=async function(e,t){try{switch(e.method){case vz.ethCall:r.callback(e,t,await r.provider.call(e.params[0],e.params[1]));break;case vz.ethGetCode:r.callback(e,t,await r.provider.getCode(e.params[0],e.params[1]));break;case vz.ethGetBalance:r.callback(e,t,await r.provider.getBalance(e.params[0],e.params[1]))}}catch(n){r.callback(e,t,void 0,n)}},this.multicall=Ez.isMulticall(t)?t:new Ez(t),Tz.forEach((t=>{void 0!==e[t]&&(this[t]=(...r)=>e[t](...r))}))}callback(e,t,r,n){t(n,{jsonrpc:yz,id:e.id,result:r,error:n})}async call(e,t){return this.rpcCall(vz.ethCall,e,t)}async getCode(e,t){return this.rpcCall(vz.ethGetCode,e,t)}async getBalance(e,t){return this.rpcCall(vz.ethGetBalance,e,t)}async rpcCall(e,...t){const r=oz();return(await az(this.multicall.handle)(this.next,{jsonrpc:yz,id:r,method:e,params:t})).result}},MulticallExternalProvider:class{constructor(e,t){if(this.provider=e,this.multicall=void 0,this.multicall=Ez.isMulticall(t)?t:new Ez(t),e.send){const t=async function(t,r){e.send(t,r)};this.send=(e,r)=>{this.multicall.handle(t,e,r)}}if(e.sendAsync){const t=async function(t,r){e.sendAsync(t,r)};this.sendAsync=(e,r)=>{this.multicall.handle(t,e,r)}}}get isMetaMask(){return this.provider.isMetaMask}get isStatus(){return this.provider.isStatus}},multicallMiddleware:e=>t=>{const r=Ez.isMulticall(e)?e:new Ez(e);return(e,n)=>r.handle(t,e,n)}}),Sz=Object.freeze({__proto__:null,Multicall:Ez,providers:Az});let kz,Oz;try{kz=localStorage}catch(e){const t=new Map;kz={getItem:e=>{var r;return null!=(r=t.get(e))?r:null},setItem:(e,r)=>t.set(e,r),removeItem:e=>t.delete(e)}}function Rz(e){return void 0!==e.address&&!function(e){return xz(e)||Iz(e)||Cz(e)}(e)}function xz(e){const t=e;return void 0!==t.signature&&void 0===t.address}function Iz(e){const t=e;return void 0!==t.r&&void 0!==t.s&&void 0!==t.v&&void 0!==t.t}function Cz(e){const t=e;return void 0!==t.address&&void 0!==t.signature}!function(e){e[e.EOA=0]="EOA",e[e.Address=1]="Address",e[e.Full=2]="Full"}(Oz||(Oz={}));const Nz=e=>{if("string"==typeof e)return Nz((e=>{if("string"!=typeof e)return e;const t=e.replace("0x",""),r=Qi.from(`0x${t.slice(0,4)}`).toNumber(),n=[];for(let e=4;e<t.length;){const r=Qi.from(t.slice(e,e+2)).toNumber();e+=2;const i=Qi.from(`0x${t.slice(e,e+2)}`).toNumber();switch(e+=2,r){case Oz.Address:const r=Eo(t.slice(e,e+40));e+=40,n.push({weight:i,address:r});break;case Oz.EOA:const a=Ii(`0x${t.slice(e,e+132)}`);e+=132;const o=Hi(a.slice(0,65)),s=o.r,f=o.s,u=o.v,c=Qi.from(a[a.length-1]).toNumber();n.push({weight:i,signature:a,r:s,s:f,v:u,t:c});break;case Oz.Full:const d=Eo(t.slice(e,e+40));e+=40;const l=Qi.from(`0x${t.slice(e,e+4)}`).mul(2).toNumber();e+=4;const p=Ii(`0x${t.slice(e,e+l)}`);e+=l,n.push({weight:i,address:d,signature:p});break;default:throw Error("Signature type not supported")}}return{threshold:r,signers:n}})(e));const t=e.signers.map((e=>{if(Rz(e))return gb(["uint8","uint8","address"],[Oz.Address,e.weight,e.address]);if(Iz(e))return gb(["uint8","uint8","bytes32","bytes32","uint8","uint8"],[Oz.EOA,e.weight,e.r,e.s,e.v,e.t]);if(Cz(e)){const t=Ii(e.signature).length;return gb(["uint8","uint8","address","uint16","bytes"],[Oz.Full,e.weight,e.address,t,e.signature])}if(xz(e))return gb(["uint8","uint8","bytes"],[Oz.EOA,e.weight,e.signature]);throw Error("Unkwnown signature part type")}));return gb(["uint16",...Array(t.length).fill("bytes")],[e.threshold,...t])};var Pz;!function(e){e.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",e.INVALID_CONFIGURATION="INVALID_CONFIGURATION",e.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR",e.NOT_LOGGED_IN_ERROR="NOT_LOGGED_IN_ERROR",e.SILENT_LOGIN_ERROR="SILENT_LOGIN_ERROR",e.REFRESH_TOKEN_ERROR="REFRESH_TOKEN_ERROR",e.USER_REGISTRATION_ERROR="USER_REGISTRATION_ERROR",e.LOGOUT_ERROR="LOGOUT_ERROR",e.TRANSFER_ERROR="TRANSFER_ERROR",e.CREATE_ORDER_ERROR="CREATE_ORDER_ERROR",e.CANCEL_ORDER_ERROR="CANCEL_ORDER_ERROR",e.EXCHANGE_TRANSFER_ERROR="EXCHANGE_TRANSFER_ERROR",e.CREATE_TRADE_ERROR="CREATE_TRADE_ERROR",e.OPERATION_NOT_SUPPORTED_ERROR="OPERATION_NOT_SUPPORTED_ERROR"}(Pz||(Pz={}));class Mz extends Error{type;constructor(e,t){super(e),this.type=t}}const Bz=async(e,t)=>{try{return await e()}catch(e){const r=`${t}: ${e.message}`||"UnknownError";throw new Mz(r,t)}},Dz="passport_credentials",Fz="pkce_state",Lz="pkce_verifier";class Uz{saveCredentials(e){if(!this.areValid(e))throw Error("Invalid credentials.");localStorage.setItem(Dz,JSON.stringify(e))}getCredentials(){const e=localStorage.getItem(Dz);return e?JSON.parse(e):null}areValid(e){if(e){const t=this.isTokenValid(e.access_token),r=this.isTokenValid(e.id_token);return t&&r}return!1}isTokenValid(e){try{const t=bD(e).exp??0;return t>Date.now()/1e3+3600}catch(e){return!1}}clearCredentials(){localStorage.removeItem(Dz)}savePKCEData(e){localStorage.setItem(Fz,e.state),localStorage.setItem(Lz,e.verifier)}getPKCEData(){const e=localStorage.getItem(Fz),t=localStorage.getItem(Lz);return e&&t?{state:e,verifier:t}:null}}const jz={headers:{"Content-Type":"application/x-www-form-urlencoded"}};function qz(e){return new Promise((t=>{setTimeout(t,e)}))}class zz{userManager;config;deviceCredentialsManager;logoutMode;constructor(e){this.config=e,this.userManager=new class{constructor(e){this._logger=new ED("UserManager"),this.settings=new JD(e),this._client=new class{constructor(e){this._logger=new ED("OidcClient"),this.settings=new BD(e),this.metadataService=new class{constructor(e){this._settings=e,this._logger=new ED("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new PD(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){const e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);const t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},this._settings.metadataSeed,t),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){const r=this._logger.create(`_getMetadataProperty('${e}')`),n=await this.getMetadata();if(r.debug("resolved"),void 0===n[e]){if(!0===t)return void r.warn("Metadata does not contain optional property");r.throw(new Error("Metadata does not contain property "+e))}return n[e]}async getSigningKeys(){const e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;const t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);const r=await this._jsonService.getJson(t);if(e.debug("got key set",r),!Array.isArray(r.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=r.keys,this._signingKeys}}(this.settings),this._claimsService=new class{constructor(e){this._settings=e,this._logger=new ED("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let e;e=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:jD;for(const r of e)qD.includes(r)||delete t[r]}return t}mergeClaims(e,t){const r={...e};for(const[e,n]of Object.entries(t))for(const t of Array.isArray(n)?n:[n]){const n=r[e];n?Array.isArray(n)?n.includes(t)||n.push(t):r[e]!==t&&("object"==typeof t&&this._settings.mergeClaims?r[e]=this.mergeClaims(n,t):r[e]=[n,t]):r[e]=t}return r}}(this.settings),this._validator=new class{constructor(e,t,r){this._settings=e,this._metadataService=t,this._claimsService=r,this._logger=new ED("ResponseValidator"),this._userInfoService=new class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new ED("UserInfoService"),this._getClaimsFromJwt=async e=>{const t=this._logger.create("_getClaimsFromJwt");try{const r=SD.decode(e);return t.debug("JWT decoding successful"),r}catch(e){throw t.error("Error parsing JWT response"),e}},this._jsonService=new PD(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){const t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));const r=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",r);const n=await this._jsonService.getJson(r,{token:e,credentials:this._settings.fetchRequestCredentials});return t.debug("got claims",n),n}}(this._settings,this._metadataService),this._tokenClient=new DD(this._settings,this._metadataService)}async validateSigninResponse(e,t){const r=this._logger.create("validateSigninResponse");this._processSigninState(e,t),r.debug("state processed"),await this._processCode(e,t),r.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,null==t?void 0:t.skipUserInfo,e.isOpenId),r.debug("claims processed")}async validateCredentialsResponse(e,t){const r=this._logger.create("validateCredentialsResponse");e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,t,e.isOpenId),r.debug("claims processed")}async validateRefreshResponse(e,t){const r=this._logger.create("validateRefreshResponse");e.userState=t.data,null!=e.session_state||(e.session_state=t.session_state),null!=e.scope||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),r.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);const n=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,n),r.debug("claims processed")}validateSignoutResponse(e,t){const r=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&r.throw(new Error("State does not match")),r.debug("state validated"),e.userState=t.data,e.error)throw r.warn("Response was error",e.error),new xD(e)}_processSigninState(e,t){const r=this._logger.create("_processSigninState");if(t.id!==e.state&&r.throw(new Error("State does not match")),t.client_id||r.throw(new Error("No client_id on state")),t.authority||r.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&r.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&r.throw(new Error("client_id mismatch on settings vs. signin state")),r.debug("state validated"),e.userState=t.data,null!=e.scope||(e.scope=t.scope),e.error)throw r.warn("Response was error",e.error),new xD(e);t.code_verifier&&!e.code&&r.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,r=!0){const n=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token)return void n.debug("not loading user info");n.debug("loading user info");const i=await this._userInfoService.getClaims(e.access_token);n.debug("user info claims received from user info endpoint"),r&&i.sub!==e.profile.sub&&n.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(i)),n.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t){const r=this._logger.create("_processCode");if(e.code){r.debug("Validating code");const n=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,...t.extraTokenParams});Object.assign(e,n)}else r.debug("No code to process")}_validateIdTokenAttributes(e,t){var r;const n=this._logger.create("_validateIdTokenAttributes");n.debug("decoding ID Token JWT");const i=SD.decode(null!=(r=e.id_token)?r:"");if(i.sub||n.throw(new Error("ID Token is missing a subject claim")),t){const e=SD.decode(t);i.sub!==e.sub&&n.throw(new Error("sub in id_token does not match current sub")),i.auth_time&&i.auth_time!==e.auth_time&&n.throw(new Error("auth_time in id_token does not match original auth_time")),i.azp&&i.azp!==e.azp&&n.throw(new Error("azp in id_token does not match original azp")),!i.azp&&e.azp&&n.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=i}}(this.settings,this.metadataService,this._claimsService),this._tokenClient=new DD(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:r,request_type:n,id_token_hint:i,login_hint:a,skipUserInfo:o,nonce:s,response_type:f=this.settings.response_type,scope:u=this.settings.scope,redirect_uri:c=this.settings.redirect_uri,prompt:d=this.settings.prompt,display:l=this.settings.display,max_age:p=this.settings.max_age,ui_locales:h=this.settings.ui_locales,acr_values:m=this.settings.acr_values,resource:b=this.settings.resource,response_mode:y=this.settings.response_mode,extraQueryParams:g=this.settings.extraQueryParams,extraTokenParams:v=this.settings.extraTokenParams}){const w=this._logger.create("createSigninRequest");if("code"!==f)throw new Error("Only the Authorization Code flow (with PKCE) is supported");const _=await this.metadataService.getAuthorizationEndpoint();w.debug("Received authorization endpoint",_);const E=new class{constructor({url:e,authority:t,client_id:r,redirect_uri:n,response_type:i,scope:a,state_data:o,response_mode:s,request_type:f,client_secret:u,nonce:c,resource:d,skipUserInfo:l,extraQueryParams:p,extraTokenParams:h,disablePKCE:m,...b}){if(this._logger=new ED("SigninRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");if(!r)throw this._logger.error("ctor: No client_id passed"),new Error("client_id");if(!n)throw this._logger.error("ctor: No redirect_uri passed"),new Error("redirect_uri");if(!i)throw this._logger.error("ctor: No response_type passed"),new Error("response_type");if(!a)throw this._logger.error("ctor: No scope passed"),new Error("scope");if(!t)throw this._logger.error("ctor: No authority passed"),new Error("authority");this.state=new LD({data:o,request_type:f,code_verifier:!m,client_id:r,authority:t,redirect_uri:n,response_mode:s,client_secret:u,scope:a,extraTokenParams:h,skipUserInfo:l});const y=new URL(e);y.searchParams.append("client_id",r),y.searchParams.append("redirect_uri",n),y.searchParams.append("response_type",i),y.searchParams.append("scope",a),c&&y.searchParams.append("nonce",c),y.searchParams.append("state",this.state.id),this.state.code_challenge&&(y.searchParams.append("code_challenge",this.state.code_challenge),y.searchParams.append("code_challenge_method","S256")),d&&(Array.isArray(d)?d:[d]).forEach((e=>y.searchParams.append("resource",e)));for(const[e,t]of Object.entries({response_mode:s,...b,...p}))null!=t&&y.searchParams.append(e,t.toString());this.url=y.href}}({url:_,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:c,response_type:f,scope:u,state_data:e,prompt:d,display:l,max_age:p,ui_locales:h,id_token_hint:i,login_hint:a,acr_values:m,resource:b,request:t,request_uri:r,extraQueryParams:g,extraTokenParams:v,request_type:n,response_mode:y,client_secret:this.settings.client_secret,skipUserInfo:o,nonce:s,disablePKCE:this.settings.disablePKCE});await this.clearStaleState();const T=E.state;return await this.settings.stateStore.set(T.id,T.toStorageString()),E}async readSigninResponseState(e,t=!1){const r=this._logger.create("readSigninResponseState"),n=new UD(RD.readParams(e,this.settings.response_mode));if(!n.state)throw r.throw(new Error("No state in response")),null;const i=await this.settings.stateStore[t?"remove":"get"](n.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:LD.fromStorageString(i),response:n}}async processSigninResponse(e){const t=this._logger.create("processSigninResponse"),{state:r,response:n}=await this.readSigninResponseState(e,!0);return t.debug("received state from storage; validating response"),await this._validator.validateSigninResponse(n,r),n}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r=!1,extraTokenParams:n={}}){const i=await this._tokenClient.exchangeCredentials({username:e,password:t,...n}),a=new UD(new URLSearchParams);return Object.assign(a,i),await this._validator.validateCredentialsResponse(a,r),a}async useRefreshToken({state:e,timeoutInSeconds:t}){var r;const n=this._logger.create("useRefreshToken");let i;if(void 0===this.settings.refreshTokenAllowedScope)i=e.scope;else{const t=this.settings.refreshTokenAllowedScope.split(" ");i=((null==(r=e.scope)?void 0:r.split(" "))||[]).filter((e=>t.includes(e))).join(" ")}const a=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:i,timeoutInSeconds:t}),o=new UD(new URLSearchParams);return Object.assign(o,a),n.debug("validating response",o),await this._validator.validateRefreshResponse(o,{...e,scope:i}),o}async createSignoutRequest({state:e,id_token_hint:t,request_type:r,post_logout_redirect_uri:n=this.settings.post_logout_redirect_uri,extraQueryParams:i=this.settings.extraQueryParams}={}){const a=this._logger.create("createSignoutRequest"),o=await this.metadataService.getEndSessionEndpoint();if(!o)throw a.throw(new Error("No end session endpoint")),null;a.debug("Received end session endpoint",o);const s=new class{constructor({url:e,state_data:t,id_token_hint:r,post_logout_redirect_uri:n,extraQueryParams:i,request_type:a}){if(this._logger=new ED("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");const o=new URL(e);r&&o.searchParams.append("id_token_hint",r),n&&(o.searchParams.append("post_logout_redirect_uri",n),t&&(this.state=new FD({data:t,request_type:a}),o.searchParams.append("state",this.state.id)));for(const[e,t]of Object.entries({...i}))null!=t&&o.searchParams.append(e,t.toString());this.url=o.href}}({url:o,id_token_hint:t,post_logout_redirect_uri:n,state_data:e,extraQueryParams:i,request_type:r});await this.clearStaleState();const f=s.state;return f&&(a.debug("Signout request has state to persist"),await this.settings.stateStore.set(f.id,f.toStorageString())),s}async readSignoutResponseState(e,t=!1){const r=this._logger.create("readSignoutResponseState"),n=new class{constructor(e){this.state=e.get("state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}}(RD.readParams(e,this.settings.response_mode));if(!n.state){if(r.debug("No state in response"),n.error)throw r.warn("Response was error:",n.error),new xD(n);return{state:void 0,response:n}}const i=await this.settings.stateStore[t?"remove":"get"](n.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:FD.fromStorageString(i),response:n}}async processSignoutResponse(e){const t=this._logger.create("processSignoutResponse"),{state:r,response:n}=await this.readSignoutResponseState(e,!0);return r?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(n,r)):t.debug("No state from storage; skipping response validation"),n}clearStaleState(){return this._logger.create("clearStaleState"),FD.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}}(e),this._redirectNavigator=new class{constructor(e){this._settings=e,this._logger=new ED("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var r;this._logger.create("prepare");let n=window.self;"top"===t&&(n=null!=(r=window.top)?r:window.self);const i=n.location[e].bind(n.location);let a;return{navigate:async e=>{this._logger.create("navigate");const t=new Promise(((e,t)=>{a=t}));return i(e.url),await t},close:()=>{this._logger.create("close"),null==a||a(new Error("Redirect aborted")),n.stop()}}}}(this.settings),this._popupNavigator=new class{constructor(e){this._settings=e,this._logger=new ED("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new QD({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,t=!1){this._logger.create("callback"),QD.notifyOpener(e,t)}}(this.settings),this._iframeNavigator=new class{constructor(e){this._settings=e,this._logger=new ED("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new YD({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),YD.notifyParent(e,this._settings.iframeNotifyParentOrigin)}}(this.settings),this._events=new ZD(this.settings),this._silentRenewService=new class{constructor(e){this._userManager=e,this._logger=new ED("SilentRenewService"),this._isStarted=!1,this._retryTimer=new OD("Retry Silent Renew"),this._tokenExpiring=async()=>{const e=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),e.debug("silent token renewal successful")}catch(t){if(t instanceof ID)return e.warn("ErrorTimeout from signinSilent:",t,"retry in 5s"),void this._retryTimer.init(5);e.error("Error from signinSilent:",t),this._userManager.events._raiseSilentRenewError(t)}}}async start(){const e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}}(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new class{constructor(e){this._userManager=e,this._logger=new ED("SessionMonitor"),this._start=async e=>{const t=e.session_state;if(!t)return;const r=this._logger.create("_start");if(e.profile?(this._sub=e.profile.sub,this._sid=e.profile.sid,r.debug("session_state",t,", sub",this._sub)):(this._sub=void 0,this._sid=void 0,r.debug("session_state",t,", anonymous user")),this._checkSessionIFrame)this._checkSessionIFrame.start(t);else try{const e=await this._userManager.metadataService.getCheckSessionIframe();if(e){r.debug("initializing check session iframe");const n=this._userManager.settings.client_id,i=this._userManager.settings.checkSessionIntervalInSeconds,a=this._userManager.settings.stopCheckSessionOnError,o=new class{constructor(e,t,r,n,i){this._callback=e,this._client_id=t,this._intervalInSeconds=n,this._stopOnError=i,this._logger=new ED("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=e=>{e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&("error"===e.data?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===e.data?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(e.data+" message from check session op iframe"))};const a=new URL(r);this._frame_origin=a.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=a.href}load(){return new Promise((e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)}))}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;const t=()=>{this._frame.contentWindow&&this._session_state&&this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,1e3*this._intervalInSeconds)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}}(this._callback,n,e,i,a);await o.load(),this._checkSessionIFrame=o,o.start(t)}else r.warn("no check session iframe found in the metadata")}catch(e){r.error("Error from getCheckSessionIframe:",e instanceof Error?e.message:e)}},this._stop=()=>{const e=this._logger.create("_stop");if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const t=setInterval((async()=>{clearInterval(t);try{const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}catch(t){e.error("error from querySessionStatus",t instanceof Error?t.message:t)}}),1e3)}},this._callback=async()=>{const e=this._logger.create("_callback");try{const t=await this._userManager.querySessionStatus();let r=!0;t&&this._checkSessionIFrame?t.sub===this._sub?(r=!1,this._checkSessionIFrame.start(t.session_state),t.sid===this._sid?e.debug("same sub still logged in at OP, restarting check session iframe; session_state",t.session_state):(e.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",t.session_state),this._userManager.events._raiseUserSessionChanged())):e.debug("different subject signed into OP",t.sub):e.debug("subject no longer signed into OP"),r?this._sub?this._userManager.events._raiseUserSignedOut():this._userManager.events._raiseUserSignedIn():e.debug("no change in session detected, no event to raise")}catch(t){this._sub&&(e.debug("Error calling queryCurrentSigninSession; raising signed out event",t),this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch((e=>{this._logger.error(e)}))}async _init(){this._logger.create("_init");const e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}}}(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(){const e=this._logger.create("getUser"),t=await this._loadUser();return t?(e.info("user loaded"),this._events.load(t,!1),t):(e.info("user not found in storage"),null)}async removeUser(){const e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),this._events.unload()}async signinRedirect(e={}){this._logger.create("signinRedirect");const{redirectMethod:t,...r}=e,n=await this._redirectNavigator.prepare({redirectMethod:t});await this._signinStart({request_type:"si:r",...r},n)}async signinRedirectCallback(e=window.location.href){const t=this._logger.create("signinRedirectCallback"),r=await this._signinEnd(e);return r.profile&&r.profile.sub?t.info("success, signed in subject",r.profile.sub):t.info("no subject"),r}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:r=!1}){const n=this._logger.create("signinResourceOwnerCredential"),i=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r,extraTokenParams:this.settings.extraTokenParams});n.debug("got signin response");const a=await this._buildUser(i);return a.profile&&a.profile.sub?n.info("success, signed in subject",a.profile.sub):n.info("no subject"),a}async signinPopup(e={}){const t=this._logger.create("signinPopup"),{popupWindowFeatures:r,popupWindowTarget:n,...i}=e,a=this.settings.popup_redirect_uri;a||t.throw(new Error("No popup_redirect_uri configured"));const o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:n}),s=await this._signin({request_type:"si:p",redirect_uri:a,display:"popup",...i},o);return s&&(s.profile&&s.profile.sub?t.info("success, signed in subject",s.profile.sub):t.info("no subject")),s}async signinPopupCallback(e=window.location.href,t=!1){const r=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,t),r.info("success")}async signinSilent(e={}){var t;const r=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:n,...i}=e;let a=await this._loadUser();if(null==a?void 0:a.refresh_token){r.debug("using refresh token");const e=new class{constructor(e){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.data=e.state}}(a);return await this._useRefreshToken(e)}const o=this.settings.silent_redirect_uri;let s;o||r.throw(new Error("No silent_redirect_uri configured")),a&&this.settings.validateSubOnSilentRenew&&(r.debug("subject prior to silent renew:",a.profile.sub),s=a.profile.sub);const f=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});return a=await this._signin({request_type:"si:s",redirect_uri:o,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==a?void 0:a.id_token:void 0,...i},f,s),a&&((null==(t=a.profile)?void 0:t.sub)?r.info("success, signed in subject",a.profile.sub):r.info("no subject")),a}async _useRefreshToken(e){const t=await this._client.useRefreshToken({state:e,timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds}),r=new zD({...e,...t});return await this.storeUser(r),this._events.load(r),r}async signinSilentCallback(e=window.location.href){const t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){const{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":return await this.signinPopupCallback(e);case"si:s":return await this.signinSilentCallback(e);default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){const{state:r}=await this._client.readSignoutResponseState(e);if(r)switch(r.request_type){case"so:r":await this.signoutRedirectCallback(e);break;case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){const t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:r,...n}=e,i=this.settings.silent_redirect_uri;i||t.throw(new Error("No silent_redirect_uri configured"));const a=await this._loadUser(),o=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r}),s=await this._signinStart({request_type:"si:s",redirect_uri:i,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==a?void 0:a.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...n},o);try{const e=await this._client.processSigninResponse(s.url);return t.debug("got signin response"),e.session_state&&e.profile.sub?(t.info("success for subject",e.profile.sub),{session_state:e.session_state,sub:e.profile.sub,sid:e.profile.sid}):(t.info("success, user not authenticated"),null)}catch(e){if(this.settings.monitorAnonymousSession&&e instanceof xD)switch(e.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:e.session_state}}throw e}}async _signin(e,t,r){const n=await this._signinStart(e,t);return await this._signinEnd(n.url,r)}async _signinStart(e,t){const r=this._logger.create("_signinStart");try{const n=await this._client.createSigninRequest(e);return r.debug("got signin request"),await t.navigate({url:n.url,state:n.state.id,response_mode:n.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(e){throw r.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signinEnd(e,t){const r=this._logger.create("_signinEnd"),n=await this._client.processSigninResponse(e);return r.debug("got signin response"),await this._buildUser(n,t)}async _buildUser(e,t){const r=this._logger.create("_buildUser"),n=new zD(e);if(t){if(t!==n.profile.sub)throw r.debug("current user does not match user returned from signin. sub from signin:",n.profile.sub),new xD({...e,error:"login_required"});r.debug("current user matches user returned from signin")}return await this.storeUser(n),r.debug("user stored"),this._events.load(n),n}async signoutRedirect(e={}){const t=this._logger.create("signoutRedirect"),{redirectMethod:r,...n}=e,i=await this._redirectNavigator.prepare({redirectMethod:r});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...n},i),t.info("success")}async signoutRedirectCallback(e=window.location.href){const t=this._logger.create("signoutRedirectCallback"),r=await this._signoutEnd(e);return t.info("success"),r}async signoutPopup(e={}){const t=this._logger.create("signoutPopup"),{popupWindowFeatures:r,popupWindowTarget:n,...i}=e,a=this.settings.popup_post_logout_redirect_uri,o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:n});await this._signout({request_type:"so:p",post_logout_redirect_uri:a,state:null==a?void 0:{},...i},o),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){const r=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,t),r.info("success")}async _signout(e,t){const r=await this._signoutStart(e,t);return await this._signoutEnd(r.url)}async _signoutStart(e={},t){var r;const n=this._logger.create("_signoutStart");try{const i=await this._loadUser();n.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(i);const a=e.id_token_hint||i&&i.id_token;a&&(n.debug("setting id_token_hint in signout request"),e.id_token_hint=a),await this.removeUser(),n.debug("user removed, creating signout request");const o=await this._client.createSignoutRequest(e);return n.debug("got signout request"),await t.navigate({url:o.url,state:null==(r=o.state)?void 0:r.id})}catch(e){throw n.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signoutEnd(e){const t=this._logger.create("_signoutEnd"),r=await this._client.processSignoutResponse(e);return t.debug("got signout response"),r}async signoutSilent(e={}){var t;const r=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:n,...i}=e,a=this.settings.includeIdTokenInSilentSignout?null==(t=await this._loadUser())?void 0:t.id_token:void 0,o=this.settings.popup_post_logout_redirect_uri,s=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});await this._signout({request_type:"so:s",post_logout_redirect_uri:o,id_token_hint:a,...i},s),r.info("success")}async signoutSilentCallback(e=window.location.href){const t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){const t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){const r=this._logger.create("_revokeInternal");if(!e)return;const n=t.filter((t=>"string"==typeof e[t]));if(n.length){for(const t of n)await this._client.revokeToken(e[t],t),r.info(`${t} revoked successfully`),"access_token"!==t&&(e[t]=null);await this.storeUser(e),r.debug("user stored"),this._events.load(e)}else r.debug("no need to revoke due to no token(s)")}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){const e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),zD.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){const t=this._logger.create("storeUser");if(e){t.debug("storing user");const r=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,r)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey)}async clearStaleState(){await this._client.clearStaleState()}}((({oidcConfiguration:e,authenticationDomain:t})=>{const r={authority:t,redirect_uri:e.redirectUri,popup_redirect_uri:e.redirectUri,client_id:e.clientId,metadata:{authorization_endpoint:`${t}/authorize`,token_endpoint:`${t}/oauth/token`,userinfo_endpoint:`${t}/userinfo`,end_session_endpoint:`${t}/v2/logout?returnTo=${encodeURIComponent(e.logoutRedirectUri)}&client_id=${e.clientId}`},mergeClaims:!0,loadUserInfo:!0,scope:e.scope};return e.audience&&(r.extraQueryParams={audience:e.audience}),r})(e)),this.deviceCredentialsManager=new Uz,this.logoutMode=e.oidcConfiguration.logoutMode||"redirect"}static mapOidcUserToDomainModel=e=>{const t=e.profile?.passport,r={expired:e.expired,idToken:e.id_token,accessToken:e.access_token,refreshToken:e.refresh_token,profile:{sub:e.profile.sub,email:e.profile.email,nickname:e.profile.nickname}};return t?.imx_eth_address&&(r.imx={ethAddress:t?.imx_eth_address,starkAddress:t?.imx_stark_address,userAdminAddress:t?.imx_user_admin_address}),t?.zkevm_eth_address&&(r.zkEvm={ethAddress:t?.zkevm_eth_address,userAdminAddress:t?.zkevm_user_admin_address}),r};static mapDeviceTokenResponseToDomainUserModel=e=>{const t=bD(e.id_token),r={idToken:e.id_token,accessToken:e.access_token,refreshToken:e.refresh_token,profile:{sub:t.sub,email:t.email,nickname:t.nickname}};return t?.passport?.imx_eth_address&&(r.imx={ethAddress:t?.passport?.imx_eth_address,starkAddress:t?.passport?.imx_stark_address,userAdminAddress:t?.passport?.imx_user_admin_address}),r};async login(){return Bz((async()=>{const e=await this.userManager.signinPopup({popupWindowFeatures:{width:410,height:450}});return zz.mapOidcUserToDomainModel(e)}),Pz.AUTHENTICATION_ERROR)}async loginCallback(){return Bz((async()=>this.userManager.signinPopupCallback()),Pz.AUTHENTICATION_ERROR)}async loginWithDeviceFlow(){return Bz((async()=>{const e=await Qr.post(`${this.config.authenticationDomain}/oauth/device/code`,{client_id:this.config.oidcConfiguration.clientId,scope:this.config.oidcConfiguration.scope,audience:this.config.oidcConfiguration.audience},jz);return{code:e.data.user_code,deviceCode:e.data.device_code,url:e.data.verification_uri_complete,interval:e.data.interval}}),Pz.AUTHENTICATION_ERROR)}async connectImxDeviceFlow(e,t,r){return Bz((async()=>{const n=Date.now();for(;;){if(null!=r&&Date.now()-n>r)throw new Error("Timed out");await qz(1e3*t);try{const t=await this.getDeviceFlowToken(e),r=zz.mapDeviceTokenResponseToDomainUserModel(t);return r.imx?.ethAddress&&r.imx?.starkAddress&&r.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(t),r}catch(e){if(!Qr.isAxiosError(e))throw e;{const t=e.response?.data;switch(t.error){case"authorization_pending":case"slow_down":break;case"expired_token":throw new Error("Token expired, please log in again");case"access_denied":throw new Error("User denied access");default:throw new Error("Error getting token")}}}}throw new Error("Failed to get credentials")}),Pz.AUTHENTICATION_ERROR)}async getDeviceFlowToken(e){return(await Qr.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e},jz)).data}static base64URLEncode(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static sha256(e){return(void 0)("sha256").update(e).digest()}getPKCEAuthorizationUrl(){const e=zz.base64URLEncode((void 0)(32)),t=zz.base64URLEncode(zz.sha256(e)),r=zz.base64URLEncode((void 0)(32));return this.deviceCredentialsManager.savePKCEData({state:r,verifier:e}),`${this.config.authenticationDomain}/authorize?response_type=code&code_challenge=${t}&code_challenge_method=S256&client_id=${this.config.oidcConfiguration.clientId}&redirect_uri=${this.config.oidcConfiguration.redirectUri}&scope=${this.config.oidcConfiguration.scope}&state=${r}&audience=${this.config.oidcConfiguration.audience}`}async connectImxPKCEFlow(e,t){return Bz((async()=>{const r=this.deviceCredentialsManager.getPKCEData();if(!r)throw new Error("No code verifier or state for PKCE");if(t!==r.state)throw new Error("Provided state does not match stored state");const n=await this.getPKCEToken(e,r.verifier),i=zz.mapDeviceTokenResponseToDomainUserModel(n);return i.imx?.ethAddress&&i.imx?.starkAddress&&i.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(n),i}),Pz.AUTHENTICATION_ERROR)}async getPKCEToken(e,t){return(await Qr.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"authorization_code",code_verifier:t,code:e,redirect_uri:this.config.oidcConfiguration.redirectUri},jz)).data}async connectImxWithCredentials(e){return Bz((async()=>{if(this.deviceCredentialsManager.areValid(e))return zz.mapDeviceTokenResponseToDomainUserModel(e);const t=e?.refresh_token??null;if(t){const e=await this.refreshToken(t);return zz.mapDeviceTokenResponseToDomainUserModel(e)}return null}),Pz.AUTHENTICATION_ERROR)}async refreshToken(e){return(await Qr.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"refresh_token",refresh_token:e},jz)).data}async logout(){return Bz((async()=>"silent"===this.logoutMode?this.userManager.signoutSilent():this.userManager.signoutRedirect()),Pz.LOGOUT_ERROR)}async logoutSilentCallback(e){return this.userManager.signoutSilentCallback(e)}async logoutDeviceFlow(){return Bz((async()=>{this.deviceCredentialsManager.clearCredentials()}),Pz.LOGOUT_ERROR)}async loginSilent(){return Bz((async()=>{if(!await this.getUser())return null;const e=await this.userManager.signinSilent();return e?zz.mapOidcUserToDomainModel(e):null}),Pz.SILENT_LOGIN_ERROR)}async getUser(){return Bz((async()=>{const e=await this.userManager.getUser();if(e)return zz.mapOidcUserToDomainModel(e);const t=this.deviceCredentialsManager.getCredentials();return t?zz.mapDeviceTokenResponseToDomainUserModel(t):null}),Pz.NOT_LOGGED_IN_ERROR)}async getUserDeviceFlow(){return Bz((async()=>{const e=this.deviceCredentialsManager.getCredentials();return e?zz.mapDeviceTokenResponseToDomainUserModel(e):null}),Pz.NOT_LOGGED_IN_ERROR)}checkStoredDeviceFlowCredentials(){return this.deviceCredentialsManager.getCredentials()}}class Hz{config;constructor(e){this.config=e}async login(e,t){return Bz((async()=>{const r=new tj(this.config.magicPublishableApiKey,{extensions:[new nj],network:t});return await r.openid.loginWithOIDC({jwt:e,providerId:this.config.magicProviderId}),r.rpcProvider}),Pz.WALLET_CONNECTION_ERROR)}}const Vz=1e3,Gz=3,Kz=async(e,t)=>{const{retries:r=Gz,interval:n=Vz,finalErr:i=Error("Retry failed"),finallyFn:a=(()=>{})}=t||{};try{return await e()}catch(t){return r<=0?Promise.reject(i):(await(o=n,new Promise((e=>{setTimeout((()=>e()),o)}))),Kz(e,{retries:r-1,finalErr:i,finallyFn:a}))}finally{r<=0&&a()}var o};var Wz,Xz;e.ProviderErrorCode=void 0,(Wz=e.ProviderErrorCode||(e.ProviderErrorCode={}))[Wz.USER_REJECTED_REQUEST=4001]="USER_REJECTED_REQUEST",Wz[Wz.UNAUTHORIZED=4100]="UNAUTHORIZED",Wz[Wz.UNSUPPORTED_METHOD=4200]="UNSUPPORTED_METHOD",Wz[Wz.DISCONNECTED=4900]="DISCONNECTED",e.RpcErrorCode=void 0,(Xz=e.RpcErrorCode||(e.RpcErrorCode={}))[Xz.RPC_SERVER_ERROR=-32e3]="RPC_SERVER_ERROR",Xz[Xz.INVALID_REQUEST=-32600]="INVALID_REQUEST",Xz[Xz.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",Xz[Xz.INVALID_PARAMS=-32602]="INVALID_PARAMS",Xz[Xz.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",Xz[Xz.PARSE_ERROR=-32700]="PARSE_ERROR",Xz[Xz.USER_REJECTED_REQUEST=-32003]="USER_REJECTED_REQUEST";class $z extends Error{message;code;constructor(e,t){super(t),this.message=t,this.code=e}}const Jz=e=>Qi.from(e).toString();class Yz{transactionAPI;confirmationScreen;imxEtherAddress;constructor({imxPublicApiDomain:e,accessToken:t,confirmationScreen:r,imxEtherAddress:n}){this.confirmationScreen=r,this.transactionAPI=new $q(new Jq({accessToken:t,basePath:e})),this.imxEtherAddress=n}loading(e){this.confirmationScreen.loading(e)}async validate({payloadHash:e}){if(!(await Kz((async()=>this.transactionAPI.getTransactionByID({transactionID:e,chainType:"starkex"})),{finallyFn:()=>{this.confirmationScreen.closeWindow()}})).data.id)throw new Error("Transaction doesn't exists");const t=await this.transactionAPI.evaluateTransaction({id:e,transactionEvaluationRequest:{chainType:"starkex"}}),{confirmationRequired:r}=t.data;if(r){if(!(await this.confirmationScreen.startGuardianTransaction(e,this.imxEtherAddress,Yq)).confirmed)throw new Error("Transaction rejected by user")}else this.confirmationScreen.closeWindow()}async evaluateEVMTransaction({chainId:t,nonce:r,user:n,metaTransactions:i}){const a={Authorization:`Bearer ${n.accessToken}`},o=(t=>{try{return t.map((e=>({delegateCall:!0===e.delegateCall,revertOnError:!0===e.revertOnError,gasLimit:e.gasLimit?Jz(e.gasLimit):"0",target:e.to??Uo,value:e.value?Jz(e.value):"0",data:e.data?e.data.toString():"0x00"})))}catch(t){const r=t instanceof Error?t.message:String(t);throw new $z(e.RpcErrorCode.INVALID_PARAMS,`Transaction failed to parsing: ${r}`)}})(i);try{return(await this.transactionAPI.evaluateTransaction({id:"evm",transactionEvaluationRequest:{chainType:"evm",chainId:t,transactionData:{nonce:r,userAddress:n.zkEvm.ethAddress,metaTransactions:o}}},{headers:a})).data}catch(t){const r=t instanceof Error?t.message:String(t);throw new $z(e.RpcErrorCode.INTERNAL_ERROR,`Transaction failed to validate with error: ${r}`)}}async validateEVMTransaction({chainId:t,nonce:r,user:n,metaTransactions:i}){const a=await this.evaluateEVMTransaction({chainId:t,nonce:r,user:n,metaTransactions:i}),{confirmationRequired:o,transactionId:s}=a;if(o&&s){if(!(await this.confirmationScreen.startGuardianTransaction(s,this.imxEtherAddress,Qq,t)).confirmed)throw new $z(e.RpcErrorCode.USER_REJECTED_REQUEST,"Transaction rejected by user ")}else this.confirmationScreen.closeWindow()}}const Qz="ERC721";const Zz="ERC721";class eH{user;starkSigner;immutableXClient;confirmationScreen;guardianClient;constructor({user:e,starkSigner:t,immutableXClient:r,imxPublicApiDomain:n,confirmationScreen:i}){this.user=e,this.starkSigner=t,this.immutableXClient=r,this.confirmationScreen=i,this.guardianClient=new Yz({imxPublicApiDomain:n,accessToken:e.accessToken,confirmationScreen:i,imxEtherAddress:e.imx.ethAddress})}async transfer(e){return async function({request:e,transfersApi:t,starkSigner:r,user:n,guardianClient:i}){return Bz((async()=>{i.loading();const a=e.type===Zz?"1":e.amount,o={sender:n.imx.ethAddress,token:tz(e),amount:a,receiver:e.receiver},s={Authorization:`Bearer ${n.accessToken}`},f=await t.getSignableTransferV1({getSignableTransferRequest:o},{headers:s});await i.validate({payloadHash:f.data.payload_hash});const u=f.data,{payload_hash:c}=u,d=await r.signMessage(c),l=await r.getAddress(),p={createTransferRequest:{sender_stark_key:u.sender_stark_key||l,sender_vault_id:u.sender_vault_id,receiver_stark_key:u.receiver_stark_key,receiver_vault_id:u.receiver_vault_id,asset_id:u.asset_id,amount:u.amount,nonce:u.nonce,expiration_timestamp:u.expiration_timestamp,stark_signature:d}},{data:h}=await t.createTransferV1(p,{headers:s});return{sent_signature:h.sent_signature,status:h.status?.toString(),time:h.time,transfer_id:h.transfer_id}}),Pz.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}registerOffchain(){throw new Mz("Operation not supported",Pz.OPERATION_NOT_SUPPORTED_ERROR)}isRegisteredOnchain(){throw new Mz("Operation not supported",Pz.OPERATION_NOT_SUPPORTED_ERROR)}createOrder(e){return async function({starkSigner:e,user:t,request:r,ordersApi:n,guardianClient:i}){return Bz((async()=>{i.loading();const{ethAddress:a}=t.imx,o=r.sell.type===Qz?"1":r.sell.amount,s=r.buy.type===Qz?"1":r.buy.amount,f={Authorization:`Bearer ${t.accessToken}`},u={user:a,amount_buy:s,token_buy:tz(r.buy),amount_sell:o,token_sell:tz(r.sell),fees:r.fees,split_fees:!0,expiration_timestamp:r.expiration_timestamp},c=await n.getSignableOrder({getSignableOrderRequestV3:u},{headers:f});await i.validate({payloadHash:c.data.payload_hash});const{payload_hash:d}=c.data,l=await e.signMessage(d),p=c.data,h={createOrderRequest:{include_fees:!0,fees:r.fees,stark_signature:l,amount_buy:p.amount_buy,amount_sell:p.amount_sell,asset_id_buy:p.asset_id_buy,asset_id_sell:p.asset_id_sell,expiration_timestamp:p.expiration_timestamp,nonce:p.nonce,stark_key:p.stark_key,vault_id_buy:p.vault_id_buy,vault_id_sell:p.vault_id_sell}};return{...(await n.createOrderV3(h,{headers:f})).data}}),Pz.CREATE_ORDER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}cancelOrder(e){return async function({user:e,starkSigner:t,request:r,ordersApi:n,guardianClient:i}){return Bz((async()=>{i.loading();const a={order_id:r.order_id},o={Authorization:`Bearer ${e.accessToken}`},s=await n.getSignableCancelOrderV3({getSignableCancelOrderRequest:a},{headers:o});await i.validate({payloadHash:s.data.payload_hash});const{payload_hash:f}=s.data,u=await t.signMessage(f),c=await n.cancelOrderV3({id:r.order_id.toString(),cancelOrderRequest:{order_id:r.order_id,stark_signature:u}},{headers:o});return{order_id:c.data.order_id,status:c.data.status}}),Pz.CANCEL_ORDER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}createTrade(e){return async function({request:e,tradesApi:t,user:r,starkSigner:n,guardianClient:i}){return Bz((async()=>{i.loading();const{ethAddress:a}=r.imx,o={expiration_timestamp:e.expiration_timestamp,fees:e.fees,order_id:e.order_id,user:a},s={Authorization:`Bearer ${r.accessToken}`},f=await t.getSignableTrade({getSignableTradeRequest:o},{headers:s});await i.validate({payloadHash:f.data.payload_hash});const{payload_hash:u}=f.data,c=await n.signMessage(u),{data:d}=f,l={createTradeRequest:{include_fees:!0,fees:e?.fees,stark_signature:c,order_id:e?.order_id,fee_info:d.fee_info,amount_buy:d.amount_buy,amount_sell:d.amount_sell,asset_id_buy:d.asset_id_buy,asset_id_sell:d.asset_id_sell,expiration_timestamp:d.expiration_timestamp,nonce:d.nonce,stark_key:d.stark_key,vault_id_buy:d.vault_id_buy,vault_id_sell:d.vault_id_sell}},{data:p}=await t.createTradeV3(l,{headers:s});return p}),Pz.CREATE_TRADE_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,tradesApi:this.immutableXClient.tradesApi,guardianClient:this.guardianClient})}batchNftTransfer(e){return async function({user:e,starkSigner:t,request:r,transfersApi:n,guardianClient:i}){return Bz((async()=>{i.loading({width:480,height:784});const{ethAddress:a}=e.imx,o={sender_ether_key:a,signable_requests:r.map((e=>({amount:"1",token:tz({type:Zz,tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver})))},s={Authorization:`Bearer ${e.accessToken}`},f=await n.getSignableTransfer({getSignableTransferRequestV2:o},{headers:s});await i.validate({payloadHash:f.data.signable_responses[0]?.payload_hash});const u=await Promise.all(f.data.signable_responses.map((async e=>{const r=await t.signMessage(e.payload_hash);return{sender_vault_id:e.sender_vault_id,receiver_stark_key:e.receiver_stark_key,receiver_vault_id:e.receiver_vault_id,asset_id:e.asset_id,amount:e.amount,nonce:e.nonce,expiration_timestamp:e.expiration_timestamp,stark_signature:r}}))),c={sender_stark_key:f.data.sender_stark_key,requests:u},d=await n.createTransfer({createTransferRequestV2:c},{headers:s});return{transfer_ids:d?.data.transfer_ids}}),Pz.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}exchangeTransfer(e){return async function({user:e,starkSigner:t,request:r,exchangesApi:n}){return Bz((async()=>{const{ethAddress:i}=e.imx,a=r.amount,o=await n.getExchangeSignableTransfer({id:r.transactionID,getSignableTransferRequest:{sender:i,token:tz(r),amount:a,receiver:r.receiver}}),s=await t.getAddress(),{payload_hash:f}=o.data,u=await t.signMessage(f),c={sender_stark_key:o.data.sender_stark_key||s,sender_vault_id:o.data.sender_vault_id,receiver_stark_key:o.data.receiver_stark_key,receiver_vault_id:o.data.receiver_vault_id,asset_id:o.data.asset_id,amount:o.data.amount,nonce:o.data.nonce,expiration_timestamp:o.data.expiration_timestamp,stark_signature:u},d={Authorization:`Bearer ${e.accessToken}`},l=await n.createExchangeTransfer({id:r.transactionID,createTransferRequest:c},{headers:d});return{sent_signature:l?.data.sent_signature,status:l?.data.status?.toString(),time:l?.data.time,transfer_id:l?.data.transfer_id}}),Pz.EXCHANGE_TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,exchangesApi:this.immutableXClient.exchangeApi})}deposit(e){throw new Mz("Operation not supported",Pz.OPERATION_NOT_SUPPORTED_ERROR)}prepareWithdrawal(e){throw new Mz("Operation not supported",Pz.OPERATION_NOT_SUPPORTED_ERROR)}completeWithdrawal(e,t){throw new Mz("Operation not supported",Pz.OPERATION_NOT_SUPPORTED_ERROR)}getAddress(){return Promise.resolve(this.user.imx.ethAddress)}}class tH{authManager;config;confirmationScreen;immutableXClient;magicAdapter;constructor({authManager:e,config:t,confirmationScreen:r,immutableXClient:n,magicAdapter:i}){this.authManager=e,this.config=t,this.confirmationScreen=r,this.immutableXClient=n,this.magicAdapter=i}async getProvider(){const e=await this.authManager.login();return this.createProviderInstance(e)}async getProviderSilent(){const e=await this.authManager.loginSilent();return e?this.createProviderInstance(e):null}async getProviderWithDeviceFlow(e,t,r){const n=await this.authManager.connectImxDeviceFlow(e,t,r);return this.createProviderInstance(n)}async getProviderWithPKCEFlow(e,t){const r=await this.authManager.connectImxPKCEFlow(e,t);return this.createProviderInstance(r)}async getProviderWithCredentials(e){const t=await this.authManager.connectImxWithCredentials(e);return t?this.createProviderInstance(t):null}async createProviderInstance(e){if(!e.idToken)throw new Mz("Failed to initialise",Pz.WALLET_CONNECTION_ERROR);const t=await this.magicAdapter.login(e.idToken,this.config.network),r=new fb(t).getSigner(),n=await(async e=>Bz((async()=>DC(await QB(e))),Pz.WALLET_CONNECTION_ERROR))(r);if(!e.imx?.ethAddress){const t=await this.registerStarkEx(r,n,e.accessToken);return new eH({user:t,starkSigner:n,immutableXClient:this.immutableXClient,imxPublicApiDomain:this.config.imxPublicApiDomain,confirmationScreen:this.confirmationScreen})}return new eH({user:e,starkSigner:n,immutableXClient:this.immutableXClient,imxPublicApiDomain:this.config.imxPublicApiDomain,confirmationScreen:this.confirmationScreen})}async registerStarkEx(e,t,r){return Bz((async()=>{await async function({ethSigner:e,starkSigner:t,usersApi:r},n){return Bz((async()=>{const i=await e.getAddress(),a=await t.getAddress(),o=await r.getSignableRegistrationOffchain({getSignableRegistrationRequest:{ether_key:i,stark_key:a}}),{signable_message:s,payload_hash:f}=o.data,u=await ez(s,e),c=await t.signMessage(f);return(await r.registerPassportUser({authorization:`Bearer ${n}`,registerPassportUserRequest:{eth_signature:u,ether_key:i,stark_signature:c,stark_key:a}})).statusText}),Pz.USER_REGISTRATION_ERROR)}({ethSigner:e,starkSigner:t,usersApi:this.immutableXClient.usersApi},r);return await Kz((async()=>{const e=await this.authManager.loginSilent();return!!e?.imx?e:Promise.reject(new Error("user wallet addresses not exist"))}))}),Pz.REFRESH_TOKEN_ERROR)}}var rH;e.Networks=void 0,(rH=e.Networks||(e.Networks={})).PRODUCTION="mainnet",rH.SANDBOX="goerli";const nH=(e,t,r)=>{const n=t.map((t=>!e[t]&&t)).filter((e=>e)).join(", ");if(""!==n){throw new Mz(r?`${r} - ${n} cannot be null`:`${n} cannot be null`,Pz.INVALID_CONFIGURATION)}};class iH{network;authenticationDomain;passportDomain;imxPublicApiDomain;magicPublishableApiKey;magicProviderId;oidcConfiguration;baseConfig;zkEvmChainId;zkEvmRpcUrl;relayerUrl;multiRollupConfig;constructor({baseConfig:t,overrides:r,...n}){if(nH(n,["clientId","logoutRedirectUri","redirectUri"]),this.oidcConfiguration=n,this.baseConfig=t,r)nH(r,["network","authenticationDomain","passportDomain","magicPublishableApiKey","magicProviderId","zkEvmRpcUrl","zkEvmChainId","relayerUrl","imxPublicApiDomain","indexerMrBasePath","orderBookMrBasePath","passportMrBasePath"],"overrides"),this.network=r.network,this.authenticationDomain=r.authenticationDomain,this.passportDomain=r.passportDomain,this.imxPublicApiDomain=r.imxPublicApiDomain,this.magicPublishableApiKey=r.magicPublishableApiKey,this.magicProviderId=r.magicProviderId,this.zkEvmRpcUrl=r.zkEvmRpcUrl,this.zkEvmChainId=r.zkEvmChainId,this.relayerUrl=r.relayerUrl,this.multiRollupConfig={indexer:gt({basePath:r.indexerMrBasePath}),orderBook:gt({basePath:r.orderBookMrBasePath}),passport:gt({basePath:r.passportMrBasePath})};else switch(t.environment){case e.Environment.PRODUCTION:this.network=e.Networks.PRODUCTION,this.authenticationDomain="https://auth.immutable.com",this.magicPublishableApiKey="pk_live_10F423798A540ED7",this.magicProviderId="fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=",this.passportDomain="https://passport.immutable.com",this.imxPublicApiDomain="https://api.immutable.com",this.zkEvmRpcUrl="",this.zkEvmChainId="",this.relayerUrl="https://api.immutable.com/relayer-mr",this.multiRollupConfig=vt();break;case e.Environment.SANDBOX:default:this.network=e.Networks.SANDBOX,this.authenticationDomain="https://auth.immutable.com",this.magicPublishableApiKey="pk_live_10F423798A540ED7",this.magicProviderId="fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=",this.passportDomain="https://passport.sandbox.immutable.com",this.imxPublicApiDomain="https://api.sandbox.immutable.com",this.zkEvmRpcUrl="https://zkevm-rpc.sandbox.x.immutable.com",this.zkEvmChainId="eip155:13392",this.relayerUrl="https://api.sandbox.immutable.com/relayer-mr",this.multiRollupConfig=wt()}}}var aH,oH,sH;!function(e){e.CONFIRMATION_WINDOW_READY="confirmation_window_ready",e.TRANSACTION_CONFIRMED="transaction_confirmed",e.TRANSACTION_ERROR="transaction_error"}(aH||(aH={})),function(e){e.TRANSACTION_START="transaction_start"}(oH||(oH={})),function(e){e.cancelOrder="delete:v1/orders",e.createOrder="post:v1/orders",e.createTrade="post:v1/trades",e.createTransfer="post:v1/transfers",e.createBatchTransfer="post:v2/transfers"}(sH||(sH={}));const fH="imx_passport_confirmation",uH=({url:e,title:t,width:r,height:n})=>{const i=Math.max(0,Math.round(window.screenX+(window.outerWidth-r)/2)),a=Math.max(0,Math.round(window.screenY+(window.outerHeight-n)/2)),o=window.open(e,t,`\n scrollbars=yes,\n width=${r}, \n height=${n}, \n top=${a}, \n left=${i}\n `);if(!o)throw new Error("Failed to open confirmation screen");return o.focus(),o},cH="Confirm this transaction";class dH{config;confirmationWindow;constructor(e){this.config=e}postMessage(e,t,r){e.postMessage({eventType:fH,accessToken:t,...r},this.config.passportDomain)}startTransaction(e,t,r){return new Promise(((n,i)=>{const a=({data:r,origin:a})=>{if(a===this.config.passportDomain&&r.eventType===fH)switch(r.messageType){case aH.CONFIRMATION_WINDOW_READY:this.postMessage(o,e,{messageType:oH.TRANSACTION_START,messageData:t});break;case aH.TRANSACTION_CONFIRMED:n({confirmed:!0});break;case aH.TRANSACTION_ERROR:i(new Error("Transaction error"));break;default:i(new Error("Unsupported message type"))}};window.addEventListener("message",a);const o=uH({url:`${this.config.passportDomain}/transaction-confirmation`,title:cH,width:r?.width||480,height:r?.height||380}),s=setInterval((()=>{o.closed&&(clearInterval(s),window.removeEventListener("message",a),n({confirmed:!1}))}),1e3)}))}startGuardianTransaction(e,t,r,n){return new Promise(((i,a)=>{const o=({data:e,origin:t})=>{if(t===this.config.passportDomain&&e.eventType===fH)switch(e.messageType){case aH.CONFIRMATION_WINDOW_READY:break;case aH.TRANSACTION_CONFIRMED:i({confirmed:!0});break;case aH.TRANSACTION_ERROR:a(new Error("Transaction error"));break;default:a(new Error("Unsupported message type"))}};if(window.addEventListener("message",o),!this.confirmationWindow)return void i({confirmed:!1});let s="";s=r===Yq?`${this.config.passportDomain}/transaction-confirmation/transaction.html?transactionId=${e}&imxEtherAddress=${t}&chainType=starkex`:`${this.config.passportDomain}/transaction-confirmation/zkevm?transactionId=${e}&imxEtherAddress=${t}&chainType=evm&chainId=${n}`,this.confirmationWindow.location.href=s;const f=setInterval((()=>{this.confirmationWindow?.closed&&(clearInterval(f),window.removeEventListener("message",o),i({confirmed:!1}))}),1e3)}))}loading(e){this.confirmationWindow=uH({url:`${this.config.passportDomain}/transaction-confirmation/loading.html`,title:cH,width:e?.width||480,height:e?.height||380})}closeWindow(){this.confirmationWindow?.close()}}var lH;!function(e){e.PENDING="PENDING",e.SUBMITTED="SUBMITTED",e.SUCCESSFUL="SUCCESSFUL",e.REVERTED="REVERTED",e.FAILED="FAILED"}(lH||(lH={})),e.ProviderEvent=void 0,(e.ProviderEvent||(e.ProviderEvent={})).ACCOUNTS_CHANGED="accountsChanged";class pH{emitter=new OE;emit(e,...t){this.emitter.emit(e,...t)}on(e,t){this.emitter.on(e,t)}removeListener(e,t){this.emitter.removeListener(e,t)}}class hH{config;constructor({config:e}){this.config=e}async postToRelayer(e){const t={id:1,jsonrpc:"2.0",...e},r=await fetch(`${this.config.relayerUrl}/v1/transactions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await r.json();if(n.error)throw n.error;return n}async ethSendTransaction(e,t){const r={method:"eth_sendTransaction",params:[{to:e,data:t,chainId:this.config.zkEvmChainId.toString()}]},{result:n}=await this.postToRelayer(r);return n}async imGetTransactionByHash(e){const t={method:"im_getTransactionByHash",params:[e]},{result:r}=await this.postToRelayer(t);return r}async imGetFeeOptions(e,t){const r={method:"im_getFeeOptions",params:[{userAddress:e,data:t,chainId:this.config.zkEvmChainId.toString()}]},{result:n}=await this.postToRelayer(r);return n}}const mH=async({authManager:t,config:r,magicAdapter:n,multiRollupApiClients:i})=>{const a=await t.getUser()||await t.login();if(!a.idToken)throw new Error("User is missing idToken");const o=await n.login(a.idToken,r.network);if(!a.zkEvm){const r=await async function({authManager:t,magicProvider:r,multiRollupApiClients:n,accessToken:i}){const a=new fb(r).getSigner(),o=await a.getAddress(),s=await ez("Only sign this message from Immutable Passport",a),f={Authorization:`Bearer ${i}`};try{await n.passportApi.createCounterfactualAddress({createCounterfactualAddressRequest:{ethereumAddress:o,ethereumSignature:s}},{headers:f})}catch(t){throw new $z(e.RpcErrorCode.INTERNAL_ERROR,`Failed to create counterfactual address: ${t}`)}const u=await t.loginSilent();if(!u?.zkEvm)throw new $z(e.RpcErrorCode.INTERNAL_ERROR,"Failed to refresh user details");return u}({authManager:t,magicProvider:o,multiRollupApiClients:i,accessToken:a.accessToken});return{user:r,magicProvider:o}}return{user:a,magicProvider:o}};const bH=async(e,t,r,n,i)=>{const a=e.map((e=>({delegateCall:!0===e.delegateCall,revertOnError:!0===e.revertOnError,gasLimit:e.gasLimit??qo,target:e.to??Uo,value:e.value??qo,data:e.data??[]})));const o=function(e,t){return ao(xs.encode(["uint256","tuple(\n bool delegateCall,\n bool revertOnError,\n uint256 gasLimit,\n address target,\n uint256 value,\n bytes data\n)[]"],[e,t]))}(t,a),s=Ii(ao(gb(["string","uint256","address","bytes32"],["",r,n,o]))),f=await i.signMessage(s),u=Nz({threshold:1,signers:[{weight:1,signature:`${f}02`}]}),c=new Df(rz.mainModule.abi);return c.encodeFunctionData(c.getFunction("execute"),[a,t,u])},yH=async({params:t,magicProvider:r,jsonRpcProvider:n,relayerClient:i,guardianClient:a,config:o,user:s})=>{a.loading({width:480,height:580});const f=t[0];if(!f.to)throw new $z(e.RpcErrorCode.INVALID_PARAMS,'eth_sendTransaction requires a "to" field');const u=(e=>{const t=e.split(":");if(2!==t.length)throw new Error("Invalid configuration, chain ID is not in CAIP-2 format");return Qi.from(t[1])})(o.zkEvmChainId),c=new fb(r).getSigner(),d=await(async(e,t)=>{const r=await e.send("eth_getCode",[t,"latest"]);if(r&&"0x"!==r)return new gl(t,rz.mainModule.abi,e).nonce();return 0})(n,s.zkEvm.ethAddress),l={to:f.to,data:f.data,nonce:d,value:f.value,revertOnError:!0},p=await bH([l],d,u,s.zkEvm.ethAddress,c),h=(await i.imGetFeeOptions(s.zkEvm.ethAddress,p)).find((e=>"IMX"===e.tokenSymbol));if(!h)throw new Error("Failed to retrieve fees for IMX token");const m={nonce:d,to:h.recipientAddress,value:h.tokenPrice,revertOnError:!0};await a.validateEVMTransaction({chainId:o.zkEvmChainId,nonce:Jz(d),user:s,metaTransactions:[l,m]});const b=await bH([l,m],d,u,s.zkEvm.ethAddress,c),y=await i.ethSendTransaction(s.zkEvm.ethAddress,b),g=await Kz((async()=>{const e=await i.imGetTransactionByHash(y);if(e.status===lH.PENDING)throw new Error;return e}),{retries:30,interval:1e3,finalErr:new $z(e.RpcErrorCode.RPC_SERVER_ERROR,"transaction hash not generated in time")});if(![lH.SUBMITTED,lH.SUCCESSFUL].includes(g.status))throw new $z(e.RpcErrorCode.RPC_SERVER_ERROR,`Transaction failed to submit with status ${g.status}`);return g.hash};class gH{authManager;config;confirmationScreen;magicAdapter;relayerClient;transactionAPI;multiRollupApiClients;jsonRpcProvider;eventEmitter;magicProvider;user;constructor({authManager:e,magicAdapter:t,config:r,confirmationScreen:n,multiRollupApiClients:i}){this.authManager=e,this.magicAdapter=t,this.config=r,this.confirmationScreen=n,this.relayerClient=new hH({config:r}),this.transactionAPI=new $q(new Jq({basePath:this.config.imxPublicApiDomain})),this.jsonRpcProvider=new om(this.config.zkEvmRpcUrl),this.multiRollupApiClients=i,this.eventEmitter=new pH}isLoggedIn(){return void 0!==this.magicProvider&&void 0!==this.user}async performRequest(t){switch(t.method){case"eth_requestAccounts":{if(this.isLoggedIn())return[this.user.zkEvm.ethAddress];const{magicProvider:t,user:r}=await mH({authManager:this.authManager,config:this.config,magicAdapter:this.magicAdapter,multiRollupApiClients:this.multiRollupApiClients});return this.user=r,this.magicProvider=t,this.eventEmitter.emit(e.ProviderEvent.ACCOUNTS_CHANGED,[this.user.zkEvm.ethAddress]),[this.user.zkEvm.ethAddress]}case"eth_sendTransaction":{if(!this.isLoggedIn())throw new $z(e.ProviderErrorCode.UNAUTHORIZED,"Unauthorised - call eth_requestAccounts first");const r=new Yz({imxPublicApiDomain:this.config.imxPublicApiDomain,accessToken:this.user.accessToken,confirmationScreen:this.confirmationScreen,imxEtherAddress:this.user?.imx?.ethAddress||""});return yH({params:t.params||[],magicProvider:this.magicProvider,guardianClient:r,jsonRpcProvider:this.jsonRpcProvider,config:this.config,relayerClient:this.relayerClient,user:this.user})}case"eth_accounts":return this.isLoggedIn()?[this.user.zkEvm.ethAddress]:[];case"eth_gasPrice":case"eth_getBalance":case"eth_getStorageAt":case"eth_estimateGas":case"eth_call":case"eth_blockNumber":case"eth_chainId":case"eth_getBlockByHash":case"eth_getBlockByNumber":case"eth_getTransactionByHash":case"eth_getTransactionReceipt":case"eth_getTransactionCount":return this.jsonRpcProvider.send(t.method,t.params||[]);default:throw new $z(e.ProviderErrorCode.UNSUPPORTED_METHOD,"Method not supported")}}async performJsonRpcRequest(t){const{id:r,jsonrpc:n}=t;try{return{id:r,jsonrpc:n,result:await this.performRequest(t)}}catch(t){let i;return i=t instanceof $z?t:t instanceof Error?new $z(e.RpcErrorCode.INTERNAL_ERROR,t.message):new $z(e.RpcErrorCode.INTERNAL_ERROR,"Internal error"),{id:r,jsonrpc:n,error:i}}}async request(t){try{return this.performRequest(t)}catch(t){if(t instanceof $z)throw t;if(t instanceof Error)throw new $z(e.RpcErrorCode.INTERNAL_ERROR,t.message);throw new $z(e.RpcErrorCode.INTERNAL_ERROR,"Internal error")}}sendAsync(e,t){if(!t)throw new Error("No callback provided");Array.isArray(e)?Promise.all(e.map(this.performJsonRpcRequest)).then((e=>{t(null,e)})).catch((e=>{t(e,[])})):this.performJsonRpcRequest(e).then((e=>{t(null,e)})).catch((e=>{t(e,null)}))}async send(t,r,n){if("string"==typeof t)return"function"==typeof r?this.sendAsync({method:t,params:[]},r):n?this.sendAsync({method:t,params:Array.isArray(r)?r:[]},n):this.request({method:t,params:Array.isArray(r)?r:[]});if("function"==typeof r)return this.sendAsync(t,r);if(!Array.isArray(t)&&"object"==typeof t)return this.performJsonRpcRequest(t);throw new $z(e.RpcErrorCode.INVALID_REQUEST,"Invalid request")}on(e,t){this.eventEmitter.on(e,t)}removeListener(e,t){this.eventEmitter.removeListener(e,t)}}var vH=sn("object"==typeof self?self.FormData:window.FormData),wH={},_H={},EH=fn(Sz),TH=fn(Mb),AH={},SH=fn(Ff),kH=fn(Oo),OH=fn(Ms),RH=fn(Al),xH=fn(Gi),IH=fn(Rf),CH=fn(ep),NH=fn(Fp),PH=fn(oo),MH=fn(Ti),BH=fn(Il),DH=fn(_b),FH=fn(op),LH=fn(Ra),UH=fn(bo),jH=fn(Ld),qH=fn(Es),zH=fn(rl),HH=fn(xb),VH=fn(Hp),GH=fn(sh);!function(e){var t=on&&on.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=on&&on.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=on&&on.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&t(n,e,i);return r(n,e),n};Object.defineProperty(e,"__esModule",{value:!0}),e.formatBytes32String=e.Utf8ErrorFuncs=e.toUtf8String=e.toUtf8CodePoints=e.toUtf8Bytes=e._toEscapedUtf8String=e.nameprep=e.hexDataSlice=e.hexDataLength=e.hexZeroPad=e.hexValue=e.hexStripZeros=e.hexConcat=e.isHexString=e.hexlify=e.base64=e.base58=e.TransactionDescription=e.LogDescription=e.Interface=e.SigningKey=e.HDNode=e.defaultPath=e.isBytesLike=e.isBytes=e.zeroPad=e.stripZeros=e.concat=e.arrayify=e.shallowCopy=e.resolveProperties=e.getStatic=e.defineReadOnly=e.deepCopy=e.checkProperties=e.poll=e.fetchJson=e._fetchData=e.RLP=e.Logger=e.checkResultErrors=e.FormatTypes=e.ParamType=e.FunctionFragment=e.EventFragment=e.ErrorFragment=e.ConstructorFragment=e.Fragment=e.defaultAbiCoder=e.AbiCoder=void 0,e.Indexed=e.Utf8ErrorReason=e.UnicodeNormalizationForm=e.SupportedAlgorithm=e.mnemonicToSeed=e.isValidMnemonic=e.entropyToMnemonic=e.mnemonicToEntropy=e.getAccountPath=e.verifyTypedData=e.verifyMessage=e.recoverPublicKey=e.computePublicKey=e.recoverAddress=e.computeAddress=e.getJsonWalletAddress=e.TransactionTypes=e.serializeTransaction=e.parseTransaction=e.accessListify=e.joinSignature=e.splitSignature=e.soliditySha256=e.solidityKeccak256=e.solidityPack=e.shuffled=e.randomBytes=e.sha512=e.sha256=e.ripemd160=e.keccak256=e.computeHmac=e.commify=e.parseUnits=e.formatUnits=e.parseEther=e.formatEther=e.isAddress=e.getCreate2Address=e.getContractAddress=e.getIcapAddress=e.getAddress=e._TypedDataEncoder=e.id=e.isValidName=e.namehash=e.hashMessage=e.dnsEncode=e.parseBytes32String=void 0;var i=SH;Object.defineProperty(e,"AbiCoder",{enumerable:!0,get:function(){return i.AbiCoder}}),Object.defineProperty(e,"checkResultErrors",{enumerable:!0,get:function(){return i.checkResultErrors}}),Object.defineProperty(e,"ConstructorFragment",{enumerable:!0,get:function(){return i.ConstructorFragment}}),Object.defineProperty(e,"defaultAbiCoder",{enumerable:!0,get:function(){return i.defaultAbiCoder}}),Object.defineProperty(e,"ErrorFragment",{enumerable:!0,get:function(){return i.ErrorFragment}}),Object.defineProperty(e,"EventFragment",{enumerable:!0,get:function(){return i.EventFragment}}),Object.defineProperty(e,"FormatTypes",{enumerable:!0,get:function(){return i.FormatTypes}}),Object.defineProperty(e,"Fragment",{enumerable:!0,get:function(){return i.Fragment}}),Object.defineProperty(e,"FunctionFragment",{enumerable:!0,get:function(){return i.FunctionFragment}}),Object.defineProperty(e,"Indexed",{enumerable:!0,get:function(){return i.Indexed}}),Object.defineProperty(e,"Interface",{enumerable:!0,get:function(){return i.Interface}}),Object.defineProperty(e,"LogDescription",{enumerable:!0,get:function(){return i.LogDescription}}),Object.defineProperty(e,"ParamType",{enumerable:!0,get:function(){return i.ParamType}}),Object.defineProperty(e,"TransactionDescription",{enumerable:!0,get:function(){return i.TransactionDescription}});var a=kH;Object.defineProperty(e,"getAddress",{enumerable:!0,get:function(){return a.getAddress}}),Object.defineProperty(e,"getCreate2Address",{enumerable:!0,get:function(){return a.getCreate2Address}}),Object.defineProperty(e,"getContractAddress",{enumerable:!0,get:function(){return a.getContractAddress}}),Object.defineProperty(e,"getIcapAddress",{enumerable:!0,get:function(){return a.getIcapAddress}}),Object.defineProperty(e,"isAddress",{enumerable:!0,get:function(){return a.isAddress}});var o=n(OH);e.base64=o;var s=RH;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return s.Base58}});var f=xH;Object.defineProperty(e,"arrayify",{enumerable:!0,get:function(){return f.arrayify}}),Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return f.concat}}),Object.defineProperty(e,"hexConcat",{enumerable:!0,get:function(){return f.hexConcat}}),Object.defineProperty(e,"hexDataSlice",{enumerable:!0,get:function(){return f.hexDataSlice}}),Object.defineProperty(e,"hexDataLength",{enumerable:!0,get:function(){return f.hexDataLength}}),Object.defineProperty(e,"hexlify",{enumerable:!0,get:function(){return f.hexlify}}),Object.defineProperty(e,"hexStripZeros",{enumerable:!0,get:function(){return f.hexStripZeros}}),Object.defineProperty(e,"hexValue",{enumerable:!0,get:function(){return f.hexValue}}),Object.defineProperty(e,"hexZeroPad",{enumerable:!0,get:function(){return f.hexZeroPad}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return f.isBytes}}),Object.defineProperty(e,"isBytesLike",{enumerable:!0,get:function(){return f.isBytesLike}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return f.isHexString}}),Object.defineProperty(e,"joinSignature",{enumerable:!0,get:function(){return f.joinSignature}}),Object.defineProperty(e,"zeroPad",{enumerable:!0,get:function(){return f.zeroPad}}),Object.defineProperty(e,"splitSignature",{enumerable:!0,get:function(){return f.splitSignature}}),Object.defineProperty(e,"stripZeros",{enumerable:!0,get:function(){return f.stripZeros}});var u=IH;Object.defineProperty(e,"_TypedDataEncoder",{enumerable:!0,get:function(){return u._TypedDataEncoder}}),Object.defineProperty(e,"dnsEncode",{enumerable:!0,get:function(){return u.dnsEncode}}),Object.defineProperty(e,"hashMessage",{enumerable:!0,get:function(){return u.hashMessage}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return u.id}}),Object.defineProperty(e,"isValidName",{enumerable:!0,get:function(){return u.isValidName}}),Object.defineProperty(e,"namehash",{enumerable:!0,get:function(){return u.namehash}});var c=CH;Object.defineProperty(e,"defaultPath",{enumerable:!0,get:function(){return c.defaultPath}}),Object.defineProperty(e,"entropyToMnemonic",{enumerable:!0,get:function(){return c.entropyToMnemonic}}),Object.defineProperty(e,"getAccountPath",{enumerable:!0,get:function(){return c.getAccountPath}}),Object.defineProperty(e,"HDNode",{enumerable:!0,get:function(){return c.HDNode}}),Object.defineProperty(e,"isValidMnemonic",{enumerable:!0,get:function(){return c.isValidMnemonic}}),Object.defineProperty(e,"mnemonicToEntropy",{enumerable:!0,get:function(){return c.mnemonicToEntropy}}),Object.defineProperty(e,"mnemonicToSeed",{enumerable:!0,get:function(){return c.mnemonicToSeed}});var d=NH;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return d.getJsonWalletAddress}});var l=PH;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return l.keccak256}});var p=MH;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return p.Logger}});var h=BH;Object.defineProperty(e,"computeHmac",{enumerable:!0,get:function(){return h.computeHmac}}),Object.defineProperty(e,"ripemd160",{enumerable:!0,get:function(){return h.ripemd160}}),Object.defineProperty(e,"sha256",{enumerable:!0,get:function(){return h.sha256}}),Object.defineProperty(e,"sha512",{enumerable:!0,get:function(){return h.sha512}});var m=DH;Object.defineProperty(e,"solidityKeccak256",{enumerable:!0,get:function(){return m.keccak256}}),Object.defineProperty(e,"solidityPack",{enumerable:!0,get:function(){return m.pack}}),Object.defineProperty(e,"soliditySha256",{enumerable:!0,get:function(){return m.sha256}});var b=FH;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return b.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return b.shuffled}});var y=LH;Object.defineProperty(e,"checkProperties",{enumerable:!0,get:function(){return y.checkProperties}}),Object.defineProperty(e,"deepCopy",{enumerable:!0,get:function(){return y.deepCopy}}),Object.defineProperty(e,"defineReadOnly",{enumerable:!0,get:function(){return y.defineReadOnly}}),Object.defineProperty(e,"getStatic",{enumerable:!0,get:function(){return y.getStatic}}),Object.defineProperty(e,"resolveProperties",{enumerable:!0,get:function(){return y.resolveProperties}}),Object.defineProperty(e,"shallowCopy",{enumerable:!0,get:function(){return y.shallowCopy}});var g=n(UH);e.RLP=g;var v=jH;Object.defineProperty(e,"computePublicKey",{enumerable:!0,get:function(){return v.computePublicKey}}),Object.defineProperty(e,"recoverPublicKey",{enumerable:!0,get:function(){return v.recoverPublicKey}}),Object.defineProperty(e,"SigningKey",{enumerable:!0,get:function(){return v.SigningKey}});var w=qH;Object.defineProperty(e,"formatBytes32String",{enumerable:!0,get:function(){return w.formatBytes32String}}),Object.defineProperty(e,"nameprep",{enumerable:!0,get:function(){return w.nameprep}}),Object.defineProperty(e,"parseBytes32String",{enumerable:!0,get:function(){return w.parseBytes32String}}),Object.defineProperty(e,"_toEscapedUtf8String",{enumerable:!0,get:function(){return w._toEscapedUtf8String}}),Object.defineProperty(e,"toUtf8Bytes",{enumerable:!0,get:function(){return w.toUtf8Bytes}}),Object.defineProperty(e,"toUtf8CodePoints",{enumerable:!0,get:function(){return w.toUtf8CodePoints}}),Object.defineProperty(e,"toUtf8String",{enumerable:!0,get:function(){return w.toUtf8String}}),Object.defineProperty(e,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return w.Utf8ErrorFuncs}});var _=zH;Object.defineProperty(e,"accessListify",{enumerable:!0,get:function(){return _.accessListify}}),Object.defineProperty(e,"computeAddress",{enumerable:!0,get:function(){return _.computeAddress}}),Object.defineProperty(e,"parseTransaction",{enumerable:!0,get:function(){return _.parse}}),Object.defineProperty(e,"recoverAddress",{enumerable:!0,get:function(){return _.recoverAddress}}),Object.defineProperty(e,"serializeTransaction",{enumerable:!0,get:function(){return _.serialize}}),Object.defineProperty(e,"TransactionTypes",{enumerable:!0,get:function(){return _.TransactionTypes}});var E=HH;Object.defineProperty(e,"commify",{enumerable:!0,get:function(){return E.commify}}),Object.defineProperty(e,"formatEther",{enumerable:!0,get:function(){return E.formatEther}}),Object.defineProperty(e,"parseEther",{enumerable:!0,get:function(){return E.parseEther}}),Object.defineProperty(e,"formatUnits",{enumerable:!0,get:function(){return E.formatUnits}}),Object.defineProperty(e,"parseUnits",{enumerable:!0,get:function(){return E.parseUnits}});var T=VH;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return T.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return T.verifyTypedData}});var A=GH;Object.defineProperty(e,"_fetchData",{enumerable:!0,get:function(){return A._fetchData}}),Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return A.fetchJson}}),Object.defineProperty(e,"poll",{enumerable:!0,get:function(){return A.poll}});var S=BH;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return S.SupportedAlgorithm}});var k=qH;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return k.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return k.Utf8ErrorReason}})}(AH);var KH={};Object.defineProperty(KH,"__esModule",{value:!0}),KH.DomainRegistryABI=void 0;KH.DomainRegistryABI=[{inputs:[{internalType:"string",name:"domain",type:"string"}],name:"DomainAlreadyRegistered",type:"error"},{inputs:[{internalType:"bytes4",name:"tag",type:"bytes4"},{internalType:"uint256",name:"maxIndex",type:"uint256"},{internalType:"uint256",name:"suppliedIndex",type:"uint256"}],name:"DomainIndexOutOfRange",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"domain",type:"string"},{indexed:!1,internalType:"bytes4",name:"tag",type:"bytes4"},{indexed:!1,internalType:"uint256",name:"index",type:"uint256"}],name:"DomainRegistered",type:"event"},{inputs:[{internalType:"bytes4",name:"tag",type:"bytes4"},{internalType:"uint256",name:"index",type:"uint256"}],name:"getDomain",outputs:[{internalType:"string",name:"domain",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"tag",type:"bytes4"}],name:"getDomains",outputs:[{internalType:"string[]",name:"domains",type:"string[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"tag",type:"bytes4"}],name:"getNumberOfDomains",outputs:[{internalType:"uint256",name:"totalDomains",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"domain",type:"string"}],name:"setDomain",outputs:[{internalType:"bytes4",name:"tag",type:"bytes4"}],stateMutability:"nonpayable",type:"function"}];var WH={};Object.defineProperty(WH,"__esModule",{value:!0}),WH.SeaportABIv14=void 0;WH.SeaportABIv14=[{inputs:[{internalType:"address",name:"conduitController",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"BadContractSignature",type:"error"},{inputs:[],name:"BadFraction",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"BadReturnValueFromERC20OnTransfer",type:"error"},{inputs:[{internalType:"uint8",name:"v",type:"uint8"}],name:"BadSignatureV",type:"error"},{inputs:[],name:"CannotCancelOrder",type:"error"},{inputs:[],name:"ConsiderationCriteriaResolverOutOfRange",type:"error"},{inputs:[],name:"ConsiderationLengthNotEqualToTotalOriginal",type:"error"},{inputs:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"considerationIndex",type:"uint256"},{internalType:"uint256",name:"shortfallAmount",type:"uint256"}],name:"ConsiderationNotMet",type:"error"},{inputs:[],name:"CriteriaNotEnabledForItem",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"identifiers",type:"uint256[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"}],name:"ERC1155BatchTransferGenericFailure",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"EtherTransferGenericFailure",type:"error"},{inputs:[],name:"InexactFraction",type:"error"},{inputs:[],name:"InsufficientEtherSupplied",type:"error"},{inputs:[],name:"Invalid1155BatchTransferEncoding",type:"error"},{inputs:[],name:"InvalidBasicOrderParameterEncoding",type:"error"},{inputs:[{internalType:"address",name:"conduit",type:"address"}],name:"InvalidCallToConduit",type:"error"},{inputs:[{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"address",name:"conduit",type:"address"}],name:"InvalidConduit",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"InvalidContractOrder",type:"error"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"InvalidERC721TransferAmount",type:"error"},{inputs:[],name:"InvalidFulfillmentComponentData",type:"error"},{inputs:[{internalType:"uint256",name:"value",type:"uint256"}],name:"InvalidMsgValue",type:"error"},{inputs:[],name:"InvalidNativeOfferItem",type:"error"},{inputs:[],name:"InvalidProof",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"InvalidRestrictedOrder",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[],name:"InvalidSigner",type:"error"},{inputs:[{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"}],name:"InvalidTime",type:"error"},{inputs:[{internalType:"uint256",name:"fulfillmentIndex",type:"uint256"}],name:"MismatchedFulfillmentOfferAndConsiderationComponents",type:"error"},{inputs:[{internalType:"enum Side",name:"side",type:"uint8"}],name:"MissingFulfillmentComponentOnAggregation",type:"error"},{inputs:[],name:"MissingItemAmount",type:"error"},{inputs:[],name:"MissingOriginalConsiderationItems",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"NoContract",type:"error"},{inputs:[],name:"NoReentrantCalls",type:"error"},{inputs:[],name:"NoSpecifiedOrdersAvailable",type:"error"},{inputs:[],name:"OfferAndConsiderationRequiredOnFulfillment",type:"error"},{inputs:[],name:"OfferCriteriaResolverOutOfRange",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"OrderAlreadyFilled",type:"error"},{inputs:[{internalType:"enum Side",name:"side",type:"uint8"}],name:"OrderCriteriaResolverOutOfRange",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"OrderIsCancelled",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"OrderPartiallyFilled",type:"error"},{inputs:[],name:"PartialFillsNotEnabledForOrder",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"TokenTransferGenericFailure",type:"error"},{inputs:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"considerationIndex",type:"uint256"}],name:"UnresolvedConsiderationCriteria",type:"error"},{inputs:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"offerIndex",type:"uint256"}],name:"UnresolvedOfferCriteria",type:"error"},{inputs:[],name:"UnusedItemParameters",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"newCounter",type:"uint256"},{indexed:!0,internalType:"address",name:"offerer",type:"address"}],name:"CounterIncremented",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"orderHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"offerer",type:"address"},{indexed:!0,internalType:"address",name:"zone",type:"address"}],name:"OrderCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"orderHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"offerer",type:"address"},{indexed:!0,internalType:"address",name:"zone",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"}],indexed:!1,internalType:"struct SpentItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],indexed:!1,internalType:"struct ReceivedItem[]",name:"consideration",type:"tuple[]"}],name:"OrderFulfilled",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"orderHash",type:"bytes32"},{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],indexed:!1,internalType:"struct OrderParameters",name:"orderParameters",type:"tuple"}],name:"OrderValidated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32[]",name:"orderHashes",type:"bytes32[]"}],name:"OrdersMatched",type:"event"},{inputs:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"counter",type:"uint256"}],internalType:"struct OrderComponents[]",name:"orders",type:"tuple[]"}],name:"cancel",outputs:[{internalType:"bool",name:"cancelled",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"uint120",name:"numerator",type:"uint120"},{internalType:"uint120",name:"denominator",type:"uint120"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"bytes",name:"extraData",type:"bytes"}],internalType:"struct AdvancedOrder",name:"advancedOrder",type:"tuple"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"enum Side",name:"side",type:"uint8"},{internalType:"uint256",name:"index",type:"uint256"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"bytes32[]",name:"criteriaProof",type:"bytes32[]"}],internalType:"struct CriteriaResolver[]",name:"criteriaResolvers",type:"tuple[]"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"},{internalType:"address",name:"recipient",type:"address"}],name:"fulfillAdvancedOrder",outputs:[{internalType:"bool",name:"fulfilled",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"uint120",name:"numerator",type:"uint120"},{internalType:"uint120",name:"denominator",type:"uint120"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"bytes",name:"extraData",type:"bytes"}],internalType:"struct AdvancedOrder[]",name:"advancedOrders",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"enum Side",name:"side",type:"uint8"},{internalType:"uint256",name:"index",type:"uint256"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"bytes32[]",name:"criteriaProof",type:"bytes32[]"}],internalType:"struct CriteriaResolver[]",name:"criteriaResolvers",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[][]",name:"offerFulfillments",type:"tuple[][]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[][]",name:"considerationFulfillments",type:"tuple[][]"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"maximumFulfilled",type:"uint256"}],name:"fulfillAvailableAdvancedOrders",outputs:[{internalType:"bool[]",name:"availableOrders",type:"bool[]"},{components:[{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ReceivedItem",name:"item",type:"tuple"},{internalType:"address",name:"offerer",type:"address"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"}],internalType:"struct Execution[]",name:"executions",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct Order[]",name:"orders",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[][]",name:"offerFulfillments",type:"tuple[][]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[][]",name:"considerationFulfillments",type:"tuple[][]"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"},{internalType:"uint256",name:"maximumFulfilled",type:"uint256"}],name:"fulfillAvailableOrders",outputs:[{internalType:"bool[]",name:"availableOrders",type:"bool[]"},{components:[{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ReceivedItem",name:"item",type:"tuple"},{internalType:"address",name:"offerer",type:"address"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"}],internalType:"struct Execution[]",name:"executions",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"considerationToken",type:"address"},{internalType:"uint256",name:"considerationIdentifier",type:"uint256"},{internalType:"uint256",name:"considerationAmount",type:"uint256"},{internalType:"address payable",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{internalType:"address",name:"offerToken",type:"address"},{internalType:"uint256",name:"offerIdentifier",type:"uint256"},{internalType:"uint256",name:"offerAmount",type:"uint256"},{internalType:"enum BasicOrderType",name:"basicOrderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"offererConduitKey",type:"bytes32"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalAdditionalRecipients",type:"uint256"},{components:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct AdditionalRecipient[]",name:"additionalRecipients",type:"tuple[]"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct BasicOrderParameters",name:"parameters",type:"tuple"}],name:"fulfillBasicOrder",outputs:[{internalType:"bool",name:"fulfilled",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct Order",name:"order",type:"tuple"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"}],name:"fulfillOrder",outputs:[{internalType:"bool",name:"fulfilled",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"contractOfferer",type:"address"}],name:"getContractOffererNonce",outputs:[{internalType:"uint256",name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"offerer",type:"address"}],name:"getCounter",outputs:[{internalType:"uint256",name:"counter",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"counter",type:"uint256"}],internalType:"struct OrderComponents",name:"order",type:"tuple"}],name:"getOrderHash",outputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"getOrderStatus",outputs:[{internalType:"bool",name:"isValidated",type:"bool"},{internalType:"bool",name:"isCancelled",type:"bool"},{internalType:"uint256",name:"totalFilled",type:"uint256"},{internalType:"uint256",name:"totalSize",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"incrementCounter",outputs:[{internalType:"uint256",name:"newCounter",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"information",outputs:[{internalType:"string",name:"version",type:"string"},{internalType:"bytes32",name:"domainSeparator",type:"bytes32"},{internalType:"address",name:"conduitController",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"uint120",name:"numerator",type:"uint120"},{internalType:"uint120",name:"denominator",type:"uint120"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"bytes",name:"extraData",type:"bytes"}],internalType:"struct AdvancedOrder[]",name:"orders",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"enum Side",name:"side",type:"uint8"},{internalType:"uint256",name:"index",type:"uint256"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"bytes32[]",name:"criteriaProof",type:"bytes32[]"}],internalType:"struct CriteriaResolver[]",name:"criteriaResolvers",type:"tuple[]"},{components:[{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[]",name:"offerComponents",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[]",name:"considerationComponents",type:"tuple[]"}],internalType:"struct Fulfillment[]",name:"fulfillments",type:"tuple[]"},{internalType:"address",name:"recipient",type:"address"}],name:"matchAdvancedOrders",outputs:[{components:[{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ReceivedItem",name:"item",type:"tuple"},{internalType:"address",name:"offerer",type:"address"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"}],internalType:"struct Execution[]",name:"executions",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct Order[]",name:"orders",type:"tuple[]"},{components:[{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[]",name:"offerComponents",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[]",name:"considerationComponents",type:"tuple[]"}],internalType:"struct Fulfillment[]",name:"fulfillments",type:"tuple[]"}],name:"matchOrders",outputs:[{components:[{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ReceivedItem",name:"item",type:"tuple"},{internalType:"address",name:"offerer",type:"address"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"}],internalType:"struct Execution[]",name:"executions",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"contractName",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct Order[]",name:"orders",type:"tuple[]"}],name:"validate",outputs:[{internalType:"bool",name:"validated",type:"bool"}],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}];var XH={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DOMAIN_REGISTRY_ADDRESS=e.CROSS_CHAIN_SEAPORT_V1_5_ADDRESS=e.CROSS_CHAIN_SEAPORT_V1_4_ADDRESS=e.KNOWN_CONDUIT_KEYS_TO_CONDUIT=e.NO_CONDUIT=e.ONE_HUNDRED_PERCENT_BP=e.MAX_INT=e.BasicOrderRouteType=e.Side=e.ItemType=e.OrderType=e.EIP_712_BULK_ORDER_TYPE=e.EIP_712_ORDER_TYPE=e.OPENSEA_CONDUIT_ADDRESS=e.OPENSEA_CONDUIT_KEY=e.SEAPORT_CONTRACT_VERSION_V1_5=e.SEAPORT_CONTRACT_VERSION_V1_4=e.SEAPORT_CONTRACT_NAME=void 0;const t=TH;var r,n,i,a;e.SEAPORT_CONTRACT_NAME="Seaport",e.SEAPORT_CONTRACT_VERSION_V1_4="1.4",e.SEAPORT_CONTRACT_VERSION_V1_5="1.5",e.OPENSEA_CONDUIT_KEY="0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000",e.OPENSEA_CONDUIT_ADDRESS="0x1e0049783f008a0085193e00003d00cd54003c71",e.EIP_712_ORDER_TYPE={OrderComponents:[{name:"offerer",type:"address"},{name:"zone",type:"address"},{name:"offer",type:"OfferItem[]"},{name:"consideration",type:"ConsiderationItem[]"},{name:"orderType",type:"uint8"},{name:"startTime",type:"uint256"},{name:"endTime",type:"uint256"},{name:"zoneHash",type:"bytes32"},{name:"salt",type:"uint256"},{name:"conduitKey",type:"bytes32"},{name:"counter",type:"uint256"}],OfferItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"}],ConsiderationItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"},{name:"recipient",type:"address"}]},e.EIP_712_BULK_ORDER_TYPE={BulkOrder:[{name:"tree",type:"OrderComponents[2][2][2][2][2][2][2]"}],OrderComponents:[{name:"offerer",type:"address"},{name:"zone",type:"address"},{name:"offer",type:"OfferItem[]"},{name:"consideration",type:"ConsiderationItem[]"},{name:"orderType",type:"uint8"},{name:"startTime",type:"uint256"},{name:"endTime",type:"uint256"},{name:"zoneHash",type:"bytes32"},{name:"salt",type:"uint256"},{name:"conduitKey",type:"bytes32"},{name:"counter",type:"uint256"}],OfferItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"}],ConsiderationItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"},{name:"recipient",type:"address"}]},function(e){e[e.FULL_OPEN=0]="FULL_OPEN",e[e.PARTIAL_OPEN=1]="PARTIAL_OPEN",e[e.FULL_RESTRICTED=2]="FULL_RESTRICTED",e[e.PARTIAL_RESTRICTED=3]="PARTIAL_RESTRICTED"}(r||(e.OrderType=r={})),function(e){e[e.NATIVE=0]="NATIVE",e[e.ERC20=1]="ERC20",e[e.ERC721=2]="ERC721",e[e.ERC1155=3]="ERC1155",e[e.ERC721_WITH_CRITERIA=4]="ERC721_WITH_CRITERIA",e[e.ERC1155_WITH_CRITERIA=5]="ERC1155_WITH_CRITERIA"}(n||(e.ItemType=n={})),function(e){e[e.OFFER=0]="OFFER",e[e.CONSIDERATION=1]="CONSIDERATION"}(i||(e.Side=i={})),function(e){e[e.ETH_TO_ERC721=0]="ETH_TO_ERC721",e[e.ETH_TO_ERC1155=1]="ETH_TO_ERC1155",e[e.ERC20_TO_ERC721=2]="ERC20_TO_ERC721",e[e.ERC20_TO_ERC1155=3]="ERC20_TO_ERC1155",e[e.ERC721_TO_ERC20=4]="ERC721_TO_ERC20",e[e.ERC1155_TO_ERC20=5]="ERC1155_TO_ERC20"}(a||(e.BasicOrderRouteType=a={})),e.MAX_INT=t.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e.ONE_HUNDRED_PERCENT_BP=1e4,e.NO_CONDUIT="0x0000000000000000000000000000000000000000000000000000000000000000",e.KNOWN_CONDUIT_KEYS_TO_CONDUIT={[e.OPENSEA_CONDUIT_KEY]:e.OPENSEA_CONDUIT_ADDRESS},e.CROSS_CHAIN_SEAPORT_V1_4_ADDRESS="0x00000000000001ad428e4906aE43D8F9852d0dD6",e.CROSS_CHAIN_SEAPORT_V1_5_ADDRESS="0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC",e.DOMAIN_REGISTRY_ADDRESS="0x000000000DaD0DE04D2B2D4a5A74581EBA94124A"}(XH);var $H={},JH={};Object.defineProperty(JH,"__esModule",{value:!0}),JH.ERC20ABI=void 0;JH.ERC20ABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];var YH={};Object.defineProperty(YH,"__esModule",{value:!0}),YH.ERC721ABI=void 0;YH.ERC721ABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"pure",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}];var QH,ZH={},eV={};function tV(){if(QH)return eV;QH=1,Object.defineProperty(eV,"__esModule",{value:!0}),eV.getItemToCriteriaMap=eV.generateCriteriaResolvers=void 0;const e=XH,t=iV();eV.generateCriteriaResolvers=({orders:r,offerCriterias:n=[[]],considerationCriterias:i=[[]]})=>{const a=r.flatMap(((r,n)=>r.parameters.offer.map(((t,r)=>({orderIndex:n,item:t,index:r,side:e.Side.OFFER}))).filter((({item:e})=>(0,t.isCriteriaItem)(e.itemType))))),o=r.flatMap(((r,n)=>r.parameters.consideration.map(((t,r)=>({orderIndex:n,item:t,index:r,side:e.Side.CONSIDERATION}))).filter((({item:e})=>(0,t.isCriteriaItem)(e.itemType))))),s=(e,t)=>e.map((({orderIndex:e,item:r,index:n,side:i})=>{const a=r.identifierOrCriteria||"0",o=t[e][n];return{orderIndex:e,index:n,side:i,identifier:o.identifier,criteriaProof:"0"===a?[]:o.proof}}));return[...s(a,n),...s(o,i)]};return eV.getItemToCriteriaMap=(e,r)=>{const n=[...r];return e.reduce(((e,r)=>((0,t.isCriteriaItem)(r.itemType)&&e.set(r,n.shift()),e)),new Map)},eV}var rV,nV={};function iV(){return rV||(rV=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMaximumSizeForOrder=e.getSummedTokenAndIdentifierAmounts=e.getPresentItemAmount=e.isCriteriaItem=e.isErc1155Item=e.isErc721Item=e.isErc20Item=e.isNativeCurrencyItem=e.isCurrencyItem=void 0;const t=TH,r=XH,n=tV(),i=nV;e.isCurrencyItem=({itemType:e})=>[r.ItemType.NATIVE,r.ItemType.ERC20].includes(e);e.isNativeCurrencyItem=({itemType:e})=>e===r.ItemType.NATIVE;e.isErc20Item=e=>e===r.ItemType.ERC20;e.isErc721Item=e=>[r.ItemType.ERC721,r.ItemType.ERC721_WITH_CRITERIA].includes(e);e.isErc1155Item=e=>[r.ItemType.ERC1155,r.ItemType.ERC1155_WITH_CRITERIA].includes(e);e.isCriteriaItem=e=>[r.ItemType.ERC721_WITH_CRITERIA,r.ItemType.ERC1155_WITH_CRITERIA].includes(e);e.getPresentItemAmount=({startAmount:e,endAmount:r,timeBasedItemParams:n})=>{const i=t.BigNumber.from(e),a=t.BigNumber.from(r);if(!n)return i.gt(a)?i:a;const{isConsiderationItem:o,currentBlockTimestamp:s,ascendingAmountTimestampBuffer:f,startTime:u,endTime:c}=n,d=t.BigNumber.from(c).sub(u),l=a.gt(e),p=t.BigNumber.from(l?s+f:s);if(p.lt(u))return i;const h=(p.gt(c)?t.BigNumber.from(c):p).sub(u),m=d.sub(h);return i.mul(m).add(a.mul(h)).add(o?d.sub(1):0).div(d)};e.getSummedTokenAndIdentifierAmounts=({items:r,criterias:i,timeBasedItemParams:a})=>{const o=(0,n.getItemToCriteriaMap)(r,i),s=r.reduce(((r,n)=>{var i,s,f,u;const c=null!==(s=null===(i=o.get(n))||void 0===i?void 0:i.identifier)&&void 0!==s?s:n.identifierOrCriteria;return Object.assign(Object.assign({},r),{[n.token]:Object.assign(Object.assign({},r[n.token]),{[c]:(null!==(u=null===(f=r[n.token])||void 0===f?void 0:f[c])&&void 0!==u?u:t.BigNumber.from(0)).add((0,e.getPresentItemAmount)({startAmount:n.startAmount,endAmount:n.endAmount,timeBasedItemParams:a}))})})}),{});return s};e.getMaximumSizeForOrder=({parameters:{offer:e,consideration:t}})=>{const r=[...e,...t].flatMap((({startAmount:e,endAmount:t})=>[e,t]));return(0,i.findGcd)(r)}}(ZH)),ZH}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.findGcd=e.gcd=void 0;const t=TH;e.gcd=(r,n)=>{const i=t.BigNumber.from(r),a=t.BigNumber.from(n);return i.eq(0)?a:(0,e.gcd)(a.mod(r),i)};e.findGcd=r=>{let n=t.BigNumber.from(r[0]);for(let t=1;t<r.length;t++)if(n=(0,e.gcd)(r[t],n),n.eq(1))return n;return n}}(nV);var aV={};!function(e){var t=on&&on.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{f(n.next(e))}catch(e){a(e)}}function s(e){try{f(n.throw(e))}catch(e){a(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}f((n=n.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getTagFromDomain=e.getTransactionMethods=e.executeAllActions=void 0;const r=AH;e.executeAllActions=e=>t(void 0,void 0,void 0,(function*(){for(let t=0;t<e.length-1;t++){const r=e[t];if("approval"===r.type){const e=yield r.transactionMethods.transact();yield e.wait()}}const t=e[e.length-1];switch(t.type){case"create":return t.createOrder();case"createBulk":return t.createBulkOrders();default:return t.transactionMethods.transact()}}));e.getTransactionMethods=(r,n,i,a)=>{const o=i[i.length-1];let s;(e=>{const t=["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","type","accessList","customData","ccipReadEnabled","value","blockTag","CallOverrides"];return void 0===e||Object.keys(e).every((e=>t.includes(e)))})(o)&&(s=o,i.pop());const f=o=>t(void 0,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},s),o),f=yield r.populateTransaction[n](...i,t);if(a){const t=(0,e.getTagFromDomain)(a);f.data=f.data+t}return f}));return{callStatic:e=>{const t=Object.assign(Object.assign({},s),e);return r.callStatic[n](...i,t)},estimateGas:e=>{const t=Object.assign(Object.assign({},s),e);return r.estimateGas[n](...i,t)},transact:e=>t(void 0,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},s),e),n=yield f(t);return r.signer.sendTransaction(n)})),buildTransaction:f}};e.getTagFromDomain=e=>(0,r.keccak256)((0,r.toUtf8Bytes)(e)).slice(2,10)}(aV);var oV=on&&on.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{f(n.next(e))}catch(e){a(e)}}function s(e){try{f(n.throw(e))}catch(e){a(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}f((n=n.apply(e,t||[])).next())}))};Object.defineProperty($H,"__esModule",{value:!0}),$H.getApprovalActions=$H.approvedItemAmount=void 0;const sV=TH,fV=JH,uV=YH,cV=XH,dV=iV(),lV=aV;$H.approvedItemAmount=(e,t,r,n)=>oV(void 0,void 0,void 0,(function*(){if((0,dV.isErc721Item)(t.itemType)||(0,dV.isErc1155Item)(t.itemType)){return new sV.Contract(t.token,uV.ERC721ABI,n).isApprovedForAll(e,r).then((e=>e?cV.MAX_INT:sV.BigNumber.from(0)))}if(t.itemType===cV.ItemType.ERC20){return new sV.Contract(t.token,fV.ERC20ABI,n).allowance(e,r)}return cV.MAX_INT})),$H.getApprovalActions=function(e,t,r){return e.filter(((t,r)=>r===e.length-1||e[r+1].token!==t.token)).map((({token:e,operator:n,itemType:i,identifierOrCriteria:a,requiredApprovedAmount:o})=>{const s=(0,dV.isErc1155Item)(i);if((0,dV.isErc721Item)(i)||s){const o=new sV.Contract(e,uV.ERC721ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,operator:n,transactionMethods:(0,lV.getTransactionMethods)(o.connect(r),t&&!s?"approve":"setApprovalForAll",[n,!(t&&!s)||a])}}{const s=new sV.Contract(e,fV.ERC20ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,transactionMethods:(0,lV.getTransactionMethods)(s.connect(r),"approve",[n,t?o:cV.MAX_INT]),operator:n}}}))};var pV={},hV={},mV={};Object.defineProperty(mV,"__esModule",{value:!0}),mV.ERC1155ABI=void 0;mV.ERC1155ABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256[]",name:"ids",type:"uint256[]"},{indexed:!1,internalType:"uint256[]",name:"amounts",type:"uint256[]"}],name:"TransferBatch",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"TransferSingle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"value",type:"string"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"URI",type:"event"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"owners",type:"address[]"},{internalType:"uint256[]",name:"ids",type:"uint256[]"}],name:"balanceOfBatch",outputs:[{internalType:"uint256[]",name:"balances",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"ids",type:"uint256[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];var bV=on&&on.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{f(n.next(e))}catch(e){a(e)}}function s(e){try{f(n.throw(e))}catch(e){a(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}f((n=n.apply(e,t||[])).next())}))};Object.defineProperty(hV,"__esModule",{value:!0}),hV.balanceOf=void 0;const yV=TH,gV=mV,vV=JH,wV=YH,_V=XH,EV=iV();hV.balanceOf=(e,t,r,n)=>bV(void 0,void 0,void 0,(function*(){if((0,EV.isErc721Item)(t.itemType)){const i=new yV.Contract(t.token,wV.ERC721ABI,r);return t.itemType===_V.ItemType.ERC721_WITH_CRITERIA?n?i.ownerOf(n.identifier).then((t=>yV.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase())))):i.balanceOf(e):i.ownerOf(t.identifierOrCriteria).then((t=>yV.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase()))))}if((0,EV.isErc1155Item)(t.itemType)){const i=new yV.Contract(t.token,gV.ERC1155ABI,r);if(t.itemType===_V.ItemType.ERC1155_WITH_CRITERIA){if(!n){const e=yV.BigNumber.from(t.startAmount),r=yV.BigNumber.from(t.endAmount);return e.gt(r)?e:r}return i.balanceOf(e,n.identifier)}return i.balanceOf(e,t.identifierOrCriteria)}if((0,EV.isErc20Item)(t.itemType)){return new yV.Contract(t.token,vV.ERC20ABI,r).balanceOf(e)}return r.getBalance(e)})),function(e){var t=on&&on.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{f(n.next(e))}catch(e){a(e)}}function s(e){try{f(n.throw(e))}catch(e){a(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}f((n=n.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.validateStandardFulfillBalancesAndApprovals=e.validateBasicFulfillBalancesAndApprovals=e.validateOfferBalancesAndApprovals=e.getInsufficientBalanceAndApprovalAmounts=e.getBalancesAndApprovals=void 0;const r=TH,n=XH,i=$H,a=hV,o=tV(),s=iV(),f=(e,t,r)=>{const n=e.find((({token:e,identifierOrCriteria:n})=>t.toLowerCase()===e.toLowerCase()&&n.toLowerCase()===r.toLowerCase()));if(!n)throw new Error("Balances and approvals didn't contain all tokens and identifiers");return n};e.getBalancesAndApprovals=({owner:e,items:f,criterias:u,operator:c,multicallProvider:d})=>t(void 0,void 0,void 0,(function*(){const l=(0,o.getItemToCriteriaMap)(f,u);return Promise.all(f.map((o=>t(void 0,void 0,void 0,(function*(){var t,f;let u=Promise.resolve(r.BigNumber.from(0));return u=(0,s.isErc721Item)(o.itemType)||(0,s.isErc1155Item)(o.itemType)||(0,s.isErc20Item)(o.itemType)?(0,i.approvedItemAmount)(e,o,c,d):Promise.resolve(n.MAX_INT),{token:o.token,identifierOrCriteria:null!==(f=null===(t=l.get(o))||void 0===t?void 0:t.identifier)&&void 0!==f?f:o.identifierOrCriteria,balance:yield(0,a.balanceOf)(e,o,d,l.get(o)),approvedAmount:yield u,itemType:o.itemType}})))))}));e.getInsufficientBalanceAndApprovalAmounts=({balancesAndApprovals:e,tokenAndIdentifierAmounts:t,operator:r})=>{const n=[...Object.entries(t).map((([e,t])=>Object.entries(t).map((([t,r])=>[e,t,r]))))].flat(),i=t=>n.filter((([r,n,i])=>f(e,r,n)[t].lt(i))).map((([r,n,i])=>{const a=f(e,r,n);return{token:r,identifierOrCriteria:n,requiredAmount:i,amountHave:a[t],itemType:a.itemType}})),[a,o]=[i("balance"),i("approvedAmount").map((e=>({token:e.token,identifierOrCriteria:e.identifierOrCriteria,approvedAmount:e.amountHave,requiredApprovedAmount:e.requiredAmount,itemType:e.itemType,operator:r})))];return{insufficientBalances:a,insufficientApprovals:o}};e.validateOfferBalancesAndApprovals=({offer:t,criterias:r,balancesAndApprovals:n,timeBasedItemParams:i,throwOnInsufficientBalances:a=!0,throwOnInsufficientApprovals:o,operator:f})=>{const{insufficientBalances:u,insufficientApprovals:c}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:n,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:t,criterias:r,timeBasedItemParams:i?Object.assign(Object.assign({},i),{isConsiderationItem:!1}):void 0}),operator:f});if(a&&u.length>0)throw new Error("The offerer does not have the amount needed to create or fulfill.");if(o&&c.length>0)throw new Error("The offerer does not have the sufficient approvals.");return c};e.validateBasicFulfillBalancesAndApprovals=({offer:t,consideration:r,offererBalancesAndApprovals:n,fulfillerBalancesAndApprovals:i,timeBasedItemParams:a,offererOperator:o,fulfillerOperator:f})=>{(0,e.validateOfferBalancesAndApprovals)({offer:t,criterias:[],balancesAndApprovals:n,timeBasedItemParams:a,throwOnInsufficientApprovals:!0,operator:o});const u=r.filter((e=>e.itemType!==t[0].itemType)),{insufficientBalances:c,insufficientApprovals:d}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:i,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:u,criterias:[],timeBasedItemParams:Object.assign(Object.assign({},a),{isConsiderationItem:!0})}),operator:f});if(c.length>0)throw new Error("The fulfiller does not have the balances needed to fulfill.");return d};e.validateStandardFulfillBalancesAndApprovals=({offer:t,consideration:r,offerCriteria:n,considerationCriteria:i,offererBalancesAndApprovals:a,fulfillerBalancesAndApprovals:o,timeBasedItemParams:f,offererOperator:c,fulfillerOperator:d})=>{(0,e.validateOfferBalancesAndApprovals)({offer:t,criterias:n,balancesAndApprovals:a,timeBasedItemParams:f,throwOnInsufficientApprovals:!0,operator:c});const l=u({items:t,criterias:n,balancesAndApprovals:o,timeBasedItemParams:f}),{insufficientBalances:p,insufficientApprovals:h}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:l,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:r,criterias:i,timeBasedItemParams:Object.assign(Object.assign({},f),{isConsiderationItem:!0})}),operator:d});if(p.length>0)throw new Error("The fulfiller does not have the balances needed to fulfill.");return h};const u=({items:e,criterias:t,timeBasedItemParams:r,balancesAndApprovals:n})=>{const i=(0,s.getSummedTokenAndIdentifierAmounts)({items:e,criterias:t,timeBasedItemParams:Object.assign(Object.assign({},r),{isConsiderationItem:!1})}),a=n.map((e=>Object.assign({},e)));return Object.entries(i).forEach((([e,t])=>Object.entries(t).forEach((([t,r])=>{const n=f(a,e,t),i=a.indexOf(n);a[i].balance=a[i].balance.add(r)})))),a}}(pV);var TV,AV={},SV={},kV={},OV={},RV={exports:{}},xV={exports:{}};function IV(){return TV||(TV=1,function(e,t){e.exports=function(){var e=e||function(e,t){var r=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),n={},i=n.lib={},a=i.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},o=i.WordArray=a.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||f).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var o=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=o<<24-(n+a)%4*8}else for(a=0;a<i;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],i=function(t){var r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},a=0;a<t;a+=4){var s=i(4294967296*(r||e.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new o.init(n,t)}}),s=n.enc={},f=s.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(r,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(r,t)}},c=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},d=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),f=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,u=e.min(4*f,i);if(f){for(var c=0;c<f;c+=a)this._doProcessBlock(n,c);var d=n.splice(0,f);r.sigBytes-=u}return new o.init(d,u)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=d.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new l.HMAC.init(e,r).finalize(t)}}});var l=n.algo={};return n}(Math);return e}()}(xV)),xV.exports}!function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=[],f=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(s[i]=r(t.pow(n,.5))),f[i]=r(t.pow(n,1/3)),i++),n++}();var u=[],c=o.SHA256=a.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],c=r[5],d=r[6],l=r[7],p=0;p<64;p++){if(p<16)u[p]=0|e[t+p];else{var h=u[p-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,b=u[p-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;u[p]=m+u[p-7]+y+u[p-16]}var g=n&i^n&a^i&a,v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=l+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&c^~s&d)+f[p]+u[p];l=d,d=c,c=s,s=o+w|0,o=a,a=i,i=n,n=w+(v+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0,r[5]=r[5]+c|0,r[6]=r[6]+d|0,r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=a._createHelper(c),r.HmacSHA256=a._createHmacHelper(c)}(Math),e.SHA256}(IV())}(RV);var CV=RV.exports,NV={exports:{}};!function(e,t){e.exports=function(){function e(e,t){var r=t?"└":"├";return r+=e?"─ ":"──┐"}function t(e,t){var r=[];for(var n in e)e.hasOwnProperty(n)&&(t&&"function"==typeof e[n]||r.push(n));return r}function r(n,i,a,o,s,f,u){var c,d,l="",p=0,h=o.slice(0);if(h.push([i,a])&&o.length>0&&(o.forEach((function(e,t){t>0&&(l+=(e[1]?" ":"│")+" "),d||e[0]!==i||(d=!0)})),l+=e(n,a)+n,s&&("object"!=typeof i||i instanceof Date)&&(l+=": "+i),d&&(l+=" (circular ref.)"),u(l)),!d&&"object"==typeof i){var m=t(i,f);m.forEach((function(e){c=++p===m.length,r(e,i[e],c,h,s,f,u)}))}}var n={asLines:function(e,t,n,i){r(".",e,!1,[],t,"function"!=typeof n&&n,i||n)},asTree:function(e,t,n){var i="";return r(".",e,!1,[],t,n,(function(e){i+=e+"\n"})),i}};return n}()}(NV);var PV,MV=NV.exports,BV={},DV={exports:{}},FV={exports:{}};function LV(){return PV||(PV=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.Base,a=n.WordArray,o=r.x64={};o.Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),o.WordArray=i.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var i=e[n];r.push(i.high),r.push(i.low)}return a.create(r,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}})}(),e}(IV())}(FV)),FV.exports}var UV,jV={exports:{}};function qV(){return UV||(UV=1,function(e,t){e.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init,n=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,n=[],i=0;i<t;i++)n[i>>>2]|=e[i]<<24-i%4*8;r.call(this,n,t)}else r.apply(this,arguments)};n.prototype=t}}(),e.lib.WordArray}(IV())}(jV)),jV.exports}var zV,HV={exports:{}};function VV(){return zV||(zV=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray,n=t.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var a=t[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>1]|=e.charCodeAt(i)<<16-i%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],a=0;a<r;a+=2){var o=i(t[a>>>2]>>>16-a%4*8&65535);n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,n=[],a=0;a<t;a++)n[a>>>1]|=i(e.charCodeAt(a)<<16-a%2*16);return r.create(n,2*t)}}}(),e.enc.Utf16}(IV())}(HV)),HV.exports}var GV,KV={exports:{}};function WV(){return GV||(GV=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var i=[],a=0,o=0;o<t;o++)if(o%4){var s=n[e.charCodeAt(o-1)]<<o%4*2,f=n[e.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=(s|f)<<24-a%4*8,a++}return r.create(i,a)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],a=0;a<r;a+=3)for(var o=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<r;s++)i.push(n.charAt(o>>>6*(3-s)&63));var f=n.charAt(64);if(f)for(;i.length%4;)i.push(f);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<r.length;a++)i[r.charCodeAt(a)]=a}var o=r.charAt(64);if(o){var s=e.indexOf(o);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(IV())}(KV)),KV.exports}var XV,$V={exports:{}};function JV(){return XV||(XV=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=[];!function(){for(var e=0;e<64;e++)s[e]=4294967296*t.abs(t.sin(e+1))|0}();var f=o.MD5=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a=this._hash.words,o=e[t+0],f=e[t+1],p=e[t+2],h=e[t+3],m=e[t+4],b=e[t+5],y=e[t+6],g=e[t+7],v=e[t+8],w=e[t+9],_=e[t+10],E=e[t+11],T=e[t+12],A=e[t+13],S=e[t+14],k=e[t+15],O=a[0],R=a[1],x=a[2],I=a[3];O=u(O,R,x,I,o,7,s[0]),I=u(I,O,R,x,f,12,s[1]),x=u(x,I,O,R,p,17,s[2]),R=u(R,x,I,O,h,22,s[3]),O=u(O,R,x,I,m,7,s[4]),I=u(I,O,R,x,b,12,s[5]),x=u(x,I,O,R,y,17,s[6]),R=u(R,x,I,O,g,22,s[7]),O=u(O,R,x,I,v,7,s[8]),I=u(I,O,R,x,w,12,s[9]),x=u(x,I,O,R,_,17,s[10]),R=u(R,x,I,O,E,22,s[11]),O=u(O,R,x,I,T,7,s[12]),I=u(I,O,R,x,A,12,s[13]),x=u(x,I,O,R,S,17,s[14]),O=c(O,R=u(R,x,I,O,k,22,s[15]),x,I,f,5,s[16]),I=c(I,O,R,x,y,9,s[17]),x=c(x,I,O,R,E,14,s[18]),R=c(R,x,I,O,o,20,s[19]),O=c(O,R,x,I,b,5,s[20]),I=c(I,O,R,x,_,9,s[21]),x=c(x,I,O,R,k,14,s[22]),R=c(R,x,I,O,m,20,s[23]),O=c(O,R,x,I,w,5,s[24]),I=c(I,O,R,x,S,9,s[25]),x=c(x,I,O,R,h,14,s[26]),R=c(R,x,I,O,v,20,s[27]),O=c(O,R,x,I,A,5,s[28]),I=c(I,O,R,x,p,9,s[29]),x=c(x,I,O,R,g,14,s[30]),O=d(O,R=c(R,x,I,O,T,20,s[31]),x,I,b,4,s[32]),I=d(I,O,R,x,v,11,s[33]),x=d(x,I,O,R,E,16,s[34]),R=d(R,x,I,O,S,23,s[35]),O=d(O,R,x,I,f,4,s[36]),I=d(I,O,R,x,m,11,s[37]),x=d(x,I,O,R,g,16,s[38]),R=d(R,x,I,O,_,23,s[39]),O=d(O,R,x,I,A,4,s[40]),I=d(I,O,R,x,o,11,s[41]),x=d(x,I,O,R,h,16,s[42]),R=d(R,x,I,O,y,23,s[43]),O=d(O,R,x,I,w,4,s[44]),I=d(I,O,R,x,T,11,s[45]),x=d(x,I,O,R,k,16,s[46]),O=l(O,R=d(R,x,I,O,p,23,s[47]),x,I,o,6,s[48]),I=l(I,O,R,x,g,10,s[49]),x=l(x,I,O,R,S,15,s[50]),R=l(R,x,I,O,b,21,s[51]),O=l(O,R,x,I,T,6,s[52]),I=l(I,O,R,x,h,10,s[53]),x=l(x,I,O,R,_,15,s[54]),R=l(R,x,I,O,f,21,s[55]),O=l(O,R,x,I,v,6,s[56]),I=l(I,O,R,x,k,10,s[57]),x=l(x,I,O,R,y,15,s[58]),R=l(R,x,I,O,A,21,s[59]),O=l(O,R,x,I,m,6,s[60]),I=l(I,O,R,x,E,10,s[61]),x=l(x,I,O,R,p,15,s[62]),R=l(R,x,I,O,w,21,s[63]),a[0]=a[0]+O|0,a[1]=a[1]+R|0,a[2]=a[2]+x|0,a[3]=a[3]+I|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var a=t.floor(n/4294967296),o=n;r[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),r[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),e.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,f=s.words,u=0;u<4;u++){var c=f[u];f[u]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return s},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,i,a,o){var s=e+(t&r|~t&n)+i+o;return(s<<a|s>>>32-a)+t}function c(e,t,r,n,i,a,o){var s=e+(t&n|r&~n)+i+o;return(s<<a|s>>>32-a)+t}function d(e,t,r,n,i,a,o){var s=e+(t^r^n)+i+o;return(s<<a|s>>>32-a)+t}function l(e,t,r,n,i,a,o){var s=e+(r^(t|~n))+i+o;return(s<<a|s>>>32-a)+t}r.MD5=a._createHelper(f),r.HmacMD5=a._createHmacHelper(f)}(Math),e.MD5}(IV())}($V)),$V.exports}var YV,QV={exports:{}};function ZV(){return YV||(YV=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.WordArray,i=r.Hasher,a=t.algo,o=[],s=a.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],s=r[3],f=r[4],u=0;u<80;u++){if(u<16)o[u]=0|e[t+u];else{var c=o[u-3]^o[u-8]^o[u-14]^o[u-16];o[u]=c<<1|c>>>31}var d=(n<<5|n>>>27)+f+o[u];d+=u<20?1518500249+(i&a|~i&s):u<40?1859775393+(i^a^s):u<60?(i&a|i&s|a&s)-1894007588:(i^a^s)-899497514,f=s,s=a,a=i<<30|i>>>2,i=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+s|0,r[4]=r[4]+f|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA1=i._createHelper(s),t.HmacSHA1=i._createHmacHelper(s)}(),e.SHA1}(IV())}(QV)),QV.exports}var eG,tG={exports:{}};var rG,nG={exports:{}};function iG(){return rG||(rG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.Hasher,n=t.x64,i=n.Word,a=n.WordArray,o=t.algo;function s(){return i.create.apply(i,arguments)}var f=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=s()}();var c=o.SHA512=r.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],c=r[5],d=r[6],l=r[7],p=n.high,h=n.low,m=i.high,b=i.low,y=a.high,g=a.low,v=o.high,w=o.low,_=s.high,E=s.low,T=c.high,A=c.low,S=d.high,k=d.low,O=l.high,R=l.low,x=p,I=h,C=m,N=b,P=y,M=g,B=v,D=w,F=_,L=E,U=T,j=A,q=S,z=k,H=O,V=R,G=0;G<80;G++){var K=u[G];if(G<16)var W=K.high=0|e[t+2*G],X=K.low=0|e[t+2*G+1];else{var $=u[G-15],J=$.high,Y=$.low,Q=(J>>>1|Y<<31)^(J>>>8|Y<<24)^J>>>7,Z=(Y>>>1|J<<31)^(Y>>>8|J<<24)^(Y>>>7|J<<25),ee=u[G-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ae=u[G-7],oe=ae.high,se=ae.low,fe=u[G-16],ue=fe.high,ce=fe.low;W=(W=(W=Q+oe+((X=Z+se)>>>0<Z>>>0?1:0))+ne+((X+=ie)>>>0<ie>>>0?1:0))+ue+((X+=ce)>>>0<ce>>>0?1:0),K.high=W,K.low=X}var de,le=F&U^~F&q,pe=L&j^~L&z,he=x&C^x&P^C&P,me=I&N^I&M^N&M,be=(x>>>28|I<<4)^(x<<30|I>>>2)^(x<<25|I>>>7),ye=(I>>>28|x<<4)^(I<<30|x>>>2)^(I<<25|x>>>7),ge=(F>>>14|L<<18)^(F>>>18|L<<14)^(F<<23|L>>>9),ve=(L>>>14|F<<18)^(L>>>18|F<<14)^(L<<23|F>>>9),we=f[G],_e=we.high,Ee=we.low,Te=H+ge+((de=V+ve)>>>0<V>>>0?1:0),Ae=ye+me;H=q,V=z,q=U,z=j,U=F,j=L,F=B+(Te=(Te=(Te=Te+le+((de+=pe)>>>0<pe>>>0?1:0))+_e+((de+=Ee)>>>0<Ee>>>0?1:0))+W+((de+=X)>>>0<X>>>0?1:0))+((L=D+de|0)>>>0<D>>>0?1:0)|0,B=P,D=M,P=C,M=N,C=x,N=I,x=Te+(be+he+(Ae>>>0<ye>>>0?1:0))+((I=de+Ae|0)>>>0<de>>>0?1:0)|0}h=n.low=h+I,n.high=p+x+(h>>>0<I>>>0?1:0),b=i.low=b+N,i.high=m+C+(b>>>0<N>>>0?1:0),g=a.low=g+M,a.high=y+P+(g>>>0<M>>>0?1:0),w=o.low=w+D,o.high=v+B+(w>>>0<D>>>0?1:0),E=s.low=E+L,s.high=_+F+(E>>>0<L>>>0?1:0),A=c.low=A+j,c.high=T+U+(A>>>0<j>>>0?1:0),k=d.low=k+z,d.high=S+q+(k>>>0<z>>>0?1:0),R=l.low=R+V,l.high=O+H+(R>>>0<V>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(c),t.HmacSHA512=r._createHmacHelper(c)}(),e.SHA512}(IV(),LV())}(nG)),nG.exports}var aG,oG={exports:{}};var sG,fG={exports:{}};function uG(){return sG||(sG=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.x64.Word,s=r.algo,f=[],u=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){f[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,a=0;a<24;a++){for(var s=0,d=0,l=0;l<7;l++){if(1&i){var p=(1<<l)-1;p<32?d^=1<<p:s^=1<<p-32}128&i?i=i<<1^113:i<<=1}c[a]=o.create(s,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=o.create()}();var l=s.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new o.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,i=0;i<n;i++){var a=e[t+2*i],o=e[t+2*i+1];a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(R=r[i]).high^=o,R.low^=a}for(var s=0;s<24;s++){for(var l=0;l<5;l++){for(var p=0,h=0,m=0;m<5;m++)p^=(R=r[l+5*m]).high,h^=R.low;var b=d[l];b.high=p,b.low=h}for(l=0;l<5;l++){var y=d[(l+4)%5],g=d[(l+1)%5],v=g.high,w=g.low;for(p=y.high^(v<<1|w>>>31),h=y.low^(w<<1|v>>>31),m=0;m<5;m++)(R=r[l+5*m]).high^=p,R.low^=h}for(var _=1;_<25;_++){var E=(R=r[_]).high,T=R.low,A=f[_];A<32?(p=E<<A|T>>>32-A,h=T<<A|E>>>32-A):(p=T<<A-32|E>>>64-A,h=E<<A-32|T>>>64-A);var S=d[u[_]];S.high=p,S.low=h}var k=d[0],O=r[0];for(k.high=O.high,k.low=O.low,l=0;l<5;l++)for(m=0;m<5;m++){var R=r[_=l+5*m],x=d[_],I=d[(l+1)%5+5*m],C=d[(l+2)%5+5*m];R.high=x.high^~I.high&C.high,R.low=x.low^~I.low&C.low}R=r[0];var N=c[s];R.high^=N.high,R.low^=N.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var n=8*e.sigBytes,a=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/a)*a>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var o=this._state,s=this.cfg.outputLength/8,f=s/8,u=[],c=0;c<f;c++){var d=o[c],l=d.high,p=d.low;l=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),u.push(p),u.push(l)}return new i.init(u,s)},clone:function(){for(var e=a.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=a._createHelper(l),r.HmacSHA3=a._createHmacHelper(l)}(Math),e.SHA3}(IV(),LV())}(fG)),fG.exports}var cG,dG={exports:{}};var lG,pG={exports:{}};function hG(){return lG||(lG=1,function(e,t){e.exports=function(e){!function(){var t=e,r=t.lib.Base,n=t.enc.Utf8;t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),o=this._iKey=t.clone(),s=a.words,f=o.words,u=0;u<r;u++)s[u]^=1549556828,f[u]^=909522486;a.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}()}(IV())}(pG)),pG.exports}var mG,bG={exports:{}};var yG,gG={exports:{}};function vG(){return yG||(yG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.Base,i=r.WordArray,a=t.algo,o=a.MD5,s=a.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:o,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=r.hasher.create(),a=i.create(),o=a.words,s=r.keySize,f=r.iterations;o.length<s;){u&&n.update(u);var u=n.update(e).finalize(t);n.reset();for(var c=1;c<f;c++)u=n.finalize(u),n.reset();a.concat(u)}return a.sigBytes=4*s,a}});t.EvpKDF=function(e,t,r){return s.create(r).compute(e,t)}}(),e.EvpKDF}(IV(),ZV(),hG())}(gG)),gG.exports}var wG,_G={exports:{}};function EG(){return wG||(wG=1,function(e,t){e.exports=function(e){e.lib.Cipher||function(t){var r=e,n=r.lib,i=n.Base,a=n.WordArray,o=n.BufferedBlockAlgorithm,s=r.enc;s.Utf8;var f=s.Base64,u=r.algo.EvpKDF,c=n.Cipher=o.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?v:y}return function(t){return{encrypt:function(r,n,i){return e(n).encrypt(t,r,n,i)},decrypt:function(r,n,i){return e(n).decrypt(t,r,n,i)}}}}()});n.StreamCipher=c.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=r.mode={},l=n.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=d.CBC=function(){var e=l.extend();function r(e,r,n){var i=this._iv;if(i){var a=i;this._iv=t}else a=this._prevBlock;for(var o=0;o<n;o++)e[r+o]^=a[o]}return e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),e.Decryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,a=e.slice(t,t+i);n.decryptBlock(e,t),r.call(this,e,t,i),this._prevBlock=a}}),e}(),h=(r.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,i=n<<24|n<<16|n<<8|n,o=[],s=0;s<n;s+=4)o.push(i);var f=a.create(o,n);e.concat(f)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};n.BlockCipher=c.extend({cfg:c.cfg.extend({mode:p,padding:h}),reset:function(){c.reset.call(this);var e=this.cfg,t=e.iv,r=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=r.createEncryptor;else n=r.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==n?this._mode.init(this,t&&t.words):(this._mode=n.call(r,this,t&&t.words),this._mode.__creator=n)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var m=n.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),b=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;if(r)var n=a.create([1398893684,1701076831]).concat(r).concat(t);else n=t;return n.toString(f)},parse:function(e){var t=f.parse(e),r=t.words;if(1398893684==r[0]&&1701076831==r[1]){var n=a.create(r.slice(2,4));r.splice(0,4),t.sigBytes-=16}return m.create({ciphertext:t,salt:n})}},y=n.SerializableCipher=i.extend({cfg:i.extend({format:b}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),a=i.finalize(t),o=i.cfg;return m.create({ciphertext:a,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),g=(r.kdf={}).OpenSSL={execute:function(e,t,r,n){n||(n=a.random(8));var i=u.create({keySize:t+r}).compute(e,n),o=a.create(i.words.slice(t),4*r);return i.sigBytes=4*t,m.create({key:i,iv:o,salt:n})}},v=n.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:g}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=i.iv;var a=y.encrypt.call(this,e,t,i.key,n);return a.mixIn(i),a},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv=i.iv,y.decrypt.call(this,e,t,i.key,n)}})}()}(IV(),vG())}(_G)),_G.exports}var TG,AG={exports:{}};function SG(){return TG||(TG=1,function(e,t){e.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,n){var i=this._iv;if(i){var a=i.slice(0);this._iv=void 0}else a=this._prevBlock;n.encryptBlock(a,0);for(var o=0;o<r;o++)e[t+o]^=a[o]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i,n),this._prevBlock=e.slice(t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,a=e.slice(t,t+i);r.call(this,e,t,i,n),this._prevBlock=a}}),t}(),e.mode.CFB}(IV(),EG())}(AG)),AG.exports}var kG,OG={exports:{}};function RG(){return kG||(kG=1,function(e,t){e.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);r.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)e[t+s]^=o[s]}}),t.Decryptor=r,t),e.mode.CTR;var t,r}(IV(),EG())}(OG)),OG.exports}var xG,IG={exports:{}};function CG(){return xG||(xG=1,function(e,t){e.exports=function(e){
31
+ */gP=vP,function(){var e="input is invalid type",t="object"==typeof window,r=t?window:{};r.JS_SHA3_NO_WINDOW&&(t=!1);var n=!t&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?r=uC:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&gP.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,o="0123456789abcdef".split(""),s=[4,1024,262144,67108864],f=[0,8,16,24],u=[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],c=[224,256,384,512],d=[128,256],l=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var h=function(e,t,r){return function(n){return new x(e,t,e).update(n)[r]()}},m=function(e,t,r){return function(n,i){return new x(e,t,i).update(n)[r]()}},b=function(e,t,r){return function(t,n,i,a){return _["cshake"+e].update(t,n,i,a)[r]()}},y=function(e,t,r){return function(t,n,i,a){return _["kmac"+e].update(t,n,i,a)[r]()}},g=function(e,t,r,n){for(var i=0;i<l.length;++i){var a=l[i];e[a]=t(r,n,a)}return e},v=function(e,t){var r=h(e,t,"hex");return r.create=function(){return new x(e,t,e)},r.update=function(e){return r.create().update(e)},g(r,h,e,t)},w=[{name:"keccak",padding:[1,256,65536,16777216],bits:c,createMethod:v},{name:"sha3",padding:[6,1536,393216,100663296],bits:c,createMethod:v},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(e,t){var r=m(e,t,"hex");return r.create=function(r){return new x(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},g(r,m,e,t)}},{name:"cshake",padding:s,bits:d,createMethod:function(e,t){var r=p[e],n=b(e,0,"hex");return n.create=function(n,i,a){return i||a?new x(e,t,n).bytepad([i,a],r):_["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},g(n,b,e,t)}},{name:"kmac",padding:s,bits:d,createMethod:function(e,t){var r=p[e],n=y(e,0,"hex");return n.create=function(n,i,a){return new I(e,t,i).bytepad(["KMAC",a],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},g(n,y,e,t)}}],_={},E=[],T=0;T<w.length;++T)for(var A=w[T],S=A.bits,k=0;k<S.length;++k){var O=A.name+"_"+S[k];if(E.push(O),_[O]=A.createMethod(S[k],A.padding),"sha3"!==A.name){var R=A.name+S[k];E.push(R),_[R]=_[O]}}function x(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function I(e,t,r){x.call(this,e,t,r)}x.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var i,o,s=this.blocks,u=this.byteCount,c=t.length,d=this.blockCount,l=0,p=this.s;l<c;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<d+1;++i)s[i]=0;if(r)for(i=this.start;l<c&&i<u;++l)s[i>>2]|=t[l]<<f[3&i++];else for(i=this.start;l<c&&i<u;++l)(o=t.charCodeAt(l))<128?s[i>>2]|=o<<f[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<f[3&i++],s[i>>2]|=(128|63&o)<<f[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<f[3&i++],s[i>>2]|=(128|o>>6&63)<<f[3&i++],s[i>>2]|=(128|63&o)<<f[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++l)),s[i>>2]|=(240|o>>18)<<f[3&i++],s[i>>2]|=(128|o>>12&63)<<f[3&i++],s[i>>2]|=(128|o>>6&63)<<f[3&i++],s[i>>2]|=(128|63&o)<<f[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=s[d],i=0;i<d;++i)p[i]^=s[i];C(p),this.reset=!0}else this.start=i}return this},x.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},x.prototype.encodeString=function(t){var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}var i=0,o=t.length;if(r)i=o;else for(var s=0;s<t.length;++s){var f=t.charCodeAt(s);f<128?i+=1:f<2048?i+=2:f<55296||f>=57344?i+=3:(f=65536+((1023&f)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},x.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,a=[];return a.length=i,this.update(a),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];C(n)}},x.prototype.toString=x.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,s=0,f="";s<n;){for(a=0;a<t&&s<n;++a,++s)e=r[a],f+=o[e>>4&15]+o[15&e]+o[e>>12&15]+o[e>>8&15]+o[e>>20&15]+o[e>>16&15]+o[e>>28&15]+o[e>>24&15];s%t==0&&(C(r),a=0)}return i&&(e=r[a],f+=o[e>>4&15]+o[15&e],i>1&&(f+=o[e>>12&15]+o[e>>8&15]),i>2&&(f+=o[e>>20&15]+o[e>>16&15])),f},x.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,o=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var f=new Uint32Array(e);o<n;){for(a=0;a<t&&o<n;++a,++o)f[o]=r[a];o%t==0&&C(r)}return i&&(f[a]=r[a],e=e.slice(0,s)),e},x.prototype.buffer=x.prototype.arrayBuffer,x.prototype.digest=x.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,a=this.extraBytes,o=0,s=0,f=[];s<i;){for(o=0;o<r&&s<i;++o,++s)e=s<<2,t=n[o],f[e]=255&t,f[e+1]=t>>8&255,f[e+2]=t>>16&255,f[e+3]=t>>24&255;s%r==0&&C(n)}return a&&(e=s<<2,t=n[o],f[e]=255&t,a>1&&(f[e+1]=t>>8&255),a>2&&(f[e+2]=t>>16&255)),f},I.prototype=new x,I.prototype.finalize=function(){return this.encode(this.outputBits,!0),x.prototype.finalize.call(this)};var C=function(e){var t,r,n,i,a,o,s,f,c,d,l,p,h,m,b,y,g,v,w,_,E,T,A,S,k,O,R,x,I,C,N,P,M,B,D,F,L,U,j,q,z,H,V,G,K,W,X,$,J,Y,Q,Z,ee,te,re,ne,ie,ae,oe,se,fe,ue,ce;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],a=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],f=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],t=(p=e[8]^e[18]^e[28]^e[38]^e[48])^(o<<1|s>>>31),r=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|o>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(f<<1|c>>>31),r=a^(c<<1|f>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=o^(d<<1|l>>>31),r=s^(l<<1|d>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=f^(p<<1|h>>>31),r=c^(h<<1|p>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=d^(i<<1|a>>>31),r=l^(a<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,m=e[0],b=e[1],W=e[11]<<4|e[10]>>>28,X=e[10]<<4|e[11]>>>28,x=e[20]<<3|e[21]>>>29,I=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,fe=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,V=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,D=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,$=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,C=e[33]<<13|e[32]>>>19,N=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,F=e[14]<<6|e[15]>>>26,L=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,Y=e[34]<<15|e[35]>>>17,Q=e[35]<<15|e[34]>>>17,P=e[45]<<29|e[44]>>>3,M=e[44]<<29|e[45]>>>3,S=e[6]<<28|e[7]>>>4,k=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,j=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,E=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,K=e[9]<<27|e[8]>>>5,O=e[18]<<20|e[19]>>>12,R=e[19]<<20|e[18]>>>12,ae=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,T=e[48]<<14|e[49]>>>18,A=e[49]<<14|e[48]>>>18,e[0]=m^~y&v,e[1]=b^~g&w,e[10]=S^~O&x,e[11]=k^~R&I,e[20]=B^~F&U,e[21]=D^~L&j,e[30]=G^~W&$,e[31]=K^~X&J,e[40]=te^~ne&ae,e[41]=re^~ie&oe,e[2]=y^~v&_,e[3]=g^~w&E,e[12]=O^~x&C,e[13]=R^~I&N,e[22]=F^~U&q,e[23]=L^~j&z,e[32]=W^~$&Y,e[33]=X^~J&Q,e[42]=ne^~ae&se,e[43]=ie^~oe&fe,e[4]=v^~_&T,e[5]=w^~E&A,e[14]=x^~C&P,e[15]=I^~N&M,e[24]=U^~q&H,e[25]=j^~z&V,e[34]=$^~Y&Z,e[35]=J^~Q&ee,e[44]=ae^~se&ue,e[45]=oe^~fe&ce,e[6]=_^~T&m,e[7]=E^~A&b,e[16]=C^~P&S,e[17]=N^~M&k,e[26]=q^~H&B,e[27]=z^~V&D,e[36]=Y^~Z&G,e[37]=Q^~ee&K,e[46]=se^~ue&te,e[47]=fe^~ce&re,e[8]=T^~m&y,e[9]=A^~b&g,e[18]=P^~S&O,e[19]=M^~k&R,e[28]=H^~B&F,e[29]=V^~D&L,e[38]=Z^~G&W,e[39]=ee^~K&X,e[48]=ue^~te&ne,e[49]=ce^~re&ie,e[0]^=u[n],e[1]^=u[n+1]};if(i)gP.exports=_;else for(T=0;T<E.length;++T)r[E[T]]=_[E[T]]}();var wP=vP.exports;function _P(e){return"0x"+wP.keccak_256(Ii(e))}let EP=!1,TP=!1;const AP={debug:1,default:2,info:2,warning:3,error:4,off:5};let SP=AP.default,kP=null;const OP=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var RP,xP;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(RP||(RP={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(xP||(xP={}));const IP="0123456789abcdef";let CP=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==AP[r]&&this.throwArgumentError("invalid log level name","logLevel",e),SP>AP[r]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(TP)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=IP[t[e]>>4],r+=IP[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const a=t;let o="";switch(r){case xP.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case xP.CALL_EXCEPTION:case xP.INSUFFICIENT_FUNDS:case xP.MISSING_NEW:case xP.NONCE_EXPIRED:case xP.REPLACEMENT_UNDERPRICED:case xP.TRANSACTION_REPLACED:case xP.UNPREDICTABLE_GAS_LIMIT:o=r}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=a,s.code=r,Object.keys(n).forEach((function(e){s[e]=n[e]})),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){OP&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:OP})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return kP||(kP=new e("logger/5.7.0")),kP}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),EP){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}TP=!!t,EP=!!r}static setLogLevel(t){const r=AP[t.toLowerCase()];null!=r?SP=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};CP.errors=xP,CP.levels=RP;var NP=li.BN;const PP=new CP("bignumber/5.7.0"),MP={};let BP=!1,DP=class e{constructor(e,t){e!==MP&&PP.throwError("cannot call constructor directly; use BigNumber.from",CP.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return LP(UP(this).fromTwos(e))}toTwos(e){return LP(UP(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return LP(UP(this).add(UP(e)))}sub(e){return LP(UP(this).sub(UP(e)))}div(t){return e.from(t).isZero()&&jP("division-by-zero","div"),LP(UP(this).div(UP(t)))}mul(e){return LP(UP(this).mul(UP(e)))}mod(e){const t=UP(e);return t.isNeg()&&jP("division-by-zero","mod"),LP(UP(this).umod(t))}pow(e){const t=UP(e);return t.isNeg()&&jP("negative-power","pow"),LP(UP(this).pow(t))}and(e){const t=UP(e);return(this.isNegative()||t.isNeg())&&jP("unbound-bitwise-result","and"),LP(UP(this).and(t))}or(e){const t=UP(e);return(this.isNegative()||t.isNeg())&&jP("unbound-bitwise-result","or"),LP(UP(this).or(t))}xor(e){const t=UP(e);return(this.isNegative()||t.isNeg())&&jP("unbound-bitwise-result","xor"),LP(UP(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&jP("negative-width","mask"),LP(UP(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&jP("negative-width","shl"),LP(UP(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&jP("negative-width","shr"),LP(UP(this).shrn(e))}eq(e){return UP(this).eq(UP(e))}lt(e){return UP(this).lt(UP(e))}lte(e){return UP(this).lte(UP(e))}gt(e){return UP(this).gt(UP(e))}gte(e){return UP(this).gte(UP(e))}isNegative(){return"-"===this._hex[0]}isZero(){return UP(this).isZero()}toNumber(){try{return UP(this).toNumber()}catch(e){jP("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return PP.throwError("this platform does not support BigInt",CP.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?BP||(BP=!0,PP.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?PP.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",CP.errors.UNEXPECTED_ARGUMENT,{}):PP.throwError("BigNumber.toString does not accept parameters",CP.errors.UNEXPECTED_ARGUMENT,{})),UP(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(MP,FP(t)):t.match(/^-?[0-9]+$/)?new e(MP,FP(new NP(t))):PP.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&jP("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&jP("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(xi(r))return e.from(Di(r));if(r)if(r.toHexString){const t=r.toHexString();if("string"==typeof t)return e.from(t)}else{let t=r._hex;if(null==t&&"BigNumber"===r.type&&(t=r.hex),"string"==typeof t&&(Mi(t)||"-"===t[0]&&Mi(t.substring(1))))return e.from(t)}return PP.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function FP(e){if("string"!=typeof e)return FP(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&PP.throwArgumentError("invalid hex","value",e),"0x00"===(e=FP(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function LP(e){return DP.from(FP(e))}function UP(e){const t=DP.from(e).toHexString();return"-"===t[0]?new NP("-"+t.substring(3),16):new NP(t.substring(2),16)}function jP(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),PP.throwError(e,CP.errors.NUMERIC_FAULT,n)}const qP=new CP("bignumber/5.7.0"),zP={},HP=DP.from(0),VP=DP.from(-1);function GP(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),qP.throwError(e,CP.errors.NUMERIC_FAULT,i)}let KP="0";for(;KP.length<256;)KP+=KP;function WP(e){if("number"!=typeof e)try{e=DP.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+KP.substring(0,e):qP.throwArgumentError("invalid decimal size","decimals",e)}function XP(e,t){null==t&&(t=0);const r=WP(t),n=(e=DP.from(e)).lt(HP);n&&(e=e.mul(VP));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=e.div(r).toString();return e=1===r.length?a:a+"."+i,n&&(e="-"+e),e}function $P(e,t){null==t&&(t=0);const r=WP(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||qP.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&qP.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&qP.throwArgumentError("too many decimal points","value",e);let a=i[0],o=i[1];for(a||(a="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>r.length-1&&GP("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const s=DP.from(a),f=DP.from(o);let u=s.mul(r).add(f);return n&&(u=u.mul(VP)),u}let JP=class e{constructor(e,t,r,n){e!==zP&&qP.throwError("cannot use FixedFormat constructor; use FixedFormat.from",CP.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=WP(n),Object.freeze(this)}static from(t){if(t instanceof e)return t;"number"==typeof t&&(t=`fixed128x${t}`);let r=!0,n=128,i=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)r=!1;else{const e=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);e||qP.throwArgumentError("invalid fixed format","format",t),r="u"!==e[1],n=parseInt(e[2]),i=parseInt(e[3])}else if(t){const e=(e,r,n)=>null==t[e]?n:(typeof t[e]!==r&&qP.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);r=e("signed","boolean",r),n=e("width","number",n),i=e("decimals","number",i)}return n%8&&qP.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&qP.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new e(zP,r,n,i)}},YP=class e{constructor(e,t,r,n){e!==zP&&qP.throwError("cannot use FixedNumber constructor; use FixedNumber.from",CP.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&qP.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(t){this._checkFormat(t);const r=$P(this._value,this.format.decimals),n=$P(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const r=$P(this._value,this.format.decimals),n=$P(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const r=$P(this._value,this.format.decimals),n=$P(t._value,t.format.decimals);return e.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const r=$P(this._value,this.format.decimals),n=$P(t._value,t.format.decimals);return e.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let r=e.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(QP.toFormat(r.format))),r}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let r=e.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(QP.toFormat(r.format))),r}round(t){null==t&&(t=0);const r=this.toString().split(".");if(1===r.length&&r.push("0"),(t<0||t>80||t%1)&&qP.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;const n=e.from("1"+KP.substring(0,t),this.format),i=ZP.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&qP.throwArgumentError("invalid byte width","width",e);return zi(DP.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return e.fromString(this._value,t)}static fromValue(t,r,n){return null!=n||null==r||function(e){return null!=e&&(DP.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Mi(e)||"bigint"==typeof e||xi(e))}(r)||(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(XP(t,r),JP.from(n))}static fromString(t,r){null==r&&(r="fixed");const n=JP.from(r),i=$P(t,n.decimals);!n.signed&&i.lt(HP)&&GP("unsigned value cannot be negative","overflow","value",t);let a=null;n.signed?a=i.toTwos(n.width).toHexString():(a=i.toHexString(),a=zi(a,n.width/8));const o=XP(i,n.decimals);return new e(zP,a,o,n)}static fromBytes(t,r){null==r&&(r="fixed");const n=JP.from(r);if(Ii(t).length>n.width/8)throw new Error("overflow");let i=DP.from(t);n.signed&&(i=i.fromTwos(n.width));const a=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=XP(i,n.decimals);return new e(zP,a,o,n)}static from(t,r){if("string"==typeof t)return e.fromString(t,r);if(xi(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(t){if(t.code!==CP.errors.INVALID_ARGUMENT)throw t}return qP.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}};const QP=YP.from(1),ZP=YP.from("0.5"),eM=new CP("strings/5.7.0");var tM,rM;function nM(e,t=tM.current){t!=tM.current&&(eM.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const a=65536+((1023&n)<<10)+(1023&i);r.push(a>>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(63&a|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return Ii(r)}function iM(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])})),n}function aM(e){let t=0;return e.split(",").map((e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}}))}function oM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function sM(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oM(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function fM(e,t,r){return uM.apply(this,arguments)}function uM(){return(uM=fC(pC.mark((function e(t,r,n){var i,a,o,s,f,u,c,d;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.users.map((function(e){return{ether_key:e.user,tokens:e.tokens.map((function(e){return sM({id:e.id,blueprint:e.blueprint},e.royalties&&e.royalties.length>0&&{royalties:e.royalties.map((function(e){return{recipient:e.recipient,percentage:e.percentage}}))})}))}})),a=r.royalties,o=sM(sM({contract_address:r.contract_address},a&&a.length>0&&{royalties:a.map((function(e){return{recipient:e.recipient,percentage:e.percentage}}))}),{},{users:i,auth_signature:""}),s=_P(nM(JSON.stringify(o))),e.next=6,yC(s,t);case 6:return f=e.sent,u=sM(sM({users:o.users.map((function(e){return{user:e.ether_key,tokens:e.tokens}}))},a&&a.length>0&&{royalties:a}),{},{contract_address:r.contract_address,auth_signature:f}),c={mintTokensRequestV2:[u]},e.next=11,n.mintTokens(c);case 11:return d=e.sent,e.abrupt("return",d.data);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cM(e){switch(e.type){case"ERC721":return{type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return{type:"ERC20",data:{token_address:e.tokenAddress}};case"ETH":return{type:"ETH",data:{decimals:18}}}}function dM(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return lM(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?lM(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function lM(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function pM(e){return hM.apply(this,arguments)}function hM(){return(hM=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p,h,m,b;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ethSigner,i=t.starkSigner,a=t.request,o=t.transfersApi,e.next=3,n.getAddress();case 3:return s=e.sent,f="ERC721"===a.type?"1":a.amount,e.next=7,o.getSignableTransferV1({getSignableTransferRequest:{sender:s,token:cM(a),amount:f,receiver:a.receiver}});case 7:return u=e.sent,c=u.data,d=c.signable_message,l=c.payload_hash,e.next=11,yC(d,n);case 11:return p=e.sent,e.next=14,i.signMessage(l);case 14:return h=e.sent,m={sender_stark_key:u.data.sender_stark_key,sender_vault_id:u.data.sender_vault_id,receiver_stark_key:u.data.receiver_stark_key,receiver_vault_id:u.data.receiver_vault_id,asset_id:u.data.asset_id,amount:u.data.amount,nonce:u.data.nonce,expiration_timestamp:u.data.expiration_timestamp,stark_signature:h},e.next=18,o.createTransferV1({createTransferRequest:m,xImxEthAddress:s,xImxEthSignature:p});case 18:return b=e.sent,e.abrupt("return",{sent_signature:null==b?void 0:b.data.sent_signature,status:null==b||null===(r=b.data.status)||void 0===r?void 0:r.toString(),time:null==b?void 0:b.data.time,transfer_id:null==b?void 0:b.data.transfer_id});case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mM(e){return bM.apply(this,arguments)}function bM(){return(bM=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p,h,m,b,y,g;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.transfersApi,e.next=3,r.getAddress();case 3:return o=e.sent,s=i.map((function(e){return{amount:"1",token:cM({type:"ERC721",tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver}})),e.next=7,a.getSignableTransfer({getSignableTransferRequestV2:{sender_ether_key:o,signable_requests:s}});case 7:if(f=e.sent,void 0!==(u=f.data.signable_message)){e.next=11;break}throw new Error("Invalid response from Signable registration offchain");case 11:return e.next=13,yC(u,r);case 13:c=e.sent,d=[],l=dM(f.data.signable_responses),e.prev=16,l.s();case 18:if((p=l.n()).done){e.next=27;break}return h=p.value,e.next=22,n.signMessage(h.payload_hash);case 22:m=e.sent,b={sender_vault_id:h.sender_vault_id,receiver_stark_key:h.receiver_stark_key,receiver_vault_id:h.receiver_vault_id,asset_id:h.asset_id,amount:h.amount,nonce:h.nonce,expiration_timestamp:h.expiration_timestamp,stark_signature:m},d.push(b);case 25:e.next=18;break;case 27:e.next=32;break;case 29:e.prev=29,e.t0=e.catch(16),l.e(e.t0);case 32:return e.prev=32,l.f(),e.finish(32);case 35:return y={sender_stark_key:f.data.sender_stark_key,requests:d},e.next=38,a.createTransfer({createTransferRequestV2:y,xImxEthAddress:o,xImxEthSignature:c});case 38:return g=e.sent,e.abrupt("return",{transfer_ids:null==g?void 0:g.data.transfer_ids});case 40:case"end":return e.stop()}}),e,null,[[16,29,32,35]])})))).apply(this,arguments)}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(tM||(tM={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(rM||(rM={})),aM("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),iM("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),iM("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),iM("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(e){if(e.length%4!=0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t})),aM("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const yM=new CP("units/5.7.0"),gM=["wei","kwei","mwei","gwei","szabo","finney","ether"];function vM(e,t){if("string"!=typeof e&&yM.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=gM.indexOf(t);-1!==e&&(t=3*e)}return $P(e,null!=t?t:18)}function wM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wM(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function EM(e,t,r,n,i,a,o){return TM.apply(this,arguments)}function TM(){return(TM=fC(pC.mark((function e(t,r,n,i,a,o,s){var f,u,c;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return f=e.sent,e.next=5,bP(f,i,s);case 5:return u=e.sent,e.next=8,o.populateTransaction.registerAndDepositEth(f,i,u.operator_signature,n,a);case 8:return c=e.sent,e.abrupt("return",t.sendTransaction(_M(_M({},c),{},{value:r})));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function AM(e,t,r,n,i,a){return SM.apply(this,arguments)}function SM(){return(SM=fC(pC.mark((function e(t,r,n,i,a,o){var s;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction["deposit(uint256,uint256,uint256)"](i,n,a);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(_M(_M({},s),{},{value:r})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kM(e,t,r,n,i,a){return OM.apply(this,arguments)}function OM(){return(OM=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u,c,d,l,p,h,m,b,y;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,f={decimals:18},u=vM(r.amount,"wei"),c={user:s,token:{type:r.type,data:f},amount:u.toString()},e.next=8,n.getSignableDeposit({getSignableDepositRequest:c});case 8:return d=e.sent,e.next=11,a.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type}}});case 11:return l=e.sent,p=l.data.asset_type,h=d.data.stark_key,m=d.data.vault_id,b=$I.connect(o.ethConfiguration.coreContractAddress,t),y=aC.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,hP(h,y);case 19:if(e.sent){e.next=24;break}return e.abrupt("return",EM(t,u,p,h,m,b,i));case 24:return e.abrupt("return",AM(t,u,p,h,m,b));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function RM(e,t,r,n,i,a){return xM.apply(this,arguments)}function xM(){return(xM=fC(pC.mark((function e(t,r,n,i,a,o){var s;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction.depositERC20(i,n,a,r);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(s));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function IM(e,t,r,n,i,a,o){return CM.apply(this,arguments)}function CM(){return(CM=fC(pC.mark((function e(t,r,n,i,a,o,s){var f,u,c;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return f=e.sent,e.next=5,bP(f,i,s);case 5:return u=e.sent,e.next=8,o.populateTransaction.registerAndDepositERC20(f,i,u.operator_signature,n,a,r);case 8:return c=e.sent,e.abrupt("return",t.sendTransaction(c));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function NM(e,t,r,n,i,a,o){return PM.apply(this,arguments)}function PM(){return(PM=fC(pC.mark((function e(t,r,n,i,a,o,s){var f,u,c,d,l,p,h,m,b,y,g,v,w,_,E,T;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return f=e.sent,e.next=5,a.getToken({address:r.tokenAddress});case 5:return u=e.sent,c=parseInt(u.data.decimals),d={decimals:c,token_address:r.tokenAddress},l=vM(r.amount,0),p=VI.connect(r.tokenAddress,t),e.next=12,p.populateTransaction.approve(s.ethConfiguration.coreContractAddress,l);case 12:return h=e.sent,e.next=15,t.sendTransaction(h);case 15:return m={user:f,token:{type:r.type,data:d},amount:l.toString()},e.next=18,n.getSignableDeposit({getSignableDepositRequest:m});case 18:return b=e.sent,e.next=21,o.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type,data:{token_address:r.tokenAddress}}}});case 21:return y=e.sent,g=y.data.asset_type,v=b.data.stark_key,w=b.data.vault_id,_=DP.from(b.data.amount),E=$I.connect(s.ethConfiguration.coreContractAddress,t),T=aC.connect(s.ethConfiguration.registrationContractAddress,t),e.next=30,hP(v,T);case 30:if(e.sent){e.next=35;break}return e.abrupt("return",IM(t,_,g,v,w,E,i));case 35:return e.abrupt("return",RM(t,_,g,v,w,E));case 36:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function MM(e,t,r,n,i,a){return BM.apply(this,arguments)}function BM(){return(BM=fC(pC.mark((function e(t,r,n,i,a,o){var s;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction.depositNft(i,n,a,r);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(s));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function DM(e,t,r,n,i,a){return FM.apply(this,arguments)}function FM(){return(FM=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u,c,d,l,p,h,m,b,y,g,v,w;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,f={token_address:r.tokenAddress,token_id:r.tokenId},u={user:s,token:{type:r.type,data:f},amount:"1".toString()},e.next=8,n.getSignableDeposit({getSignableDepositRequest:u});case 8:return c=e.sent,e.next=11,a.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type,data:{token_address:r.tokenAddress,token_id:r.tokenId}}}});case 11:return d=e.sent,l=d.data.asset_type,p=c.data.stark_key,h=c.data.vault_id,m=$I.connect(o.ethConfiguration.coreContractAddress,t),b=aC.connect(o.ethConfiguration.registrationContractAddress,t),e.next=19,hP(p,b);case 19:return y=e.sent,g=KI.connect(r.tokenAddress,t),v=o.ethConfiguration.coreContractAddress,e.next=24,g.isApprovedForAll(s,v);case 24:if(e.sent){e.next=28;break}return e.next=28,g.setApprovalForAll(v,!0);case 28:if(y){e.next=34;break}return e.next=31,bP(s,p,i);case 31:return w=e.sent,e.next=34,m.registerUser(s,p,w.operator_signature);case 34:return e.abrupt("return",MM(t,r.tokenId,l,p,h,m));case 35:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var LM=function(e){if(void 0!==e)return e;throw new Error("undefined field exception")};function UM(e){return jM.apply(this,arguments)}function jM(){return(jM=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p,h;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.withdrawalsApi,a="ERC721"===t.type?"1":t.amount,e.t0=i,e.next=5,r.getAddress();case 5:return e.t1=e.sent,e.t2=cM(t),e.t3=a,e.t4={user:e.t1,token:e.t2,amount:e.t3},e.t5={getSignableWithdrawalRequest:e.t4},e.next=12,e.t0.getSignableWithdrawal.call(e.t0,e.t5);case 12:return o=e.sent,s=o.data,f=s.signable_message,u=s.payload_hash,e.next=16,n.signMessage(u);case 16:return c=e.sent,e.next=19,_C(f,r);case 19:return d=e.sent,l=d.ethAddress,p=d.ethSignature,e.next=24,i.createWithdrawal({createWithdrawalRequest:{stark_key:LM(o.data.stark_key),amount:a,asset_id:LM(o.data.asset_id),vault_id:LM(o.data.vault_id),nonce:LM(o.data.nonce),stark_signature:c},xImxEthAddress:l,xImxEthSignature:p});case 24:return h=e.sent,e.abrupt("return",h.data);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function zM(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qM(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function HM(e,t,r,n){return VM.apply(this,arguments)}function VM(){return(VM=fC(pC.mark((function e(t,r,n,i){var a;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.encodeAsset({assetType:t,encodeAssetRequest:{token:zM({type:r},i&&{data:i})}});case 2:return a=e.sent,e.abrupt("return",a.data);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function GM(e,t,r,n,i){return KM.apply(this,arguments)}function KM(){return(KM=fC(pC.mark((function e(t,r,n,i,a){var o,s,f;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return o=e.sent,e.next=5,bP(o,n,a);case 5:return s=e.sent,e.next=8,i.populateTransaction.registerAndWithdraw(o,n,s.operator_signature,r);case 8:return f=e.sent,e.abrupt("return",t.sendTransaction(f));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function WM(e,t,r,n){return XM.apply(this,arguments)}function XM(){return(XM=fC(pC.mark((function e(t,r,n,i){var a;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.populateTransaction.withdraw(n,r);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(a));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $M(e,t,r,n,i,a){return JM.apply(this,arguments)}function JM(){return(JM=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,HM("asset","ERC20",i,{token_address:n.tokenAddress});case 2:return s=e.sent,f=$I.connect(o.ethConfiguration.coreContractAddress,t),u=aC.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,hP(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",GM(t,s.asset_type,r,u,a));case 12:return e.abrupt("return",WM(t,s.asset_type,r,f));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function YM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function QM(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?YM(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ZM(e,t,r,n,i){return eB.apply(this,arguments)}function eB(){return(eB=fC(pC.mark((function e(t,r,n,i,a){var o;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.populateTransaction.withdrawAndMint(n,r,i);case 2:return o=e.sent,e.abrupt("return",t.sendTransaction(o));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tB(e,t,r,n,i,a){return rB.apply(this,arguments)}function rB(){return(rB=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,e.next=5,bP(s,n,o);case 5:return f=e.sent,e.next=8,a.populateTransaction.regsiterAndWithdrawAndMint(s,n,f.operator_signature,r,i);case 8:return u=e.sent,e.abrupt("return",t.sendTransaction(u));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nB(e){var t=e.data.id,r=e.data.blueprint||"";return My(dy("{".concat(t,"}:{").concat(r,"}")))}function iB(e,t,r,n,i,a){return aB.apply(this,arguments)}function aB(){return(aB=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u,c;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,HM("mintable-asset","ERC721",i,QM({id:n.data.id,token_address:n.data.tokenAddress},n.data.blueprint&&{blueprint:n.data.blueprint}));case 2:return s=e.sent,f=nB(n),u=$I.connect(o.ethConfiguration.coreContractAddress,t),c=aC.connect(o.ethConfiguration.registrationContractAddress,t),e.next=8,hP(r,c);case 8:if(e.sent){e.next=13;break}return e.abrupt("return",tB(t,s.asset_type,r,f,c,a));case 13:return e.abrupt("return",ZM(t,s.asset_type,r,f,u));case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oB(e,t,r,n,i,a){return sB.apply(this,arguments)}function sB(){return(sB=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,e.next=5,bP(s,n,o);case 5:return f=e.sent,e.next=8,a.populateTransaction.registerAndWithdrawNft(s,n,f.operator_signature,r,i);case 8:return u=e.sent,e.abrupt("return",t.sendTransaction(u));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fB(e,t,r,n,i){return uB.apply(this,arguments)}function uB(){return(uB=fC(pC.mark((function e(t,r,n,i,a){var o;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.populateTransaction.withdrawNft(n,r,i);case 2:return o=e.sent,e.abrupt("return",t.sendTransaction(o));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cB(e,t,r,n,i,a){return dB.apply(this,arguments)}function dB(){return(dB=fC(pC.mark((function e(t,r,n,i,a,o){var s,f,u;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,HM("asset","ERC721",i,{token_id:n.tokenId,token_address:n.tokenAddress});case 2:return s=e.sent,f=$I.connect(o.ethConfiguration.coreContractAddress,t),u=aC.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,hP(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",oB(t,s.asset_type,r,n.tokenId,u,a));case 12:return e.abrupt("return",fB(t,s.asset_type,r,n.tokenId,f));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lB(e,t,r,n,i,a,o){return pB.apply(this,arguments)}function pB(){return(pB=fC(pC.mark((function e(t,r,n,i,a,o,s){var f,u;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f=n.tokenAddress,u=n.tokenId,e.next=4,a.getMintableTokenDetailsByClientTokenId({tokenAddress:f,tokenId:u}).then((function(e){return iB(t,r,{type:"ERC721",data:{id:u,tokenAddress:f,blueprint:e.data.blueprint}},i,o,s)})).catch((function(e){var a;if(404===(null===(a=e.response)||void 0===a?void 0:a.status))return cB(t,r,n,i,o,s);throw e}));case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function hB(e,t,r,n,i){return mB.apply(this,arguments)}function mB(){return(mB=fC(pC.mark((function e(t,r,n,i,a){var o,s,f;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return o=e.sent,e.next=5,bP(o,n,a);case 5:return s=e.sent,e.next=8,i.populateTransaction.registerAndWithdraw(o,n,s.operator_signature,r);case 8:return f=e.sent,e.abrupt("return",t.sendTransaction(f));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bB(e,t,r,n){return yB.apply(this,arguments)}function yB(){return(yB=fC(pC.mark((function e(t,r,n,i){var a;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.populateTransaction.withdraw(n,r);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(a));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gB(e,t,r,n,i){return vB.apply(this,arguments)}function vB(){return(vB=fC(pC.mark((function e(t,r,n,i,a){var o,s,f;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,HM("asset","ETH",n);case 2:return o=e.sent,s=$I.connect(a.ethConfiguration.coreContractAddress,t),f=aC.connect(a.ethConfiguration.registrationContractAddress,t),e.next=7,hP(r,f);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",hB(t,o.asset_type,r,f,i));case 12:return e.abrupt("return",bB(t,o.asset_type,r,s));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wB(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _B(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wB(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wB(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function EB(e){return TB.apply(this,arguments)}function TB(){return(TB=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p,h,m,b,y,g;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.ordersApi,e.next=3,r.getAddress();case 3:return o=e.sent,s="ERC721"===i.sell.type?"1":i.sell.amount,f="ERC721"===i.buy.type?"1":i.buy.amount,u={user:o,amount_buy:f,token_buy:cM(i.buy),amount_sell:s,token_sell:cM(i.sell),fees:i.fees,expiration_timestamp:i.expiration_timestamp,split_fees:!0},e.next=9,a.getSignableOrder({getSignableOrderRequestV3:u});case 9:return c=e.sent,d=c.data,l=d.signable_message,p=d.payload_hash,e.next=13,yC(l,r);case 13:return h=e.sent,e.next=16,n.signMessage(p);case 16:return m=e.sent,b=c.data,y={createOrderRequest:{amount_buy:b.amount_buy,amount_sell:b.amount_sell,asset_id_buy:b.asset_id_buy,asset_id_sell:b.asset_id_sell,expiration_timestamp:b.expiration_timestamp,include_fees:!0,fees:i.fees,nonce:b.nonce,stark_key:b.stark_key,stark_signature:m,vault_id_buy:b.vault_id_buy,vault_id_sell:b.vault_id_sell},xImxEthAddress:o,xImxEthSignature:h},e.next=21,a.createOrderV3(y);case 21:return g=e.sent,e.abrupt("return",_B({},g.data));case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function AB(e){return SB.apply(this,arguments)}function SB(){return(SB=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.ordersApi,e.next=3,a.getSignableCancelOrderV3({getSignableCancelOrderRequest:{order_id:i.order_id}});case 3:return o=e.sent,s=o.data,f=s.signable_message,u=s.payload_hash,e.next=7,yC(f,r);case 7:return c=e.sent,e.next=10,n.signMessage(u);case 10:return d=e.sent,e.next=13,r.getAddress();case 13:return l=e.sent,e.next=16,a.cancelOrderV3({id:i.order_id.toString(),cancelOrderRequest:{order_id:i.order_id,stark_signature:d},xImxEthAddress:l,xImxEthSignature:c});case 16:return p=e.sent,e.abrupt("return",{order_id:p.data.order_id,status:p.data.status});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kB(e){return OB.apply(this,arguments)}function OB(){return(OB=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,a=t.tradesApi,e.next=3,r.getAddress();case 3:return o=e.sent,e.next=6,a.getSignableTrade({getSignableTradeRequest:{user:o,order_id:i.order_id,fees:i.fees}});case 6:return s=e.sent,f=s.data,u=f.signable_message,c=f.payload_hash,e.next=10,yC(u,r);case 10:return d=e.sent,e.next=13,n.signMessage(c);case 13:return l=e.sent,e.next=16,a.createTradeV3({createTradeRequest:{amount_buy:s.data.amount_buy,amount_sell:s.data.amount_sell,asset_id_buy:s.data.asset_id_buy,asset_id_sell:s.data.asset_id_sell,expiration_timestamp:s.data.expiration_timestamp,fee_info:s.data.fee_info,fees:i.fees,include_fees:!0,nonce:s.data.nonce,order_id:i.order_id,stark_key:s.data.stark_key,vault_id_buy:s.data.vault_id_buy,vault_id_sell:s.data.vault_id_sell,stark_signature:l},xImxEthAddress:o,xImxEthSignature:d});case 16:return p=e.sent,e.abrupt("return",p.data);case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function RB(e){return xB.apply(this,arguments)}function xB(){return(xB=fC(pC.mark((function e(t){var r,n,i,a,o,s,f,u,c,d,l,p,h,m,b;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ethSigner,i=t.starkSigner,a=t.request,o=t.exchangesApi,e.next=3,n.getAddress();case 3:return s=e.sent,f=a.amount,e.next=7,o.getExchangeSignableTransfer({id:a.transactionID,getSignableTransferRequest:{sender:s,token:cM(a),amount:f,receiver:a.receiver}});case 7:return u=e.sent,c=u.data,d=c.signable_message,l=c.payload_hash,e.next=11,yC(d,n);case 11:return p=e.sent,e.next=14,i.signMessage(l);case 14:return h=e.sent,m={sender_stark_key:u.data.sender_stark_key,sender_vault_id:u.data.sender_vault_id,receiver_stark_key:u.data.receiver_stark_key,receiver_vault_id:u.data.receiver_vault_id,asset_id:u.data.asset_id,amount:u.data.amount,nonce:u.data.nonce,expiration_timestamp:u.data.expiration_timestamp,stark_signature:h},e.next=18,o.createExchangeTransfer({id:a.transactionID,createTransferRequest:m,xImxEthAddress:s,xImxEthSignature:p});case 18:return b=e.sent,e.abrupt("return",{sent_signature:null==b?void 0:b.data.sent_signature,status:null==b||null===(r=b.data.status)||void 0===r?void 0:r.toString(),time:null==b?void 0:b.data.time,transfer_id:null==b?void 0:b.data.transfer_id});case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function IB(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function CB(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?IB(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):IB(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var NB=function(){function e(t){UI(this,e),this.config=t;var r=t.apiConfiguration;this.config=t,this.depositsApi=new lN(r),this.encodingApi=new bN(r),this.mintsApi=new NN(r),this.ordersApi=new jN(r),this.tokensApi=new XN(r),this.tradesApi=new QN(r),this.transfersApi=new rP(r),this.usersApi=new oP(r),this.withdrawalsApi=new cP(r),this.projectsApi=new VN(r),this.collectionsApi=new fN(r),this.metadataApi=new AN(r),this.metadataRefreshesApi=new RN(r),this.exchangesApi=new wN(r)}var t,r,n,i,a,o,s,f,u,c,d,l,p,h,m,b,y,g,v,w,_,E,T,A,S,k,O,R;return qI(e,[{key:"isChainValid",value:function(e){return e===this.config.ethConfiguration.chainID}},{key:"validateChain",value:(R=fC(pC.mark((function e(t){var r;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getChainId();case 2:if(r=e.sent,this.isChainValid(r)){e.next=5;break}throw new Error("The wallet used for this operation is not from the correct network.");case 5:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"registerOffchain",value:(O=fC(pC.mark((function e(t){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",lP(CB(CB({},t),{},{usersApi:this.usersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"isRegisteredOnchain",value:(k=fC(pC.mark((function e(t){var r,n;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return r=aC.connect(this.config.ethConfiguration.registrationContractAddress,t.ethSigner),e.next=5,t.starkSigner.getAddress();case 5:return n=e.sent,e.abrupt("return",hP(n,r));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"mint",value:(S=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",fM(t,r,this.mintsApi));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"transfer",value:(A=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",pM(CB(CB({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"exchangeTransfer",value:(T=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",RB(CB(CB({},t),{},{request:r,exchangesApi:this.exchangesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"batchNftTransfer",value:(E=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",mM(CB(CB({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"deposit",value:(_=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=r.type,e.next="ETH"===e.t0?3:"ERC20"===e.t0?4:"ERC721"===e.t0?5:6;break;case 3:return e.abrupt("return",this.depositEth(t,r));case 4:return e.abrupt("return",this.depositERC20(t,r));case 5:return e.abrupt("return",this.depositERC721(t,r));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"depositEth",value:(w=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",kM(t,r,this.depositsApi,this.usersApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"depositERC20",value:(v=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",NM(t,r,this.depositsApi,this.usersApi,this.tokensApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"depositERC721",value:(g=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",DM(t,r,this.depositsApi,this.usersApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"prepareWithdrawal",value:(y=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",UM(CB(CB(CB({},t),r),{},{withdrawalsApi:this.withdrawalsApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"completeWithdrawal",value:function(e,t,r){switch(r.type){case"ETH":return this.completeEthWithdrawal(e,t);case"ERC20":return this.completeERC20Withdrawal(e,t,r);case"ERC721":return this.completeERC721Withdrawal(e,t,r)}}},{key:"completeEthWithdrawal",value:(b=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",gB(t,r,this.encodingApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"completeERC20Withdrawal",value:(m=fC(pC.mark((function e(t,r,n){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",$M(t,r,n,this.encodingApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return m.apply(this,arguments)})},{key:"completeERC721Withdrawal",value:function(){var e=fC(pC.mark((function e(t,r,n){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",lB(t,r,n,this.encodingApi,this.mintsApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"createOrder",value:(h=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",EB(CB(CB({},t),{},{request:r,ordersApi:this.ordersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"cancelOrder",value:(p=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",AB(CB(CB({},t),{},{request:r,ordersApi:this.ordersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"createTrade",value:(l=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",kB(CB(CB({},t),{},{request:r,tradesApi:this.tradesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"createProject",value:(d=fC(pC.mark((function e(t,r){var n;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return n=e.sent,e.abrupt("return",this.projectsApi.createProject({iMXSignature:n.signature,iMXTimestamp:n.timestamp,createProjectRequest:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"getProject",value:(c=fC(pC.mark((function e(t,r){var n;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return n=e.sent,e.abrupt("return",this.projectsApi.getProject({id:r,iMXSignature:n.signature,iMXTimestamp:n.timestamp}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"getProjects",value:(u=fC(pC.mark((function e(t,r,n,i,a){var o;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return o=e.sent,e.abrupt("return",this.projectsApi.getProjects({iMXSignature:o.signature,iMXTimestamp:o.timestamp,pageSize:r,cursor:n,orderBy:i,direction:a}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return u.apply(this,arguments)})},{key:"createCollection",value:(f=fC(pC.mark((function e(t,r){var n;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return n=e.sent,e.abrupt("return",this.collectionsApi.createCollection({iMXSignature:n.signature,iMXTimestamp:n.timestamp,createCollectionRequest:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"updateCollection",value:(s=fC(pC.mark((function e(t,r,n){var i;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return i=e.sent,e.abrupt("return",this.collectionsApi.updateCollection({iMXSignature:i.signature,iMXTimestamp:i.timestamp,address:r,updateCollectionRequest:n}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return s.apply(this,arguments)})},{key:"addMetadataSchemaToCollection",value:(o=fC(pC.mark((function e(t,r,n){var i;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return i=e.sent,e.abrupt("return",this.metadataApi.addMetadataSchemaToCollection({iMXSignature:i.signature,iMXTimestamp:i.timestamp,addMetadataSchemaToCollectionRequest:n,address:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return o.apply(this,arguments)})},{key:"updateMetadataSchemaByName",value:(a=fC(pC.mark((function e(t,r,n,i){var a;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return a=e.sent,e.abrupt("return",this.metadataApi.updateMetadataSchemaByName({iMXSignature:a.signature,iMXTimestamp:a.timestamp,address:r,name:n,metadataSchemaRequest:i}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return a.apply(this,arguments)})},{key:"listMetadataRefreshes",value:(i=fC(pC.mark((function e(t,r,n,i){var a,o;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return a=e.sent,e.next=5,t.getAddress();case 5:return o=e.sent,e.abrupt("return",this.metadataRefreshesApi.getAListOfMetadataRefreshes({xImxEthSignature:a.signature,xImxEthTimestamp:a.timestamp,xImxEthAddress:o,collectionAddress:r,pageSize:n,cursor:i}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return i.apply(this,arguments)})},{key:"getMetadataRefreshErrors",value:(n=fC(pC.mark((function e(t,r,n,i){var a,o;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return a=e.sent,e.next=5,t.getAddress();case 5:return o=e.sent,e.abrupt("return",this.metadataRefreshesApi.getMetadataRefreshErrors({xImxEthSignature:a.signature,xImxEthTimestamp:a.timestamp,xImxEthAddress:o,refreshId:r,pageSize:n,cursor:i}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"getMetadataRefreshResults",value:(r=fC(pC.mark((function e(t,r){var n,i;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return n=e.sent,e.next=5,t.getAddress();case 5:return i=e.sent,e.abrupt("return",this.metadataRefreshesApi.getMetadataRefreshResults({xImxEthSignature:n.signature,xImxEthTimestamp:n.timestamp,xImxEthAddress:i,refreshId:r}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"createMetadataRefresh",value:(t=fC(pC.mark((function e(t,r){var n,i;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vC(t);case 2:return n=e.sent,e.next=5,t.getAddress();case 5:return i=e.sent,e.abrupt("return",this.metadataRefreshesApi.requestAMetadataRefresh({xImxEthSignature:n.signature,xImxEthTimestamp:n.timestamp,xImxEthAddress:i,createMetadataRefreshRequest:r}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}();var PB=function(e){ZI(r,LC(Error));var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=JI(e);if(t){var i=JI(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return rC(this,r)}}(r);function r(e){var n,i=e.code,a=e.details,o=e.message;return UI(this,r),(n=t.call(this,o)).code=i,n.details=a,n}return qI(r)}();function MB(e){if(LI.isAxiosError(e)&&e.response){var t,r,n,i=e.response.data;return i.code&&i.message?new PB({code:i.code,details:i.details,message:i.message}):new PB({code:null!==(t=null!==(r=e.code)&&void 0!==r?r:null===(n=e.response)||void 0===n?void 0:n.status.toString())&&void 0!==t?t:"unknown_error_code",message:String(e)})}return new PB({code:"unknown_error_code",message:String(e)})}var BB=function(){function e(t){UI(this,e),this.depositsApi=new lN(t.apiConfiguration),this.mintsApi=new NN(t.apiConfiguration),this.ordersApi=new jN(t.apiConfiguration),this.tokensApi=new XN(t.apiConfiguration),this.tradesApi=new QN(t.apiConfiguration),this.transfersApi=new rP(t.apiConfiguration),this.exchangeApi=new wN(t.apiConfiguration),this.usersApi=new oP(t.apiConfiguration),this.withdrawalsApi=new cP(t.apiConfiguration),this.balanceApi=new iN(t.apiConfiguration),this.assetApi=new eN(t.apiConfiguration),this.collectionApi=new fN(t.apiConfiguration),this.metadataApi=new AN(t.apiConfiguration),this.metadataRefreshesApi=new RN(t.apiConfiguration),this.nftCheckoutPrimaryApi=new DN(t.apiConfiguration),this.projectsApi=new VN(t.apiConfiguration),this.workflows=new NB(t)}var t,r,n;return qI(e,[{key:"deposit",value:function(e,t){return this.workflows.deposit(e,t).catch((function(e){throw MB(e)}))}},{key:"getDeposit",value:function(e){return this.depositsApi.getDeposit(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listDeposits",value:function(e){return this.depositsApi.listDeposits(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"registerOffchain",value:function(e){return this.workflows.registerOffchain(e).catch((function(e){throw MB(e)}))}},{key:"isRegisteredOnchain",value:function(e){return this.workflows.isRegisteredOnchain(e).catch((function(e){throw MB(e)}))}},{key:"getUser",value:function(e){return this.usersApi.getUsers({user:e}).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getAsset",value:function(e){return this.assetApi.getAsset(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listAssets",value:function(e){return this.assetApi.listAssets(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"createCollection",value:function(e,t){return this.workflows.createCollection(e,t).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getCollection",value:function(e){return this.collectionApi.getCollection(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listCollectionFilters",value:function(e){return this.collectionApi.listCollectionFilters(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listCollections",value:function(e){return this.collectionApi.listCollections(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"updateCollection",value:function(e,t,r){return this.workflows.updateCollection(e,t,r).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"addMetadataSchemaToCollection",value:function(e,t,r){return this.workflows.addMetadataSchemaToCollection(e,t,r).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getMetadataSchema",value:function(e){return this.metadataApi.getMetadataSchema(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"updateMetadataSchemaByName",value:function(e,t,r,n){return this.workflows.updateMetadataSchemaByName(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listMetadataRefreshes",value:function(e,t,r,n){return this.workflows.listMetadataRefreshes(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getMetadataRefreshErrors",value:function(e,t,r,n){return this.workflows.getMetadataRefreshErrors(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getMetadataRefreshResults",value:function(e,t){return this.workflows.getMetadataRefreshResults(e,t).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"createMetadataRefresh",value:function(e,t){return this.workflows.createMetadataRefresh(e,t).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"createProject",value:(n=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.createProject(t,r).then((function(e){return e.data})).catch((function(e){throw MB(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getProject",value:(r=fC(pC.mark((function e(t,r){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.getProject(t,r).then((function(e){return e.data})).catch((function(e){throw MB(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getProjects",value:(t=fC(pC.mark((function e(t,r,n,i,a){return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.getProjects(t,r,n,i,a).then((function(e){return e.data})).catch((function(e){throw MB(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r,n,i,a){return t.apply(this,arguments)})},{key:"getBalance",value:function(e){return this.balanceApi.getBalance(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listBalances",value:function(e){return this.balanceApi.listBalances(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getMint",value:function(e){return this.mintsApi.getMint(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listMints",value:function(e){return this.mintsApi.listMints(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"mint",value:function(e,t){return this.workflows.mint(e,t).catch((function(e){throw MB(e)}))}},{key:"listWithdrawals",value:function(e){return this.withdrawalsApi.listWithdrawals(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getWithdrawal",value:function(e){return this.withdrawalsApi.getWithdrawal(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"prepareWithdrawal",value:function(e,t){return this.workflows.prepareWithdrawal(e,t).catch((function(e){throw MB(e)}))}},{key:"completeWithdrawal",value:function(e,t,r){return this.workflows.completeWithdrawal(e,t,r).catch((function(e){throw MB(e)}))}},{key:"getOrder",value:function(e){return this.ordersApi.getOrderV3(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listOrders",value:function(e){return this.ordersApi.listOrdersV3(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"createOrder",value:function(e,t){return this.workflows.createOrder(e,t).catch((function(e){throw MB(e)}))}},{key:"cancelOrder",value:function(e,t){return this.workflows.cancelOrder(e,t).catch((function(e){throw MB(e)}))}},{key:"getTrade",value:function(e){return this.tradesApi.getTrade(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listTrades",value:function(e){return this.tradesApi.listTradesV3(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"createTrade",value:function(e,t){return this.workflows.createTrade(e,t).catch((function(e){throw MB(e)}))}},{key:"getToken",value:function(e){return this.tokensApi.getToken(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listTokens",value:function(e){return this.tokensApi.listTokens(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"getTransfer",value:function(e){return this.transfersApi.getTransfer(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"listTransfers",value:function(e){return this.transfersApi.listTransfers(e).then((function(e){return e.data})).catch((function(e){throw MB(e)}))}},{key:"transfer",value:function(e,t){return this.workflows.transfer(e,t).catch((function(e){throw MB(e)}))}},{key:"batchNftTransfer",value:function(e,t){return this.workflows.batchNftTransfer(e,t).catch((function(e){throw MB(e)}))}},{key:"createExchange",value:function(e){return this.exchangeApi.createExchange(e).catch((function(e){throw MB(e)}))}},{key:"getExchange",value:function(e){return this.exchangeApi.getExchange(e).catch((function(e){throw MB(e)}))}},{key:"getExchanges",value:function(e){return this.exchangeApi.getExchanges(e).catch((function(e){throw MB(e)}))}},{key:"exchangeTransfer",value:function(e,t){return this.workflows.exchangeTransfer(e,t).catch((function(e){throw MB(e)}))}},{key:"createNftPrimary",value:function(e){return this.nftCheckoutPrimaryApi.createNftPrimary(e).catch((function(e){throw MB(e)}))}},{key:"getCurrenciesNFTCheckoutPrimary",value:function(e){return this.nftCheckoutPrimaryApi.getCurrenciesNFTCheckoutPrimary(e).catch((function(e){throw MB(e)}))}},{key:"getNftPrimaryTransaction",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransaction(e).catch((function(e){throw MB(e)}))}},{key:"getNftPrimaryTransactions",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransactions(e).catch((function(e){throw MB(e)}))}}]),e}();function DB(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function FB(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?DB(Object(r),!0).forEach((function(t){zI(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):DB(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var LB={"x-sdk-version":"imx-core-sdk-ts-".concat("2.0.2")},UB=function(e){var t=e.coreContractAddress,r=e.registrationContractAddress,n=e.chainID,i=e.basePath,a=e.headers,o=e.sdkVersion;if(!i.trim())throw Error("basePath can not be empty");return o&&(LB["x-sdk-version"]=o),a=FB(FB({},a||{}),LB),{apiConfiguration:new dP({basePath:i,baseOptions:{headers:a}}),ethConfiguration:{coreContractAddress:t,registrationContractAddress:r,chainID:n}}},jB={get PRODUCTION(){return UB({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"})},get SANDBOX(){return UB({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"})},createConfig:UB},qB=new li("08000000 00000010 ffffffff ffffffff b781126d cae7b232 1e66a241 adc64d2f",16);new Fy.ec(new Fy.curves.PresetCurve({type:"short",prime:null,p:"08000000 00000011 00000000 00000000 00000000 00000000 00000000 00000001",a:"00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001",b:"06f21413 efbe40de 150e596d 72f7a8c5 609ad26c 15c915c1 f4cdfcb9 9cee9e89",n:qB.toString("hex"),hash:Xc.sha256,gRed:!1,g:["1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca","5668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"]}));var zB=function(){var e=new li("1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000",16);return e.sub(e.mod(qB))};function HB(e,t){return new li(Xc.sha256().update(ay(Cy(e)+Oy(ly(t),2))).digest("hex"),16)}function VB(e){for(var t=zB(),r=HB(e.toString("hex",64),0),n=0;r.gte(t);n++)r=HB(r.toString("hex"),n);return r.umod(qB).toString("hex")}function GB(e){for(var t=zB(),r=HB(e.toString("hex",64),0),n=1;r.gte(t);n++)r=HB(r.toString("hex"),n);return r.umod(qB).toString("hex")}function KB(e){var t=zB();return HB(e.toString("hex",64),0).gte(t)}function WB(e){return XB.apply(this,arguments)}function XB(){return(XB=fC(pC.mark((function e(t){var r,n;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=new BB(jB.PRODUCTION),e.next=4,r.getUser(t);case 4:if(!((n=e.sent).accounts.length>0)){e.next=7;break}return e.abrupt("return",{starkPublicKey:n.accounts[0],accountNotFound:!1});case 7:e.next=14;break;case 9:if(e.prev=9,e.t0=e.catch(0),!(e.t0 instanceof PB&&"account_not_found"==e.t0.code)){e.next=13;break}return e.abrupt("return",{starkPublicKey:"",accountNotFound:!0});case 13:throw e.t0;case 14:case"end":return e.stop()}}),e,null,[[0,9]])})))).apply(this,arguments)}function $B(e,t){var r=ZR.hdkey.fromMasterSeed(Buffer.from(e.slice(2),"hex")).derivePath(t).getWallet().getPrivateKey();return new li(r)}function JB(e,t,r){return YB.apply(this,arguments)}function YB(){return(YB=fC(pC.mark((function e(t,r,n){var i,a,o,s,f,u,c,d;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=$B(t,r),a=GB(i),KB(i)){e.next=4;break}return e.abrupt("return",a);case 4:return e.next=6,WB(n);case 6:if(void 0!==(o=e.sent)){e.next=9;break}throw new Error("Error fetching stark public key from IMX");case 9:if(!o.accountNotFound){e.next=11;break}return e.abrupt("return",a);case 11:return s=new li(Cy(o.starkPublicKey),16),e.next=14,DC(a).getAddress();case 14:if(f=e.sent,!s.eq(new li(Cy(f),16))){e.next=17;break}return e.abrupt("return",a);case 17:return u=VB(i),e.next=20,DC(u).getAddress();case 20:if(f=e.sent,!s.eq(new li(Cy(f),16))){e.next=23;break}return e.abrupt("return",u);case 23:return c=MC(t,r),d=PC(c),e.next=27,DC(d).getAddress();case 27:if(f=e.sent,!s.eq(new li(Cy(f),16))){e.next=30;break}return e.abrupt("return",d);case 30:throw new Error("Can not deterministically generate stark private key - please contact support");case 31:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function QB(e){return ZB.apply(this,arguments)}function ZB(){return(ZB=fC(pC.mark((function e(t){var r,n,i,a,o;return pC.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return r=e.sent.toLowerCase(),e.next=5,t.signMessage("Only sign this request if you’ve initiated an action with Immutable X.");case 5:return n=e.sent,i=Hi(n).s,a=CC("starkex","immutablex",r,"1"),e.next=10,JB(i,a,r);case 10:return o=e.sent,e.abrupt("return",o.padStart(64,"0"));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}CP.errors.INSUFFICIENT_FUNDS,CP.errors.NONCE_EXPIRED,CP.errors.REPLACEMENT_UNDERPRICED;const eD=({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n})=>jB.createConfig({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n,sdkVersion:"ts-immutable-sdk-0.4.1-alpha.1"}),tD=()=>eD({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"});class rD{immutableXConfig;baseConfig;constructor({baseConfig:t,overrides:r}){if(this.baseConfig=t,r)this.immutableXConfig=r.immutableXConfig;else switch(t.environment){case e.Environment.SANDBOX:this.immutableXConfig=tD();break;case e.Environment.PRODUCTION:this.immutableXConfig=eD({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"});break;default:this.immutableXConfig=tD()}}}class nD{immutableX;depositsApi;mintsApi;ordersApi;tokensApi;tradesApi;transfersApi;exchangeApi;nftCheckoutPrimaryApi;usersApi;withdrawalsApi;balanceApi;assetApi;collectionApi;metadataApi;metadataRefreshesApi;projectsApi;constructor(e){const t=new rD(e);this.immutableX=new BB(t.immutableXConfig),this.depositsApi=this.immutableX.depositsApi,this.mintsApi=this.immutableX.mintsApi,this.ordersApi=this.immutableX.ordersApi,this.tokensApi=this.immutableX.tokensApi,this.tradesApi=this.immutableX.tradesApi,this.transfersApi=this.immutableX.transfersApi,this.exchangeApi=this.immutableX.exchangeApi,this.usersApi=this.immutableX.usersApi,this.withdrawalsApi=this.immutableX.withdrawalsApi,this.balanceApi=this.immutableX.balanceApi,this.assetApi=this.immutableX.assetApi,this.collectionApi=this.immutableX.collectionApi,this.metadataApi=this.immutableX.metadataApi,this.metadataRefreshesApi=this.immutableX.metadataRefreshesApi,this.nftCheckoutPrimaryApi=this.immutableX.nftCheckoutPrimaryApi,this.projectsApi=this.immutableX.projectsApi}getDeposit(e){return this.immutableX.getDeposit(e)}listDeposits(e){return this.immutableX.listDeposits(e)}getUser(e){return this.immutableX.getUser(e)}getAsset(e){return this.immutableX.getAsset(e)}listAssets(e){return this.immutableX.listAssets(e)}createCollection(e,t){return this.immutableX.createCollection(e,t)}getCollection(e){return this.immutableX.getCollection(e)}listCollectionFilters(e){return this.immutableX.listCollectionFilters(e)}listCollections(e){return this.collectionApi.listCollections(e).then((e=>e.data))}updateCollection(e,t,r){return this.immutableX.updateCollection(e,t,r)}addMetadataSchemaToCollection(e,t,r){return this.immutableX.addMetadataSchemaToCollection(e,t,r)}getMetadataSchema(e){return this.immutableX.getMetadataSchema(e)}updateMetadataSchemaByName(e,t,r,n){return this.immutableX.updateMetadataSchemaByName(e,t,r,n)}listMetadataRefreshes(e,t,r,n){return this.immutableX.listMetadataRefreshes(e,t,r,n)}getMetadataRefreshErrors(e,t,r,n){return this.immutableX.getMetadataRefreshErrors(e,t,r,n)}getMetadataRefreshResults(e,t){return this.immutableX.getMetadataRefreshResults(e,t)}createMetadataRefresh(e,t){return this.immutableX.createMetadataRefresh(e,t)}async createProject(e,t){return this.immutableX.createProject(e,t)}async getProject(e,t){return this.immutableX.getProject(e,t)}async getProjects(e,t,r,n,i){return this.immutableX.getProjects(e,t,r,n,i)}getBalance(e){return this.immutableX.getBalance(e)}listBalances(e){return this.immutableX.listBalances(e)}getMint(e){return this.immutableX.getMint(e)}listMints(e){return this.immutableX.listMints(e)}mint(e,t){return this.immutableX.mint(e,t)}listWithdrawals(e){return this.immutableX.listWithdrawals(e)}getWithdrawal(e){return this.immutableX.getWithdrawal(e)}getOrder(e){return this.immutableX.getOrder(e)}listOrders(e){return this.immutableX.listOrders(e)}getTrade(e){return this.immutableX.getTrade(e)}listTrades(e){return this.immutableX.listTrades(e)}getToken(e){return this.immutableX.getToken(e)}listTokens(e){return this.immutableX.listTokens(e)}getTransfer(e){return this.immutableX.getTransfer(e)}listTransfers(e){return this.immutableX.listTransfers(e)}createExchange(e){return this.immutableX.createExchange(e).then((e=>e.data))}getExchange(e){return this.immutableX.getExchange(e).then((e=>e.data))}getExchanges(e){return this.immutableX.getExchanges(e).then((e=>e.data))}exchangeTransfer(e,t){return this.immutableX.exchangeTransfer(e,t)}createNftPrimary(e){return this.immutableX.createNftPrimary(e).then((e=>e.data))}getCurrenciesNFTCheckoutPrimary(e){return this.immutableX.getCurrenciesNFTCheckoutPrimary(e).then((e=>e.data))}getNftPrimaryTransaction(e){return this.immutableX.getNftPrimaryTransaction(e).then((e=>e.data))}getNftPrimaryTransactions(e){return this.immutableX.getNftPrimaryTransactions(e).then((e=>e.data))}}var iD={exports:{}};!function(e,t){e.exports=function(){var e=e||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==on&&on.crypto&&(r=on.crypto),!r)try{r=Gy}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},o=a.lib={},s=o.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},f=o.WordArray=s.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var o=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=o<<24-(n+a)%4*8}else for(var s=0;s<i;s+=4)t[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new f.init(t,e)}}),u=a.enc={},c=u.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new f.init(r,t/2)}},d=u.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new f.init(r,t)}},l=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,a=n.sigBytes,o=this.blockSize,s=a/(4*o),u=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*o,c=e.min(4*u,a);if(u){for(var d=0;d<u;d+=o)this._doProcessBlock(i,d);r=i.splice(0,u),n.sigBytes-=c}return new f.init(r,c)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});o.Hasher=p.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}});var h=a.algo={};return a}(Math);return e}()}(iD);var aD=iD.exports,oD=sn(aD),sD={exports:{}};!function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=[],f=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(s[i]=r(t.pow(n,.5))),f[i]=r(t.pow(n,1/3)),i++),n++}();var u=[],c=o.SHA256=a.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],c=r[5],d=r[6],l=r[7],p=0;p<64;p++){if(p<16)u[p]=0|e[t+p];else{var h=u[p-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,b=u[p-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;u[p]=m+u[p-7]+y+u[p-16]}var g=n&i^n&a^i&a,v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=l+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&c^~s&d)+f[p]+u[p];l=d,d=c,c=s,s=o+w|0,o=a,a=i,i=n,n=w+(v+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0,r[5]=r[5]+c|0,r[6]=r[6]+d|0,r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=a._createHelper(c),r.HmacSHA256=a._createHmacHelper(c)}(Math),e.SHA256}(aD)}(sD);var fD=sn(sD.exports),uD={exports:{}};!function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var i=[],a=0,o=0;o<t;o++)if(o%4){var s=n[e.charCodeAt(o-1)]<<o%4*2|n[e.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=s<<24-a%4*8,a++}return r.create(i,a)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],a=0;a<r;a+=3)for(var o=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<r;s++)i.push(n.charAt(o>>>6*(3-s)&63));var f=n.charAt(64);if(f)for(;i.length%4;)i.push(f);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<r.length;a++)i[r.charCodeAt(a)]=a}var o=r.charAt(64);if(o){var s=e.indexOf(o);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(aD)}(uD);var cD=sn(uD.exports),dD={exports:{}};!function(e,t){e.exports=function(e){return e.enc.Utf8}(aD)}(dD);var lD=sn(dD.exports);function pD(e){this.message=e}pD.prototype=new Error,pD.prototype.name="InvalidCharacterError";var hD="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new pD("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,a=0,o="";n=t.charAt(a++);~n&&(r=i%4?64*r+n:n,i++%4)?o+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return o};function mD(e){this.message=e}function bD(e,t){if("string"!=typeof e)throw new mD("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(hD(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return hD(t)}}(e.split(".")[r]))}catch(e){throw new mD("Invalid token specified: "+e.message)}}mD.prototype=new Error,mD.prototype.name="InvalidTokenError";var yD,gD,vD,wD={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},_D=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(_D||{});(vD=_D||(_D={})).reset=function(){yD=3,gD=wD},vD.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");yD=e},vD.setLogger=function(e){gD=e};var ED=class{constructor(e){this._name=e}debug(...e){yD>=4&&gD.debug(ED._format(this._name,this._method),...e)}info(...e){yD>=3&&gD.info(ED._format(this._name,this._method),...e)}warn(...e){yD>=2&&gD.warn(ED._format(this._name,this._method),...e)}error(...e){yD>=1&&gD.error(ED._format(this._name,this._method),...e)}throw(e){throw this.error(e),e}create(e){const t=Object.create(this);return t._method=e,t.debug("begin"),t}static createStatic(e,t){const r=new ED(`${e}.${t}`);return r.debug("begin"),r}static _format(e,t){const r=`[${e}]`;return t?`${r} ${t}:`:r}static debug(e,...t){yD>=4&&gD.debug(ED._format(e),...t)}static info(e,...t){yD>=3&&gD.info(ED._format(e),...t)}static warn(e,...t){yD>=2&&gD.warn(ED._format(e),...t)}static error(e,...t){yD>=1&&gD.error(ED._format(e),...t)}};_D.reset();var TD=class{static _randomWord(){return oD.lib.WordArray.random(1).words[0]}static generateUUIDv4(){const e="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^TD._randomWord()&15>>+e/4).toString(16)));return e.replace(/-/g,"")}static generateCodeVerifier(){return TD.generateUUIDv4()+TD.generateUUIDv4()+TD.generateUUIDv4()}static generateCodeChallenge(e){try{const t=fD(e);return cD.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(e){throw ED.error("CryptoUtils.generateCodeChallenge",e),e}}static generateBasicAuth(e,t){const r=lD.parse([e,t].join(":"));return cD.stringify(r)}},AD=class{constructor(e){this._name=e,this._logger=new ED(`Event('${this._name}')`),this._callbacks=[]}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){const t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}raise(...e){this._logger.debug("raise:",...e);for(const t of this._callbacks)t(...e)}},SD=class{static decode(e){try{return bD(e)}catch(e){throw ED.error("JwtUtils.decode",e),e}}},kD=class{static center({...e}){var t;return null==e.width&&(e.width=null!=(t=[800,720,600,480].find((e=>e<=window.outerWidth/1.618)))?t:360),null!=e.left||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),null!=e.height&&(null!=e.top||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter((([,e])=>null!=e)).map((([e,t])=>`${e}=${"boolean"!=typeof t?t:t?"yes":"no"}`)).join(",")}},OD=class extends AD{constructor(){super(...arguments),this._logger=new ED(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const e=this._expiration-OD.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=OD.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(e){const t=this._logger.create("init");e=Math.max(Math.floor(e),1);const r=OD.getEpochTime()+e;if(this.expiration===r&&this._timerHandle)return void t.debug("skipping since already initialized for expiration at",this.expiration);this.cancel(),t.debug("using duration",e),this._expiration=r;const n=Math.min(e,5);this._timerHandle=setInterval(this._callback,1e3*n)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},RD=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");const r=new URL(e,"http://127.0.0.1")["fragment"===t?"hash":"search"];return new URLSearchParams(r.slice(1))}},xD=class extends Error{constructor(e,t){var r,n,i;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw ED.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=null!=(r=e.error_description)?r:null,this.error_uri=null!=(n=e.error_uri)?n:null,this.state=e.userState,this.session_state=null!=(i=e.session_state)?i:null}},ID=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},CD=class{constructor(e){this._logger=new ED("AccessTokenEvents"),this._expiringTimer=new OD("Access token expiring"),this._expiredTimer=new OD("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}load(e){const t=this._logger.create("load");if(e.access_token&&void 0!==e.expires_in){const r=e.expires_in;if(t.debug("access token present, remaining duration:",r),r>0){let e=r-this._expiringNotificationTimeInSeconds;e<=0&&(e=1),t.debug("registering expiring timer, raising in",e,"seconds"),this._expiringTimer.init(e)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const n=r+1;t.debug("registering expired timer, raising in",n,"seconds"),this._expiredTimer.init(n)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},ND=class{constructor(){this._logger=new ED("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},PD=class{constructor(e=[],t=null,r={}){this._jwtHandler=t,this._extraHeaders=r,this._logger=new ED("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){const{timeoutInSeconds:r,...n}=t;if(!r)return await fetch(e,n);const i=new AbortController,a=setTimeout((()=>i.abort()),1e3*r);try{return await fetch(e,{...t,signal:i.signal})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw new ID("Network timed out");throw e}finally{clearTimeout(a)}}async getJson(e,{token:t,credentials:r}={}){const n=this._logger.create("getJson"),i={Accept:this._contentTypes.join(", ")};let a;t&&(n.debug("token passed, setting Authorization header"),i.Authorization="Bearer "+t),this.appendExtraHeaders(i);try{n.debug("url:",e),a=await this.fetchWithTimeout(e,{method:"GET",headers:i,credentials:r})}catch(e){throw n.error("Network Error"),e}n.debug("HTTP response received, status",a.status);const o=a.headers.get("Content-Type");if(o&&!this._contentTypes.find((e=>o.startsWith(e)))&&n.throw(new Error(`Invalid response Content-Type: ${null!=o?o:"undefined"}, from URL: ${e}`)),a.ok&&this._jwtHandler&&(null==o?void 0:o.startsWith("application/jwt")))return await this._jwtHandler(await a.text());let s;try{s=await a.json()}catch(e){if(n.error("Error parsing JSON response",e),a.ok)throw e;throw new Error(`${a.statusText} (${a.status})`)}if(!a.ok){if(n.error("Error from server:",s),s.error)throw new xD(s);throw new Error(`${a.statusText} (${a.status}): ${JSON.stringify(s)}`)}return s}async postForm(e,{body:t,basicAuth:r,timeoutInSeconds:n,initCredentials:i}){const a=this._logger.create("postForm"),o={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"};let s;void 0!==r&&(o.Authorization="Basic "+r),this.appendExtraHeaders(o);try{a.debug("url:",e),s=await this.fetchWithTimeout(e,{method:"POST",headers:o,body:t,timeoutInSeconds:n,credentials:i})}catch(e){throw a.error("Network error"),e}a.debug("HTTP response received, status",s.status);const f=s.headers.get("Content-Type");if(f&&!this._contentTypes.find((e=>f.startsWith(e))))throw new Error(`Invalid response Content-Type: ${null!=f?f:"undefined"}, from URL: ${e}`);const u=await s.text();let c={};if(u)try{c=JSON.parse(u)}catch(e){if(a.error("Error parsing JSON response",e),s.ok)throw e;throw new Error(`${s.statusText} (${s.status})`)}if(!s.ok){if(a.error("Error from server:",c),c.error)throw new xD(c,t);throw new Error(`${s.statusText} (${s.status}): ${JSON.stringify(c)}`)}return c}appendExtraHeaders(e){const t=this._logger.create("appendExtraHeaders"),r=Object.keys(this._extraHeaders),n=["authorization","accept","content-type"];0!==r.length&&r.forEach((r=>{if(n.includes(r.toLocaleLowerCase()))return void t.warn("Protected header could not be overridden",r,n);const i="function"==typeof this._extraHeaders[r]?this._extraHeaders[r]():this._extraHeaders[r];i&&""!==i&&(e[r]=i)}))}},MD=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new ED("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){this._logger.create(`get('${e}')`),e=this._prefix+e;return await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;const t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");const e=await this._store.length,t=[];for(let r=0;r<e;r++){const e=await this._store.key(r);e&&0===e.indexOf(this._prefix)&&t.push(e.substr(this._prefix.length))}return t}},BD=class{constructor({authority:e,metadataUrl:t,metadata:r,signingKeys:n,metadataSeed:i,client_id:a,client_secret:o,response_type:s="code",scope:f="openid",redirect_uri:u,post_logout_redirect_uri:c,client_authentication:d="client_secret_post",prompt:l,display:p,max_age:h,ui_locales:m,acr_values:b,resource:y,response_mode:g="query",filterProtocolClaims:v=!0,loadUserInfo:w=!1,staleStateAgeInSeconds:_=900,clockSkewInSeconds:E=300,userInfoJwtIssuer:T="OP",mergeClaims:A=!1,disablePKCE:S=!1,stateStore:k,refreshTokenCredentials:O,revokeTokenAdditionalContentTypes:R,fetchRequestCredentials:x,refreshTokenAllowedScope:I,extraQueryParams:C={},extraTokenParams:N={},extraHeaders:P={}}){if(this.authority=e,t?this.metadataUrl=t:(this.metadataUrl=e,e&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=r,this.metadataSeed=i,this.signingKeys=n,this.client_id=a,this.client_secret=o,this.response_type=s,this.scope=f,this.redirect_uri=u,this.post_logout_redirect_uri=c,this.client_authentication=d,this.prompt=l,this.display=p,this.max_age=h,this.ui_locales=m,this.acr_values=b,this.resource=y,this.response_mode=g,this.filterProtocolClaims=null==v||v,this.loadUserInfo=!!w,this.staleStateAgeInSeconds=_,this.clockSkewInSeconds=E,this.userInfoJwtIssuer=T,this.mergeClaims=!!A,this.disablePKCE=!!S,this.revokeTokenAdditionalContentTypes=R,x&&O&&console.warn("Both fetchRequestCredentials and refreshTokenCredentials is set. Only fetchRequestCredentials will be used."),this.fetchRequestCredentials=x||(O||"same-origin"),k)this.stateStore=k;else{const e="undefined"!=typeof window?window.localStorage:new ND;this.stateStore=new MD({store:e})}this.refreshTokenAllowedScope=I,this.extraQueryParams=C,this.extraTokenParams=N,this.extraHeaders=P}},DD=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new ED("TokenClient"),this._jsonService=new PD(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:r=this._settings.client_id,client_secret:n=this._settings.client_secret,...i}){const a=this._logger.create("exchangeCode");r||a.throw(new Error("A client_id is required")),t||a.throw(new Error("A redirect_uri is required")),i.code||a.throw(new Error("A code is required"));const o=new URLSearchParams({grant_type:e,redirect_uri:t});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let s;switch(this._settings.client_authentication){case"client_secret_basic":if(!n)throw a.throw(new Error("A client_secret is required")),null;s=TD.generateBasicAuth(r,n);break;case"client_secret_post":o.append("client_id",r),n&&o.append("client_secret",n)}const f=await this._metadataService.getTokenEndpoint(!1);a.debug("got token endpoint");const u=await this._jsonService.postForm(f,{body:o,basicAuth:s,initCredentials:this._settings.fetchRequestCredentials});return a.debug("got response"),u}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,scope:n=this._settings.scope,...i}){const a=this._logger.create("exchangeCredentials");t||a.throw(new Error("A client_id is required"));const o=new URLSearchParams({grant_type:e,scope:n});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let s;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw a.throw(new Error("A client_secret is required")),null;s=TD.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r)}const f=await this._metadataService.getTokenEndpoint(!1);a.debug("got token endpoint");const u=await this._jsonService.postForm(f,{body:o,basicAuth:s,initCredentials:this._settings.fetchRequestCredentials});return a.debug("got response"),u}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,timeoutInSeconds:n,...i}){const a=this._logger.create("exchangeRefreshToken");t||a.throw(new Error("A client_id is required")),i.refresh_token||a.throw(new Error("A refresh_token is required"));const o=new URLSearchParams({grant_type:e});for(const[e,t]of Object.entries(i))null!=t&&o.set(e,t);let s;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw a.throw(new Error("A client_secret is required")),null;s=TD.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r)}const f=await this._metadataService.getTokenEndpoint(!1);a.debug("got token endpoint");const u=await this._jsonService.postForm(f,{body:o,basicAuth:s,timeoutInSeconds:n,initCredentials:this._settings.fetchRequestCredentials});return a.debug("got response"),u}async revoke(e){var t;const r=this._logger.create("revoke");e.token||r.throw(new Error("A token is required"));const n=await this._metadataService.getRevocationEndpoint(!1);r.debug(`got revocation endpoint, revoking ${null!=(t=e.token_type_hint)?t:"default token type"}`);const i=new URLSearchParams;for(const[t,r]of Object.entries(e))null!=r&&i.set(t,r);i.set("client_id",this._settings.client_id),this._settings.client_secret&&i.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(n,{body:i}),r.debug("got response")}},FD=class{constructor(e){this.id=e.id||TD.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=OD.getEpochTime(),this.request_type=e.request_type}toStorageString(){return new ED("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})}static fromStorageString(e){return ED.createStatic("State","fromStorageString"),new FD(JSON.parse(e))}static async clearStaleState(e,t){const r=ED.createStatic("State","clearStaleState"),n=OD.getEpochTime()-t,i=await e.getAllKeys();r.debug("got keys",i);for(let t=0;t<i.length;t++){const a=i[t],o=await e.get(a);let s=!1;if(o)try{const e=FD.fromStorageString(o);r.debug("got item from key:",a,e.created),e.created<=n&&(s=!0)}catch(e){r.error("Error parsing state for key:",a,e),s=!0}else r.debug("no item in storage for key:",a),s=!0;s&&(r.debug("removed item for key:",a),e.remove(a))}}},LD=class extends FD{constructor(e){super(e),!0===e.code_verifier?this.code_verifier=TD.generateCodeVerifier():e.code_verifier&&(this.code_verifier=e.code_verifier),this.code_verifier&&(this.code_challenge=TD.generateCodeChallenge(this.code_verifier)),this.authority=e.authority,this.client_id=e.client_id,this.redirect_uri=e.redirect_uri,this.scope=e.scope,this.client_secret=e.client_secret,this.extraTokenParams=e.extraTokenParams,this.response_mode=e.response_mode,this.skipUserInfo=e.skipUserInfo}toStorageString(){return new ED("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}static fromStorageString(e){ED.createStatic("SigninState","fromStorageString");const t=JSON.parse(e);return new LD(t)}},UD=class{constructor(e){this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-OD.getEpochTime()}set expires_in(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+OD.getEpochTime())}get isOpenId(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}},jD=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],qD=["sub","iss","aud","exp","iat"],zD=class{constructor(e){var t;this.id_token=e.id_token,this.session_state=null!=(t=e.session_state)?t:null,this.access_token=e.access_token,this.refresh_token=e.refresh_token,this.token_type=e.token_type,this.scope=e.scope,this.profile=e.profile,this.expires_at=e.expires_at,this.state=e.userState}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-OD.getEpochTime()}set expires_in(e){void 0!==e&&(this.expires_at=Math.floor(e)+OD.getEpochTime())}get expired(){const e=this.expires_in;if(void 0!==e)return e<=0}get scopes(){var e,t;return null!=(t=null==(e=this.scope)?void 0:e.split(" "))?t:[]}toStorageString(){return new ED("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(e){return ED.createStatic("User","fromStorageString"),new zD(JSON.parse(e))}},HD="oidc-client",VD=class{constructor(){this._abort=new AD("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){const t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);const{url:r,keepOpen:n}=await new Promise(((r,n)=>{const i=i=>{var a;const o=i.data,s=null!=(a=e.scriptOrigin)?a:window.location.origin;if(i.origin===s&&(null==o?void 0:o.source)===HD){try{const r=RD.readParams(o.url,e.response_mode).get("state");if(r||t.warn("no state found in response url"),i.source!==this._window&&r!==e.state)return}catch(e){this._dispose(),n(new Error("Invalid response from window"))}r(o)}};window.addEventListener("message",i,!1),this._disposeHandlers.add((()=>window.removeEventListener("message",i,!1))),this._disposeHandlers.add(this._abort.addHandler((e=>{this._dispose(),n(e)})))}));return t.debug("got response from window"),this._dispose(),n||this.close(),{url:r}}_dispose(){this._logger.create("_dispose");for(const e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,r=!1,n=window.location.origin){e.postMessage({source:HD,url:t,keepOpen:r},n)}},GD={location:!1,toolbar:!1,height:640},KD="_blank",WD=60,XD=2,$D=10,JD=class extends BD{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:r=e.post_logout_redirect_uri,popupWindowFeatures:n=GD,popupWindowTarget:i=KD,redirectMethod:a="assign",redirectTarget:o="self",iframeNotifyParentOrigin:s=e.iframeNotifyParentOrigin,iframeScriptOrigin:f=e.iframeScriptOrigin,silent_redirect_uri:u=e.redirect_uri,silentRequestTimeoutInSeconds:c=$D,automaticSilentRenew:d=!0,validateSubOnSilentRenew:l=!0,includeIdTokenInSilentRenew:p=!1,monitorSession:h=!1,monitorAnonymousSession:m=!1,checkSessionIntervalInSeconds:b=XD,query_status_response_type:y="code",stopCheckSessionOnError:g=!0,revokeTokenTypes:v=["access_token","refresh_token"],revokeTokensOnSignout:w=!1,includeIdTokenInSilentSignout:_=!1,accessTokenExpiringNotificationTimeInSeconds:E=WD,userStore:T}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=r,this.popupWindowFeatures=n,this.popupWindowTarget=i,this.redirectMethod=a,this.redirectTarget=o,this.iframeNotifyParentOrigin=s,this.iframeScriptOrigin=f,this.silent_redirect_uri=u,this.silentRequestTimeoutInSeconds=c,this.automaticSilentRenew=d,this.validateSubOnSilentRenew=l,this.includeIdTokenInSilentRenew=p,this.monitorSession=h,this.monitorAnonymousSession=m,this.checkSessionIntervalInSeconds=b,this.stopCheckSessionOnError=g,this.query_status_response_type=y,this.revokeTokenTypes=v,this.revokeTokensOnSignout=w,this.includeIdTokenInSilentSignout=_,this.accessTokenExpiringNotificationTimeInSeconds=E,T)this.userStore=T;else{const e="undefined"!=typeof window?window.sessionStorage:new ND;this.userStore=new MD({store:e})}}},YD=class extends VD{constructor({silentRequestTimeoutInSeconds:e=$D}){super(),this._logger=new ED("IFrameWindow"),this._timeoutInSeconds=e,this._frame=YD.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const e=window.document.createElement("iframe");return e.style.visibility="hidden",e.style.position="fixed",e.style.left="-1000px",e.style.top="0",e.width="0",e.height="0",e.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),window.document.body.appendChild(e),e}async navigate(e){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);const t=setTimeout((()=>this._abort.raise(new ID("IFrame timed out without a response"))),1e3*this._timeoutInSeconds);return this._disposeHandlers.add((()=>clearTimeout(t))),await super.navigate(e)}close(){var e;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",(e=>{var t;const r=e.target;null==(t=r.parentNode)||t.removeChild(r),this._abort.raise(new Error("IFrame removed from DOM"))}),!0),null==(e=this._frame.contentWindow)||e.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(e,t){return super._notifyParent(window.parent,e,!1,t)}},QD=class extends VD{constructor({popupWindowTarget:e=KD,popupWindowFeatures:t={}}){super(),this._logger=new ED("PopupWindow");const r=kD.center({...GD,...t});this._window=window.open(void 0,e,kD.serialize(r))}async navigate(e){var t;null==(t=this._window)||t.focus();const r=setInterval((()=>{this._window&&!this._window.closed||this._abort.raise(new Error("Popup closed by user"))}),500);return this._disposeHandlers.add((()=>clearInterval(r))),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,e,t)}},ZD=class extends CD{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new ED("UserManagerEvents"),this._userLoaded=new AD("User loaded"),this._userUnloaded=new AD("User unloaded"),this._silentRenewError=new AD("Silent renew error"),this._userSignedIn=new AD("User signed in"),this._userSignedOut=new AD("User signed out"),this._userSessionChanged=new AD("User session changed")}load(e,t=!0){super.load(e),t&&this._userLoaded.raise(e)}unload(){super.unload(),this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}_raiseSilentRenewError(e){this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}_raiseUserSignedIn(){this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}_raiseUserSignedOut(){this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}_raiseUserSessionChanged(){this._userSessionChanged.raise()}},eF=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(eF||{}),tF=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e))(tF||{}),rF=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e))(rF||{}),nF=(e=>(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_auth_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="mc_get_wallet_info",e.ShowUI="mc_wallet",e.NFTPurchase="magic_nft_purchase",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.UpdatePhoneNumber="magic_auth_update_phone_number",e.UpdatePhoneNumberTestMode="magic_auth_update_phone_number_testing_mode",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e))(nF||{}),iF=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e))(iF||{}),aF=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(aF||{}),oF=(e=>(e.Harmony="HARMONY",e))(oF||{}),sF=Object.create,fF=Object.defineProperty,uF=Object.defineProperties,cF=Object.getOwnPropertyDescriptor,dF=Object.getOwnPropertyDescriptors,lF=Object.getOwnPropertyNames,pF=Object.getOwnPropertySymbols,hF=Object.getPrototypeOf,mF=Object.prototype.hasOwnProperty,bF=Object.prototype.propertyIsEnumerable,yF=(e,t,r)=>t in e?fF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gF=(e,t)=>{for(var r in t||(t={}))mF.call(t,r)&&yF(e,r,t[r]);if(pF)for(var r of pF(t))bF.call(t,r)&&yF(e,r,t[r]);return e},vF=(e,t,r)=>new Promise(((n,i)=>{var a=e=>{try{s(r.next(e))}catch(e){i(e)}},o=e=>{try{s(r.throw(e))}catch(e){i(e)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(a,o);s((r=r.apply(e,t)).next())})),wF=((e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports))(((e,t)=>{var r=Object.prototype.hasOwnProperty,n="~";function i(){}function a(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,r,i,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new a(r,i||e,o),f=n?n+t:t;return e._events[f]?e._events[f].fn?e._events[f]=[e._events[f],s]:e._events[f].push(s):(e._events[f]=s,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function f(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),f.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)r.call(e,t)&&i.push(n?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},f.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=new Array(a);i<a;i++)o[i]=r[i].fn;return o},f.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},f.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var f,u,c=this._events[s],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,i),!0;case 5:return c.fn.call(c.context,t,r,i,a),!0;case 6:return c.fn.call(c.context,t,r,i,a,o),!0}for(u=1,f=new Array(d-1);u<d;u++)f[u-1]=arguments[u];c.fn.apply(c.context,f)}else{var l,p=c.length;for(u=0;u<p;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,r);break;case 4:c[u].fn.call(c[u].context,t,r,i);break;default:if(!f)for(l=1,f=new Array(d-1);l<d;l++)f[l-1]=arguments[l];c[u].fn.apply(c[u].context,f)}}return!0},f.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},f.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},f.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!r||o.context===r)&&s(this,a);else{for(var f=0,u=[],c=o.length;f<c;f++)(o[f].fn!==t||i&&!o[f].once||r&&o[f].context!==r)&&u.push(o[f]);u.length?this._events[a]=1===u.length?u[0]:u:s(this,a)}return this},f.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},f.prototype.off=f.prototype.removeListener,f.prototype.addListener=f.prototype.on,f.prefixed=n,f.EventEmitter=f,typeof t<"u"&&(t.exports=f)}));var _F={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16},EF="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},TF=EF,AF=function(e){let t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=_F,n=(t=e.exports={}).re=[],i=t.src=[],a=t.t={},o=0,s=(e,t,r)=>{let s=o++;TF(s,t),a[e]=s,i[s]=t,n[s]=new RegExp(t,r?"g":void 0)};s("NUMERICIDENTIFIER","0|[1-9]\\d*"),s("NUMERICIDENTIFIERLOOSE","[0-9]+"),s("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),s("MAINVERSION",`(${i[a.NUMERICIDENTIFIER]})\\.(${i[a.NUMERICIDENTIFIER]})\\.(${i[a.NUMERICIDENTIFIER]})`),s("MAINVERSIONLOOSE",`(${i[a.NUMERICIDENTIFIERLOOSE]})\\.(${i[a.NUMERICIDENTIFIERLOOSE]})\\.(${i[a.NUMERICIDENTIFIERLOOSE]})`),s("PRERELEASEIDENTIFIER",`(?:${i[a.NUMERICIDENTIFIER]}|${i[a.NONNUMERICIDENTIFIER]})`),s("PRERELEASEIDENTIFIERLOOSE",`(?:${i[a.NUMERICIDENTIFIERLOOSE]}|${i[a.NONNUMERICIDENTIFIER]})`),s("PRERELEASE",`(?:-(${i[a.PRERELEASEIDENTIFIER]}(?:\\.${i[a.PRERELEASEIDENTIFIER]})*))`),s("PRERELEASELOOSE",`(?:-?(${i[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${i[a.PRERELEASEIDENTIFIERLOOSE]})*))`),s("BUILDIDENTIFIER","[0-9A-Za-z-]+"),s("BUILD",`(?:\\+(${i[a.BUILDIDENTIFIER]}(?:\\.${i[a.BUILDIDENTIFIER]})*))`),s("FULLPLAIN",`v?${i[a.MAINVERSION]}${i[a.PRERELEASE]}?${i[a.BUILD]}?`),s("FULL",`^${i[a.FULLPLAIN]}$`),s("LOOSEPLAIN",`[v=\\s]*${i[a.MAINVERSIONLOOSE]}${i[a.PRERELEASELOOSE]}?${i[a.BUILD]}?`),s("LOOSE",`^${i[a.LOOSEPLAIN]}$`),s("GTLT","((?:<|>)?=?)"),s("XRANGEIDENTIFIERLOOSE",`${i[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),s("XRANGEIDENTIFIER",`${i[a.NUMERICIDENTIFIER]}|x|X|\\*`),s("XRANGEPLAIN",`[v=\\s]*(${i[a.XRANGEIDENTIFIER]})(?:\\.(${i[a.XRANGEIDENTIFIER]})(?:\\.(${i[a.XRANGEIDENTIFIER]})(?:${i[a.PRERELEASE]})?${i[a.BUILD]}?)?)?`),s("XRANGEPLAINLOOSE",`[v=\\s]*(${i[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[a.XRANGEIDENTIFIERLOOSE]})(?:${i[a.PRERELEASELOOSE]})?${i[a.BUILD]}?)?)?`),s("XRANGE",`^${i[a.GTLT]}\\s*${i[a.XRANGEPLAIN]}$`),s("XRANGELOOSE",`^${i[a.GTLT]}\\s*${i[a.XRANGEPLAINLOOSE]}$`),s("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),s("COERCERTL",i[a.COERCE],!0),s("LONETILDE","(?:~>?)"),s("TILDETRIM",`(\\s*)${i[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",s("TILDE",`^${i[a.LONETILDE]}${i[a.XRANGEPLAIN]}$`),s("TILDELOOSE",`^${i[a.LONETILDE]}${i[a.XRANGEPLAINLOOSE]}$`),s("LONECARET","(?:\\^)"),s("CARETTRIM",`(\\s*)${i[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",s("CARET",`^${i[a.LONECARET]}${i[a.XRANGEPLAIN]}$`),s("CARETLOOSE",`^${i[a.LONECARET]}${i[a.XRANGEPLAINLOOSE]}$`),s("COMPARATORLOOSE",`^${i[a.GTLT]}\\s*(${i[a.LOOSEPLAIN]})$|^$`),s("COMPARATOR",`^${i[a.GTLT]}\\s*(${i[a.FULLPLAIN]})$|^$`),s("COMPARATORTRIM",`(\\s*)${i[a.GTLT]}\\s*(${i[a.LOOSEPLAIN]}|${i[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",s("HYPHENRANGE",`^\\s*(${i[a.XRANGEPLAIN]})\\s+-\\s+(${i[a.XRANGEPLAIN]})\\s*$`),s("HYPHENRANGELOOSE",`^\\s*(${i[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${i[a.XRANGEPLAINLOOSE]})\\s*$`),s("STAR","(<|>)?=?\\s*\\*"),s("GTE0","^\\s*>=\\s*0.0.0\\s*$"),s("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")})),SF=/^[0-9]+$/,kF=(e,t)=>{let r=SF.test(e),n=SF.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},OF={compareIdentifiers:kF,rcompareIdentifiers:(e,t)=>kF(t,e)},{MAX_LENGTH:RF,MAX_SAFE_INTEGER:xF}=_F,{re:IF,t:CF}=AF,{compareIdentifiers:NF}=OF,PF=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof PF){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid Version: ${e}`);if(e.length>RF)throw new TypeError(`version is longer than ${RF} characters`);TF("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?IF[CF.LOOSE]:IF[CF.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>xF||this.major<0)throw new TypeError("Invalid major version");if(this.minor>xF||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>xF||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<xF)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(TF("SemVer.compare",this.version,this.options,e),!(e instanceof PF)){if("string"==typeof e&&e===this.version)return 0;e=new PF(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof PF||(e=new PF(e,this.options)),NF(this.major,e.major)||NF(this.minor,e.minor)||NF(this.patch,e.patch)}comparePre(e){if(e instanceof PF||(e=new PF(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(TF("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return NF(r,n)}while(++t)}compareBuild(e){e instanceof PF||(e=new PF(e,this.options));let t=0;do{let r=this.build[t],n=e.build[t];if(TF("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return NF(r,n)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}},MF=(e,t,r)=>new PF(e,r).compare(new PF(t,r)),BF=(e,t,r)=>0===MF(e,t,r),DF=(e,t,r)=>0!==MF(e,t,r),FF=(e,t,r)=>MF(e,t,r)>0,LF=(e,t,r)=>MF(e,t,r)>=0,UF=(e,t,r)=>MF(e,t,r)<0,jF=(e,t,r)=>MF(e,t,r)<=0,qF=(e,t,r,n)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return BF(e,r,n);case"!=":return DF(e,r,n);case">":return FF(e,r,n);case">=":return LF(e,r,n);case"<":return UF(e,r,n);case"<=":return jF(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}},zF=Symbol("SemVer ANY"),HF=class{static get ANY(){return zF}constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof HF){if(e.loose===!!t.loose)return e;e=e.value}TF("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===zF?this.value="":this.value=this.operator+this.semver.version,TF("comp",this)}parse(e){let t=this.options.loose?VF[GF.COMPARATORLOOSE]:VF[GF.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new PF(r[2],this.options.loose):this.semver=zF}toString(){return this.value}test(e){if(TF("Comparator.test",e,this.options.loose),this.semver===zF||e===zF)return!0;if("string"==typeof e)try{e=new PF(e,this.options)}catch(e){return!1}return qF(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof HF))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new KF(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new KF(this.value,t).test(e.semver);let r=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),n=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),i=this.semver.version===e.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),o=qF(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),s=qF(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||n||i&&a||o||s}},{re:VF,t:GF}=AF,KF=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof KF)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new KF(e.raw,t);if(e instanceof HF)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let{loose:t}=this.options;e=e.trim();let r=t?WF[XF.HYPHENRANGELOOSE]:WF[XF.HYPHENRANGE];e=e.replace(r,uL(this.options.includePrerelease)),TF("hyphen replace",e),e=e.replace(WF[XF.COMPARATORTRIM],$F),TF("comparator trim",e,WF[XF.COMPARATORTRIM]),e=(e=(e=e.replace(WF[XF.TILDETRIM],JF)).replace(WF[XF.CARETTRIM],YF)).split(/\s+/).join(" ");let n=t?WF[XF.COMPARATORLOOSE]:WF[XF.COMPARATOR];return e.split(" ").map((e=>ZF(e,this.options))).join(" ").split(/\s+/).map((e=>fL(e,this.options))).filter(this.options.loose?e=>!!e.match(n):()=>!0).map((e=>new HF(e,this.options)))}intersects(e,t){if(!(e instanceof KF))throw new TypeError("a Range is required");return this.set.some((r=>QF(r,t)&&e.set.some((e=>QF(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new PF(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(cL(this.set[t],e,this.options))return!0;return!1}},{re:WF,t:XF,comparatorTrimReplace:$F,tildeTrimReplace:JF,caretTrimReplace:YF}=AF,QF=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();for(;r&&n.length;)r=n.every((e=>i.intersects(e,t))),i=n.pop();return r},ZF=(e,t)=>(TF("comp",e,t),e=nL(e,t),TF("caret",e),e=tL(e,t),TF("tildes",e),e=aL(e,t),TF("xrange",e),e=sL(e,t),TF("stars",e),e),eL=e=>!e||"x"===e.toLowerCase()||"*"===e,tL=(e,t)=>e.trim().split(/\s+/).map((e=>rL(e,t))).join(" "),rL=(e,t)=>{let r=t.loose?WF[XF.TILDELOOSE]:WF[XF.TILDE];return e.replace(r,((t,r,n,i,a)=>{let o;return TF("tilde",e,t,r,n,i,a),eL(r)?o="":eL(n)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:eL(i)?o=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:a?(TF("replaceTilde pr",a),o=`>=${r}.${n}.${i}-${a} <${r}.${+n+1}.0-0`):o=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,TF("tilde return",o),o}))},nL=(e,t)=>e.trim().split(/\s+/).map((e=>iL(e,t))).join(" "),iL=(e,t)=>{TF("caret",e,t);let r=t.loose?WF[XF.CARETLOOSE]:WF[XF.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,a,o)=>{let s;return TF("caret",e,t,r,i,a,o),eL(r)?s="":eL(i)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:eL(a)?s="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:o?(TF("replaceCaret pr",o),s="0"===r?"0"===i?`>=${r}.${i}.${a}-${o} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}-${o} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a}-${o} <${+r+1}.0.0-0`):(TF("no pr"),s="0"===r?"0"===i?`>=${r}.${i}.${a}${n} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a} <${+r+1}.0.0-0`),TF("caret return",s),s}))},aL=(e,t)=>(TF("replaceXRanges",e,t),e.split(/\s+/).map((e=>oL(e,t))).join(" ")),oL=(e,t)=>{e=e.trim();let r=t.loose?WF[XF.XRANGELOOSE]:WF[XF.XRANGE];return e.replace(r,((r,n,i,a,o,s)=>{TF("xRange",e,r,n,i,a,o,s);let f=eL(i),u=f||eL(a),c=u||eL(o),d=c;return"="===n&&d&&(n=""),s=t.includePrerelease?"-0":"",f?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&d?(u&&(a=0),o=0,">"===n?(n=">=",u?(i=+i+1,a=0,o=0):(a=+a+1,o=0)):"<="===n&&(n="<",u?i=+i+1:a=+a+1),"<"===n&&(s="-0"),r=`${n+i}.${a}.${o}${s}`):u?r=`>=${i}.0.0${s} <${+i+1}.0.0-0`:c&&(r=`>=${i}.${a}.0${s} <${i}.${+a+1}.0-0`),TF("xRange return",r),r}))},sL=(e,t)=>(TF("replaceStars",e,t),e.trim().replace(WF[XF.STAR],"")),fL=(e,t)=>(TF("replaceGTE0",e,t),e.trim().replace(WF[t.includePrerelease?XF.GTE0PRE:XF.GTE0],"")),uL=e=>(t,r,n,i,a,o,s,f,u,c,d,l,p)=>`${r=eL(n)?"":eL(i)?`>=${n}.0.0${e?"-0":""}`:eL(a)?`>=${n}.${i}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${f=eL(u)?"":eL(c)?`<${+u+1}.0.0-0`:eL(d)?`<${u}.${+c+1}.0-0`:l?`<=${u}.${c}.${d}-${l}`:e?`<${u}.${c}.${+d+1}-0`:`<=${f}`}`.trim(),cL=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(TF(e[r].semver),e[r].semver!==HF.ANY&&e[r].semver.prerelease.length>0){let n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0},dL=(e,t,r)=>{try{t=new KF(t,r)}catch(e){return!1}return t.test(e)},{MAX_LENGTH:lL}=_F,{re:pL,t:hL}=AF,mL=(e,t)=>{if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof PF)return e;if("string"!=typeof e||e.length>lL||!(t.loose?pL[hL.LOOSE]:pL[hL.FULL]).test(e))return null;try{return new PF(e,t)}catch(e){return null}},{re:bL,t:yL}=AF,gL=(e,t)=>{if(e instanceof PF)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=bL[yL.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),bL[yL.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;bL[yL.COERCERTL].lastIndex=-1}else r=e.match(bL[yL.COERCE]);return null===r?null:mL(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function vL(e){return String.fromCharCode(parseInt(e.slice(1),16))}function wL(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function _L(e){return function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,vL))}(JSON.stringify(e))}function EL(e){return JSON.parse(function(e){return decodeURIComponent(Array.from(atob(e),wL).join(""))}(e))}function TL(e){return void 0===e}function AL(e){return function(e){return null===e}(e)||TL(e)}function SL(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var kL={};var OL={"magic-sdk":"magic-sdk","@magic-sdk/react-native":"magic-sdk-rn","@magic-sdk/react-native-bare":"magic-sdk-rn-bare","@magic-sdk/react-native-expo":"magic-sdk-rn-expo"},RL=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,RL.prototype)}},xL=class extends Error{constructor(e){super(),this.__proto__=Error;let t=Number(null==e?void 0:e.code);this.rawMessage=(null==e?void 0:e.message)||"Internal error",this.code=function(e){return!AL(e)&&"number"==typeof e&&Object.values(rF).includes(e)}(t)?t:rF.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(null==e?void 0:e.data)||void 0,Object.setPrototypeOf(this,xL.prototype)}},IL=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},CL=class extends Error{constructor(e,t,r,n){super(`Magic Extension Error (${e.name}): [${t}] ${r}`),this.code=t,this.rawMessage=r,this.data=n,this.__proto__=Error,Object.setPrototypeOf(this,CL.prototype)}},NL=class{constructor(e,t,r){this.code=t,this.rawMessage=r,this.message=`Magic Extension Warning (${e.name}): [${t}] ${r}`}log(){console.warn(this.message)}};function PL(){return new RL(eF.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function ML(){return new RL(eF.MalformedResponse,"Response from the Magic iframe is malformed.")}function BL(e){return new RL(eF.ExtensionNotInitialized,`Extensions must be initialized with a Magic SDK instance before \`Extension.${e}\` can be accessed. Do not invoke \`Extension.${e}\` inside an extension constructor.`)}function DL(e){let t=`Some extensions are incompatible with \`${kL.sdkName}@${kL.version}\`:`;return e.filter((e=>void 0!==e.compat&&null!==e.compat)).forEach((e=>{let r=e.compat[kL.sdkName];"string"==typeof r?t+=`\n - Extension \`${e.name}\` supports version(s) \`${r}\``:r||(t+=`\n - Extension \`${e.name}\` does not support ${kL.platform} environments.`)})),new RL(eF.IncompatibleExtensions,t)}function FL(e){return new RL(eF.InvalidArgument,`Invalid ${(e=>{let t=e+1,r=t%10,n=t%100;return 1===r&&11!==n?`${t}st`:2===r&&12!==n?`${t}nd`:3===r&&13!==n?`${t}rd`:`${t}th`})(e.argument)} argument given to \`${e.procedure}\`.\n Expected: \`${e.expected}\`\n Received: \`${e.received}\``)}function LL(){return new IL(tF.ReactNativeEndpointConfiguration,`CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The \`endpoint\` parameter SHOULD NOT be provided. The Magic \`<iframe>\` is automatically wrapped by a WebView pointed at \`${kL.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}var UL=function*(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}();function jL(){return UL.next().value}var qL=Symbol("Payload pre-processed by Magic SDK");function zL(e){return Object.defineProperty(e,qL,{value:!0,enumerable:!1}),e}function HL(e){var t,r,n;return function(e){return!!e[qL]}(e)||(e.jsonrpc=null!=(t=e.jsonrpc)?t:"2.0",e.id=jL(),e.method=null!=(r=e.method)?r:"noop",e.params=null!=(n=e.params)?n:[],zL(e)),e}function VL(e,t=[]){return zL({params:t,method:e,jsonrpc:"2.0",id:jL()})}var GL=class{constructor(e){e instanceof GL?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):function(e){return!AL(e)&&!(TL(e.jsonrpc)||TL(e.id)||TL(e.result)&&TL(e.error))}(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=void 0,this._error=void 0)}applyError(e){return this._error=e,this}applyResult(e){return this._result=e,this}get hasError(){return void 0!==this._error&&null!==this._error}get hasResult(){return void 0!==this._result}get payload(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}}},KL=((e,t,r)=>(r=null!=e?sF(hF(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of lF(t))!mF.call(e,i)&&i!==r&&fF(e,i,{get:()=>t[i],enumerable:!(n=cF(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:fF(r,"default",{value:e,enumerable:!0}),e)))(wF()),WL=class extends KL.default{};function XL(){let e=new WL;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...n)=>(e[t].apply(e,n),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var $L=Symbol("isPromiEvent");function JL(e){return!!e[$L]}function YL(e){let t=QL(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:n}=XL(),i=Symbol("Promise.then"),a=Symbol("Promise.catch"),o=Symbol("Promise.finally"),s=(e,t)=>(...r)=>{let n=t[e].apply(t,r);return f(n)},f=e=>Object.assign(e,{[$L]:!0,[i]:e[i]||e.then,[a]:e[a]||e.catch,[o]:e[o]||e.finally,then:s(i,e),catch:s(a,e),finally:s(o,e),on:n("on",e),once:n("once",e),addListener:n("addListener",e),off:n("off",e),removeListener:n("removeListener",e),removeAllListeners:n("removeAllListeners",e),emit:r("emit"),eventNames:r("eventNames"),listeners:r("listeners"),listenerCount:r("listenerCount")}),u=f(t.then((e=>(u.emit("done",e),u.emit("settled"),e)),(e=>{throw u.emit("error",e),u.emit("settled"),e})));return u}function QL(e){return new Promise(((t,r)=>{let n=e(t,r);Promise.resolve(n).catch(r)}))}var ZL,eU=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(aF.MAGIC_HANDLE_REQUEST,HL(e)),r=YL(((e,r)=>{t.then((t=>{if(n(),t.hasError)r(new xL(t.payload.error));else{if(!t.hasResult)throw ML();e(t.payload.result)}})).catch((e=>{n(),r(e)}))})),n=this.overlay.on(iF.MAGIC_HANDLE_EVENT,(t=>{var n;let{response:i}=t.data;if(i.id===e.id&&(null==(n=i.result)?void 0:n.event)){let{event:e,params:t=[]}=i.result;r.emit(e,...t)}}));return r}createIntermediaryEvent(e,t){return r=>{let n=VL(nF.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(n)}}},tU=class extends eU{loginWithMagicLink(e){let{email:t,showUI:r=!0,redirectURI:n}=e,i=VL(this.sdk.testMode?nF.LoginWithMagicLinkTestMode:nF.LoginWithMagicLink,[{email:t,showUI:r,redirectURI:n}]);return this.request(i)}loginWithSMS(e){let{phoneNumber:t}=e,r=VL(this.sdk.testMode?nF.LoginWithSmsTestMode:nF.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(r)}loginWithEmailOTP(e){let{email:t,showUI:r}=e,n=VL(this.sdk.testMode?nF.LoginWithEmailOTPTestMode:nF.LoginWithEmailOTP,[{email:t,showUI:r}]);if(!r){let e=this.request(n);return e&&e.on("otp-input-sent",(e=>{this.createIntermediaryEvent("verify-email-otp",n.id)(e)})),e}return this.request(n)}loginWithCredential(e){let t=null!=e?e:"";if(!e&&"web"===kL.platform){t=window.location.search;let e=window.location.origin+window.location.pathname;window.history.replaceState(null,"",e)}let r=VL(this.sdk.testMode?nF.LoginWithCredentialTestMode:nF.LoginWithCredential,[t]);return this.request(r)}},rU={};function nU(e){return(...t)=>vF(this,null,(function*(){return ZL||(ZL=yield kL.configureStorage()),yield ZL.ready(),ZL[e](...t)}))}((e,t)=>{for(var r in t)fF(e,r,{get:t[r],enumerable:!0})})(rU,{clear:()=>sU,getItem:()=>iU,iterate:()=>dU,key:()=>uU,keys:()=>cU,length:()=>fU,removeItem:()=>oU,setItem:()=>aU});var iU=nU("getItem"),aU=nU("setItem"),oU=nU("removeItem"),sU=nU("clear"),fU=nU("length"),uU=nU("key"),cU=nU("keys"),dU=nU("iterate");function lU(){let e=window.crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=191&e[8]|128;let t="";return t+=e[0].toString(16),t+=e[1].toString(16),t+=e[2].toString(16),t+=e[3].toString(16),t+="-",t+=e[4].toString(16),t+=e[5].toString(16),t+="-",t+=e[6].toString(16),t+=e[7].toString(16),t+="-",t+=e[8].toString(16),t+=e[9].toString(16),t+="-",t+=e[10].toString(16),t+=e[11].toString(16),t+=e[12].toString(16),t+=e[13].toString(16),t+=e[14].toString(16),t+=e[15].toString(16),t}var pU="STORE_KEY_PRIVATE_KEY",hU="STORE_KEY_PUBLIC_JWK",mU="ECDSA",bU="P-256",yU={name:mU,namedCurve:bU},gU={name:mU,namedCurve:bU};function vU(){oU(hU),oU(pU)}function wU(){return vF(this,null,(function*(){let e=yield function(){return vF(this,null,(function*(){if(function(){let e="undefined"!=typeof window&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}())return(yield iU(hU))||(yield function(){return vF(this,null,(function*(){let e=null,{subtle:t}=window.crypto,r=yield t.generateKey(yU,!0,["sign"]),n=yield t.exportKey("jwk",r.privateKey);e=yield t.exportKey("jwk",r.publicKey);let i=yield t.importKey("jwk",n,gU,!1,["sign"]);yield aU(pU,i),yield aU(hU,e)}))}()),iU(hU);console.info("webcrypto is not supported")}))}();if(!e)return void console.info("unable to create public key or webcrypto is unsupported");let{subtle:t}=window.crypto,r=yield iU(pU);if(!r||!t)return void console.info("unable to find private key or webcrypto unsupported");let n={iat:Math.floor((new Date).getTime()/1e3),jti:lU()},i={typ:"dpop+jwt",alg:"ES256",jwk:e},a=_U(JSON.stringify(i)),o=_U(JSON.stringify(n)),s=function(e){return(new TextEncoder).encode(e)}(`${a}.${o}`),f={name:mU,hash:{name:"SHA-256"}},u=function(e){let t="";return e.forEach((e=>{t+=String.fromCharCode(e)})),EU(t)}(new Uint8Array(yield t.sign(f,r,s)));return`${a}.${o}.${u}`}))}function _U(e){return EU(function(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))}(e))}function EU(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}var TU=class extends eU{getIdToken(e){let t=VL(this.sdk.testMode?nF.GetIdTokenTestMode:nF.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=VL(this.sdk.testMode?nF.GenerateIdTokenTestMode:nF.GenerateIdToken,[e]);return this.request(t)}getMetadata(){let e=VL(this.sdk.testMode?nF.GetMetadataTestMode:nF.GetMetadata);return this.request(e)}updateEmail(e){let{email:t,showUI:r=!0}=e,n=VL(this.sdk.testMode?nF.UpdateEmailTestMode:nF.UpdateEmail,[{email:t,showUI:r}]);return this.request(n)}isLoggedIn(){let e=VL(this.sdk.testMode?nF.IsLoggedInTestMode:nF.IsLoggedIn);return this.request(e)}logout(){vU();let e=VL(this.sdk.testMode?nF.LogoutTestMode:nF.Logout);return this.request(e)}showSettings(){let e=VL(this.sdk.testMode?nF.UserSettingsTestMode:nF.UserSettings);return this.request(e)}updatePhoneNumber(){let e=VL(this.sdk.testMode?nF.UpdatePhoneNumberTestMode:nF.UpdatePhoneNumber);return this.request(e)}recoverAccount(e){let t=VL(this.sdk.testMode?nF.RecoverAccountTestMode:nF.RecoverAccount,[e]);return this.request(t)}},AU=class extends eU{connectWithUI(){let e=VL(nF.RequestAccounts);return this.request(e)}showUI(){let e=VL(nF.ShowUI);return this.request(e)}getInfo(){let e=VL(nF.GetInfo);return this.request(e)}requestUserInfoWithUI(e){let t=VL(nF.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}disconnect(){vU();let e=VL(nF.Disconnect);return this.request(e)}},{createBoundEmitterMethod:SU,createChainingEmitterMethod:kU}=XL(),OU=class extends eU{constructor(){super(...arguments),this.isMagic=!0,this.on=kU("on",this),this.once=kU("once",this),this.addListener=kU("addListener",this),this.off=kU("off",this),this.removeListener=kU("removeListener",this),this.removeAllListeners=kU("removeAllListeners",this),this.emit=SU("emit"),this.eventNames=SU("eventNames"),this.listeners=SU("listeners"),this.listenerCount=SU("listenerCount")}sendAsync(e,t){if(!t)throw FL({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:null===t?"null":typeof t});if(Array.isArray(e))this.overlay.post(aF.MAGIC_HANDLE_REQUEST,e.map((e=>{let t=HL(e);return this.prefixPayloadMethodForTestMode(t),t}))).then((e=>{t(null,e.map((e=>((e,t)=>uF(e,dF(t)))(gF({},e.payload),{error:e.hasError?new xL(e.payload.error):null}))))}));else{let r=HL(e);this.prefixPayloadMethodForTestMode(r),this.overlay.post(aF.MAGIC_HANDLE_REQUEST,r).then((e=>{t(e.hasError?new xL(e.payload.error):null,e.payload)}))}}send(e,t){if("string"==typeof e){let r=VL(e,Array.isArray(t)?t:[]);return this.request(r)}if(Array.isArray(e)||t)return void this.sendAsync(e,t);let r=new IL(tF.SyncWeb3Method,"Non-async web3 methods are deprecated in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.");return r.log(),new GL(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=VL("eth_accounts");return this.request(e)}request(e){return this.prefixPayloadMethodForTestMode(e),super.request(e)}prefixPayloadMethodForTestMode(e){this.sdk.testMode&&(e.method=`testMode/eth/${e.method}`)}};function RU(e,t){return t?new URL(e,t):new URL(e)}var xU=["request","overlay","sdk"];function IU(e){let t=Object.getPrototypeOf(e),r=[t];for(;t!==eU.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}var CU=class extends eU{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:YL,isPromiEvent:JL,encodeJSON:_L,decodeJSON:EL,createJsonRpcRequestPayload:VL,standardizeJsonRpcRequestPayload:HL,storage:rU};let e=[this,...IU(this)];xU.forEach((t=>{let r=e.map((e=>Object.getOwnPropertyDescriptor(e,t))),n=r.findIndex((e=>!!e)),i=n>0,a=r[n];a&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:a,isPrototypeField:i}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw BL(t)}}))}))}init(e){this.__is_initialized__||(xU.forEach((e=>{if(this.__sdk_access_field_descriptors__.has(e)){let{descriptor:t,isPrototypeField:r}=this.__sdk_access_field_descriptors__.get(e);r?delete this[e]:Object.defineProperty(this,e,t)}})),this.sdk=e,this.__is_initialized__=!0)}createDeprecationWarning(e){let{method:t,removalVersion:r,useInstead:n}=e;return new NL(this,"DEPRECATION_NOTICE",`\`${t}\` will be removed from this Extension in version \`${r}\`.${n?` Use \`${n}\` instead.`:""}`)}createWarning(e,t){return new NL(this,e,t)}createError(e,t,r){return new CL(this,e,t,r)}},NU=class extends CU{};NU.Internal=class extends CU{},NU.Anonymous="anonymous extension";var PU=class extends eU{purchase(e){let t=VL(nF.NFTPurchase,[e]);return this.request(t)}};function MU(e){return!e.compat||null==e.compat[kL.sdkName]||("string"==typeof e.compat[kL.sdkName]?dL(gL(kL.version),e.compat[kL.sdkName]):!!e.compat[kL.sdkName])}function BU(e){var t;let r=null!=(t=null==e?void 0:e.extensions)?t:[],n={},i=[];if(Array.isArray(r)?r.forEach((e=>{MU(e)?(e.init(this),(e.name||e.name!==NU.Anonymous)&&(this[e.name]=e),e instanceof NU.Internal&&(SL(e.config)||(n[e.name]=e.config))):i.push(e)})):Object.keys(r).forEach((e=>{if(MU(r[e])){r[e].init(this);let t=r[e];this[e]=t,t instanceof NU.Internal&&(SL(t.config)||(n[r[e].name]=t.config))}else i.push(r[e])})),i.length)throw DL(i);return n}var DU=class{constructor(e,t){var r;if(this.apiKey=e,!e)throw PL();"react-native"===kL.platform&&(null==t?void 0:t.endpoint)&&LL().log();let{defaultEndpoint:n,version:i}=kL;this.testMode=!(null==t||!t.testMode),this.endpoint=RU(null!=(r=null==t?void 0:t.endpoint)?r:n).origin,this.auth=new tU(this),this.user=new TU(this),this.wallet=new AU(this),this.nft=new PU(this),this.rpcProvider=new OU(this);let a=BU.call(this,t);this.parameters=_L(gF({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:null==t?void 0:t.network,host:RU(this.endpoint).host,sdk:OL[kL.sdkName],version:i,ext:SL(a)?void 0:a,locale:(null==t?void 0:t.locale)||"en_US"},kL.bundleId?{bundleId:kL.bundleId}:{}))}get overlay(){if(!DU.__overlays__.has(this.parameters)){let e=new kL.ViewController(this.endpoint,this.parameters);e.init(),DU.__overlays__.set(this.parameters,e)}return DU.__overlays__.get(this.parameters)}preload(){return vF(this,null,(function*(){yield this.overlay.ready}))}},FU=DU;function LU(e,t){var r;let n=null==(r=t.data.response)?void 0:r.id,i=function(e,t){return t&&Array.isArray(e)?e.find((e=>e.id===t)):e}(e,n);if(n&&i){return{id:n,response:new GL(i).applyResult(t.data.response.result).applyError(t.data.response.error)}}return{}}FU.__overlays__=new Map;var UU=class{constructor(e,t){this.endpoint=e,this.parameters=t,this.messageHandlers=new Set,this.ready=this.waitForReady(),this.listen()}post(e,t){return vF(this,null,(function*(){return QL((r=>vF(this,null,(function*(){yield this.ready;let n=[],i=Array.isArray(t)?t.map((e=>e.id)):[],a=yield function(e,t){return vF(this,null,(function*(){let r,n=yield iU("rt");if("web"===kL.platform)try{r=yield wU()}catch(e){console.error("webcrypto error",e)}return r?n?{msgType:e,payload:t,jwt:r,rt:n}:{msgType:e,payload:t,jwt:r}:{msgType:e,payload:t}}))}(`${e}-${this.parameters}`,t);yield this._post(a);let o=this.on(iF.MAGIC_HANDLE_RESPONSE,(e=>a=>{let{id:o,response:s}=LU(t,a);(function(e){vF(this,null,(function*(){!e.data.rt||(yield aU("rt",e.data.rt))}))})(a),o&&s&&Array.isArray(t)&&i.includes(o)?(n.push(s),n.length===t.length&&(e(),r(n))):o&&s&&!Array.isArray(t)&&o===t.id&&(e(),r(s))})((()=>o())))}))))}))}on(e,t){let r=t.bind(window),n=t=>{t.data.msgType===`${e}-${this.parameters}`&&r(t)};return this.messageHandlers.add(n),()=>this.messageHandlers.delete(n)}waitForReady(){return new Promise((e=>{this.on(iF.MAGIC_OVERLAY_READY,(()=>e()))}))}listen(){this.on(iF.MAGIC_HIDE_OVERLAY,(()=>{this.hideOverlay()})),this.on(iF.MAGIC_SHOW_OVERLAY,(()=>{this.showOverlay()}))}},jU=Object.create,qU=Object.defineProperty,zU=Object.getOwnPropertyDescriptor,HU=Object.getOwnPropertyNames,VU=Object.getPrototypeOf,GU=Object.prototype.hasOwnProperty,KU=(e=>"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(e,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):e)((function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')})),WU=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),XU=(e,t,r)=>(r=null!=e?jU(VU(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of HU(t))!GU.call(e,i)&&i!==r&&qU(e,i,{get:()=>t[i],enumerable:!(n=zU(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:qU(r,"default",{value:e,enumerable:!0}),e)),$U=(e,t,r)=>new Promise(((n,i)=>{var a=e=>{try{s(r.next(e))}catch(e){i(e)}},o=e=>{try{s(r.throw(e))}catch(e){i(e)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(a,o);s((r=r.apply(e,t)).next())})),JU=WU(((e,t)=>{!function(r){if("object"==typeof e&&typeof t<"u")t.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).localforage=r()}}((function(){return function e(t,r,n){function i(o,s){if(!r[o]){if(!t[o]){var f="function"==typeof KU&&KU;if(!s&&f)return f(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};t[o][0].call(c.exports,(function(e){return i(t[o][1][e]||e)}),c,c.exports,e,t,r,n)}return r[o].exports}for(var a="function"==typeof KU&&KU,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){(function(e){var r,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var i=0,a=new n(c),o=e.document.createTextNode("");a.observe(o,{characterData:!0}),r=function(){o.data=i=++i%2}}else if(!e.setImmediate&&typeof e.MessageChannel<"u"){var s=new e.MessageChannel;s.port1.onmessage=c,r=function(){s.port2.postMessage(0)}}else r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){c(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(c,0)};var f,u=[];function c(){f=!0;for(var e,t,r=u.length;r;){for(t=u,u=[],e=-1;++e<r;)t[e]();r=u.length}f=!1}t.exports=function(e){1===u.push(e)&&!f&&r()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(e,t,r){var n=e(1);function i(){}var a={},o=["REJECTED"],s=["FULFILLED"],f=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,e!==i&&p(this,e)}function c(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function d(e,t,r){n((function(){var n;try{n=t(r)}catch(t){return a.reject(e,t)}n===e?a.reject(e,new TypeError("Cannot resolve promise with itself")):a.resolve(e,n)}))}function l(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var r=!1;function n(t){r||(r=!0,a.reject(e,t))}function i(t){r||(r=!0,a.resolve(e,t))}var o=h((function(){t(i,n)}));"error"===o.status&&n(o.value)}function h(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=u,u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===o)return this;var r=new this.constructor(i);this.state!==f?d(r,this.state===s?e:t,this.outcome):this.queue.push(new c(r,e,t));return r},c.prototype.callFulfilled=function(e){a.resolve(this.promise,e)},c.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},c.prototype.callRejected=function(e){a.reject(this.promise,e)},c.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},a.resolve=function(e,t){var r=h(l,t);if("error"===r.status)return a.reject(e,r.value);var n=r.value;if(n)p(e,n);else{e.state=s,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},a.reject=function(e,t){e.state=o,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:a.resolve(new this(i),e)},u.reject=function(e){var t=new this(i);return a.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var o=new Array(r),s=0,f=-1,u=new this(i);++f<r;)c(e[f],f);return u;function c(e,i){t.resolve(e).then((function(e){o[i]=e,++s===r&&!n&&(n=!0,a.resolve(u,o))}),(function(e){n||(n=!0,a.reject(u,e))}))}},u.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var o=-1,s=new this(i);++o<r;)f(e[o]);return s;function f(e){t.resolve(e).then((function(e){n||(n=!0,a.resolve(s,e))}),(function(e){n||(n=!0,a.reject(s,e))}))}}},{1:1}],3:[function(e,t,r){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var i=function(){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}}();function a(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new(typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}typeof Promise>"u"&&e(3);var o=Promise;function s(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function f(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function u(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function c(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var d="local-forage-detect-blob-support",l=void 0,p={},h=Object.prototype.toString,m="readonly",b="readwrite";function y(e){return"boolean"==typeof l?o.resolve(l):function(e){return new o((function(t){var r=e.transaction(d,b),n=a([""]);r.objectStore(d).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return l=e}))}function g(e){var t=p[e.name],r={};r.promise=new o((function(e,t){r.resolve=e,r.reject=t})),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then((function(){return r.promise})):t.dbReady=r.promise}function v(e){var t=p[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function w(e,t){var r=p[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function _(e,t){return new o((function(r,n){if(p[e.name]=p[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);g(e),e.db.close()}var a=[e.name];t&&a.push(e.version);var o=i.open.apply(i,a);t&&(o.onupgradeneeded=function(t){var r=o.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(d)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),n(o.error)},o.onsuccess=function(){var t=o.result;t.onversionchange=function(e){e.target.close()},r(t),v(e)}}))}function E(e){return _(e,!1)}function T(e){return _(e,!0)}function A(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,i=e.version>e.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function S(e){var t=function(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;i<t;i++)n[i]=e.charCodeAt(i);return r}(atob(e.data));return a([t],{type:e.type})}function k(e){return e&&e.__local_forage_encoded_blob}function O(e){var t=this,r=t._initReady().then((function(){var e=p[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return f(r,e,e),r}function R(e,t,r,n){void 0===n&&(n=1);try{var i=e.db.transaction(e.storeName,t);r(null,i)}catch(i){if(n>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return o.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),T(e)})).then((function(){return function(e){g(e);for(var t=p[e.name],r=t.forages,n=0;n<r.length;n++){var i=r[n];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,E(e).then((function(t){return e.db=t,A(e)?T(e):t})).then((function(n){e.db=t.db=n;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=n})).catch((function(t){throw w(e,t),t}))}(e).then((function(){R(e,t,r,n-1)}))})).catch(r);r(i)}}var x={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var i=p[r.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},p[r.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=O);var a=[];function s(){return o.resolve()}for(var f=0;f<i.forages.length;f++){var u=i.forages[f];u!==t&&a.push(u._initReady().catch(s))}var c=i.forages.slice(0);return o.all(a).then((function(){return r.db=i.db,E(r)})).then((function(e){return r.db=e,A(r,t._defaultConfig.version)?T(r):e})).then((function(e){r.db=i.db=e,t._dbInfo=r;for(var n=0;n<c.length;n++){var a=c[n];a!==t&&(a._dbInfo.db=r.db,a._dbInfo.version=r.version)}}))},_support:function(){try{if(!i||!i.open)return!1;var e=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}(),iterate:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){R(r._dbInfo,m,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).openCursor(),s=1;o.onsuccess=function(){var r=o.result;if(r){var n=r.value;k(n)&&(n=S(n));var i=e(n,r.key,s++);void 0!==i?t(i):r.continue()}else t()},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){R(r._dbInfo,m,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),k(e)&&(e=S(e)),t(e)},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},setItem:function(e,t,r){var n=this;e=u(e);var i=new o((function(r,i){var a;n.ready().then((function(){return a=n._dbInfo,"[object Blob]"===h.call(t)?y(a.db).then((function(e){return e?t:function(e){return new o((function(t,r){var n=new FileReader;n.onerror=r,n.onloadend=function(r){var n=btoa(r.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:e.type})},n.readAsBinaryString(e)}))}(t)})):t})).then((function(t){R(n._dbInfo,b,(function(a,o){if(a)return i(a);try{var s=o.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var f=s.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),r(t)},o.onabort=o.onerror=function(){var e=f.error?f.error:f.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return s(i,r),i},removeItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){R(r._dbInfo,b,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).delete(e);a.oncomplete=function(){t()},a.onerror=function(){n(o.error)},a.onabort=function(){var e=o.error?o.error:o.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},clear:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){R(t._dbInfo,b,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=a.error?a.error:a.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return s(r,e),r},length:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){R(t._dbInfo,m,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).count();a.onsuccess=function(){e(a.result)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,e),r},key:function(e,t){var r=this,n=new o((function(t,n){e<0?t(null):r.ready().then((function(){R(r._dbInfo,m,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName),s=!1,f=o.openKeyCursor();f.onsuccess=function(){var r=f.result;r?0===e||s?t(r.key):(s=!0,r.advance(e)):t(null)},f.onerror=function(){n(f.error)}}catch(e){n(e)}}))})).catch(n)}));return s(n,t),n},keys:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){R(t._dbInfo,m,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];a.onsuccess=function(){var t=a.result;t?(o.push(t.key),t.continue()):e(o)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return s(r,e),r},dropInstance:function(e,t){t=c.apply(this,arguments);var r,n=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName),e.name){var a=e.name===n.name&&this._dbInfo.db?o.resolve(this._dbInfo.db):E(e).then((function(t){var r=p[e.name],n=r.forages;r.db=t;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=t;return t}));r=e.storeName?a.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;g(e);var n=p[e.name],a=n.forages;t.close();for(var s=0;s<a.length;s++){var f=a[s];f._dbInfo.db=null,f._dbInfo.version=r}var u=new o((function(t,n){var a=i.open(e.name,r);a.onerror=function(e){a.result.close(),n(e)},a.onupgradeneeded=function(){a.result.deleteObjectStore(e.storeName)},a.onsuccess=function(){var e=a.result;e.close(),t(e)}}));return u.then((function(e){n.db=e;for(var t=0;t<a.length;t++){var r=a[t];r._dbInfo.db=e,v(r._dbInfo)}})).catch((function(t){throw(w(e,t)||o.resolve()).catch((function(){})),t}))}})):a.then((function(t){g(e);var r=p[e.name],n=r.forages;t.close();for(var a=0;a<n.length;a++){n[a]._dbInfo.db=null}var s=new o((function(t,r){var n=i.deleteDatabase(e.name);n.onerror=function(){var e=n.result;e&&e.close(),r(n.error)},n.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}));return s.then((function(e){r.db=e;for(var t=0;t<n.length;t++){v(n[t]._dbInfo)}})).catch((function(t){throw(w(e,t)||o.resolve()).catch((function(){})),t}))}))}else r=o.reject("Invalid arguments");return s(r,t),r}};var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",C=/^~~local_forage_type~([^~]+)~/,N="__lfsc__:",P="arbf",M="blob",B="si08",D="ui08",F="uic8",L="si16",U="si32",j="ur16",q="ui32",z="fl32",H="fl64",V=Object.prototype.toString;function G(e){var t,r,n,i,a,o=.75*e.length,s=e.length,f=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var u=new ArrayBuffer(o),c=new Uint8Array(u);for(t=0;t<s;t+=4)r=I.indexOf(e[t]),n=I.indexOf(e[t+1]),i=I.indexOf(e[t+2]),a=I.indexOf(e[t+3]),c[f++]=r<<2|n>>4,c[f++]=(15&n)<<4|i>>2,c[f++]=(3&i)<<6|63&a;return u}function K(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=I[r[t]>>2],n+=I[(3&r[t])<<4|r[t+1]>>4],n+=I[(15&r[t+1])<<2|r[t+2]>>6],n+=I[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var W={serialize:function(e,t){var r="";if(e&&(r=V.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===V.call(e.buffer))){var n,i=N;e instanceof ArrayBuffer?(n=e,i+=P):(n=e.buffer,"[object Int8Array]"===r?i+=B:"[object Uint8Array]"===r?i+=D:"[object Uint8ClampedArray]"===r?i+=F:"[object Int16Array]"===r?i+=L:"[object Uint16Array]"===r?i+=j:"[object Int32Array]"===r?i+=U:"[object Uint32Array]"===r?i+=q:"[object Float32Array]"===r?i+=z:"[object Float64Array]"===r?i+=H:t(new Error("Failed to get type for BinaryArray"))),t(i+K(n))}else if("[object Blob]"===r){var a=new FileReader;a.onload=function(){var r="~~local_forage_type~"+e.type+"~"+K(this.result);t(N+M+r)},a.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,9)!==N)return JSON.parse(e);var t,r=e.substring(13),n=e.substring(9,13);if(n===M&&C.test(r)){var i=r.match(C);t=i[1],r=r.substring(i[0].length)}var o=G(r);switch(n){case P:return o;case M:return a([o],{type:t});case B:return new Int8Array(o);case D:return new Uint8Array(o);case F:return new Uint8ClampedArray(o);case L:return new Int16Array(o);case j:return new Uint16Array(o);case U:return new Int32Array(o);case q:return new Uint32Array(o);case z:return new Float32Array(o);case H:return new Float64Array(o);default:throw new Error("Unkown type: "+n)}},stringToBuffer:G,bufferToString:K};function X(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function $(e,t,r,n,i,a){e.executeSql(r,n,i,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,s){s.rows.length?a(e,o):X(e,t,(function(){e.executeSql(r,n,i,a)}),a)}),a):a(e,o)}),a)}function J(e,t,r,n){var i=this;e=u(e);var a=new o((function(a,o){i.ready().then((function(){void 0===t&&(t=null);var s=t,f=i._dbInfo;f.serializer.serialize(t,(function(t,u){u?o(u):f.db.transaction((function(r){$(r,f,"INSERT OR REPLACE INTO "+f.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){a(s)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void a(J.apply(i,[e,s,r,n-1]));o(t)}}))}))})).catch(o)}));return s(a,r),a}var Y={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var i=new o((function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction((function(i){X(i,r,(function(){t._dbInfo=r,e()}),(function(e,t){n(t)}))}),n)}));return r.serializer=W,i},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"SELECT * FROM "+i.storeName,[],(function(r,n){for(var a=n.rows,o=a.length,s=0;s<o;s++){var f=a.item(s),u=f.value;if(u&&(u=i.serializer.deserialize(u)),void 0!==(u=e(u,f.key,s+1)))return void t(u)}t()}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=i.serializer.deserialize(n)),t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},setItem:function(e,t,r){return J.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=u(e);var n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},clear:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){$(t,n,"DELETE FROM "+n.storeName,[],(function(){e()}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,e),r},length:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){$(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(t,r){var n=r.rows.item(0).c;e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,e),r},key:function(e,t){var r=this,n=new o((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){$(r,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return s(n,t),n},keys:function(e){var t=this,r=new o((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){$(t,n,"SELECT key FROM "+n.storeName,[],(function(t,r){for(var n=[],i=0;i<r.rows.length;i++)n.push(r.rows.item(i).key);e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return s(r,e),r},dropInstance:function(e,t){t=c.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;return n=e.name?new o((function(t){var n;n=e.name===r.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:n,storeNames:[e.storeName]}):t(function(e){return new o((function(t,r){e.transaction((function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(r,n){for(var i=[],a=0;a<n.rows.length;a++)i.push(n.rows.item(a).name);t({db:e,storeNames:i})}),(function(e,t){r(t)}))}),(function(e){r(e)}))}))}(n))})).then((function(e){return new o((function(t,r){e.db.transaction((function(n){function i(e){return new o((function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){r(t)}))}))}for(var a=[],s=0,f=e.storeNames.length;s<f;s++)a.push(i(e.storeNames[s]));o.all(a).then((function(){t()})).catch((function(e){r(e)}))}),(function(e){r(e)}))}))})):o.reject("Invalid arguments"),s(n,t),n}};function Q(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function Z(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}()||localStorage.length>0}var ee={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=Q(e,this._defaultConfig),Z()?(this._dbInfo=t,t.serializer=W,o.resolve()):o.reject()},_support:function(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then((function(){for(var t=r._dbInfo,n=t.keyPrefix,i=n.length,a=localStorage.length,o=1,s=0;s<a;s++){var f=localStorage.key(s);if(0===f.indexOf(n)){var u=localStorage.getItem(f);if(u&&(u=t.serializer.deserialize(u)),void 0!==(u=e(u,f.substring(i),o++)))return u}}}));return s(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=r.ready().then((function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n}));return s(n,t),n},setItem:function(e,t,r){var n=this;e=u(e);var i=n.ready().then((function(){void 0===t&&(t=null);var r=t;return new o((function(i,a){var o=n._dbInfo;o.serializer.serialize(t,(function(t,n){if(n)a(n);else try{localStorage.setItem(o.keyPrefix+e,t),i(r)}catch(e){("QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&a(e),a(e)}}))}))}));return s(i,r),i},removeItem:function(e,t){var r=this;e=u(e);var n=r.ready().then((function(){var t=r._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return s(n,t),n},clear:function(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}}));return s(r,e),r},length:function(e){var t=this.keys().then((function(e){return e.length}));return s(t,e),t},key:function(e,t){var r=this,n=r.ready().then((function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch{t=null}return t&&(t=t.substring(n.keyPrefix.length)),t}));return s(n,t),n},keys:function(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo,r=localStorage.length,n=[],i=0;i<r;i++){var a=localStorage.key(i);0===a.indexOf(e.keyPrefix)&&n.push(a.substring(e.keyPrefix.length))}return n}));return s(r,e),r},dropInstance:function(e,t){if(t=c.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,i=this;return n=e.name?new o((function(t){e.storeName?t(Q(e,i._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}})):o.reject("Invalid arguments"),s(n,t),n}},te=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},re=function(e,t){for(var r=e.length,n=0;n<r;){if(te(e[n],t))return!0;n++}return!1},ne=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},oe={INDEXEDDB:x,WEBSQL:Y,LOCALSTORAGE:ee},se=[oe.INDEXEDDB._driver,oe.WEBSQL._driver,oe.LOCALSTORAGE._driver],fe=["dropInstance"],ue=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fe),ce={description:"",driver:se.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var r=arguments;return e.ready().then((function(){return e[t].apply(e,r)}))}}function le(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(ne(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var pe=function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),oe)if(oe.hasOwnProperty(r)){var n=oe[r],i=n._driver;this[r]=i,ie[i]||this.defineDriver(n)}this._defaultConfig=le({},ce),this._config=le({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(typeof e>"u"?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new o((function(t,r){try{var n=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(i);for(var a=ue.concat("_initStorage"),f=0,u=a.length;f<u;f++){var c=a[f];if((!re(fe,c)||e[c])&&"function"!=typeof e[c])return void r(i)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=o.reject(t);return s(r,arguments[arguments.length-1]),r}},r=0,n=fe.length;r<n;r++){var i=fe[r];e[i]||(e[i]=t(i))}}();var d=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,ae[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,r):d(!!e._support):d(!0)}catch(e){r(e)}}));return f(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?o.resolve(ie[e]):o.reject(new Error("Driver not found."));return f(n,t,r),n},e.prototype.getSerializer=function(e){var t=o.resolve(W);return f(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return f(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;ne(e)||(e=[e]);var i=this._getSupportedDrivers(e);function a(){n._config.driver=n.driver()}function s(e){return n._extend(e),a(),n._ready=n._initStorage(n._config),n._ready}var u=null!==this._driverSet?this._driverSet.catch((function(){return o.resolve()})):o.resolve();return this._driverSet=u.then((function(){var e=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then((function(e){n._driver=e._driver,a(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0;return function r(){for(;t<e.length;){var i=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(i).then(s).catch(r)}a();var f=new Error("No available storage method found.");return n._driverSet=o.reject(f),n._driverSet}()}}(i)}))})).catch((function(){a();var e=new Error("No available storage method found.");return n._driverSet=o.reject(e),n._driverSet})),f(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){le(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=ue.length;e<t;e++)de(this,ue[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),he=new pe;t.exports=he},{3:3}]},{},[4])(4)}))})),YU=WU(((e,t)=>{!function(r,n){"object"==typeof e&&typeof t<"u"?n(e):"function"==typeof define&&define.amd?define("localforage-driver-memory",["exports"],n):n(r.LocalforageDriverMemory={})}(typeof self<"u"?self:e,(function(e){var t=/^~~local_forage_type~([^~]+)~/,r=Object.prototype.toString;function n(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var n=new ArrayBuffer(t),i=new Uint8Array(n),a=0,o=0;a<r;a+=4){var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a+1]),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a+2]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[a+3]);i[o++]=s<<2|f>>4,i[o++]=(15&f)<<4|u>>2,i[o++]=(3&u)<<6|63&c}return n}function i(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[n]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[n])<<4|t[n+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[n+1])<<2|t[n+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[n+2]];return t.length%3==2?r=r.substring(0,r.length-1)+"=":t.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function a(e){var t,r;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var n=e instanceof Date?new Date(e):e.constructor();try{for(var i=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(Object.keys(e)),o=i.next();!o.done;o=i.next()){var s=o.value;Object.prototype.hasOwnProperty.call(e,s)&&(e.isActiveClone=null,n[s]=a(e[s]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}function o(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function s(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function f(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function u(e,t){var r,n=this;if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var i=this.config();e.name=e.name||i.name,e.storeName=e.storeName||i.storeName}return r=e.name?new Promise((function(t){e.storeName?t(o(e,n._defaultConfig)):t(e.name+"/")})):Promise.reject("Invalid arguments"),{promise:r,callback:t}}function c(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var d={bufferToString:i,deserialize:function(e){if("__lfsc__:"!==e.substring(0,9))return JSON.parse(e);var r,i=e.substring(13),a=e.substring(9,13);if("blob"===a&&t.test(i)){var o=i.match(t);r=o[1],i=i.substring(o[0].length)}var s=n(i);switch(a){case"arbf":return s;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new(typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}([s],{type:r});case"si08":return new Int8Array(s);case"ui08":return new Uint8Array(s);case"uic8":return new Uint8ClampedArray(s);case"si16":return new Int16Array(s);case"ur16":return new Uint16Array(s);case"si32":return new Int32Array(s);case"ui32":return new Uint32Array(s);case"fl32":return new Float32Array(s);case"fl64":return new Float64Array(s);default:throw new Error("Unkown type: "+a)}},serialize:function(e,t){var n="";if(e&&(n=r.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===r.call(e.buffer))){var a=void 0,o="__lfsc__:";e instanceof ArrayBuffer?(a=e,o+="arbf"):(a=e.buffer,"[object Int8Array]"===n?o+="si08":"[object Uint8Array]"===n?o+="ui08":"[object Uint8ClampedArray]"===n?o+="uic8":"[object Int16Array]"===n?o+="si16":"[object Uint16Array]"===n?o+="ur16":"[object Int32Array]"===n?o+="si32":"[object Uint32Array]"===n?o+="ui32":"[object Float32Array]"===n?o+="fl32":"[object Float64Array]"===n?o+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(o+i(a))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var r="~~local_forage_type~"+e.type+"~"+i(this.result);t("__lfsc__:blob"+r)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:n},l={},p=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return l[t]||(l[t]=new e(t)),l[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete l[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?a(e):{},r=o(t,this._defaultConfig),n=p.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=d,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=n,Promise.resolve()},e.clear=function(e){var t=this,r=this.ready().then((function(){t._dbInfo.mStore.clear()}));return s(r,e),r},e.dropInstance=function(e,t){var r=u.apply(this,arguments),n=r.promise,i=r.callback,a=n.then((function(e){p.resolve(e).drop()}));return s(a,i),n},e.getItem=function(e,t){var r=this;e=c(e);var n=this.ready().then((function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)}));return s(n,t),n},e.iterate=function(e,t){var r=this,n=this.ready().then((function(){for(var t=r._dbInfo.mStore,n=t.keys(),i=0;i<n.length;i++){var a=t.get(n[i]);if(a&&(a=r._dbInfo.serializer.deserialize(a)),void 0!==(a=e(a,n[i],i+1)))return a}}));return s(n,t),n},e.key=function(e,t){var r=this,n=this.ready().then((function(){var t;try{void 0===(t=r._dbInfo.mStore.key(e))&&(t=null)}catch{t=null}return t}));return s(n,t),n},e.keys=function(e){var t=this,r=this.ready().then((function(){return t._dbInfo.mStore.keys()}));return s(r,e),r},e.length=function(e){var t=this.keys().then((function(e){return e.length}));return s(t,e),t},e.removeItem=function(e,t){var r=this;e=c(e);var n=this.ready().then((function(){r._dbInfo.mStore.rm(e)}));return s(n,t),n},e.setItem=function(e,t,r){var n=this;e=c(e);var i=this.ready().then((function(){void 0===t&&(t=null);var r=t;return new Promise((function(i,a){n._dbInfo.serializer.serialize(t,(function(t,o){if(o)a(o);else try{n._dbInfo.mStore.set(e,t),i(r)}catch(e){a(e)}}))}))}));return s(i,r),i},Object.defineProperty(e,"__esModule",{value:!0})}))})),QU=XU(JU()),ZU=XU(YU()),ej={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var tj=function(e,t){return Object.assign(kL,t),e}(FU,{platform:"web",sdkName:"magic-sdk",version:"13.6.2",defaultEndpoint:"https://auth.magic.link/",ViewController:class extends UU{constructor(){super(...arguments),this.activeElement=null}init(){this.test="hello",this.iframe=new Promise((e=>{let t=()=>{if(function(e){let t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find((t=>t.src.includes(e))))}(encodeURIComponent(this.parameters)))new IL(tF.DuplicateIframe,"Duplicate iframes found.").log();else{let t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=RU(this.endpoint).host,t.title="Secure Modal",t.src=RU(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,function(e){for(let[t,r]of Object.entries(ej))e.style[t]=r}(t),document.body.appendChild(t),e(t)}};["loaded","interactive","complete"].includes(document.readyState)?t():window.addEventListener("load",t,!1)})),window.addEventListener("message",(e=>{var t;if(e.origin===this.endpoint&&e.data&&e.data.msgType&&this.messageHandlers.size){e.data.response=null!=(t=e.data.response)?t:{};for(let t of this.messageHandlers.values())t(e)}}))}showOverlay(){return $U(this,null,(function*(){let e=yield this.iframe;e.style.display="block",this.activeElement=document.activeElement,e.focus()}))}hideOverlay(){return $U(this,null,(function*(){var e;(yield this.iframe).style.display="none",null!=(e=this.activeElement)&&e.focus&&this.activeElement.focus(),this.activeElement=null}))}_post(e){return $U(this,null,(function*(){let t=yield this.iframe;if(!t||!t.contentWindow)throw new RL(eF.ModalNotReady,"Modal is not ready.");t.contentWindow.postMessage(e,this.endpoint)}))}},configureStorage:()=>$U(void 0,null,(function*(){let e=QU.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(ZU),yield e.setDriver([QU.default.INDEXEDDB,QU.default.LOCALSTORAGE,ZU._driver]),e}))}),rj=(e=>(e.LoginWithOIDC="magic_auth_login_with_oidc",e))(rj||{}),nj=class extends NU.Internal{constructor(){super(...arguments),this.name="openid",this.config={}}loginWithOIDC(e){let t=this.utils.createJsonRpcRequestPayload("magic_auth_login_with_oidc",[e]);return this.request(t)}};function ij(e,t){return function(){return e.apply(t,arguments)}}const{toString:aj}=Object.prototype,{getPrototypeOf:oj}=Object,sj=(e=>t=>{const r=aj.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),fj=e=>(e=e.toLowerCase(),t=>sj(t)===e),uj=e=>t=>typeof t===e,{isArray:cj}=Array,dj=uj("undefined");const lj=fj("ArrayBuffer");const pj=uj("string"),hj=uj("function"),mj=uj("number"),bj=e=>null!==e&&"object"==typeof e,yj=e=>{if("object"!==sj(e))return!1;const t=oj(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},gj=fj("Date"),vj=fj("File"),wj=fj("Blob"),_j=fj("FileList"),Ej=fj("URLSearchParams");function Tj(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),cj(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function Aj(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const Sj="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,kj=e=>!dj(e)&&e!==Sj;const Oj=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&oj(Uint8Array)),Rj=fj("HTMLFormElement"),xj=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Ij=fj("RegExp"),Cj=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Tj(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},Nj="abcdefghijklmnopqrstuvwxyz",Pj="0123456789",Mj={DIGIT:Pj,ALPHA:Nj,ALPHA_DIGIT:Nj+Nj.toUpperCase()+Pj};const Bj=fj("AsyncFunction");var Dj={isArray:cj,isArrayBuffer:lj,isBuffer:function(e){return null!==e&&!dj(e)&&null!==e.constructor&&!dj(e.constructor)&&hj(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||hj(e.append)&&("formdata"===(t=sj(e))||"object"===t&&hj(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&lj(e.buffer),t},isString:pj,isNumber:mj,isBoolean:e=>!0===e||!1===e,isObject:bj,isPlainObject:yj,isUndefined:dj,isDate:gj,isFile:vj,isBlob:wj,isRegExp:Ij,isFunction:hj,isStream:e=>bj(e)&&hj(e.pipe),isURLSearchParams:Ej,isTypedArray:Oj,isFileList:_j,forEach:Tj,merge:function e(){const{caseless:t}=kj(this)&&this||{},r={},n=(n,i)=>{const a=t&&Aj(r,i)||i;yj(r[a])&&yj(n)?r[a]=e(r[a],n):yj(n)?r[a]=e({},n):cj(n)?r[a]=n.slice():r[a]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Tj(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(Tj(t,((t,n)=>{r&&hj(t)?e[n]=ij(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,a,o;const s={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],n&&!n(o,e,t)||s[o]||(t[o]=e[o],s[o]=!0);e=!1!==r&&oj(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:sj,kindOfTest:fj,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(cj(e))return e;let t=e.length;if(!mj(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Rj,hasOwnProperty:xj,hasOwnProp:xj,reduceDescriptors:Cj,freezeMethods:e=>{Cj(e,((t,r)=>{if(hj(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];hj(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return cj(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:Aj,global:Sj,isContextDefined:kj,ALPHABET:Mj,generateString:(e=16,t=Mj.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&hj(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(bj(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=cj(e)?[]:{};return Tj(e,((e,t)=>{const a=r(e,n+1);!dj(a)&&(i[t]=a)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:Bj,isThenable:e=>e&&(bj(e)||hj(e))&&hj(e.then)&&hj(e.catch)};function Fj(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}Dj.inherits(Fj,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Dj.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Lj=Fj.prototype,Uj={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{Uj[e]={value:e}})),Object.defineProperties(Fj,Uj),Object.defineProperty(Lj,"isAxiosError",{value:!0}),Fj.from=(e,t,r,n,i,a)=>{const o=Object.create(Lj);return Dj.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),Fj.call(o,e.message,t,r,n,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function jj(e){return Dj.isPlainObject(e)||Dj.isArray(e)}function qj(e){return Dj.endsWith(e,"[]")?e.slice(0,-2):e}function zj(e,t,r){return e?e.concat(t).map((function(e,t){return e=qj(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const Hj=Dj.toFlatObject(Dj,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Vj(e,t,r){if(!Dj.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=Dj.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Dj.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Dj.isSpecCompliantForm(t);if(!Dj.isFunction(i))throw new TypeError("visitor must be a function");function f(e){if(null===e)return"";if(Dj.isDate(e))return e.toISOString();if(!s&&Dj.isBlob(e))throw new Fj("Blob is not supported. Use a Buffer instead.");return Dj.isArrayBuffer(e)||Dj.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if(Dj.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Dj.isArray(e)&&function(e){return Dj.isArray(e)&&!e.some(jj)}(e)||(Dj.isFileList(e)||Dj.endsWith(r,"[]"))&&(s=Dj.toArray(e)))return r=qj(r),s.forEach((function(e,n){!Dj.isUndefined(e)&&null!==e&&t.append(!0===o?zj([r],n,a):null===o?r:r+"[]",f(e))})),!1;return!!jj(e)||(t.append(zj(i,r,a),f(e)),!1)}const c=[],d=Object.assign(Hj,{defaultVisitor:u,convertValue:f,isVisitable:jj});if(!Dj.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Dj.isUndefined(r)){if(-1!==c.indexOf(r))throw Error("Circular reference detected in "+n.join("."));c.push(r),Dj.forEach(r,(function(r,a){!0===(!(Dj.isUndefined(r)||null===r)&&i.call(t,r,Dj.isString(a)?a.trim():a,n,d))&&e(r,n?n.concat(a):[a])})),c.pop()}}(e),t}function Gj(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Kj(e,t){this._pairs=[],e&&Vj(e,this,t)}const Wj=Kj.prototype;function Xj(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $j(e,t,r){if(!t)return e;const n=r&&r.encode||Xj,i=r&&r.serialize;let a;if(a=i?i(t,r):Dj.isURLSearchParams(t)?t.toString():new Kj(t,r).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}Wj.append=function(e,t){this._pairs.push([e,t])},Wj.toString=function(e){const t=e?function(t){return e.call(this,t,Gj)}:Gj;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Jj=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Dj.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Yj={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Qj={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Kj,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function Zj(e){function t(e,r,n,i){let a=e[i++];const o=Number.isFinite(+a),s=i>=e.length;if(a=!a&&Dj.isArray(n)?n.length:a,s)return Dj.hasOwnProp(n,a)?n[a]=[n[a],r]:n[a]=r,!o;n[a]&&Dj.isObject(n[a])||(n[a]=[]);return t(e,r,n[a],i)&&Dj.isArray(n[a])&&(n[a]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}(n[a])),!o}if(Dj.isFormData(e)&&Dj.isFunction(e.entries)){const r={};return Dj.forEachEntry(e,((e,n)=>{t(function(e){return Dj.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const eq={"Content-Type":void 0};const tq={transitional:Yj,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=Dj.isObject(e);i&&Dj.isHTMLForm(e)&&(e=new FormData(e));if(Dj.isFormData(e))return n&&n?JSON.stringify(Zj(e)):e;if(Dj.isArrayBuffer(e)||Dj.isBuffer(e)||Dj.isStream(e)||Dj.isFile(e)||Dj.isBlob(e))return e;if(Dj.isArrayBufferView(e))return e.buffer;if(Dj.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Vj(e,new Qj.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Qj.isNode&&Dj.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=Dj.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Vj(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(Dj.isString(e))try{return(t||JSON.parse)(e),Dj.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||tq.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&Dj.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw Fj.from(e,Fj.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Qj.classes.FormData,Blob:Qj.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Dj.forEach(["delete","get","head"],(function(e){tq.headers[e]={}})),Dj.forEach(["post","put","patch"],(function(e){tq.headers[e]=Dj.merge(eq)}));var rq=tq;const nq=Dj.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const iq=Symbol("internals");function aq(e){return e&&String(e).trim().toLowerCase()}function oq(e){return!1===e||null==e?e:Dj.isArray(e)?e.map(oq):String(e)}function sq(e,t,r,n,i){return Dj.isFunction(n)?n.call(this,t,r):(i&&(t=r),Dj.isString(t)?Dj.isString(n)?-1!==t.indexOf(n):Dj.isRegExp(n)?n.test(t):void 0:void 0)}class fq{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=aq(t);if(!i)throw new Error("header name must be a non-empty string");const a=Dj.findKey(n,i);(!a||void 0===n[a]||!0===r||void 0===r&&!1!==n[a])&&(n[a||t]=oq(e))}const a=(e,t)=>Dj.forEach(e,((e,r)=>i(e,r,t)));return Dj.isPlainObject(e)||e instanceof this.constructor?a(e,t):Dj.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?a((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&nq[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=aq(e)){const r=Dj.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(Dj.isFunction(t))return t.call(this,e,r);if(Dj.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=aq(e)){const r=Dj.findKey(this,e);return!(!r||void 0===this[r]||t&&!sq(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=aq(e)){const i=Dj.findKey(r,e);!i||t&&!sq(0,r[i],i,t)||(delete r[i],n=!0)}}return Dj.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!sq(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return Dj.forEach(this,((n,i)=>{const a=Dj.findKey(r,i);if(a)return t[a]=oq(n),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();o!==i&&delete t[i],t[o]=oq(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Dj.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&Dj.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[iq]=this[iq]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=aq(e);t[n]||(!function(e,t){const r=Dj.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return Dj.isArray(e)?e.forEach(n):n(e),this}}fq.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Dj.freezeMethods(fq.prototype),Dj.freezeMethods(fq);var uq=fq;function cq(e,t){const r=this||rq,n=t||r,i=uq.from(n.headers);let a=n.data;return Dj.forEach(e,(function(e){a=e.call(r,a,i.normalize(),t?t.status:void 0)})),i.normalize(),a}function dq(e){return!(!e||!e.__CANCEL__)}function lq(e,t,r){Fj.call(this,null==e?"canceled":e,Fj.ERR_CANCELED,t,r),this.name="CanceledError"}Dj.inherits(lq,Fj,{__CANCEL__:!0});var pq=Qj.isStandardBrowserEnv?{write:function(e,t,r,n,i,a){const o=[];o.push(e+"="+encodeURIComponent(t)),Dj.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Dj.isString(n)&&o.push("path="+n),Dj.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function hq(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var mq=Qj.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=Dj.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function bq(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,a=0,o=0;return t=void 0!==t?t:1e3,function(s){const f=Date.now(),u=n[o];i||(i=f),r[a]=s,n[a]=f;let c=o,d=0;for(;c!==a;)d+=r[c++],c%=e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),f-i<t)return;const l=u&&f-u;return l?Math.round(1e3*d/l):void 0}}(50,250);return i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,s=a-r,f=n(s);r=a;const u={loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:f||void 0,estimated:f&&o&&a<=o?(o-a)/f:void 0,event:i};u[t?"download":"upload"]=!0,e(u)}}var yq="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=uq.from(e.headers).normalize(),a=e.responseType;let o;function s(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}Dj.isFormData(n)&&(Qj.isStandardBrowserEnv||Qj.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let f=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const u=hq(e.baseURL,e.url);function c(){if(!f)return;const n=uq.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Fj("Request failed with status code "+r.status,[Fj.ERR_BAD_REQUEST,Fj.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),s()}),(function(e){r(e),s()}),{data:a&&"text"!==a&&"json"!==a?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:n,config:e,request:f}),f=null}if(f.open(e.method.toUpperCase(),$j(u,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,"onloadend"in f?f.onloadend=c:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(c)},f.onabort=function(){f&&(r(new Fj("Request aborted",Fj.ECONNABORTED,e,f)),f=null)},f.onerror=function(){r(new Fj("Network Error",Fj.ERR_NETWORK,e,f)),f=null},f.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Yj;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new Fj(t,n.clarifyTimeoutError?Fj.ETIMEDOUT:Fj.ECONNABORTED,e,f)),f=null},Qj.isStandardBrowserEnv){const t=(e.withCredentials||mq(u))&&e.xsrfCookieName&&pq.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in f&&Dj.forEach(i.toJSON(),(function(e,t){f.setRequestHeader(t,e)})),Dj.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&"json"!==a&&(f.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",bq(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",bq(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{f&&(r(!t||t.type?new lq(null,e,f):t),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);d&&-1===Qj.protocols.indexOf(d)?r(new Fj("Unsupported protocol "+d+":",Fj.ERR_BAD_REQUEST,e)):f.send(n||null)}))};const gq={http:null,xhr:yq};Dj.forEach(gq,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var vq=e=>{e=Dj.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=Dj.isString(r)?gq[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new Fj(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(Dj.hasOwnProp(gq,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!Dj.isFunction(n))throw new TypeError("adapter is not a function");return n};function wq(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new lq(null,e)}function _q(e){wq(e),e.headers=uq.from(e.headers),e.data=cq.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return vq(e.adapter||rq.adapter)(e).then((function(t){return wq(e),t.data=cq.call(e,e.transformResponse,t),t.headers=uq.from(t.headers),t}),(function(t){return dq(t)||(wq(e),t&&t.response&&(t.response.data=cq.call(e,e.transformResponse,t.response),t.response.headers=uq.from(t.response.headers))),Promise.reject(t)}))}const Eq=e=>e instanceof uq?e.toJSON():e;function Tq(e,t){t=t||{};const r={};function n(e,t,r){return Dj.isPlainObject(e)&&Dj.isPlainObject(t)?Dj.merge.call({caseless:r},e,t):Dj.isPlainObject(t)?Dj.merge({},t):Dj.isArray(t)?t.slice():t}function i(e,t,r){return Dj.isUndefined(t)?Dj.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function a(e,t){if(!Dj.isUndefined(t))return n(void 0,t)}function o(e,t){return Dj.isUndefined(t)?Dj.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,a){return a in t?n(r,i):a in e?n(void 0,r):void 0}const f={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(e,t)=>i(Eq(e),Eq(t),!0)};return Dj.forEach(Object.keys(Object.assign({},e,t)),(function(n){const a=f[n]||i,o=a(e[n],t[n],n);Dj.isUndefined(o)&&a!==s||(r[n]=o)})),r}const Aq="1.4.0",Sq={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Sq[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const kq={};Sq.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,a)=>{if(!1===e)throw new Fj(n(i," has been removed"+(t?" in "+t:"")),Fj.ERR_DEPRECATED);return t&&!kq[i]&&(kq[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}};var Oq={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Fj("options must be an object",Fj.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const a=n[i],o=t[a];if(o){const t=e[a],r=void 0===t||o(t,a,e);if(!0!==r)throw new Fj("option "+a+" must be "+r,Fj.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new Fj("Unknown option "+a,Fj.ERR_BAD_OPTION)}},validators:Sq};const Rq=Oq.validators;class xq{constructor(e){this.defaults=e,this.interceptors={request:new Jj,response:new Jj}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Tq(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let a;void 0!==r&&Oq.assertOptions(r,{silentJSONParsing:Rq.transitional(Rq.boolean),forcedJSONParsing:Rq.transitional(Rq.boolean),clarifyTimeoutError:Rq.transitional(Rq.boolean)},!1),null!=n&&(Dj.isFunction(n)?t.paramsSerializer={serialize:n}:Oq.assertOptions(n,{encode:Rq.function,serialize:Rq.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=i&&Dj.merge(i.common,i[t.method]),a&&Dj.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=uq.concat(a,i);const o=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const f=[];let u;this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)}));let c,d=0;if(!s){const e=[_q.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,f),c=e.length,u=Promise.resolve(t);d<c;)u=u.then(e[d++],e[d++]);return u}c=o.length;let l=t;for(d=0;d<c;){const e=o[d++],t=o[d++];try{l=e(l)}catch(e){t.call(this,e);break}}try{u=_q.call(this,l)}catch(e){return Promise.reject(e)}for(d=0,c=f.length;d<c;)u=u.then(f[d++],f[d++]);return u}getUri(e){return $j(hq((e=Tq(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}Dj.forEach(["delete","get","head","options"],(function(e){xq.prototype[e]=function(t,r){return this.request(Tq(r||{},{method:e,url:t,data:(r||{}).data}))}})),Dj.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(Tq(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}xq.prototype[e]=t(),xq.prototype[e+"Form"]=t(!0)}));var Iq=xq;class Cq{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new lq(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;const t=new Cq((function(t){e=t}));return{token:t,cancel:e}}}var Nq=Cq;const Pq={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Pq).forEach((([e,t])=>{Pq[t]=e}));var Mq=Pq;const Bq=function e(t){const r=new Iq(t),n=ij(Iq.prototype.request,r);return Dj.extend(n,Iq.prototype,r,{allOwnKeys:!0}),Dj.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Tq(t,r))},n}(rq);Bq.Axios=Iq,Bq.CanceledError=lq,Bq.CancelToken=Nq,Bq.isCancel=dq,Bq.VERSION=Aq,Bq.toFormData=Vj,Bq.AxiosError=Fj,Bq.Cancel=Bq.CanceledError,Bq.all=function(e){return Promise.all(e)},Bq.spread=function(e){return function(t){return e.apply(null,t)}},Bq.isAxiosError=function(e){return Dj.isObject(e)&&!0===e.isAxiosError},Bq.mergeConfig=Tq,Bq.AxiosHeaders=uq,Bq.formToJSON=e=>Zj(Dj.isHTMLForm(e)?new FormData(e):e),Bq.HttpStatusCode=Mq,Bq.default=Bq;var Dq=Bq;const Fq="https://guardian.sandbox.imtbl.com".replace(/\/+$/,"");class Lq{basePath;axios;configuration;constructor(e,t=Fq,r=Dq){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Uq extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const jq="https://example.com",qq=function(e,t,r){if(null==r)throw new Uq(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},zq=async function(e,t){if(t&&t.accessToken){const r="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+r}};function Hq(e,t,r=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>Hq(e,t,r))):Object.keys(t).forEach((n=>Hq(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t))}const Vq=function(e,...t){const r=new URLSearchParams(e.search);Hq(r,t),e.search=r.toString()},Gq=function(e,t,r){const n="string"!=typeof e;return(n&&r&&r.isJsonMime?r.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},Kq=function(e){return e.pathname+e.search+e.hash},Wq=function(e,t,r,n){return(i=t,a=r)=>{const o={...e.options,url:(n?.basePath||a)+e.url};return i.request(o)}},Xq=function(e){const t=function(e){return{approvePendingTransaction:async(t,r,n={})=>{qq("approvePendingTransaction","payloadHash",t),qq("approvePendingTransaction","transactionApprovalRequest",r);const i="/guardian/v1/transactions/{payloadHash}/approve".replace("{payloadHash}",encodeURIComponent(String(t))),a=new URL(i,jq);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},f={};await zq(f,e),f["Content-Type"]="application/json",Vq(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...f,...u,...n.headers},s.data=Gq(r,s,e),{url:Kq(a),options:s}},evaluateTransaction:async(t,r,n={})=>{qq("evaluateTransaction","id",t),qq("evaluateTransaction","transactionEvaluationRequest",r);const i="/guardian/v1/transactions/{id}/evaluate".replace("{id}",encodeURIComponent(String(t))),a=new URL(i,jq);let o;e&&(o=e.baseOptions);const s={method:"POST",...o,...n},f={};await zq(f,e),f["Content-Type"]="application/json",Vq(a,{});let u=o&&o.headers?o.headers:{};return s.headers={...f,...u,...n.headers},s.data=Gq(r,s,e),{url:Kq(a),options:s}},getTransactionByID:async(t,r,n,i={})=>{qq("getTransactionByID","transactionID",t),qq("getTransactionByID","chainType",r);const a="/guardian/v1/transactions/{transactionID}".replace("{transactionID}",encodeURIComponent(String(t))),o=new URL(a,jq);let s;e&&(s=e.baseOptions);const f={method:"GET",...s,...i},u={},c={};await zq(u,e),void 0!==r&&(c.chainType=r),void 0!==n&&(c.chainID=n),Vq(o,c);let d=s&&s.headers?s.headers:{};return f.headers={...u,...d,...i.headers},{url:Kq(o),options:f}}}}(e);return{async approvePendingTransaction(r,n,i){const a=await t.approvePendingTransaction(r,n,i);return Wq(a,Dq,Fq,e)},async evaluateTransaction(r,n,i){const a=await t.evaluateTransaction(r,n,i);return Wq(a,Dq,Fq,e)},async getTransactionByID(r,n,i,a){const o=await t.getTransactionByID(r,n,i,a);return Wq(o,Dq,Fq,e)}}};class $q extends Lq{approvePendingTransaction(e,t){return Xq(this.configuration).approvePendingTransaction(e.payloadHash,e.transactionApprovalRequest,t).then((e=>e(this.axios,this.basePath)))}evaluateTransaction(e,t){return Xq(this.configuration).evaluateTransaction(e.id,e.transactionEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionByID(e,t){return Xq(this.configuration).getTransactionByID(e.transactionID,e.chainType,e.chainID,t).then((e=>e(this.axios,this.basePath)))}}class Jq{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const Yq="starkex",Qq="evm";function Zq(e){const t=-1!==new li(e,16).cmp(new li(27))?new li(e,16).sub(new li(27)).toNumber():new li(e,16).toNumber();return e.trim()?t:void 0}async function ez(e,t){const r=function(e,t=64){const r=Cy(e);return{r:new li(r.substring(0,t),"hex"),s:new li(r.substring(t,2*t),"hex"),recoveryParam:Zq(r.substring(2*t,2*t+2))}}(await t.signMessage(e));return Py(xy((n=r).r.toString(16),64)+xy(n.s.toString(16),64)+xy(n.recoveryParam?.toString(16)||"",2));var n}function tz(e){switch(e.type){case"ERC721":return{type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return{type:"ERC20",data:{token_address:e.tokenAddress}};default:return{type:"ETH",data:{decimals:18}}}}const rz={erc1271:Object.freeze({__proto__:null,abi:[{type:"function",name:"isValidSignature",constant:!0,inputs:[{type:"bytes32"},{type:"bytes"}],outputs:[{type:"bytes4"}],payable:!1,stateMutability:"view"}],returns:{isValidSignatureBytes32:"0x1626ba7e"}}),factory:Object.freeze({__proto__:null,abi:[{type:"function",name:"deploy",constant:!1,inputs:[{type:"address"},{type:"bytes32"}],outputs:[],payable:!0,stateMutability:"payable"}]}),mainModule:Object.freeze({__proto__:null,abi:[{type:"function",name:"nonce",constant:!0,inputs:[],outputs:[{type:"uint256"}],payable:!1,stateMutability:"view"},{type:"function",name:"readNonce",constant:!0,inputs:[{type:"uint256"}],outputs:[{type:"uint256"}],payable:!1,stateMutability:"view"},{type:"function",name:"updateImplementation",constant:!1,inputs:[{type:"address"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"selfExecute",constant:!1,inputs:[{components:[{type:"bool",name:"delegateCall"},{type:"bool",name:"revertOnError"},{type:"uint256",name:"gasLimit"},{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}],type:"tuple[]"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"execute",constant:!1,inputs:[{components:[{type:"bool",name:"delegateCall"},{type:"bool",name:"revertOnError"},{type:"uint256",name:"gasLimit"},{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}],type:"tuple[]"},{type:"uint256"},{type:"bytes"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"createContract",inputs:[{type:"bytes"}],payable:!0,stateMutability:"payable"}]}),mainModuleUpgradable:Object.freeze({__proto__:null,abi:[{type:"function",name:"updateImageHash",constant:!0,inputs:[{type:"bytes32"}],outputs:[],payable:!1,stateMutability:"view"},{type:"function",name:"imageHash",constant:!0,inputs:[],outputs:[{type:"bytes32"}],payable:!1,stateMutability:"view"}]}),sequenceUtils:Object.freeze({__proto__:null,abi:[{inputs:[{internalType:"address",name:"_factory",type:"address"},{internalType:"address",name:"_mainModule",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"_wallet",type:"address"},{indexed:!0,internalType:"bytes32",name:"_imageHash",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"_threshold",type:"uint256"},{indexed:!1,internalType:"bytes",name:"_signers",type:"bytes"}],name:"RequiredConfig",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"_wallet",type:"address"},{indexed:!0,internalType:"address",name:"_signer",type:"address"}],name:"RequiredSigner",type:"event"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callBalanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callBlockNumber",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_i",type:"uint256"}],name:"callBlockhash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"callChainId",outputs:[{internalType:"uint256",name:"id",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCode",outputs:[{internalType:"bytes",name:"code",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCodeHash",outputs:[{internalType:"bytes32",name:"codeHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCodeSize",outputs:[{internalType:"uint256",name:"size",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callCoinbase",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"callDifficulty",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasLeft",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasLimit",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callOrigin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"callTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"knownImageHashes",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"lastImageHashUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lastSignerUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lastWalletUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"bool",name:"delegateCall",type:"bool"},{internalType:"bool",name:"revertOnError",type:"bool"},{internalType:"uint256",name:"gasLimit",type:"uint256"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],internalType:"struct IModuleCalls.Transaction[]",name:"_txs",type:"tuple[]"}],name:"multiCall",outputs:[{internalType:"bool[]",name:"_successes",type:"bool[]"},{internalType:"bytes[]",name:"_results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"uint256",name:"_threshold",type:"uint256"},{components:[{internalType:"uint256",name:"weight",type:"uint256"},{internalType:"address",name:"signer",type:"address"}],internalType:"struct RequireUtils.Member[]",name:"_members",type:"tuple[]"},{internalType:"bool",name:"_index",type:"bool"}],name:"publishConfig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"uint256",name:"_sizeMembers",type:"uint256"},{internalType:"bytes",name:"_signature",type:"bytes"},{internalType:"bool",name:"_index",type:"bool"}],name:"publishInitialSigners",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"uint256",name:"_nonce",type:"uint256"}],name:"requireMinNonce",outputs:[],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_expiration",type:"uint256"}],name:"requireNonExpired",outputs:[],stateMutability:"view",type:"function"}]}),requireFreshSigner:Object.freeze({__proto__:null,abi:[{inputs:[{internalType:"address",name:"",type:"address"}],name:"requireFreshSigner",outputs:[],stateMutability:"nonpayable",type:"function"}]})};function nz(){return nz=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},nz.apply(this,arguments)}var iz;!function(e){e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.DISABLED=5]="DISABLED"}(iz||(iz={}));function az(e,t){return function(...r){const n=Array.prototype.slice.call(r);return new Promise((async(r,i)=>{try{n.push(((e,t)=>e?i(e):r(t))),await e.apply(t,n)}catch(e){i(e)}}))}}new class{constructor(e){this.config=e,this.logLevel=void 0,this.configure(e)}configure(e){switch(this.config=nz({},this.config,e),this.config.logLevel){case"DEBUG":this.logLevel=iz.DEBUG;break;case"INFO":default:this.logLevel=iz.INFO;break;case"WARN":this.logLevel=iz.WARN;break;case"ERROR":this.logLevel=iz.ERROR;break;case"DISABLED":this.logLevel=iz.DISABLED}void 0===this.config.silence&&(this.config.silence=!1)}debug(e,...t){!0!==this.config.silence&&this.logLevel===iz.DEBUG&&console.log(e,...t)}info(e,...t){!0!==this.config.silence&&this.logLevel<=iz.INFO&&console.log(e,...t)}warn(e,...t){!0!==this.config.silence&&this.logLevel<=iz.WARN&&(console.warn(e,...t),this.config.onwarn&&this.config.onwarn(e,t))}error(e,...t){!0!==this.config.silence&&this.logLevel<=iz.ERROR&&(console.error(e,...t),this.config.onerror&&this.config.onerror(e,t))}}({logLevel:"INFO",silence:!0});const oz=(e=0,t=Number.MAX_SAFE_INTEGER)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e);function sz(){return sz=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sz.apply(this,arguments)}const fz=(e,t=!1)=>(((e,t=!1,r=!1)=>{if(!e)throw new Error("invalid network config: empty config");const n=[];if(Array.isArray(e)?n.push(...e):n.push(e),0===n.length){if(t)throw new Error("invalid network config: empty config");return!1}const i=n.map((e=>e.chainId)).sort(),a=i.filter(((e,t)=>i.indexOf(e)!==t));if(a.length>0){if(t)throw new Error(`invalid network config: duplicate chainIds ${a}`);return!1}n.forEach((e=>e.name=e.name.toLowerCase()));const o=n.map((e=>e.name)).sort(),s=o.filter(((e,t)=>o.indexOf(e)!==t));if(s.length>0){if(t)throw new Error(`invalid network config: duplicate network names ${s}`);return!1}let f=!1,u=!1;for(let e=0;e<n.length;e++){const i=n[e];if(!(i.rpcUrl&&""!==i.rpcUrl||i.provider)){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: rpcUrl or provider must be provided`);return!1}if(!r&&!i.relayer){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: relayer must be provided`);return!1}if(i.isDefaultChain){if(f){if(t)throw new Error(`invalid network config for chainId ${i.chainId}: DefaultChain is already set by another config`);return!1}f=!0}if(i.isAuthChain){if(u&&t)throw new Error(`invalid network config for chainId ${i.chainId}: AuthChain is already set by another config`);u=!0}}if(!f){if(t)throw new Error("invalid network config: DefaultChain must be set");return!1}if(!u){if(t)throw new Error("invalid network config: AuthChain must be set");return!1}})(e,!0,t),e),uz=e=>fz(cz(e)),cz=e=>{if(!e)return[];const t=e.sort(((e,t)=>e.chainId===t.chainId?0:e.chainId<t.chainId?-1:1)),r=t.findIndex((e=>e.isDefaultChain));r>0&&t.splice(0,0,t.splice(r,1)[0]);const n=t.findIndex((e=>e.isAuthChain&&!0!==e.isDefaultChain));return n>0&&t.splice(1,0,t.splice(n,1)[0]),t},dz=(e,t)=>"string"==typeof e?(t=t||{},e.replace(/\$\{\s*([$#@\-\d\w]+)\s*\}/gim,(function(e,r){let n=t[r];return n="function"==typeof n?n():null==n?"":"object"==typeof n||"symbol"==typeof n?n.toString():n.valueOf(),n}))):"";let lz;!function(e){e[e.MAINNET=1]="MAINNET",e[e.ROPSTEN=3]="ROPSTEN",e[e.RINKEBY=4]="RINKEBY",e[e.GOERLI=5]="GOERLI",e[e.KOVAN=42]="KOVAN",e[e.POLYGON=137]="POLYGON",e[e.POLYGON_MUMBAI=80001]="POLYGON_MUMBAI",e[e.POLYGON_ZKEVM=1101]="POLYGON_ZKEVM",e[e.BSC=56]="BSC",e[e.BSC_TESTNET=97]="BSC_TESTNET",e[e.OPTIMISM=10]="OPTIMISM",e[e.OPTIMISM_TESTNET=69]="OPTIMISM_TESTNET",e[e.ARBITRUM=42161]="ARBITRUM",e[e.ARBITRUM_GOERLI=421613]="ARBITRUM_GOERLI",e[e.ARBITRUM_NOVA=42170]="ARBITRUM_NOVA",e[e.AVALANCHE=43114]="AVALANCHE",e[e.AVALANCHE_TESTNET=43113]="AVALANCHE_TESTNET",e[e.FANTOM=250]="FANTOM",e[e.FANTOM_TESTNET=4002]="FANTOM_TESTNET",e[e.GNOSIS=100]="GNOSIS",e[e.AURORA=1313161554]="AURORA",e[e.AURORA_TESTNET=1313161556]="AURORA_TESTNET",e[e.BASE_GOERLI=84531]="BASE_GOERLI"}(lz||(lz={}));const pz=e=>dz("https://${network}-indexer.sequence.app",{network:e}),hz=e=>dz("https://${network}-relayer.sequence.app",{network:e}),mz=e=>dz("https://nodes.sequence.app/${network}",{network:e}),bz={[lz.MAINNET]:{chainId:lz.MAINNET,name:"mainnet",title:"Ethereum",blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[lz.ROPSTEN]:{chainId:lz.ROPSTEN,name:"ropsten",title:"Ropsten",testnet:!0,blockExplorer:{name:"Etherscan (Ropsten)",rootUrl:"https://ropsten.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[lz.RINKEBY]:{chainId:lz.RINKEBY,name:"rinkeby",title:"Rinkeby",testnet:!0,blockExplorer:{name:"Etherscan (Rinkeby)",rootUrl:"https://rinkeby.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",disabled:!0},[lz.GOERLI]:{chainId:lz.GOERLI,name:"goerli",title:"Goerli",testnet:!0,blockExplorer:{name:"Etherscan (Goerli)",rootUrl:"https://goerli.etherscan.io/"},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[lz.KOVAN]:{chainId:lz.KOVAN,name:"kovan",title:"Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"}},[lz.POLYGON]:{chainId:lz.POLYGON,name:"polygon",title:"Polygon",blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"}},[lz.POLYGON_MUMBAI]:{chainId:lz.POLYGON_MUMBAI,name:"mumbai",title:"Polygon Mumbai",testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"}},[lz.POLYGON_ZKEVM]:{chainId:lz.POLYGON_ZKEVM,name:"polygon-zkevm",title:"Polygon zkEVM",blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"}},[lz.BSC]:{chainId:lz.BSC,name:"bsc",title:"BNB Smart Chain",blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"}},[lz.BSC_TESTNET]:{chainId:lz.BSC_TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"}},[lz.OPTIMISM]:{chainId:lz.OPTIMISM,name:"optimism",title:"Optimism",blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"}},[lz.OPTIMISM_TESTNET]:{chainId:lz.OPTIMISM_TESTNET,name:"optimism-testnet",title:"Optimistic Kovan",testnet:!0,blockExplorer:{name:"Etherscan (Optimism Testnet)",rootUrl:"https://kovan-optimistic.etherscan.io/"}},[lz.ARBITRUM]:{chainId:lz.ARBITRUM,name:"arbitrum",title:"Arbitrum One",blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"}},[lz.ARBITRUM_GOERLI]:{chainId:lz.ARBITRUM_GOERLI,name:"arbitrum-goerli",title:"Arbitrum Goerli",testnet:!0,blockExplorer:{name:"Arbiscan (Testnet)",rootUrl:"https://testnet.arbiscan.io/"}},[lz.ARBITRUM_NOVA]:{chainId:lz.ARBITRUM_NOVA,name:"arbitrum-nova",title:"Arbitrum Nova",blockExplorer:{name:"Nova Explorer",rootUrl:"https://nova-explorer.arbitrum.io/"}},[lz.AVALANCHE]:{chainId:lz.AVALANCHE,name:"avalanche",title:"Avalanche",blockExplorer:{name:"Snowtrace",rootUrl:"https://snowtrace.io/"}},[lz.AVALANCHE_TESTNET]:{chainId:lz.AVALANCHE_TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",testnet:!0,blockExplorer:{name:"Snowtrace (Testnet)",rootUrl:"https://testnet.snowtrace.io/"}},[lz.FANTOM]:{chainId:lz.FANTOM,name:"fantom",title:"Fantom",blockExplorer:{name:"FTMScan",rootUrl:"https://ftmscan.com/"}},[lz.FANTOM_TESTNET]:{chainId:lz.FANTOM_TESTNET,name:"fantom-testnet",title:"Fantom Testnet",testnet:!0,blockExplorer:{name:"FTMScan (Testnet)",rootUrl:"https://testnet.ftmscan.com/"}},[lz.GNOSIS]:{chainId:lz.GNOSIS,name:"gnosis",title:"Gnosis Chain",blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"}},[lz.AURORA]:{chainId:lz.AURORA,name:"aurora",title:"Aurora",blockExplorer:{name:"Aurora Explorer",rootUrl:"https://aurorascan.dev/"}},[lz.AURORA_TESTNET]:{chainId:lz.AURORA_TESTNET,name:"aurora-testnet",title:"Aurora Testnet",blockExplorer:{name:"Aurora Explorer (Testnet)",rootUrl:"https://testnet.aurorascan.dev/"}},[lz.BASE_GOERLI]:{chainId:lz.BASE_GOERLI,name:"base-goerli",title:"Base Goerli",blockExplorer:{name:"Base Goerli Explorer",rootUrl:"https://goerli.basescan.org/"}}};uz([sz({},bz[lz.MAINNET],{rpcUrl:mz("mainnet"),relayer:{url:hz("mainnet")},indexerUrl:pz("mainnet")}),sz({},bz[lz.POLYGON],{rpcUrl:mz("polygon"),relayer:{url:hz("polygon")},indexerUrl:pz("polygon"),isDefaultChain:!0,isAuthChain:!0}),sz({},bz[lz.BSC],{rpcUrl:mz("bsc"),indexerUrl:pz("bsc"),relayer:{url:hz("bsc")}}),sz({},bz[lz.AVALANCHE],{rpcUrl:mz("avalanche"),indexerUrl:pz("avalanche"),relayer:{url:hz("avalanche")}}),sz({},bz[lz.ARBITRUM],{rpcUrl:mz("arbitrum"),indexerUrl:pz("arbitrum"),relayer:{url:hz("arbitrum")}}),sz({},bz[lz.ARBITRUM_NOVA],{rpcUrl:mz("arbitrum-nova"),indexerUrl:pz("arbitrum-nova"),relayer:{url:hz("arbitrum-nova")}}),sz({},bz[lz.OPTIMISM],{rpcUrl:mz("optimism"),indexerUrl:pz("optimism"),relayer:{url:hz("optimism")}}),sz({},bz[lz.POLYGON_ZKEVM],{rpcUrl:mz("polygon-zkevm"),indexerUrl:pz("polygon-zkevm"),relayer:{url:hz("polygon-zkevm")}}),sz({},bz[lz.GNOSIS],{rpcUrl:mz("gnosis"),indexerUrl:pz("gnosis"),relayer:{url:hz("gnosis")}})]),uz([sz({},bz[lz.RINKEBY],{rpcUrl:mz("rinkeby"),relayer:{url:hz("rinkeby")},indexerUrl:pz("rinkeby")}),sz({},bz[lz.GOERLI],{rpcUrl:mz("goerli"),relayer:{url:hz("goerli")},indexerUrl:pz("goerli")}),sz({},bz[lz.POLYGON_MUMBAI],{rpcUrl:mz("mumbai"),relayer:{url:hz("mumbai")},indexerUrl:pz("mumbai"),isDefaultChain:!0,isAuthChain:!0}),sz({},bz[lz.BSC_TESTNET],{rpcUrl:mz("bsc-testnet"),relayer:{url:hz("bsc-testnet")},indexerUrl:pz("bsc-testnet")}),sz({},bz[lz.ARBITRUM_GOERLI],{rpcUrl:mz("arbitrum-goerli"),relayer:{url:hz("arbitrum-goerli")},indexerUrl:pz("arbitrum-goerli")}),sz({},bz[lz.BASE_GOERLI],{rpcUrl:mz("base-goerli"),relayer:{url:hz("base-goerli")},indexerUrl:pz("base-goerli")})]);const yz="2.0";function gz(){return gz=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},gz.apply(this,arguments)}let vz;function wz(e,t){return e.reduce((function(e,r,n){return t(r,n)?e[0].push(r):e[1].push(r),e}),[[],[]])}!function(e){e.ethCall="eth_call",e.ethGetBalance="eth_getBalance",e.ethGetCode="eth_getCode"}(vz||(vz={}));const _z={batchSize:50,timeWindow:50,contract:"0xd130B43062D875a4B7aF3f8fc036Bc6e9D3E1B3E",verbose:!1};let Ez=class e{constructor(t){var r=this;if(this.batchableJsonRpcMethods=[vz.ethCall,vz.ethGetCode,vz.ethGetBalance],this.multicallInterface=new Df(rz.sequenceUtils.abi),this.options=void 0,this.timeout=void 0,this.queue=[],this.scheduleExecution=()=>{this.queue.length>0&&(this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(this.run,this.options.timeWindow))},this.handle=(e,t,r)=>this.batchableJsonRpcMethods.find((e=>e===t.method))?(this.queue.push({request:t,callback:r,next:e}),this.options.verbose&&console.log("Scheduling call",t.method),void this.scheduleExecution()):(this.options.verbose&&console.log("Forwarded call",t.method),e(t,r)),this.run=async function(){r.options.verbose&&console.log("Processing multicall");const e=Math.min(r.options.batchSize,r.queue.length);if(0===e)return;if(1===e)return r.forward(r.queue[0]),r.queue=[],void(r.options.verbose&&console.log("Skip multicall, single item"));r.options.verbose&&console.log("Resolving",e);var t=r.queue.slice(0,e);r.queue=e===r.queue.length?[]:r.queue.slice(e),r.options.verbose&&console.log("Updated queue",r.queue.length),0!==r.queue.length&&r.scheduleExecution();const n=t[0].next;let i;var[t,a]=wz(t,(e=>{try{if(e.next!==n)return!1;switch(e.request.method){case vz.ethCall:if(e.request.params[0].from||e.request.params[0].gasPrice||e.request.params[0].value)return!1;case vz.ethGetBalance:case vz.ethGetCode:const t=function(e){if(void 0===e)return"latest";switch(e){case"earliest":case"latest":case"pending":return e}return Qi.from(e)}(e.request.params[1]);if(void 0===i&&(i=t),!function(e,t){return e===t||(Qi.isBigNumber(e)?!!Qi.isBigNumber(t)&&e.eq(t):!Qi.isBigNumber(t)&&e===t)}(t,i))return!1}return!0}catch(e){return!1}}));if(0!==a.length&&(r.options.verbose&&console.log("Forwarding incompatible calls",a.length),r.forward(a),0===t.length))return;let o=t.map((e=>{try{switch(e.request.method){case vz.ethCall:return{delegateCall:!1,revertOnError:!1,target:e.request.params[0].to,data:e.request.params[0].data,gasLimit:e.request.params[0].gas?e.request.params[0].gas:0,value:0};case vz.ethGetCode:return{delegateCall:!1,revertOnError:!1,target:r.options.contract,gasLimit:0,value:0,data:r.multicallInterface.encodeFunctionData(r.multicallInterface.getFunction("callCode"),[e.request.params[0]])};case vz.ethGetBalance:return{delegateCall:!1,revertOnError:!1,target:r.options.contract,gasLimit:0,value:0,data:r.multicallInterface.encodeFunctionData(r.multicallInterface.getFunction("callBalanceOf"),[e.request.params[0]])};default:return null}}catch(e){return null}}));var[t,a]=wz(t,((e,t)=>void 0!==o[t]));if(o=o.filter((e=>e)),0!==a.length&&(r.options.verbose&&console.log("Forwarding calls on error",a.length),r.forward(a),0===t.length))return;let s;try{s=r.multicallInterface.encodeFunctionData(r.multicallInterface.getFunction("multiCall"),[o])}catch(e){return void r.forward(t)}const f=oz(),u=await async function(e,t){try{return await e}catch(e){return t instanceof Function?t(e):t}}(az(n)({id:f,jsonrpc:yz,method:vz.ethCall,params:[{to:r.options.contract,value:0,data:s},Qi.isBigNumber(i)?i.toNumber():i]}),(e=>({jsonrpc:yz,id:f,result:void 0,error:e})));if(u.error)return r.forward(t);let c;try{c=r.multicallInterface.decodeFunctionResult(r.multicallInterface.getFunction("multiCall"),u.result)}catch(e){return void r.forward(t)}r.options.verbose&&console.log("Got response for",t.length),t.forEach(((e,t)=>{if(c[0][t])switch(e.request.method){case vz.ethCall:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:c[1][t]});break;case vz.ethGetCode:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:xs.decode(["bytes"],c[1][t])[0]});break;case vz.ethGetBalance:e.callback(void 0,{jsonrpc:e.request.jsonrpc,id:e.request.id,result:xs.decode(["uint256"],c[1][t])[0]})}else r.forward(e)}))},this.options=t?gz({},e.DefaultOptions,t):e.DefaultOptions,this.options.batchSize<=0)throw new Error(`Invalid batch size of ${this.options.batchSize}`)}forward(e){Array.isArray(e)?e.forEach((e=>e.next(e.request,e.callback))):e.next(e.request,e.callback)}static isMulticall(t){return t&&void 0!==t.handle&&void 0!==t.conf&&e.isMulticallOptions(t.options)}static isMulticallOptions(e){return void 0!==e&&void 0!==e.batchSize&&void 0!==e.timeWindow&&void 0!==e.contract}};Ez.DefaultOptions=gz({},_z);const Tz=["getNetwork","getBlockNumber","getGasPrice","getTransactionCount","getStorageAt","sendTransaction","estimateGas","getBlock","getTransaction","getTransactionReceipt","getLogs","emit","litenerCount","addListener","removeListener","waitForTransaction","detectNetwork","getBlockWithTransactions"];var Az=Object.freeze({__proto__:null,ProxyMethods:Tz,MulticallProvider:class extends Wh{constructor(e,t){var r;super(e.getNetwork()),r=this,this.provider=e,this.multicall=void 0,this.listenerCount=this.provider.listenerCount,this.getResolver=async function(e){const t=r.provider;if(t.getResolver){const n=await t.getResolver(await e);return n?new Vh(r,n.address,n.name):null}return t.getResolver(await e)},this.next=async function(e,t){try{switch(e.method){case vz.ethCall:r.callback(e,t,await r.provider.call(e.params[0],e.params[1]));break;case vz.ethGetCode:r.callback(e,t,await r.provider.getCode(e.params[0],e.params[1]));break;case vz.ethGetBalance:r.callback(e,t,await r.provider.getBalance(e.params[0],e.params[1]))}}catch(n){r.callback(e,t,void 0,n)}},this.multicall=Ez.isMulticall(t)?t:new Ez(t),Tz.forEach((t=>{void 0!==e[t]&&(this[t]=(...r)=>e[t](...r))}))}callback(e,t,r,n){t(n,{jsonrpc:yz,id:e.id,result:r,error:n})}async call(e,t){return this.rpcCall(vz.ethCall,e,t)}async getCode(e,t){return this.rpcCall(vz.ethGetCode,e,t)}async getBalance(e,t){return this.rpcCall(vz.ethGetBalance,e,t)}async rpcCall(e,...t){const r=oz();return(await az(this.multicall.handle)(this.next,{jsonrpc:yz,id:r,method:e,params:t})).result}},MulticallExternalProvider:class{constructor(e,t){if(this.provider=e,this.multicall=void 0,this.multicall=Ez.isMulticall(t)?t:new Ez(t),e.send){const t=async function(t,r){e.send(t,r)};this.send=(e,r)=>{this.multicall.handle(t,e,r)}}if(e.sendAsync){const t=async function(t,r){e.sendAsync(t,r)};this.sendAsync=(e,r)=>{this.multicall.handle(t,e,r)}}}get isMetaMask(){return this.provider.isMetaMask}get isStatus(){return this.provider.isStatus}},multicallMiddleware:e=>t=>{const r=Ez.isMulticall(e)?e:new Ez(e);return(e,n)=>r.handle(t,e,n)}}),Sz=Object.freeze({__proto__:null,Multicall:Ez,providers:Az});let kz,Oz;try{kz=localStorage}catch(e){const t=new Map;kz={getItem:e=>{var r;return null!=(r=t.get(e))?r:null},setItem:(e,r)=>t.set(e,r),removeItem:e=>t.delete(e)}}function Rz(e){return void 0!==e.address&&!function(e){return xz(e)||Iz(e)||Cz(e)}(e)}function xz(e){const t=e;return void 0!==t.signature&&void 0===t.address}function Iz(e){const t=e;return void 0!==t.r&&void 0!==t.s&&void 0!==t.v&&void 0!==t.t}function Cz(e){const t=e;return void 0!==t.address&&void 0!==t.signature}!function(e){e[e.EOA=0]="EOA",e[e.Address=1]="Address",e[e.Full=2]="Full"}(Oz||(Oz={}));const Nz=e=>{if("string"==typeof e)return Nz((e=>{if("string"!=typeof e)return e;const t=e.replace("0x",""),r=Qi.from(`0x${t.slice(0,4)}`).toNumber(),n=[];for(let e=4;e<t.length;){const r=Qi.from(t.slice(e,e+2)).toNumber();e+=2;const i=Qi.from(`0x${t.slice(e,e+2)}`).toNumber();switch(e+=2,r){case Oz.Address:const r=Eo(t.slice(e,e+40));e+=40,n.push({weight:i,address:r});break;case Oz.EOA:const a=Ii(`0x${t.slice(e,e+132)}`);e+=132;const o=Hi(a.slice(0,65)),s=o.r,f=o.s,u=o.v,c=Qi.from(a[a.length-1]).toNumber();n.push({weight:i,signature:a,r:s,s:f,v:u,t:c});break;case Oz.Full:const d=Eo(t.slice(e,e+40));e+=40;const l=Qi.from(`0x${t.slice(e,e+4)}`).mul(2).toNumber();e+=4;const p=Ii(`0x${t.slice(e,e+l)}`);e+=l,n.push({weight:i,address:d,signature:p});break;default:throw Error("Signature type not supported")}}return{threshold:r,signers:n}})(e));const t=e.signers.map((e=>{if(Rz(e))return gb(["uint8","uint8","address"],[Oz.Address,e.weight,e.address]);if(Iz(e))return gb(["uint8","uint8","bytes32","bytes32","uint8","uint8"],[Oz.EOA,e.weight,e.r,e.s,e.v,e.t]);if(Cz(e)){const t=Ii(e.signature).length;return gb(["uint8","uint8","address","uint16","bytes"],[Oz.Full,e.weight,e.address,t,e.signature])}if(xz(e))return gb(["uint8","uint8","bytes"],[Oz.EOA,e.weight,e.signature]);throw Error("Unkwnown signature part type")}));return gb(["uint16",...Array(t.length).fill("bytes")],[e.threshold,...t])};var Pz;!function(e){e.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",e.INVALID_CONFIGURATION="INVALID_CONFIGURATION",e.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR",e.NOT_LOGGED_IN_ERROR="NOT_LOGGED_IN_ERROR",e.SILENT_LOGIN_ERROR="SILENT_LOGIN_ERROR",e.REFRESH_TOKEN_ERROR="REFRESH_TOKEN_ERROR",e.USER_REGISTRATION_ERROR="USER_REGISTRATION_ERROR",e.LOGOUT_ERROR="LOGOUT_ERROR",e.TRANSFER_ERROR="TRANSFER_ERROR",e.CREATE_ORDER_ERROR="CREATE_ORDER_ERROR",e.CANCEL_ORDER_ERROR="CANCEL_ORDER_ERROR",e.EXCHANGE_TRANSFER_ERROR="EXCHANGE_TRANSFER_ERROR",e.CREATE_TRADE_ERROR="CREATE_TRADE_ERROR",e.OPERATION_NOT_SUPPORTED_ERROR="OPERATION_NOT_SUPPORTED_ERROR"}(Pz||(Pz={}));class Mz extends Error{type;constructor(e,t){super(e),this.type=t}}const Bz=async(e,t)=>{try{return await e()}catch(e){const r=`${t}: ${e.message}`||"UnknownError";throw new Mz(r,t)}},Dz="passport_credentials",Fz="pkce_state",Lz="pkce_verifier";class Uz{saveCredentials(e){if(!this.areValid(e))throw Error("Invalid credentials.");localStorage.setItem(Dz,JSON.stringify(e))}getCredentials(){const e=localStorage.getItem(Dz);return e?JSON.parse(e):null}areValid(e){if(e){const t=this.isTokenValid(e.access_token),r=this.isTokenValid(e.id_token);return t&&r}return!1}isTokenValid(e){try{const t=bD(e).exp??0;return t>Date.now()/1e3+3600}catch(e){return!1}}clearCredentials(){localStorage.removeItem(Dz)}savePKCEData(e){localStorage.setItem(Fz,e.state),localStorage.setItem(Lz,e.verifier)}getPKCEData(){const e=localStorage.getItem(Fz),t=localStorage.getItem(Lz);return e&&t?{state:e,verifier:t}:null}}const jz={headers:{"Content-Type":"application/x-www-form-urlencoded"}};function qz(e){return new Promise((t=>{setTimeout(t,e)}))}class zz{userManager;config;deviceCredentialsManager;logoutMode;constructor(e){this.config=e,this.userManager=new class{constructor(e){this._logger=new ED("UserManager"),this.settings=new JD(e),this._client=new class{constructor(e){this._logger=new ED("OidcClient"),this.settings=new BD(e),this.metadataService=new class{constructor(e){this._settings=e,this._logger=new ED("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new PD(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){const e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);const t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},this._settings.metadataSeed,t),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){const r=this._logger.create(`_getMetadataProperty('${e}')`),n=await this.getMetadata();if(r.debug("resolved"),void 0===n[e]){if(!0===t)return void r.warn("Metadata does not contain optional property");r.throw(new Error("Metadata does not contain property "+e))}return n[e]}async getSigningKeys(){const e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;const t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);const r=await this._jsonService.getJson(t);if(e.debug("got key set",r),!Array.isArray(r.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=r.keys,this._signingKeys}}(this.settings),this._claimsService=new class{constructor(e){this._settings=e,this._logger=new ED("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let e;e=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:jD;for(const r of e)qD.includes(r)||delete t[r]}return t}mergeClaims(e,t){const r={...e};for(const[e,n]of Object.entries(t))for(const t of Array.isArray(n)?n:[n]){const n=r[e];n?Array.isArray(n)?n.includes(t)||n.push(t):r[e]!==t&&("object"==typeof t&&this._settings.mergeClaims?r[e]=this.mergeClaims(n,t):r[e]=[n,t]):r[e]=t}return r}}(this.settings),this._validator=new class{constructor(e,t,r){this._settings=e,this._metadataService=t,this._claimsService=r,this._logger=new ED("ResponseValidator"),this._userInfoService=new class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new ED("UserInfoService"),this._getClaimsFromJwt=async e=>{const t=this._logger.create("_getClaimsFromJwt");try{const r=SD.decode(e);return t.debug("JWT decoding successful"),r}catch(e){throw t.error("Error parsing JWT response"),e}},this._jsonService=new PD(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){const t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));const r=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",r);const n=await this._jsonService.getJson(r,{token:e,credentials:this._settings.fetchRequestCredentials});return t.debug("got claims",n),n}}(this._settings,this._metadataService),this._tokenClient=new DD(this._settings,this._metadataService)}async validateSigninResponse(e,t){const r=this._logger.create("validateSigninResponse");this._processSigninState(e,t),r.debug("state processed"),await this._processCode(e,t),r.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,null==t?void 0:t.skipUserInfo,e.isOpenId),r.debug("claims processed")}async validateCredentialsResponse(e,t){const r=this._logger.create("validateCredentialsResponse");e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,t,e.isOpenId),r.debug("claims processed")}async validateRefreshResponse(e,t){const r=this._logger.create("validateRefreshResponse");e.userState=t.data,null!=e.session_state||(e.session_state=t.session_state),null!=e.scope||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),r.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);const n=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,n),r.debug("claims processed")}validateSignoutResponse(e,t){const r=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&r.throw(new Error("State does not match")),r.debug("state validated"),e.userState=t.data,e.error)throw r.warn("Response was error",e.error),new xD(e)}_processSigninState(e,t){const r=this._logger.create("_processSigninState");if(t.id!==e.state&&r.throw(new Error("State does not match")),t.client_id||r.throw(new Error("No client_id on state")),t.authority||r.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&r.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&r.throw(new Error("client_id mismatch on settings vs. signin state")),r.debug("state validated"),e.userState=t.data,null!=e.scope||(e.scope=t.scope),e.error)throw r.warn("Response was error",e.error),new xD(e);t.code_verifier&&!e.code&&r.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,r=!0){const n=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token)return void n.debug("not loading user info");n.debug("loading user info");const i=await this._userInfoService.getClaims(e.access_token);n.debug("user info claims received from user info endpoint"),r&&i.sub!==e.profile.sub&&n.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(i)),n.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t){const r=this._logger.create("_processCode");if(e.code){r.debug("Validating code");const n=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,...t.extraTokenParams});Object.assign(e,n)}else r.debug("No code to process")}_validateIdTokenAttributes(e,t){var r;const n=this._logger.create("_validateIdTokenAttributes");n.debug("decoding ID Token JWT");const i=SD.decode(null!=(r=e.id_token)?r:"");if(i.sub||n.throw(new Error("ID Token is missing a subject claim")),t){const e=SD.decode(t);i.sub!==e.sub&&n.throw(new Error("sub in id_token does not match current sub")),i.auth_time&&i.auth_time!==e.auth_time&&n.throw(new Error("auth_time in id_token does not match original auth_time")),i.azp&&i.azp!==e.azp&&n.throw(new Error("azp in id_token does not match original azp")),!i.azp&&e.azp&&n.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=i}}(this.settings,this.metadataService,this._claimsService),this._tokenClient=new DD(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:r,request_type:n,id_token_hint:i,login_hint:a,skipUserInfo:o,nonce:s,response_type:f=this.settings.response_type,scope:u=this.settings.scope,redirect_uri:c=this.settings.redirect_uri,prompt:d=this.settings.prompt,display:l=this.settings.display,max_age:p=this.settings.max_age,ui_locales:h=this.settings.ui_locales,acr_values:m=this.settings.acr_values,resource:b=this.settings.resource,response_mode:y=this.settings.response_mode,extraQueryParams:g=this.settings.extraQueryParams,extraTokenParams:v=this.settings.extraTokenParams}){const w=this._logger.create("createSigninRequest");if("code"!==f)throw new Error("Only the Authorization Code flow (with PKCE) is supported");const _=await this.metadataService.getAuthorizationEndpoint();w.debug("Received authorization endpoint",_);const E=new class{constructor({url:e,authority:t,client_id:r,redirect_uri:n,response_type:i,scope:a,state_data:o,response_mode:s,request_type:f,client_secret:u,nonce:c,resource:d,skipUserInfo:l,extraQueryParams:p,extraTokenParams:h,disablePKCE:m,...b}){if(this._logger=new ED("SigninRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");if(!r)throw this._logger.error("ctor: No client_id passed"),new Error("client_id");if(!n)throw this._logger.error("ctor: No redirect_uri passed"),new Error("redirect_uri");if(!i)throw this._logger.error("ctor: No response_type passed"),new Error("response_type");if(!a)throw this._logger.error("ctor: No scope passed"),new Error("scope");if(!t)throw this._logger.error("ctor: No authority passed"),new Error("authority");this.state=new LD({data:o,request_type:f,code_verifier:!m,client_id:r,authority:t,redirect_uri:n,response_mode:s,client_secret:u,scope:a,extraTokenParams:h,skipUserInfo:l});const y=new URL(e);y.searchParams.append("client_id",r),y.searchParams.append("redirect_uri",n),y.searchParams.append("response_type",i),y.searchParams.append("scope",a),c&&y.searchParams.append("nonce",c),y.searchParams.append("state",this.state.id),this.state.code_challenge&&(y.searchParams.append("code_challenge",this.state.code_challenge),y.searchParams.append("code_challenge_method","S256")),d&&(Array.isArray(d)?d:[d]).forEach((e=>y.searchParams.append("resource",e)));for(const[e,t]of Object.entries({response_mode:s,...b,...p}))null!=t&&y.searchParams.append(e,t.toString());this.url=y.href}}({url:_,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:c,response_type:f,scope:u,state_data:e,prompt:d,display:l,max_age:p,ui_locales:h,id_token_hint:i,login_hint:a,acr_values:m,resource:b,request:t,request_uri:r,extraQueryParams:g,extraTokenParams:v,request_type:n,response_mode:y,client_secret:this.settings.client_secret,skipUserInfo:o,nonce:s,disablePKCE:this.settings.disablePKCE});await this.clearStaleState();const T=E.state;return await this.settings.stateStore.set(T.id,T.toStorageString()),E}async readSigninResponseState(e,t=!1){const r=this._logger.create("readSigninResponseState"),n=new UD(RD.readParams(e,this.settings.response_mode));if(!n.state)throw r.throw(new Error("No state in response")),null;const i=await this.settings.stateStore[t?"remove":"get"](n.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:LD.fromStorageString(i),response:n}}async processSigninResponse(e){const t=this._logger.create("processSigninResponse"),{state:r,response:n}=await this.readSigninResponseState(e,!0);return t.debug("received state from storage; validating response"),await this._validator.validateSigninResponse(n,r),n}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r=!1,extraTokenParams:n={}}){const i=await this._tokenClient.exchangeCredentials({username:e,password:t,...n}),a=new UD(new URLSearchParams);return Object.assign(a,i),await this._validator.validateCredentialsResponse(a,r),a}async useRefreshToken({state:e,timeoutInSeconds:t}){var r;const n=this._logger.create("useRefreshToken");let i;if(void 0===this.settings.refreshTokenAllowedScope)i=e.scope;else{const t=this.settings.refreshTokenAllowedScope.split(" ");i=((null==(r=e.scope)?void 0:r.split(" "))||[]).filter((e=>t.includes(e))).join(" ")}const a=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:i,timeoutInSeconds:t}),o=new UD(new URLSearchParams);return Object.assign(o,a),n.debug("validating response",o),await this._validator.validateRefreshResponse(o,{...e,scope:i}),o}async createSignoutRequest({state:e,id_token_hint:t,request_type:r,post_logout_redirect_uri:n=this.settings.post_logout_redirect_uri,extraQueryParams:i=this.settings.extraQueryParams}={}){const a=this._logger.create("createSignoutRequest"),o=await this.metadataService.getEndSessionEndpoint();if(!o)throw a.throw(new Error("No end session endpoint")),null;a.debug("Received end session endpoint",o);const s=new class{constructor({url:e,state_data:t,id_token_hint:r,post_logout_redirect_uri:n,extraQueryParams:i,request_type:a}){if(this._logger=new ED("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");const o=new URL(e);r&&o.searchParams.append("id_token_hint",r),n&&(o.searchParams.append("post_logout_redirect_uri",n),t&&(this.state=new FD({data:t,request_type:a}),o.searchParams.append("state",this.state.id)));for(const[e,t]of Object.entries({...i}))null!=t&&o.searchParams.append(e,t.toString());this.url=o.href}}({url:o,id_token_hint:t,post_logout_redirect_uri:n,state_data:e,extraQueryParams:i,request_type:r});await this.clearStaleState();const f=s.state;return f&&(a.debug("Signout request has state to persist"),await this.settings.stateStore.set(f.id,f.toStorageString())),s}async readSignoutResponseState(e,t=!1){const r=this._logger.create("readSignoutResponseState"),n=new class{constructor(e){this.state=e.get("state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}}(RD.readParams(e,this.settings.response_mode));if(!n.state){if(r.debug("No state in response"),n.error)throw r.warn("Response was error:",n.error),new xD(n);return{state:void 0,response:n}}const i=await this.settings.stateStore[t?"remove":"get"](n.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:FD.fromStorageString(i),response:n}}async processSignoutResponse(e){const t=this._logger.create("processSignoutResponse"),{state:r,response:n}=await this.readSignoutResponseState(e,!0);return r?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(n,r)):t.debug("No state from storage; skipping response validation"),n}clearStaleState(){return this._logger.create("clearStaleState"),FD.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}}(e),this._redirectNavigator=new class{constructor(e){this._settings=e,this._logger=new ED("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var r;this._logger.create("prepare");let n=window.self;"top"===t&&(n=null!=(r=window.top)?r:window.self);const i=n.location[e].bind(n.location);let a;return{navigate:async e=>{this._logger.create("navigate");const t=new Promise(((e,t)=>{a=t}));return i(e.url),await t},close:()=>{this._logger.create("close"),null==a||a(new Error("Redirect aborted")),n.stop()}}}}(this.settings),this._popupNavigator=new class{constructor(e){this._settings=e,this._logger=new ED("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new QD({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,t=!1){this._logger.create("callback"),QD.notifyOpener(e,t)}}(this.settings),this._iframeNavigator=new class{constructor(e){this._settings=e,this._logger=new ED("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new YD({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),YD.notifyParent(e,this._settings.iframeNotifyParentOrigin)}}(this.settings),this._events=new ZD(this.settings),this._silentRenewService=new class{constructor(e){this._userManager=e,this._logger=new ED("SilentRenewService"),this._isStarted=!1,this._retryTimer=new OD("Retry Silent Renew"),this._tokenExpiring=async()=>{const e=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),e.debug("silent token renewal successful")}catch(t){if(t instanceof ID)return e.warn("ErrorTimeout from signinSilent:",t,"retry in 5s"),void this._retryTimer.init(5);e.error("Error from signinSilent:",t),this._userManager.events._raiseSilentRenewError(t)}}}async start(){const e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}}(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new class{constructor(e){this._userManager=e,this._logger=new ED("SessionMonitor"),this._start=async e=>{const t=e.session_state;if(!t)return;const r=this._logger.create("_start");if(e.profile?(this._sub=e.profile.sub,this._sid=e.profile.sid,r.debug("session_state",t,", sub",this._sub)):(this._sub=void 0,this._sid=void 0,r.debug("session_state",t,", anonymous user")),this._checkSessionIFrame)this._checkSessionIFrame.start(t);else try{const e=await this._userManager.metadataService.getCheckSessionIframe();if(e){r.debug("initializing check session iframe");const n=this._userManager.settings.client_id,i=this._userManager.settings.checkSessionIntervalInSeconds,a=this._userManager.settings.stopCheckSessionOnError,o=new class{constructor(e,t,r,n,i){this._callback=e,this._client_id=t,this._intervalInSeconds=n,this._stopOnError=i,this._logger=new ED("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=e=>{e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&("error"===e.data?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===e.data?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(e.data+" message from check session op iframe"))};const a=new URL(r);this._frame_origin=a.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=a.href}load(){return new Promise((e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)}))}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;const t=()=>{this._frame.contentWindow&&this._session_state&&this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,1e3*this._intervalInSeconds)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}}(this._callback,n,e,i,a);await o.load(),this._checkSessionIFrame=o,o.start(t)}else r.warn("no check session iframe found in the metadata")}catch(e){r.error("Error from getCheckSessionIframe:",e instanceof Error?e.message:e)}},this._stop=()=>{const e=this._logger.create("_stop");if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const t=setInterval((async()=>{clearInterval(t);try{const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}catch(t){e.error("error from querySessionStatus",t instanceof Error?t.message:t)}}),1e3)}},this._callback=async()=>{const e=this._logger.create("_callback");try{const t=await this._userManager.querySessionStatus();let r=!0;t&&this._checkSessionIFrame?t.sub===this._sub?(r=!1,this._checkSessionIFrame.start(t.session_state),t.sid===this._sid?e.debug("same sub still logged in at OP, restarting check session iframe; session_state",t.session_state):(e.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",t.session_state),this._userManager.events._raiseUserSessionChanged())):e.debug("different subject signed into OP",t.sub):e.debug("subject no longer signed into OP"),r?this._sub?this._userManager.events._raiseUserSignedOut():this._userManager.events._raiseUserSignedIn():e.debug("no change in session detected, no event to raise")}catch(t){this._sub&&(e.debug("Error calling queryCurrentSigninSession; raising signed out event",t),this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch((e=>{this._logger.error(e)}))}async _init(){this._logger.create("_init");const e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}}}(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(){const e=this._logger.create("getUser"),t=await this._loadUser();return t?(e.info("user loaded"),this._events.load(t,!1),t):(e.info("user not found in storage"),null)}async removeUser(){const e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),this._events.unload()}async signinRedirect(e={}){this._logger.create("signinRedirect");const{redirectMethod:t,...r}=e,n=await this._redirectNavigator.prepare({redirectMethod:t});await this._signinStart({request_type:"si:r",...r},n)}async signinRedirectCallback(e=window.location.href){const t=this._logger.create("signinRedirectCallback"),r=await this._signinEnd(e);return r.profile&&r.profile.sub?t.info("success, signed in subject",r.profile.sub):t.info("no subject"),r}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:r=!1}){const n=this._logger.create("signinResourceOwnerCredential"),i=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r,extraTokenParams:this.settings.extraTokenParams});n.debug("got signin response");const a=await this._buildUser(i);return a.profile&&a.profile.sub?n.info("success, signed in subject",a.profile.sub):n.info("no subject"),a}async signinPopup(e={}){const t=this._logger.create("signinPopup"),{popupWindowFeatures:r,popupWindowTarget:n,...i}=e,a=this.settings.popup_redirect_uri;a||t.throw(new Error("No popup_redirect_uri configured"));const o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:n}),s=await this._signin({request_type:"si:p",redirect_uri:a,display:"popup",...i},o);return s&&(s.profile&&s.profile.sub?t.info("success, signed in subject",s.profile.sub):t.info("no subject")),s}async signinPopupCallback(e=window.location.href,t=!1){const r=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,t),r.info("success")}async signinSilent(e={}){var t;const r=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:n,...i}=e;let a=await this._loadUser();if(null==a?void 0:a.refresh_token){r.debug("using refresh token");const e=new class{constructor(e){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.data=e.state}}(a);return await this._useRefreshToken(e)}const o=this.settings.silent_redirect_uri;let s;o||r.throw(new Error("No silent_redirect_uri configured")),a&&this.settings.validateSubOnSilentRenew&&(r.debug("subject prior to silent renew:",a.profile.sub),s=a.profile.sub);const f=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});return a=await this._signin({request_type:"si:s",redirect_uri:o,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==a?void 0:a.id_token:void 0,...i},f,s),a&&((null==(t=a.profile)?void 0:t.sub)?r.info("success, signed in subject",a.profile.sub):r.info("no subject")),a}async _useRefreshToken(e){const t=await this._client.useRefreshToken({state:e,timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds}),r=new zD({...e,...t});return await this.storeUser(r),this._events.load(r),r}async signinSilentCallback(e=window.location.href){const t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){const{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":return await this.signinPopupCallback(e);case"si:s":return await this.signinSilentCallback(e);default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){const{state:r}=await this._client.readSignoutResponseState(e);if(r)switch(r.request_type){case"so:r":await this.signoutRedirectCallback(e);break;case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){const t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:r,...n}=e,i=this.settings.silent_redirect_uri;i||t.throw(new Error("No silent_redirect_uri configured"));const a=await this._loadUser(),o=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r}),s=await this._signinStart({request_type:"si:s",redirect_uri:i,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==a?void 0:a.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...n},o);try{const e=await this._client.processSigninResponse(s.url);return t.debug("got signin response"),e.session_state&&e.profile.sub?(t.info("success for subject",e.profile.sub),{session_state:e.session_state,sub:e.profile.sub,sid:e.profile.sid}):(t.info("success, user not authenticated"),null)}catch(e){if(this.settings.monitorAnonymousSession&&e instanceof xD)switch(e.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:e.session_state}}throw e}}async _signin(e,t,r){const n=await this._signinStart(e,t);return await this._signinEnd(n.url,r)}async _signinStart(e,t){const r=this._logger.create("_signinStart");try{const n=await this._client.createSigninRequest(e);return r.debug("got signin request"),await t.navigate({url:n.url,state:n.state.id,response_mode:n.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(e){throw r.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signinEnd(e,t){const r=this._logger.create("_signinEnd"),n=await this._client.processSigninResponse(e);return r.debug("got signin response"),await this._buildUser(n,t)}async _buildUser(e,t){const r=this._logger.create("_buildUser"),n=new zD(e);if(t){if(t!==n.profile.sub)throw r.debug("current user does not match user returned from signin. sub from signin:",n.profile.sub),new xD({...e,error:"login_required"});r.debug("current user matches user returned from signin")}return await this.storeUser(n),r.debug("user stored"),this._events.load(n),n}async signoutRedirect(e={}){const t=this._logger.create("signoutRedirect"),{redirectMethod:r,...n}=e,i=await this._redirectNavigator.prepare({redirectMethod:r});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...n},i),t.info("success")}async signoutRedirectCallback(e=window.location.href){const t=this._logger.create("signoutRedirectCallback"),r=await this._signoutEnd(e);return t.info("success"),r}async signoutPopup(e={}){const t=this._logger.create("signoutPopup"),{popupWindowFeatures:r,popupWindowTarget:n,...i}=e,a=this.settings.popup_post_logout_redirect_uri,o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:n});await this._signout({request_type:"so:p",post_logout_redirect_uri:a,state:null==a?void 0:{},...i},o),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){const r=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,t),r.info("success")}async _signout(e,t){const r=await this._signoutStart(e,t);return await this._signoutEnd(r.url)}async _signoutStart(e={},t){var r;const n=this._logger.create("_signoutStart");try{const i=await this._loadUser();n.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(i);const a=e.id_token_hint||i&&i.id_token;a&&(n.debug("setting id_token_hint in signout request"),e.id_token_hint=a),await this.removeUser(),n.debug("user removed, creating signout request");const o=await this._client.createSignoutRequest(e);return n.debug("got signout request"),await t.navigate({url:o.url,state:null==(r=o.state)?void 0:r.id})}catch(e){throw n.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signoutEnd(e){const t=this._logger.create("_signoutEnd"),r=await this._client.processSignoutResponse(e);return t.debug("got signout response"),r}async signoutSilent(e={}){var t;const r=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:n,...i}=e,a=this.settings.includeIdTokenInSilentSignout?null==(t=await this._loadUser())?void 0:t.id_token:void 0,o=this.settings.popup_post_logout_redirect_uri,s=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});await this._signout({request_type:"so:s",post_logout_redirect_uri:o,id_token_hint:a,...i},s),r.info("success")}async signoutSilentCallback(e=window.location.href){const t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){const t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){const r=this._logger.create("_revokeInternal");if(!e)return;const n=t.filter((t=>"string"==typeof e[t]));if(n.length){for(const t of n)await this._client.revokeToken(e[t],t),r.info(`${t} revoked successfully`),"access_token"!==t&&(e[t]=null);await this.storeUser(e),r.debug("user stored"),this._events.load(e)}else r.debug("no need to revoke due to no token(s)")}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){const e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),zD.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){const t=this._logger.create("storeUser");if(e){t.debug("storing user");const r=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,r)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey)}async clearStaleState(){await this._client.clearStaleState()}}((({oidcConfiguration:e,authenticationDomain:t})=>{const r={authority:t,redirect_uri:e.redirectUri,popup_redirect_uri:e.redirectUri,client_id:e.clientId,metadata:{authorization_endpoint:`${t}/authorize`,token_endpoint:`${t}/oauth/token`,userinfo_endpoint:`${t}/userinfo`,end_session_endpoint:`${t}/v2/logout?returnTo=${encodeURIComponent(e.logoutRedirectUri)}&client_id=${e.clientId}`},mergeClaims:!0,loadUserInfo:!0,scope:e.scope};return e.audience&&(r.extraQueryParams={audience:e.audience}),r})(e)),this.deviceCredentialsManager=new Uz,this.logoutMode=e.oidcConfiguration.logoutMode||"redirect"}static mapOidcUserToDomainModel=e=>{const t=e.profile?.passport,r={expired:e.expired,idToken:e.id_token,accessToken:e.access_token,refreshToken:e.refresh_token,profile:{sub:e.profile.sub,email:e.profile.email,nickname:e.profile.nickname}};return t?.imx_eth_address&&(r.imx={ethAddress:t?.imx_eth_address,starkAddress:t?.imx_stark_address,userAdminAddress:t?.imx_user_admin_address}),t?.zkevm_eth_address&&(r.zkEvm={ethAddress:t?.zkevm_eth_address,userAdminAddress:t?.zkevm_user_admin_address}),r};static mapDeviceTokenResponseToDomainUserModel=e=>{const t=bD(e.id_token),r={idToken:e.id_token,accessToken:e.access_token,refreshToken:e.refresh_token,profile:{sub:t.sub,email:t.email,nickname:t.nickname}};return t?.passport?.imx_eth_address&&(r.imx={ethAddress:t?.passport?.imx_eth_address,starkAddress:t?.passport?.imx_stark_address,userAdminAddress:t?.passport?.imx_user_admin_address}),r};async login(){return Bz((async()=>{const e=await this.userManager.signinPopup({popupWindowFeatures:{width:410,height:450}});return zz.mapOidcUserToDomainModel(e)}),Pz.AUTHENTICATION_ERROR)}async loginCallback(){return Bz((async()=>this.userManager.signinPopupCallback()),Pz.AUTHENTICATION_ERROR)}async loginWithDeviceFlow(){return Bz((async()=>{const e=await Qr.post(`${this.config.authenticationDomain}/oauth/device/code`,{client_id:this.config.oidcConfiguration.clientId,scope:this.config.oidcConfiguration.scope,audience:this.config.oidcConfiguration.audience},jz);return{code:e.data.user_code,deviceCode:e.data.device_code,url:e.data.verification_uri_complete,interval:e.data.interval}}),Pz.AUTHENTICATION_ERROR)}async connectImxDeviceFlow(e,t,r){return Bz((async()=>{const n=Date.now();for(;;){if(null!=r&&Date.now()-n>r)throw new Error("Timed out");await qz(1e3*t);try{const t=await this.getDeviceFlowToken(e),r=zz.mapDeviceTokenResponseToDomainUserModel(t);return r.imx?.ethAddress&&r.imx?.starkAddress&&r.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(t),r}catch(e){if(!Qr.isAxiosError(e))throw e;{const t=e.response?.data;switch(t.error){case"authorization_pending":case"slow_down":break;case"expired_token":throw new Error("Token expired, please log in again");case"access_denied":throw new Error("User denied access");default:throw new Error("Error getting token")}}}}throw new Error("Failed to get credentials")}),Pz.AUTHENTICATION_ERROR)}async getDeviceFlowToken(e){return(await Qr.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e},jz)).data}static base64URLEncode(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static sha256(e){return(void 0)("sha256").update(e).digest()}getPKCEAuthorizationUrl(){const e=zz.base64URLEncode((void 0)(32)),t=zz.base64URLEncode(zz.sha256(e)),r=zz.base64URLEncode((void 0)(32));return this.deviceCredentialsManager.savePKCEData({state:r,verifier:e}),`${this.config.authenticationDomain}/authorize?response_type=code&code_challenge=${t}&code_challenge_method=S256&client_id=${this.config.oidcConfiguration.clientId}&redirect_uri=${this.config.oidcConfiguration.redirectUri}&scope=${this.config.oidcConfiguration.scope}&state=${r}&audience=${this.config.oidcConfiguration.audience}`}async connectImxPKCEFlow(e,t){return Bz((async()=>{const r=this.deviceCredentialsManager.getPKCEData();if(!r)throw new Error("No code verifier or state for PKCE");if(t!==r.state)throw new Error("Provided state does not match stored state");const n=await this.getPKCEToken(e,r.verifier),i=zz.mapDeviceTokenResponseToDomainUserModel(n);return i.imx?.ethAddress&&i.imx?.starkAddress&&i.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(n),i}),Pz.AUTHENTICATION_ERROR)}async getPKCEToken(e,t){return(await Qr.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"authorization_code",code_verifier:t,code:e,redirect_uri:this.config.oidcConfiguration.redirectUri},jz)).data}async connectImxWithCredentials(e){return Bz((async()=>{if(this.deviceCredentialsManager.areValid(e))return zz.mapDeviceTokenResponseToDomainUserModel(e);const t=e?.refresh_token??null;if(t){const e=await this.refreshToken(t);return zz.mapDeviceTokenResponseToDomainUserModel(e)}return null}),Pz.AUTHENTICATION_ERROR)}async refreshToken(e){return(await Qr.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"refresh_token",refresh_token:e},jz)).data}async logout(){return Bz((async()=>"silent"===this.logoutMode?this.userManager.signoutSilent():this.userManager.signoutRedirect()),Pz.LOGOUT_ERROR)}async logoutSilentCallback(e){return this.userManager.signoutSilentCallback(e)}async logoutDeviceFlow(){return Bz((async()=>{this.deviceCredentialsManager.clearCredentials()}),Pz.LOGOUT_ERROR)}async loginSilent(){return Bz((async()=>{if(!await this.getUser())return null;const e=await this.userManager.signinSilent();return e?zz.mapOidcUserToDomainModel(e):null}),Pz.SILENT_LOGIN_ERROR)}async getUser(){return Bz((async()=>{const e=await this.userManager.getUser();if(e)return zz.mapOidcUserToDomainModel(e);const t=this.deviceCredentialsManager.getCredentials();return t?zz.mapDeviceTokenResponseToDomainUserModel(t):null}),Pz.NOT_LOGGED_IN_ERROR)}async getUserDeviceFlow(){return Bz((async()=>{const e=this.deviceCredentialsManager.getCredentials();return e?zz.mapDeviceTokenResponseToDomainUserModel(e):null}),Pz.NOT_LOGGED_IN_ERROR)}checkStoredDeviceFlowCredentials(){return this.deviceCredentialsManager.getCredentials()}}class Hz{config;constructor(e){this.config=e}async login(e,t){return Bz((async()=>{const r=new tj(this.config.magicPublishableApiKey,{extensions:[new nj],network:t});return await r.openid.loginWithOIDC({jwt:e,providerId:this.config.magicProviderId}),r.rpcProvider}),Pz.WALLET_CONNECTION_ERROR)}}const Vz=1e3,Gz=3,Kz=async(e,t)=>{const{retries:r=Gz,interval:n=Vz,finalErr:i=Error("Retry failed"),finallyFn:a=(()=>{})}=t||{};try{return await e()}catch(t){return r<=0?Promise.reject(i):(await(o=n,new Promise((e=>{setTimeout((()=>e()),o)}))),Kz(e,{retries:r-1,finalErr:i,finallyFn:a}))}finally{r<=0&&a()}var o};var Wz,Xz;e.ProviderErrorCode=void 0,(Wz=e.ProviderErrorCode||(e.ProviderErrorCode={}))[Wz.USER_REJECTED_REQUEST=4001]="USER_REJECTED_REQUEST",Wz[Wz.UNAUTHORIZED=4100]="UNAUTHORIZED",Wz[Wz.UNSUPPORTED_METHOD=4200]="UNSUPPORTED_METHOD",Wz[Wz.DISCONNECTED=4900]="DISCONNECTED",e.RpcErrorCode=void 0,(Xz=e.RpcErrorCode||(e.RpcErrorCode={}))[Xz.RPC_SERVER_ERROR=-32e3]="RPC_SERVER_ERROR",Xz[Xz.INVALID_REQUEST=-32600]="INVALID_REQUEST",Xz[Xz.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",Xz[Xz.INVALID_PARAMS=-32602]="INVALID_PARAMS",Xz[Xz.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",Xz[Xz.PARSE_ERROR=-32700]="PARSE_ERROR",Xz[Xz.USER_REJECTED_REQUEST=-32003]="USER_REJECTED_REQUEST";class $z extends Error{message;code;constructor(e,t){super(t),this.message=t,this.code=e}}const Jz=e=>Qi.from(e).toString();class Yz{transactionAPI;confirmationScreen;imxEtherAddress;constructor({imxPublicApiDomain:e,accessToken:t,confirmationScreen:r,imxEtherAddress:n}){this.confirmationScreen=r,this.transactionAPI=new $q(new Jq({accessToken:t,basePath:e})),this.imxEtherAddress=n}loading(e){this.confirmationScreen.loading(e)}async validate({payloadHash:e}){if(!(await Kz((async()=>this.transactionAPI.getTransactionByID({transactionID:e,chainType:"starkex"})),{finallyFn:()=>{this.confirmationScreen.closeWindow()}})).data.id)throw new Error("Transaction doesn't exists");const t=await this.transactionAPI.evaluateTransaction({id:e,transactionEvaluationRequest:{chainType:"starkex"}}),{confirmationRequired:r}=t.data;if(r){if(!(await this.confirmationScreen.startGuardianTransaction(e,this.imxEtherAddress,Yq)).confirmed)throw new Error("Transaction rejected by user")}else this.confirmationScreen.closeWindow()}async evaluateEVMTransaction({chainId:t,nonce:r,user:n,metaTransactions:i}){const a={Authorization:`Bearer ${n.accessToken}`},o=(t=>{try{return t.map((e=>({delegateCall:!0===e.delegateCall,revertOnError:!0===e.revertOnError,gasLimit:e.gasLimit?Jz(e.gasLimit):"0",target:e.to??Uo,value:e.value?Jz(e.value):"0",data:e.data?e.data.toString():"0x00"})))}catch(t){const r=t instanceof Error?t.message:String(t);throw new $z(e.RpcErrorCode.INVALID_PARAMS,`Transaction failed to parsing: ${r}`)}})(i);try{return(await this.transactionAPI.evaluateTransaction({id:"evm",transactionEvaluationRequest:{chainType:"evm",chainId:t,transactionData:{nonce:r,userAddress:n.zkEvm.ethAddress,metaTransactions:o}}},{headers:a})).data}catch(t){const r=t instanceof Error?t.message:String(t);throw new $z(e.RpcErrorCode.INTERNAL_ERROR,`Transaction failed to validate with error: ${r}`)}}async validateEVMTransaction({chainId:t,nonce:r,user:n,metaTransactions:i}){const a=await this.evaluateEVMTransaction({chainId:t,nonce:r,user:n,metaTransactions:i}),{confirmationRequired:o,transactionId:s}=a;if(o&&s){if(!(await this.confirmationScreen.startGuardianTransaction(s,this.imxEtherAddress,Qq,t)).confirmed)throw new $z(e.RpcErrorCode.USER_REJECTED_REQUEST,"Transaction rejected by user ")}else this.confirmationScreen.closeWindow()}}const Qz="ERC721";const Zz="ERC721";class eH{user;starkSigner;immutableXClient;confirmationScreen;guardianClient;constructor({user:e,starkSigner:t,immutableXClient:r,imxPublicApiDomain:n,confirmationScreen:i}){this.user=e,this.starkSigner=t,this.immutableXClient=r,this.confirmationScreen=i,this.guardianClient=new Yz({imxPublicApiDomain:n,accessToken:e.accessToken,confirmationScreen:i,imxEtherAddress:e.imx.ethAddress})}async transfer(e){return async function({request:e,transfersApi:t,starkSigner:r,user:n,guardianClient:i}){return Bz((async()=>{i.loading();const a=e.type===Zz?"1":e.amount,o={sender:n.imx.ethAddress,token:tz(e),amount:a,receiver:e.receiver},s={Authorization:`Bearer ${n.accessToken}`},f=await t.getSignableTransferV1({getSignableTransferRequest:o},{headers:s});await i.validate({payloadHash:f.data.payload_hash});const u=f.data,{payload_hash:c}=u,d=await r.signMessage(c),l=await r.getAddress(),p={createTransferRequest:{sender_stark_key:u.sender_stark_key||l,sender_vault_id:u.sender_vault_id,receiver_stark_key:u.receiver_stark_key,receiver_vault_id:u.receiver_vault_id,asset_id:u.asset_id,amount:u.amount,nonce:u.nonce,expiration_timestamp:u.expiration_timestamp,stark_signature:d}},{data:h}=await t.createTransferV1(p,{headers:s});return{sent_signature:h.sent_signature,status:h.status?.toString(),time:h.time,transfer_id:h.transfer_id}}),Pz.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}registerOffchain(){throw new Mz("Operation not supported",Pz.OPERATION_NOT_SUPPORTED_ERROR)}isRegisteredOnchain(){throw new Mz("Operation not supported",Pz.OPERATION_NOT_SUPPORTED_ERROR)}createOrder(e){return async function({starkSigner:e,user:t,request:r,ordersApi:n,guardianClient:i}){return Bz((async()=>{i.loading();const{ethAddress:a}=t.imx,o=r.sell.type===Qz?"1":r.sell.amount,s=r.buy.type===Qz?"1":r.buy.amount,f={Authorization:`Bearer ${t.accessToken}`},u={user:a,amount_buy:s,token_buy:tz(r.buy),amount_sell:o,token_sell:tz(r.sell),fees:r.fees,split_fees:!0,expiration_timestamp:r.expiration_timestamp},c=await n.getSignableOrder({getSignableOrderRequestV3:u},{headers:f});await i.validate({payloadHash:c.data.payload_hash});const{payload_hash:d}=c.data,l=await e.signMessage(d),p=c.data,h={createOrderRequest:{include_fees:!0,fees:r.fees,stark_signature:l,amount_buy:p.amount_buy,amount_sell:p.amount_sell,asset_id_buy:p.asset_id_buy,asset_id_sell:p.asset_id_sell,expiration_timestamp:p.expiration_timestamp,nonce:p.nonce,stark_key:p.stark_key,vault_id_buy:p.vault_id_buy,vault_id_sell:p.vault_id_sell}};return{...(await n.createOrderV3(h,{headers:f})).data}}),Pz.CREATE_ORDER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}cancelOrder(e){return async function({user:e,starkSigner:t,request:r,ordersApi:n,guardianClient:i}){return Bz((async()=>{i.loading();const a={order_id:r.order_id},o={Authorization:`Bearer ${e.accessToken}`},s=await n.getSignableCancelOrderV3({getSignableCancelOrderRequest:a},{headers:o});await i.validate({payloadHash:s.data.payload_hash});const{payload_hash:f}=s.data,u=await t.signMessage(f),c=await n.cancelOrderV3({id:r.order_id.toString(),cancelOrderRequest:{order_id:r.order_id,stark_signature:u}},{headers:o});return{order_id:c.data.order_id,status:c.data.status}}),Pz.CANCEL_ORDER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}createTrade(e){return async function({request:e,tradesApi:t,user:r,starkSigner:n,guardianClient:i}){return Bz((async()=>{i.loading();const{ethAddress:a}=r.imx,o={expiration_timestamp:e.expiration_timestamp,fees:e.fees,order_id:e.order_id,user:a},s={Authorization:`Bearer ${r.accessToken}`},f=await t.getSignableTrade({getSignableTradeRequest:o},{headers:s});await i.validate({payloadHash:f.data.payload_hash});const{payload_hash:u}=f.data,c=await n.signMessage(u),{data:d}=f,l={createTradeRequest:{include_fees:!0,fees:e?.fees,stark_signature:c,order_id:e?.order_id,fee_info:d.fee_info,amount_buy:d.amount_buy,amount_sell:d.amount_sell,asset_id_buy:d.asset_id_buy,asset_id_sell:d.asset_id_sell,expiration_timestamp:d.expiration_timestamp,nonce:d.nonce,stark_key:d.stark_key,vault_id_buy:d.vault_id_buy,vault_id_sell:d.vault_id_sell}},{data:p}=await t.createTradeV3(l,{headers:s});return p}),Pz.CREATE_TRADE_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,tradesApi:this.immutableXClient.tradesApi,guardianClient:this.guardianClient})}batchNftTransfer(e){return async function({user:e,starkSigner:t,request:r,transfersApi:n,guardianClient:i}){return Bz((async()=>{i.loading({width:480,height:784});const{ethAddress:a}=e.imx,o={sender_ether_key:a,signable_requests:r.map((e=>({amount:"1",token:tz({type:Zz,tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver})))},s={Authorization:`Bearer ${e.accessToken}`},f=await n.getSignableTransfer({getSignableTransferRequestV2:o},{headers:s});await i.validate({payloadHash:f.data.signable_responses[0]?.payload_hash});const u=await Promise.all(f.data.signable_responses.map((async e=>{const r=await t.signMessage(e.payload_hash);return{sender_vault_id:e.sender_vault_id,receiver_stark_key:e.receiver_stark_key,receiver_vault_id:e.receiver_vault_id,asset_id:e.asset_id,amount:e.amount,nonce:e.nonce,expiration_timestamp:e.expiration_timestamp,stark_signature:r}}))),c={sender_stark_key:f.data.sender_stark_key,requests:u},d=await n.createTransfer({createTransferRequestV2:c},{headers:s});return{transfer_ids:d?.data.transfer_ids}}),Pz.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}exchangeTransfer(e){return async function({user:e,starkSigner:t,request:r,exchangesApi:n}){return Bz((async()=>{const{ethAddress:i}=e.imx,a=r.amount,o=await n.getExchangeSignableTransfer({id:r.transactionID,getSignableTransferRequest:{sender:i,token:tz(r),amount:a,receiver:r.receiver}}),s=await t.getAddress(),{payload_hash:f}=o.data,u=await t.signMessage(f),c={sender_stark_key:o.data.sender_stark_key||s,sender_vault_id:o.data.sender_vault_id,receiver_stark_key:o.data.receiver_stark_key,receiver_vault_id:o.data.receiver_vault_id,asset_id:o.data.asset_id,amount:o.data.amount,nonce:o.data.nonce,expiration_timestamp:o.data.expiration_timestamp,stark_signature:u},d={Authorization:`Bearer ${e.accessToken}`},l=await n.createExchangeTransfer({id:r.transactionID,createTransferRequest:c},{headers:d});return{sent_signature:l?.data.sent_signature,status:l?.data.status?.toString(),time:l?.data.time,transfer_id:l?.data.transfer_id}}),Pz.EXCHANGE_TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,exchangesApi:this.immutableXClient.exchangeApi})}deposit(e){throw new Mz("Operation not supported",Pz.OPERATION_NOT_SUPPORTED_ERROR)}prepareWithdrawal(e){throw new Mz("Operation not supported",Pz.OPERATION_NOT_SUPPORTED_ERROR)}completeWithdrawal(e,t){throw new Mz("Operation not supported",Pz.OPERATION_NOT_SUPPORTED_ERROR)}getAddress(){return Promise.resolve(this.user.imx.ethAddress)}}class tH{authManager;config;confirmationScreen;immutableXClient;magicAdapter;constructor({authManager:e,config:t,confirmationScreen:r,immutableXClient:n,magicAdapter:i}){this.authManager=e,this.config=t,this.confirmationScreen=r,this.immutableXClient=n,this.magicAdapter=i}async getProvider(){const e=await this.authManager.login();return this.createProviderInstance(e)}async getProviderSilent(){const e=await this.authManager.loginSilent();return e?this.createProviderInstance(e):null}async getProviderWithDeviceFlow(e,t,r){const n=await this.authManager.connectImxDeviceFlow(e,t,r);return this.createProviderInstance(n)}async getProviderWithPKCEFlow(e,t){const r=await this.authManager.connectImxPKCEFlow(e,t);return this.createProviderInstance(r)}async getProviderWithCredentials(e){const t=await this.authManager.connectImxWithCredentials(e);return t?this.createProviderInstance(t):null}async createProviderInstance(e){if(!e.idToken)throw new Mz("Failed to initialise",Pz.WALLET_CONNECTION_ERROR);const t=await this.magicAdapter.login(e.idToken,this.config.network),r=new fb(t).getSigner(),n=await(async e=>Bz((async()=>DC(await QB(e))),Pz.WALLET_CONNECTION_ERROR))(r);if(!e.imx?.ethAddress){const t=await this.registerStarkEx(r,n,e.accessToken);return new eH({user:t,starkSigner:n,immutableXClient:this.immutableXClient,imxPublicApiDomain:this.config.imxPublicApiDomain,confirmationScreen:this.confirmationScreen})}return new eH({user:e,starkSigner:n,immutableXClient:this.immutableXClient,imxPublicApiDomain:this.config.imxPublicApiDomain,confirmationScreen:this.confirmationScreen})}async registerStarkEx(e,t,r){return Bz((async()=>{await async function({ethSigner:e,starkSigner:t,usersApi:r},n){return Bz((async()=>{const i=await e.getAddress(),a=await t.getAddress(),o=await r.getSignableRegistrationOffchain({getSignableRegistrationRequest:{ether_key:i,stark_key:a}}),{signable_message:s,payload_hash:f}=o.data,u=await ez(s,e),c=await t.signMessage(f);return(await r.registerPassportUser({authorization:`Bearer ${n}`,registerPassportUserRequest:{eth_signature:u,ether_key:i,stark_signature:c,stark_key:a}})).statusText}),Pz.USER_REGISTRATION_ERROR)}({ethSigner:e,starkSigner:t,usersApi:this.immutableXClient.usersApi},r);return await Kz((async()=>{const e=await this.authManager.loginSilent();return!!e?.imx?e:Promise.reject(new Error("user wallet addresses not exist"))}))}),Pz.REFRESH_TOKEN_ERROR)}}var rH;e.Networks=void 0,(rH=e.Networks||(e.Networks={})).PRODUCTION="mainnet",rH.SANDBOX="goerli";const nH=(e,t,r)=>{const n=t.map((t=>!e[t]&&t)).filter((e=>e)).join(", ");if(""!==n){throw new Mz(r?`${r} - ${n} cannot be null`:`${n} cannot be null`,Pz.INVALID_CONFIGURATION)}};class iH{network;authenticationDomain;passportDomain;imxPublicApiDomain;magicPublishableApiKey;magicProviderId;oidcConfiguration;baseConfig;zkEvmChainId;zkEvmRpcUrl;relayerUrl;multiRollupConfig;constructor({baseConfig:t,overrides:r,...n}){if(nH(n,["clientId","logoutRedirectUri","redirectUri"]),this.oidcConfiguration=n,this.baseConfig=t,r)nH(r,["network","authenticationDomain","passportDomain","magicPublishableApiKey","magicProviderId","zkEvmRpcUrl","zkEvmChainId","relayerUrl","imxPublicApiDomain","indexerMrBasePath","orderBookMrBasePath","passportMrBasePath"],"overrides"),this.network=r.network,this.authenticationDomain=r.authenticationDomain,this.passportDomain=r.passportDomain,this.imxPublicApiDomain=r.imxPublicApiDomain,this.magicPublishableApiKey=r.magicPublishableApiKey,this.magicProviderId=r.magicProviderId,this.zkEvmRpcUrl=r.zkEvmRpcUrl,this.zkEvmChainId=r.zkEvmChainId,this.relayerUrl=r.relayerUrl,this.multiRollupConfig={indexer:gt({basePath:r.indexerMrBasePath}),orderBook:gt({basePath:r.orderBookMrBasePath}),passport:gt({basePath:r.passportMrBasePath})};else switch(t.environment){case e.Environment.PRODUCTION:this.network=e.Networks.PRODUCTION,this.authenticationDomain="https://auth.immutable.com",this.magicPublishableApiKey="pk_live_10F423798A540ED7",this.magicProviderId="fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=",this.passportDomain="https://passport.immutable.com",this.imxPublicApiDomain="https://api.immutable.com",this.zkEvmRpcUrl="",this.zkEvmChainId="",this.relayerUrl="https://api.immutable.com/relayer-mr",this.multiRollupConfig=vt();break;case e.Environment.SANDBOX:default:this.network=e.Networks.SANDBOX,this.authenticationDomain="https://auth.immutable.com",this.magicPublishableApiKey="pk_live_10F423798A540ED7",this.magicProviderId="fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=",this.passportDomain="https://passport.sandbox.immutable.com",this.imxPublicApiDomain="https://api.sandbox.immutable.com",this.zkEvmRpcUrl="https://zkevm-rpc.sandbox.x.immutable.com",this.zkEvmChainId="eip155:13392",this.relayerUrl="https://api.sandbox.immutable.com/relayer-mr",this.multiRollupConfig=wt()}}}var aH,oH,sH;!function(e){e.CONFIRMATION_WINDOW_READY="confirmation_window_ready",e.TRANSACTION_CONFIRMED="transaction_confirmed",e.TRANSACTION_ERROR="transaction_error"}(aH||(aH={})),function(e){e.TRANSACTION_START="transaction_start"}(oH||(oH={})),function(e){e.cancelOrder="delete:v1/orders",e.createOrder="post:v1/orders",e.createTrade="post:v1/trades",e.createTransfer="post:v1/transfers",e.createBatchTransfer="post:v2/transfers"}(sH||(sH={}));const fH="imx_passport_confirmation",uH=({url:e,title:t,width:r,height:n})=>{const i=Math.max(0,Math.round(window.screenX+(window.outerWidth-r)/2)),a=Math.max(0,Math.round(window.screenY+(window.outerHeight-n)/2)),o=window.open(e,t,`\n scrollbars=yes,\n width=${r}, \n height=${n}, \n top=${a}, \n left=${i}\n `);if(!o)throw new Error("Failed to open confirmation screen");return o.focus(),o},cH="Confirm this transaction";class dH{config;confirmationWindow;constructor(e){this.config=e}postMessage(e,t,r){e.postMessage({eventType:fH,accessToken:t,...r},this.config.passportDomain)}startTransaction(e,t,r){return new Promise(((n,i)=>{const a=({data:r,origin:a})=>{if(a===this.config.passportDomain&&r.eventType===fH)switch(r.messageType){case aH.CONFIRMATION_WINDOW_READY:this.postMessage(o,e,{messageType:oH.TRANSACTION_START,messageData:t});break;case aH.TRANSACTION_CONFIRMED:n({confirmed:!0});break;case aH.TRANSACTION_ERROR:i(new Error("Transaction error"));break;default:i(new Error("Unsupported message type"))}};window.addEventListener("message",a);const o=uH({url:`${this.config.passportDomain}/transaction-confirmation`,title:cH,width:r?.width||480,height:r?.height||380}),s=setInterval((()=>{o.closed&&(clearInterval(s),window.removeEventListener("message",a),n({confirmed:!1}))}),1e3)}))}startGuardianTransaction(e,t,r,n){return new Promise(((i,a)=>{const o=({data:e,origin:t})=>{if(t===this.config.passportDomain&&e.eventType===fH)switch(e.messageType){case aH.CONFIRMATION_WINDOW_READY:break;case aH.TRANSACTION_CONFIRMED:i({confirmed:!0});break;case aH.TRANSACTION_ERROR:a(new Error("Transaction error"));break;default:a(new Error("Unsupported message type"))}};if(window.addEventListener("message",o),!this.confirmationWindow)return void i({confirmed:!1});let s="";s=r===Yq?`${this.config.passportDomain}/transaction-confirmation/transaction.html?transactionId=${e}&imxEtherAddress=${t}&chainType=starkex`:`${this.config.passportDomain}/transaction-confirmation/zkevm?transactionId=${e}&imxEtherAddress=${t}&chainType=evm&chainId=${n}`,this.confirmationWindow.location.href=s;const f=setInterval((()=>{this.confirmationWindow?.closed&&(clearInterval(f),window.removeEventListener("message",o),i({confirmed:!1}))}),1e3)}))}loading(e){this.confirmationWindow=uH({url:`${this.config.passportDomain}/transaction-confirmation/loading.html`,title:cH,width:e?.width||480,height:e?.height||380})}closeWindow(){this.confirmationWindow?.close()}}var lH;!function(e){e.PENDING="PENDING",e.SUBMITTED="SUBMITTED",e.SUCCESSFUL="SUCCESSFUL",e.REVERTED="REVERTED",e.FAILED="FAILED"}(lH||(lH={})),e.ProviderEvent=void 0,(e.ProviderEvent||(e.ProviderEvent={})).ACCOUNTS_CHANGED="accountsChanged";class pH{emitter=new OE;emit(e,...t){this.emitter.emit(e,...t)}on(e,t){this.emitter.on(e,t)}removeListener(e,t){this.emitter.removeListener(e,t)}}class hH{config;constructor({config:e}){this.config=e}async postToRelayer(e){const t={id:1,jsonrpc:"2.0",...e},r=await fetch(`${this.config.relayerUrl}/v1/transactions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await r.json();if(n.error)throw n.error;return n}async ethSendTransaction(e,t){const r={method:"eth_sendTransaction",params:[{to:e,data:t,chainId:this.config.zkEvmChainId.toString()}]},{result:n}=await this.postToRelayer(r);return n}async imGetTransactionByHash(e){const t={method:"im_getTransactionByHash",params:[e]},{result:r}=await this.postToRelayer(t);return r}async imGetFeeOptions(e,t){const r={method:"im_getFeeOptions",params:[{userAddress:e,data:t,chainId:this.config.zkEvmChainId.toString()}]},{result:n}=await this.postToRelayer(r);return n}}const mH=async({authManager:t,config:r,magicAdapter:n,multiRollupApiClients:i})=>{const a=await t.getUser()||await t.login();if(!a.idToken)throw new Error("User is missing idToken");const o=await n.login(a.idToken,r.network);if(!a.zkEvm){const r=await async function({authManager:t,magicProvider:r,multiRollupApiClients:n,accessToken:i}){const a=new fb(r).getSigner(),o=await a.getAddress(),s=await ez("Only sign this message from Immutable Passport",a),f={Authorization:`Bearer ${i}`};try{await n.passportApi.createCounterfactualAddress({createCounterfactualAddressRequest:{ethereumAddress:o,ethereumSignature:s}},{headers:f})}catch(t){throw new $z(e.RpcErrorCode.INTERNAL_ERROR,`Failed to create counterfactual address: ${t}`)}const u=await t.loginSilent();if(!u?.zkEvm)throw new $z(e.RpcErrorCode.INTERNAL_ERROR,"Failed to refresh user details");return u}({authManager:t,magicProvider:o,multiRollupApiClients:i,accessToken:a.accessToken});return{user:r,magicProvider:o}}return{user:a,magicProvider:o}};const bH=async(e,t,r,n,i)=>{const a=e.map((e=>({delegateCall:!0===e.delegateCall,revertOnError:!0===e.revertOnError,gasLimit:e.gasLimit??qo,target:e.to??Uo,value:e.value??qo,data:e.data??[]})));const o=function(e,t){return ao(xs.encode(["uint256","tuple(\n bool delegateCall,\n bool revertOnError,\n uint256 gasLimit,\n address target,\n uint256 value,\n bytes data\n)[]"],[e,t]))}(t,a),s=Ii(ao(gb(["string","uint256","address","bytes32"],["",r,n,o]))),f=await i.signMessage(s),u=Nz({threshold:1,signers:[{weight:1,signature:`${f}02`}]}),c=new Df(rz.mainModule.abi);return c.encodeFunctionData(c.getFunction("execute"),[a,t,u])},yH=async({params:t,magicProvider:r,jsonRpcProvider:n,relayerClient:i,guardianClient:a,config:o,user:s})=>{a.loading({width:480,height:580});const f=t[0];if(!f.to)throw new $z(e.RpcErrorCode.INVALID_PARAMS,'eth_sendTransaction requires a "to" field');const u=(e=>{const t=e.split(":");if(2!==t.length)throw new Error("Invalid configuration, chain ID is not in CAIP-2 format");return Qi.from(t[1])})(o.zkEvmChainId),c=new fb(r).getSigner(),d=await(async(e,t)=>{const r=await e.send("eth_getCode",[t,"latest"]);if(r&&"0x"!==r)return new gl(t,rz.mainModule.abi,e).nonce();return 0})(n,s.zkEvm.ethAddress),l={to:f.to,data:f.data,nonce:d,value:f.value,revertOnError:!0},p=await bH([l],d,u,s.zkEvm.ethAddress,c),h=(await i.imGetFeeOptions(s.zkEvm.ethAddress,p)).find((e=>"IMX"===e.tokenSymbol));if(!h)throw new Error("Failed to retrieve fees for IMX token");const m={nonce:d,to:h.recipientAddress,value:h.tokenPrice,revertOnError:!0};await a.validateEVMTransaction({chainId:o.zkEvmChainId,nonce:Jz(d),user:s,metaTransactions:[l,m]});const b=await bH([l,m],d,u,s.zkEvm.ethAddress,c),y=await i.ethSendTransaction(s.zkEvm.ethAddress,b),g=await Kz((async()=>{const e=await i.imGetTransactionByHash(y);if(e.status===lH.PENDING)throw new Error;return e}),{retries:30,interval:1e3,finalErr:new $z(e.RpcErrorCode.RPC_SERVER_ERROR,"transaction hash not generated in time")});if(![lH.SUBMITTED,lH.SUCCESSFUL].includes(g.status))throw new $z(e.RpcErrorCode.RPC_SERVER_ERROR,`Transaction failed to submit with status ${g.status}`);return g.hash};class gH{authManager;config;confirmationScreen;magicAdapter;relayerClient;transactionAPI;multiRollupApiClients;jsonRpcProvider;eventEmitter;magicProvider;user;constructor({authManager:e,magicAdapter:t,config:r,confirmationScreen:n,multiRollupApiClients:i}){this.authManager=e,this.magicAdapter=t,this.config=r,this.confirmationScreen=n,this.relayerClient=new hH({config:r}),this.transactionAPI=new $q(new Jq({basePath:this.config.imxPublicApiDomain})),this.jsonRpcProvider=new om(this.config.zkEvmRpcUrl),this.multiRollupApiClients=i,this.eventEmitter=new pH}isLoggedIn(){return void 0!==this.magicProvider&&void 0!==this.user}async performRequest(t){switch(t.method){case"eth_requestAccounts":{if(this.isLoggedIn())return[this.user.zkEvm.ethAddress];const{magicProvider:t,user:r}=await mH({authManager:this.authManager,config:this.config,magicAdapter:this.magicAdapter,multiRollupApiClients:this.multiRollupApiClients});return this.user=r,this.magicProvider=t,this.eventEmitter.emit(e.ProviderEvent.ACCOUNTS_CHANGED,[this.user.zkEvm.ethAddress]),[this.user.zkEvm.ethAddress]}case"eth_sendTransaction":{if(!this.isLoggedIn())throw new $z(e.ProviderErrorCode.UNAUTHORIZED,"Unauthorised - call eth_requestAccounts first");const r=new Yz({imxPublicApiDomain:this.config.imxPublicApiDomain,accessToken:this.user.accessToken,confirmationScreen:this.confirmationScreen,imxEtherAddress:this.user?.imx?.ethAddress||""});return yH({params:t.params||[],magicProvider:this.magicProvider,guardianClient:r,jsonRpcProvider:this.jsonRpcProvider,config:this.config,relayerClient:this.relayerClient,user:this.user})}case"eth_accounts":return this.isLoggedIn()?[this.user.zkEvm.ethAddress]:[];case"eth_gasPrice":case"eth_getBalance":case"eth_getStorageAt":case"eth_estimateGas":case"eth_call":case"eth_blockNumber":case"eth_chainId":case"eth_getBlockByHash":case"eth_getBlockByNumber":case"eth_getTransactionByHash":case"eth_getTransactionReceipt":case"eth_getTransactionCount":return this.jsonRpcProvider.send(t.method,t.params||[]);default:throw new $z(e.ProviderErrorCode.UNSUPPORTED_METHOD,"Method not supported")}}async performJsonRpcRequest(t){const{id:r,jsonrpc:n}=t;try{return{id:r,jsonrpc:n,result:await this.performRequest(t)}}catch(t){let i;return i=t instanceof $z?t:t instanceof Error?new $z(e.RpcErrorCode.INTERNAL_ERROR,t.message):new $z(e.RpcErrorCode.INTERNAL_ERROR,"Internal error"),{id:r,jsonrpc:n,error:i}}}async request(t){try{return this.performRequest(t)}catch(t){if(t instanceof $z)throw t;if(t instanceof Error)throw new $z(e.RpcErrorCode.INTERNAL_ERROR,t.message);throw new $z(e.RpcErrorCode.INTERNAL_ERROR,"Internal error")}}sendAsync(e,t){if(!t)throw new Error("No callback provided");Array.isArray(e)?Promise.all(e.map(this.performJsonRpcRequest)).then((e=>{t(null,e)})).catch((e=>{t(e,[])})):this.performJsonRpcRequest(e).then((e=>{t(null,e)})).catch((e=>{t(e,null)}))}async send(t,r,n){if("string"==typeof t)return"function"==typeof r?this.sendAsync({method:t,params:[]},r):n?this.sendAsync({method:t,params:Array.isArray(r)?r:[]},n):this.request({method:t,params:Array.isArray(r)?r:[]});if("function"==typeof r)return this.sendAsync(t,r);if(!Array.isArray(t)&&"object"==typeof t)return this.performJsonRpcRequest(t);throw new $z(e.RpcErrorCode.INVALID_REQUEST,"Invalid request")}on(e,t){this.eventEmitter.on(e,t)}removeListener(e,t){this.eventEmitter.removeListener(e,t)}}var vH=sn("object"==typeof self?self.FormData:window.FormData),wH={},_H={},EH=fn(Sz),TH=fn(Mb),AH={},SH=fn(Ff),kH=fn(Oo),OH=fn(Ms),RH=fn(Al),xH=fn(Gi),IH=fn(Rf),CH=fn(ep),NH=fn(Fp),PH=fn(oo),MH=fn(Ti),BH=fn(Il),DH=fn(_b),FH=fn(op),LH=fn(Ra),UH=fn(bo),jH=fn(Ld),qH=fn(Es),zH=fn(rl),HH=fn(xb),VH=fn(Hp),GH=fn(sh);!function(e){var t=on&&on.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=on&&on.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=on&&on.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&t(n,e,i);return r(n,e),n};Object.defineProperty(e,"__esModule",{value:!0}),e.formatBytes32String=e.Utf8ErrorFuncs=e.toUtf8String=e.toUtf8CodePoints=e.toUtf8Bytes=e._toEscapedUtf8String=e.nameprep=e.hexDataSlice=e.hexDataLength=e.hexZeroPad=e.hexValue=e.hexStripZeros=e.hexConcat=e.isHexString=e.hexlify=e.base64=e.base58=e.TransactionDescription=e.LogDescription=e.Interface=e.SigningKey=e.HDNode=e.defaultPath=e.isBytesLike=e.isBytes=e.zeroPad=e.stripZeros=e.concat=e.arrayify=e.shallowCopy=e.resolveProperties=e.getStatic=e.defineReadOnly=e.deepCopy=e.checkProperties=e.poll=e.fetchJson=e._fetchData=e.RLP=e.Logger=e.checkResultErrors=e.FormatTypes=e.ParamType=e.FunctionFragment=e.EventFragment=e.ErrorFragment=e.ConstructorFragment=e.Fragment=e.defaultAbiCoder=e.AbiCoder=void 0,e.Indexed=e.Utf8ErrorReason=e.UnicodeNormalizationForm=e.SupportedAlgorithm=e.mnemonicToSeed=e.isValidMnemonic=e.entropyToMnemonic=e.mnemonicToEntropy=e.getAccountPath=e.verifyTypedData=e.verifyMessage=e.recoverPublicKey=e.computePublicKey=e.recoverAddress=e.computeAddress=e.getJsonWalletAddress=e.TransactionTypes=e.serializeTransaction=e.parseTransaction=e.accessListify=e.joinSignature=e.splitSignature=e.soliditySha256=e.solidityKeccak256=e.solidityPack=e.shuffled=e.randomBytes=e.sha512=e.sha256=e.ripemd160=e.keccak256=e.computeHmac=e.commify=e.parseUnits=e.formatUnits=e.parseEther=e.formatEther=e.isAddress=e.getCreate2Address=e.getContractAddress=e.getIcapAddress=e.getAddress=e._TypedDataEncoder=e.id=e.isValidName=e.namehash=e.hashMessage=e.dnsEncode=e.parseBytes32String=void 0;var i=SH;Object.defineProperty(e,"AbiCoder",{enumerable:!0,get:function(){return i.AbiCoder}}),Object.defineProperty(e,"checkResultErrors",{enumerable:!0,get:function(){return i.checkResultErrors}}),Object.defineProperty(e,"ConstructorFragment",{enumerable:!0,get:function(){return i.ConstructorFragment}}),Object.defineProperty(e,"defaultAbiCoder",{enumerable:!0,get:function(){return i.defaultAbiCoder}}),Object.defineProperty(e,"ErrorFragment",{enumerable:!0,get:function(){return i.ErrorFragment}}),Object.defineProperty(e,"EventFragment",{enumerable:!0,get:function(){return i.EventFragment}}),Object.defineProperty(e,"FormatTypes",{enumerable:!0,get:function(){return i.FormatTypes}}),Object.defineProperty(e,"Fragment",{enumerable:!0,get:function(){return i.Fragment}}),Object.defineProperty(e,"FunctionFragment",{enumerable:!0,get:function(){return i.FunctionFragment}}),Object.defineProperty(e,"Indexed",{enumerable:!0,get:function(){return i.Indexed}}),Object.defineProperty(e,"Interface",{enumerable:!0,get:function(){return i.Interface}}),Object.defineProperty(e,"LogDescription",{enumerable:!0,get:function(){return i.LogDescription}}),Object.defineProperty(e,"ParamType",{enumerable:!0,get:function(){return i.ParamType}}),Object.defineProperty(e,"TransactionDescription",{enumerable:!0,get:function(){return i.TransactionDescription}});var a=kH;Object.defineProperty(e,"getAddress",{enumerable:!0,get:function(){return a.getAddress}}),Object.defineProperty(e,"getCreate2Address",{enumerable:!0,get:function(){return a.getCreate2Address}}),Object.defineProperty(e,"getContractAddress",{enumerable:!0,get:function(){return a.getContractAddress}}),Object.defineProperty(e,"getIcapAddress",{enumerable:!0,get:function(){return a.getIcapAddress}}),Object.defineProperty(e,"isAddress",{enumerable:!0,get:function(){return a.isAddress}});var o=n(OH);e.base64=o;var s=RH;Object.defineProperty(e,"base58",{enumerable:!0,get:function(){return s.Base58}});var f=xH;Object.defineProperty(e,"arrayify",{enumerable:!0,get:function(){return f.arrayify}}),Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return f.concat}}),Object.defineProperty(e,"hexConcat",{enumerable:!0,get:function(){return f.hexConcat}}),Object.defineProperty(e,"hexDataSlice",{enumerable:!0,get:function(){return f.hexDataSlice}}),Object.defineProperty(e,"hexDataLength",{enumerable:!0,get:function(){return f.hexDataLength}}),Object.defineProperty(e,"hexlify",{enumerable:!0,get:function(){return f.hexlify}}),Object.defineProperty(e,"hexStripZeros",{enumerable:!0,get:function(){return f.hexStripZeros}}),Object.defineProperty(e,"hexValue",{enumerable:!0,get:function(){return f.hexValue}}),Object.defineProperty(e,"hexZeroPad",{enumerable:!0,get:function(){return f.hexZeroPad}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return f.isBytes}}),Object.defineProperty(e,"isBytesLike",{enumerable:!0,get:function(){return f.isBytesLike}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return f.isHexString}}),Object.defineProperty(e,"joinSignature",{enumerable:!0,get:function(){return f.joinSignature}}),Object.defineProperty(e,"zeroPad",{enumerable:!0,get:function(){return f.zeroPad}}),Object.defineProperty(e,"splitSignature",{enumerable:!0,get:function(){return f.splitSignature}}),Object.defineProperty(e,"stripZeros",{enumerable:!0,get:function(){return f.stripZeros}});var u=IH;Object.defineProperty(e,"_TypedDataEncoder",{enumerable:!0,get:function(){return u._TypedDataEncoder}}),Object.defineProperty(e,"dnsEncode",{enumerable:!0,get:function(){return u.dnsEncode}}),Object.defineProperty(e,"hashMessage",{enumerable:!0,get:function(){return u.hashMessage}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return u.id}}),Object.defineProperty(e,"isValidName",{enumerable:!0,get:function(){return u.isValidName}}),Object.defineProperty(e,"namehash",{enumerable:!0,get:function(){return u.namehash}});var c=CH;Object.defineProperty(e,"defaultPath",{enumerable:!0,get:function(){return c.defaultPath}}),Object.defineProperty(e,"entropyToMnemonic",{enumerable:!0,get:function(){return c.entropyToMnemonic}}),Object.defineProperty(e,"getAccountPath",{enumerable:!0,get:function(){return c.getAccountPath}}),Object.defineProperty(e,"HDNode",{enumerable:!0,get:function(){return c.HDNode}}),Object.defineProperty(e,"isValidMnemonic",{enumerable:!0,get:function(){return c.isValidMnemonic}}),Object.defineProperty(e,"mnemonicToEntropy",{enumerable:!0,get:function(){return c.mnemonicToEntropy}}),Object.defineProperty(e,"mnemonicToSeed",{enumerable:!0,get:function(){return c.mnemonicToSeed}});var d=NH;Object.defineProperty(e,"getJsonWalletAddress",{enumerable:!0,get:function(){return d.getJsonWalletAddress}});var l=PH;Object.defineProperty(e,"keccak256",{enumerable:!0,get:function(){return l.keccak256}});var p=MH;Object.defineProperty(e,"Logger",{enumerable:!0,get:function(){return p.Logger}});var h=BH;Object.defineProperty(e,"computeHmac",{enumerable:!0,get:function(){return h.computeHmac}}),Object.defineProperty(e,"ripemd160",{enumerable:!0,get:function(){return h.ripemd160}}),Object.defineProperty(e,"sha256",{enumerable:!0,get:function(){return h.sha256}}),Object.defineProperty(e,"sha512",{enumerable:!0,get:function(){return h.sha512}});var m=DH;Object.defineProperty(e,"solidityKeccak256",{enumerable:!0,get:function(){return m.keccak256}}),Object.defineProperty(e,"solidityPack",{enumerable:!0,get:function(){return m.pack}}),Object.defineProperty(e,"soliditySha256",{enumerable:!0,get:function(){return m.sha256}});var b=FH;Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return b.randomBytes}}),Object.defineProperty(e,"shuffled",{enumerable:!0,get:function(){return b.shuffled}});var y=LH;Object.defineProperty(e,"checkProperties",{enumerable:!0,get:function(){return y.checkProperties}}),Object.defineProperty(e,"deepCopy",{enumerable:!0,get:function(){return y.deepCopy}}),Object.defineProperty(e,"defineReadOnly",{enumerable:!0,get:function(){return y.defineReadOnly}}),Object.defineProperty(e,"getStatic",{enumerable:!0,get:function(){return y.getStatic}}),Object.defineProperty(e,"resolveProperties",{enumerable:!0,get:function(){return y.resolveProperties}}),Object.defineProperty(e,"shallowCopy",{enumerable:!0,get:function(){return y.shallowCopy}});var g=n(UH);e.RLP=g;var v=jH;Object.defineProperty(e,"computePublicKey",{enumerable:!0,get:function(){return v.computePublicKey}}),Object.defineProperty(e,"recoverPublicKey",{enumerable:!0,get:function(){return v.recoverPublicKey}}),Object.defineProperty(e,"SigningKey",{enumerable:!0,get:function(){return v.SigningKey}});var w=qH;Object.defineProperty(e,"formatBytes32String",{enumerable:!0,get:function(){return w.formatBytes32String}}),Object.defineProperty(e,"nameprep",{enumerable:!0,get:function(){return w.nameprep}}),Object.defineProperty(e,"parseBytes32String",{enumerable:!0,get:function(){return w.parseBytes32String}}),Object.defineProperty(e,"_toEscapedUtf8String",{enumerable:!0,get:function(){return w._toEscapedUtf8String}}),Object.defineProperty(e,"toUtf8Bytes",{enumerable:!0,get:function(){return w.toUtf8Bytes}}),Object.defineProperty(e,"toUtf8CodePoints",{enumerable:!0,get:function(){return w.toUtf8CodePoints}}),Object.defineProperty(e,"toUtf8String",{enumerable:!0,get:function(){return w.toUtf8String}}),Object.defineProperty(e,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return w.Utf8ErrorFuncs}});var _=zH;Object.defineProperty(e,"accessListify",{enumerable:!0,get:function(){return _.accessListify}}),Object.defineProperty(e,"computeAddress",{enumerable:!0,get:function(){return _.computeAddress}}),Object.defineProperty(e,"parseTransaction",{enumerable:!0,get:function(){return _.parse}}),Object.defineProperty(e,"recoverAddress",{enumerable:!0,get:function(){return _.recoverAddress}}),Object.defineProperty(e,"serializeTransaction",{enumerable:!0,get:function(){return _.serialize}}),Object.defineProperty(e,"TransactionTypes",{enumerable:!0,get:function(){return _.TransactionTypes}});var E=HH;Object.defineProperty(e,"commify",{enumerable:!0,get:function(){return E.commify}}),Object.defineProperty(e,"formatEther",{enumerable:!0,get:function(){return E.formatEther}}),Object.defineProperty(e,"parseEther",{enumerable:!0,get:function(){return E.parseEther}}),Object.defineProperty(e,"formatUnits",{enumerable:!0,get:function(){return E.formatUnits}}),Object.defineProperty(e,"parseUnits",{enumerable:!0,get:function(){return E.parseUnits}});var T=VH;Object.defineProperty(e,"verifyMessage",{enumerable:!0,get:function(){return T.verifyMessage}}),Object.defineProperty(e,"verifyTypedData",{enumerable:!0,get:function(){return T.verifyTypedData}});var A=GH;Object.defineProperty(e,"_fetchData",{enumerable:!0,get:function(){return A._fetchData}}),Object.defineProperty(e,"fetchJson",{enumerable:!0,get:function(){return A.fetchJson}}),Object.defineProperty(e,"poll",{enumerable:!0,get:function(){return A.poll}});var S=BH;Object.defineProperty(e,"SupportedAlgorithm",{enumerable:!0,get:function(){return S.SupportedAlgorithm}});var k=qH;Object.defineProperty(e,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return k.UnicodeNormalizationForm}}),Object.defineProperty(e,"Utf8ErrorReason",{enumerable:!0,get:function(){return k.Utf8ErrorReason}})}(AH);var KH={};Object.defineProperty(KH,"__esModule",{value:!0}),KH.DomainRegistryABI=void 0;KH.DomainRegistryABI=[{inputs:[{internalType:"string",name:"domain",type:"string"}],name:"DomainAlreadyRegistered",type:"error"},{inputs:[{internalType:"bytes4",name:"tag",type:"bytes4"},{internalType:"uint256",name:"maxIndex",type:"uint256"},{internalType:"uint256",name:"suppliedIndex",type:"uint256"}],name:"DomainIndexOutOfRange",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"domain",type:"string"},{indexed:!1,internalType:"bytes4",name:"tag",type:"bytes4"},{indexed:!1,internalType:"uint256",name:"index",type:"uint256"}],name:"DomainRegistered",type:"event"},{inputs:[{internalType:"bytes4",name:"tag",type:"bytes4"},{internalType:"uint256",name:"index",type:"uint256"}],name:"getDomain",outputs:[{internalType:"string",name:"domain",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"tag",type:"bytes4"}],name:"getDomains",outputs:[{internalType:"string[]",name:"domains",type:"string[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"tag",type:"bytes4"}],name:"getNumberOfDomains",outputs:[{internalType:"uint256",name:"totalDomains",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"domain",type:"string"}],name:"setDomain",outputs:[{internalType:"bytes4",name:"tag",type:"bytes4"}],stateMutability:"nonpayable",type:"function"}];var WH={};Object.defineProperty(WH,"__esModule",{value:!0}),WH.SeaportABIv14=void 0;WH.SeaportABIv14=[{inputs:[{internalType:"address",name:"conduitController",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"BadContractSignature",type:"error"},{inputs:[],name:"BadFraction",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"BadReturnValueFromERC20OnTransfer",type:"error"},{inputs:[{internalType:"uint8",name:"v",type:"uint8"}],name:"BadSignatureV",type:"error"},{inputs:[],name:"CannotCancelOrder",type:"error"},{inputs:[],name:"ConsiderationCriteriaResolverOutOfRange",type:"error"},{inputs:[],name:"ConsiderationLengthNotEqualToTotalOriginal",type:"error"},{inputs:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"considerationIndex",type:"uint256"},{internalType:"uint256",name:"shortfallAmount",type:"uint256"}],name:"ConsiderationNotMet",type:"error"},{inputs:[],name:"CriteriaNotEnabledForItem",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"identifiers",type:"uint256[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"}],name:"ERC1155BatchTransferGenericFailure",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"EtherTransferGenericFailure",type:"error"},{inputs:[],name:"InexactFraction",type:"error"},{inputs:[],name:"InsufficientEtherSupplied",type:"error"},{inputs:[],name:"Invalid1155BatchTransferEncoding",type:"error"},{inputs:[],name:"InvalidBasicOrderParameterEncoding",type:"error"},{inputs:[{internalType:"address",name:"conduit",type:"address"}],name:"InvalidCallToConduit",type:"error"},{inputs:[{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"address",name:"conduit",type:"address"}],name:"InvalidConduit",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"InvalidContractOrder",type:"error"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"InvalidERC721TransferAmount",type:"error"},{inputs:[],name:"InvalidFulfillmentComponentData",type:"error"},{inputs:[{internalType:"uint256",name:"value",type:"uint256"}],name:"InvalidMsgValue",type:"error"},{inputs:[],name:"InvalidNativeOfferItem",type:"error"},{inputs:[],name:"InvalidProof",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"InvalidRestrictedOrder",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[],name:"InvalidSigner",type:"error"},{inputs:[{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"}],name:"InvalidTime",type:"error"},{inputs:[{internalType:"uint256",name:"fulfillmentIndex",type:"uint256"}],name:"MismatchedFulfillmentOfferAndConsiderationComponents",type:"error"},{inputs:[{internalType:"enum Side",name:"side",type:"uint8"}],name:"MissingFulfillmentComponentOnAggregation",type:"error"},{inputs:[],name:"MissingItemAmount",type:"error"},{inputs:[],name:"MissingOriginalConsiderationItems",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"NoContract",type:"error"},{inputs:[],name:"NoReentrantCalls",type:"error"},{inputs:[],name:"NoSpecifiedOrdersAvailable",type:"error"},{inputs:[],name:"OfferAndConsiderationRequiredOnFulfillment",type:"error"},{inputs:[],name:"OfferCriteriaResolverOutOfRange",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"OrderAlreadyFilled",type:"error"},{inputs:[{internalType:"enum Side",name:"side",type:"uint8"}],name:"OrderCriteriaResolverOutOfRange",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"OrderIsCancelled",type:"error"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"OrderPartiallyFilled",type:"error"},{inputs:[],name:"PartialFillsNotEnabledForOrder",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"TokenTransferGenericFailure",type:"error"},{inputs:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"considerationIndex",type:"uint256"}],name:"UnresolvedConsiderationCriteria",type:"error"},{inputs:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"offerIndex",type:"uint256"}],name:"UnresolvedOfferCriteria",type:"error"},{inputs:[],name:"UnusedItemParameters",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"newCounter",type:"uint256"},{indexed:!0,internalType:"address",name:"offerer",type:"address"}],name:"CounterIncremented",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"orderHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"offerer",type:"address"},{indexed:!0,internalType:"address",name:"zone",type:"address"}],name:"OrderCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"orderHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"offerer",type:"address"},{indexed:!0,internalType:"address",name:"zone",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"}],indexed:!1,internalType:"struct SpentItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],indexed:!1,internalType:"struct ReceivedItem[]",name:"consideration",type:"tuple[]"}],name:"OrderFulfilled",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"orderHash",type:"bytes32"},{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],indexed:!1,internalType:"struct OrderParameters",name:"orderParameters",type:"tuple"}],name:"OrderValidated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32[]",name:"orderHashes",type:"bytes32[]"}],name:"OrdersMatched",type:"event"},{inputs:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"counter",type:"uint256"}],internalType:"struct OrderComponents[]",name:"orders",type:"tuple[]"}],name:"cancel",outputs:[{internalType:"bool",name:"cancelled",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"uint120",name:"numerator",type:"uint120"},{internalType:"uint120",name:"denominator",type:"uint120"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"bytes",name:"extraData",type:"bytes"}],internalType:"struct AdvancedOrder",name:"advancedOrder",type:"tuple"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"enum Side",name:"side",type:"uint8"},{internalType:"uint256",name:"index",type:"uint256"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"bytes32[]",name:"criteriaProof",type:"bytes32[]"}],internalType:"struct CriteriaResolver[]",name:"criteriaResolvers",type:"tuple[]"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"},{internalType:"address",name:"recipient",type:"address"}],name:"fulfillAdvancedOrder",outputs:[{internalType:"bool",name:"fulfilled",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"uint120",name:"numerator",type:"uint120"},{internalType:"uint120",name:"denominator",type:"uint120"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"bytes",name:"extraData",type:"bytes"}],internalType:"struct AdvancedOrder[]",name:"advancedOrders",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"enum Side",name:"side",type:"uint8"},{internalType:"uint256",name:"index",type:"uint256"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"bytes32[]",name:"criteriaProof",type:"bytes32[]"}],internalType:"struct CriteriaResolver[]",name:"criteriaResolvers",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[][]",name:"offerFulfillments",type:"tuple[][]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[][]",name:"considerationFulfillments",type:"tuple[][]"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"maximumFulfilled",type:"uint256"}],name:"fulfillAvailableAdvancedOrders",outputs:[{internalType:"bool[]",name:"availableOrders",type:"bool[]"},{components:[{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ReceivedItem",name:"item",type:"tuple"},{internalType:"address",name:"offerer",type:"address"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"}],internalType:"struct Execution[]",name:"executions",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct Order[]",name:"orders",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[][]",name:"offerFulfillments",type:"tuple[][]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[][]",name:"considerationFulfillments",type:"tuple[][]"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"},{internalType:"uint256",name:"maximumFulfilled",type:"uint256"}],name:"fulfillAvailableOrders",outputs:[{internalType:"bool[]",name:"availableOrders",type:"bool[]"},{components:[{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ReceivedItem",name:"item",type:"tuple"},{internalType:"address",name:"offerer",type:"address"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"}],internalType:"struct Execution[]",name:"executions",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"considerationToken",type:"address"},{internalType:"uint256",name:"considerationIdentifier",type:"uint256"},{internalType:"uint256",name:"considerationAmount",type:"uint256"},{internalType:"address payable",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{internalType:"address",name:"offerToken",type:"address"},{internalType:"uint256",name:"offerIdentifier",type:"uint256"},{internalType:"uint256",name:"offerAmount",type:"uint256"},{internalType:"enum BasicOrderType",name:"basicOrderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"offererConduitKey",type:"bytes32"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalAdditionalRecipients",type:"uint256"},{components:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct AdditionalRecipient[]",name:"additionalRecipients",type:"tuple[]"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct BasicOrderParameters",name:"parameters",type:"tuple"}],name:"fulfillBasicOrder",outputs:[{internalType:"bool",name:"fulfilled",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct Order",name:"order",type:"tuple"},{internalType:"bytes32",name:"fulfillerConduitKey",type:"bytes32"}],name:"fulfillOrder",outputs:[{internalType:"bool",name:"fulfilled",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"contractOfferer",type:"address"}],name:"getContractOffererNonce",outputs:[{internalType:"uint256",name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"offerer",type:"address"}],name:"getCounter",outputs:[{internalType:"uint256",name:"counter",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"counter",type:"uint256"}],internalType:"struct OrderComponents",name:"order",type:"tuple"}],name:"getOrderHash",outputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"getOrderStatus",outputs:[{internalType:"bool",name:"isValidated",type:"bool"},{internalType:"bool",name:"isCancelled",type:"bool"},{internalType:"uint256",name:"totalFilled",type:"uint256"},{internalType:"uint256",name:"totalSize",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"incrementCounter",outputs:[{internalType:"uint256",name:"newCounter",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"information",outputs:[{internalType:"string",name:"version",type:"string"},{internalType:"bytes32",name:"domainSeparator",type:"bytes32"},{internalType:"address",name:"conduitController",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"uint120",name:"numerator",type:"uint120"},{internalType:"uint120",name:"denominator",type:"uint120"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"bytes",name:"extraData",type:"bytes"}],internalType:"struct AdvancedOrder[]",name:"orders",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"enum Side",name:"side",type:"uint8"},{internalType:"uint256",name:"index",type:"uint256"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"bytes32[]",name:"criteriaProof",type:"bytes32[]"}],internalType:"struct CriteriaResolver[]",name:"criteriaResolvers",type:"tuple[]"},{components:[{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[]",name:"offerComponents",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[]",name:"considerationComponents",type:"tuple[]"}],internalType:"struct Fulfillment[]",name:"fulfillments",type:"tuple[]"},{internalType:"address",name:"recipient",type:"address"}],name:"matchAdvancedOrders",outputs:[{components:[{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ReceivedItem",name:"item",type:"tuple"},{internalType:"address",name:"offerer",type:"address"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"}],internalType:"struct Execution[]",name:"executions",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct Order[]",name:"orders",type:"tuple[]"},{components:[{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[]",name:"offerComponents",type:"tuple[]"},{components:[{internalType:"uint256",name:"orderIndex",type:"uint256"},{internalType:"uint256",name:"itemIndex",type:"uint256"}],internalType:"struct FulfillmentComponent[]",name:"considerationComponents",type:"tuple[]"}],internalType:"struct Fulfillment[]",name:"fulfillments",type:"tuple[]"}],name:"matchOrders",outputs:[{components:[{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifier",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ReceivedItem",name:"item",type:"tuple"},{internalType:"address",name:"offerer",type:"address"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"}],internalType:"struct Execution[]",name:"executions",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"contractName",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"offerer",type:"address"},{internalType:"address",name:"zone",type:"address"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"}],internalType:"struct OfferItem[]",name:"offer",type:"tuple[]"},{components:[{internalType:"enum ItemType",name:"itemType",type:"uint8"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"identifierOrCriteria",type:"uint256"},{internalType:"uint256",name:"startAmount",type:"uint256"},{internalType:"uint256",name:"endAmount",type:"uint256"},{internalType:"address payable",name:"recipient",type:"address"}],internalType:"struct ConsiderationItem[]",name:"consideration",type:"tuple[]"},{internalType:"enum OrderType",name:"orderType",type:"uint8"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"bytes32",name:"zoneHash",type:"bytes32"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes32",name:"conduitKey",type:"bytes32"},{internalType:"uint256",name:"totalOriginalConsiderationItems",type:"uint256"}],internalType:"struct OrderParameters",name:"parameters",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct Order[]",name:"orders",type:"tuple[]"}],name:"validate",outputs:[{internalType:"bool",name:"validated",type:"bool"}],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}];var XH={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DOMAIN_REGISTRY_ADDRESS=e.CROSS_CHAIN_SEAPORT_V1_5_ADDRESS=e.CROSS_CHAIN_SEAPORT_V1_4_ADDRESS=e.KNOWN_CONDUIT_KEYS_TO_CONDUIT=e.NO_CONDUIT=e.ONE_HUNDRED_PERCENT_BP=e.MAX_INT=e.BasicOrderRouteType=e.Side=e.ItemType=e.OrderType=e.EIP_712_BULK_ORDER_TYPE=e.EIP_712_ORDER_TYPE=e.OPENSEA_CONDUIT_ADDRESS=e.OPENSEA_CONDUIT_KEY=e.SEAPORT_CONTRACT_VERSION_V1_5=e.SEAPORT_CONTRACT_VERSION_V1_4=e.SEAPORT_CONTRACT_NAME=void 0;const t=TH;var r,n,i,a;e.SEAPORT_CONTRACT_NAME="Seaport",e.SEAPORT_CONTRACT_VERSION_V1_4="1.4",e.SEAPORT_CONTRACT_VERSION_V1_5="1.5",e.OPENSEA_CONDUIT_KEY="0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000",e.OPENSEA_CONDUIT_ADDRESS="0x1e0049783f008a0085193e00003d00cd54003c71",e.EIP_712_ORDER_TYPE={OrderComponents:[{name:"offerer",type:"address"},{name:"zone",type:"address"},{name:"offer",type:"OfferItem[]"},{name:"consideration",type:"ConsiderationItem[]"},{name:"orderType",type:"uint8"},{name:"startTime",type:"uint256"},{name:"endTime",type:"uint256"},{name:"zoneHash",type:"bytes32"},{name:"salt",type:"uint256"},{name:"conduitKey",type:"bytes32"},{name:"counter",type:"uint256"}],OfferItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"}],ConsiderationItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"},{name:"recipient",type:"address"}]},e.EIP_712_BULK_ORDER_TYPE={BulkOrder:[{name:"tree",type:"OrderComponents[2][2][2][2][2][2][2]"}],OrderComponents:[{name:"offerer",type:"address"},{name:"zone",type:"address"},{name:"offer",type:"OfferItem[]"},{name:"consideration",type:"ConsiderationItem[]"},{name:"orderType",type:"uint8"},{name:"startTime",type:"uint256"},{name:"endTime",type:"uint256"},{name:"zoneHash",type:"bytes32"},{name:"salt",type:"uint256"},{name:"conduitKey",type:"bytes32"},{name:"counter",type:"uint256"}],OfferItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"}],ConsiderationItem:[{name:"itemType",type:"uint8"},{name:"token",type:"address"},{name:"identifierOrCriteria",type:"uint256"},{name:"startAmount",type:"uint256"},{name:"endAmount",type:"uint256"},{name:"recipient",type:"address"}]},function(e){e[e.FULL_OPEN=0]="FULL_OPEN",e[e.PARTIAL_OPEN=1]="PARTIAL_OPEN",e[e.FULL_RESTRICTED=2]="FULL_RESTRICTED",e[e.PARTIAL_RESTRICTED=3]="PARTIAL_RESTRICTED"}(r||(e.OrderType=r={})),function(e){e[e.NATIVE=0]="NATIVE",e[e.ERC20=1]="ERC20",e[e.ERC721=2]="ERC721",e[e.ERC1155=3]="ERC1155",e[e.ERC721_WITH_CRITERIA=4]="ERC721_WITH_CRITERIA",e[e.ERC1155_WITH_CRITERIA=5]="ERC1155_WITH_CRITERIA"}(n||(e.ItemType=n={})),function(e){e[e.OFFER=0]="OFFER",e[e.CONSIDERATION=1]="CONSIDERATION"}(i||(e.Side=i={})),function(e){e[e.ETH_TO_ERC721=0]="ETH_TO_ERC721",e[e.ETH_TO_ERC1155=1]="ETH_TO_ERC1155",e[e.ERC20_TO_ERC721=2]="ERC20_TO_ERC721",e[e.ERC20_TO_ERC1155=3]="ERC20_TO_ERC1155",e[e.ERC721_TO_ERC20=4]="ERC721_TO_ERC20",e[e.ERC1155_TO_ERC20=5]="ERC1155_TO_ERC20"}(a||(e.BasicOrderRouteType=a={})),e.MAX_INT=t.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e.ONE_HUNDRED_PERCENT_BP=1e4,e.NO_CONDUIT="0x0000000000000000000000000000000000000000000000000000000000000000",e.KNOWN_CONDUIT_KEYS_TO_CONDUIT={[e.OPENSEA_CONDUIT_KEY]:e.OPENSEA_CONDUIT_ADDRESS},e.CROSS_CHAIN_SEAPORT_V1_4_ADDRESS="0x00000000000001ad428e4906aE43D8F9852d0dD6",e.CROSS_CHAIN_SEAPORT_V1_5_ADDRESS="0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC",e.DOMAIN_REGISTRY_ADDRESS="0x000000000DaD0DE04D2B2D4a5A74581EBA94124A"}(XH);var $H={},JH={};Object.defineProperty(JH,"__esModule",{value:!0}),JH.ERC20ABI=void 0;JH.ERC20ABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];var YH={};Object.defineProperty(YH,"__esModule",{value:!0}),YH.ERC721ABI=void 0;YH.ERC721ABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"pure",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}];var QH,ZH={},eV={};function tV(){if(QH)return eV;QH=1,Object.defineProperty(eV,"__esModule",{value:!0}),eV.getItemToCriteriaMap=eV.generateCriteriaResolvers=void 0;const e=XH,t=iV();eV.generateCriteriaResolvers=({orders:r,offerCriterias:n=[[]],considerationCriterias:i=[[]]})=>{const a=r.flatMap(((r,n)=>r.parameters.offer.map(((t,r)=>({orderIndex:n,item:t,index:r,side:e.Side.OFFER}))).filter((({item:e})=>(0,t.isCriteriaItem)(e.itemType))))),o=r.flatMap(((r,n)=>r.parameters.consideration.map(((t,r)=>({orderIndex:n,item:t,index:r,side:e.Side.CONSIDERATION}))).filter((({item:e})=>(0,t.isCriteriaItem)(e.itemType))))),s=(e,t)=>e.map((({orderIndex:e,item:r,index:n,side:i})=>{const a=r.identifierOrCriteria||"0",o=t[e][n];return{orderIndex:e,index:n,side:i,identifier:o.identifier,criteriaProof:"0"===a?[]:o.proof}}));return[...s(a,n),...s(o,i)]};return eV.getItemToCriteriaMap=(e,r)=>{const n=[...r];return e.reduce(((e,r)=>((0,t.isCriteriaItem)(r.itemType)&&e.set(r,n.shift()),e)),new Map)},eV}var rV,nV={};function iV(){return rV||(rV=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMaximumSizeForOrder=e.getSummedTokenAndIdentifierAmounts=e.getPresentItemAmount=e.isCriteriaItem=e.isErc1155Item=e.isErc721Item=e.isErc20Item=e.isNativeCurrencyItem=e.isCurrencyItem=void 0;const t=TH,r=XH,n=tV(),i=nV;e.isCurrencyItem=({itemType:e})=>[r.ItemType.NATIVE,r.ItemType.ERC20].includes(e);e.isNativeCurrencyItem=({itemType:e})=>e===r.ItemType.NATIVE;e.isErc20Item=e=>e===r.ItemType.ERC20;e.isErc721Item=e=>[r.ItemType.ERC721,r.ItemType.ERC721_WITH_CRITERIA].includes(e);e.isErc1155Item=e=>[r.ItemType.ERC1155,r.ItemType.ERC1155_WITH_CRITERIA].includes(e);e.isCriteriaItem=e=>[r.ItemType.ERC721_WITH_CRITERIA,r.ItemType.ERC1155_WITH_CRITERIA].includes(e);e.getPresentItemAmount=({startAmount:e,endAmount:r,timeBasedItemParams:n})=>{const i=t.BigNumber.from(e),a=t.BigNumber.from(r);if(!n)return i.gt(a)?i:a;const{isConsiderationItem:o,currentBlockTimestamp:s,ascendingAmountTimestampBuffer:f,startTime:u,endTime:c}=n,d=t.BigNumber.from(c).sub(u),l=a.gt(e),p=t.BigNumber.from(l?s+f:s);if(p.lt(u))return i;const h=(p.gt(c)?t.BigNumber.from(c):p).sub(u),m=d.sub(h);return i.mul(m).add(a.mul(h)).add(o?d.sub(1):0).div(d)};e.getSummedTokenAndIdentifierAmounts=({items:r,criterias:i,timeBasedItemParams:a})=>{const o=(0,n.getItemToCriteriaMap)(r,i),s=r.reduce(((r,n)=>{var i,s,f,u;const c=null!==(s=null===(i=o.get(n))||void 0===i?void 0:i.identifier)&&void 0!==s?s:n.identifierOrCriteria;return Object.assign(Object.assign({},r),{[n.token]:Object.assign(Object.assign({},r[n.token]),{[c]:(null!==(u=null===(f=r[n.token])||void 0===f?void 0:f[c])&&void 0!==u?u:t.BigNumber.from(0)).add((0,e.getPresentItemAmount)({startAmount:n.startAmount,endAmount:n.endAmount,timeBasedItemParams:a}))})})}),{});return s};e.getMaximumSizeForOrder=({parameters:{offer:e,consideration:t}})=>{const r=[...e,...t].flatMap((({startAmount:e,endAmount:t})=>[e,t]));return(0,i.findGcd)(r)}}(ZH)),ZH}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.findGcd=e.gcd=void 0;const t=TH;e.gcd=(r,n)=>{const i=t.BigNumber.from(r),a=t.BigNumber.from(n);return i.eq(0)?a:(0,e.gcd)(a.mod(r),i)};e.findGcd=r=>{let n=t.BigNumber.from(r[0]);for(let t=1;t<r.length;t++)if(n=(0,e.gcd)(r[t],n),n.eq(1))return n;return n}}(nV);var aV={};!function(e){var t=on&&on.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{f(n.next(e))}catch(e){a(e)}}function s(e){try{f(n.throw(e))}catch(e){a(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}f((n=n.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getTagFromDomain=e.getTransactionMethods=e.executeAllActions=void 0;const r=AH;e.executeAllActions=e=>t(void 0,void 0,void 0,(function*(){for(let t=0;t<e.length-1;t++){const r=e[t];if("approval"===r.type){const e=yield r.transactionMethods.transact();yield e.wait()}}const t=e[e.length-1];switch(t.type){case"create":return t.createOrder();case"createBulk":return t.createBulkOrders();default:return t.transactionMethods.transact()}}));e.getTransactionMethods=(r,n,i,a)=>{const o=i[i.length-1];let s;(e=>{const t=["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","type","accessList","customData","ccipReadEnabled","value","blockTag","CallOverrides"];return void 0===e||Object.keys(e).every((e=>t.includes(e)))})(o)&&(s=o,i.pop());const f=o=>t(void 0,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},s),o),f=yield r.populateTransaction[n](...i,t);if(a){const t=(0,e.getTagFromDomain)(a);f.data=f.data+t}return f}));return{callStatic:e=>{const t=Object.assign(Object.assign({},s),e);return r.callStatic[n](...i,t)},estimateGas:e=>{const t=Object.assign(Object.assign({},s),e);return r.estimateGas[n](...i,t)},transact:e=>t(void 0,void 0,void 0,(function*(){const t=Object.assign(Object.assign({},s),e),n=yield f(t);return r.signer.sendTransaction(n)})),buildTransaction:f}};e.getTagFromDomain=e=>(0,r.keccak256)((0,r.toUtf8Bytes)(e)).slice(2,10)}(aV);var oV=on&&on.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{f(n.next(e))}catch(e){a(e)}}function s(e){try{f(n.throw(e))}catch(e){a(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}f((n=n.apply(e,t||[])).next())}))};Object.defineProperty($H,"__esModule",{value:!0}),$H.getApprovalActions=$H.approvedItemAmount=void 0;const sV=TH,fV=JH,uV=YH,cV=XH,dV=iV(),lV=aV;$H.approvedItemAmount=(e,t,r,n)=>oV(void 0,void 0,void 0,(function*(){if((0,dV.isErc721Item)(t.itemType)||(0,dV.isErc1155Item)(t.itemType)){return new sV.Contract(t.token,uV.ERC721ABI,n).isApprovedForAll(e,r).then((e=>e?cV.MAX_INT:sV.BigNumber.from(0)))}if(t.itemType===cV.ItemType.ERC20){return new sV.Contract(t.token,fV.ERC20ABI,n).allowance(e,r)}return cV.MAX_INT})),$H.getApprovalActions=function(e,t,r){return e.filter(((t,r)=>r===e.length-1||e[r+1].token!==t.token)).map((({token:e,operator:n,itemType:i,identifierOrCriteria:a,requiredApprovedAmount:o})=>{const s=(0,dV.isErc1155Item)(i);if((0,dV.isErc721Item)(i)||s){const o=new sV.Contract(e,uV.ERC721ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,operator:n,transactionMethods:(0,lV.getTransactionMethods)(o.connect(r),t&&!s?"approve":"setApprovalForAll",[n,!(t&&!s)||a])}}{const s=new sV.Contract(e,fV.ERC20ABI,r);return{type:"approval",token:e,identifierOrCriteria:a,itemType:i,transactionMethods:(0,lV.getTransactionMethods)(s.connect(r),"approve",[n,t?o:cV.MAX_INT]),operator:n}}}))};var pV={},hV={},mV={};Object.defineProperty(mV,"__esModule",{value:!0}),mV.ERC1155ABI=void 0;mV.ERC1155ABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256[]",name:"ids",type:"uint256[]"},{indexed:!1,internalType:"uint256[]",name:"amounts",type:"uint256[]"}],name:"TransferBatch",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"TransferSingle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"value",type:"string"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"URI",type:"event"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"owners",type:"address[]"},{internalType:"uint256[]",name:"ids",type:"uint256[]"}],name:"balanceOfBatch",outputs:[{internalType:"uint256[]",name:"balances",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"ids",type:"uint256[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];var bV=on&&on.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{f(n.next(e))}catch(e){a(e)}}function s(e){try{f(n.throw(e))}catch(e){a(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}f((n=n.apply(e,t||[])).next())}))};Object.defineProperty(hV,"__esModule",{value:!0}),hV.balanceOf=void 0;const yV=TH,gV=mV,vV=JH,wV=YH,_V=XH,EV=iV();hV.balanceOf=(e,t,r,n)=>bV(void 0,void 0,void 0,(function*(){if((0,EV.isErc721Item)(t.itemType)){const i=new yV.Contract(t.token,wV.ERC721ABI,r);return t.itemType===_V.ItemType.ERC721_WITH_CRITERIA?n?i.ownerOf(n.identifier).then((t=>yV.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase())))):i.balanceOf(e):i.ownerOf(t.identifierOrCriteria).then((t=>yV.BigNumber.from(Number(t.toLowerCase()===e.toLowerCase()))))}if((0,EV.isErc1155Item)(t.itemType)){const i=new yV.Contract(t.token,gV.ERC1155ABI,r);if(t.itemType===_V.ItemType.ERC1155_WITH_CRITERIA){if(!n){const e=yV.BigNumber.from(t.startAmount),r=yV.BigNumber.from(t.endAmount);return e.gt(r)?e:r}return i.balanceOf(e,n.identifier)}return i.balanceOf(e,t.identifierOrCriteria)}if((0,EV.isErc20Item)(t.itemType)){return new yV.Contract(t.token,vV.ERC20ABI,r).balanceOf(e)}return r.getBalance(e)})),function(e){var t=on&&on.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{f(n.next(e))}catch(e){a(e)}}function s(e){try{f(n.throw(e))}catch(e){a(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}f((n=n.apply(e,t||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.validateStandardFulfillBalancesAndApprovals=e.validateBasicFulfillBalancesAndApprovals=e.validateOfferBalancesAndApprovals=e.getInsufficientBalanceAndApprovalAmounts=e.getBalancesAndApprovals=void 0;const r=TH,n=XH,i=$H,a=hV,o=tV(),s=iV(),f=(e,t,r)=>{const n=e.find((({token:e,identifierOrCriteria:n})=>t.toLowerCase()===e.toLowerCase()&&n.toLowerCase()===r.toLowerCase()));if(!n)throw new Error("Balances and approvals didn't contain all tokens and identifiers");return n};e.getBalancesAndApprovals=({owner:e,items:f,criterias:u,operator:c,multicallProvider:d})=>t(void 0,void 0,void 0,(function*(){const l=(0,o.getItemToCriteriaMap)(f,u);return Promise.all(f.map((o=>t(void 0,void 0,void 0,(function*(){var t,f;let u=Promise.resolve(r.BigNumber.from(0));return u=(0,s.isErc721Item)(o.itemType)||(0,s.isErc1155Item)(o.itemType)||(0,s.isErc20Item)(o.itemType)?(0,i.approvedItemAmount)(e,o,c,d):Promise.resolve(n.MAX_INT),{token:o.token,identifierOrCriteria:null!==(f=null===(t=l.get(o))||void 0===t?void 0:t.identifier)&&void 0!==f?f:o.identifierOrCriteria,balance:yield(0,a.balanceOf)(e,o,d,l.get(o)),approvedAmount:yield u,itemType:o.itemType}})))))}));e.getInsufficientBalanceAndApprovalAmounts=({balancesAndApprovals:e,tokenAndIdentifierAmounts:t,operator:r})=>{const n=[...Object.entries(t).map((([e,t])=>Object.entries(t).map((([t,r])=>[e,t,r]))))].flat(),i=t=>n.filter((([r,n,i])=>f(e,r,n)[t].lt(i))).map((([r,n,i])=>{const a=f(e,r,n);return{token:r,identifierOrCriteria:n,requiredAmount:i,amountHave:a[t],itemType:a.itemType}})),[a,o]=[i("balance"),i("approvedAmount").map((e=>({token:e.token,identifierOrCriteria:e.identifierOrCriteria,approvedAmount:e.amountHave,requiredApprovedAmount:e.requiredAmount,itemType:e.itemType,operator:r})))];return{insufficientBalances:a,insufficientApprovals:o}};e.validateOfferBalancesAndApprovals=({offer:t,criterias:r,balancesAndApprovals:n,timeBasedItemParams:i,throwOnInsufficientBalances:a=!0,throwOnInsufficientApprovals:o,operator:f})=>{const{insufficientBalances:u,insufficientApprovals:c}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:n,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:t,criterias:r,timeBasedItemParams:i?Object.assign(Object.assign({},i),{isConsiderationItem:!1}):void 0}),operator:f});if(a&&u.length>0)throw new Error("The offerer does not have the amount needed to create or fulfill.");if(o&&c.length>0)throw new Error("The offerer does not have the sufficient approvals.");return c};e.validateBasicFulfillBalancesAndApprovals=({offer:t,consideration:r,offererBalancesAndApprovals:n,fulfillerBalancesAndApprovals:i,timeBasedItemParams:a,offererOperator:o,fulfillerOperator:f})=>{(0,e.validateOfferBalancesAndApprovals)({offer:t,criterias:[],balancesAndApprovals:n,timeBasedItemParams:a,throwOnInsufficientApprovals:!0,operator:o});const u=r.filter((e=>e.itemType!==t[0].itemType)),{insufficientBalances:c,insufficientApprovals:d}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:i,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:u,criterias:[],timeBasedItemParams:Object.assign(Object.assign({},a),{isConsiderationItem:!0})}),operator:f});if(c.length>0)throw new Error("The fulfiller does not have the balances needed to fulfill.");return d};e.validateStandardFulfillBalancesAndApprovals=({offer:t,consideration:r,offerCriteria:n,considerationCriteria:i,offererBalancesAndApprovals:a,fulfillerBalancesAndApprovals:o,timeBasedItemParams:f,offererOperator:c,fulfillerOperator:d})=>{(0,e.validateOfferBalancesAndApprovals)({offer:t,criterias:n,balancesAndApprovals:a,timeBasedItemParams:f,throwOnInsufficientApprovals:!0,operator:c});const l=u({items:t,criterias:n,balancesAndApprovals:o,timeBasedItemParams:f}),{insufficientBalances:p,insufficientApprovals:h}=(0,e.getInsufficientBalanceAndApprovalAmounts)({balancesAndApprovals:l,tokenAndIdentifierAmounts:(0,s.getSummedTokenAndIdentifierAmounts)({items:r,criterias:i,timeBasedItemParams:Object.assign(Object.assign({},f),{isConsiderationItem:!0})}),operator:d});if(p.length>0)throw new Error("The fulfiller does not have the balances needed to fulfill.");return h};const u=({items:e,criterias:t,timeBasedItemParams:r,balancesAndApprovals:n})=>{const i=(0,s.getSummedTokenAndIdentifierAmounts)({items:e,criterias:t,timeBasedItemParams:Object.assign(Object.assign({},r),{isConsiderationItem:!1})}),a=n.map((e=>Object.assign({},e)));return Object.entries(i).forEach((([e,t])=>Object.entries(t).forEach((([t,r])=>{const n=f(a,e,t),i=a.indexOf(n);a[i].balance=a[i].balance.add(r)})))),a}}(pV);var TV,AV={},SV={},kV={},OV={},RV={exports:{}},xV={exports:{}};function IV(){return TV||(TV=1,function(e,t){e.exports=function(){var e=e||function(e,t){var r=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),n={},i=n.lib={},a=i.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},o=i.WordArray=a.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||f).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var o=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=o<<24-(n+a)%4*8}else for(a=0;a<i;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],i=function(t){var r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},a=0;a<t;a+=4){var s=i(4294967296*(r||e.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new o.init(n,t)}}),s=n.enc={},f=s.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(r,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(r,t)}},c=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},d=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),f=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,u=e.min(4*f,i);if(f){for(var c=0;c<f;c+=a)this._doProcessBlock(n,c);var d=n.splice(0,f);r.sigBytes-=u}return new o.init(d,u)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=d.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new l.HMAC.init(e,r).finalize(t)}}});var l=n.algo={};return n}(Math);return e}()}(xV)),xV.exports}!function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=[],f=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(s[i]=r(t.pow(n,.5))),f[i]=r(t.pow(n,1/3)),i++),n++}();var u=[],c=o.SHA256=a.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],c=r[5],d=r[6],l=r[7],p=0;p<64;p++){if(p<16)u[p]=0|e[t+p];else{var h=u[p-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,b=u[p-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;u[p]=m+u[p-7]+y+u[p-16]}var g=n&i^n&a^i&a,v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=l+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&c^~s&d)+f[p]+u[p];l=d,d=c,c=s,s=o+w|0,o=a,a=i,i=n,n=w+(v+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0,r[5]=r[5]+c|0,r[6]=r[6]+d|0,r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=a._createHelper(c),r.HmacSHA256=a._createHmacHelper(c)}(Math),e.SHA256}(IV())}(RV);var CV=RV.exports,NV={exports:{}};!function(e,t){e.exports=function(){function e(e,t){var r=t?"└":"├";return r+=e?"─ ":"──┐"}function t(e,t){var r=[];for(var n in e)e.hasOwnProperty(n)&&(t&&"function"==typeof e[n]||r.push(n));return r}function r(n,i,a,o,s,f,u){var c,d,l="",p=0,h=o.slice(0);if(h.push([i,a])&&o.length>0&&(o.forEach((function(e,t){t>0&&(l+=(e[1]?" ":"│")+" "),d||e[0]!==i||(d=!0)})),l+=e(n,a)+n,s&&("object"!=typeof i||i instanceof Date)&&(l+=": "+i),d&&(l+=" (circular ref.)"),u(l)),!d&&"object"==typeof i){var m=t(i,f);m.forEach((function(e){c=++p===m.length,r(e,i[e],c,h,s,f,u)}))}}var n={asLines:function(e,t,n,i){r(".",e,!1,[],t,"function"!=typeof n&&n,i||n)},asTree:function(e,t,n){var i="";return r(".",e,!1,[],t,n,(function(e){i+=e+"\n"})),i}};return n}()}(NV);var PV,MV=NV.exports,BV={},DV={exports:{}},FV={exports:{}};function LV(){return PV||(PV=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.Base,a=n.WordArray,o=r.x64={};o.Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),o.WordArray=i.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var i=e[n];r.push(i.high),r.push(i.low)}return a.create(r,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}})}(),e}(IV())}(FV)),FV.exports}var UV,jV={exports:{}};function qV(){return UV||(UV=1,function(e,t){e.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init,n=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,n=[],i=0;i<t;i++)n[i>>>2]|=e[i]<<24-i%4*8;r.call(this,n,t)}else r.apply(this,arguments)};n.prototype=t}}(),e.lib.WordArray}(IV())}(jV)),jV.exports}var zV,HV={exports:{}};function VV(){return zV||(zV=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray,n=t.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var a=t[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>1]|=e.charCodeAt(i)<<16-i%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],a=0;a<r;a+=2){var o=i(t[a>>>2]>>>16-a%4*8&65535);n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,n=[],a=0;a<t;a++)n[a>>>1]|=i(e.charCodeAt(a)<<16-a%2*16);return r.create(n,2*t)}}}(),e.enc.Utf16}(IV())}(HV)),HV.exports}var GV,KV={exports:{}};function WV(){return GV||(GV=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var i=[],a=0,o=0;o<t;o++)if(o%4){var s=n[e.charCodeAt(o-1)]<<o%4*2,f=n[e.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=(s|f)<<24-a%4*8,a++}return r.create(i,a)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],a=0;a<r;a+=3)for(var o=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<r;s++)i.push(n.charAt(o>>>6*(3-s)&63));var f=n.charAt(64);if(f)for(;i.length%4;)i.push(f);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<r.length;a++)i[r.charCodeAt(a)]=a}var o=r.charAt(64);if(o){var s=e.indexOf(o);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(IV())}(KV)),KV.exports}var XV,$V={exports:{}};function JV(){return XV||(XV=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=[];!function(){for(var e=0;e<64;e++)s[e]=4294967296*t.abs(t.sin(e+1))|0}();var f=o.MD5=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a=this._hash.words,o=e[t+0],f=e[t+1],p=e[t+2],h=e[t+3],m=e[t+4],b=e[t+5],y=e[t+6],g=e[t+7],v=e[t+8],w=e[t+9],_=e[t+10],E=e[t+11],T=e[t+12],A=e[t+13],S=e[t+14],k=e[t+15],O=a[0],R=a[1],x=a[2],I=a[3];O=u(O,R,x,I,o,7,s[0]),I=u(I,O,R,x,f,12,s[1]),x=u(x,I,O,R,p,17,s[2]),R=u(R,x,I,O,h,22,s[3]),O=u(O,R,x,I,m,7,s[4]),I=u(I,O,R,x,b,12,s[5]),x=u(x,I,O,R,y,17,s[6]),R=u(R,x,I,O,g,22,s[7]),O=u(O,R,x,I,v,7,s[8]),I=u(I,O,R,x,w,12,s[9]),x=u(x,I,O,R,_,17,s[10]),R=u(R,x,I,O,E,22,s[11]),O=u(O,R,x,I,T,7,s[12]),I=u(I,O,R,x,A,12,s[13]),x=u(x,I,O,R,S,17,s[14]),O=c(O,R=u(R,x,I,O,k,22,s[15]),x,I,f,5,s[16]),I=c(I,O,R,x,y,9,s[17]),x=c(x,I,O,R,E,14,s[18]),R=c(R,x,I,O,o,20,s[19]),O=c(O,R,x,I,b,5,s[20]),I=c(I,O,R,x,_,9,s[21]),x=c(x,I,O,R,k,14,s[22]),R=c(R,x,I,O,m,20,s[23]),O=c(O,R,x,I,w,5,s[24]),I=c(I,O,R,x,S,9,s[25]),x=c(x,I,O,R,h,14,s[26]),R=c(R,x,I,O,v,20,s[27]),O=c(O,R,x,I,A,5,s[28]),I=c(I,O,R,x,p,9,s[29]),x=c(x,I,O,R,g,14,s[30]),O=d(O,R=c(R,x,I,O,T,20,s[31]),x,I,b,4,s[32]),I=d(I,O,R,x,v,11,s[33]),x=d(x,I,O,R,E,16,s[34]),R=d(R,x,I,O,S,23,s[35]),O=d(O,R,x,I,f,4,s[36]),I=d(I,O,R,x,m,11,s[37]),x=d(x,I,O,R,g,16,s[38]),R=d(R,x,I,O,_,23,s[39]),O=d(O,R,x,I,A,4,s[40]),I=d(I,O,R,x,o,11,s[41]),x=d(x,I,O,R,h,16,s[42]),R=d(R,x,I,O,y,23,s[43]),O=d(O,R,x,I,w,4,s[44]),I=d(I,O,R,x,T,11,s[45]),x=d(x,I,O,R,k,16,s[46]),O=l(O,R=d(R,x,I,O,p,23,s[47]),x,I,o,6,s[48]),I=l(I,O,R,x,g,10,s[49]),x=l(x,I,O,R,S,15,s[50]),R=l(R,x,I,O,b,21,s[51]),O=l(O,R,x,I,T,6,s[52]),I=l(I,O,R,x,h,10,s[53]),x=l(x,I,O,R,_,15,s[54]),R=l(R,x,I,O,f,21,s[55]),O=l(O,R,x,I,v,6,s[56]),I=l(I,O,R,x,k,10,s[57]),x=l(x,I,O,R,y,15,s[58]),R=l(R,x,I,O,A,21,s[59]),O=l(O,R,x,I,m,6,s[60]),I=l(I,O,R,x,E,10,s[61]),x=l(x,I,O,R,p,15,s[62]),R=l(R,x,I,O,w,21,s[63]),a[0]=a[0]+O|0,a[1]=a[1]+R|0,a[2]=a[2]+x|0,a[3]=a[3]+I|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var a=t.floor(n/4294967296),o=n;r[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),r[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),e.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,f=s.words,u=0;u<4;u++){var c=f[u];f[u]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return s},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,i,a,o){var s=e+(t&r|~t&n)+i+o;return(s<<a|s>>>32-a)+t}function c(e,t,r,n,i,a,o){var s=e+(t&n|r&~n)+i+o;return(s<<a|s>>>32-a)+t}function d(e,t,r,n,i,a,o){var s=e+(t^r^n)+i+o;return(s<<a|s>>>32-a)+t}function l(e,t,r,n,i,a,o){var s=e+(r^(t|~n))+i+o;return(s<<a|s>>>32-a)+t}r.MD5=a._createHelper(f),r.HmacMD5=a._createHmacHelper(f)}(Math),e.MD5}(IV())}($V)),$V.exports}var YV,QV={exports:{}};function ZV(){return YV||(YV=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.WordArray,i=r.Hasher,a=t.algo,o=[],s=a.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],s=r[3],f=r[4],u=0;u<80;u++){if(u<16)o[u]=0|e[t+u];else{var c=o[u-3]^o[u-8]^o[u-14]^o[u-16];o[u]=c<<1|c>>>31}var d=(n<<5|n>>>27)+f+o[u];d+=u<20?1518500249+(i&a|~i&s):u<40?1859775393+(i^a^s):u<60?(i&a|i&s|a&s)-1894007588:(i^a^s)-899497514,f=s,s=a,a=i<<30|i>>>2,i=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+s|0,r[4]=r[4]+f|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA1=i._createHelper(s),t.HmacSHA1=i._createHmacHelper(s)}(),e.SHA1}(IV())}(QV)),QV.exports}var eG,tG={exports:{}};var rG,nG={exports:{}};function iG(){return rG||(rG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.Hasher,n=t.x64,i=n.Word,a=n.WordArray,o=t.algo;function s(){return i.create.apply(i,arguments)}var f=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=s()}();var c=o.SHA512=r.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],c=r[5],d=r[6],l=r[7],p=n.high,h=n.low,m=i.high,b=i.low,y=a.high,g=a.low,v=o.high,w=o.low,_=s.high,E=s.low,T=c.high,A=c.low,S=d.high,k=d.low,O=l.high,R=l.low,x=p,I=h,C=m,N=b,P=y,M=g,B=v,D=w,F=_,L=E,U=T,j=A,q=S,z=k,H=O,V=R,G=0;G<80;G++){var K=u[G];if(G<16)var W=K.high=0|e[t+2*G],X=K.low=0|e[t+2*G+1];else{var $=u[G-15],J=$.high,Y=$.low,Q=(J>>>1|Y<<31)^(J>>>8|Y<<24)^J>>>7,Z=(Y>>>1|J<<31)^(Y>>>8|J<<24)^(Y>>>7|J<<25),ee=u[G-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ae=u[G-7],oe=ae.high,se=ae.low,fe=u[G-16],ue=fe.high,ce=fe.low;W=(W=(W=Q+oe+((X=Z+se)>>>0<Z>>>0?1:0))+ne+((X+=ie)>>>0<ie>>>0?1:0))+ue+((X+=ce)>>>0<ce>>>0?1:0),K.high=W,K.low=X}var de,le=F&U^~F&q,pe=L&j^~L&z,he=x&C^x&P^C&P,me=I&N^I&M^N&M,be=(x>>>28|I<<4)^(x<<30|I>>>2)^(x<<25|I>>>7),ye=(I>>>28|x<<4)^(I<<30|x>>>2)^(I<<25|x>>>7),ge=(F>>>14|L<<18)^(F>>>18|L<<14)^(F<<23|L>>>9),ve=(L>>>14|F<<18)^(L>>>18|F<<14)^(L<<23|F>>>9),we=f[G],_e=we.high,Ee=we.low,Te=H+ge+((de=V+ve)>>>0<V>>>0?1:0),Ae=ye+me;H=q,V=z,q=U,z=j,U=F,j=L,F=B+(Te=(Te=(Te=Te+le+((de+=pe)>>>0<pe>>>0?1:0))+_e+((de+=Ee)>>>0<Ee>>>0?1:0))+W+((de+=X)>>>0<X>>>0?1:0))+((L=D+de|0)>>>0<D>>>0?1:0)|0,B=P,D=M,P=C,M=N,C=x,N=I,x=Te+(be+he+(Ae>>>0<ye>>>0?1:0))+((I=de+Ae|0)>>>0<de>>>0?1:0)|0}h=n.low=h+I,n.high=p+x+(h>>>0<I>>>0?1:0),b=i.low=b+N,i.high=m+C+(b>>>0<N>>>0?1:0),g=a.low=g+M,a.high=y+P+(g>>>0<M>>>0?1:0),w=o.low=w+D,o.high=v+B+(w>>>0<D>>>0?1:0),E=s.low=E+L,s.high=_+F+(E>>>0<L>>>0?1:0),A=c.low=A+j,c.high=T+U+(A>>>0<j>>>0?1:0),k=d.low=k+z,d.high=S+q+(k>>>0<z>>>0?1:0),R=l.low=R+V,l.high=O+H+(R>>>0<V>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(c),t.HmacSHA512=r._createHmacHelper(c)}(),e.SHA512}(IV(),LV())}(nG)),nG.exports}var aG,oG={exports:{}};var sG,fG={exports:{}};function uG(){return sG||(sG=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.x64.Word,s=r.algo,f=[],u=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){f[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,a=0;a<24;a++){for(var s=0,d=0,l=0;l<7;l++){if(1&i){var p=(1<<l)-1;p<32?d^=1<<p:s^=1<<p-32}128&i?i=i<<1^113:i<<=1}c[a]=o.create(s,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=o.create()}();var l=s.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new o.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,i=0;i<n;i++){var a=e[t+2*i],o=e[t+2*i+1];a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(R=r[i]).high^=o,R.low^=a}for(var s=0;s<24;s++){for(var l=0;l<5;l++){for(var p=0,h=0,m=0;m<5;m++)p^=(R=r[l+5*m]).high,h^=R.low;var b=d[l];b.high=p,b.low=h}for(l=0;l<5;l++){var y=d[(l+4)%5],g=d[(l+1)%5],v=g.high,w=g.low;for(p=y.high^(v<<1|w>>>31),h=y.low^(w<<1|v>>>31),m=0;m<5;m++)(R=r[l+5*m]).high^=p,R.low^=h}for(var _=1;_<25;_++){var E=(R=r[_]).high,T=R.low,A=f[_];A<32?(p=E<<A|T>>>32-A,h=T<<A|E>>>32-A):(p=T<<A-32|E>>>64-A,h=E<<A-32|T>>>64-A);var S=d[u[_]];S.high=p,S.low=h}var k=d[0],O=r[0];for(k.high=O.high,k.low=O.low,l=0;l<5;l++)for(m=0;m<5;m++){var R=r[_=l+5*m],x=d[_],I=d[(l+1)%5+5*m],C=d[(l+2)%5+5*m];R.high=x.high^~I.high&C.high,R.low=x.low^~I.low&C.low}R=r[0];var N=c[s];R.high^=N.high,R.low^=N.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var n=8*e.sigBytes,a=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/a)*a>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var o=this._state,s=this.cfg.outputLength/8,f=s/8,u=[],c=0;c<f;c++){var d=o[c],l=d.high,p=d.low;l=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),u.push(p),u.push(l)}return new i.init(u,s)},clone:function(){for(var e=a.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=a._createHelper(l),r.HmacSHA3=a._createHmacHelper(l)}(Math),e.SHA3}(IV(),LV())}(fG)),fG.exports}var cG,dG={exports:{}};var lG,pG={exports:{}};function hG(){return lG||(lG=1,function(e,t){e.exports=function(e){!function(){var t=e,r=t.lib.Base,n=t.enc.Utf8;t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),o=this._iKey=t.clone(),s=a.words,f=o.words,u=0;u<r;u++)s[u]^=1549556828,f[u]^=909522486;a.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}()}(IV())}(pG)),pG.exports}var mG,bG={exports:{}};var yG,gG={exports:{}};function vG(){return yG||(yG=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.Base,i=r.WordArray,a=t.algo,o=a.MD5,s=a.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:o,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=r.hasher.create(),a=i.create(),o=a.words,s=r.keySize,f=r.iterations;o.length<s;){u&&n.update(u);var u=n.update(e).finalize(t);n.reset();for(var c=1;c<f;c++)u=n.finalize(u),n.reset();a.concat(u)}return a.sigBytes=4*s,a}});t.EvpKDF=function(e,t,r){return s.create(r).compute(e,t)}}(),e.EvpKDF}(IV(),ZV(),hG())}(gG)),gG.exports}var wG,_G={exports:{}};function EG(){return wG||(wG=1,function(e,t){e.exports=function(e){e.lib.Cipher||function(t){var r=e,n=r.lib,i=n.Base,a=n.WordArray,o=n.BufferedBlockAlgorithm,s=r.enc;s.Utf8;var f=s.Base64,u=r.algo.EvpKDF,c=n.Cipher=o.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?v:y}return function(t){return{encrypt:function(r,n,i){return e(n).encrypt(t,r,n,i)},decrypt:function(r,n,i){return e(n).decrypt(t,r,n,i)}}}}()});n.StreamCipher=c.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=r.mode={},l=n.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=d.CBC=function(){var e=l.extend();function r(e,r,n){var i=this._iv;if(i){var a=i;this._iv=t}else a=this._prevBlock;for(var o=0;o<n;o++)e[r+o]^=a[o]}return e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),e.Decryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,a=e.slice(t,t+i);n.decryptBlock(e,t),r.call(this,e,t,i),this._prevBlock=a}}),e}(),h=(r.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,i=n<<24|n<<16|n<<8|n,o=[],s=0;s<n;s+=4)o.push(i);var f=a.create(o,n);e.concat(f)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};n.BlockCipher=c.extend({cfg:c.cfg.extend({mode:p,padding:h}),reset:function(){c.reset.call(this);var e=this.cfg,t=e.iv,r=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=r.createEncryptor;else n=r.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==n?this._mode.init(this,t&&t.words):(this._mode=n.call(r,this,t&&t.words),this._mode.__creator=n)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var m=n.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),b=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;if(r)var n=a.create([1398893684,1701076831]).concat(r).concat(t);else n=t;return n.toString(f)},parse:function(e){var t=f.parse(e),r=t.words;if(1398893684==r[0]&&1701076831==r[1]){var n=a.create(r.slice(2,4));r.splice(0,4),t.sigBytes-=16}return m.create({ciphertext:t,salt:n})}},y=n.SerializableCipher=i.extend({cfg:i.extend({format:b}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),a=i.finalize(t),o=i.cfg;return m.create({ciphertext:a,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),g=(r.kdf={}).OpenSSL={execute:function(e,t,r,n){n||(n=a.random(8));var i=u.create({keySize:t+r}).compute(e,n),o=a.create(i.words.slice(t),4*r);return i.sigBytes=4*t,m.create({key:i,iv:o,salt:n})}},v=n.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:g}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=i.iv;var a=y.encrypt.call(this,e,t,i.key,n);return a.mixIn(i),a},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv=i.iv,y.decrypt.call(this,e,t,i.key,n)}})}()}(IV(),vG())}(_G)),_G.exports}var TG,AG={exports:{}};function SG(){return TG||(TG=1,function(e,t){e.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,n){var i=this._iv;if(i){var a=i.slice(0);this._iv=void 0}else a=this._prevBlock;n.encryptBlock(a,0);for(var o=0;o<r;o++)e[t+o]^=a[o]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i,n),this._prevBlock=e.slice(t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,a=e.slice(t,t+i);r.call(this,e,t,i,n),this._prevBlock=a}}),t}(),e.mode.CFB}(IV(),EG())}(AG)),AG.exports}var kG,OG={exports:{}};function RG(){return kG||(kG=1,function(e,t){e.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);r.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)e[t+s]^=o[s]}}),t.Decryptor=r,t),e.mode.CTR;var t,r}(IV(),EG())}(OG)),OG.exports}var xG,IG={exports:{}};function CG(){return xG||(xG=1,function(e,t){e.exports=function(e){
32
32
  /** @preserve
33
33
  * Counter block mode compatible with Dr Brian Gladman fileenc.c
34
34
  * derived from CryptoJS.mode.CTR
@@ -81,5 +81,5 @@ return function(t){var r=e,n=r.lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=i.create(
81
81
  *
82
82
  * This source code is licensed under the MIT license found in the
83
83
  * LICENSE file in the root directory of this source tree.
84
- */"production"===process.env.NODE_ENV?b3.exports=function(){if(E3)return y3;E3=1;var e=T3,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function o(e,r,o){var s,f={},u=null,c=null;for(s in void 0!==o&&(u=""+o),void 0!==r.key&&(u=""+r.key),void 0!==r.ref&&(c=r.ref),r)n.call(r,s)&&!a.hasOwnProperty(s)&&(f[s]=r[s]);if(e&&e.defaultProps)for(s in r=e.defaultProps)void 0===f[s]&&(f[s]=r[s]);return{$$typeof:t,type:e,key:u,ref:c,props:f,_owner:i.current}}return y3.Fragment=r,y3.jsx=o,y3.jsxs=o,y3}():b3.exports=(A3||(A3=1,"production"!==process.env.NODE_ENV&&function(){var e=T3,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator",b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];!function(e,t,r){var n=b.ReactDebugCurrentFrame.getStackAddendum();""!==n&&(t+="%s",r=r.concat([n]));var i=r.map((function(e){return String(e)}));i.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,i)}("error",e,r)}var g,v=!1,w=!1,_=!1,E=!1,T=!1;function A(e){return e.displayName||"Context"}function S(e){if(null==e)return null;if("number"==typeof e.tag&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case n:return"Fragment";case r:return"Portal";case a:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case s:return A(e)+".Consumer";case o:return A(e._context)+".Provider";case f:return function(e,t,r){var n=e.displayName;if(n)return n;var i=t.displayName||t.name||"";return""!==i?r+"("+i+")":r}(e,e.render,"ForwardRef");case d:var t=e.displayName||null;return null!==t?t:S(e.type)||"Memo";case l:var p=e,h=p._payload,m=p._init;try{return S(m(h))}catch(e){return null}}return null}g=Symbol.for("react.module.reference");var k,O,R,x,I,C,N,P=Object.assign,M=0;function B(){}B.__reactDisabledLog=!0;var D,F=b.ReactCurrentDispatcher;function L(e,t,r){if(void 0===D)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);D=n&&n[1]||""}return"\n"+D+e}var U,j=!1,q="function"==typeof WeakMap?WeakMap:Map;function z(e,t){if(!e||j)return"";var r,n=U.get(e);if(void 0!==n)return n;j=!0;var i,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,i=F.current,F.current=null,function(){if(0===M){k=console.log,O=console.info,R=console.warn,x=console.error,I=console.group,C=console.groupCollapsed,N=console.groupEnd;var e={configurable:!0,enumerable:!0,value:B,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}M++}();try{if(t){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(o,[])}catch(e){r=e}Reflect.construct(e,[],o)}else{try{o.call()}catch(e){r=e}e.call(o.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),f=r.stack.split("\n"),u=s.length-1,c=f.length-1;u>=1&&c>=0&&s[u]!==f[c];)c--;for(;u>=1&&c>=0;u--,c--)if(s[u]!==f[c]){if(1!==u||1!==c)do{if(u--,--c<0||s[u]!==f[c]){var d="\n"+s[u].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),"function"==typeof e&&U.set(e,d),d}}while(u>=1&&c>=0);break}}}finally{j=!1,F.current=i,function(){if(0==--M){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},e,{value:k}),info:P({},e,{value:O}),warn:P({},e,{value:R}),error:P({},e,{value:x}),group:P({},e,{value:I}),groupCollapsed:P({},e,{value:C}),groupEnd:P({},e,{value:N})})}M<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var l=e?e.displayName||e.name:"",p=l?L(l):"";return"function"==typeof e&&U.set(e,p),p}function H(e,t,r){if(null==e)return"";if("function"==typeof e)return z(e,function(e){var t=e.prototype;return!(!t||!t.isReactComponent)}(e));if("string"==typeof e)return L(e);switch(e){case u:return L("Suspense");case c:return L("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case f:return function(e,t,r){return z(e,!1)}(e.render);case d:return H(e.type,t,r);case l:var n=e,i=n._payload,a=n._init;try{return H(a(i),t,r)}catch(e){}}return""}U=new q;var V=Object.prototype.hasOwnProperty,G={},K=b.ReactDebugCurrentFrame;function W(e){if(e){var t=e._owner,r=H(e.type,e._source,t?t.type:null);K.setExtraStackFrame(r)}else K.setExtraStackFrame(null)}var X=Array.isArray;function $(e){return X(e)}function J(e){return""+e}function Y(e){if(function(e){try{return J(e),!1}catch(e){return!0}}(e))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),J(e)}var Q,Z,ee,te=b.ReactCurrentOwner,re={key:!0,ref:!0,__self:!0,__source:!0};ee={};var ne=function(e,r,n,i,a,o,s){var f={$$typeof:t,type:e,key:r,ref:n,props:s,_owner:o,_store:{}};return Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(f,"_self",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.defineProperty(f,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f};function ie(e,t,r,n,i){var a,o={},s=null,f=null;for(a in void 0!==r&&(Y(r),s=""+r),function(e){if(V.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(Y(t.key),s=""+t.key),function(e){if(V.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(f=t.ref,function(e,t){if("string"==typeof e.ref&&te.current&&t&&te.current.stateNode!==t){var r=S(te.current.type);ee[r]||(y('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',S(te.current.type),e.ref),ee[r]=!0)}}(t,i)),t)V.call(t,a)&&!re.hasOwnProperty(a)&&(o[a]=t[a]);if(e&&e.defaultProps){var u=e.defaultProps;for(a in u)void 0===o[a]&&(o[a]=u[a])}if(s||f){var c="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,t){var r=function(){Q||(Q=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(o,c),f&&function(e,t){var r=function(){Z||(Z=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(o,c)}return ne(e,s,f,i,n,te.current,o)}var ae,oe=b.ReactCurrentOwner,se=b.ReactDebugCurrentFrame;function fe(e){if(e){var t=e._owner,r=H(e.type,e._source,t?t.type:null);se.setExtraStackFrame(r)}else se.setExtraStackFrame(null)}function ue(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}function ce(){if(oe.current){var e=S(oe.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}ae=!1;var de={};function le(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=ce();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!de[r]){de[r]=!0;var n="";e&&e._owner&&e._owner!==oe.current&&(n=" It was passed a child from "+S(e._owner.type)+"."),fe(e),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,n),fe(null)}}}function pe(e,t){if("object"==typeof e)if($(e))for(var r=0;r<e.length;r++){var n=e[r];ue(n)&&le(n,t)}else if(ue(e))e._store&&(e._store.validated=!0);else if(e){var i=function(e){if(null===e||"object"!=typeof e)return null;var t=h&&e[h]||e[m];return"function"==typeof t?t:null}(e);if("function"==typeof i&&i!==e.entries)for(var a,o=i.call(e);!(a=o.next()).done;)ue(a.value)&&le(a.value,t)}}function he(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==f&&r.$$typeof!==d)return;t=r.propTypes}if(t){var n=S(r);!function(e,t,r,n,i){var a=Function.call.bind(V);for(var o in e)if(a(e,o)){var s=void 0;try{if("function"!=typeof e[o]){var f=Error((n||"React class")+": "+r+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}s=e[o](t,o,n,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(W(i),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",r,o,typeof s),W(null)),s instanceof Error&&!(s.message in G)&&(G[s.message]=!0,W(i),y("Failed %s type: %s",r,s.message),W(null))}}(t,e.props,"prop",n,e)}else void 0===r.PropTypes||ae||(ae=!0,y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",S(r)||"Unknown"));"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function me(e,r,h,m,b,A){var k=function(e){return"string"==typeof e||"function"==typeof e||!!(e===n||e===a||T||e===i||e===u||e===c||E||e===p||v||w||_)||"object"==typeof e&&null!==e&&(e.$$typeof===l||e.$$typeof===d||e.$$typeof===o||e.$$typeof===s||e.$$typeof===f||e.$$typeof===g||void 0!==e.getModuleId)}(e);if(!k){var O="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(O+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var R,x=function(e){return void 0!==e?"\n\nCheck your code at "+e.fileName.replace(/^.*[\\\/]/,"")+":"+e.lineNumber+".":""}(b);O+=x||ce(),null===e?R="null":$(e)?R="array":void 0!==e&&e.$$typeof===t?(R="<"+(S(e.type)||"Unknown")+" />",O=" Did you accidentally export a JSX literal instead of a component?"):R=typeof e,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",R,O)}var I=ie(e,r,h,b,A);if(null==I)return I;if(k){var C=r.children;if(void 0!==C)if(m)if($(C)){for(var N=0;N<C.length;N++)pe(C[N],e);Object.freeze&&Object.freeze(C)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else pe(C,e)}return e===n?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var n=t[r];if("children"!==n&&"key"!==n){fe(e),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),fe(null);break}}null!==e.ref&&(fe(e),y("Invalid attribute `ref` supplied to `React.Fragment`."),fe(null))}(I):he(I),I}var be=function(e,t,r){return me(e,t,r,!1)},ye=function(e,t,r){return me(e,t,r,!0)};S3.Fragment=n,S3.jsx=be,S3.jsxs=ye}()),S3);var k3=b3.exports;function O3(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}const R3=()=>"0.4.1-alpha";var x3;O3({},"IMTBLWidgetEvents",(()=>e.IMTBLWidgetEvents)),e.IMTBLWidgetEvents=void 0,(x3=e.IMTBLWidgetEvents||(e.IMTBLWidgetEvents={})).IMTBL_CONNECT_WIDGET_EVENT="imtbl-connect-widget",x3.IMTBL_WALLET_WIDGET_EVENT="imtbl-wallet-widget",x3.IMTBL_SWAP_WIDGET_EVENT="imtbl-swap-widget",x3.IMTBL_BRIDGE_WIDGET_EVENT="imtbl-bridge-widget";var I3;O3({},"ConnectEventType",(()=>e.ConnectEventType)),e.ConnectEventType=void 0,(I3=e.ConnectEventType||(e.ConnectEventType={})).CLOSE_WIDGET="close-widget",I3.SUCCESS="success",I3.FAILURE="failure";var C3;O3({},"WalletEventType",(()=>e.WalletEventType)),e.WalletEventType=void 0,(C3=e.WalletEventType||(e.WalletEventType={})).CLOSE_WIDGET="close-widget",C3.NETWORK_SWITCH="network-switch",C3.DISCONNECT_WALLET="disconnect-wallet";var N3;O3({},"SwapEventType",(()=>e.SwapEventType)),e.SwapEventType=void 0,(N3=e.SwapEventType||(e.SwapEventType={})).CLOSE_WIDGET="close-widget",N3.SUCCESS="success",N3.FAILURE="failure",N3.REJECTED="rejected";var P3;O3({},"BridgeEventType",(()=>e.BridgeEventType)),e.BridgeEventType=void 0,(P3=e.BridgeEventType||(e.BridgeEventType={})).CLOSE_WIDGET="close-widget",P3.SUCCESS="success",P3.FAILURE="failure";var M3;O3({},"OrchestrationEventType",(()=>e.OrchestrationEventType)),e.OrchestrationEventType=void 0,(M3=e.OrchestrationEventType||(e.OrchestrationEventType={})).REQUEST_CONNECT="request-connect",M3.REQUEST_WALLET="request-wallet",M3.REQUEST_SWAP="request-swap",M3.REQUEST_BRIDGE="request-bridge",M3.REQUEST_ONRAMP="request-onramp";var B3,D3,F3={};O3(F3,"WidgetTheme",(()=>e.WidgetTheme)),O3(F3,"CheckoutWidgetTagNames",(()=>e.CheckoutWidgetTagNames)),e.WidgetTheme=void 0,(B3=e.WidgetTheme||(e.WidgetTheme={})).LIGHT="light",B3.DARK="dark",B3.CUSTOM="custom",e.CheckoutWidgetTagNames=void 0,(D3=e.CheckoutWidgetTagNames||(e.CheckoutWidgetTagNames={})).CONNECT="imtbl-connect",D3.WALLET="imtbl-wallet",D3.SWAP="imtbl-swap",D3.BRIDGE="imtbl-bridge";function L3(e,t){if(!t)return void console.error("no provider parsed");if(void 0===window)return void console.error("missing window object: please run Checkout client side");let r=0;let n;const i=()=>{try{const r=document.getElementsByTagName(e);r[0].setProvider(t),window.clearInterval(n)}catch(e){r++,r>=10&&(window.clearInterval(n),console.error("failed to set the provider"))}};n=window.setInterval(i,10),i()}function U3(t){const{walletProvider:r,fromContractAddress:n,amount:i,provider:a}=t;T3.useEffect((()=>{a&&L3(e.CheckoutWidgetTagNames.BRIDGE,a)}),[a]);const o=window.ImtblCheckoutWidgetConfig;return k3.jsx("imtbl-bridge",{widgetConfig:o,walletProvider:r,fromContractAddress:n??"",amount:i??""})}O3({},"BridgeReact",(()=>U3));function j3(){const e=window.ImtblCheckoutWidgetConfig;return k3.jsx("imtbl-connect",{widgetConfig:e})}O3({},"ConnectReact",(()=>j3));function q3(t){const{walletProvider:r,fromContractAddress:n,amount:i,toContractAddress:a,provider:o}=t;T3.useEffect((()=>{o&&L3(e.CheckoutWidgetTagNames.SWAP,o)}),[o]);const s=window.ImtblCheckoutWidgetConfig;return k3.jsx("imtbl-swap",{widgetConfig:s,walletProvider:r,fromContractAddress:n??"",toContractAddress:a??"",amount:i??""})}O3({},"SwapReact",(()=>q3));function z3(t){const{walletProvider:r,provider:n}=t;T3.useEffect((()=>{n&&L3(e.CheckoutWidgetTagNames.WALLET,n)}),[n]);const i=window.ImtblCheckoutWidgetConfig;return k3.jsx("imtbl-wallet",{widgetConfig:i,walletProvider:r})}O3({},"WalletReact",(()=>z3));const H3=[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],V3="0x60806040523480156200001157600080fd5b50604051620017ec380380620017ec8339818101604052810190620000379190620001f6565b8160039081620000489190620004c6565b5080600490816200005a9190620004c6565b505050620005ad565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620000cc8262000081565b810181811067ffffffffffffffff82111715620000ee57620000ed62000092565b5b80604052505050565b60006200010362000063565b9050620001118282620000c1565b919050565b600067ffffffffffffffff82111562000134576200013362000092565b5b6200013f8262000081565b9050602081019050919050565b60005b838110156200016c5780820151818401526020810190506200014f565b60008484015250505050565b60006200018f620001898462000116565b620000f7565b905082815260208101848484011115620001ae57620001ad6200007c565b5b620001bb8482856200014c565b509392505050565b600082601f830112620001db57620001da62000077565b5b8151620001ed84826020860162000178565b91505092915050565b6000806040838503121562000210576200020f6200006d565b5b600083015167ffffffffffffffff81111562000231576200023062000072565b5b6200023f85828601620001c3565b925050602083015167ffffffffffffffff81111562000263576200026262000072565b5b6200027185828601620001c3565b9150509250929050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620002ce57607f821691505b602082108103620002e457620002e362000286565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026200034e7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200030f565b6200035a86836200030f565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620003a7620003a16200039b8462000372565b6200037c565b62000372565b9050919050565b6000819050919050565b620003c38362000386565b620003db620003d282620003ae565b8484546200031c565b825550505050565b600090565b620003f2620003e3565b620003ff818484620003b8565b505050565b5b8181101562000427576200041b600082620003e8565b60018101905062000405565b5050565b601f82111562000476576200044081620002ea565b6200044b84620002ff565b810160208510156200045b578190505b620004736200046a85620002ff565b83018262000404565b50505b505050565b600082821c905092915050565b60006200049b600019846008026200047b565b1980831691505092915050565b6000620004b6838362000488565b9150826002028217905092915050565b620004d1826200027b565b67ffffffffffffffff811115620004ed57620004ec62000092565b5b620004f98254620002b5565b620005068282856200042b565b600060209050601f8311600181146200053e576000841562000529578287015190505b620005358582620004a8565b865550620005a5565b601f1984166200054e86620002ea565b60005b82811015620005785784890151825560018201915060208501945060208101905062000551565b8683101562000598578489015162000594601f89168262000488565b8355505b6001600288020188555050505b505050505050565b61122f80620005bd6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610b0c565b60405180910390f35b6100e660048036038101906100e19190610bc7565b610308565b6040516100f39190610c22565b60405180910390f35b61010461032b565b6040516101119190610c4c565b60405180910390f35b610134600480360381019061012f9190610c67565b610335565b6040516101419190610c22565b60405180910390f35b610152610364565b60405161015f9190610cd6565b60405180910390f35b610182600480360381019061017d9190610bc7565b61036d565b60405161018f9190610c22565b60405180910390f35b6101b260048036038101906101ad9190610cf1565b6103a4565b6040516101bf9190610c4c565b60405180910390f35b6101d06103ec565b6040516101dd9190610b0c565b60405180910390f35b61020060048036038101906101fb9190610bc7565b61047e565b60405161020d9190610c22565b60405180910390f35b610230600480360381019061022b9190610bc7565b6104f5565b60405161023d9190610c22565b60405180910390f35b610260600480360381019061025b9190610d1e565b610518565b60405161026d9190610c4c565b60405180910390f35b60606003805461028590610d8d565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190610d8d565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b60008061031361059f565b90506103208185856105a7565b600191505092915050565b6000600254905090565b60008061034061059f565b905061034d858285610770565b6103588585856107fc565b60019150509392505050565b60006012905090565b60008061037861059f565b905061039981858561038a8589610518565b6103949190610ded565b6105a7565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546103fb90610d8d565b80601f016020809104026020016040519081016040528092919081815260200182805461042790610d8d565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60008061048961059f565b905060006104978286610518565b9050838110156104dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d390610e93565b60405180910390fd5b6104e982868684036105a7565b60019250505092915050565b60008061050061059f565b905061050d8185856107fc565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060d90610f25565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067c90610fb7565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107639190610c4c565b60405180910390a3505050565b600061077c8484610518565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107f657818110156107e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107df90611023565b60405180910390fd5b6107f584848484036105a7565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361086b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610862906110b5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d190611147565b60405180910390fd5b6108e5838383610a72565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561096b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610962906111d9565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a599190610c4c565b60405180910390a3610a6c848484610a77565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ab6578082015181840152602081019050610a9b565b60008484015250505050565b6000601f19601f8301169050919050565b6000610ade82610a7c565b610ae88185610a87565b9350610af8818560208601610a98565b610b0181610ac2565b840191505092915050565b60006020820190508181036000830152610b268184610ad3565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610b5e82610b33565b9050919050565b610b6e81610b53565b8114610b7957600080fd5b50565b600081359050610b8b81610b65565b92915050565b6000819050919050565b610ba481610b91565b8114610baf57600080fd5b50565b600081359050610bc181610b9b565b92915050565b60008060408385031215610bde57610bdd610b2e565b5b6000610bec85828601610b7c565b9250506020610bfd85828601610bb2565b9150509250929050565b60008115159050919050565b610c1c81610c07565b82525050565b6000602082019050610c376000830184610c13565b92915050565b610c4681610b91565b82525050565b6000602082019050610c616000830184610c3d565b92915050565b600080600060608486031215610c8057610c7f610b2e565b5b6000610c8e86828701610b7c565b9350506020610c9f86828701610b7c565b9250506040610cb086828701610bb2565b9150509250925092565b600060ff82169050919050565b610cd081610cba565b82525050565b6000602082019050610ceb6000830184610cc7565b92915050565b600060208284031215610d0757610d06610b2e565b5b6000610d1584828501610b7c565b91505092915050565b60008060408385031215610d3557610d34610b2e565b5b6000610d4385828601610b7c565b9250506020610d5485828601610b7c565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610da557607f821691505b602082108103610db857610db7610d5e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df882610b91565b9150610e0383610b91565b9250828201905080821115610e1b57610e1a610dbe565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000610e7d602583610a87565b9150610e8882610e21565b604082019050919050565b60006020820190508181036000830152610eac81610e70565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000610f0f602483610a87565b9150610f1a82610eb3565b604082019050919050565b60006020820190508181036000830152610f3e81610f02565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000610fa1602283610a87565b9150610fac82610f45565b604082019050919050565b60006020820190508181036000830152610fd081610f94565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061100d601d83610a87565b915061101882610fd7565b602082019050919050565b6000602082019050818103600083015261103c81611000565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061109f602583610a87565b91506110aa82611043565b604082019050919050565b600060208201905081810360008301526110ce81611092565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611131602383610a87565b915061113c826110d5565b604082019050919050565b6000602082019050818103600083015261116081611124565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006111c3602683610a87565b91506111ce82611167565b604082019050919050565b600060208201905081810360008301526111f2816111b6565b905091905056fea26469706673582212204188b273199f085e1921ec1a1fa55abdee2e425960bda675a51fac85acd9972064736f6c63430008110033";class G3 extends vl{constructor(...e){e.length>1?super(...e):super(H3,V3,e[0])}deploy(e,t,r){return super.deploy(e,t,r||{})}getDeployTransaction(e,t,r){return super.getDeployTransaction(e,t,r||{})}attach(e){return super.attach(e)}connect(e){return super.connect(e)}static bytecode=V3;static abi=H3;static createInterface(){return new Df(H3)}static connect(e,t){return new gl(e,H3,t)}}const K3=[{inputs:[{internalType:"address",name:"owner_",type:"address"},{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"string",name:"baseURI_",type:"string"},{internalType:"string",name:"contractURI_",type:"string"},{internalType:"address",name:"_receiver",type:"address"},{internalType:"uint96",name:"_feeNumerator",type:"uint96"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"ApproveTargetNotInAllowlist",type:"error"},{inputs:[{internalType:"address",name:"caller",type:"address"}],name:"CallerNotInAllowlist",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"previousAdminRole",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"newAdminRole",type:"bytes32"}],name:"RoleAdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleGranted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"oldRegistry",type:"address"},{indexed:!1,internalType:"address",name:"newRegistry",type:"address"}],name:"RoyaltytAllowlistRegistryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DEFAULT_ADMIN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"MINTER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contractURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"getAdmins",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleAdmin",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"uint256",name:"index",type:"uint256"}],name:"getRoleMember",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleMemberCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"}],name:"grantMinterRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"grantRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"hasRole",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"renounceRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"}],name:"revokeMinterRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"revokeRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"royaltyAllowlist",outputs:[{internalType:"contract IRoyaltyAllowlist",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"},{internalType:"uint256",name:"_salePrice",type:"uint256"}],name:"royaltyInfo",outputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"baseURI_",type:"string"}],name:"setBaseURI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"_contractURI",type:"string"}],name:"setContractURI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_royaltyAllowlist",type:"address"}],name:"setRoyaltyAllowlistRegistry",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}],W3="0x60806040523480156200001157600080fd5b50604051620060d4380380620060d4833981810160405281019062000037919062000762565b868686868686868585816000908162000051919062000adc565b50806001908162000063919062000adc565b505050620000788282620000dc60201b60201c565b6200008d6000801b886200027f60201b60201c565b83601090816200009e919062000adc565b5082600f9081620000b0919062000adc565b50620000c86011620002c760201b620015f11760201c565b505050505050505050505050505062000cde565b620000ec620002dd60201b60201c565b6bffffffffffffffffffffffff16816bffffffffffffffffffffffff1611156200014d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001449062000c4a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620001bf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001b69062000cbc565b60405180910390fd5b60405180604001604052808373ffffffffffffffffffffffffffffffffffffffff168152602001826bffffffffffffffffffffffff16815250600d60008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055509050505050565b620002968282620002e760201b620016071760201c565b620002c28160076000858152602001908152602001600020620003d960201b620016e81790919060201c565b505050565b6001816000016000828254019250508190555050565b6000612710905090565b620002f982826200041160201b60201c565b620003d55760016006600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506200037a6200047c60201b60201c565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600062000409836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6200048460201b60201c565b905092915050565b60006006600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600033905090565b6000620004988383620004fe60201b60201c565b620004f3578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050620004f8565b600090505b92915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620005628262000535565b9050919050565b620005748162000555565b81146200058057600080fd5b50565b600081519050620005948162000569565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620005ef82620005a4565b810181811067ffffffffffffffff82111715620006115762000610620005b5565b5b80604052505050565b60006200062662000521565b9050620006348282620005e4565b919050565b600067ffffffffffffffff821115620006575762000656620005b5565b5b6200066282620005a4565b9050602081019050919050565b60005b838110156200068f57808201518184015260208101905062000672565b60008484015250505050565b6000620006b2620006ac8462000639565b6200061a565b905082815260208101848484011115620006d157620006d06200059f565b5b620006de8482856200066f565b509392505050565b600082601f830112620006fe57620006fd6200059a565b5b8151620007108482602086016200069b565b91505092915050565b60006bffffffffffffffffffffffff82169050919050565b6200073c8162000719565b81146200074857600080fd5b50565b6000815190506200075c8162000731565b92915050565b600080600080600080600060e0888a0312156200078457620007836200052b565b5b6000620007948a828b0162000583565b975050602088015167ffffffffffffffff811115620007b857620007b762000530565b5b620007c68a828b01620006e6565b965050604088015167ffffffffffffffff811115620007ea57620007e962000530565b5b620007f88a828b01620006e6565b955050606088015167ffffffffffffffff8111156200081c576200081b62000530565b5b6200082a8a828b01620006e6565b945050608088015167ffffffffffffffff8111156200084e576200084d62000530565b5b6200085c8a828b01620006e6565b93505060a06200086f8a828b0162000583565b92505060c0620008828a828b016200074b565b91505092959891949750929550565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620008e457607f821691505b602082108103620008fa57620008f96200089c565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620009647fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000925565b62000970868362000925565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620009bd620009b7620009b18462000988565b62000992565b62000988565b9050919050565b6000819050919050565b620009d9836200099c565b620009f1620009e882620009c4565b84845462000932565b825550505050565b600090565b62000a08620009f9565b62000a15818484620009ce565b505050565b5b8181101562000a3d5762000a31600082620009fe565b60018101905062000a1b565b5050565b601f82111562000a8c5762000a568162000900565b62000a618462000915565b8101602085101562000a71578190505b62000a8962000a808562000915565b83018262000a1a565b50505b505050565b600082821c905092915050565b600062000ab16000198460080262000a91565b1980831691505092915050565b600062000acc838362000a9e565b9150826002028217905092915050565b62000ae78262000891565b67ffffffffffffffff81111562000b035762000b02620005b5565b5b62000b0f8254620008cb565b62000b1c82828562000a41565b600060209050601f83116001811462000b54576000841562000b3f578287015190505b62000b4b858262000abe565b86555062000bbb565b601f19841662000b648662000900565b60005b8281101562000b8e5784890151825560018201915060208501945060208101905062000b67565b8683101562000bae578489015162000baa601f89168262000a9e565b8355505b6001600288020188555050505b505050505050565b600082825260208201905092915050565b7f455243323938313a20726f79616c7479206665652077696c6c2065786365656460008201527f2073616c65507269636500000000000000000000000000000000000000000000602082015250565b600062000c32602a8362000bc3565b915062000c3f8262000bd4565b604082019050919050565b6000602082019050818103600083015262000c658162000c23565b9050919050565b7f455243323938313a20696e76616c696420726563656976657200000000000000600082015250565b600062000ca460198362000bc3565b915062000cb18262000c6c565b602082019050919050565b6000602082019050818103600083015262000cd78162000c95565b9050919050565b6153e68062000cee6000396000f3fe608060405234801561001057600080fd5b50600436106102275760003560e01c80636352211e1161013057806395d89b41116100b8578063ca15c8731161007c578063ca15c87314610697578063d5391393146106c7578063d547741f146106e5578063e8a3d48514610701578063e985e9c51461071f57610227565b806395d89b41146105f3578063a217fddf14610611578063a22cb4651461062f578063b88d4fde1461064b578063c87b56dd1461066757610227565b80636c0360eb116100ff5780636c0360eb1461052957806370a08231146105475780639010d07c1461057757806391d14854146105a7578063938e3d7b146105d757610227565b80636352211e146104a35780636588962a146104d357806369e2f0fb146104ef5780636b3a06321461050b57610227565b80632f745c59116101b357806340c10f191161018257806340c10f191461040357806342842e0e1461041f57806342966c681461043b5780634f6ccce71461045757806355f804b31461048757610227565b80632f745c591461037d57806331ae450b146103ad57806336568abe146103cb5780633dd1eb61146103e757610227565b806318160ddd116101fa57806318160ddd146102c657806323b872dd146102e4578063248a9ca3146103005780632a55205a146103305780632f2ff15d1461036157610227565b806301ffc9a71461022c57806306fdde031461025c578063081812fc1461027a578063095ea7b3146102aa575b600080fd5b61024660048036038101906102419190613a2e565b61074f565b6040516102539190613a76565b60405180910390f35b610264610761565b6040516102719190613b21565b60405180910390f35b610294600480360381019061028f9190613b79565b6107f3565b6040516102a19190613be7565b60405180910390f35b6102c460048036038101906102bf9190613c2e565b610839565b005b6102ce610847565b6040516102db9190613c7d565b60405180910390f35b6102fe60048036038101906102f99190613c98565b610854565b005b61031a60048036038101906103159190613d21565b6108b4565b6040516103279190613d5d565b60405180910390f35b61034a60048036038101906103459190613d78565b6108d4565b604051610358929190613db8565b60405180910390f35b61037b60048036038101906103769190613de1565b610abe565b005b61039760048036038101906103929190613c2e565b610adf565b6040516103a49190613c7d565b60405180910390f35b6103b5610b84565b6040516103c29190613edf565b60405180910390f35b6103e560048036038101906103e09190613de1565b610c64565b005b61040160048036038101906103fc9190613f01565b610ce7565b005b61041d60048036038101906104189190613c2e565b610d22565b005b61043960048036038101906104349190613c98565b610d7a565b005b61045560048036038101906104509190613b79565b610d9a565b005b610471600480360381019061046c9190613b79565b610df6565b60405161047e9190613c7d565b60405180910390f35b6104a1600480360381019061049c9190614063565b610e67565b005b6104bd60048036038101906104b89190613b79565b610e88565b6040516104ca9190613be7565b60405180910390f35b6104ed60048036038101906104e89190613f01565b610f0e565b005b61050960048036038101906105049190613f01565b611094565b005b6105136110cf565b604051610520919061410b565b60405180910390f35b6105316110f5565b60405161053e9190613b21565b60405180910390f35b610561600480360381019061055c9190613f01565b611183565b60405161056e9190613c7d565b60405180910390f35b610591600480360381019061058c9190614126565b61123a565b60405161059e9190613be7565b60405180910390f35b6105c160048036038101906105bc9190613de1565b611269565b6040516105ce9190613a76565b60405180910390f35b6105f160048036038101906105ec9190614063565b6112d4565b005b6105fb6112f5565b6040516106089190613b21565b60405180910390f35b610619611387565b6040516106269190613d5d565b60405180910390f35b61064960048036038101906106449190614192565b61138e565b005b61066560048036038101906106609190614273565b61139c565b005b610681600480360381019061067c9190613b79565b6113fe565b60405161068e9190613b21565b60405180910390f35b6106b160048036038101906106ac9190613d21565b611466565b6040516106be9190613c7d565b60405180910390f35b6106cf61148a565b6040516106dc9190613d5d565b60405180910390f35b6106ff60048036038101906106fa9190613de1565b6114ae565b005b6107096114cf565b6040516107169190613b21565b60405180910390f35b610739600480360381019061073491906142f6565b61155d565b6040516107469190613a76565b60405180910390f35b600061075a82611718565b9050919050565b60606000805461077090614365565b80601f016020809104026020016040519081016040528092919081815260200182805461079c90614365565b80156107e95780601f106107be576101008083540402835291602001916107e9565b820191906000526020600020905b8154815290600101906020018083116107cc57829003601f168201915b5050505050905090565b60006107fe82611792565b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b61084382826117dd565b5050565b6000600b80549050905090565b61086561085f6117f4565b826117fc565b6108a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089b90614408565b60405180910390fd5b6108af838383611891565b505050565b600060066000838152602001908152602001600020600101549050919050565b6000806000600e60008681526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610a6957600d6040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090505b6000610a736118a1565b6bffffffffffffffffffffffff1682602001516bffffffffffffffffffffffff1686610a9f9190614457565b610aa991906144c8565b90508160000151819350935050509250929050565b610ac7826108b4565b610ad0816118ab565b610ada83836118bf565b505050565b6000610aea83611183565b8210610b2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b229061456b565b60405180910390fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b60606000610b946000801b611466565b905060008167ffffffffffffffff811115610bb257610bb1613f38565b5b604051908082528060200260200182016040528015610be05781602001602082028036833780820191505090505b50905060005b82811015610c5b57610bfb6000801b8261123a565b828281518110610c0e57610c0d61458b565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080610c53906145ba565b915050610be6565b50809250505090565b610c6c6117f4565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610cd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd090614674565b60405180910390fd5b610ce382826118f3565b5050565b6000801b610cf4816118ab565b610d1e7f4d494e5445525f524f4c4500000000000000000000000000000000000000000083610abe565b5050565b7f4d494e5445525f524f4c45000000000000000000000000000000000000000000610d4c816118ab565b60005b82811015610d7457610d6084611927565b508080610d6c906145ba565b915050610d4f565b50505050565b610d958383836040518060200160405280600081525061139c565b505050565b610dab610da56117f4565b826117fc565b610dea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de190614408565b60405180910390fd5b610df381611953565b50565b6000610e00610847565b8210610e41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3890614706565b60405180910390fd5b600b8281548110610e5557610e5461458b565b5b90600052602060002001549050919050565b6000801b610e74816118ab565b8160109081610e8391906148c8565b505050565b600080610e9483611aa1565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610f05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610efc906149e6565b60405180910390fd5b80915050919050565b6000801b610f1b816118ab565b8173ffffffffffffffffffffffffffffffffffffffff166301ffc9a77f05a3b809000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b8152600401610f749190614a15565b602060405180830381865afa158015610f91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb59190614a45565b610ff4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610feb90614ae4565b60405180910390fd5b7f4a1d010d926ae0d4294a4afe61ae81bb378335fbf671e099a7138b5afeefdf84600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683604051611047929190614b04565b60405180910390a181600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000801b6110a1816118ab565b6110cb7f4d494e5445525f524f4c45000000000000000000000000000000000000000000836114ae565b5050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6010805461110290614365565b80601f016020809104026020016040519081016040528092919081815260200182805461112e90614365565b801561117b5780601f106111505761010080835404028352916020019161117b565b820191906000526020600020905b81548152906001019060200180831161115e57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036111f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ea90614b9f565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60006112618260076000868152602001908152602001600020611ade90919063ffffffff16565b905092915050565b60006006600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000801b6112e1816118ab565b81600f90816112f091906148c8565b505050565b60606001805461130490614365565b80601f016020809104026020016040519081016040528092919081815260200182805461133090614365565b801561137d5780601f106113525761010080835404028352916020019161137d565b820191906000526020600020905b81548152906001019060200180831161136057829003601f168201915b5050505050905090565b6000801b81565b6113988282611af8565b5050565b6113ad6113a76117f4565b836117fc565b6113ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e390614408565b60405180910390fd5b6113f884848484611b0f565b50505050565b606061140982611792565b6000611413611b6b565b90506000815111611433576040518060200160405280600081525061145e565b8061143d84611bfd565b60405160200161144e929190614bfb565b6040516020818303038152906040525b915050919050565b600061148360076000848152602001908152602001600020611ccb565b9050919050565b7f4d494e5445525f524f4c4500000000000000000000000000000000000000000081565b6114b7826108b4565b6114c0816118ab565b6114ca83836118f3565b505050565b600f80546114dc90614365565b80601f016020809104026020016040519081016040528092919081815260200182805461150890614365565b80156115555780601f1061152a57610100808354040283529160200191611555565b820191906000526020600020905b81548152906001019060200180831161153857829003601f168201915b505050505081565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6001816000016000828254019250508190555050565b6116118282611269565b6116e45760016006600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506116896117f4565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000611710836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611ce0565b905092915050565b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061178b575061178a82611d50565b5b9050919050565b61179b81611dca565b6117da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117d1906149e6565b60405180910390fd5b50565b6117e682611e0b565b6117f08282611f64565b5050565b600033905090565b60008061180883610e88565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061184a5750611849818561155d565b5b8061188857508373ffffffffffffffffffffffffffffffffffffffff16611870846107f3565b73ffffffffffffffffffffffffffffffffffffffff16145b91505092915050565b61189c83838361207b565b505050565b6000612710905090565b6118bc816118b76117f4565b612093565b50565b6118c98282611607565b6118ee81600760008581526020019081526020016000206116e890919063ffffffff16565b505050565b6118fd8282612118565b61192281600760008581526020019081526020016000206121fa90919063ffffffff16565b505050565b600080611934601161222a565b90506119408382612238565b61194a60116115f1565b80915050919050565b600061195e82610e88565b905061196e816000846001612455565b61197782610e88565b90506004600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506002600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905581600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4611a9d816000846001612467565b5050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000611aed836000018361246d565b60001c905092915050565b611b0182611e0b565b611b0b8282612498565b5050565b611b1a848484611891565b611b26848484846124ae565b611b65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5c90614c91565b60405180910390fd5b50505050565b606060108054611b7a90614365565b80601f0160208091040260200160405190810160405280929190818152602001828054611ba690614365565b8015611bf35780601f10611bc857610100808354040283529160200191611bf3565b820191906000526020600020905b815481529060010190602001808311611bd657829003601f168201915b5050505050905090565b606060006001611c0c84612635565b01905060008167ffffffffffffffff811115611c2b57611c2a613f38565b5b6040519080825280601f01601f191660200182016040528015611c5d5781602001600182028036833780820191505090505b509050600082602001820190505b600115611cc0578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581611cb457611cb3614499565b5b04945060008503611c6b575b819350505050919050565b6000611cd982600001612788565b9050919050565b6000611cec8383612799565b611d45578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050611d4a565b600090505b92915050565b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611dc35750611dc2826127bc565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff16611dec83611aa1565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600073ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611f605760008173ffffffffffffffffffffffffffffffffffffffff163b1480611f1f5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166305a3b809826040518263ffffffff1660e01b8152600401611edd9190613be7565b602060405180830381865afa158015611efa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1e9190614a45565b5b611f6157806040517f8371ab02000000000000000000000000000000000000000000000000000000008152600401611f579190613be7565b60405180910390fd5b5b50565b6000611f6f82610e88565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611fdf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fd690614d23565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16611ffe6117f4565b73ffffffffffffffffffffffffffffffffffffffff16148061202d575061202c816120276117f4565b61155d565b5b61206c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206390614db5565b60405180910390fd5b61207683836127ce565b505050565b612083612887565b61208e8383836129f3565b505050565b61209d8282611269565b612114576120aa81612cec565b6120b88360001c6020612d19565b6040516020016120c9929190614e6d565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161210b9190613b21565b60405180910390fd5b5050565b6121228282611269565b156121f65760006006600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061219b6117f4565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b6000612222836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612f55565b905092915050565b600081600001549050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036122a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229e90614ef3565b60405180910390fd5b6122b081611dca565b156122f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122e790614f5f565b60405180910390fd5b6122fe600083836001612455565b61230781611dca565b15612347576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161233e90614f5f565b60405180910390fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612451600083836001612467565b5050565b61246184848484613069565b50505050565b50505050565b60008260000182815481106124855761248461458b565b5b9060005260206000200154905092915050565b6124aa6124a36117f4565b83836131c7565b5050565b60006124cf8473ffffffffffffffffffffffffffffffffffffffff16613333565b15612628578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026124f86117f4565b8786866040518563ffffffff1660e01b815260040161251a9493929190614fd4565b6020604051808303816000875af192505050801561255657506040513d601f19601f820116820180604052508101906125539190615035565b60015b6125d8573d8060008114612586576040519150601f19603f3d011682016040523d82523d6000602084013e61258b565b606091505b5060008151036125d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125c790614c91565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161491505061262d565b600190505b949350505050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310612693577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161268957612688614499565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106126d0576d04ee2d6d415b85acef810000000083816126c6576126c5614499565b5b0492506020810190505b662386f26fc1000083106126ff57662386f26fc1000083816126f5576126f4614499565b5b0492506010810190505b6305f5e1008310612728576305f5e100838161271e5761271d614499565b5b0492506008810190505b612710831061274d57612710838161274357612742614499565b5b0492506004810190505b60648310612770576064838161276657612765614499565b5b0492506002810190505b600a831061277f576001810190505b80915050919050565b600081600001805490509050919050565b600080836001016000848152602001908152602001600020541415905092915050565b60006127c782613356565b9050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661284183610e88565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600073ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146129f0573273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806129af5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166305a3b809336040518263ffffffff1660e01b815260040161296d9190613be7565b602060405180830381865afa15801561298a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ae9190614a45565b5b6129f157336040517f937db65f0000000000000000000000000000000000000000000000000000000081526004016129e79190613be7565b60405180910390fd5b5b565b8273ffffffffffffffffffffffffffffffffffffffff16612a1382610e88565b73ffffffffffffffffffffffffffffffffffffffff1614612a69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a60906150d4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612ad8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612acf90615166565b60405180910390fd5b612ae58383836001612455565b8273ffffffffffffffffffffffffffffffffffffffff16612b0582610e88565b73ffffffffffffffffffffffffffffffffffffffff1614612b5b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b52906150d4565b60405180910390fd5b6004600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612ce78383836001612467565b505050565b6060612d128273ffffffffffffffffffffffffffffffffffffffff16601460ff16612d19565b9050919050565b606060006002836002612d2c9190614457565b612d369190615186565b67ffffffffffffffff811115612d4f57612d4e613f38565b5b6040519080825280601f01601f191660200182016040528015612d815781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612db957612db861458b565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612e1d57612e1c61458b565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006001846002612e5d9190614457565b612e679190615186565b90505b6001811115612f07577f3031323334353637383961626364656600000000000000000000000000000000600f861660108110612ea957612ea861458b565b5b1a60f81b828281518110612ec057612ebf61458b565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c945080612f00906151ba565b9050612e6a565b5060008414612f4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f429061522f565b60405180910390fd5b8091505092915050565b6000808360010160008481526020019081526020016000205490506000811461305d576000600182612f87919061524f565b9050600060018660000180549050612f9f919061524f565b905081811461300e576000866000018281548110612fc057612fbf61458b565b5b9060005260206000200154905080876000018481548110612fe457612fe361458b565b5b90600052602060002001819055508387600101600083815260200190815260200160002081905550505b8560000180548061302257613021615283565b5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050613063565b60009150505b92915050565b613075848484846133d0565b60018111156130b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130b090615324565b60405180910390fd5b6000829050600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603613100576130fb816134f6565b61313f565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161461313e5761313d858261353f565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036131815761317c816136ac565b6131c0565b8473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146131bf576131be848261377d565b5b5b5050505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603613235576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161322c90615390565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516133269190613a76565b60405180910390a3505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60007f5a05180f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806133c957506133c8826137fc565b5b9050919050565b60018111156134f057600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146134645780600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461345c919061524f565b925050819055505b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146134ef5780600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546134e79190615186565b925050819055505b5b50505050565b600b80549050600c600083815260200190815260200160002081905550600b81908060018154018082558091505060019003906000526020600020016000909190919091505550565b6000600161354c84611183565b613556919061524f565b90506000600a600084815260200190815260200160002054905081811461363b576000600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008481526020019081526020016000208190555081600a600083815260200190815260200160002081905550505b600a600084815260200190815260200160002060009055600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600b805490506136c0919061524f565b90506000600c60008481526020019081526020016000205490506000600b83815481106136f0576136ef61458b565b5b9060005260206000200154905080600b83815481106137125761371161458b565b5b906000526020600020018190555081600c600083815260200190815260200160002081905550600c600085815260200190815260200160002060009055600b80548061376157613760615283565b5b6001900381819060005260206000200160009055905550505050565b600061378883611183565b905081600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000208190555080600a600084815260200190815260200160002081905550505050565b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061386f575061386e82613876565b5b9050919050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061394157507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80613951575061395082613958565b5b9050919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613a0b816139d6565b8114613a1657600080fd5b50565b600081359050613a2881613a02565b92915050565b600060208284031215613a4457613a436139cc565b5b6000613a5284828501613a19565b91505092915050565b60008115159050919050565b613a7081613a5b565b82525050565b6000602082019050613a8b6000830184613a67565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015613acb578082015181840152602081019050613ab0565b60008484015250505050565b6000601f19601f8301169050919050565b6000613af382613a91565b613afd8185613a9c565b9350613b0d818560208601613aad565b613b1681613ad7565b840191505092915050565b60006020820190508181036000830152613b3b8184613ae8565b905092915050565b6000819050919050565b613b5681613b43565b8114613b6157600080fd5b50565b600081359050613b7381613b4d565b92915050565b600060208284031215613b8f57613b8e6139cc565b5b6000613b9d84828501613b64565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000613bd182613ba6565b9050919050565b613be181613bc6565b82525050565b6000602082019050613bfc6000830184613bd8565b92915050565b613c0b81613bc6565b8114613c1657600080fd5b50565b600081359050613c2881613c02565b92915050565b60008060408385031215613c4557613c446139cc565b5b6000613c5385828601613c19565b9250506020613c6485828601613b64565b9150509250929050565b613c7781613b43565b82525050565b6000602082019050613c926000830184613c6e565b92915050565b600080600060608486031215613cb157613cb06139cc565b5b6000613cbf86828701613c19565b9350506020613cd086828701613c19565b9250506040613ce186828701613b64565b9150509250925092565b6000819050919050565b613cfe81613ceb565b8114613d0957600080fd5b50565b600081359050613d1b81613cf5565b92915050565b600060208284031215613d3757613d366139cc565b5b6000613d4584828501613d0c565b91505092915050565b613d5781613ceb565b82525050565b6000602082019050613d726000830184613d4e565b92915050565b60008060408385031215613d8f57613d8e6139cc565b5b6000613d9d85828601613b64565b9250506020613dae85828601613b64565b9150509250929050565b6000604082019050613dcd6000830185613bd8565b613dda6020830184613c6e565b9392505050565b60008060408385031215613df857613df76139cc565b5b6000613e0685828601613d0c565b9250506020613e1785828601613c19565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613e5681613bc6565b82525050565b6000613e688383613e4d565b60208301905092915050565b6000602082019050919050565b6000613e8c82613e21565b613e968185613e2c565b9350613ea183613e3d565b8060005b83811015613ed2578151613eb98882613e5c565b9750613ec483613e74565b925050600181019050613ea5565b5085935050505092915050565b60006020820190508181036000830152613ef98184613e81565b905092915050565b600060208284031215613f1757613f166139cc565b5b6000613f2584828501613c19565b91505092915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613f7082613ad7565b810181811067ffffffffffffffff82111715613f8f57613f8e613f38565b5b80604052505050565b6000613fa26139c2565b9050613fae8282613f67565b919050565b600067ffffffffffffffff821115613fce57613fcd613f38565b5b613fd782613ad7565b9050602081019050919050565b82818337600083830152505050565b600061400661400184613fb3565b613f98565b90508281526020810184848401111561402257614021613f33565b5b61402d848285613fe4565b509392505050565b600082601f83011261404a57614049613f2e565b5b813561405a848260208601613ff3565b91505092915050565b600060208284031215614079576140786139cc565b5b600082013567ffffffffffffffff811115614097576140966139d1565b5b6140a384828501614035565b91505092915050565b6000819050919050565b60006140d16140cc6140c784613ba6565b6140ac565b613ba6565b9050919050565b60006140e3826140b6565b9050919050565b60006140f5826140d8565b9050919050565b614105816140ea565b82525050565b600060208201905061412060008301846140fc565b92915050565b6000806040838503121561413d5761413c6139cc565b5b600061414b85828601613d0c565b925050602061415c85828601613b64565b9150509250929050565b61416f81613a5b565b811461417a57600080fd5b50565b60008135905061418c81614166565b92915050565b600080604083850312156141a9576141a86139cc565b5b60006141b785828601613c19565b92505060206141c88582860161417d565b9150509250929050565b600067ffffffffffffffff8211156141ed576141ec613f38565b5b6141f682613ad7565b9050602081019050919050565b6000614216614211846141d2565b613f98565b90508281526020810184848401111561423257614231613f33565b5b61423d848285613fe4565b509392505050565b600082601f83011261425a57614259613f2e565b5b813561426a848260208601614203565b91505092915050565b6000806000806080858703121561428d5761428c6139cc565b5b600061429b87828801613c19565b94505060206142ac87828801613c19565b93505060406142bd87828801613b64565b925050606085013567ffffffffffffffff8111156142de576142dd6139d1565b5b6142ea87828801614245565b91505092959194509250565b6000806040838503121561430d5761430c6139cc565b5b600061431b85828601613c19565b925050602061432c85828601613c19565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061437d57607f821691505b6020821081036143905761438f614336565b5b50919050565b7f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560008201527f72206f7220617070726f76656400000000000000000000000000000000000000602082015250565b60006143f2602d83613a9c565b91506143fd82614396565b604082019050919050565b60006020820190508181036000830152614421816143e5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061446282613b43565b915061446d83613b43565b925082820261447b81613b43565b9150828204841483151761449257614491614428565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006144d382613b43565b91506144de83613b43565b9250826144ee576144ed614499565b5b828204905092915050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b6000614555602b83613a9c565b9150614560826144f9565b604082019050919050565b6000602082019050818103600083015261458481614548565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006145c582613b43565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036145f7576145f6614428565b5b600182019050919050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b600061465e602f83613a9c565b915061466982614602565b604082019050919050565b6000602082019050818103600083015261468d81614651565b9050919050565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b60006146f0602c83613a9c565b91506146fb82614694565b604082019050919050565b6000602082019050818103600083015261471f816146e3565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026147887fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261474b565b614792868361474b565b95508019841693508086168417925050509392505050565b60006147c56147c06147bb84613b43565b6140ac565b613b43565b9050919050565b6000819050919050565b6147df836147aa565b6147f36147eb826147cc565b848454614758565b825550505050565b600090565b6148086147fb565b6148138184846147d6565b505050565b5b818110156148375761482c600082614800565b600181019050614819565b5050565b601f82111561487c5761484d81614726565b6148568461473b565b81016020851015614865578190505b6148796148718561473b565b830182614818565b50505b505050565b600082821c905092915050565b600061489f60001984600802614881565b1980831691505092915050565b60006148b8838361488e565b9150826002028217905092915050565b6148d182613a91565b67ffffffffffffffff8111156148ea576148e9613f38565b5b6148f48254614365565b6148ff82828561483b565b600060209050601f8311600181146149325760008415614920578287015190505b61492a85826148ac565b865550614992565b601f19841661494086614726565b60005b8281101561496857848901518255600182019150602085019450602081019050614943565b868310156149855784890151614981601f89168261488e565b8355505b6001600288020188555050505b505050505050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b60006149d0601883613a9c565b91506149db8261499a565b602082019050919050565b600060208201905081810360008301526149ff816149c3565b9050919050565b614a0f816139d6565b82525050565b6000602082019050614a2a6000830184614a06565b92915050565b600081519050614a3f81614166565b92915050565b600060208284031215614a5b57614a5a6139cc565b5b6000614a6984828501614a30565b91505092915050565b7f636f6e747261637420646f6573206e6f7420696d706c656d656e742049526f7960008201527f616c7479416c6c6f776c69737400000000000000000000000000000000000000602082015250565b6000614ace602d83613a9c565b9150614ad982614a72565b604082019050919050565b60006020820190508181036000830152614afd81614ac1565b9050919050565b6000604082019050614b196000830185613bd8565b614b266020830184613bd8565b9392505050565b7f4552433732313a2061646472657373207a65726f206973206e6f74206120766160008201527f6c6964206f776e65720000000000000000000000000000000000000000000000602082015250565b6000614b89602983613a9c565b9150614b9482614b2d565b604082019050919050565b60006020820190508181036000830152614bb881614b7c565b9050919050565b600081905092915050565b6000614bd582613a91565b614bdf8185614bbf565b9350614bef818560208601613aad565b80840191505092915050565b6000614c078285614bca565b9150614c138284614bca565b91508190509392505050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b6000614c7b603283613a9c565b9150614c8682614c1f565b604082019050919050565b60006020820190508181036000830152614caa81614c6e565b9050919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b6000614d0d602183613a9c565b9150614d1882614cb1565b604082019050919050565b60006020820190508181036000830152614d3c81614d00565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b6000614d9f603d83613a9c565b9150614daa82614d43565b604082019050919050565b60006020820190508181036000830152614dce81614d92565b9050919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b6000614e0b601783614bbf565b9150614e1682614dd5565b601782019050919050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b6000614e57601183614bbf565b9150614e6282614e21565b601182019050919050565b6000614e7882614dfe565b9150614e848285614bca565b9150614e8f82614e4a565b9150614e9b8284614bca565b91508190509392505050565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b6000614edd602083613a9c565b9150614ee882614ea7565b602082019050919050565b60006020820190508181036000830152614f0c81614ed0565b9050919050565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b6000614f49601c83613a9c565b9150614f5482614f13565b602082019050919050565b60006020820190508181036000830152614f7881614f3c565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000614fa682614f7f565b614fb08185614f8a565b9350614fc0818560208601613aad565b614fc981613ad7565b840191505092915050565b6000608082019050614fe96000830187613bd8565b614ff66020830186613bd8565b6150036040830185613c6e565b81810360608301526150158184614f9b565b905095945050505050565b60008151905061502f81613a02565b92915050565b60006020828403121561504b5761504a6139cc565b5b600061505984828501615020565b91505092915050565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b60006150be602583613a9c565b91506150c982615062565b604082019050919050565b600060208201905081810360008301526150ed816150b1565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000615150602483613a9c565b915061515b826150f4565b604082019050919050565b6000602082019050818103600083015261517f81615143565b9050919050565b600061519182613b43565b915061519c83613b43565b92508282019050808211156151b4576151b3614428565b5b92915050565b60006151c582613b43565b9150600082036151d8576151d7614428565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b6000615219602083613a9c565b9150615224826151e3565b602082019050919050565b600060208201905081810360008301526152488161520c565b9050919050565b600061525a82613b43565b915061526583613b43565b925082820390508181111561527d5761527c614428565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f455243373231456e756d657261626c653a20636f6e736563757469766520747260008201527f616e7366657273206e6f7420737570706f727465640000000000000000000000602082015250565b600061530e603583613a9c565b9150615319826152b2565b604082019050919050565b6000602082019050818103600083015261533d81615301565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b600061537a601983613a9c565b915061538582615344565b602082019050919050565b600060208201905081810360008301526153a98161536d565b905091905056fea2646970667358221220f2de678fa1f1a3fc28d8056ba46769331f91c7536f9259f07a82f3f97942823964736f6c63430008110033";class X3 extends vl{constructor(...e){e.length>1?super(...e):super(K3,W3,e[0])}deploy(e,t,r,n,i,a,o,s){return super.deploy(e,t,r,n,i,a,o,s||{})}getDeployTransaction(e,t,r,n,i,a,o,s){return super.getDeployTransaction(e,t,r,n,i,a,o,s||{})}attach(e){return super.attach(e)}connect(e){return super.connect(e)}static bytecode=W3;static abi=K3;static createInterface(){return new Df(K3)}static connect(e,t){return new gl(e,K3,t)}}e.APIError=Zr,e.BlockchainData=class{config;activities;chains;collections;nfts;nftOwners;tokens;constructor(e){this.config=new nn(e),this.activities=new mt.ActivitiesApi(this.config.apiConfig),this.chains=new mt.ChainsApi(this.config.apiConfig),this.collections=new mt.CollectionsApi(this.config.apiConfig),this.nfts=new mt.NftsApi(this.config.apiConfig),this.nftOwners=new mt.NftOwnersApi(this.config.apiConfig),this.tokens=new mt.TokensApi(this.config.apiConfig)}async listActivities(e){return await this.activities.listActivities(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async getActivity(e){return await this.activities.getActivity(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async listChains(e){return await this.chains.listChains(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async listCollections(e){return await this.collections.listCollections(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async getCollection(e){return await this.collections.getCollection(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async getNFT(e){return await this.nfts.getNFT(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async listNFTs(e){return await this.nfts.listNFTs(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async listNFTsByAccountAddress(e){return await this.nfts.listNFTsByAccountAddress(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async listNFTOwners(e){return await this.nftOwners.listNFTOwners(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async listTokens(e){return await this.tokens.listERC20Tokens(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async getToken(e){return await this.tokens.getERC20Token(e).then((e=>e.data)).catch((e=>{throw an(e)}))}},e.BridgeReact=U3,e.CHECKOUT_API_BASE_URL=F5,e.Checkout=class{config;readOnlyProviders;constructor(e=h3){this.config=new u3(e),this.readOnlyProviders=new Map}async createProvider(e){return await Z5(e.walletProvider)}async checkIsWalletConnected(t){return async function(t){if(!t?.provider?.request)throw new V5("Check wallet connection request failed",e.CheckoutErrorType.PROVIDER_REQUEST_FAILED_ERROR,{rpcMethod:P5.CHECK_CONNECTION});let r=[];try{r=await t.provider.request({method:P5.CHECK_CONNECTION,params:[]})}catch(t){throw new V5("Check wallet connection request failed",e.CheckoutErrorType.PROVIDER_REQUEST_FAILED_ERROR,{rpcMethod:P5.CHECK_CONNECTION})}return{isConnected:r&&r.length>0,walletAddress:r[0]??""}}(await t3(this.config,t.provider,{allowUnsupportedProvider:!0}))}async connect(t){const r=await t3(this.config,t.provider,{allowUnsupportedProvider:!0});await async function(t){return await G5((async()=>{if(!t||!t?.provider?.request)throw new V5("Incompatible provider",e.CheckoutErrorType.PROVIDER_REQUEST_MISSING_ERROR,{details:"Attempting to connect with an incompatible provider"});await t.provider.request({method:P5.CONNECT,params:[]})}),{type:e.CheckoutErrorType.USER_REJECTED_REQUEST_ERROR}),t}(r);return{provider:r,network:await X5(this.config,r)}}async switchNetwork(e){const t=await t3(this.config,e.provider,{allowUnsupportedProvider:!0,allowMistmatchedChainId:!0});return await $5(this.config,t,e.chainId)}async getBalance(e){const t=await t3(this.config,e.provider);return e.contractAddress&&""!==e.contractAddress?await Q5(t,e.walletAddress,e.contractAddress):await Y5(this.config,t,e.walletAddress)}async getAllBalances(t){const r=await t3(this.config,t.provider);return(async(t,r,n,i)=>{const a=await J5(t,{type:e.TokenFilterTypes.ALL,chainId:i}),o=[];return o.push(Y5(t,r,n)),a.tokens.filter((e=>e.address)).forEach((e=>o.push(Q5(r,n,e.address??"")))),{balances:(await Promise.allSettled(o)).filter((e=>"fulfilled"===e.status)).map((e=>e.value))}})(this.config,r,t.walletAddress,t.chainId)}async getNetworkAllowList(e){return await W5(this.config,e)}async getTokenAllowList(e){return await J5(this.config,e)}async getWalletAllowList(t){return await async function(t){const r=[],n=t.exclude?.map((e=>e.walletProvider))??[];let i=Object.values(e.WalletProviderName);0!==n.length&&(i=i.filter((e=>!n.includes(e))));for(const e of i)r.push({walletProvider:e,name:e});return{wallets:r}}(t)}async sendTransaction(t){const r=await t3(this.config,t.provider);return await(async(t,r)=>{try{return{transactionResponse:await t.getSigner().sendTransaction(r)}}catch(t){if(t.code===Pb.errors.INSUFFICIENT_FUNDS)throw new V5(t.message,e.CheckoutErrorType.INSUFFICIENT_FUNDS);if(t.code===Pb.errors.ACTION_REJECTED)throw new V5(t.message,e.CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);if(t.code===Pb.errors.UNPREDICTABLE_GAS_LIMIT)throw new V5(t.message,e.CheckoutErrorType.UNPREDICTABLE_GAS_LIMIT);throw new V5(t.message,e.CheckoutErrorType.TRANSACTION_FAILED)}})(r,t.transaction)}async getNetworkInfo(e){const t=await t3(this.config,e.provider,{allowUnsupportedProvider:!0,allowMistmatchedChainId:!0});return await X5(this.config,t)}static isWeb3Provider(e){return e3(e)}async gasEstimate(t){return this.readOnlyProviders=await async function(t,r){if(t.isProduction&&r?.has(e.ChainId.ETHEREUM))return r;if(r?.has(e.ChainId.SEPOLIA))return r;const n=new Map;return(await W5(t,{type:e.NetworkFilterTypes.ALL})).networks.forEach((e=>{const r=t.networkMap.get(e.chainId)?.rpcUrls[0],i=new om(r);n.set(e.chainId,i)})),n}(this.config,this.readOnlyProviders),await async function(t,r,n){switch(t.gasEstimateType){case e.GasEstimateType.BRIDGE_TO_L2:return await l3(r,n,t.isSpendingCapApprovalRequired,t.tokenAddress);case e.GasEstimateType.SWAP:return await p3(n);default:throw new V5("Invalid type provided for gasEstimateType",e.CheckoutErrorType.INVALID_GAS_ESTIMATE_TYPE)}}(t,this.readOnlyProviders,this.config)}},e.CheckoutWidgets=function(e){if(void 0===window)return void console.error("missing window object: please run Checkout client side");if(void 0===document)return void console.error("missing document object: please run Checkout client side");const t=document.createElement("script"),r=function(e){const t=R3();if(void 0===e)return t;if(void 0===e.major||void 0===e.minor||void 0===e.patch||void 0===e.prerelease)return t;if(e.major<0)return t;if(e.minor<0)return t;if(e.patch<0)return t;if("alpha"!==e.prerelease)return t;if(0===e.major&&0===e.minor&&0===e.patch)return t;let r=t;return!Number.isNaN(e.major)&&e.major>=0&&(r=e.major.toString()),Number.isNaN(e.minor)||(r+=`.${e.minor.toString()}`),Number.isNaN(e.patch)||(r+=`.${e.patch.toString()}`),r+=`-${e.prerelease}`,void 0!==e.build&&e.build>0&&(r+=`.${e.build}`),r}(e?.version);let n=`https://cdn.jsdelivr.net/npm/@imtbl/sdk@${r}/dist/browser/checkout.js`;t.setAttribute("src",n),document.head.appendChild(t),window.ImtblCheckoutWidgetConfig=JSON.stringify(e)},e.ConnectReact=j3,e.ERC20=class{contract;constructor(e){const t=new G3;this.contract=t.attach(e)}async totalSupply(e,t={}){return this.contract.connect(e).totalSupply(t)}async balanceOf(e,t,r={}){return this.contract.connect(e).balanceOf(t,r)}async allowance(e,t,r,n={}){return this.contract.connect(e).allowance(t,r,n)}async populateTransfer(e,t,r){return this.contract.populateTransaction.transfer(e,t,r)}async populateApprove(e,t,r={}){return this.contract.populateTransaction.approve(e,t,r)}async populateTransferFrom(e,t,r,n={}){return this.contract.populateTransaction.transferFrom(e,t,r,n)}},e.ERC721PermissionedMintable=class{contract;constructor(e){const t=new X3;this.contract=t.attach(e)}async DEFAULT_ADMIN_ROLE(e,t={}){return await this.contract.connect(e).DEFAULT_ADMIN_ROLE(t)}async MINTER_ROLE(e,t={}){return await this.contract.connect(e).MINTER_ROLE(t)}async balanceOf(e,t,r={}){return await this.contract.connect(e).balanceOf(t,r)}async baseURI(e,t={}){return await this.contract.connect(e).baseURI(t)}async contractURI(e,t={}){return await this.contract.connect(e).contractURI(t)}async getAdmins(e,t={}){return await this.contract.connect(e).getAdmins(t)}async getApproved(e,t,r={}){return await this.contract.connect(e).getApproved(t,r)}async getRoleAdmin(e,t,r={}){return await this.contract.connect(e).getRoleAdmin(t,r)}async getRoleMember(e,t,r,n={}){return await this.contract.connect(e).getRoleMember(t,r,n)}async getRoleMemberCount(e,t,r={}){return await this.contract.connect(e).getRoleMemberCount(t,r)}async hasRole(e,t,r,n={}){return await this.contract.connect(e).hasRole(t,r,n)}async isApprovedForAll(e,t,r,n={}){return await this.contract.connect(e).isApprovedForAll(t,r,n)}async name(e,t={}){return await this.contract.connect(e).name(t)}async ownerOf(e,t,r={}){return await this.contract.connect(e).ownerOf(t,r)}async royaltyAllowlist(e,t={}){return await this.contract.connect(e).royaltyAllowlist(t)}async royaltyInfo(e,t,r,n={}){return await this.contract.connect(e).royaltyInfo(t,r,n)}async symbol(e,t={}){return await this.contract.connect(e).symbol(t)}async tokenByIndex(e,t,r={}){return await this.contract.connect(e).tokenByIndex(t,r)}async tokenOfOwnerByIndex(e,t,r,n={}){return await this.contract.connect(e).tokenOfOwnerByIndex(t,r,n)}async tokenURI(e,t,r={}){return await this.contract.connect(e).tokenURI(t,r)}async totalSupply(e,t={}){return await this.contract.connect(e).totalSupply(t)}async populateApprove(e,t,r={}){return await this.contract.populateTransaction.approve(e,t,r)}async populateBurn(e,t={}){return await this.contract.populateTransaction.burn(e,t)}async populateGrantMinterRole(e,t={}){return await this.contract.populateTransaction.grantMinterRole(e,t)}async populateGrantRole(e,t,r={}){return await this.contract.populateTransaction.grantRole(e,t,r)}async populateMint(e,t,r={}){return await this.contract.populateTransaction.mint(e,t,r)}async populateRenounceRole(e,t,r={}){return await this.contract.populateTransaction.renounceRole(e,t,r)}async populateRevokeMinterRole(e,t={}){return await this.contract.populateTransaction.revokeMinterRole(e,t)}async populateRevokeRole(e,t,r={}){return await this.contract.populateTransaction.revokeRole(e,t,r)}async"populateSafeTransferFrom(address,address,uint256)"(e,t,r,n={}){return await this.contract.populateTransaction["safeTransferFrom(address,address,uint256)"](e,t,r,n)}async"populateSafeTransferFrom(address,address,uint256,bytes)"(e,t,r,n,i={}){return await this.contract.populateTransaction["safeTransferFrom(address,address,uint256,bytes)"](e,t,r,n,i)}async populateSetApprovalForAll(e,t,r={}){return await this.contract.populateTransaction.setApprovalForAll(e,t,r)}async populateSetBaseURI(e,t={}){return await this.contract.populateTransaction.setBaseURI(e,t)}async populateSetContractURI(e,t={}){return await this.contract.populateTransaction.setContractURI(e,t)}async populateSetRoyaltyAllowlistRegistry(e,t={}){return await this.contract.populateTransaction.setRoyaltyAllowlistRegistry(e,t)}},e.GenericIMXProvider=EX,e.ImmutableConfiguration=t,e.ImmutableXClient=nD,e.JsonRpcError=$z,e.MetaMaskIMXProvider=UX,e.Orderbook=class{apiClient;seaport;orderbookConfig;constructor(t){const r={...function(t){switch(t){case e.Environment.SANDBOX:return{seaportContractAddress:"0x474989C4D25DD41B0B9b1ECb4643B9Fe25f83B19",zoneContractAddress:"0x6FeDb4949E5b452700A8a8956999a7E05B6770F3",apiEndpoint:"https://order-book-mr.sandbox.imtbl.com",chainName:"imtbl-zkevm-testnet",provider:new om("https://zkevm-rpc.sandbox.x.immutable.com")};case e.Environment.PRODUCTION:return{seaportContractAddress:"",zoneContractAddress:"",apiEndpoint:"https://order-book-mr.imtbl.com",chainName:"imtbl-zkevm-mainnet",provider:new om("https://zkevm-rpc.x.immutable.com")};default:return null}}(t.baseConfig.environment),...t.overrides};if(!r)throw new Error("Orderbook configuration not passed, please specify the environment under config.baseConfig.environment");this.orderbookConfig=r;const{apiEndpoint:n,chainName:i}=this.orderbookConfig;if(!n)throw new Error("API endpoint must be provided");this.apiClient=new eX(n,i,this.orderbookConfig.seaportContractAddress).create();const a=new aX(this.orderbookConfig.seaportContractAddress,this.orderbookConfig.provider);this.seaport=new QW(a,this.orderbookConfig.provider,this.orderbookConfig.seaportContractAddress,this.orderbookConfig.zoneContractAddress)}getListing(e){return this.apiClient.getListing(e)}listListings(e){return this.apiClient.listListings(e)}async prepareListing({makerAddress:e,sell:t,buy:r,orderExpiry:n}){const i=new iX(t.contractAddress,this.orderbookConfig.provider).create(),a=await i.royaltyInfo(t.tokenId,r.amount);return this.seaport.prepareSeaportOrder(e,t,r,a,new Date,n||new Date(Date.now()+63072e6))}createListing(e){return this.apiClient.createListing(e)}async fulfillOrder(e,t){const r=await this.apiClient.getListing(e);if(r.result.status!==VW.ACTIVE)throw new Error(`Cannot fulfil order that is not active. Current status: ${r.result.status}`);return this.seaport.fulfilOrder(r.result,t)}async cancelOrder(e,t){const r=await this.apiClient.getListing(e);if(r.result.status!==VW.ACTIVE&&r.result.status!==VW.INACTIVE&&r.result.status!==VW.PENDING)throw new Error(`Cannot cancel order with status ${r.result.status}`);if(r.result.account_address!==t.toLowerCase())throw new Error(`Only account ${r.result.account_address} can cancel order ${e}`);return{unsignedCancelOrderTransaction:await this.seaport.cancelOrder(r.result,t)}}},e.Passport=class{authManager;config;confirmationScreen;immutableXClient;magicAdapter;passportImxProviderFactory;multiRollupApiClients;constructor(e){this.config=new iH(e),this.authManager=new zz(this.config),this.magicAdapter=new Hz(this.config),this.confirmationScreen=new dH(this.config),this.immutableXClient=e.overrides?.immutableXClient||new nD({baseConfig:e.baseConfig}),this.multiRollupApiClients=new bt(this.config.multiRollupConfig),this.passportImxProviderFactory=new tH({authManager:this.authManager,config:this.config,confirmationScreen:this.confirmationScreen,immutableXClient:this.immutableXClient,magicAdapter:this.magicAdapter})}async connectImxSilent(){return this.passportImxProviderFactory.getProviderSilent()}async connectImx(){return this.passportImxProviderFactory.getProvider()}async loginWithDeviceFlow(){return this.authManager.loginWithDeviceFlow()}async connectImxDeviceFlow(e,t,r){return this.passportImxProviderFactory.getProviderWithDeviceFlow(e,t,r)}getPKCEAuthorizationUrl(){return this.authManager.getPKCEAuthorizationUrl()}async connectImxPKCEFlow(e,t){return this.passportImxProviderFactory.getProviderWithPKCEFlow(e,t)}checkStoredDeviceFlowCredentials(){return this.authManager.checkStoredDeviceFlowCredentials()}async connectImxWithCredentials(e){return this.passportImxProviderFactory.getProviderWithCredentials(e)}connectEvm(){return new gH({authManager:this.authManager,magicAdapter:this.magicAdapter,config:this.config,confirmationScreen:this.confirmationScreen,multiRollupApiClients:this.multiRollupApiClients})}async loginCallback(){return this.authManager.loginCallback()}async logout(){return this.authManager.logout()}async logoutSilentCallback(e){return this.authManager.logoutSilentCallback(e)}async logoutDeviceFlow(){return this.authManager.logoutDeviceFlow()}async getUserInfo(){const e=await this.authManager.getUser();return e?.profile}async getUserInfoDeviceFlow(){const e=await this.authManager.getUserDeviceFlow();return e?.profile}async getIdToken(){const e=await this.authManager.getUser();return e?.idToken}async getAccessToken(){const e=await this.authManager.getUser();return e?.accessToken}},e.PassportError=Mz,e.ProviderConfiguration=class{immutableXConfig;baseConfig;constructor({baseConfig:t,overrides:r}){if(this.baseConfig=t,r)this.immutableXConfig=r.immutableXConfig;else switch(t.environment){case e.Environment.SANDBOX:this.immutableXConfig=jB.SANDBOX;break;case e.Environment.PRODUCTION:this.immutableXConfig=jB.PRODUCTION}}},e.SwapReact=q3,e.UpdateConfig=function(e){void 0!==window?window.ImtblCheckoutWidgetConfig=JSON.stringify(e):console.error("missing document object: please run Checkout client side")},e.WalletReact=z3,e.imxClientCreateStarkSigner=DC,e.imxClientGenerateLegacyStarkPrivateKey=QB,e.module="orderbook"}));
84
+ */"production"===process.env.NODE_ENV?b3.exports=function(){if(E3)return y3;E3=1;var e=T3,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function o(e,r,o){var s,f={},u=null,c=null;for(s in void 0!==o&&(u=""+o),void 0!==r.key&&(u=""+r.key),void 0!==r.ref&&(c=r.ref),r)n.call(r,s)&&!a.hasOwnProperty(s)&&(f[s]=r[s]);if(e&&e.defaultProps)for(s in r=e.defaultProps)void 0===f[s]&&(f[s]=r[s]);return{$$typeof:t,type:e,key:u,ref:c,props:f,_owner:i.current}}return y3.Fragment=r,y3.jsx=o,y3.jsxs=o,y3}():b3.exports=(A3||(A3=1,"production"!==process.env.NODE_ENV&&function(){var e=T3,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator",b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];!function(e,t,r){var n=b.ReactDebugCurrentFrame.getStackAddendum();""!==n&&(t+="%s",r=r.concat([n]));var i=r.map((function(e){return String(e)}));i.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,i)}("error",e,r)}var g,v=!1,w=!1,_=!1,E=!1,T=!1;function A(e){return e.displayName||"Context"}function S(e){if(null==e)return null;if("number"==typeof e.tag&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case n:return"Fragment";case r:return"Portal";case a:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case s:return A(e)+".Consumer";case o:return A(e._context)+".Provider";case f:return function(e,t,r){var n=e.displayName;if(n)return n;var i=t.displayName||t.name||"";return""!==i?r+"("+i+")":r}(e,e.render,"ForwardRef");case d:var t=e.displayName||null;return null!==t?t:S(e.type)||"Memo";case l:var p=e,h=p._payload,m=p._init;try{return S(m(h))}catch(e){return null}}return null}g=Symbol.for("react.module.reference");var k,O,R,x,I,C,N,P=Object.assign,M=0;function B(){}B.__reactDisabledLog=!0;var D,F=b.ReactCurrentDispatcher;function L(e,t,r){if(void 0===D)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);D=n&&n[1]||""}return"\n"+D+e}var U,j=!1,q="function"==typeof WeakMap?WeakMap:Map;function z(e,t){if(!e||j)return"";var r,n=U.get(e);if(void 0!==n)return n;j=!0;var i,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,i=F.current,F.current=null,function(){if(0===M){k=console.log,O=console.info,R=console.warn,x=console.error,I=console.group,C=console.groupCollapsed,N=console.groupEnd;var e={configurable:!0,enumerable:!0,value:B,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}M++}();try{if(t){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(o,[])}catch(e){r=e}Reflect.construct(e,[],o)}else{try{o.call()}catch(e){r=e}e.call(o.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),f=r.stack.split("\n"),u=s.length-1,c=f.length-1;u>=1&&c>=0&&s[u]!==f[c];)c--;for(;u>=1&&c>=0;u--,c--)if(s[u]!==f[c]){if(1!==u||1!==c)do{if(u--,--c<0||s[u]!==f[c]){var d="\n"+s[u].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),"function"==typeof e&&U.set(e,d),d}}while(u>=1&&c>=0);break}}}finally{j=!1,F.current=i,function(){if(0==--M){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},e,{value:k}),info:P({},e,{value:O}),warn:P({},e,{value:R}),error:P({},e,{value:x}),group:P({},e,{value:I}),groupCollapsed:P({},e,{value:C}),groupEnd:P({},e,{value:N})})}M<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var l=e?e.displayName||e.name:"",p=l?L(l):"";return"function"==typeof e&&U.set(e,p),p}function H(e,t,r){if(null==e)return"";if("function"==typeof e)return z(e,function(e){var t=e.prototype;return!(!t||!t.isReactComponent)}(e));if("string"==typeof e)return L(e);switch(e){case u:return L("Suspense");case c:return L("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case f:return function(e,t,r){return z(e,!1)}(e.render);case d:return H(e.type,t,r);case l:var n=e,i=n._payload,a=n._init;try{return H(a(i),t,r)}catch(e){}}return""}U=new q;var V=Object.prototype.hasOwnProperty,G={},K=b.ReactDebugCurrentFrame;function W(e){if(e){var t=e._owner,r=H(e.type,e._source,t?t.type:null);K.setExtraStackFrame(r)}else K.setExtraStackFrame(null)}var X=Array.isArray;function $(e){return X(e)}function J(e){return""+e}function Y(e){if(function(e){try{return J(e),!1}catch(e){return!0}}(e))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),J(e)}var Q,Z,ee,te=b.ReactCurrentOwner,re={key:!0,ref:!0,__self:!0,__source:!0};ee={};var ne=function(e,r,n,i,a,o,s){var f={$$typeof:t,type:e,key:r,ref:n,props:s,_owner:o,_store:{}};return Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(f,"_self",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.defineProperty(f,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f};function ie(e,t,r,n,i){var a,o={},s=null,f=null;for(a in void 0!==r&&(Y(r),s=""+r),function(e){if(V.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(Y(t.key),s=""+t.key),function(e){if(V.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(f=t.ref,function(e,t){if("string"==typeof e.ref&&te.current&&t&&te.current.stateNode!==t){var r=S(te.current.type);ee[r]||(y('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',S(te.current.type),e.ref),ee[r]=!0)}}(t,i)),t)V.call(t,a)&&!re.hasOwnProperty(a)&&(o[a]=t[a]);if(e&&e.defaultProps){var u=e.defaultProps;for(a in u)void 0===o[a]&&(o[a]=u[a])}if(s||f){var c="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,t){var r=function(){Q||(Q=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(o,c),f&&function(e,t){var r=function(){Z||(Z=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(o,c)}return ne(e,s,f,i,n,te.current,o)}var ae,oe=b.ReactCurrentOwner,se=b.ReactDebugCurrentFrame;function fe(e){if(e){var t=e._owner,r=H(e.type,e._source,t?t.type:null);se.setExtraStackFrame(r)}else se.setExtraStackFrame(null)}function ue(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}function ce(){if(oe.current){var e=S(oe.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}ae=!1;var de={};function le(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=ce();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!de[r]){de[r]=!0;var n="";e&&e._owner&&e._owner!==oe.current&&(n=" It was passed a child from "+S(e._owner.type)+"."),fe(e),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,n),fe(null)}}}function pe(e,t){if("object"==typeof e)if($(e))for(var r=0;r<e.length;r++){var n=e[r];ue(n)&&le(n,t)}else if(ue(e))e._store&&(e._store.validated=!0);else if(e){var i=function(e){if(null===e||"object"!=typeof e)return null;var t=h&&e[h]||e[m];return"function"==typeof t?t:null}(e);if("function"==typeof i&&i!==e.entries)for(var a,o=i.call(e);!(a=o.next()).done;)ue(a.value)&&le(a.value,t)}}function he(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==f&&r.$$typeof!==d)return;t=r.propTypes}if(t){var n=S(r);!function(e,t,r,n,i){var a=Function.call.bind(V);for(var o in e)if(a(e,o)){var s=void 0;try{if("function"!=typeof e[o]){var f=Error((n||"React class")+": "+r+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}s=e[o](t,o,n,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(W(i),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",r,o,typeof s),W(null)),s instanceof Error&&!(s.message in G)&&(G[s.message]=!0,W(i),y("Failed %s type: %s",r,s.message),W(null))}}(t,e.props,"prop",n,e)}else void 0===r.PropTypes||ae||(ae=!0,y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",S(r)||"Unknown"));"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function me(e,r,h,m,b,A){var k=function(e){return"string"==typeof e||"function"==typeof e||!!(e===n||e===a||T||e===i||e===u||e===c||E||e===p||v||w||_)||"object"==typeof e&&null!==e&&(e.$$typeof===l||e.$$typeof===d||e.$$typeof===o||e.$$typeof===s||e.$$typeof===f||e.$$typeof===g||void 0!==e.getModuleId)}(e);if(!k){var O="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(O+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var R,x=function(e){return void 0!==e?"\n\nCheck your code at "+e.fileName.replace(/^.*[\\\/]/,"")+":"+e.lineNumber+".":""}(b);O+=x||ce(),null===e?R="null":$(e)?R="array":void 0!==e&&e.$$typeof===t?(R="<"+(S(e.type)||"Unknown")+" />",O=" Did you accidentally export a JSX literal instead of a component?"):R=typeof e,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",R,O)}var I=ie(e,r,h,b,A);if(null==I)return I;if(k){var C=r.children;if(void 0!==C)if(m)if($(C)){for(var N=0;N<C.length;N++)pe(C[N],e);Object.freeze&&Object.freeze(C)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else pe(C,e)}return e===n?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var n=t[r];if("children"!==n&&"key"!==n){fe(e),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),fe(null);break}}null!==e.ref&&(fe(e),y("Invalid attribute `ref` supplied to `React.Fragment`."),fe(null))}(I):he(I),I}var be=function(e,t,r){return me(e,t,r,!1)},ye=function(e,t,r){return me(e,t,r,!0)};S3.Fragment=n,S3.jsx=be,S3.jsxs=ye}()),S3);var k3=b3.exports;function O3(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}const R3=()=>"0.4.1-alpha.1";var x3;O3({},"IMTBLWidgetEvents",(()=>e.IMTBLWidgetEvents)),e.IMTBLWidgetEvents=void 0,(x3=e.IMTBLWidgetEvents||(e.IMTBLWidgetEvents={})).IMTBL_CONNECT_WIDGET_EVENT="imtbl-connect-widget",x3.IMTBL_WALLET_WIDGET_EVENT="imtbl-wallet-widget",x3.IMTBL_SWAP_WIDGET_EVENT="imtbl-swap-widget",x3.IMTBL_BRIDGE_WIDGET_EVENT="imtbl-bridge-widget";var I3;O3({},"ConnectEventType",(()=>e.ConnectEventType)),e.ConnectEventType=void 0,(I3=e.ConnectEventType||(e.ConnectEventType={})).CLOSE_WIDGET="close-widget",I3.SUCCESS="success",I3.FAILURE="failure";var C3;O3({},"WalletEventType",(()=>e.WalletEventType)),e.WalletEventType=void 0,(C3=e.WalletEventType||(e.WalletEventType={})).CLOSE_WIDGET="close-widget",C3.NETWORK_SWITCH="network-switch",C3.DISCONNECT_WALLET="disconnect-wallet";var N3;O3({},"SwapEventType",(()=>e.SwapEventType)),e.SwapEventType=void 0,(N3=e.SwapEventType||(e.SwapEventType={})).CLOSE_WIDGET="close-widget",N3.SUCCESS="success",N3.FAILURE="failure",N3.REJECTED="rejected";var P3;O3({},"BridgeEventType",(()=>e.BridgeEventType)),e.BridgeEventType=void 0,(P3=e.BridgeEventType||(e.BridgeEventType={})).CLOSE_WIDGET="close-widget",P3.SUCCESS="success",P3.FAILURE="failure";var M3;O3({},"OrchestrationEventType",(()=>e.OrchestrationEventType)),e.OrchestrationEventType=void 0,(M3=e.OrchestrationEventType||(e.OrchestrationEventType={})).REQUEST_CONNECT="request-connect",M3.REQUEST_WALLET="request-wallet",M3.REQUEST_SWAP="request-swap",M3.REQUEST_BRIDGE="request-bridge",M3.REQUEST_ONRAMP="request-onramp";var B3,D3,F3={};O3(F3,"WidgetTheme",(()=>e.WidgetTheme)),O3(F3,"CheckoutWidgetTagNames",(()=>e.CheckoutWidgetTagNames)),e.WidgetTheme=void 0,(B3=e.WidgetTheme||(e.WidgetTheme={})).LIGHT="light",B3.DARK="dark",B3.CUSTOM="custom",e.CheckoutWidgetTagNames=void 0,(D3=e.CheckoutWidgetTagNames||(e.CheckoutWidgetTagNames={})).CONNECT="imtbl-connect",D3.WALLET="imtbl-wallet",D3.SWAP="imtbl-swap",D3.BRIDGE="imtbl-bridge";function L3(e,t){if(!t)return void console.error("no provider parsed");if(void 0===window)return void console.error("missing window object: please run Checkout client side");let r=0;let n;const i=()=>{try{const r=document.getElementsByTagName(e);r[0].setProvider(t),window.clearInterval(n)}catch(e){r++,r>=10&&(window.clearInterval(n),console.error("failed to set the provider"))}};n=window.setInterval(i,10),i()}function U3(t){const{walletProvider:r,fromContractAddress:n,amount:i,provider:a}=t;T3.useEffect((()=>{a&&L3(e.CheckoutWidgetTagNames.BRIDGE,a)}),[a]);const o=window.ImtblCheckoutWidgetConfig;return k3.jsx("imtbl-bridge",{widgetConfig:o,walletProvider:r,fromContractAddress:n??"",amount:i??""})}O3({},"BridgeReact",(()=>U3));function j3(){const e=window.ImtblCheckoutWidgetConfig;return k3.jsx("imtbl-connect",{widgetConfig:e})}O3({},"ConnectReact",(()=>j3));function q3(t){const{walletProvider:r,fromContractAddress:n,amount:i,toContractAddress:a,provider:o}=t;T3.useEffect((()=>{o&&L3(e.CheckoutWidgetTagNames.SWAP,o)}),[o]);const s=window.ImtblCheckoutWidgetConfig;return k3.jsx("imtbl-swap",{widgetConfig:s,walletProvider:r,fromContractAddress:n??"",toContractAddress:a??"",amount:i??""})}O3({},"SwapReact",(()=>q3));function z3(t){const{walletProvider:r,provider:n}=t;T3.useEffect((()=>{n&&L3(e.CheckoutWidgetTagNames.WALLET,n)}),[n]);const i=window.ImtblCheckoutWidgetConfig;return k3.jsx("imtbl-wallet",{widgetConfig:i,walletProvider:r})}O3({},"WalletReact",(()=>z3));const H3=[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],V3="0x60806040523480156200001157600080fd5b50604051620017ec380380620017ec8339818101604052810190620000379190620001f6565b8160039081620000489190620004c6565b5080600490816200005a9190620004c6565b505050620005ad565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620000cc8262000081565b810181811067ffffffffffffffff82111715620000ee57620000ed62000092565b5b80604052505050565b60006200010362000063565b9050620001118282620000c1565b919050565b600067ffffffffffffffff82111562000134576200013362000092565b5b6200013f8262000081565b9050602081019050919050565b60005b838110156200016c5780820151818401526020810190506200014f565b60008484015250505050565b60006200018f620001898462000116565b620000f7565b905082815260208101848484011115620001ae57620001ad6200007c565b5b620001bb8482856200014c565b509392505050565b600082601f830112620001db57620001da62000077565b5b8151620001ed84826020860162000178565b91505092915050565b6000806040838503121562000210576200020f6200006d565b5b600083015167ffffffffffffffff81111562000231576200023062000072565b5b6200023f85828601620001c3565b925050602083015167ffffffffffffffff81111562000263576200026262000072565b5b6200027185828601620001c3565b9150509250929050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620002ce57607f821691505b602082108103620002e457620002e362000286565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026200034e7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200030f565b6200035a86836200030f565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620003a7620003a16200039b8462000372565b6200037c565b62000372565b9050919050565b6000819050919050565b620003c38362000386565b620003db620003d282620003ae565b8484546200031c565b825550505050565b600090565b620003f2620003e3565b620003ff818484620003b8565b505050565b5b8181101562000427576200041b600082620003e8565b60018101905062000405565b5050565b601f82111562000476576200044081620002ea565b6200044b84620002ff565b810160208510156200045b578190505b620004736200046a85620002ff565b83018262000404565b50505b505050565b600082821c905092915050565b60006200049b600019846008026200047b565b1980831691505092915050565b6000620004b6838362000488565b9150826002028217905092915050565b620004d1826200027b565b67ffffffffffffffff811115620004ed57620004ec62000092565b5b620004f98254620002b5565b620005068282856200042b565b600060209050601f8311600181146200053e576000841562000529578287015190505b620005358582620004a8565b865550620005a5565b601f1984166200054e86620002ea565b60005b82811015620005785784890151825560018201915060208501945060208101905062000551565b8683101562000598578489015162000594601f89168262000488565b8355505b6001600288020188555050505b505050505050565b61122f80620005bd6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610b0c565b60405180910390f35b6100e660048036038101906100e19190610bc7565b610308565b6040516100f39190610c22565b60405180910390f35b61010461032b565b6040516101119190610c4c565b60405180910390f35b610134600480360381019061012f9190610c67565b610335565b6040516101419190610c22565b60405180910390f35b610152610364565b60405161015f9190610cd6565b60405180910390f35b610182600480360381019061017d9190610bc7565b61036d565b60405161018f9190610c22565b60405180910390f35b6101b260048036038101906101ad9190610cf1565b6103a4565b6040516101bf9190610c4c565b60405180910390f35b6101d06103ec565b6040516101dd9190610b0c565b60405180910390f35b61020060048036038101906101fb9190610bc7565b61047e565b60405161020d9190610c22565b60405180910390f35b610230600480360381019061022b9190610bc7565b6104f5565b60405161023d9190610c22565b60405180910390f35b610260600480360381019061025b9190610d1e565b610518565b60405161026d9190610c4c565b60405180910390f35b60606003805461028590610d8d565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190610d8d565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b60008061031361059f565b90506103208185856105a7565b600191505092915050565b6000600254905090565b60008061034061059f565b905061034d858285610770565b6103588585856107fc565b60019150509392505050565b60006012905090565b60008061037861059f565b905061039981858561038a8589610518565b6103949190610ded565b6105a7565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546103fb90610d8d565b80601f016020809104026020016040519081016040528092919081815260200182805461042790610d8d565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60008061048961059f565b905060006104978286610518565b9050838110156104dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d390610e93565b60405180910390fd5b6104e982868684036105a7565b60019250505092915050565b60008061050061059f565b905061050d8185856107fc565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060d90610f25565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067c90610fb7565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107639190610c4c565b60405180910390a3505050565b600061077c8484610518565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107f657818110156107e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107df90611023565b60405180910390fd5b6107f584848484036105a7565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361086b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610862906110b5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d190611147565b60405180910390fd5b6108e5838383610a72565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561096b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610962906111d9565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a599190610c4c565b60405180910390a3610a6c848484610a77565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ab6578082015181840152602081019050610a9b565b60008484015250505050565b6000601f19601f8301169050919050565b6000610ade82610a7c565b610ae88185610a87565b9350610af8818560208601610a98565b610b0181610ac2565b840191505092915050565b60006020820190508181036000830152610b268184610ad3565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610b5e82610b33565b9050919050565b610b6e81610b53565b8114610b7957600080fd5b50565b600081359050610b8b81610b65565b92915050565b6000819050919050565b610ba481610b91565b8114610baf57600080fd5b50565b600081359050610bc181610b9b565b92915050565b60008060408385031215610bde57610bdd610b2e565b5b6000610bec85828601610b7c565b9250506020610bfd85828601610bb2565b9150509250929050565b60008115159050919050565b610c1c81610c07565b82525050565b6000602082019050610c376000830184610c13565b92915050565b610c4681610b91565b82525050565b6000602082019050610c616000830184610c3d565b92915050565b600080600060608486031215610c8057610c7f610b2e565b5b6000610c8e86828701610b7c565b9350506020610c9f86828701610b7c565b9250506040610cb086828701610bb2565b9150509250925092565b600060ff82169050919050565b610cd081610cba565b82525050565b6000602082019050610ceb6000830184610cc7565b92915050565b600060208284031215610d0757610d06610b2e565b5b6000610d1584828501610b7c565b91505092915050565b60008060408385031215610d3557610d34610b2e565b5b6000610d4385828601610b7c565b9250506020610d5485828601610b7c565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610da557607f821691505b602082108103610db857610db7610d5e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df882610b91565b9150610e0383610b91565b9250828201905080821115610e1b57610e1a610dbe565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000610e7d602583610a87565b9150610e8882610e21565b604082019050919050565b60006020820190508181036000830152610eac81610e70565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000610f0f602483610a87565b9150610f1a82610eb3565b604082019050919050565b60006020820190508181036000830152610f3e81610f02565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000610fa1602283610a87565b9150610fac82610f45565b604082019050919050565b60006020820190508181036000830152610fd081610f94565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061100d601d83610a87565b915061101882610fd7565b602082019050919050565b6000602082019050818103600083015261103c81611000565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061109f602583610a87565b91506110aa82611043565b604082019050919050565b600060208201905081810360008301526110ce81611092565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611131602383610a87565b915061113c826110d5565b604082019050919050565b6000602082019050818103600083015261116081611124565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006111c3602683610a87565b91506111ce82611167565b604082019050919050565b600060208201905081810360008301526111f2816111b6565b905091905056fea26469706673582212204188b273199f085e1921ec1a1fa55abdee2e425960bda675a51fac85acd9972064736f6c63430008110033";class G3 extends vl{constructor(...e){e.length>1?super(...e):super(H3,V3,e[0])}deploy(e,t,r){return super.deploy(e,t,r||{})}getDeployTransaction(e,t,r){return super.getDeployTransaction(e,t,r||{})}attach(e){return super.attach(e)}connect(e){return super.connect(e)}static bytecode=V3;static abi=H3;static createInterface(){return new Df(H3)}static connect(e,t){return new gl(e,H3,t)}}const K3=[{inputs:[{internalType:"address",name:"owner_",type:"address"},{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"string",name:"baseURI_",type:"string"},{internalType:"string",name:"contractURI_",type:"string"},{internalType:"address",name:"_receiver",type:"address"},{internalType:"uint96",name:"_feeNumerator",type:"uint96"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"ApproveTargetNotInAllowlist",type:"error"},{inputs:[{internalType:"address",name:"caller",type:"address"}],name:"CallerNotInAllowlist",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"previousAdminRole",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"newAdminRole",type:"bytes32"}],name:"RoleAdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleGranted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"oldRegistry",type:"address"},{indexed:!1,internalType:"address",name:"newRegistry",type:"address"}],name:"RoyaltytAllowlistRegistryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DEFAULT_ADMIN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"MINTER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"contractURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"getAdmins",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleAdmin",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"uint256",name:"index",type:"uint256"}],name:"getRoleMember",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleMemberCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"}],name:"grantMinterRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"grantRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"hasRole",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"renounceRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"}],name:"revokeMinterRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"revokeRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"royaltyAllowlist",outputs:[{internalType:"contract IRoyaltyAllowlist",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"},{internalType:"uint256",name:"_salePrice",type:"uint256"}],name:"royaltyInfo",outputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"baseURI_",type:"string"}],name:"setBaseURI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"_contractURI",type:"string"}],name:"setContractURI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_royaltyAllowlist",type:"address"}],name:"setRoyaltyAllowlistRegistry",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}],W3="0x60806040523480156200001157600080fd5b50604051620060d4380380620060d4833981810160405281019062000037919062000762565b868686868686868585816000908162000051919062000adc565b50806001908162000063919062000adc565b505050620000788282620000dc60201b60201c565b6200008d6000801b886200027f60201b60201c565b83601090816200009e919062000adc565b5082600f9081620000b0919062000adc565b50620000c86011620002c760201b620015f11760201c565b505050505050505050505050505062000cde565b620000ec620002dd60201b60201c565b6bffffffffffffffffffffffff16816bffffffffffffffffffffffff1611156200014d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001449062000c4a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620001bf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001b69062000cbc565b60405180910390fd5b60405180604001604052808373ffffffffffffffffffffffffffffffffffffffff168152602001826bffffffffffffffffffffffff16815250600d60008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055509050505050565b620002968282620002e760201b620016071760201c565b620002c28160076000858152602001908152602001600020620003d960201b620016e81790919060201c565b505050565b6001816000016000828254019250508190555050565b6000612710905090565b620002f982826200041160201b60201c565b620003d55760016006600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506200037a6200047c60201b60201c565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600062000409836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6200048460201b60201c565b905092915050565b60006006600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600033905090565b6000620004988383620004fe60201b60201c565b620004f3578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050620004f8565b600090505b92915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620005628262000535565b9050919050565b620005748162000555565b81146200058057600080fd5b50565b600081519050620005948162000569565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620005ef82620005a4565b810181811067ffffffffffffffff82111715620006115762000610620005b5565b5b80604052505050565b60006200062662000521565b9050620006348282620005e4565b919050565b600067ffffffffffffffff821115620006575762000656620005b5565b5b6200066282620005a4565b9050602081019050919050565b60005b838110156200068f57808201518184015260208101905062000672565b60008484015250505050565b6000620006b2620006ac8462000639565b6200061a565b905082815260208101848484011115620006d157620006d06200059f565b5b620006de8482856200066f565b509392505050565b600082601f830112620006fe57620006fd6200059a565b5b8151620007108482602086016200069b565b91505092915050565b60006bffffffffffffffffffffffff82169050919050565b6200073c8162000719565b81146200074857600080fd5b50565b6000815190506200075c8162000731565b92915050565b600080600080600080600060e0888a0312156200078457620007836200052b565b5b6000620007948a828b0162000583565b975050602088015167ffffffffffffffff811115620007b857620007b762000530565b5b620007c68a828b01620006e6565b965050604088015167ffffffffffffffff811115620007ea57620007e962000530565b5b620007f88a828b01620006e6565b955050606088015167ffffffffffffffff8111156200081c576200081b62000530565b5b6200082a8a828b01620006e6565b945050608088015167ffffffffffffffff8111156200084e576200084d62000530565b5b6200085c8a828b01620006e6565b93505060a06200086f8a828b0162000583565b92505060c0620008828a828b016200074b565b91505092959891949750929550565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620008e457607f821691505b602082108103620008fa57620008f96200089c565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620009647fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000925565b62000970868362000925565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620009bd620009b7620009b18462000988565b62000992565b62000988565b9050919050565b6000819050919050565b620009d9836200099c565b620009f1620009e882620009c4565b84845462000932565b825550505050565b600090565b62000a08620009f9565b62000a15818484620009ce565b505050565b5b8181101562000a3d5762000a31600082620009fe565b60018101905062000a1b565b5050565b601f82111562000a8c5762000a568162000900565b62000a618462000915565b8101602085101562000a71578190505b62000a8962000a808562000915565b83018262000a1a565b50505b505050565b600082821c905092915050565b600062000ab16000198460080262000a91565b1980831691505092915050565b600062000acc838362000a9e565b9150826002028217905092915050565b62000ae78262000891565b67ffffffffffffffff81111562000b035762000b02620005b5565b5b62000b0f8254620008cb565b62000b1c82828562000a41565b600060209050601f83116001811462000b54576000841562000b3f578287015190505b62000b4b858262000abe565b86555062000bbb565b601f19841662000b648662000900565b60005b8281101562000b8e5784890151825560018201915060208501945060208101905062000b67565b8683101562000bae578489015162000baa601f89168262000a9e565b8355505b6001600288020188555050505b505050505050565b600082825260208201905092915050565b7f455243323938313a20726f79616c7479206665652077696c6c2065786365656460008201527f2073616c65507269636500000000000000000000000000000000000000000000602082015250565b600062000c32602a8362000bc3565b915062000c3f8262000bd4565b604082019050919050565b6000602082019050818103600083015262000c658162000c23565b9050919050565b7f455243323938313a20696e76616c696420726563656976657200000000000000600082015250565b600062000ca460198362000bc3565b915062000cb18262000c6c565b602082019050919050565b6000602082019050818103600083015262000cd78162000c95565b9050919050565b6153e68062000cee6000396000f3fe608060405234801561001057600080fd5b50600436106102275760003560e01c80636352211e1161013057806395d89b41116100b8578063ca15c8731161007c578063ca15c87314610697578063d5391393146106c7578063d547741f146106e5578063e8a3d48514610701578063e985e9c51461071f57610227565b806395d89b41146105f3578063a217fddf14610611578063a22cb4651461062f578063b88d4fde1461064b578063c87b56dd1461066757610227565b80636c0360eb116100ff5780636c0360eb1461052957806370a08231146105475780639010d07c1461057757806391d14854146105a7578063938e3d7b146105d757610227565b80636352211e146104a35780636588962a146104d357806369e2f0fb146104ef5780636b3a06321461050b57610227565b80632f745c59116101b357806340c10f191161018257806340c10f191461040357806342842e0e1461041f57806342966c681461043b5780634f6ccce71461045757806355f804b31461048757610227565b80632f745c591461037d57806331ae450b146103ad57806336568abe146103cb5780633dd1eb61146103e757610227565b806318160ddd116101fa57806318160ddd146102c657806323b872dd146102e4578063248a9ca3146103005780632a55205a146103305780632f2ff15d1461036157610227565b806301ffc9a71461022c57806306fdde031461025c578063081812fc1461027a578063095ea7b3146102aa575b600080fd5b61024660048036038101906102419190613a2e565b61074f565b6040516102539190613a76565b60405180910390f35b610264610761565b6040516102719190613b21565b60405180910390f35b610294600480360381019061028f9190613b79565b6107f3565b6040516102a19190613be7565b60405180910390f35b6102c460048036038101906102bf9190613c2e565b610839565b005b6102ce610847565b6040516102db9190613c7d565b60405180910390f35b6102fe60048036038101906102f99190613c98565b610854565b005b61031a60048036038101906103159190613d21565b6108b4565b6040516103279190613d5d565b60405180910390f35b61034a60048036038101906103459190613d78565b6108d4565b604051610358929190613db8565b60405180910390f35b61037b60048036038101906103769190613de1565b610abe565b005b61039760048036038101906103929190613c2e565b610adf565b6040516103a49190613c7d565b60405180910390f35b6103b5610b84565b6040516103c29190613edf565b60405180910390f35b6103e560048036038101906103e09190613de1565b610c64565b005b61040160048036038101906103fc9190613f01565b610ce7565b005b61041d60048036038101906104189190613c2e565b610d22565b005b61043960048036038101906104349190613c98565b610d7a565b005b61045560048036038101906104509190613b79565b610d9a565b005b610471600480360381019061046c9190613b79565b610df6565b60405161047e9190613c7d565b60405180910390f35b6104a1600480360381019061049c9190614063565b610e67565b005b6104bd60048036038101906104b89190613b79565b610e88565b6040516104ca9190613be7565b60405180910390f35b6104ed60048036038101906104e89190613f01565b610f0e565b005b61050960048036038101906105049190613f01565b611094565b005b6105136110cf565b604051610520919061410b565b60405180910390f35b6105316110f5565b60405161053e9190613b21565b60405180910390f35b610561600480360381019061055c9190613f01565b611183565b60405161056e9190613c7d565b60405180910390f35b610591600480360381019061058c9190614126565b61123a565b60405161059e9190613be7565b60405180910390f35b6105c160048036038101906105bc9190613de1565b611269565b6040516105ce9190613a76565b60405180910390f35b6105f160048036038101906105ec9190614063565b6112d4565b005b6105fb6112f5565b6040516106089190613b21565b60405180910390f35b610619611387565b6040516106269190613d5d565b60405180910390f35b61064960048036038101906106449190614192565b61138e565b005b61066560048036038101906106609190614273565b61139c565b005b610681600480360381019061067c9190613b79565b6113fe565b60405161068e9190613b21565b60405180910390f35b6106b160048036038101906106ac9190613d21565b611466565b6040516106be9190613c7d565b60405180910390f35b6106cf61148a565b6040516106dc9190613d5d565b60405180910390f35b6106ff60048036038101906106fa9190613de1565b6114ae565b005b6107096114cf565b6040516107169190613b21565b60405180910390f35b610739600480360381019061073491906142f6565b61155d565b6040516107469190613a76565b60405180910390f35b600061075a82611718565b9050919050565b60606000805461077090614365565b80601f016020809104026020016040519081016040528092919081815260200182805461079c90614365565b80156107e95780601f106107be576101008083540402835291602001916107e9565b820191906000526020600020905b8154815290600101906020018083116107cc57829003601f168201915b5050505050905090565b60006107fe82611792565b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b61084382826117dd565b5050565b6000600b80549050905090565b61086561085f6117f4565b826117fc565b6108a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089b90614408565b60405180910390fd5b6108af838383611891565b505050565b600060066000838152602001908152602001600020600101549050919050565b6000806000600e60008681526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1603610a6957600d6040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090505b6000610a736118a1565b6bffffffffffffffffffffffff1682602001516bffffffffffffffffffffffff1686610a9f9190614457565b610aa991906144c8565b90508160000151819350935050509250929050565b610ac7826108b4565b610ad0816118ab565b610ada83836118bf565b505050565b6000610aea83611183565b8210610b2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b229061456b565b60405180910390fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b60606000610b946000801b611466565b905060008167ffffffffffffffff811115610bb257610bb1613f38565b5b604051908082528060200260200182016040528015610be05781602001602082028036833780820191505090505b50905060005b82811015610c5b57610bfb6000801b8261123a565b828281518110610c0e57610c0d61458b565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080610c53906145ba565b915050610be6565b50809250505090565b610c6c6117f4565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610cd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd090614674565b60405180910390fd5b610ce382826118f3565b5050565b6000801b610cf4816118ab565b610d1e7f4d494e5445525f524f4c4500000000000000000000000000000000000000000083610abe565b5050565b7f4d494e5445525f524f4c45000000000000000000000000000000000000000000610d4c816118ab565b60005b82811015610d7457610d6084611927565b508080610d6c906145ba565b915050610d4f565b50505050565b610d958383836040518060200160405280600081525061139c565b505050565b610dab610da56117f4565b826117fc565b610dea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de190614408565b60405180910390fd5b610df381611953565b50565b6000610e00610847565b8210610e41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3890614706565b60405180910390fd5b600b8281548110610e5557610e5461458b565b5b90600052602060002001549050919050565b6000801b610e74816118ab565b8160109081610e8391906148c8565b505050565b600080610e9483611aa1565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610f05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610efc906149e6565b60405180910390fd5b80915050919050565b6000801b610f1b816118ab565b8173ffffffffffffffffffffffffffffffffffffffff166301ffc9a77f05a3b809000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b8152600401610f749190614a15565b602060405180830381865afa158015610f91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb59190614a45565b610ff4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610feb90614ae4565b60405180910390fd5b7f4a1d010d926ae0d4294a4afe61ae81bb378335fbf671e099a7138b5afeefdf84600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683604051611047929190614b04565b60405180910390a181600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000801b6110a1816118ab565b6110cb7f4d494e5445525f524f4c45000000000000000000000000000000000000000000836114ae565b5050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6010805461110290614365565b80601f016020809104026020016040519081016040528092919081815260200182805461112e90614365565b801561117b5780601f106111505761010080835404028352916020019161117b565b820191906000526020600020905b81548152906001019060200180831161115e57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036111f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ea90614b9f565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60006112618260076000868152602001908152602001600020611ade90919063ffffffff16565b905092915050565b60006006600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000801b6112e1816118ab565b81600f90816112f091906148c8565b505050565b60606001805461130490614365565b80601f016020809104026020016040519081016040528092919081815260200182805461133090614365565b801561137d5780601f106113525761010080835404028352916020019161137d565b820191906000526020600020905b81548152906001019060200180831161136057829003601f168201915b5050505050905090565b6000801b81565b6113988282611af8565b5050565b6113ad6113a76117f4565b836117fc565b6113ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e390614408565b60405180910390fd5b6113f884848484611b0f565b50505050565b606061140982611792565b6000611413611b6b565b90506000815111611433576040518060200160405280600081525061145e565b8061143d84611bfd565b60405160200161144e929190614bfb565b6040516020818303038152906040525b915050919050565b600061148360076000848152602001908152602001600020611ccb565b9050919050565b7f4d494e5445525f524f4c4500000000000000000000000000000000000000000081565b6114b7826108b4565b6114c0816118ab565b6114ca83836118f3565b505050565b600f80546114dc90614365565b80601f016020809104026020016040519081016040528092919081815260200182805461150890614365565b80156115555780601f1061152a57610100808354040283529160200191611555565b820191906000526020600020905b81548152906001019060200180831161153857829003601f168201915b505050505081565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6001816000016000828254019250508190555050565b6116118282611269565b6116e45760016006600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506116896117f4565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000611710836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611ce0565b905092915050565b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061178b575061178a82611d50565b5b9050919050565b61179b81611dca565b6117da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117d1906149e6565b60405180910390fd5b50565b6117e682611e0b565b6117f08282611f64565b5050565b600033905090565b60008061180883610e88565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061184a5750611849818561155d565b5b8061188857508373ffffffffffffffffffffffffffffffffffffffff16611870846107f3565b73ffffffffffffffffffffffffffffffffffffffff16145b91505092915050565b61189c83838361207b565b505050565b6000612710905090565b6118bc816118b76117f4565b612093565b50565b6118c98282611607565b6118ee81600760008581526020019081526020016000206116e890919063ffffffff16565b505050565b6118fd8282612118565b61192281600760008581526020019081526020016000206121fa90919063ffffffff16565b505050565b600080611934601161222a565b90506119408382612238565b61194a60116115f1565b80915050919050565b600061195e82610e88565b905061196e816000846001612455565b61197782610e88565b90506004600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506002600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905581600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4611a9d816000846001612467565b5050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000611aed836000018361246d565b60001c905092915050565b611b0182611e0b565b611b0b8282612498565b5050565b611b1a848484611891565b611b26848484846124ae565b611b65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5c90614c91565b60405180910390fd5b50505050565b606060108054611b7a90614365565b80601f0160208091040260200160405190810160405280929190818152602001828054611ba690614365565b8015611bf35780601f10611bc857610100808354040283529160200191611bf3565b820191906000526020600020905b815481529060010190602001808311611bd657829003601f168201915b5050505050905090565b606060006001611c0c84612635565b01905060008167ffffffffffffffff811115611c2b57611c2a613f38565b5b6040519080825280601f01601f191660200182016040528015611c5d5781602001600182028036833780820191505090505b509050600082602001820190505b600115611cc0578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581611cb457611cb3614499565b5b04945060008503611c6b575b819350505050919050565b6000611cd982600001612788565b9050919050565b6000611cec8383612799565b611d45578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050611d4a565b600090505b92915050565b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611dc35750611dc2826127bc565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff16611dec83611aa1565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600073ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611f605760008173ffffffffffffffffffffffffffffffffffffffff163b1480611f1f5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166305a3b809826040518263ffffffff1660e01b8152600401611edd9190613be7565b602060405180830381865afa158015611efa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1e9190614a45565b5b611f6157806040517f8371ab02000000000000000000000000000000000000000000000000000000008152600401611f579190613be7565b60405180910390fd5b5b50565b6000611f6f82610e88565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611fdf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fd690614d23565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16611ffe6117f4565b73ffffffffffffffffffffffffffffffffffffffff16148061202d575061202c816120276117f4565b61155d565b5b61206c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206390614db5565b60405180910390fd5b61207683836127ce565b505050565b612083612887565b61208e8383836129f3565b505050565b61209d8282611269565b612114576120aa81612cec565b6120b88360001c6020612d19565b6040516020016120c9929190614e6d565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161210b9190613b21565b60405180910390fd5b5050565b6121228282611269565b156121f65760006006600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061219b6117f4565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b6000612222836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612f55565b905092915050565b600081600001549050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036122a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229e90614ef3565b60405180910390fd5b6122b081611dca565b156122f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122e790614f5f565b60405180910390fd5b6122fe600083836001612455565b61230781611dca565b15612347576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161233e90614f5f565b60405180910390fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612451600083836001612467565b5050565b61246184848484613069565b50505050565b50505050565b60008260000182815481106124855761248461458b565b5b9060005260206000200154905092915050565b6124aa6124a36117f4565b83836131c7565b5050565b60006124cf8473ffffffffffffffffffffffffffffffffffffffff16613333565b15612628578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026124f86117f4565b8786866040518563ffffffff1660e01b815260040161251a9493929190614fd4565b6020604051808303816000875af192505050801561255657506040513d601f19601f820116820180604052508101906125539190615035565b60015b6125d8573d8060008114612586576040519150601f19603f3d011682016040523d82523d6000602084013e61258b565b606091505b5060008151036125d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125c790614c91565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161491505061262d565b600190505b949350505050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310612693577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161268957612688614499565b5b0492506040810190505b6d04ee2d6d415b85acef810000000083106126d0576d04ee2d6d415b85acef810000000083816126c6576126c5614499565b5b0492506020810190505b662386f26fc1000083106126ff57662386f26fc1000083816126f5576126f4614499565b5b0492506010810190505b6305f5e1008310612728576305f5e100838161271e5761271d614499565b5b0492506008810190505b612710831061274d57612710838161274357612742614499565b5b0492506004810190505b60648310612770576064838161276657612765614499565b5b0492506002810190505b600a831061277f576001810190505b80915050919050565b600081600001805490509050919050565b600080836001016000848152602001908152602001600020541415905092915050565b60006127c782613356565b9050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661284183610e88565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600073ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146129f0573273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806129af5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166305a3b809336040518263ffffffff1660e01b815260040161296d9190613be7565b602060405180830381865afa15801561298a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ae9190614a45565b5b6129f157336040517f937db65f0000000000000000000000000000000000000000000000000000000081526004016129e79190613be7565b60405180910390fd5b5b565b8273ffffffffffffffffffffffffffffffffffffffff16612a1382610e88565b73ffffffffffffffffffffffffffffffffffffffff1614612a69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a60906150d4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612ad8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612acf90615166565b60405180910390fd5b612ae58383836001612455565b8273ffffffffffffffffffffffffffffffffffffffff16612b0582610e88565b73ffffffffffffffffffffffffffffffffffffffff1614612b5b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b52906150d4565b60405180910390fd5b6004600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612ce78383836001612467565b505050565b6060612d128273ffffffffffffffffffffffffffffffffffffffff16601460ff16612d19565b9050919050565b606060006002836002612d2c9190614457565b612d369190615186565b67ffffffffffffffff811115612d4f57612d4e613f38565b5b6040519080825280601f01601f191660200182016040528015612d815781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612db957612db861458b565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612e1d57612e1c61458b565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006001846002612e5d9190614457565b612e679190615186565b90505b6001811115612f07577f3031323334353637383961626364656600000000000000000000000000000000600f861660108110612ea957612ea861458b565b5b1a60f81b828281518110612ec057612ebf61458b565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c945080612f00906151ba565b9050612e6a565b5060008414612f4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f429061522f565b60405180910390fd5b8091505092915050565b6000808360010160008481526020019081526020016000205490506000811461305d576000600182612f87919061524f565b9050600060018660000180549050612f9f919061524f565b905081811461300e576000866000018281548110612fc057612fbf61458b565b5b9060005260206000200154905080876000018481548110612fe457612fe361458b565b5b90600052602060002001819055508387600101600083815260200190815260200160002081905550505b8560000180548061302257613021615283565b5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050613063565b60009150505b92915050565b613075848484846133d0565b60018111156130b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130b090615324565b60405180910390fd5b6000829050600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603613100576130fb816134f6565b61313f565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161461313e5761313d858261353f565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036131815761317c816136ac565b6131c0565b8473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146131bf576131be848261377d565b5b5b5050505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603613235576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161322c90615390565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516133269190613a76565b60405180910390a3505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60007f5a05180f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806133c957506133c8826137fc565b5b9050919050565b60018111156134f057600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146134645780600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461345c919061524f565b925050819055505b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146134ef5780600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546134e79190615186565b925050819055505b5b50505050565b600b80549050600c600083815260200190815260200160002081905550600b81908060018154018082558091505060019003906000526020600020016000909190919091505550565b6000600161354c84611183565b613556919061524f565b90506000600a600084815260200190815260200160002054905081811461363b576000600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008481526020019081526020016000208190555081600a600083815260200190815260200160002081905550505b600a600084815260200190815260200160002060009055600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600b805490506136c0919061524f565b90506000600c60008481526020019081526020016000205490506000600b83815481106136f0576136ef61458b565b5b9060005260206000200154905080600b83815481106137125761371161458b565b5b906000526020600020018190555081600c600083815260200190815260200160002081905550600c600085815260200190815260200160002060009055600b80548061376157613760615283565b5b6001900381819060005260206000200160009055905550505050565b600061378883611183565b905081600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000208190555080600a600084815260200190815260200160002081905550505050565b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061386f575061386e82613876565b5b9050919050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061394157507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80613951575061395082613958565b5b9050919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613a0b816139d6565b8114613a1657600080fd5b50565b600081359050613a2881613a02565b92915050565b600060208284031215613a4457613a436139cc565b5b6000613a5284828501613a19565b91505092915050565b60008115159050919050565b613a7081613a5b565b82525050565b6000602082019050613a8b6000830184613a67565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015613acb578082015181840152602081019050613ab0565b60008484015250505050565b6000601f19601f8301169050919050565b6000613af382613a91565b613afd8185613a9c565b9350613b0d818560208601613aad565b613b1681613ad7565b840191505092915050565b60006020820190508181036000830152613b3b8184613ae8565b905092915050565b6000819050919050565b613b5681613b43565b8114613b6157600080fd5b50565b600081359050613b7381613b4d565b92915050565b600060208284031215613b8f57613b8e6139cc565b5b6000613b9d84828501613b64565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000613bd182613ba6565b9050919050565b613be181613bc6565b82525050565b6000602082019050613bfc6000830184613bd8565b92915050565b613c0b81613bc6565b8114613c1657600080fd5b50565b600081359050613c2881613c02565b92915050565b60008060408385031215613c4557613c446139cc565b5b6000613c5385828601613c19565b9250506020613c6485828601613b64565b9150509250929050565b613c7781613b43565b82525050565b6000602082019050613c926000830184613c6e565b92915050565b600080600060608486031215613cb157613cb06139cc565b5b6000613cbf86828701613c19565b9350506020613cd086828701613c19565b9250506040613ce186828701613b64565b9150509250925092565b6000819050919050565b613cfe81613ceb565b8114613d0957600080fd5b50565b600081359050613d1b81613cf5565b92915050565b600060208284031215613d3757613d366139cc565b5b6000613d4584828501613d0c565b91505092915050565b613d5781613ceb565b82525050565b6000602082019050613d726000830184613d4e565b92915050565b60008060408385031215613d8f57613d8e6139cc565b5b6000613d9d85828601613b64565b9250506020613dae85828601613b64565b9150509250929050565b6000604082019050613dcd6000830185613bd8565b613dda6020830184613c6e565b9392505050565b60008060408385031215613df857613df76139cc565b5b6000613e0685828601613d0c565b9250506020613e1785828601613c19565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613e5681613bc6565b82525050565b6000613e688383613e4d565b60208301905092915050565b6000602082019050919050565b6000613e8c82613e21565b613e968185613e2c565b9350613ea183613e3d565b8060005b83811015613ed2578151613eb98882613e5c565b9750613ec483613e74565b925050600181019050613ea5565b5085935050505092915050565b60006020820190508181036000830152613ef98184613e81565b905092915050565b600060208284031215613f1757613f166139cc565b5b6000613f2584828501613c19565b91505092915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613f7082613ad7565b810181811067ffffffffffffffff82111715613f8f57613f8e613f38565b5b80604052505050565b6000613fa26139c2565b9050613fae8282613f67565b919050565b600067ffffffffffffffff821115613fce57613fcd613f38565b5b613fd782613ad7565b9050602081019050919050565b82818337600083830152505050565b600061400661400184613fb3565b613f98565b90508281526020810184848401111561402257614021613f33565b5b61402d848285613fe4565b509392505050565b600082601f83011261404a57614049613f2e565b5b813561405a848260208601613ff3565b91505092915050565b600060208284031215614079576140786139cc565b5b600082013567ffffffffffffffff811115614097576140966139d1565b5b6140a384828501614035565b91505092915050565b6000819050919050565b60006140d16140cc6140c784613ba6565b6140ac565b613ba6565b9050919050565b60006140e3826140b6565b9050919050565b60006140f5826140d8565b9050919050565b614105816140ea565b82525050565b600060208201905061412060008301846140fc565b92915050565b6000806040838503121561413d5761413c6139cc565b5b600061414b85828601613d0c565b925050602061415c85828601613b64565b9150509250929050565b61416f81613a5b565b811461417a57600080fd5b50565b60008135905061418c81614166565b92915050565b600080604083850312156141a9576141a86139cc565b5b60006141b785828601613c19565b92505060206141c88582860161417d565b9150509250929050565b600067ffffffffffffffff8211156141ed576141ec613f38565b5b6141f682613ad7565b9050602081019050919050565b6000614216614211846141d2565b613f98565b90508281526020810184848401111561423257614231613f33565b5b61423d848285613fe4565b509392505050565b600082601f83011261425a57614259613f2e565b5b813561426a848260208601614203565b91505092915050565b6000806000806080858703121561428d5761428c6139cc565b5b600061429b87828801613c19565b94505060206142ac87828801613c19565b93505060406142bd87828801613b64565b925050606085013567ffffffffffffffff8111156142de576142dd6139d1565b5b6142ea87828801614245565b91505092959194509250565b6000806040838503121561430d5761430c6139cc565b5b600061431b85828601613c19565b925050602061432c85828601613c19565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061437d57607f821691505b6020821081036143905761438f614336565b5b50919050565b7f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560008201527f72206f7220617070726f76656400000000000000000000000000000000000000602082015250565b60006143f2602d83613a9c565b91506143fd82614396565b604082019050919050565b60006020820190508181036000830152614421816143e5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061446282613b43565b915061446d83613b43565b925082820261447b81613b43565b9150828204841483151761449257614491614428565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006144d382613b43565b91506144de83613b43565b9250826144ee576144ed614499565b5b828204905092915050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b6000614555602b83613a9c565b9150614560826144f9565b604082019050919050565b6000602082019050818103600083015261458481614548565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006145c582613b43565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036145f7576145f6614428565b5b600182019050919050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b600061465e602f83613a9c565b915061466982614602565b604082019050919050565b6000602082019050818103600083015261468d81614651565b9050919050565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b60006146f0602c83613a9c565b91506146fb82614694565b604082019050919050565b6000602082019050818103600083015261471f816146e3565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026147887fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261474b565b614792868361474b565b95508019841693508086168417925050509392505050565b60006147c56147c06147bb84613b43565b6140ac565b613b43565b9050919050565b6000819050919050565b6147df836147aa565b6147f36147eb826147cc565b848454614758565b825550505050565b600090565b6148086147fb565b6148138184846147d6565b505050565b5b818110156148375761482c600082614800565b600181019050614819565b5050565b601f82111561487c5761484d81614726565b6148568461473b565b81016020851015614865578190505b6148796148718561473b565b830182614818565b50505b505050565b600082821c905092915050565b600061489f60001984600802614881565b1980831691505092915050565b60006148b8838361488e565b9150826002028217905092915050565b6148d182613a91565b67ffffffffffffffff8111156148ea576148e9613f38565b5b6148f48254614365565b6148ff82828561483b565b600060209050601f8311600181146149325760008415614920578287015190505b61492a85826148ac565b865550614992565b601f19841661494086614726565b60005b8281101561496857848901518255600182019150602085019450602081019050614943565b868310156149855784890151614981601f89168261488e565b8355505b6001600288020188555050505b505050505050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b60006149d0601883613a9c565b91506149db8261499a565b602082019050919050565b600060208201905081810360008301526149ff816149c3565b9050919050565b614a0f816139d6565b82525050565b6000602082019050614a2a6000830184614a06565b92915050565b600081519050614a3f81614166565b92915050565b600060208284031215614a5b57614a5a6139cc565b5b6000614a6984828501614a30565b91505092915050565b7f636f6e747261637420646f6573206e6f7420696d706c656d656e742049526f7960008201527f616c7479416c6c6f776c69737400000000000000000000000000000000000000602082015250565b6000614ace602d83613a9c565b9150614ad982614a72565b604082019050919050565b60006020820190508181036000830152614afd81614ac1565b9050919050565b6000604082019050614b196000830185613bd8565b614b266020830184613bd8565b9392505050565b7f4552433732313a2061646472657373207a65726f206973206e6f74206120766160008201527f6c6964206f776e65720000000000000000000000000000000000000000000000602082015250565b6000614b89602983613a9c565b9150614b9482614b2d565b604082019050919050565b60006020820190508181036000830152614bb881614b7c565b9050919050565b600081905092915050565b6000614bd582613a91565b614bdf8185614bbf565b9350614bef818560208601613aad565b80840191505092915050565b6000614c078285614bca565b9150614c138284614bca565b91508190509392505050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b6000614c7b603283613a9c565b9150614c8682614c1f565b604082019050919050565b60006020820190508181036000830152614caa81614c6e565b9050919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b6000614d0d602183613a9c565b9150614d1882614cb1565b604082019050919050565b60006020820190508181036000830152614d3c81614d00565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b6000614d9f603d83613a9c565b9150614daa82614d43565b604082019050919050565b60006020820190508181036000830152614dce81614d92565b9050919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b6000614e0b601783614bbf565b9150614e1682614dd5565b601782019050919050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b6000614e57601183614bbf565b9150614e6282614e21565b601182019050919050565b6000614e7882614dfe565b9150614e848285614bca565b9150614e8f82614e4a565b9150614e9b8284614bca565b91508190509392505050565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b6000614edd602083613a9c565b9150614ee882614ea7565b602082019050919050565b60006020820190508181036000830152614f0c81614ed0565b9050919050565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b6000614f49601c83613a9c565b9150614f5482614f13565b602082019050919050565b60006020820190508181036000830152614f7881614f3c565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000614fa682614f7f565b614fb08185614f8a565b9350614fc0818560208601613aad565b614fc981613ad7565b840191505092915050565b6000608082019050614fe96000830187613bd8565b614ff66020830186613bd8565b6150036040830185613c6e565b81810360608301526150158184614f9b565b905095945050505050565b60008151905061502f81613a02565b92915050565b60006020828403121561504b5761504a6139cc565b5b600061505984828501615020565b91505092915050565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b60006150be602583613a9c565b91506150c982615062565b604082019050919050565b600060208201905081810360008301526150ed816150b1565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000615150602483613a9c565b915061515b826150f4565b604082019050919050565b6000602082019050818103600083015261517f81615143565b9050919050565b600061519182613b43565b915061519c83613b43565b92508282019050808211156151b4576151b3614428565b5b92915050565b60006151c582613b43565b9150600082036151d8576151d7614428565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b6000615219602083613a9c565b9150615224826151e3565b602082019050919050565b600060208201905081810360008301526152488161520c565b9050919050565b600061525a82613b43565b915061526583613b43565b925082820390508181111561527d5761527c614428565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f455243373231456e756d657261626c653a20636f6e736563757469766520747260008201527f616e7366657273206e6f7420737570706f727465640000000000000000000000602082015250565b600061530e603583613a9c565b9150615319826152b2565b604082019050919050565b6000602082019050818103600083015261533d81615301565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b600061537a601983613a9c565b915061538582615344565b602082019050919050565b600060208201905081810360008301526153a98161536d565b905091905056fea2646970667358221220f2de678fa1f1a3fc28d8056ba46769331f91c7536f9259f07a82f3f97942823964736f6c63430008110033";class X3 extends vl{constructor(...e){e.length>1?super(...e):super(K3,W3,e[0])}deploy(e,t,r,n,i,a,o,s){return super.deploy(e,t,r,n,i,a,o,s||{})}getDeployTransaction(e,t,r,n,i,a,o,s){return super.getDeployTransaction(e,t,r,n,i,a,o,s||{})}attach(e){return super.attach(e)}connect(e){return super.connect(e)}static bytecode=W3;static abi=K3;static createInterface(){return new Df(K3)}static connect(e,t){return new gl(e,K3,t)}}e.APIError=Zr,e.BlockchainData=class{config;activities;chains;collections;nfts;nftOwners;tokens;constructor(e){this.config=new nn(e),this.activities=new mt.ActivitiesApi(this.config.apiConfig),this.chains=new mt.ChainsApi(this.config.apiConfig),this.collections=new mt.CollectionsApi(this.config.apiConfig),this.nfts=new mt.NftsApi(this.config.apiConfig),this.nftOwners=new mt.NftOwnersApi(this.config.apiConfig),this.tokens=new mt.TokensApi(this.config.apiConfig)}async listActivities(e){return await this.activities.listActivities(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async getActivity(e){return await this.activities.getActivity(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async listChains(e){return await this.chains.listChains(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async listCollections(e){return await this.collections.listCollections(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async getCollection(e){return await this.collections.getCollection(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async getNFT(e){return await this.nfts.getNFT(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async listNFTs(e){return await this.nfts.listNFTs(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async listNFTsByAccountAddress(e){return await this.nfts.listNFTsByAccountAddress(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async listNFTOwners(e){return await this.nftOwners.listNFTOwners(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async listTokens(e){return await this.tokens.listERC20Tokens(e).then((e=>e.data)).catch((e=>{throw an(e)}))}async getToken(e){return await this.tokens.getERC20Token(e).then((e=>e.data)).catch((e=>{throw an(e)}))}},e.BridgeReact=U3,e.CHECKOUT_API_BASE_URL=F5,e.Checkout=class{config;readOnlyProviders;constructor(e=h3){this.config=new u3(e),this.readOnlyProviders=new Map}async createProvider(e){return await Z5(e.walletProvider)}async checkIsWalletConnected(t){return async function(t){if(!t?.provider?.request)throw new V5("Check wallet connection request failed",e.CheckoutErrorType.PROVIDER_REQUEST_FAILED_ERROR,{rpcMethod:P5.CHECK_CONNECTION});let r=[];try{r=await t.provider.request({method:P5.CHECK_CONNECTION,params:[]})}catch(t){throw new V5("Check wallet connection request failed",e.CheckoutErrorType.PROVIDER_REQUEST_FAILED_ERROR,{rpcMethod:P5.CHECK_CONNECTION})}return{isConnected:r&&r.length>0,walletAddress:r[0]??""}}(await t3(this.config,t.provider,{allowUnsupportedProvider:!0}))}async connect(t){const r=await t3(this.config,t.provider,{allowUnsupportedProvider:!0});await async function(t){return await G5((async()=>{if(!t||!t?.provider?.request)throw new V5("Incompatible provider",e.CheckoutErrorType.PROVIDER_REQUEST_MISSING_ERROR,{details:"Attempting to connect with an incompatible provider"});await t.provider.request({method:P5.CONNECT,params:[]})}),{type:e.CheckoutErrorType.USER_REJECTED_REQUEST_ERROR}),t}(r);return{provider:r,network:await X5(this.config,r)}}async switchNetwork(e){const t=await t3(this.config,e.provider,{allowUnsupportedProvider:!0,allowMistmatchedChainId:!0});return await $5(this.config,t,e.chainId)}async getBalance(e){const t=await t3(this.config,e.provider);return e.contractAddress&&""!==e.contractAddress?await Q5(t,e.walletAddress,e.contractAddress):await Y5(this.config,t,e.walletAddress)}async getAllBalances(t){const r=await t3(this.config,t.provider);return(async(t,r,n,i)=>{const a=await J5(t,{type:e.TokenFilterTypes.ALL,chainId:i}),o=[];return o.push(Y5(t,r,n)),a.tokens.filter((e=>e.address)).forEach((e=>o.push(Q5(r,n,e.address??"")))),{balances:(await Promise.allSettled(o)).filter((e=>"fulfilled"===e.status)).map((e=>e.value))}})(this.config,r,t.walletAddress,t.chainId)}async getNetworkAllowList(e){return await W5(this.config,e)}async getTokenAllowList(e){return await J5(this.config,e)}async getWalletAllowList(t){return await async function(t){const r=[],n=t.exclude?.map((e=>e.walletProvider))??[];let i=Object.values(e.WalletProviderName);0!==n.length&&(i=i.filter((e=>!n.includes(e))));for(const e of i)r.push({walletProvider:e,name:e});return{wallets:r}}(t)}async sendTransaction(t){const r=await t3(this.config,t.provider);return await(async(t,r)=>{try{return{transactionResponse:await t.getSigner().sendTransaction(r)}}catch(t){if(t.code===Pb.errors.INSUFFICIENT_FUNDS)throw new V5(t.message,e.CheckoutErrorType.INSUFFICIENT_FUNDS);if(t.code===Pb.errors.ACTION_REJECTED)throw new V5(t.message,e.CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);if(t.code===Pb.errors.UNPREDICTABLE_GAS_LIMIT)throw new V5(t.message,e.CheckoutErrorType.UNPREDICTABLE_GAS_LIMIT);throw new V5(t.message,e.CheckoutErrorType.TRANSACTION_FAILED)}})(r,t.transaction)}async getNetworkInfo(e){const t=await t3(this.config,e.provider,{allowUnsupportedProvider:!0,allowMistmatchedChainId:!0});return await X5(this.config,t)}static isWeb3Provider(e){return e3(e)}async gasEstimate(t){return this.readOnlyProviders=await async function(t,r){if(t.isProduction&&r?.has(e.ChainId.ETHEREUM))return r;if(r?.has(e.ChainId.SEPOLIA))return r;const n=new Map;return(await W5(t,{type:e.NetworkFilterTypes.ALL})).networks.forEach((e=>{const r=t.networkMap.get(e.chainId)?.rpcUrls[0],i=new om(r);n.set(e.chainId,i)})),n}(this.config,this.readOnlyProviders),await async function(t,r,n){switch(t.gasEstimateType){case e.GasEstimateType.BRIDGE_TO_L2:return await l3(r,n,t.isSpendingCapApprovalRequired,t.tokenAddress);case e.GasEstimateType.SWAP:return await p3(n);default:throw new V5("Invalid type provided for gasEstimateType",e.CheckoutErrorType.INVALID_GAS_ESTIMATE_TYPE)}}(t,this.readOnlyProviders,this.config)}},e.CheckoutWidgets=function(e){if(void 0===window)return void console.error("missing window object: please run Checkout client side");if(void 0===document)return void console.error("missing document object: please run Checkout client side");const t=document.createElement("script"),r=function(e){const t=R3();if(void 0===e)return t;if(void 0===e.major||void 0===e.minor||void 0===e.patch||void 0===e.prerelease)return t;if(e.major<0)return t;if(e.minor<0)return t;if(e.patch<0)return t;if("alpha"!==e.prerelease)return t;if(0===e.major&&0===e.minor&&0===e.patch)return t;let r=t;return!Number.isNaN(e.major)&&e.major>=0&&(r=e.major.toString()),Number.isNaN(e.minor)||(r+=`.${e.minor.toString()}`),Number.isNaN(e.patch)||(r+=`.${e.patch.toString()}`),r+=`-${e.prerelease}`,void 0!==e.build&&e.build>0&&(r+=`.${e.build}`),r}(e?.version);let n=`https://cdn.jsdelivr.net/npm/@imtbl/sdk@${r}/dist/browser/checkout.js`;t.setAttribute("src",n),document.head.appendChild(t),window.ImtblCheckoutWidgetConfig=JSON.stringify(e)},e.ConnectReact=j3,e.ERC20=class{contract;constructor(e){const t=new G3;this.contract=t.attach(e)}async totalSupply(e,t={}){return this.contract.connect(e).totalSupply(t)}async balanceOf(e,t,r={}){return this.contract.connect(e).balanceOf(t,r)}async allowance(e,t,r,n={}){return this.contract.connect(e).allowance(t,r,n)}async populateTransfer(e,t,r){return this.contract.populateTransaction.transfer(e,t,r)}async populateApprove(e,t,r={}){return this.contract.populateTransaction.approve(e,t,r)}async populateTransferFrom(e,t,r,n={}){return this.contract.populateTransaction.transferFrom(e,t,r,n)}},e.ERC721PermissionedMintable=class{contract;constructor(e){const t=new X3;this.contract=t.attach(e)}async DEFAULT_ADMIN_ROLE(e,t={}){return await this.contract.connect(e).DEFAULT_ADMIN_ROLE(t)}async MINTER_ROLE(e,t={}){return await this.contract.connect(e).MINTER_ROLE(t)}async balanceOf(e,t,r={}){return await this.contract.connect(e).balanceOf(t,r)}async baseURI(e,t={}){return await this.contract.connect(e).baseURI(t)}async contractURI(e,t={}){return await this.contract.connect(e).contractURI(t)}async getAdmins(e,t={}){return await this.contract.connect(e).getAdmins(t)}async getApproved(e,t,r={}){return await this.contract.connect(e).getApproved(t,r)}async getRoleAdmin(e,t,r={}){return await this.contract.connect(e).getRoleAdmin(t,r)}async getRoleMember(e,t,r,n={}){return await this.contract.connect(e).getRoleMember(t,r,n)}async getRoleMemberCount(e,t,r={}){return await this.contract.connect(e).getRoleMemberCount(t,r)}async hasRole(e,t,r,n={}){return await this.contract.connect(e).hasRole(t,r,n)}async isApprovedForAll(e,t,r,n={}){return await this.contract.connect(e).isApprovedForAll(t,r,n)}async name(e,t={}){return await this.contract.connect(e).name(t)}async ownerOf(e,t,r={}){return await this.contract.connect(e).ownerOf(t,r)}async royaltyAllowlist(e,t={}){return await this.contract.connect(e).royaltyAllowlist(t)}async royaltyInfo(e,t,r,n={}){return await this.contract.connect(e).royaltyInfo(t,r,n)}async symbol(e,t={}){return await this.contract.connect(e).symbol(t)}async tokenByIndex(e,t,r={}){return await this.contract.connect(e).tokenByIndex(t,r)}async tokenOfOwnerByIndex(e,t,r,n={}){return await this.contract.connect(e).tokenOfOwnerByIndex(t,r,n)}async tokenURI(e,t,r={}){return await this.contract.connect(e).tokenURI(t,r)}async totalSupply(e,t={}){return await this.contract.connect(e).totalSupply(t)}async populateApprove(e,t,r={}){return await this.contract.populateTransaction.approve(e,t,r)}async populateBurn(e,t={}){return await this.contract.populateTransaction.burn(e,t)}async populateGrantMinterRole(e,t={}){return await this.contract.populateTransaction.grantMinterRole(e,t)}async populateGrantRole(e,t,r={}){return await this.contract.populateTransaction.grantRole(e,t,r)}async populateMint(e,t,r={}){return await this.contract.populateTransaction.mint(e,t,r)}async populateRenounceRole(e,t,r={}){return await this.contract.populateTransaction.renounceRole(e,t,r)}async populateRevokeMinterRole(e,t={}){return await this.contract.populateTransaction.revokeMinterRole(e,t)}async populateRevokeRole(e,t,r={}){return await this.contract.populateTransaction.revokeRole(e,t,r)}async"populateSafeTransferFrom(address,address,uint256)"(e,t,r,n={}){return await this.contract.populateTransaction["safeTransferFrom(address,address,uint256)"](e,t,r,n)}async"populateSafeTransferFrom(address,address,uint256,bytes)"(e,t,r,n,i={}){return await this.contract.populateTransaction["safeTransferFrom(address,address,uint256,bytes)"](e,t,r,n,i)}async populateSetApprovalForAll(e,t,r={}){return await this.contract.populateTransaction.setApprovalForAll(e,t,r)}async populateSetBaseURI(e,t={}){return await this.contract.populateTransaction.setBaseURI(e,t)}async populateSetContractURI(e,t={}){return await this.contract.populateTransaction.setContractURI(e,t)}async populateSetRoyaltyAllowlistRegistry(e,t={}){return await this.contract.populateTransaction.setRoyaltyAllowlistRegistry(e,t)}},e.GenericIMXProvider=EX,e.ImmutableConfiguration=t,e.ImmutableXClient=nD,e.JsonRpcError=$z,e.MetaMaskIMXProvider=UX,e.Orderbook=class{apiClient;seaport;orderbookConfig;constructor(t){const r={...function(t){switch(t){case e.Environment.SANDBOX:return{seaportContractAddress:"0x474989C4D25DD41B0B9b1ECb4643B9Fe25f83B19",zoneContractAddress:"0x6FeDb4949E5b452700A8a8956999a7E05B6770F3",apiEndpoint:"https://order-book-mr.sandbox.imtbl.com",chainName:"imtbl-zkevm-testnet",provider:new om("https://zkevm-rpc.sandbox.x.immutable.com")};case e.Environment.PRODUCTION:return{seaportContractAddress:"",zoneContractAddress:"",apiEndpoint:"https://order-book-mr.imtbl.com",chainName:"imtbl-zkevm-mainnet",provider:new om("https://zkevm-rpc.x.immutable.com")};default:return null}}(t.baseConfig.environment),...t.overrides};if(!r)throw new Error("Orderbook configuration not passed, please specify the environment under config.baseConfig.environment");this.orderbookConfig=r;const{apiEndpoint:n,chainName:i}=this.orderbookConfig;if(!n)throw new Error("API endpoint must be provided");this.apiClient=new eX(n,i,this.orderbookConfig.seaportContractAddress).create();const a=new aX(this.orderbookConfig.seaportContractAddress,this.orderbookConfig.provider);this.seaport=new QW(a,this.orderbookConfig.provider,this.orderbookConfig.seaportContractAddress,this.orderbookConfig.zoneContractAddress)}getListing(e){return this.apiClient.getListing(e)}listListings(e){return this.apiClient.listListings(e)}async prepareListing({makerAddress:e,sell:t,buy:r,orderExpiry:n}){const i=new iX(t.contractAddress,this.orderbookConfig.provider).create(),a=await i.royaltyInfo(t.tokenId,r.amount);return this.seaport.prepareSeaportOrder(e,t,r,a,new Date,n||new Date(Date.now()+63072e6))}createListing(e){return this.apiClient.createListing(e)}async fulfillOrder(e,t){const r=await this.apiClient.getListing(e);if(r.result.status!==VW.ACTIVE)throw new Error(`Cannot fulfil order that is not active. Current status: ${r.result.status}`);return this.seaport.fulfilOrder(r.result,t)}async cancelOrder(e,t){const r=await this.apiClient.getListing(e);if(r.result.status!==VW.ACTIVE&&r.result.status!==VW.INACTIVE&&r.result.status!==VW.PENDING)throw new Error(`Cannot cancel order with status ${r.result.status}`);if(r.result.account_address!==t.toLowerCase())throw new Error(`Only account ${r.result.account_address} can cancel order ${e}`);return{unsignedCancelOrderTransaction:await this.seaport.cancelOrder(r.result,t)}}},e.Passport=class{authManager;config;confirmationScreen;immutableXClient;magicAdapter;passportImxProviderFactory;multiRollupApiClients;constructor(e){this.config=new iH(e),this.authManager=new zz(this.config),this.magicAdapter=new Hz(this.config),this.confirmationScreen=new dH(this.config),this.immutableXClient=e.overrides?.immutableXClient||new nD({baseConfig:e.baseConfig}),this.multiRollupApiClients=new bt(this.config.multiRollupConfig),this.passportImxProviderFactory=new tH({authManager:this.authManager,config:this.config,confirmationScreen:this.confirmationScreen,immutableXClient:this.immutableXClient,magicAdapter:this.magicAdapter})}async connectImxSilent(){return this.passportImxProviderFactory.getProviderSilent()}async connectImx(){return this.passportImxProviderFactory.getProvider()}async loginWithDeviceFlow(){return this.authManager.loginWithDeviceFlow()}async connectImxDeviceFlow(e,t,r){return this.passportImxProviderFactory.getProviderWithDeviceFlow(e,t,r)}getPKCEAuthorizationUrl(){return this.authManager.getPKCEAuthorizationUrl()}async connectImxPKCEFlow(e,t){return this.passportImxProviderFactory.getProviderWithPKCEFlow(e,t)}checkStoredDeviceFlowCredentials(){return this.authManager.checkStoredDeviceFlowCredentials()}async connectImxWithCredentials(e){return this.passportImxProviderFactory.getProviderWithCredentials(e)}connectEvm(){return new gH({authManager:this.authManager,magicAdapter:this.magicAdapter,config:this.config,confirmationScreen:this.confirmationScreen,multiRollupApiClients:this.multiRollupApiClients})}async loginCallback(){return this.authManager.loginCallback()}async logout(){return this.authManager.logout()}async logoutSilentCallback(e){return this.authManager.logoutSilentCallback(e)}async logoutDeviceFlow(){return this.authManager.logoutDeviceFlow()}async getUserInfo(){const e=await this.authManager.getUser();return e?.profile}async getUserInfoDeviceFlow(){const e=await this.authManager.getUserDeviceFlow();return e?.profile}async getIdToken(){const e=await this.authManager.getUser();return e?.idToken}async getAccessToken(){const e=await this.authManager.getUser();return e?.accessToken}},e.PassportError=Mz,e.ProviderConfiguration=class{immutableXConfig;baseConfig;constructor({baseConfig:t,overrides:r}){if(this.baseConfig=t,r)this.immutableXConfig=r.immutableXConfig;else switch(t.environment){case e.Environment.SANDBOX:this.immutableXConfig=jB.SANDBOX;break;case e.Environment.PRODUCTION:this.immutableXConfig=jB.PRODUCTION}}},e.SwapReact=q3,e.UpdateConfig=function(e){void 0!==window?window.ImtblCheckoutWidgetConfig=JSON.stringify(e):console.error("missing document object: please run Checkout client side")},e.WalletReact=z3,e.imxClientCreateStarkSigner=DC,e.imxClientGenerateLegacyStarkPrivateKey=QB,e.module="orderbook"}));
85
85
  //# sourceMappingURL=index.browser.js.map