diff --git a/Cargo.lock b/Cargo.lock index 5ae16c48..7ba9e215 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2750,7 +2750,7 @@ dependencies = [ "http-body 1.0.0", "hyper 1.3.1", "pin-project-lite", - "socket2 0.5.6", + "socket2 0.5.7", "tokio", "tower", "tower-service", @@ -3129,6 +3129,7 @@ dependencies = [ "sha2", "sha3", "snow", + "socket2 0.5.7", "static_dir", "thiserror", "tokio", @@ -3264,7 +3265,7 @@ dependencies = [ "sha2", "thiserror", "tokio", - "tokio-tungstenite 0.20.1", + "tokio-tungstenite 0.21.0", "toml", "tracing", "tracing-appender", @@ -5099,9 +5100,8 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "snow" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "850948bee068e713b8ab860fe1adc4d109676ab4c3b621fd8147f06b261f2f85" +version = "0.9.0" +source = "git+https://github.com/dr-frmr/snow?branch=dr/extract_cipherstates#1d4eb5f6747aa59aabb32bbbe698fb4bb7dfb9a4" dependencies = [ "aes-gcm", "blake2", @@ -5126,9 +5126,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", "windows-sys 0.52.0", @@ -5483,7 +5483,7 @@ dependencies = [ "num_cpus", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.6", + "socket2 0.5.7", "tokio-macros", "windows-sys 0.48.0", ] diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index d6cabeb9..929f6d42 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -80,7 +80,10 @@ serde_json = "1.0" serde_urlencoded = "0.7" sha2 = "0.10" sha3 = "0.10.8" -snow = { version = "0.9.5", features = ["ring-resolver"] } +# snow = { version = "0.9.5", features = ["ring-resolver"] } +# unfortunately need to use forked version for async use and in-place encryption +snow = { git = "https://github.com/dr-frmr/snow", branch = "dr/extract_cipherstates", features = ["ring-resolver"] } +socket2 = "0.5.7" static_dir = "0.2.0" thiserror = "1.0" tokio = { version = "1.28", features = ["fs", "macros", "rt-multi-thread", "signal", "sync"] } diff --git a/kinode/packages/app_store/pkg/ui/assets/index-Gc4HI_PE.js b/kinode/packages/app_store/pkg/ui/assets/index--h2dsLNv.js similarity index 68% rename from kinode/packages/app_store/pkg/ui/assets/index-Gc4HI_PE.js rename to kinode/packages/app_store/pkg/ui/assets/index--h2dsLNv.js index a913acd5..cbbf66d1 100644 --- a/kinode/packages/app_store/pkg/ui/assets/index-Gc4HI_PE.js +++ b/kinode/packages/app_store/pkg/ui/assets/index--h2dsLNv.js @@ -1,4 +1,4 @@ -var F2=Object.defineProperty;var U2=(t,e,r)=>e in t?F2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o0=(t,e,r)=>(U2(t,typeof e!="symbol"?e+"":e,r),r);function z2(t,e){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Si(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ys(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var ig={exports:{}},Au={},sg={exports:{}},we={};/** +var U2=Object.defineProperty;var z2=(t,e,r)=>e in t?U2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o0=(t,e,r)=>(z2(t,typeof e!="symbol"?e+"":e,r),r);function $2(t,e){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Si(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ys(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var sg={exports:{}},Au={},og={exports:{}},we={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var F2=Object.defineProperty;var U2=(t,e,r)=>e in t?F2(t,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Aa=Symbol.for("react.element"),$2=Symbol.for("react.portal"),H2=Symbol.for("react.fragment"),q2=Symbol.for("react.strict_mode"),V2=Symbol.for("react.profiler"),G2=Symbol.for("react.provider"),W2=Symbol.for("react.context"),K2=Symbol.for("react.forward_ref"),Q2=Symbol.for("react.suspense"),J2=Symbol.for("react.memo"),Y2=Symbol.for("react.lazy"),a0=Symbol.iterator;function X2(t){return t===null||typeof t!="object"?null:(t=a0&&t[a0]||t["@@iterator"],typeof t=="function"?t:null)}var og={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ag=Object.assign,lg={};function Xs(t,e,r){this.props=t,this.context=e,this.refs=lg,this.updater=r||og}Xs.prototype.isReactComponent={};Xs.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Xs.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function ug(){}ug.prototype=Xs.prototype;function Hh(t,e,r){this.props=t,this.context=e,this.refs=lg,this.updater=r||og}var qh=Hh.prototype=new ug;qh.constructor=Hh;ag(qh,Xs.prototype);qh.isPureReactComponent=!0;var l0=Array.isArray,cg=Object.prototype.hasOwnProperty,Vh={current:null},fg={key:!0,ref:!0,__self:!0,__source:!0};function hg(t,e,r){var n,i={},s=null,o=null;if(e!=null)for(n in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)cg.call(e,n)&&!fg.hasOwnProperty(n)&&(i[n]=e[n]);var a=arguments.length-2;if(a===1)i.children=r;else if(1e in t?F2(t,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var iw=T,sw=Symbol.for("react.element"),ow=Symbol.for("react.fragment"),aw=Object.prototype.hasOwnProperty,lw=iw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,uw={key:!0,ref:!0,__self:!0,__source:!0};function dg(t,e,r){var n,i={},s=null,o=null;r!==void 0&&(s=""+r),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(n in e)aw.call(e,n)&&!uw.hasOwnProperty(n)&&(i[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)i[n]===void 0&&(i[n]=e[n]);return{$$typeof:sw,type:t,key:s,ref:o,props:i,_owner:lw.current}}Au.Fragment=ow;Au.jsx=dg;Au.jsxs=dg;ig.exports=Au;var S=ig.exports,Nf={},pg={exports:{}},wr={},mg={exports:{}},gg={};/** + */var sw=j,ow=Symbol.for("react.element"),aw=Symbol.for("react.fragment"),lw=Object.prototype.hasOwnProperty,uw=sw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,cw={key:!0,ref:!0,__self:!0,__source:!0};function pg(t,e,r){var n,i={},s=null,o=null;r!==void 0&&(s=""+r),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(n in e)lw.call(e,n)&&!cw.hasOwnProperty(n)&&(i[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)i[n]===void 0&&(i[n]=e[n]);return{$$typeof:ow,type:t,key:s,ref:o,props:i,_owner:uw.current}}Au.Fragment=aw;Au.jsx=pg;Au.jsxs=pg;sg.exports=Au;var _=sg.exports,Nf={},mg={exports:{}},wr={},gg={exports:{}},vg={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var F2=Object.defineProperty;var U2=(t,e,r)=>e in t?F2(t,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(t){function e(_,P){var I=_.length;_.push(P);e:for(;0>>1,d=_[N];if(0>>1;Ni(x,I))Bi(z,x)?(_[N]=z,_[B]=I,N=B):(_[N]=x,_[ee]=I,N=ee);else if(Bi(z,I))_[N]=z,_[B]=I,N=B;else break e}}return P}function i(_,P){var I=_.sortIndex-P.sortIndex;return I!==0?I:_.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,h=null,p=3,v=!1,y=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function A(_){for(var P=r(u);P!==null;){if(P.callback===null)n(u);else if(P.startTime<=_)n(u),P.sortIndex=P.expirationTime,e(l,P);else break;P=r(u)}}function j(_){if(b=!1,A(_),!y)if(r(l)!==null)y=!0,E(L);else{var P=r(u);P!==null&&M(j,P.startTime-_)}}function L(_,P){y=!1,b&&(b=!1,w(U),U=-1),v=!0;var I=p;try{for(A(P),h=r(l);h!==null&&(!(h.expirationTime>P)||_&&!re());){var N=h.callback;if(typeof N=="function"){h.callback=null,p=h.priorityLevel;var d=N(h.expirationTime<=P);P=t.unstable_now(),typeof d=="function"?h.callback=d:h===r(l)&&n(l),A(P)}else n(l);h=r(l)}if(h!==null)var C=!0;else{var ee=r(u);ee!==null&&M(j,ee.startTime-P),C=!1}return C}finally{h=null,p=I,v=!1}}var D=!1,F=null,U=-1,G=5,J=-1;function re(){return!(t.unstable_now()-J_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<_?Math.floor(1e3/_):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return r(l)},t.unstable_next=function(_){switch(p){case 1:case 2:case 3:var P=3;break;default:P=p}var I=p;p=P;try{return _()}finally{p=I}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(_,P){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var I=p;p=_;try{return P()}finally{p=I}},t.unstable_scheduleCallback=function(_,P,I){var N=t.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0N?(_.sortIndex=I,e(u,_),r(l)===null&&_===r(u)&&(b?(w(U),U=-1):b=!0,M(j,I-N))):(_.sortIndex=d,e(l,_),y||v||(y=!0,E(L))),_},t.unstable_shouldYield=re,t.unstable_wrapCallback=function(_){var P=p;return function(){var I=p;p=P;try{return _.apply(this,arguments)}finally{p=I}}}})(gg);mg.exports=gg;var cw=mg.exports;/** + */(function(t){function e(S,P){var I=S.length;S.push(P);e:for(;0>>1,d=S[N];if(0>>1;Ni(x,I))Bi(z,x)?(S[N]=z,S[B]=I,N=B):(S[N]=x,S[ee]=I,N=ee);else if(Bi(z,I))S[N]=z,S[B]=I,N=B;else break e}}return P}function i(S,P){var I=S.sortIndex-P.sortIndex;return I!==0?I:S.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,h=null,p=3,v=!1,w=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function A(S){for(var P=r(u);P!==null;){if(P.callback===null)n(u);else if(P.startTime<=S)n(u),P.sortIndex=P.expirationTime,e(l,P);else break;P=r(u)}}function T(S){if(b=!1,A(S),!w)if(r(l)!==null)w=!0,E(L);else{var P=r(u);P!==null&&M(T,P.startTime-S)}}function L(S,P){w=!1,b&&(b=!1,y(U),U=-1),v=!0;var I=p;try{for(A(P),h=r(l);h!==null&&(!(h.expirationTime>P)||S&&!re());){var N=h.callback;if(typeof N=="function"){h.callback=null,p=h.priorityLevel;var d=N(h.expirationTime<=P);P=t.unstable_now(),typeof d=="function"?h.callback=d:h===r(l)&&n(l),A(P)}else n(l);h=r(l)}if(h!==null)var C=!0;else{var ee=r(u);ee!==null&&M(T,ee.startTime-P),C=!1}return C}finally{h=null,p=I,v=!1}}var D=!1,F=null,U=-1,G=5,J=-1;function re(){return!(t.unstable_now()-JS||125N?(S.sortIndex=I,e(u,S),r(l)===null&&S===r(u)&&(b?(y(U),U=-1):b=!0,M(T,I-N))):(S.sortIndex=d,e(l,S),w||v||(w=!0,E(L))),S},t.unstable_shouldYield=re,t.unstable_wrapCallback=function(S){var P=p;return function(){var I=p;p=P;try{return S.apply(this,arguments)}finally{p=I}}}})(vg);gg.exports=vg;var fw=gg.exports;/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ var F2=Object.defineProperty;var U2=(t,e,r)=>e in t?F2(t,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var vg=T,vr=cw;function q(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mf=Object.prototype.hasOwnProperty,fw=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,c0={},f0={};function hw(t){return Mf.call(f0,t)?!0:Mf.call(c0,t)?!1:fw.test(t)?f0[t]=!0:(c0[t]=!0,!1)}function dw(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function pw(t,e,r,n){if(e===null||typeof e>"u"||dw(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Jt(t,e,r,n,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var jt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){jt[t]=new Jt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];jt[e]=new Jt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){jt[t]=new Jt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){jt[t]=new Jt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){jt[t]=new Jt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){jt[t]=new Jt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){jt[t]=new Jt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){jt[t]=new Jt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){jt[t]=new Jt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Wh=/[\-:]([a-z])/g;function Kh(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Wh,Kh);jt[e]=new Jt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Wh,Kh);jt[e]=new Jt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Wh,Kh);jt[e]=new Jt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){jt[t]=new Jt(t,1,!1,t.toLowerCase(),null,!1,!1)});jt.xlinkHref=new Jt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){jt[t]=new Jt(t,1,!1,t.toLowerCase(),null,!0,!0)});function Qh(t,e,r,n){var i=jt.hasOwnProperty(e)?jt[e]:null;(i!==null?i.type!==0:n||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mf=Object.prototype.hasOwnProperty,hw=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,c0={},f0={};function dw(t){return Mf.call(f0,t)?!0:Mf.call(c0,t)?!1:hw.test(t)?f0[t]=!0:(c0[t]=!0,!1)}function pw(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function mw(t,e,r,n){if(e===null||typeof e>"u"||pw(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Jt(t,e,r,n,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var jt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){jt[t]=new Jt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];jt[e]=new Jt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){jt[t]=new Jt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){jt[t]=new Jt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){jt[t]=new Jt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){jt[t]=new Jt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){jt[t]=new Jt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){jt[t]=new Jt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){jt[t]=new Jt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Wh=/[\-:]([a-z])/g;function Kh(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Wh,Kh);jt[e]=new Jt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Wh,Kh);jt[e]=new Jt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Wh,Kh);jt[e]=new Jt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){jt[t]=new Jt(t,1,!1,t.toLowerCase(),null,!1,!1)});jt.xlinkHref=new Jt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){jt[t]=new Jt(t,1,!1,t.toLowerCase(),null,!0,!0)});function Qh(t,e,r,n){var i=jt.hasOwnProperty(e)?jt[e]:null;(i!==null?i.type!==0:n||!(2a||i[o]!==s[a]){var l=` -`+i[o].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{Sc=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?Eo(t):""}function mw(t){switch(t.tag){case 5:return Eo(t.type);case 16:return Eo("Lazy");case 13:return Eo("Suspense");case 19:return Eo("SuspenseList");case 0:case 2:case 15:return t=kc(t.type,!1),t;case 11:return t=kc(t.type.render,!1),t;case 1:return t=kc(t.type,!0),t;default:return""}}function If(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case fs:return"Fragment";case cs:return"Portal";case Cf:return"Profiler";case Jh:return"StrictMode";case Pf:return"Suspense";case Rf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case xg:return(t.displayName||"Context")+".Consumer";case wg:return(t._context.displayName||"Context")+".Provider";case Yh:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Xh:return e=t.displayName||null,e!==null?e:If(t.type)||"Memo";case ii:e=t._payload,t=t._init;try{return If(t(e))}catch{}}return null}function gw(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return If(e);case 8:return e===Jh?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Ei(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Eg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function vw(t){var e=Eg(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Da(t){t._valueTracker||(t._valueTracker=vw(t))}function Ag(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=Eg(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Tl(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Of(t,e){var r=e.checked;return dt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function d0(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=Ei(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function _g(t,e){e=e.checked,e!=null&&Qh(t,"checked",e,!1)}function Tf(t,e){_g(t,e);var r=Ei(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?jf(t,e.type,r):e.hasOwnProperty("defaultValue")&&jf(t,e.type,Ei(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function p0(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function jf(t,e,r){(e!=="number"||Tl(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var Ao=Array.isArray;function Ms(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Fa.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function qo(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var Co={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},yw=["Webkit","ms","Moz","O"];Object.keys(Co).forEach(function(t){yw.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Co[e]=Co[t]})});function Mg(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||Co.hasOwnProperty(t)&&Co[t]?(""+e).trim():e+"px"}function Cg(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=Mg(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var ww=dt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Df(t,e){if(e){if(ww[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(q(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(q(62))}}function Ff(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Uf=null;function Zh(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var zf=null,Cs=null,Ps=null;function v0(t){if(t=ka(t)){if(typeof zf!="function")throw Error(q(280));var e=t.stateNode;e&&(e=Mu(e),zf(t.stateNode,t.type,e))}}function Pg(t){Cs?Ps?Ps.push(t):Ps=[t]:Cs=t}function Rg(){if(Cs){var t=Cs,e=Ps;if(Ps=Cs=null,v0(t),e)for(t=0;t>>=0,t===0?32:31-(Pw(t)/Rw|0)|0}var Ua=64,za=4194304;function _o(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Dl(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,s=t.pingedLanes,o=r&268435455;if(o!==0){var a=o&~i;a!==0?n=_o(a):(s&=o,s!==0&&(n=_o(s)))}else o=r&~i,o!==0?n=_o(o):s!==0&&(n=_o(s));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function _a(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Kr(e),t[e]=r}function jw(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=Ro),k0=" ",N0=!1;function Yg(t,e){switch(t){case"keyup":return ux.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var hs=!1;function fx(t,e){switch(t){case"compositionend":return Xg(e);case"keypress":return e.which!==32?null:(N0=!0,k0);case"textInput":return t=e.data,t===k0&&N0?null:t;default:return null}}function hx(t,e){if(hs)return t==="compositionend"||!ad&&Yg(t,e)?(t=Qg(),ml=id=ci=null,hs=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=R0(r)}}function rv(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?rv(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function nv(){for(var t=window,e=Tl();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Tl(t.document)}return e}function ld(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function bx(t){var e=nv(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&rv(r.ownerDocument.documentElement,r)){if(n!==null&&ld(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!t.extend&&s>n&&(i=n,n=s,s=i),i=I0(r,s);var o=I0(r,n);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>n?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,ds=null,Wf=null,Oo=null,Kf=!1;function O0(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Kf||ds==null||ds!==Tl(n)||(n=ds,"selectionStart"in n&&ld(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Oo&&Jo(Oo,n)||(Oo=n,n=zl(Wf,"onSelect"),0gs||(t.current=eh[gs],eh[gs]=null,gs--)}function Ye(t,e){gs++,eh[gs]=t.current,t.current=e}var Ai={},Ht=Ni(Ai),sr=Ni(!1),Hi=Ai;function Ds(t,e){var r=t.type.contextTypes;if(!r)return Ai;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function or(t){return t=t.childContextTypes,t!=null}function Hl(){nt(sr),nt(Ht)}function U0(t,e,r){if(Ht.current!==Ai)throw Error(q(168));Ye(Ht,e),Ye(sr,r)}function hv(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(q(108,gw(t)||"Unknown",i));return dt({},r,n)}function ql(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Ai,Hi=Ht.current,Ye(Ht,t),Ye(sr,sr.current),!0}function z0(t,e,r){var n=t.stateNode;if(!n)throw Error(q(169));r?(t=hv(t,e,Hi),n.__reactInternalMemoizedMergedChildContext=t,nt(sr),nt(Ht),Ye(Ht,t)):nt(sr),Ye(sr,r)}var Mn=null,Cu=!1,Uc=!1;function dv(t){Mn===null?Mn=[t]:Mn.push(t)}function Ox(t){Cu=!0,dv(t)}function Mi(){if(!Uc&&Mn!==null){Uc=!0;var t=0,e=Oe;try{var r=Mn;for(Oe=1;t>=o,i-=o,In=1<<32-Kr(e)+i|r<U?(G=F,F=null):G=F.sibling;var J=p(w,F,A[U],j);if(J===null){F===null&&(F=G);break}t&&F&&J.alternate===null&&e(w,F),m=s(J,m,U),D===null?L=J:D.sibling=J,D=J,F=G}if(U===A.length)return r(w,F),st&&Ii(w,U),L;if(F===null){for(;UU?(G=F,F=null):G=F.sibling;var re=p(w,F,J.value,j);if(re===null){F===null&&(F=G);break}t&&F&&re.alternate===null&&e(w,F),m=s(re,m,U),D===null?L=re:D.sibling=re,D=re,F=G}if(J.done)return r(w,F),st&&Ii(w,U),L;if(F===null){for(;!J.done;U++,J=A.next())J=h(w,J.value,j),J!==null&&(m=s(J,m,U),D===null?L=J:D.sibling=J,D=J);return st&&Ii(w,U),L}for(F=n(w,F);!J.done;U++,J=A.next())J=v(F,w,U,J.value,j),J!==null&&(t&&J.alternate!==null&&F.delete(J.key===null?U:J.key),m=s(J,m,U),D===null?L=J:D.sibling=J,D=J);return t&&F.forEach(function($e){return e(w,$e)}),st&&Ii(w,U),L}function k(w,m,A,j){if(typeof A=="object"&&A!==null&&A.type===fs&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case Ba:e:{for(var L=A.key,D=m;D!==null;){if(D.key===L){if(L=A.type,L===fs){if(D.tag===7){r(w,D.sibling),m=i(D,A.props.children),m.return=w,w=m;break e}}else if(D.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===ii&&K0(L)===D.type){r(w,D.sibling),m=i(D,A.props),m.ref=ho(w,D,A),m.return=w,w=m;break e}r(w,D);break}else e(w,D);D=D.sibling}A.type===fs?(m=Fi(A.props.children,w.mode,j,A.key),m.return=w,w=m):(j=Al(A.type,A.key,A.props,null,w.mode,j),j.ref=ho(w,m,A),j.return=w,w=j)}return o(w);case cs:e:{for(D=A.key;m!==null;){if(m.key===D)if(m.tag===4&&m.stateNode.containerInfo===A.containerInfo&&m.stateNode.implementation===A.implementation){r(w,m.sibling),m=i(m,A.children||[]),m.return=w,w=m;break e}else{r(w,m);break}else e(w,m);m=m.sibling}m=Kc(A,w.mode,j),m.return=w,w=m}return o(w);case ii:return D=A._init,k(w,m,D(A._payload),j)}if(Ao(A))return y(w,m,A,j);if(ao(A))return b(w,m,A,j);Ka(w,A)}return typeof A=="string"&&A!==""||typeof A=="number"?(A=""+A,m!==null&&m.tag===6?(r(w,m.sibling),m=i(m,A),m.return=w,w=m):(r(w,m),m=Wc(A,w.mode,j),m.return=w,w=m),o(w)):r(w,m)}return k}var Us=bv(!0),Ev=bv(!1),Na={},hn=Ni(Na),ea=Ni(Na),ta=Ni(Na);function Bi(t){if(t===Na)throw Error(q(174));return t}function vd(t,e){switch(Ye(ta,e),Ye(ea,t),Ye(hn,Na),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Bf(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Bf(e,t)}nt(hn),Ye(hn,e)}function zs(){nt(hn),nt(ea),nt(ta)}function Av(t){Bi(ta.current);var e=Bi(hn.current),r=Bf(e,t.type);e!==r&&(Ye(ea,t),Ye(hn,r))}function yd(t){ea.current===t&&(nt(hn),nt(ea))}var ft=Ni(0);function Jl(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var zc=[];function wd(){for(var t=0;tr?r:4,t(!0);var n=$c.transition;$c.transition={};try{t(!1),e()}finally{Oe=r,$c.transition=n}}function Fv(){return Ir().memoizedState}function Bx(t,e,r){var n=xi(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Uv(t))zv(e,r);else if(r=vv(t,e,r,n),r!==null){var i=Kt();Qr(r,t,n,i),$v(r,e,n)}}function Dx(t,e,r){var n=xi(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Uv(t))zv(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,r);if(i.hasEagerState=!0,i.eagerState=a,Jr(a,o)){var l=e.interleaved;l===null?(i.next=i,md(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}r=vv(t,e,i,n),r!==null&&(i=Kt(),Qr(r,t,n,i),$v(r,e,n))}}function Uv(t){var e=t.alternate;return t===ht||e!==null&&e===ht}function zv(t,e){To=Yl=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function $v(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,td(t,r)}}var Xl={readContext:Rr,useCallback:Bt,useContext:Bt,useEffect:Bt,useImperativeHandle:Bt,useInsertionEffect:Bt,useLayoutEffect:Bt,useMemo:Bt,useReducer:Bt,useRef:Bt,useState:Bt,useDebugValue:Bt,useDeferredValue:Bt,useTransition:Bt,useMutableSource:Bt,useSyncExternalStore:Bt,useId:Bt,unstable_isNewReconciler:!1},Fx={readContext:Rr,useCallback:function(t,e){return rn().memoizedState=[t,e===void 0?null:e],t},useContext:Rr,useEffect:J0,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,wl(4194308,4,Tv.bind(null,e,t),r)},useLayoutEffect:function(t,e){return wl(4194308,4,t,e)},useInsertionEffect:function(t,e){return wl(4,2,t,e)},useMemo:function(t,e){var r=rn();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=rn();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=Bx.bind(null,ht,t),[n.memoizedState,t]},useRef:function(t){var e=rn();return t={current:t},e.memoizedState=t},useState:Q0,useDebugValue:_d,useDeferredValue:function(t){return rn().memoizedState=t},useTransition:function(){var t=Q0(!1),e=t[0];return t=Lx.bind(null,t[1]),rn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ht,i=rn();if(st){if(r===void 0)throw Error(q(407));r=r()}else{if(r=e(),Mt===null)throw Error(q(349));Vi&30||kv(n,e,r)}i.memoizedState=r;var s={value:r,getSnapshot:e};return i.queue=s,J0(Mv.bind(null,n,s,t),[t]),n.flags|=2048,ia(9,Nv.bind(null,n,s,r,e),void 0,null),r},useId:function(){var t=rn(),e=Mt.identifierPrefix;if(st){var r=On,n=In;r=(n&~(1<<32-Kr(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=ra++,0")&&(l=l.replace("",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{Sc=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?Eo(t):""}function gw(t){switch(t.tag){case 5:return Eo(t.type);case 16:return Eo("Lazy");case 13:return Eo("Suspense");case 19:return Eo("SuspenseList");case 0:case 2:case 15:return t=kc(t.type,!1),t;case 11:return t=kc(t.type.render,!1),t;case 1:return t=kc(t.type,!0),t;default:return""}}function If(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case fs:return"Fragment";case cs:return"Portal";case Cf:return"Profiler";case Jh:return"StrictMode";case Pf:return"Suspense";case Rf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case bg:return(t.displayName||"Context")+".Consumer";case xg:return(t._context.displayName||"Context")+".Provider";case Yh:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Xh:return e=t.displayName||null,e!==null?e:If(t.type)||"Memo";case ii:e=t._payload,t=t._init;try{return If(t(e))}catch{}}return null}function vw(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return If(e);case 8:return e===Jh?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Ei(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ag(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function yw(t){var e=Ag(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Da(t){t._valueTracker||(t._valueTracker=yw(t))}function _g(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=Ag(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Tl(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Of(t,e){var r=e.checked;return dt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function d0(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=Ei(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Sg(t,e){e=e.checked,e!=null&&Qh(t,"checked",e,!1)}function Tf(t,e){Sg(t,e);var r=Ei(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?jf(t,e.type,r):e.hasOwnProperty("defaultValue")&&jf(t,e.type,Ei(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function p0(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function jf(t,e,r){(e!=="number"||Tl(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var Ao=Array.isArray;function Ms(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Fa.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function qo(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var Co={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ww=["Webkit","ms","Moz","O"];Object.keys(Co).forEach(function(t){ww.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Co[e]=Co[t]})});function Cg(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||Co.hasOwnProperty(t)&&Co[t]?(""+e).trim():e+"px"}function Pg(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=Cg(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var xw=dt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Df(t,e){if(e){if(xw[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(q(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(q(62))}}function Ff(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Uf=null;function Zh(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var zf=null,Cs=null,Ps=null;function v0(t){if(t=ka(t)){if(typeof zf!="function")throw Error(q(280));var e=t.stateNode;e&&(e=Mu(e),zf(t.stateNode,t.type,e))}}function Rg(t){Cs?Ps?Ps.push(t):Ps=[t]:Cs=t}function Ig(){if(Cs){var t=Cs,e=Ps;if(Ps=Cs=null,v0(t),e)for(t=0;t>>=0,t===0?32:31-(Rw(t)/Iw|0)|0}var Ua=64,za=4194304;function _o(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Dl(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,s=t.pingedLanes,o=r&268435455;if(o!==0){var a=o&~i;a!==0?n=_o(a):(s&=o,s!==0&&(n=_o(s)))}else o=r&~i,o!==0?n=_o(o):s!==0&&(n=_o(s));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function _a(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Kr(e),t[e]=r}function Lw(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=Ro),k0=" ",N0=!1;function Xg(t,e){switch(t){case"keyup":return cx.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var hs=!1;function hx(t,e){switch(t){case"compositionend":return Zg(e);case"keypress":return e.which!==32?null:(N0=!0,k0);case"textInput":return t=e.data,t===k0&&N0?null:t;default:return null}}function dx(t,e){if(hs)return t==="compositionend"||!ad&&Xg(t,e)?(t=Jg(),ml=id=ci=null,hs=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=R0(r)}}function nv(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?nv(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function iv(){for(var t=window,e=Tl();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Tl(t.document)}return e}function ld(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Ex(t){var e=iv(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&nv(r.ownerDocument.documentElement,r)){if(n!==null&&ld(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!t.extend&&s>n&&(i=n,n=s,s=i),i=I0(r,s);var o=I0(r,n);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>n?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,ds=null,Wf=null,Oo=null,Kf=!1;function O0(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Kf||ds==null||ds!==Tl(n)||(n=ds,"selectionStart"in n&&ld(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Oo&&Jo(Oo,n)||(Oo=n,n=zl(Wf,"onSelect"),0gs||(t.current=eh[gs],eh[gs]=null,gs--)}function Ye(t,e){gs++,eh[gs]=t.current,t.current=e}var Ai={},Ht=Ni(Ai),sr=Ni(!1),Hi=Ai;function Ds(t,e){var r=t.type.contextTypes;if(!r)return Ai;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function or(t){return t=t.childContextTypes,t!=null}function Hl(){nt(sr),nt(Ht)}function U0(t,e,r){if(Ht.current!==Ai)throw Error(q(168));Ye(Ht,e),Ye(sr,r)}function dv(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(q(108,vw(t)||"Unknown",i));return dt({},r,n)}function ql(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Ai,Hi=Ht.current,Ye(Ht,t),Ye(sr,sr.current),!0}function z0(t,e,r){var n=t.stateNode;if(!n)throw Error(q(169));r?(t=dv(t,e,Hi),n.__reactInternalMemoizedMergedChildContext=t,nt(sr),nt(Ht),Ye(Ht,t)):nt(sr),Ye(sr,r)}var Mn=null,Cu=!1,Uc=!1;function pv(t){Mn===null?Mn=[t]:Mn.push(t)}function Tx(t){Cu=!0,pv(t)}function Mi(){if(!Uc&&Mn!==null){Uc=!0;var t=0,e=Oe;try{var r=Mn;for(Oe=1;t>=o,i-=o,In=1<<32-Kr(e)+i|r<U?(G=F,F=null):G=F.sibling;var J=p(y,F,A[U],T);if(J===null){F===null&&(F=G);break}t&&F&&J.alternate===null&&e(y,F),m=s(J,m,U),D===null?L=J:D.sibling=J,D=J,F=G}if(U===A.length)return r(y,F),st&&Ii(y,U),L;if(F===null){for(;UU?(G=F,F=null):G=F.sibling;var re=p(y,F,J.value,T);if(re===null){F===null&&(F=G);break}t&&F&&re.alternate===null&&e(y,F),m=s(re,m,U),D===null?L=re:D.sibling=re,D=re,F=G}if(J.done)return r(y,F),st&&Ii(y,U),L;if(F===null){for(;!J.done;U++,J=A.next())J=h(y,J.value,T),J!==null&&(m=s(J,m,U),D===null?L=J:D.sibling=J,D=J);return st&&Ii(y,U),L}for(F=n(y,F);!J.done;U++,J=A.next())J=v(F,y,U,J.value,T),J!==null&&(t&&J.alternate!==null&&F.delete(J.key===null?U:J.key),m=s(J,m,U),D===null?L=J:D.sibling=J,D=J);return t&&F.forEach(function($e){return e(y,$e)}),st&&Ii(y,U),L}function k(y,m,A,T){if(typeof A=="object"&&A!==null&&A.type===fs&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case Ba:e:{for(var L=A.key,D=m;D!==null;){if(D.key===L){if(L=A.type,L===fs){if(D.tag===7){r(y,D.sibling),m=i(D,A.props.children),m.return=y,y=m;break e}}else if(D.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===ii&&K0(L)===D.type){r(y,D.sibling),m=i(D,A.props),m.ref=ho(y,D,A),m.return=y,y=m;break e}r(y,D);break}else e(y,D);D=D.sibling}A.type===fs?(m=Fi(A.props.children,y.mode,T,A.key),m.return=y,y=m):(T=Al(A.type,A.key,A.props,null,y.mode,T),T.ref=ho(y,m,A),T.return=y,y=T)}return o(y);case cs:e:{for(D=A.key;m!==null;){if(m.key===D)if(m.tag===4&&m.stateNode.containerInfo===A.containerInfo&&m.stateNode.implementation===A.implementation){r(y,m.sibling),m=i(m,A.children||[]),m.return=y,y=m;break e}else{r(y,m);break}else e(y,m);m=m.sibling}m=Kc(A,y.mode,T),m.return=y,y=m}return o(y);case ii:return D=A._init,k(y,m,D(A._payload),T)}if(Ao(A))return w(y,m,A,T);if(ao(A))return b(y,m,A,T);Ka(y,A)}return typeof A=="string"&&A!==""||typeof A=="number"?(A=""+A,m!==null&&m.tag===6?(r(y,m.sibling),m=i(m,A),m.return=y,y=m):(r(y,m),m=Wc(A,y.mode,T),m.return=y,y=m),o(y)):r(y,m)}return k}var Us=Ev(!0),Av=Ev(!1),Na={},hn=Ni(Na),ea=Ni(Na),ta=Ni(Na);function Bi(t){if(t===Na)throw Error(q(174));return t}function vd(t,e){switch(Ye(ta,e),Ye(ea,t),Ye(hn,Na),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Bf(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Bf(e,t)}nt(hn),Ye(hn,e)}function zs(){nt(hn),nt(ea),nt(ta)}function _v(t){Bi(ta.current);var e=Bi(hn.current),r=Bf(e,t.type);e!==r&&(Ye(ea,t),Ye(hn,r))}function yd(t){ea.current===t&&(nt(hn),nt(ea))}var ft=Ni(0);function Jl(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var zc=[];function wd(){for(var t=0;tr?r:4,t(!0);var n=$c.transition;$c.transition={};try{t(!1),e()}finally{Oe=r,$c.transition=n}}function Uv(){return Ir().memoizedState}function Dx(t,e,r){var n=xi(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},zv(t))$v(e,r);else if(r=yv(t,e,r,n),r!==null){var i=Kt();Qr(r,t,n,i),Hv(r,e,n)}}function Fx(t,e,r){var n=xi(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(zv(t))$v(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,r);if(i.hasEagerState=!0,i.eagerState=a,Jr(a,o)){var l=e.interleaved;l===null?(i.next=i,md(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}r=yv(t,e,i,n),r!==null&&(i=Kt(),Qr(r,t,n,i),Hv(r,e,n))}}function zv(t){var e=t.alternate;return t===ht||e!==null&&e===ht}function $v(t,e){To=Yl=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Hv(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,td(t,r)}}var Xl={readContext:Rr,useCallback:Bt,useContext:Bt,useEffect:Bt,useImperativeHandle:Bt,useInsertionEffect:Bt,useLayoutEffect:Bt,useMemo:Bt,useReducer:Bt,useRef:Bt,useState:Bt,useDebugValue:Bt,useDeferredValue:Bt,useTransition:Bt,useMutableSource:Bt,useSyncExternalStore:Bt,useId:Bt,unstable_isNewReconciler:!1},Ux={readContext:Rr,useCallback:function(t,e){return rn().memoizedState=[t,e===void 0?null:e],t},useContext:Rr,useEffect:J0,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,wl(4194308,4,jv.bind(null,e,t),r)},useLayoutEffect:function(t,e){return wl(4194308,4,t,e)},useInsertionEffect:function(t,e){return wl(4,2,t,e)},useMemo:function(t,e){var r=rn();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=rn();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=Dx.bind(null,ht,t),[n.memoizedState,t]},useRef:function(t){var e=rn();return t={current:t},e.memoizedState=t},useState:Q0,useDebugValue:_d,useDeferredValue:function(t){return rn().memoizedState=t},useTransition:function(){var t=Q0(!1),e=t[0];return t=Bx.bind(null,t[1]),rn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ht,i=rn();if(st){if(r===void 0)throw Error(q(407));r=r()}else{if(r=e(),Mt===null)throw Error(q(349));Vi&30||Nv(n,e,r)}i.memoizedState=r;var s={value:r,getSnapshot:e};return i.queue=s,J0(Cv.bind(null,n,s,t),[t]),n.flags|=2048,ia(9,Mv.bind(null,n,s,r,e),void 0,null),r},useId:function(){var t=rn(),e=Mt.identifierPrefix;if(st){var r=On,n=In;r=(n&~(1<<32-Kr(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=ra++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=o.createElement(r,{is:n.is}):(t=o.createElement(r),r==="select"&&(o=t,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):t=o.createElementNS(t,r),t[an]=e,t[Zo]=n,Yv(t,e,!1,!1),e.stateNode=t;e:{switch(o=Ff(r,n),r){case"dialog":rt("cancel",t),rt("close",t),i=n;break;case"iframe":case"object":case"embed":rt("load",t),i=n;break;case"video":case"audio":for(i=0;iHs&&(e.flags|=128,n=!0,po(s,!1),e.lanes=4194304)}else{if(!n)if(t=Jl(o),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),po(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!st)return Dt(e),null}else 2*wt()-s.renderingStartTime>Hs&&r!==1073741824&&(e.flags|=128,n=!0,po(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(r=s.last,r!==null?r.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=wt(),e.sibling=null,r=ft.current,Ye(ft,n?r&1|2:r&1),e):(Dt(e),null);case 22:case 23:return Pd(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?fr&1073741824&&(Dt(e),e.subtreeFlags&6&&(e.flags|=8192)):Dt(e),null;case 24:return null;case 25:return null}throw Error(q(156,e.tag))}function Wx(t,e){switch(cd(e),e.tag){case 1:return or(e.type)&&Hl(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return zs(),nt(sr),nt(Ht),wd(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return yd(e),null;case 13:if(nt(ft),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(q(340));Fs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return nt(ft),null;case 4:return zs(),null;case 10:return pd(e.type._context),null;case 22:case 23:return Pd(),null;case 24:return null;default:return null}}var Ja=!1,Ft=!1,Kx=typeof WeakSet=="function"?WeakSet:Set,X=null;function xs(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){mt(t,e,n)}else r.current=null}function hh(t,e,r){try{r()}catch(n){mt(t,e,n)}}var sp=!1;function Qx(t,e){if(Qf=Fl,t=nv(),ld(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,a=-1,l=-1,u=0,c=0,h=t,p=null;t:for(;;){for(var v;h!==r||i!==0&&h.nodeType!==3||(a=o+i),h!==s||n!==0&&h.nodeType!==3||(l=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(v=h.firstChild)!==null;)p=h,h=v;for(;;){if(h===t)break t;if(p===r&&++u===i&&(a=o),p===s&&++c===n&&(l=o),(v=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=v}r=a===-1||l===-1?null:{start:a,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(Jf={focusedElem:t,selectionRange:r},Fl=!1,X=e;X!==null;)if(e=X,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,X=t;else for(;X!==null;){e=X;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var b=y.memoizedProps,k=y.memoizedState,w=e.stateNode,m=w.getSnapshotBeforeUpdate(e.elementType===e.type?b:zr(e.type,b),k);w.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var A=e.stateNode.containerInfo;A.nodeType===1?A.textContent="":A.nodeType===9&&A.documentElement&&A.removeChild(A.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(j){mt(e,e.return,j)}if(t=e.sibling,t!==null){t.return=e.return,X=t;break}X=e.return}return y=sp,sp=!1,y}function jo(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&hh(e,r,s)}i=i.next}while(i!==n)}}function Iu(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function dh(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function e1(t){var e=t.alternate;e!==null&&(t.alternate=null,e1(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[an],delete e[Zo],delete e[Zf],delete e[Rx],delete e[Ix])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function t1(t){return t.tag===5||t.tag===3||t.tag===4}function op(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||t1(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ph(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=$l));else if(n!==4&&(t=t.child,t!==null))for(ph(t,e,r),t=t.sibling;t!==null;)ph(t,e,r),t=t.sibling}function mh(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(mh(t,e,r),t=t.sibling;t!==null;)mh(t,e,r),t=t.sibling}var Rt=null,qr=!1;function ti(t,e,r){for(r=r.child;r!==null;)r1(t,e,r),r=r.sibling}function r1(t,e,r){if(fn&&typeof fn.onCommitFiberUnmount=="function")try{fn.onCommitFiberUnmount(_u,r)}catch{}switch(r.tag){case 5:Ft||xs(r,e);case 6:var n=Rt,i=qr;Rt=null,ti(t,e,r),Rt=n,qr=i,Rt!==null&&(qr?(t=Rt,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Rt.removeChild(r.stateNode));break;case 18:Rt!==null&&(qr?(t=Rt,r=r.stateNode,t.nodeType===8?Fc(t.parentNode,r):t.nodeType===1&&Fc(t,r),Ko(t)):Fc(Rt,r.stateNode));break;case 4:n=Rt,i=qr,Rt=r.stateNode.containerInfo,qr=!0,ti(t,e,r),Rt=n,qr=i;break;case 0:case 11:case 14:case 15:if(!Ft&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&hh(r,e,o),i=i.next}while(i!==n)}ti(t,e,r);break;case 1:if(!Ft&&(xs(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){mt(r,e,a)}ti(t,e,r);break;case 21:ti(t,e,r);break;case 22:r.mode&1?(Ft=(n=Ft)||r.memoizedState!==null,ti(t,e,r),Ft=n):ti(t,e,r);break;default:ti(t,e,r)}}function ap(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new Kx),e.forEach(function(n){var i=ib.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Br(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~s}if(n=i,n=wt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Yx(n/1960))-n,10t?16:t,fi===null)var n=!1;else{if(t=fi,fi=null,tu=0,Ae&6)throw Error(q(331));var i=Ae;for(Ae|=4,X=t.current;X!==null;){var s=X,o=s.child;if(X.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lwt()-Md?Di(t,0):Nd|=r),ar(t,e)}function c1(t,e){e===0&&(t.mode&1?(e=za,za<<=1,!(za&130023424)&&(za=4194304)):e=1);var r=Kt();t=Fn(t,e),t!==null&&(_a(t,e,r),ar(t,r))}function nb(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),c1(t,r)}function ib(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(q(314))}n!==null&&n.delete(e),c1(t,r)}var f1;f1=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||sr.current)ir=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return ir=!1,Vx(t,e,r);ir=!!(t.flags&131072)}else ir=!1,st&&e.flags&1048576&&pv(e,Gl,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;xl(t,e),t=e.pendingProps;var i=Ds(e,Ht.current);Is(e,r),i=bd(null,e,n,t,i,r);var s=Ed();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,or(n)?(s=!0,ql(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,gd(e),i.updater=Pu,e.stateNode=i,i._reactInternals=e,sh(e,n,t,r),e=lh(null,e,n,!0,s,r)):(e.tag=0,st&&s&&ud(e),Wt(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(xl(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=ob(n),t=zr(n,t),i){case 0:e=ah(null,e,n,t,r);break e;case 1:e=rp(null,e,n,t,r);break e;case 11:e=ep(null,e,n,t,r);break e;case 14:e=tp(null,e,n,zr(n.type,t),r);break e}throw Error(q(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:zr(n,i),ah(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:zr(n,i),rp(t,e,n,i,r);case 3:e:{if(Kv(e),t===null)throw Error(q(387));n=e.pendingProps,s=e.memoizedState,i=s.element,yv(t,e),Ql(e,n,null,r);var o=e.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=$s(Error(q(423)),e),e=np(t,e,n,r,i);break e}else if(n!==i){i=$s(Error(q(424)),e),e=np(t,e,n,r,i);break e}else for(pr=vi(e.stateNode.containerInfo.firstChild),gr=e,st=!0,Vr=null,r=Ev(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Fs(),n===i){e=Un(t,e,r);break e}Wt(t,e,n,r)}e=e.child}return e;case 5:return Av(e),t===null&&rh(e),n=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,Yf(n,i)?o=null:s!==null&&Yf(n,s)&&(e.flags|=32),Wv(t,e),Wt(t,e,o,r),e.child;case 6:return t===null&&rh(e),null;case 13:return Qv(t,e,r);case 4:return vd(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Us(e,null,n,r):Wt(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:zr(n,i),ep(t,e,n,i,r);case 7:return Wt(t,e,e.pendingProps,r),e.child;case 8:return Wt(t,e,e.pendingProps.children,r),e.child;case 12:return Wt(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,Ye(Wl,n._currentValue),n._currentValue=o,s!==null)if(Jr(s.value,o)){if(s.children===i.children&&!sr.current){e=Un(t,e,r);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===n){if(s.tag===1){l=jn(-1,r&-r),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),nh(s.return,r,e),a.lanes|=r;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(q(341));o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),nh(o,r,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Wt(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Is(e,r),i=Rr(i),n=n(i),e.flags|=1,Wt(t,e,n,r),e.child;case 14:return n=e.type,i=zr(n,e.pendingProps),i=zr(n.type,i),tp(t,e,n,i,r);case 15:return Vv(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:zr(n,i),xl(t,e),e.tag=1,or(n)?(t=!0,ql(e)):t=!1,Is(e,r),xv(e,n,i),sh(e,n,i,r),lh(null,e,n,!0,t,r);case 19:return Jv(t,e,r);case 22:return Gv(t,e,r)}throw Error(q(156,e.tag))};function h1(t,e){return Dg(t,e)}function sb(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Cr(t,e,r,n){return new sb(t,e,r,n)}function Id(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ob(t){if(typeof t=="function")return Id(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Yh)return 11;if(t===Xh)return 14}return 2}function bi(t,e){var r=t.alternate;return r===null?(r=Cr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function Al(t,e,r,n,i,s){var o=2;if(n=t,typeof t=="function")Id(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case fs:return Fi(r.children,i,s,e);case Jh:o=8,i|=8;break;case Cf:return t=Cr(12,r,e,i|2),t.elementType=Cf,t.lanes=s,t;case Pf:return t=Cr(13,r,e,i),t.elementType=Pf,t.lanes=s,t;case Rf:return t=Cr(19,r,e,i),t.elementType=Rf,t.lanes=s,t;case bg:return Tu(r,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case wg:o=10;break e;case xg:o=9;break e;case Yh:o=11;break e;case Xh:o=14;break e;case ii:o=16,n=null;break e}throw Error(q(130,t==null?t:typeof t,""))}return e=Cr(o,r,e,i),e.elementType=t,e.type=n,e.lanes=s,e}function Fi(t,e,r,n){return t=Cr(7,t,n,e),t.lanes=r,t}function Tu(t,e,r,n){return t=Cr(22,t,n,e),t.elementType=bg,t.lanes=r,t.stateNode={isHidden:!1},t}function Wc(t,e,r){return t=Cr(6,t,null,e),t.lanes=r,t}function Kc(t,e,r){return e=Cr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function ab(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Mc(0),this.expirationTimes=Mc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Od(t,e,r,n,i,s,o,a,l){return t=new ab(t,e,r,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Cr(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},gd(s),t}function lb(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(g1)}catch(t){console.error(t)}}g1(),pg.exports=wr;var oa=pg.exports,mp=oa;Nf.createRoot=mp.createRoot,Nf.hydrateRoot=mp.hydrateRoot;/** +`+s.stack}return{value:t,source:e,stack:i,digest:null}}function Vc(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function oh(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var Hx=typeof WeakMap=="function"?WeakMap:Map;function qv(t,e,r){r=jn(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){eu||(eu=!0,gh=n),oh(t,e)},r}function Vv(t,e,r){r=jn(-1,r),r.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var i=e.value;r.payload=function(){return n(i)},r.callback=function(){oh(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){oh(t,e),typeof n!="function"&&(wi===null?wi=new Set([this]):wi.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),r}function Y0(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new Hx;var i=new Set;n.set(e,i)}else i=n.get(e),i===void 0&&(i=new Set,n.set(e,i));i.has(r)||(i.add(r),t=nb.bind(null,t,e,r),e.then(t,t))}function X0(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function Z0(t,e,r,n,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=jn(-1,1),e.tag=2,yi(r,e,1))),r.lanes|=1),t)}var qx=qn.ReactCurrentOwner,ir=!1;function Wt(t,e,r,n){e.child=t===null?Av(e,null,r,n):Us(e,t.child,r,n)}function ep(t,e,r,n,i){r=r.render;var s=e.ref;return Is(e,i),n=bd(t,e,r,n,s,i),r=Ed(),t!==null&&!ir?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Un(t,e,i)):(st&&r&&ud(e),e.flags|=1,Wt(t,e,n,i),e.child)}function tp(t,e,r,n,i){if(t===null){var s=r.type;return typeof s=="function"&&!Id(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=s,Gv(t,e,s,n,i)):(t=Al(r.type,null,n,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var o=s.memoizedProps;if(r=r.compare,r=r!==null?r:Jo,r(o,n)&&t.ref===e.ref)return Un(t,e,i)}return e.flags|=1,t=bi(s,n),t.ref=e.ref,t.return=e,e.child=t}function Gv(t,e,r,n,i){if(t!==null){var s=t.memoizedProps;if(Jo(s,n)&&t.ref===e.ref)if(ir=!1,e.pendingProps=n=s,(t.lanes&i)!==0)t.flags&131072&&(ir=!0);else return e.lanes=t.lanes,Un(t,e,i)}return ah(t,e,r,n,i)}function Wv(t,e,r){var n=e.pendingProps,i=n.children,s=t!==null?t.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ye(bs,fr),fr|=r;else{if(!(r&1073741824))return t=s!==null?s.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Ye(bs,fr),fr|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,Ye(bs,fr),fr|=n}else s!==null?(n=s.baseLanes|r,e.memoizedState=null):n=r,Ye(bs,fr),fr|=n;return Wt(t,e,i,r),e.child}function Kv(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function ah(t,e,r,n,i){var s=or(r)?Hi:Ht.current;return s=Ds(e,s),Is(e,i),r=bd(t,e,r,n,s,i),n=Ed(),t!==null&&!ir?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Un(t,e,i)):(st&&n&&ud(e),e.flags|=1,Wt(t,e,r,i),e.child)}function rp(t,e,r,n,i){if(or(r)){var s=!0;ql(e)}else s=!1;if(Is(e,i),e.stateNode===null)xl(t,e),bv(e,r,n),sh(e,r,n,i),n=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,u=r.contextType;typeof u=="object"&&u!==null?u=Rr(u):(u=or(r)?Hi:Ht.current,u=Ds(e,u));var c=r.getDerivedStateFromProps,h=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==n||l!==u)&&W0(e,o,n,u),si=!1;var p=e.memoizedState;o.state=p,Ql(e,n,o,i),l=e.memoizedState,a!==n||p!==l||sr.current||si?(typeof c=="function"&&(ih(e,r,c,n),l=e.memoizedState),(a=si||G0(e,r,a,n,p,l,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=l),o.props=n,o.state=l,o.context=u,n=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{o=e.stateNode,wv(t,e),a=e.memoizedProps,u=e.type===e.elementType?a:zr(e.type,a),o.props=u,h=e.pendingProps,p=o.context,l=r.contextType,typeof l=="object"&&l!==null?l=Rr(l):(l=or(r)?Hi:Ht.current,l=Ds(e,l));var v=r.getDerivedStateFromProps;(c=typeof v=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||p!==l)&&W0(e,o,n,l),si=!1,p=e.memoizedState,o.state=p,Ql(e,n,o,i);var w=e.memoizedState;a!==h||p!==w||sr.current||si?(typeof v=="function"&&(ih(e,r,v,n),w=e.memoizedState),(u=si||G0(e,r,u,n,p,w,l)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,w,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,w,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=w),o.props=n,o.state=w,o.context=l,n=u):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),n=!1)}return lh(t,e,r,n,s,i)}function lh(t,e,r,n,i,s){Kv(t,e);var o=(e.flags&128)!==0;if(!n&&!o)return i&&z0(e,r,!1),Un(t,e,s);n=e.stateNode,qx.current=e;var a=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&o?(e.child=Us(e,t.child,null,s),e.child=Us(e,null,a,s)):Wt(t,e,a,s),e.memoizedState=n.state,i&&z0(e,r,!0),e.child}function Qv(t){var e=t.stateNode;e.pendingContext?U0(t,e.pendingContext,e.pendingContext!==e.context):e.context&&U0(t,e.context,!1),vd(t,e.containerInfo)}function np(t,e,r,n,i){return Fs(),fd(i),e.flags|=256,Wt(t,e,r,n),e.child}var uh={dehydrated:null,treeContext:null,retryLane:0};function ch(t){return{baseLanes:t,cachePool:null,transitions:null}}function Jv(t,e,r){var n=e.pendingProps,i=ft.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(i&2)!==0),a?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),Ye(ft,i&1),t===null)return rh(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=n.children,t=n.fallback,s?(n=e.mode,s=e.child,o={mode:"hidden",children:o},!(n&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Tu(o,n,0,null),t=Fi(t,n,r,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=ch(r),e.memoizedState=uh,t):Sd(e,o));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return Vx(t,e,o,n,a,i,r);if(s){s=n.fallback,o=e.mode,i=t.child,a=i.sibling;var l={mode:"hidden",children:n.children};return!(o&1)&&e.child!==i?(n=e.child,n.childLanes=0,n.pendingProps=l,e.deletions=null):(n=bi(i,l),n.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=bi(a,s):(s=Fi(s,o,r,null),s.flags|=2),s.return=e,n.return=e,n.sibling=s,e.child=n,n=s,s=e.child,o=t.child.memoizedState,o=o===null?ch(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~r,e.memoizedState=uh,n}return s=t.child,t=s.sibling,n=bi(s,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function Sd(t,e){return e=Tu({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Qa(t,e,r,n){return n!==null&&fd(n),Us(e,t.child,null,r),t=Sd(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Vx(t,e,r,n,i,s,o){if(r)return e.flags&256?(e.flags&=-257,n=Vc(Error(q(422))),Qa(t,e,o,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=n.fallback,i=e.mode,n=Tu({mode:"visible",children:n.children},i,0,null),s=Fi(s,i,o,null),s.flags|=2,n.return=e,s.return=e,n.sibling=s,e.child=n,e.mode&1&&Us(e,t.child,null,o),e.child.memoizedState=ch(o),e.memoizedState=uh,s);if(!(e.mode&1))return Qa(t,e,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var a=n.dgst;return n=a,s=Error(q(419)),n=Vc(s,n,void 0),Qa(t,e,o,n)}if(a=(o&t.childLanes)!==0,ir||a){if(n=Mt,n!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Fn(t,i),Qr(n,t,i,-1))}return Rd(),n=Vc(Error(q(421))),Qa(t,e,o,n)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=ib.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,pr=vi(i.nextSibling),gr=e,st=!0,Vr=null,t!==null&&(Nr[Mr++]=In,Nr[Mr++]=On,Nr[Mr++]=qi,In=t.id,On=t.overflow,qi=e),e=Sd(e,n.children),e.flags|=4096,e)}function ip(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),nh(t.return,e,r)}function Gc(t,e,r,n,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function Yv(t,e,r){var n=e.pendingProps,i=n.revealOrder,s=n.tail;if(Wt(t,e,n.children,r),n=ft.current,n&2)n=n&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&ip(t,r,e);else if(t.tag===19)ip(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(Ye(ft,n),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(r=e.child,i=null;r!==null;)t=r.alternate,t!==null&&Jl(t)===null&&(i=r),r=r.sibling;r=i,r===null?(i=e.child,e.child=null):(i=r.sibling,r.sibling=null),Gc(e,!1,i,r,s);break;case"backwards":for(r=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&Jl(t)===null){e.child=i;break}t=i.sibling,i.sibling=r,r=i,i=t}Gc(e,!0,r,null,s);break;case"together":Gc(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function xl(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Un(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),Gi|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(q(153));if(e.child!==null){for(t=e.child,r=bi(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=bi(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function Gx(t,e,r){switch(e.tag){case 3:Qv(e),Fs();break;case 5:_v(e);break;case 1:or(e.type)&&ql(e);break;case 4:vd(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,i=e.memoizedProps.value;Ye(Wl,n._currentValue),n._currentValue=i;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(Ye(ft,ft.current&1),e.flags|=128,null):r&e.child.childLanes?Jv(t,e,r):(Ye(ft,ft.current&1),t=Un(t,e,r),t!==null?t.sibling:null);Ye(ft,ft.current&1);break;case 19:if(n=(r&e.childLanes)!==0,t.flags&128){if(n)return Yv(t,e,r);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ye(ft,ft.current),n)break;return null;case 22:case 23:return e.lanes=0,Wv(t,e,r)}return Un(t,e,r)}var Xv,fh,Zv,e1;Xv=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};fh=function(){};Zv=function(t,e,r,n){var i=t.memoizedProps;if(i!==n){t=e.stateNode,Bi(hn.current);var s=null;switch(r){case"input":i=Of(t,i),n=Of(t,n),s=[];break;case"select":i=dt({},i,{value:void 0}),n=dt({},n,{value:void 0}),s=[];break;case"textarea":i=Lf(t,i),n=Lf(t,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=$l)}Df(r,n);var o;r=null;for(u in i)if(!n.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var a=i[u];for(o in a)a.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Ho.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in n){var l=n[u];if(a=i!=null?i[u]:void 0,n.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(r||(r={}),r[o]=l[o])}else r||(s||(s=[]),s.push(u,r)),r=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Ho.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&rt("scroll",t),s||a===l||(s=[])):(s=s||[]).push(u,l))}r&&(s=s||[]).push("style",r);var u=s;(e.updateQueue=u)&&(e.flags|=4)}};e1=function(t,e,r,n){r!==n&&(e.flags|=4)};function po(t,e){if(!st)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function Dt(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,n=0;if(e)for(var i=t.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=n,t.childLanes=r,e}function Wx(t,e,r){var n=e.pendingProps;switch(cd(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(e),null;case 1:return or(e.type)&&Hl(),Dt(e),null;case 3:return n=e.stateNode,zs(),nt(sr),nt(Ht),wd(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Wa(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Vr!==null&&(wh(Vr),Vr=null))),fh(t,e),Dt(e),null;case 5:yd(e);var i=Bi(ta.current);if(r=e.type,t!==null&&e.stateNode!=null)Zv(t,e,r,n,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(q(166));return Dt(e),null}if(t=Bi(hn.current),Wa(e)){n=e.stateNode,r=e.type;var s=e.memoizedProps;switch(n[an]=e,n[Zo]=s,t=(e.mode&1)!==0,r){case"dialog":rt("cancel",n),rt("close",n);break;case"iframe":case"object":case"embed":rt("load",n);break;case"video":case"audio":for(i=0;i<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=o.createElement(r,{is:n.is}):(t=o.createElement(r),r==="select"&&(o=t,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):t=o.createElementNS(t,r),t[an]=e,t[Zo]=n,Xv(t,e,!1,!1),e.stateNode=t;e:{switch(o=Ff(r,n),r){case"dialog":rt("cancel",t),rt("close",t),i=n;break;case"iframe":case"object":case"embed":rt("load",t),i=n;break;case"video":case"audio":for(i=0;iHs&&(e.flags|=128,n=!0,po(s,!1),e.lanes=4194304)}else{if(!n)if(t=Jl(o),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),po(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!st)return Dt(e),null}else 2*wt()-s.renderingStartTime>Hs&&r!==1073741824&&(e.flags|=128,n=!0,po(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(r=s.last,r!==null?r.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=wt(),e.sibling=null,r=ft.current,Ye(ft,n?r&1|2:r&1),e):(Dt(e),null);case 22:case 23:return Pd(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?fr&1073741824&&(Dt(e),e.subtreeFlags&6&&(e.flags|=8192)):Dt(e),null;case 24:return null;case 25:return null}throw Error(q(156,e.tag))}function Kx(t,e){switch(cd(e),e.tag){case 1:return or(e.type)&&Hl(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return zs(),nt(sr),nt(Ht),wd(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return yd(e),null;case 13:if(nt(ft),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(q(340));Fs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return nt(ft),null;case 4:return zs(),null;case 10:return pd(e.type._context),null;case 22:case 23:return Pd(),null;case 24:return null;default:return null}}var Ja=!1,Ft=!1,Qx=typeof WeakSet=="function"?WeakSet:Set,X=null;function xs(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){mt(t,e,n)}else r.current=null}function hh(t,e,r){try{r()}catch(n){mt(t,e,n)}}var sp=!1;function Jx(t,e){if(Qf=Fl,t=iv(),ld(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,a=-1,l=-1,u=0,c=0,h=t,p=null;t:for(;;){for(var v;h!==r||i!==0&&h.nodeType!==3||(a=o+i),h!==s||n!==0&&h.nodeType!==3||(l=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(v=h.firstChild)!==null;)p=h,h=v;for(;;){if(h===t)break t;if(p===r&&++u===i&&(a=o),p===s&&++c===n&&(l=o),(v=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=v}r=a===-1||l===-1?null:{start:a,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(Jf={focusedElem:t,selectionRange:r},Fl=!1,X=e;X!==null;)if(e=X,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,X=t;else for(;X!==null;){e=X;try{var w=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var b=w.memoizedProps,k=w.memoizedState,y=e.stateNode,m=y.getSnapshotBeforeUpdate(e.elementType===e.type?b:zr(e.type,b),k);y.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var A=e.stateNode.containerInfo;A.nodeType===1?A.textContent="":A.nodeType===9&&A.documentElement&&A.removeChild(A.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(T){mt(e,e.return,T)}if(t=e.sibling,t!==null){t.return=e.return,X=t;break}X=e.return}return w=sp,sp=!1,w}function jo(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&hh(e,r,s)}i=i.next}while(i!==n)}}function Iu(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function dh(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function t1(t){var e=t.alternate;e!==null&&(t.alternate=null,t1(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[an],delete e[Zo],delete e[Zf],delete e[Ix],delete e[Ox])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function r1(t){return t.tag===5||t.tag===3||t.tag===4}function op(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||r1(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ph(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=$l));else if(n!==4&&(t=t.child,t!==null))for(ph(t,e,r),t=t.sibling;t!==null;)ph(t,e,r),t=t.sibling}function mh(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(mh(t,e,r),t=t.sibling;t!==null;)mh(t,e,r),t=t.sibling}var Rt=null,qr=!1;function ti(t,e,r){for(r=r.child;r!==null;)n1(t,e,r),r=r.sibling}function n1(t,e,r){if(fn&&typeof fn.onCommitFiberUnmount=="function")try{fn.onCommitFiberUnmount(_u,r)}catch{}switch(r.tag){case 5:Ft||xs(r,e);case 6:var n=Rt,i=qr;Rt=null,ti(t,e,r),Rt=n,qr=i,Rt!==null&&(qr?(t=Rt,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Rt.removeChild(r.stateNode));break;case 18:Rt!==null&&(qr?(t=Rt,r=r.stateNode,t.nodeType===8?Fc(t.parentNode,r):t.nodeType===1&&Fc(t,r),Ko(t)):Fc(Rt,r.stateNode));break;case 4:n=Rt,i=qr,Rt=r.stateNode.containerInfo,qr=!0,ti(t,e,r),Rt=n,qr=i;break;case 0:case 11:case 14:case 15:if(!Ft&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&hh(r,e,o),i=i.next}while(i!==n)}ti(t,e,r);break;case 1:if(!Ft&&(xs(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){mt(r,e,a)}ti(t,e,r);break;case 21:ti(t,e,r);break;case 22:r.mode&1?(Ft=(n=Ft)||r.memoizedState!==null,ti(t,e,r),Ft=n):ti(t,e,r);break;default:ti(t,e,r)}}function ap(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new Qx),e.forEach(function(n){var i=sb.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Br(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~s}if(n=i,n=wt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Xx(n/1960))-n,10t?16:t,fi===null)var n=!1;else{if(t=fi,fi=null,tu=0,Ae&6)throw Error(q(331));var i=Ae;for(Ae|=4,X=t.current;X!==null;){var s=X,o=s.child;if(X.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lwt()-Md?Di(t,0):Nd|=r),ar(t,e)}function f1(t,e){e===0&&(t.mode&1?(e=za,za<<=1,!(za&130023424)&&(za=4194304)):e=1);var r=Kt();t=Fn(t,e),t!==null&&(_a(t,e,r),ar(t,r))}function ib(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),f1(t,r)}function sb(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(q(314))}n!==null&&n.delete(e),f1(t,r)}var h1;h1=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||sr.current)ir=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return ir=!1,Gx(t,e,r);ir=!!(t.flags&131072)}else ir=!1,st&&e.flags&1048576&&mv(e,Gl,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;xl(t,e),t=e.pendingProps;var i=Ds(e,Ht.current);Is(e,r),i=bd(null,e,n,t,i,r);var s=Ed();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,or(n)?(s=!0,ql(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,gd(e),i.updater=Pu,e.stateNode=i,i._reactInternals=e,sh(e,n,t,r),e=lh(null,e,n,!0,s,r)):(e.tag=0,st&&s&&ud(e),Wt(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(xl(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=ab(n),t=zr(n,t),i){case 0:e=ah(null,e,n,t,r);break e;case 1:e=rp(null,e,n,t,r);break e;case 11:e=ep(null,e,n,t,r);break e;case 14:e=tp(null,e,n,zr(n.type,t),r);break e}throw Error(q(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:zr(n,i),ah(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:zr(n,i),rp(t,e,n,i,r);case 3:e:{if(Qv(e),t===null)throw Error(q(387));n=e.pendingProps,s=e.memoizedState,i=s.element,wv(t,e),Ql(e,n,null,r);var o=e.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=$s(Error(q(423)),e),e=np(t,e,n,r,i);break e}else if(n!==i){i=$s(Error(q(424)),e),e=np(t,e,n,r,i);break e}else for(pr=vi(e.stateNode.containerInfo.firstChild),gr=e,st=!0,Vr=null,r=Av(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Fs(),n===i){e=Un(t,e,r);break e}Wt(t,e,n,r)}e=e.child}return e;case 5:return _v(e),t===null&&rh(e),n=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,Yf(n,i)?o=null:s!==null&&Yf(n,s)&&(e.flags|=32),Kv(t,e),Wt(t,e,o,r),e.child;case 6:return t===null&&rh(e),null;case 13:return Jv(t,e,r);case 4:return vd(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Us(e,null,n,r):Wt(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:zr(n,i),ep(t,e,n,i,r);case 7:return Wt(t,e,e.pendingProps,r),e.child;case 8:return Wt(t,e,e.pendingProps.children,r),e.child;case 12:return Wt(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,Ye(Wl,n._currentValue),n._currentValue=o,s!==null)if(Jr(s.value,o)){if(s.children===i.children&&!sr.current){e=Un(t,e,r);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===n){if(s.tag===1){l=jn(-1,r&-r),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),nh(s.return,r,e),a.lanes|=r;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(q(341));o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),nh(o,r,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Wt(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Is(e,r),i=Rr(i),n=n(i),e.flags|=1,Wt(t,e,n,r),e.child;case 14:return n=e.type,i=zr(n,e.pendingProps),i=zr(n.type,i),tp(t,e,n,i,r);case 15:return Gv(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:zr(n,i),xl(t,e),e.tag=1,or(n)?(t=!0,ql(e)):t=!1,Is(e,r),bv(e,n,i),sh(e,n,i,r),lh(null,e,n,!0,t,r);case 19:return Yv(t,e,r);case 22:return Wv(t,e,r)}throw Error(q(156,e.tag))};function d1(t,e){return Fg(t,e)}function ob(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Cr(t,e,r,n){return new ob(t,e,r,n)}function Id(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ab(t){if(typeof t=="function")return Id(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Yh)return 11;if(t===Xh)return 14}return 2}function bi(t,e){var r=t.alternate;return r===null?(r=Cr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function Al(t,e,r,n,i,s){var o=2;if(n=t,typeof t=="function")Id(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case fs:return Fi(r.children,i,s,e);case Jh:o=8,i|=8;break;case Cf:return t=Cr(12,r,e,i|2),t.elementType=Cf,t.lanes=s,t;case Pf:return t=Cr(13,r,e,i),t.elementType=Pf,t.lanes=s,t;case Rf:return t=Cr(19,r,e,i),t.elementType=Rf,t.lanes=s,t;case Eg:return Tu(r,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case xg:o=10;break e;case bg:o=9;break e;case Yh:o=11;break e;case Xh:o=14;break e;case ii:o=16,n=null;break e}throw Error(q(130,t==null?t:typeof t,""))}return e=Cr(o,r,e,i),e.elementType=t,e.type=n,e.lanes=s,e}function Fi(t,e,r,n){return t=Cr(7,t,n,e),t.lanes=r,t}function Tu(t,e,r,n){return t=Cr(22,t,n,e),t.elementType=Eg,t.lanes=r,t.stateNode={isHidden:!1},t}function Wc(t,e,r){return t=Cr(6,t,null,e),t.lanes=r,t}function Kc(t,e,r){return e=Cr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function lb(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Mc(0),this.expirationTimes=Mc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Od(t,e,r,n,i,s,o,a,l){return t=new lb(t,e,r,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Cr(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},gd(s),t}function ub(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(v1)}catch(t){console.error(t)}}v1(),mg.exports=wr;var oa=mg.exports,mp=oa;Nf.createRoot=mp.createRoot,Nf.hydrateRoot=mp.hydrateRoot;/** * @remix-run/router v1.14.2 * * Copyright (c) Remix Software Inc. @@ -46,7 +46,7 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function aa(){return aa=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Bd(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function pb(){return Math.random().toString(36).substr(2,8)}function vp(t,e){return{usr:t.state,key:t.key,idx:e}}function xh(t,e,r,n){return r===void 0&&(r=null),aa({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?to(e):e,{state:r,key:e&&e.key||n||pb()})}function v1(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function to(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function mb(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,a=hi.Pop,l=null,u=c();u==null&&(u=0,o.replaceState(aa({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function h(){a=hi.Pop;let k=c(),w=k==null?null:k-u;u=k,l&&l({action:a,location:b.location,delta:w})}function p(k,w){a=hi.Push;let m=xh(b.location,k,w);r&&r(m,k),u=c()+1;let A=vp(m,u),j=b.createHref(m);try{o.pushState(A,"",j)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;i.location.assign(j)}s&&l&&l({action:a,location:b.location,delta:1})}function v(k,w){a=hi.Replace;let m=xh(b.location,k,w);r&&r(m,k),u=c();let A=vp(m,u),j=b.createHref(m);o.replaceState(A,"",j),s&&l&&l({action:a,location:b.location,delta:0})}function y(k){let w=i.location.origin!=="null"?i.location.origin:i.location.href,m=typeof k=="string"?k:v1(k);return St(w,"No window.location.(origin|href) available to create URL for href: "+m),new URL(m,w)}let b={get action(){return a},get location(){return t(i,o)},listen(k){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(gp,h),l=k,()=>{i.removeEventListener(gp,h),l=null}},createHref(k){return e(i,k)},createURL:y,encodeLocation(k){let w=y(k);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:p,replace:v,go(k){return o.go(k)}};return b}var yp;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(yp||(yp={}));function gb(t,e,r){r===void 0&&(r="/");let n=typeof e=="string"?to(e):e,i=x1(n.pathname||"/",r);if(i==null)return null;let s=y1(t);vb(s);let o=null;for(let a=0;o==null&&a{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(St(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let u=Ui([n,l.relativePath]),c=r.concat(l);s.children&&s.children.length>0&&(St(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),y1(s.children,e,c,u)),!(s.path==null&&!s.index)&&e.push({path:u,score:_b(u,s.index),routesMeta:c})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let l of w1(s.path))i(s,o,l)}),e}function w1(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=w1(n.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function vb(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:Sb(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const yb=/^:[\w-]+$/,wb=3,xb=2,bb=1,Eb=10,Ab=-2,wp=t=>t==="*";function _b(t,e){let r=t.split("/"),n=r.length;return r.some(wp)&&(n+=Ab),e&&(n+=xb),r.filter(i=>!wp(i)).reduce((i,s)=>i+(yb.test(s)?wb:s===""?bb:Eb),n)}function Sb(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function kb(t,e){let{routesMeta:r}=t,n={},i="/",s=[];for(let o=0;o{let{paramName:p,isOptional:v}=c;if(p==="*"){let b=a[h]||"";o=s.slice(0,s.length-b.length).replace(/(.)\/+$/,"$1")}const y=a[h];return v&&!y?u[p]=void 0:u[p]=Pb(y||"",p),u},{}),pathname:s,pathnameBase:o,pattern:t}}function Mb(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),Bd(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(n.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function Cb(t){try{return decodeURI(t)}catch(e){return Bd(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Pb(t,e){try{return decodeURIComponent(t)}catch(r){return Bd(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+r+").")),t}}function x1(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function Rb(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?to(t):t;return{pathname:r?r.startsWith("/")?r:Ib(r,e):e,search:Bb(n),hash:Db(i)}}function Ib(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Qc(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Ob(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function Tb(t,e){let r=Ob(t);return e?r.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function jb(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=to(t):(i=aa({},t),St(!i.pathname||!i.pathname.includes("?"),Qc("?","pathname","search",i)),St(!i.pathname||!i.pathname.includes("#"),Qc("#","pathname","hash",i)),St(!i.search||!i.search.includes("#"),Qc("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=r;else{let h=e.length-1;if(!n&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),h-=1;i.pathname=p.join("/")}a=h>=0?e[h]:"/"}let l=Rb(i,a),u=o&&o!=="/"&&o.endsWith("/"),c=(s||o===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const Ui=t=>t.join("/").replace(/\/\/+/g,"/"),Lb=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Bb=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Db=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function Fb(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const b1=["post","put","patch","delete"];new Set(b1);const Ub=["get",...b1];new Set(Ub);/** + */function aa(){return aa=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Bd(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function mb(){return Math.random().toString(36).substr(2,8)}function vp(t,e){return{usr:t.state,key:t.key,idx:e}}function xh(t,e,r,n){return r===void 0&&(r=null),aa({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?to(e):e,{state:r,key:e&&e.key||n||mb()})}function y1(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function to(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function gb(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,a=hi.Pop,l=null,u=c();u==null&&(u=0,o.replaceState(aa({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function h(){a=hi.Pop;let k=c(),y=k==null?null:k-u;u=k,l&&l({action:a,location:b.location,delta:y})}function p(k,y){a=hi.Push;let m=xh(b.location,k,y);r&&r(m,k),u=c()+1;let A=vp(m,u),T=b.createHref(m);try{o.pushState(A,"",T)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;i.location.assign(T)}s&&l&&l({action:a,location:b.location,delta:1})}function v(k,y){a=hi.Replace;let m=xh(b.location,k,y);r&&r(m,k),u=c();let A=vp(m,u),T=b.createHref(m);o.replaceState(A,"",T),s&&l&&l({action:a,location:b.location,delta:0})}function w(k){let y=i.location.origin!=="null"?i.location.origin:i.location.href,m=typeof k=="string"?k:y1(k);return St(y,"No window.location.(origin|href) available to create URL for href: "+m),new URL(m,y)}let b={get action(){return a},get location(){return t(i,o)},listen(k){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(gp,h),l=k,()=>{i.removeEventListener(gp,h),l=null}},createHref(k){return e(i,k)},createURL:w,encodeLocation(k){let y=w(k);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:p,replace:v,go(k){return o.go(k)}};return b}var yp;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(yp||(yp={}));function vb(t,e,r){r===void 0&&(r="/");let n=typeof e=="string"?to(e):e,i=b1(n.pathname||"/",r);if(i==null)return null;let s=w1(t);yb(s);let o=null;for(let a=0;o==null&&a{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(St(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let u=Ui([n,l.relativePath]),c=r.concat(l);s.children&&s.children.length>0&&(St(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),w1(s.children,e,c,u)),!(s.path==null&&!s.index)&&e.push({path:u,score:Sb(u,s.index),routesMeta:c})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let l of x1(s.path))i(s,o,l)}),e}function x1(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=x1(n.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function yb(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:kb(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const wb=/^:[\w-]+$/,xb=3,bb=2,Eb=1,Ab=10,_b=-2,wp=t=>t==="*";function Sb(t,e){let r=t.split("/"),n=r.length;return r.some(wp)&&(n+=_b),e&&(n+=bb),r.filter(i=>!wp(i)).reduce((i,s)=>i+(wb.test(s)?xb:s===""?Eb:Ab),n)}function kb(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function Nb(t,e){let{routesMeta:r}=t,n={},i="/",s=[];for(let o=0;o{let{paramName:p,isOptional:v}=c;if(p==="*"){let b=a[h]||"";o=s.slice(0,s.length-b.length).replace(/(.)\/+$/,"$1")}const w=a[h];return v&&!w?u[p]=void 0:u[p]=Rb(w||"",p),u},{}),pathname:s,pathnameBase:o,pattern:t}}function Cb(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),Bd(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(n.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function Pb(t){try{return decodeURI(t)}catch(e){return Bd(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Rb(t,e){try{return decodeURIComponent(t)}catch(r){return Bd(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+r+").")),t}}function b1(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function Ib(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?to(t):t;return{pathname:r?r.startsWith("/")?r:Ob(r,e):e,search:Db(n),hash:Fb(i)}}function Ob(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Qc(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Tb(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function jb(t,e){let r=Tb(t);return e?r.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function Lb(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=to(t):(i=aa({},t),St(!i.pathname||!i.pathname.includes("?"),Qc("?","pathname","search",i)),St(!i.pathname||!i.pathname.includes("#"),Qc("#","pathname","hash",i)),St(!i.search||!i.search.includes("#"),Qc("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=r;else{let h=e.length-1;if(!n&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),h-=1;i.pathname=p.join("/")}a=h>=0?e[h]:"/"}let l=Ib(i,a),u=o&&o!=="/"&&o.endsWith("/"),c=(s||o===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const Ui=t=>t.join("/").replace(/\/\/+/g,"/"),Bb=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Db=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Fb=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function Ub(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const E1=["post","put","patch","delete"];new Set(E1);const zb=["get",...E1];new Set(zb);/** * React Router v6.21.3 * * Copyright (c) Remix Software Inc. @@ -55,7 +55,7 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function la(){return la=Object.assign?Object.assign.bind():function(t){for(var e=1;e{a.current=!0}),T.useCallback(function(u,c){if(c===void 0&&(c={}),!a.current)return;if(typeof u=="number"){n.go(u);return}let h=jb(u,JSON.parse(o),s,c.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:Ui([e,h.pathname])),(c.replace?n.replace:n.push)(h,c.state,c)},[e,n,o,s,t])}function Hb(){let{matches:t}=T.useContext(es),e=t[t.length-1];return e?e.params:{}}function qb(t,e){return Vb(t,e)}function Vb(t,e,r,n){zu()||St(!1);let{navigator:i}=T.useContext(Fu),{matches:s}=T.useContext(es),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=$u(),c;if(e){var h;let k=typeof e=="string"?to(e):e;l==="/"||(h=k.pathname)!=null&&h.startsWith(l)||St(!1),c=k}else c=u;let p=c.pathname||"/",v=l==="/"?p:p.slice(l.length)||"/",y=gb(t,{pathname:v}),b=Jb(y&&y.map(k=>Object.assign({},k,{params:Object.assign({},a,k.params),pathname:Ui([l,i.encodeLocation?i.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?l:Ui([l,i.encodeLocation?i.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),s,r,n);return e&&b?T.createElement(Uu.Provider,{value:{location:la({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:hi.Pop}},b):b}function Gb(){let t=e3(),e=Fb(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},s=null;return T.createElement(T.Fragment,null,T.createElement("h2",null,"Unexpected Application Error!"),T.createElement("h3",{style:{fontStyle:"italic"}},e),r?T.createElement("pre",{style:i},r):null,s)}const Wb=T.createElement(Gb,null);class Kb extends T.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?T.createElement(es.Provider,{value:this.props.routeContext},T.createElement(E1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Qb(t){let{routeContext:e,match:r,children:n}=t,i=T.useContext(Dd);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),T.createElement(es.Provider,{value:e},n)}function Jb(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var s;if((s=r)!=null&&s.errors)t=r.matches;else return null}let o=t,a=(i=r)==null?void 0:i.errors;if(a!=null){let c=o.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id]));c>=0||St(!1),o=o.slice(0,Math.min(o.length,c+1))}let l=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let c=0;c=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,h,p)=>{let v,y=!1,b=null,k=null;r&&(v=a&&h.route.id?a[h.route.id]:void 0,b=h.route.errorElement||Wb,l&&(u<0&&p===0?(r3("route-fallback",!1),y=!0,k=null):u===p&&(y=!0,k=h.route.hydrateFallbackElement||null)));let w=e.concat(o.slice(0,p+1)),m=()=>{let A;return v?A=b:y?A=k:h.route.Component?A=T.createElement(h.route.Component,null):h.route.element?A=h.route.element:A=c,T.createElement(Qb,{match:h,routeContext:{outlet:c,matches:w,isDataRoute:r!=null},children:A})};return r&&(h.route.ErrorBoundary||h.route.errorElement||p===0)?T.createElement(Kb,{location:r.location,revalidation:r.revalidation,component:b,error:v,children:m(),routeContext:{outlet:null,matches:w,isDataRoute:!0}}):m()},null)}var _1=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(_1||{}),iu=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(iu||{});function Yb(t){let e=T.useContext(Dd);return e||St(!1),e}function Xb(t){let e=T.useContext(zb);return e||St(!1),e}function Zb(t){let e=T.useContext(es);return e||St(!1),e}function S1(t){let e=Zb(),r=e.matches[e.matches.length-1];return r.route.id||St(!1),r.route.id}function e3(){var t;let e=T.useContext(E1),r=Xb(iu.UseRouteError),n=S1(iu.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function t3(){let{router:t}=Yb(_1.UseNavigateStable),e=S1(iu.UseNavigateStable),r=T.useRef(!1);return A1(()=>{r.current=!0}),T.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,la({fromRouteId:e},s)))},[t,e])}const xp={};function r3(t,e,r){!e&&!xp[t]&&(xp[t]=!0)}function ko(t){St(!1)}function n3(t){let{basename:e="/",children:r=null,location:n,navigationType:i=hi.Pop,navigator:s,static:o=!1,future:a}=t;zu()&&St(!1);let l=e.replace(/^\/*/,"/"),u=T.useMemo(()=>({basename:l,navigator:s,static:o,future:la({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof n=="string"&&(n=to(n));let{pathname:c="/",search:h="",hash:p="",state:v=null,key:y="default"}=n,b=T.useMemo(()=>{let k=x1(c,l);return k==null?null:{location:{pathname:k,search:h,hash:p,state:v,key:y},navigationType:i}},[l,c,h,p,v,y,i]);return b==null?null:T.createElement(Fu.Provider,{value:u},T.createElement(Uu.Provider,{children:r,value:b}))}function i3(t){let{children:e,location:r}=t;return qb(bh(e),r)}new Promise(()=>{});function bh(t,e){e===void 0&&(e=[]);let r=[];return T.Children.forEach(t,(n,i)=>{if(!T.isValidElement(n))return;let s=[...e,i];if(n.type===T.Fragment){r.push.apply(r,bh(n.props.children,s));return}n.type!==ko&&St(!1),!n.props.index||!n.props.children||St(!1);let o={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=bh(n.props.children,s)),r.push(o)}),r}/** + */function la(){return la=Object.assign?Object.assign.bind():function(t){for(var e=1;e{a.current=!0}),j.useCallback(function(u,c){if(c===void 0&&(c={}),!a.current)return;if(typeof u=="number"){n.go(u);return}let h=Lb(u,JSON.parse(o),s,c.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:Ui([e,h.pathname])),(c.replace?n.replace:n.push)(h,c.state,c)},[e,n,o,s,t])}function qb(){let{matches:t}=j.useContext(es),e=t[t.length-1];return e?e.params:{}}function Vb(t,e){return Gb(t,e)}function Gb(t,e,r,n){zu()||St(!1);let{navigator:i}=j.useContext(Fu),{matches:s}=j.useContext(es),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=$u(),c;if(e){var h;let k=typeof e=="string"?to(e):e;l==="/"||(h=k.pathname)!=null&&h.startsWith(l)||St(!1),c=k}else c=u;let p=c.pathname||"/",v=l==="/"?p:p.slice(l.length)||"/",w=vb(t,{pathname:v}),b=Yb(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},a,k.params),pathname:Ui([l,i.encodeLocation?i.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?l:Ui([l,i.encodeLocation?i.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),s,r,n);return e&&b?j.createElement(Uu.Provider,{value:{location:la({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:hi.Pop}},b):b}function Wb(){let t=t3(),e=Ub(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},s=null;return j.createElement(j.Fragment,null,j.createElement("h2",null,"Unexpected Application Error!"),j.createElement("h3",{style:{fontStyle:"italic"}},e),r?j.createElement("pre",{style:i},r):null,s)}const Kb=j.createElement(Wb,null);class Qb extends j.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?j.createElement(es.Provider,{value:this.props.routeContext},j.createElement(A1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Jb(t){let{routeContext:e,match:r,children:n}=t,i=j.useContext(Dd);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),j.createElement(es.Provider,{value:e},n)}function Yb(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var s;if((s=r)!=null&&s.errors)t=r.matches;else return null}let o=t,a=(i=r)==null?void 0:i.errors;if(a!=null){let c=o.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id]));c>=0||St(!1),o=o.slice(0,Math.min(o.length,c+1))}let l=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let c=0;c=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,h,p)=>{let v,w=!1,b=null,k=null;r&&(v=a&&h.route.id?a[h.route.id]:void 0,b=h.route.errorElement||Kb,l&&(u<0&&p===0?(n3("route-fallback",!1),w=!0,k=null):u===p&&(w=!0,k=h.route.hydrateFallbackElement||null)));let y=e.concat(o.slice(0,p+1)),m=()=>{let A;return v?A=b:w?A=k:h.route.Component?A=j.createElement(h.route.Component,null):h.route.element?A=h.route.element:A=c,j.createElement(Jb,{match:h,routeContext:{outlet:c,matches:y,isDataRoute:r!=null},children:A})};return r&&(h.route.ErrorBoundary||h.route.errorElement||p===0)?j.createElement(Qb,{location:r.location,revalidation:r.revalidation,component:b,error:v,children:m(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):m()},null)}var S1=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(S1||{}),iu=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(iu||{});function Xb(t){let e=j.useContext(Dd);return e||St(!1),e}function Zb(t){let e=j.useContext($b);return e||St(!1),e}function e3(t){let e=j.useContext(es);return e||St(!1),e}function k1(t){let e=e3(),r=e.matches[e.matches.length-1];return r.route.id||St(!1),r.route.id}function t3(){var t;let e=j.useContext(A1),r=Zb(iu.UseRouteError),n=k1(iu.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function r3(){let{router:t}=Xb(S1.UseNavigateStable),e=k1(iu.UseNavigateStable),r=j.useRef(!1);return _1(()=>{r.current=!0}),j.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,la({fromRouteId:e},s)))},[t,e])}const xp={};function n3(t,e,r){!e&&!xp[t]&&(xp[t]=!0)}function ko(t){St(!1)}function i3(t){let{basename:e="/",children:r=null,location:n,navigationType:i=hi.Pop,navigator:s,static:o=!1,future:a}=t;zu()&&St(!1);let l=e.replace(/^\/*/,"/"),u=j.useMemo(()=>({basename:l,navigator:s,static:o,future:la({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof n=="string"&&(n=to(n));let{pathname:c="/",search:h="",hash:p="",state:v=null,key:w="default"}=n,b=j.useMemo(()=>{let k=b1(c,l);return k==null?null:{location:{pathname:k,search:h,hash:p,state:v,key:w},navigationType:i}},[l,c,h,p,v,w,i]);return b==null?null:j.createElement(Fu.Provider,{value:u},j.createElement(Uu.Provider,{children:r,value:b}))}function s3(t){let{children:e,location:r}=t;return Vb(bh(e),r)}new Promise(()=>{});function bh(t,e){e===void 0&&(e=[]);let r=[];return j.Children.forEach(t,(n,i)=>{if(!j.isValidElement(n))return;let s=[...e,i];if(n.type===j.Fragment){r.push.apply(r,bh(n.props.children,s));return}n.type!==ko&&St(!1),!n.props.index||!n.props.children||St(!1);let o={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=bh(n.props.children,s)),r.push(o)}),r}/** * React Router DOM v6.21.3 * * Copyright (c) Remix Software Inc. @@ -64,14 +64,14 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */const s3="startTransition",bp=nw[s3];function o3(t){let{basename:e,children:r,future:n,window:i}=t,s=T.useRef();s.current==null&&(s.current=db({window:i,v5Compat:!0}));let o=s.current,[a,l]=T.useState({action:o.action,location:o.location}),{v7_startTransition:u}=n||{},c=T.useCallback(h=>{u&&bp?bp(()=>l(h)):l(h)},[l,u]);return T.useLayoutEffect(()=>o.listen(c),[o,c]),T.createElement(n3,{basename:e,children:r,location:a.location,navigationType:a.action,navigator:o,future:n})}var Ep;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Ep||(Ep={}));var Ap;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Ap||(Ap={}));var Hu={},Ln={},k1={};const a3="logger/5.7.0";let _p=!1,Sp=!1;const _l={debug:1,default:2,info:2,warning:3,error:4,off:5};let kp=_l.default,Jc=null;function l3(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Np=l3();var Eh;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(Eh||(Eh={}));var $r;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})($r||($r={}));const Mp="0123456789abcdef";class O{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();_l[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(kp>_l[n])&&console.log.apply(console,r)}debug(...e){this._log(O.levels.DEBUG,e)}info(...e){this._log(O.levels.INFO,e)}warn(...e){this._log(O.levels.WARNING,e)}makeError(e,r,n){if(Sp)return this.makeError("censored error",r,{});r||(r=O.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(l=>{const u=n[l];try{if(u instanceof Uint8Array){let c="";for(let h=0;h>4],c+=Mp[u[h]&15];i.push(l+"=Uint8Array(0x"+c+")")}else i.push(l+"="+JSON.stringify(u))}catch{i.push(l+"="+JSON.stringify(n[l].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case $r.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=e;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case $r.CALL_EXCEPTION:case $r.INSUFFICIENT_FUNDS:case $r.MISSING_NEW:case $r.NONCE_EXPIRED:case $r.REPLACEMENT_UNDERPRICED:case $r.TRANSACTION_REPLACED:case $r.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(l){a[l]=n[l]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,O.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Np&&this.throwError("platform missing String.prototype.normalize",O.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Np})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,O.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,O.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,O.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",O.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",O.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",O.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Jc||(Jc=new O(a3)),Jc}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",O.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),_p){if(!e)return;this.globalLogger().throwError("error censorship permanent",O.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Sp=!!e,_p=!!r}static setLogLevel(e){const r=_l[e.toLowerCase()];if(r==null){O.globalLogger().warn("invalid log level - "+e);return}kp=r}static from(e){return new O(e)}}O.errors=$r;O.levels=Eh;const u3="bytes/5.7.0",pt=new O(u3);function N1(t){return!!t.toHexString}function Ts(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ts(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Fd(t){return me(t)&&!(t.length%2)||qu(t)}function Cp(t){return typeof t=="number"&&t==t&&t%1===0}function qu(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Cp(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function oe(t,e){if(e||(e={}),typeof t=="number"){pt.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ts(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),N1(t)&&(t=t.toHexString()),me(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":pt.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ioe(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),Ts(n)}function qs(t){let e=oe(t);if(e.length===0)return e;let r=0;for(;re&&pt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ts(r)}function me(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Yc="0123456789abcdef";function ne(t,e){if(e||(e={}),typeof t=="number"){pt.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Yc[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),N1(t))return t.toHexString();if(me(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":pt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(qu(t)){let r="0x";for(let n=0;n>4]+Yc[i&15]}return r}return pt.throwArgumentError("invalid hexlify value","value",t)}function zn(t){if(typeof t!="string")t=ne(t);else if(!me(t)||t.length%2)return null;return(t.length-2)/2}function Ot(t,e,r){return typeof t!="string"?t=ne(t):(!me(t)||t.length%2)&&pt.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function nr(t){let e="0x";return t.forEach(r=>{e+=ne(r).substring(2)}),e}function Vu(t){const e=c3(ne(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function c3(t){typeof t!="string"&&(t=ne(t)),me(t)||pt.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&pt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Gu(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Fd(t)){let r=oe(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=ne(r.slice(0,32)),e.s=ne(r.slice(32,64))):r.length===65?(e.r=ne(r.slice(0,32)),e.s=ne(r.slice(32,64)),e.v=r[64]):pt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:pt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=ne(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=Sl(oe(e._vs),32);e._vs=ne(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&pt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=ne(i);e.s==null?e.s=o:e.s!==o&&pt.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?pt.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&pt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!me(e.r)?pt.throwArgumentError("signature missing or invalid r","signature",t):e.r=gt(e.r,32),e.s==null||!me(e.s)?pt.throwArgumentError("signature missing or invalid s","signature",t):e.s=gt(e.s,32);const r=oe(e.s);r[0]>=128&&pt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=ne(r);e._vs&&(me(e._vs)||pt.throwArgumentError("signature invalid _vs","signature",t),e._vs=gt(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&pt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}var Ud={exports:{}};const f3={},h3=Object.freeze(Object.defineProperty({__proto__:null,default:f3},Symbol.toStringTag,{value:"Module"})),d3=Ys(h3);Ud.exports;(function(t){(function(e,r){function n(R,f){if(!R)throw new Error(f||"Assertion failed")}function i(R,f){R.super_=f;var g=function(){};g.prototype=f.prototype,R.prototype=new g,R.prototype.constructor=R}function s(R,f,g){if(s.isBN(R))return R;this.negative=0,this.words=null,this.length=0,this.red=null,R!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(R||0,f||10,g||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=d3.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,g){return f.cmp(g)>0?f:g},s.min=function(f,g){return f.cmp(g)<0?f:g},s.prototype._init=function(f,g,E){if(typeof f=="number")return this._initNumber(f,g,E);if(typeof f=="object")return this._initArray(f,g,E);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var M=0;f[0]==="-"&&(M++,this.negative=1),M=0;M-=3)P=f[M]|f[M-1]<<8|f[M-2]<<16,this.words[_]|=P<>>26-I&67108863,I+=24,I>=26&&(I-=26,_++);else if(E==="le")for(M=0,_=0;M>>26-I&67108863,I+=24,I>=26&&(I-=26,_++);return this._strip()};function a(R,f){var g=R.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+R)}function l(R,f,g){var E=a(R,g);return g-1>=f&&(E|=a(R,g-1)<<4),E}s.prototype._parseHex=function(f,g,E){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var M=0;M=g;M-=2)I=l(f,g,M)<<_,this.words[P]|=I&67108863,_>=18?(_-=18,P+=1,this.words[P]|=I>>>26):_+=8;else{var N=f.length-g;for(M=N%2===0?g+1:g;M=18?(_-=18,P+=1,this.words[P]|=I>>>26):_+=8}this._strip()};function u(R,f,g,E){for(var M=0,_=0,P=Math.min(R.length,g),I=f;I=49?_=N-49+10:N>=17?_=N-17+10:_=N,n(N>=0&&_1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch{s.prototype.inspect=h}else s.prototype.inspect=h;function h(){return(this.red?""}var p=["","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"],v=[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],y=[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];s.prototype.toString=function(f,g){f=f||10,g=g|0||1;var E;if(f===16||f==="hex"){E="";for(var M=0,_=0,P=0;P>>24-M&16777215,M+=2,M>=26&&(M-=26,P--),_!==0||P!==this.length-1?E=p[6-N.length]+N+E:E=N+E}for(_!==0&&(E=_.toString(16)+E);E.length%g!==0;)E="0"+E;return this.negative!==0&&(E="-"+E),E}if(f===(f|0)&&f>=2&&f<=36){var d=v[f],C=y[f];E="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var x=ee.modrn(C).toString(f);ee=ee.idivn(C),ee.isZero()?E=x+E:E=p[d-x.length]+x+E}for(this.isZero()&&(E="0"+E);E.length%g!==0;)E="0"+E;return this.negative!==0&&(E="-"+E),E}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,g){return this.toArrayLike(o,f,g)}),s.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var b=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};s.prototype.toArrayLike=function(f,g,E){this._strip();var M=this.byteLength(),_=E||Math.max(1,M);n(M<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var P=b(f,_),I=g==="le"?"LE":"BE";return this["_toArrayLike"+I](P,M),P},s.prototype._toArrayLikeLE=function(f,g){for(var E=0,M=0,_=0,P=0;_>8&255),E>16&255),P===6?(E>24&255),M=0,P=0):(M=I>>>24,P+=2)}if(E=0&&(f[E--]=I>>8&255),E>=0&&(f[E--]=I>>16&255),P===6?(E>=0&&(f[E--]=I>>24&255),M=0,P=0):(M=I>>>24,P+=2)}if(E>=0)for(f[E--]=M;E>=0;)f[E--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var g=f,E=0;return g>=4096&&(E+=13,g>>>=13),g>=64&&(E+=7,g>>>=7),g>=8&&(E+=4,g>>>=4),g>=2&&(E+=2,g>>>=2),E+g},s.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,E=0;return g&8191||(E+=13,g>>>=13),g&127||(E+=7,g>>>=7),g&15||(E+=4,g>>>=4),g&3||(E+=2,g>>>=2),g&1||E++,E},s.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function k(R){for(var f=new Array(R.bitLength()),g=0;g>>M&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var E=0;Ef.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var g,E;this.length>f.length?(g=this,E=f):(g=f,E=this);for(var M=0;Mf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,E=f%26;this._expand(g),E>0&&g--;for(var M=0;M0&&(this.words[M]=~this.words[M]&67108863>>26-E),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var E=f/26|0,M=f%26;return this._expand(E+1),g?this.words[E]=this.words[E]|1<f.length?(E=this,M=f):(E=f,M=this);for(var _=0,P=0;P>>26;for(;_!==0&&P>>26;if(this.length=E.length,_!==0)this.words[this.length]=_,this.length++;else if(E!==this)for(;Pf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var E=this.cmp(f);if(E===0)return this.negative=0,this.length=1,this.words[0]=0,this;var M,_;E>0?(M=this,_=f):(M=f,_=this);for(var P=0,I=0;I<_.length;I++)g=(M.words[I]|0)-(_.words[I]|0)+P,P=g>>26,this.words[I]=g&67108863;for(;P!==0&&I>26,this.words[I]=g&67108863;if(P===0&&I>>26,ee=N&67108863,x=Math.min(d,f.length-1),B=Math.max(0,d-R.length+1);B<=x;B++){var z=d-B|0;M=R.words[z]|0,_=f.words[B]|0,P=M*_+ee,C+=P/67108864|0,ee=P&67108863}g.words[d]=ee|0,N=C|0}return N!==0?g.words[d]=N|0:g.length--,g._strip()}var m=function(f,g,E){var M=f.words,_=g.words,P=E.words,I=0,N,d,C,ee=M[0]|0,x=ee&8191,B=ee>>>13,z=M[1]|0,$=z&8191,V=z>>>13,se=M[2]|0,Y=se&8191,K=se>>>13,Xe=M[3]|0,Q=Xe&8191,ae=Xe>>>13,Xr=M[4]|0,Te=Xr&8191,Me=Xr>>>13,Zr=M[5]|0,Ce=Zr&8191,fe=Zr>>>13,Er=M[6]|0,he=Er&8191,je=Er>>>13,en=M[7]|0,ge=en&8191,He=en>>>13,En=M[8]|0,qe=En&8191,Ve=En>>>13,Gt=M[9]|0,Le=Gt&8191,Ge=Gt>>>13,Lr=_[0]|0,Pe=Lr&8191,We=Lr>>>13,An=_[1]|0,Be=An&8191,Ke=An>>>13,_n=_[2]|0,De=_n&8191,ie=_n>>>13,lt=_[3]|0,ve=lt&8191,de=lt>>>13,it=_[4]|0,_e=it&8191,Se=it>>>13,Pt=_[5]|0,Re=Pt&8191,Fe=Pt>>>13,Yt=_[6]|0,Qe=Yt&8191,Je=Yt>>>13,Xt=_[7]|0,Ie=Xt&8191,Ue=Xt>>>13,Ar=_[8]|0,Ne=Ar&8191,Ze=Ar>>>13,Ri=_[9]|0,et=Ri&8191,tt=Ri>>>13;E.negative=f.negative^g.negative,E.length=19,N=Math.imul(x,Pe),d=Math.imul(x,We),d=d+Math.imul(B,Pe)|0,C=Math.imul(B,We);var Jn=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,N=Math.imul($,Pe),d=Math.imul($,We),d=d+Math.imul(V,Pe)|0,C=Math.imul(V,We),N=N+Math.imul(x,Be)|0,d=d+Math.imul(x,Ke)|0,d=d+Math.imul(B,Be)|0,C=C+Math.imul(B,Ke)|0;var Yn=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,N=Math.imul(Y,Pe),d=Math.imul(Y,We),d=d+Math.imul(K,Pe)|0,C=Math.imul(K,We),N=N+Math.imul($,Be)|0,d=d+Math.imul($,Ke)|0,d=d+Math.imul(V,Be)|0,C=C+Math.imul(V,Ke)|0,N=N+Math.imul(x,De)|0,d=d+Math.imul(x,ie)|0,d=d+Math.imul(B,De)|0,C=C+Math.imul(B,ie)|0;var Xn=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(Xn>>>26)|0,Xn&=67108863,N=Math.imul(Q,Pe),d=Math.imul(Q,We),d=d+Math.imul(ae,Pe)|0,C=Math.imul(ae,We),N=N+Math.imul(Y,Be)|0,d=d+Math.imul(Y,Ke)|0,d=d+Math.imul(K,Be)|0,C=C+Math.imul(K,Ke)|0,N=N+Math.imul($,De)|0,d=d+Math.imul($,ie)|0,d=d+Math.imul(V,De)|0,C=C+Math.imul(V,ie)|0,N=N+Math.imul(x,ve)|0,d=d+Math.imul(x,de)|0,d=d+Math.imul(B,ve)|0,C=C+Math.imul(B,de)|0;var Zn=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,N=Math.imul(Te,Pe),d=Math.imul(Te,We),d=d+Math.imul(Me,Pe)|0,C=Math.imul(Me,We),N=N+Math.imul(Q,Be)|0,d=d+Math.imul(Q,Ke)|0,d=d+Math.imul(ae,Be)|0,C=C+Math.imul(ae,Ke)|0,N=N+Math.imul(Y,De)|0,d=d+Math.imul(Y,ie)|0,d=d+Math.imul(K,De)|0,C=C+Math.imul(K,ie)|0,N=N+Math.imul($,ve)|0,d=d+Math.imul($,de)|0,d=d+Math.imul(V,ve)|0,C=C+Math.imul(V,de)|0,N=N+Math.imul(x,_e)|0,d=d+Math.imul(x,Se)|0,d=d+Math.imul(B,_e)|0,C=C+Math.imul(B,Se)|0;var ei=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(ei>>>26)|0,ei&=67108863,N=Math.imul(Ce,Pe),d=Math.imul(Ce,We),d=d+Math.imul(fe,Pe)|0,C=Math.imul(fe,We),N=N+Math.imul(Te,Be)|0,d=d+Math.imul(Te,Ke)|0,d=d+Math.imul(Me,Be)|0,C=C+Math.imul(Me,Ke)|0,N=N+Math.imul(Q,De)|0,d=d+Math.imul(Q,ie)|0,d=d+Math.imul(ae,De)|0,C=C+Math.imul(ae,ie)|0,N=N+Math.imul(Y,ve)|0,d=d+Math.imul(Y,de)|0,d=d+Math.imul(K,ve)|0,C=C+Math.imul(K,de)|0,N=N+Math.imul($,_e)|0,d=d+Math.imul($,Se)|0,d=d+Math.imul(V,_e)|0,C=C+Math.imul(V,Se)|0,N=N+Math.imul(x,Re)|0,d=d+Math.imul(x,Fe)|0,d=d+Math.imul(B,Re)|0,C=C+Math.imul(B,Fe)|0;var uc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(uc>>>26)|0,uc&=67108863,N=Math.imul(he,Pe),d=Math.imul(he,We),d=d+Math.imul(je,Pe)|0,C=Math.imul(je,We),N=N+Math.imul(Ce,Be)|0,d=d+Math.imul(Ce,Ke)|0,d=d+Math.imul(fe,Be)|0,C=C+Math.imul(fe,Ke)|0,N=N+Math.imul(Te,De)|0,d=d+Math.imul(Te,ie)|0,d=d+Math.imul(Me,De)|0,C=C+Math.imul(Me,ie)|0,N=N+Math.imul(Q,ve)|0,d=d+Math.imul(Q,de)|0,d=d+Math.imul(ae,ve)|0,C=C+Math.imul(ae,de)|0,N=N+Math.imul(Y,_e)|0,d=d+Math.imul(Y,Se)|0,d=d+Math.imul(K,_e)|0,C=C+Math.imul(K,Se)|0,N=N+Math.imul($,Re)|0,d=d+Math.imul($,Fe)|0,d=d+Math.imul(V,Re)|0,C=C+Math.imul(V,Fe)|0,N=N+Math.imul(x,Qe)|0,d=d+Math.imul(x,Je)|0,d=d+Math.imul(B,Qe)|0,C=C+Math.imul(B,Je)|0;var cc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(cc>>>26)|0,cc&=67108863,N=Math.imul(ge,Pe),d=Math.imul(ge,We),d=d+Math.imul(He,Pe)|0,C=Math.imul(He,We),N=N+Math.imul(he,Be)|0,d=d+Math.imul(he,Ke)|0,d=d+Math.imul(je,Be)|0,C=C+Math.imul(je,Ke)|0,N=N+Math.imul(Ce,De)|0,d=d+Math.imul(Ce,ie)|0,d=d+Math.imul(fe,De)|0,C=C+Math.imul(fe,ie)|0,N=N+Math.imul(Te,ve)|0,d=d+Math.imul(Te,de)|0,d=d+Math.imul(Me,ve)|0,C=C+Math.imul(Me,de)|0,N=N+Math.imul(Q,_e)|0,d=d+Math.imul(Q,Se)|0,d=d+Math.imul(ae,_e)|0,C=C+Math.imul(ae,Se)|0,N=N+Math.imul(Y,Re)|0,d=d+Math.imul(Y,Fe)|0,d=d+Math.imul(K,Re)|0,C=C+Math.imul(K,Fe)|0,N=N+Math.imul($,Qe)|0,d=d+Math.imul($,Je)|0,d=d+Math.imul(V,Qe)|0,C=C+Math.imul(V,Je)|0,N=N+Math.imul(x,Ie)|0,d=d+Math.imul(x,Ue)|0,d=d+Math.imul(B,Ie)|0,C=C+Math.imul(B,Ue)|0;var fc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(fc>>>26)|0,fc&=67108863,N=Math.imul(qe,Pe),d=Math.imul(qe,We),d=d+Math.imul(Ve,Pe)|0,C=Math.imul(Ve,We),N=N+Math.imul(ge,Be)|0,d=d+Math.imul(ge,Ke)|0,d=d+Math.imul(He,Be)|0,C=C+Math.imul(He,Ke)|0,N=N+Math.imul(he,De)|0,d=d+Math.imul(he,ie)|0,d=d+Math.imul(je,De)|0,C=C+Math.imul(je,ie)|0,N=N+Math.imul(Ce,ve)|0,d=d+Math.imul(Ce,de)|0,d=d+Math.imul(fe,ve)|0,C=C+Math.imul(fe,de)|0,N=N+Math.imul(Te,_e)|0,d=d+Math.imul(Te,Se)|0,d=d+Math.imul(Me,_e)|0,C=C+Math.imul(Me,Se)|0,N=N+Math.imul(Q,Re)|0,d=d+Math.imul(Q,Fe)|0,d=d+Math.imul(ae,Re)|0,C=C+Math.imul(ae,Fe)|0,N=N+Math.imul(Y,Qe)|0,d=d+Math.imul(Y,Je)|0,d=d+Math.imul(K,Qe)|0,C=C+Math.imul(K,Je)|0,N=N+Math.imul($,Ie)|0,d=d+Math.imul($,Ue)|0,d=d+Math.imul(V,Ie)|0,C=C+Math.imul(V,Ue)|0,N=N+Math.imul(x,Ne)|0,d=d+Math.imul(x,Ze)|0,d=d+Math.imul(B,Ne)|0,C=C+Math.imul(B,Ze)|0;var hc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(hc>>>26)|0,hc&=67108863,N=Math.imul(Le,Pe),d=Math.imul(Le,We),d=d+Math.imul(Ge,Pe)|0,C=Math.imul(Ge,We),N=N+Math.imul(qe,Be)|0,d=d+Math.imul(qe,Ke)|0,d=d+Math.imul(Ve,Be)|0,C=C+Math.imul(Ve,Ke)|0,N=N+Math.imul(ge,De)|0,d=d+Math.imul(ge,ie)|0,d=d+Math.imul(He,De)|0,C=C+Math.imul(He,ie)|0,N=N+Math.imul(he,ve)|0,d=d+Math.imul(he,de)|0,d=d+Math.imul(je,ve)|0,C=C+Math.imul(je,de)|0,N=N+Math.imul(Ce,_e)|0,d=d+Math.imul(Ce,Se)|0,d=d+Math.imul(fe,_e)|0,C=C+Math.imul(fe,Se)|0,N=N+Math.imul(Te,Re)|0,d=d+Math.imul(Te,Fe)|0,d=d+Math.imul(Me,Re)|0,C=C+Math.imul(Me,Fe)|0,N=N+Math.imul(Q,Qe)|0,d=d+Math.imul(Q,Je)|0,d=d+Math.imul(ae,Qe)|0,C=C+Math.imul(ae,Je)|0,N=N+Math.imul(Y,Ie)|0,d=d+Math.imul(Y,Ue)|0,d=d+Math.imul(K,Ie)|0,C=C+Math.imul(K,Ue)|0,N=N+Math.imul($,Ne)|0,d=d+Math.imul($,Ze)|0,d=d+Math.imul(V,Ne)|0,C=C+Math.imul(V,Ze)|0,N=N+Math.imul(x,et)|0,d=d+Math.imul(x,tt)|0,d=d+Math.imul(B,et)|0,C=C+Math.imul(B,tt)|0;var dc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(dc>>>26)|0,dc&=67108863,N=Math.imul(Le,Be),d=Math.imul(Le,Ke),d=d+Math.imul(Ge,Be)|0,C=Math.imul(Ge,Ke),N=N+Math.imul(qe,De)|0,d=d+Math.imul(qe,ie)|0,d=d+Math.imul(Ve,De)|0,C=C+Math.imul(Ve,ie)|0,N=N+Math.imul(ge,ve)|0,d=d+Math.imul(ge,de)|0,d=d+Math.imul(He,ve)|0,C=C+Math.imul(He,de)|0,N=N+Math.imul(he,_e)|0,d=d+Math.imul(he,Se)|0,d=d+Math.imul(je,_e)|0,C=C+Math.imul(je,Se)|0,N=N+Math.imul(Ce,Re)|0,d=d+Math.imul(Ce,Fe)|0,d=d+Math.imul(fe,Re)|0,C=C+Math.imul(fe,Fe)|0,N=N+Math.imul(Te,Qe)|0,d=d+Math.imul(Te,Je)|0,d=d+Math.imul(Me,Qe)|0,C=C+Math.imul(Me,Je)|0,N=N+Math.imul(Q,Ie)|0,d=d+Math.imul(Q,Ue)|0,d=d+Math.imul(ae,Ie)|0,C=C+Math.imul(ae,Ue)|0,N=N+Math.imul(Y,Ne)|0,d=d+Math.imul(Y,Ze)|0,d=d+Math.imul(K,Ne)|0,C=C+Math.imul(K,Ze)|0,N=N+Math.imul($,et)|0,d=d+Math.imul($,tt)|0,d=d+Math.imul(V,et)|0,C=C+Math.imul(V,tt)|0;var pc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(pc>>>26)|0,pc&=67108863,N=Math.imul(Le,De),d=Math.imul(Le,ie),d=d+Math.imul(Ge,De)|0,C=Math.imul(Ge,ie),N=N+Math.imul(qe,ve)|0,d=d+Math.imul(qe,de)|0,d=d+Math.imul(Ve,ve)|0,C=C+Math.imul(Ve,de)|0,N=N+Math.imul(ge,_e)|0,d=d+Math.imul(ge,Se)|0,d=d+Math.imul(He,_e)|0,C=C+Math.imul(He,Se)|0,N=N+Math.imul(he,Re)|0,d=d+Math.imul(he,Fe)|0,d=d+Math.imul(je,Re)|0,C=C+Math.imul(je,Fe)|0,N=N+Math.imul(Ce,Qe)|0,d=d+Math.imul(Ce,Je)|0,d=d+Math.imul(fe,Qe)|0,C=C+Math.imul(fe,Je)|0,N=N+Math.imul(Te,Ie)|0,d=d+Math.imul(Te,Ue)|0,d=d+Math.imul(Me,Ie)|0,C=C+Math.imul(Me,Ue)|0,N=N+Math.imul(Q,Ne)|0,d=d+Math.imul(Q,Ze)|0,d=d+Math.imul(ae,Ne)|0,C=C+Math.imul(ae,Ze)|0,N=N+Math.imul(Y,et)|0,d=d+Math.imul(Y,tt)|0,d=d+Math.imul(K,et)|0,C=C+Math.imul(K,tt)|0;var mc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(mc>>>26)|0,mc&=67108863,N=Math.imul(Le,ve),d=Math.imul(Le,de),d=d+Math.imul(Ge,ve)|0,C=Math.imul(Ge,de),N=N+Math.imul(qe,_e)|0,d=d+Math.imul(qe,Se)|0,d=d+Math.imul(Ve,_e)|0,C=C+Math.imul(Ve,Se)|0,N=N+Math.imul(ge,Re)|0,d=d+Math.imul(ge,Fe)|0,d=d+Math.imul(He,Re)|0,C=C+Math.imul(He,Fe)|0,N=N+Math.imul(he,Qe)|0,d=d+Math.imul(he,Je)|0,d=d+Math.imul(je,Qe)|0,C=C+Math.imul(je,Je)|0,N=N+Math.imul(Ce,Ie)|0,d=d+Math.imul(Ce,Ue)|0,d=d+Math.imul(fe,Ie)|0,C=C+Math.imul(fe,Ue)|0,N=N+Math.imul(Te,Ne)|0,d=d+Math.imul(Te,Ze)|0,d=d+Math.imul(Me,Ne)|0,C=C+Math.imul(Me,Ze)|0,N=N+Math.imul(Q,et)|0,d=d+Math.imul(Q,tt)|0,d=d+Math.imul(ae,et)|0,C=C+Math.imul(ae,tt)|0;var gc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(gc>>>26)|0,gc&=67108863,N=Math.imul(Le,_e),d=Math.imul(Le,Se),d=d+Math.imul(Ge,_e)|0,C=Math.imul(Ge,Se),N=N+Math.imul(qe,Re)|0,d=d+Math.imul(qe,Fe)|0,d=d+Math.imul(Ve,Re)|0,C=C+Math.imul(Ve,Fe)|0,N=N+Math.imul(ge,Qe)|0,d=d+Math.imul(ge,Je)|0,d=d+Math.imul(He,Qe)|0,C=C+Math.imul(He,Je)|0,N=N+Math.imul(he,Ie)|0,d=d+Math.imul(he,Ue)|0,d=d+Math.imul(je,Ie)|0,C=C+Math.imul(je,Ue)|0,N=N+Math.imul(Ce,Ne)|0,d=d+Math.imul(Ce,Ze)|0,d=d+Math.imul(fe,Ne)|0,C=C+Math.imul(fe,Ze)|0,N=N+Math.imul(Te,et)|0,d=d+Math.imul(Te,tt)|0,d=d+Math.imul(Me,et)|0,C=C+Math.imul(Me,tt)|0;var vc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(vc>>>26)|0,vc&=67108863,N=Math.imul(Le,Re),d=Math.imul(Le,Fe),d=d+Math.imul(Ge,Re)|0,C=Math.imul(Ge,Fe),N=N+Math.imul(qe,Qe)|0,d=d+Math.imul(qe,Je)|0,d=d+Math.imul(Ve,Qe)|0,C=C+Math.imul(Ve,Je)|0,N=N+Math.imul(ge,Ie)|0,d=d+Math.imul(ge,Ue)|0,d=d+Math.imul(He,Ie)|0,C=C+Math.imul(He,Ue)|0,N=N+Math.imul(he,Ne)|0,d=d+Math.imul(he,Ze)|0,d=d+Math.imul(je,Ne)|0,C=C+Math.imul(je,Ze)|0,N=N+Math.imul(Ce,et)|0,d=d+Math.imul(Ce,tt)|0,d=d+Math.imul(fe,et)|0,C=C+Math.imul(fe,tt)|0;var yc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(yc>>>26)|0,yc&=67108863,N=Math.imul(Le,Qe),d=Math.imul(Le,Je),d=d+Math.imul(Ge,Qe)|0,C=Math.imul(Ge,Je),N=N+Math.imul(qe,Ie)|0,d=d+Math.imul(qe,Ue)|0,d=d+Math.imul(Ve,Ie)|0,C=C+Math.imul(Ve,Ue)|0,N=N+Math.imul(ge,Ne)|0,d=d+Math.imul(ge,Ze)|0,d=d+Math.imul(He,Ne)|0,C=C+Math.imul(He,Ze)|0,N=N+Math.imul(he,et)|0,d=d+Math.imul(he,tt)|0,d=d+Math.imul(je,et)|0,C=C+Math.imul(je,tt)|0;var wc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(wc>>>26)|0,wc&=67108863,N=Math.imul(Le,Ie),d=Math.imul(Le,Ue),d=d+Math.imul(Ge,Ie)|0,C=Math.imul(Ge,Ue),N=N+Math.imul(qe,Ne)|0,d=d+Math.imul(qe,Ze)|0,d=d+Math.imul(Ve,Ne)|0,C=C+Math.imul(Ve,Ze)|0,N=N+Math.imul(ge,et)|0,d=d+Math.imul(ge,tt)|0,d=d+Math.imul(He,et)|0,C=C+Math.imul(He,tt)|0;var xc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(xc>>>26)|0,xc&=67108863,N=Math.imul(Le,Ne),d=Math.imul(Le,Ze),d=d+Math.imul(Ge,Ne)|0,C=Math.imul(Ge,Ze),N=N+Math.imul(qe,et)|0,d=d+Math.imul(qe,tt)|0,d=d+Math.imul(Ve,et)|0,C=C+Math.imul(Ve,tt)|0;var bc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(bc>>>26)|0,bc&=67108863,N=Math.imul(Le,et),d=Math.imul(Le,tt),d=d+Math.imul(Ge,et)|0,C=Math.imul(Ge,tt);var Ec=(I+N|0)+((d&8191)<<13)|0;return I=(C+(d>>>13)|0)+(Ec>>>26)|0,Ec&=67108863,P[0]=Jn,P[1]=Yn,P[2]=Xn,P[3]=Zn,P[4]=ei,P[5]=uc,P[6]=cc,P[7]=fc,P[8]=hc,P[9]=dc,P[10]=pc,P[11]=mc,P[12]=gc,P[13]=vc,P[14]=yc,P[15]=wc,P[16]=xc,P[17]=bc,P[18]=Ec,I!==0&&(P[19]=I,E.length++),E};Math.imul||(m=w);function A(R,f,g){g.negative=f.negative^R.negative,g.length=R.length+f.length;for(var E=0,M=0,_=0;_>>26)|0,M+=P>>>26,P&=67108863}g.words[_]=I,E=P,P=M}return E!==0?g.words[_]=E:g.length--,g._strip()}function j(R,f,g){return A(R,f,g)}s.prototype.mulTo=function(f,g){var E,M=this.length+f.length;return this.length===10&&f.length===10?E=m(this,f,g):M<63?E=w(this,f,g):M<1024?E=A(this,f,g):E=j(this,f,g),E},s.prototype.mul=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},s.prototype.mulf=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),j(this,f,g)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var E=0,M=0;M>=26,E+=_/67108864|0,E+=P>>>26,this.words[M]=P&67108863}return E!==0&&(this.words[M]=E,this.length++),g?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var g=k(f);if(g.length===0)return new s(1);for(var E=this,M=0;M=0);var g=f%26,E=(f-g)/26,M=67108863>>>26-g<<26-g,_;if(g!==0){var P=0;for(_=0;_>>26-g}P&&(this.words[_]=P,this.length++)}if(E!==0){for(_=this.length-1;_>=0;_--)this.words[_+E]=this.words[_];for(_=0;_=0);var M;g?M=(g-g%26)/26:M=0;var _=f%26,P=Math.min((f-_)/26,this.length),I=67108863^67108863>>>_<<_,N=E;if(M-=P,M=Math.max(0,M),N){for(var d=0;dP)for(this.length-=P,d=0;d=0&&(C!==0||d>=M);d--){var ee=this.words[d]|0;this.words[d]=C<<26-_|ee>>>_,C=ee&I}return N&&C!==0&&(N.words[N.length++]=C),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,g,E){return n(this.negative===0),this.iushrn(f,g,E)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,E=(f-g)/26,M=1<=0);var g=f%26,E=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=E)return this;if(g!==0&&E++,this.length=Math.min(E,this.length),g!==0){var M=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(N/67108864|0),this.words[_+E]=P&67108863}for(;_>26,this.words[_+E]=P&67108863;if(I===0)return this._strip();for(n(I===-1),I=0,_=0;_>26,this.words[_]=P&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,g){var E=this.length-f.length,M=this.clone(),_=f,P=_.words[_.length-1]|0,I=this._countBits(P);E=26-I,E!==0&&(_=_.ushln(E),M.iushln(E),P=_.words[_.length-1]|0);var N=M.length-_.length,d;if(g!=="mod"){d=new s(null),d.length=N+1,d.words=new Array(d.length);for(var C=0;C=0;x--){var B=(M.words[_.length+x]|0)*67108864+(M.words[_.length+x-1]|0);for(B=Math.min(B/P|0,67108863),M._ishlnsubmul(_,B,x);M.negative!==0;)B--,M.negative=0,M._ishlnsubmul(_,1,x),M.isZero()||(M.negative^=1);d&&(d.words[x]=B)}return d&&d._strip(),M._strip(),g!=="div"&&E!==0&&M.iushrn(E),{div:d||null,mod:M}},s.prototype.divmod=function(f,g,E){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var M,_,P;return this.negative!==0&&f.negative===0?(P=this.neg().divmod(f,g),g!=="mod"&&(M=P.div.neg()),g!=="div"&&(_=P.mod.neg(),E&&_.negative!==0&&_.iadd(f)),{div:M,mod:_}):this.negative===0&&f.negative!==0?(P=this.divmod(f.neg(),g),g!=="mod"&&(M=P.div.neg()),{div:M,mod:P.mod}):this.negative&f.negative?(P=this.neg().divmod(f.neg(),g),g!=="div"&&(_=P.mod.neg(),E&&_.negative!==0&&_.isub(f)),{div:P.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,g)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var E=g.div.negative!==0?g.mod.isub(f):g.mod,M=f.ushrn(1),_=f.andln(1),P=E.cmp(M);return P<0||_===1&&P===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var E=(1<<26)%f,M=0,_=this.length-1;_>=0;_--)M=(E*M+(this.words[_]|0))%f;return g?-M:M},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var E=0,M=this.length-1;M>=0;M--){var _=(this.words[M]|0)+E*67108864;this.words[M]=_/f|0,E=_%f}return this._strip(),g?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,E=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var M=new s(1),_=new s(0),P=new s(0),I=new s(1),N=0;g.isEven()&&E.isEven();)g.iushrn(1),E.iushrn(1),++N;for(var d=E.clone(),C=g.clone();!g.isZero();){for(var ee=0,x=1;!(g.words[0]&x)&&ee<26;++ee,x<<=1);if(ee>0)for(g.iushrn(ee);ee-- >0;)(M.isOdd()||_.isOdd())&&(M.iadd(d),_.isub(C)),M.iushrn(1),_.iushrn(1);for(var B=0,z=1;!(E.words[0]&z)&&B<26;++B,z<<=1);if(B>0)for(E.iushrn(B);B-- >0;)(P.isOdd()||I.isOdd())&&(P.iadd(d),I.isub(C)),P.iushrn(1),I.iushrn(1);g.cmp(E)>=0?(g.isub(E),M.isub(P),_.isub(I)):(E.isub(g),P.isub(M),I.isub(_))}return{a:P,b:I,gcd:E.iushln(N)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,E=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var M=new s(1),_=new s(0),P=E.clone();g.cmpn(1)>0&&E.cmpn(1)>0;){for(var I=0,N=1;!(g.words[0]&N)&&I<26;++I,N<<=1);if(I>0)for(g.iushrn(I);I-- >0;)M.isOdd()&&M.iadd(P),M.iushrn(1);for(var d=0,C=1;!(E.words[0]&C)&&d<26;++d,C<<=1);if(d>0)for(E.iushrn(d);d-- >0;)_.isOdd()&&_.iadd(P),_.iushrn(1);g.cmp(E)>=0?(g.isub(E),M.isub(_)):(E.isub(g),_.isub(M))}var ee;return g.cmpn(1)===0?ee=M:ee=_,ee.cmpn(0)<0&&ee.iadd(f),ee},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),E=f.clone();g.negative=0,E.negative=0;for(var M=0;g.isEven()&&E.isEven();M++)g.iushrn(1),E.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;E.isEven();)E.iushrn(1);var _=g.cmp(E);if(_<0){var P=g;g=E,E=P}else if(_===0||E.cmpn(1)===0)break;g.isub(E)}while(!0);return E.iushln(M)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,E=(f-g)/26,M=1<>>26,I&=67108863,this.words[P]=I}return _!==0&&(this.words[P]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var E;if(this.length>1)E=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var M=this.words[0]|0;E=M===f?0:Mf.length)return 1;if(this.length=0;E--){var M=this.words[E]|0,_=f.words[E]|0;if(M!==_){M<_?g=-1:M>_&&(g=1);break}}return g},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new re(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var L={k256:null,p224:null,p192:null,p25519:null};function D(R,f){this.name=R,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}D.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},D.prototype.ireduce=function(f){var g=f,E;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),E=g.bitLength();while(E>this.n);var M=E0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},D.prototype.split=function(f,g){f.iushrn(this.n,0,g)},D.prototype.imulK=function(f){return f.imul(this.k)};function F(){D.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(F,D),F.prototype.split=function(f,g){for(var E=4194303,M=Math.min(f.length,9),_=0;_>>22,P=I}P>>>=22,f.words[_-10]=P,P===0&&f.length>10?f.length-=10:f.length-=9},F.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,E=0;E>>=26,f.words[E]=_,g=M}return g!==0&&(f.words[f.length++]=g),f},s._prime=function(f){if(L[f])return L[f];var g;if(f==="k256")g=new F;else if(f==="p224")g=new U;else if(f==="p192")g=new G;else if(f==="p25519")g=new J;else throw new Error("Unknown prime "+f);return L[f]=g,g};function re(R){if(typeof R=="string"){var f=s._prime(R);this.m=f.p,this.prime=f}else n(R.gtn(1),"modulus must be greater than 1"),this.m=R,this.prime=null}re.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},re.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},re.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},re.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},re.prototype.add=function(f,g){this._verify2(f,g);var E=f.add(g);return E.cmp(this.m)>=0&&E.isub(this.m),E._forceRed(this)},re.prototype.iadd=function(f,g){this._verify2(f,g);var E=f.iadd(g);return E.cmp(this.m)>=0&&E.isub(this.m),E},re.prototype.sub=function(f,g){this._verify2(f,g);var E=f.sub(g);return E.cmpn(0)<0&&E.iadd(this.m),E._forceRed(this)},re.prototype.isub=function(f,g){this._verify2(f,g);var E=f.isub(g);return E.cmpn(0)<0&&E.iadd(this.m),E},re.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},re.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},re.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},re.prototype.isqr=function(f){return this.imul(f,f.clone())},re.prototype.sqr=function(f){return this.mul(f,f)},re.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var E=this.m.add(new s(1)).iushrn(2);return this.pow(f,E)}for(var M=this.m.subn(1),_=0;!M.isZero()&&M.andln(1)===0;)_++,M.iushrn(1);n(!M.isZero());var P=new s(1).toRed(this),I=P.redNeg(),N=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new s(2*d*d).toRed(this);this.pow(d,N).cmp(I)!==0;)d.redIAdd(I);for(var C=this.pow(d,M),ee=this.pow(f,M.addn(1).iushrn(1)),x=this.pow(f,M),B=_;x.cmp(P)!==0;){for(var z=x,$=0;z.cmp(P)!==0;$++)z=z.redSqr();n($=0;_--){for(var C=g.words[_],ee=d-1;ee>=0;ee--){var x=C>>ee&1;if(P!==M[0]&&(P=this.sqr(P)),x===0&&I===0){N=0;continue}I<<=1,I|=x,N++,!(N!==E&&(_!==0||ee!==0))&&(P=this.mul(P,M[I]),N=0,I=0)}d=26}return P},re.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},re.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},s.mont=function(f){return new $e(f)};function $e(R){re.call(this,R),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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)}i($e,re),$e.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},$e.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},$e.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var E=f.imul(g),M=E.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=E.isub(M).iushrn(this.shift),P=_;return _.cmp(this.m)>=0?P=_.isub(this.m):_.cmpn(0)<0&&(P=_.iadd(this.m)),P._forceRed(this)},$e.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new s(0)._forceRed(this);var E=f.mul(g),M=E.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=E.isub(M).iushrn(this.shift),P=_;return _.cmp(this.m)>=0?P=_.isub(this.m):_.cmpn(0)<0&&(P=_.iadd(this.m)),P._forceRed(this)},$e.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,ze)})(Ud);var p3=Ud.exports;const ue=Si(p3),m3="bignumber/5.7.0";var ua=ue.BN;const kn=new O(m3),Xc={},Pp=9007199254740991;let Rp=!1;class W{constructor(e,r){e!==Xc&&kn.throwError("cannot call constructor directly; use BigNumber.from",O.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Zt(ye(this).fromTwos(e))}toTwos(e){return Zt(ye(this).toTwos(e))}abs(){return this._hex[0]==="-"?W.from(this._hex.substring(1)):this}add(e){return Zt(ye(this).add(ye(e)))}sub(e){return Zt(ye(this).sub(ye(e)))}div(e){return W.from(e).isZero()&&_r("division-by-zero","div"),Zt(ye(this).div(ye(e)))}mul(e){return Zt(ye(this).mul(ye(e)))}mod(e){const r=ye(e);return r.isNeg()&&_r("division-by-zero","mod"),Zt(ye(this).umod(r))}pow(e){const r=ye(e);return r.isNeg()&&_r("negative-power","pow"),Zt(ye(this).pow(r))}and(e){const r=ye(e);return(this.isNegative()||r.isNeg())&&_r("unbound-bitwise-result","and"),Zt(ye(this).and(r))}or(e){const r=ye(e);return(this.isNegative()||r.isNeg())&&_r("unbound-bitwise-result","or"),Zt(ye(this).or(r))}xor(e){const r=ye(e);return(this.isNegative()||r.isNeg())&&_r("unbound-bitwise-result","xor"),Zt(ye(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&_r("negative-width","mask"),Zt(ye(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&_r("negative-width","shl"),Zt(ye(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&_r("negative-width","shr"),Zt(ye(this).shrn(e))}eq(e){return ye(this).eq(ye(e))}lt(e){return ye(this).lt(ye(e))}lte(e){return ye(this).lte(ye(e))}gt(e){return ye(this).gt(ye(e))}gte(e){return ye(this).gte(ye(e))}isNegative(){return this._hex[0]==="-"}isZero(){return ye(this).isZero()}toNumber(){try{return ye(this).toNumber()}catch{_r("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return kn.throwError("this platform does not support BigInt",O.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Rp||(Rp=!0,kn.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?kn.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",O.errors.UNEXPECTED_ARGUMENT,{}):kn.throwError("BigNumber.toString does not accept parameters",O.errors.UNEXPECTED_ARGUMENT,{})),ye(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof W)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new W(Xc,ca(e)):e.match(/^-?[0-9]+$/)?new W(Xc,ca(new ua(e))):kn.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&_r("underflow","BigNumber.from",e),(e>=Pp||e<=-Pp)&&_r("overflow","BigNumber.from",e),W.from(String(e));const r=e;if(typeof r=="bigint")return W.from(r.toString());if(qu(r))return W.from(ne(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return W.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(me(n)||n[0]==="-"&&me(n.substring(1))))return W.from(n)}return kn.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function ca(t){if(typeof t!="string")return ca(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&kn.throwArgumentError("invalid hex","value",t),t=ca(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Zt(t){return W.from(ca(t))}function ye(t){const e=W.from(t).toHexString();return e[0]==="-"?new ua("-"+e.substring(3),16):new ua(e.substring(2),16)}function _r(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),kn.throwError(t,O.errors.NUMERIC_FAULT,n)}function g3(t){return new ua(t,36).toString(16)}function v3(t){return new ua(t,16).toString(36)}var M1={exports:{}};/** + */const o3="startTransition",bp=iw[o3];function a3(t){let{basename:e,children:r,future:n,window:i}=t,s=j.useRef();s.current==null&&(s.current=pb({window:i,v5Compat:!0}));let o=s.current,[a,l]=j.useState({action:o.action,location:o.location}),{v7_startTransition:u}=n||{},c=j.useCallback(h=>{u&&bp?bp(()=>l(h)):l(h)},[l,u]);return j.useLayoutEffect(()=>o.listen(c),[o,c]),j.createElement(i3,{basename:e,children:r,location:a.location,navigationType:a.action,navigator:o,future:n})}var Ep;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Ep||(Ep={}));var Ap;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Ap||(Ap={}));var Hu={},Ln={},N1={};const l3="logger/5.7.0";let _p=!1,Sp=!1;const _l={debug:1,default:2,info:2,warning:3,error:4,off:5};let kp=_l.default,Jc=null;function u3(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Np=u3();var Eh;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(Eh||(Eh={}));var $r;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})($r||($r={}));const Mp="0123456789abcdef";class O{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();_l[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(kp>_l[n])&&console.log.apply(console,r)}debug(...e){this._log(O.levels.DEBUG,e)}info(...e){this._log(O.levels.INFO,e)}warn(...e){this._log(O.levels.WARNING,e)}makeError(e,r,n){if(Sp)return this.makeError("censored error",r,{});r||(r=O.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(l=>{const u=n[l];try{if(u instanceof Uint8Array){let c="";for(let h=0;h>4],c+=Mp[u[h]&15];i.push(l+"=Uint8Array(0x"+c+")")}else i.push(l+"="+JSON.stringify(u))}catch{i.push(l+"="+JSON.stringify(n[l].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case $r.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=e;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case $r.CALL_EXCEPTION:case $r.INSUFFICIENT_FUNDS:case $r.MISSING_NEW:case $r.NONCE_EXPIRED:case $r.REPLACEMENT_UNDERPRICED:case $r.TRANSACTION_REPLACED:case $r.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(l){a[l]=n[l]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,O.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Np&&this.throwError("platform missing String.prototype.normalize",O.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Np})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,O.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,O.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,O.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",O.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",O.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",O.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Jc||(Jc=new O(l3)),Jc}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",O.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),_p){if(!e)return;this.globalLogger().throwError("error censorship permanent",O.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Sp=!!e,_p=!!r}static setLogLevel(e){const r=_l[e.toLowerCase()];if(r==null){O.globalLogger().warn("invalid log level - "+e);return}kp=r}static from(e){return new O(e)}}O.errors=$r;O.levels=Eh;const c3="bytes/5.7.0",pt=new O(c3);function M1(t){return!!t.toHexString}function Ts(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ts(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Fd(t){return me(t)&&!(t.length%2)||qu(t)}function Cp(t){return typeof t=="number"&&t==t&&t%1===0}function qu(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Cp(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function oe(t,e){if(e||(e={}),typeof t=="number"){pt.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ts(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),M1(t)&&(t=t.toHexString()),me(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":pt.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ioe(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),Ts(n)}function qs(t){let e=oe(t);if(e.length===0)return e;let r=0;for(;re&&pt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ts(r)}function me(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Yc="0123456789abcdef";function ne(t,e){if(e||(e={}),typeof t=="number"){pt.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Yc[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),M1(t))return t.toHexString();if(me(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":pt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(qu(t)){let r="0x";for(let n=0;n>4]+Yc[i&15]}return r}return pt.throwArgumentError("invalid hexlify value","value",t)}function zn(t){if(typeof t!="string")t=ne(t);else if(!me(t)||t.length%2)return null;return(t.length-2)/2}function Ot(t,e,r){return typeof t!="string"?t=ne(t):(!me(t)||t.length%2)&&pt.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function nr(t){let e="0x";return t.forEach(r=>{e+=ne(r).substring(2)}),e}function Vu(t){const e=f3(ne(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function f3(t){typeof t!="string"&&(t=ne(t)),me(t)||pt.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&pt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Gu(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Fd(t)){let r=oe(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=ne(r.slice(0,32)),e.s=ne(r.slice(32,64))):r.length===65?(e.r=ne(r.slice(0,32)),e.s=ne(r.slice(32,64)),e.v=r[64]):pt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:pt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=ne(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=Sl(oe(e._vs),32);e._vs=ne(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&pt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=ne(i);e.s==null?e.s=o:e.s!==o&&pt.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?pt.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&pt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!me(e.r)?pt.throwArgumentError("signature missing or invalid r","signature",t):e.r=gt(e.r,32),e.s==null||!me(e.s)?pt.throwArgumentError("signature missing or invalid s","signature",t):e.s=gt(e.s,32);const r=oe(e.s);r[0]>=128&&pt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=ne(r);e._vs&&(me(e._vs)||pt.throwArgumentError("signature invalid _vs","signature",t),e._vs=gt(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&pt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}var Ud={exports:{}};const h3={},d3=Object.freeze(Object.defineProperty({__proto__:null,default:h3},Symbol.toStringTag,{value:"Module"})),p3=Ys(d3);Ud.exports;(function(t){(function(e,r){function n(R,f){if(!R)throw new Error(f||"Assertion failed")}function i(R,f){R.super_=f;var g=function(){};g.prototype=f.prototype,R.prototype=new g,R.prototype.constructor=R}function s(R,f,g){if(s.isBN(R))return R;this.negative=0,this.words=null,this.length=0,this.red=null,R!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(R||0,f||10,g||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=p3.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,g){return f.cmp(g)>0?f:g},s.min=function(f,g){return f.cmp(g)<0?f:g},s.prototype._init=function(f,g,E){if(typeof f=="number")return this._initNumber(f,g,E);if(typeof f=="object")return this._initArray(f,g,E);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var M=0;f[0]==="-"&&(M++,this.negative=1),M=0;M-=3)P=f[M]|f[M-1]<<8|f[M-2]<<16,this.words[S]|=P<>>26-I&67108863,I+=24,I>=26&&(I-=26,S++);else if(E==="le")for(M=0,S=0;M>>26-I&67108863,I+=24,I>=26&&(I-=26,S++);return this._strip()};function a(R,f){var g=R.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+R)}function l(R,f,g){var E=a(R,g);return g-1>=f&&(E|=a(R,g-1)<<4),E}s.prototype._parseHex=function(f,g,E){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var M=0;M=g;M-=2)I=l(f,g,M)<=18?(S-=18,P+=1,this.words[P]|=I>>>26):S+=8;else{var N=f.length-g;for(M=N%2===0?g+1:g;M=18?(S-=18,P+=1,this.words[P]|=I>>>26):S+=8}this._strip()};function u(R,f,g,E){for(var M=0,S=0,P=Math.min(R.length,g),I=f;I=49?S=N-49+10:N>=17?S=N-17+10:S=N,n(N>=0&&S1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch{s.prototype.inspect=h}else s.prototype.inspect=h;function h(){return(this.red?""}var p=["","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"],v=[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],w=[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];s.prototype.toString=function(f,g){f=f||10,g=g|0||1;var E;if(f===16||f==="hex"){E="";for(var M=0,S=0,P=0;P>>24-M&16777215,M+=2,M>=26&&(M-=26,P--),S!==0||P!==this.length-1?E=p[6-N.length]+N+E:E=N+E}for(S!==0&&(E=S.toString(16)+E);E.length%g!==0;)E="0"+E;return this.negative!==0&&(E="-"+E),E}if(f===(f|0)&&f>=2&&f<=36){var d=v[f],C=w[f];E="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var x=ee.modrn(C).toString(f);ee=ee.idivn(C),ee.isZero()?E=x+E:E=p[d-x.length]+x+E}for(this.isZero()&&(E="0"+E);E.length%g!==0;)E="0"+E;return this.negative!==0&&(E="-"+E),E}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,g){return this.toArrayLike(o,f,g)}),s.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var b=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};s.prototype.toArrayLike=function(f,g,E){this._strip();var M=this.byteLength(),S=E||Math.max(1,M);n(M<=S,"byte array longer than desired length"),n(S>0,"Requested array length <= 0");var P=b(f,S),I=g==="le"?"LE":"BE";return this["_toArrayLike"+I](P,M),P},s.prototype._toArrayLikeLE=function(f,g){for(var E=0,M=0,S=0,P=0;S>8&255),E>16&255),P===6?(E>24&255),M=0,P=0):(M=I>>>24,P+=2)}if(E=0&&(f[E--]=I>>8&255),E>=0&&(f[E--]=I>>16&255),P===6?(E>=0&&(f[E--]=I>>24&255),M=0,P=0):(M=I>>>24,P+=2)}if(E>=0)for(f[E--]=M;E>=0;)f[E--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var g=f,E=0;return g>=4096&&(E+=13,g>>>=13),g>=64&&(E+=7,g>>>=7),g>=8&&(E+=4,g>>>=4),g>=2&&(E+=2,g>>>=2),E+g},s.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,E=0;return g&8191||(E+=13,g>>>=13),g&127||(E+=7,g>>>=7),g&15||(E+=4,g>>>=4),g&3||(E+=2,g>>>=2),g&1||E++,E},s.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function k(R){for(var f=new Array(R.bitLength()),g=0;g>>M&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var E=0;Ef.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var g,E;this.length>f.length?(g=this,E=f):(g=f,E=this);for(var M=0;Mf.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,E=f%26;this._expand(g),E>0&&g--;for(var M=0;M0&&(this.words[M]=~this.words[M]&67108863>>26-E),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var E=f/26|0,M=f%26;return this._expand(E+1),g?this.words[E]=this.words[E]|1<f.length?(E=this,M=f):(E=f,M=this);for(var S=0,P=0;P>>26;for(;S!==0&&P>>26;if(this.length=E.length,S!==0)this.words[this.length]=S,this.length++;else if(E!==this)for(;Pf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var E=this.cmp(f);if(E===0)return this.negative=0,this.length=1,this.words[0]=0,this;var M,S;E>0?(M=this,S=f):(M=f,S=this);for(var P=0,I=0;I>26,this.words[I]=g&67108863;for(;P!==0&&I>26,this.words[I]=g&67108863;if(P===0&&I>>26,ee=N&67108863,x=Math.min(d,f.length-1),B=Math.max(0,d-R.length+1);B<=x;B++){var z=d-B|0;M=R.words[z]|0,S=f.words[B]|0,P=M*S+ee,C+=P/67108864|0,ee=P&67108863}g.words[d]=ee|0,N=C|0}return N!==0?g.words[d]=N|0:g.length--,g._strip()}var m=function(f,g,E){var M=f.words,S=g.words,P=E.words,I=0,N,d,C,ee=M[0]|0,x=ee&8191,B=ee>>>13,z=M[1]|0,$=z&8191,V=z>>>13,se=M[2]|0,Y=se&8191,K=se>>>13,Xe=M[3]|0,Q=Xe&8191,ae=Xe>>>13,Xr=M[4]|0,Te=Xr&8191,Me=Xr>>>13,Zr=M[5]|0,Ce=Zr&8191,fe=Zr>>>13,Er=M[6]|0,he=Er&8191,je=Er>>>13,en=M[7]|0,ge=en&8191,He=en>>>13,En=M[8]|0,qe=En&8191,Ve=En>>>13,Gt=M[9]|0,Le=Gt&8191,Ge=Gt>>>13,Lr=S[0]|0,Pe=Lr&8191,We=Lr>>>13,An=S[1]|0,Be=An&8191,Ke=An>>>13,_n=S[2]|0,De=_n&8191,ie=_n>>>13,lt=S[3]|0,ve=lt&8191,de=lt>>>13,it=S[4]|0,_e=it&8191,Se=it>>>13,Pt=S[5]|0,Re=Pt&8191,Fe=Pt>>>13,Yt=S[6]|0,Qe=Yt&8191,Je=Yt>>>13,Xt=S[7]|0,Ie=Xt&8191,Ue=Xt>>>13,Ar=S[8]|0,Ne=Ar&8191,Ze=Ar>>>13,Ri=S[9]|0,et=Ri&8191,tt=Ri>>>13;E.negative=f.negative^g.negative,E.length=19,N=Math.imul(x,Pe),d=Math.imul(x,We),d=d+Math.imul(B,Pe)|0,C=Math.imul(B,We);var Jn=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,N=Math.imul($,Pe),d=Math.imul($,We),d=d+Math.imul(V,Pe)|0,C=Math.imul(V,We),N=N+Math.imul(x,Be)|0,d=d+Math.imul(x,Ke)|0,d=d+Math.imul(B,Be)|0,C=C+Math.imul(B,Ke)|0;var Yn=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,N=Math.imul(Y,Pe),d=Math.imul(Y,We),d=d+Math.imul(K,Pe)|0,C=Math.imul(K,We),N=N+Math.imul($,Be)|0,d=d+Math.imul($,Ke)|0,d=d+Math.imul(V,Be)|0,C=C+Math.imul(V,Ke)|0,N=N+Math.imul(x,De)|0,d=d+Math.imul(x,ie)|0,d=d+Math.imul(B,De)|0,C=C+Math.imul(B,ie)|0;var Xn=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(Xn>>>26)|0,Xn&=67108863,N=Math.imul(Q,Pe),d=Math.imul(Q,We),d=d+Math.imul(ae,Pe)|0,C=Math.imul(ae,We),N=N+Math.imul(Y,Be)|0,d=d+Math.imul(Y,Ke)|0,d=d+Math.imul(K,Be)|0,C=C+Math.imul(K,Ke)|0,N=N+Math.imul($,De)|0,d=d+Math.imul($,ie)|0,d=d+Math.imul(V,De)|0,C=C+Math.imul(V,ie)|0,N=N+Math.imul(x,ve)|0,d=d+Math.imul(x,de)|0,d=d+Math.imul(B,ve)|0,C=C+Math.imul(B,de)|0;var Zn=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,N=Math.imul(Te,Pe),d=Math.imul(Te,We),d=d+Math.imul(Me,Pe)|0,C=Math.imul(Me,We),N=N+Math.imul(Q,Be)|0,d=d+Math.imul(Q,Ke)|0,d=d+Math.imul(ae,Be)|0,C=C+Math.imul(ae,Ke)|0,N=N+Math.imul(Y,De)|0,d=d+Math.imul(Y,ie)|0,d=d+Math.imul(K,De)|0,C=C+Math.imul(K,ie)|0,N=N+Math.imul($,ve)|0,d=d+Math.imul($,de)|0,d=d+Math.imul(V,ve)|0,C=C+Math.imul(V,de)|0,N=N+Math.imul(x,_e)|0,d=d+Math.imul(x,Se)|0,d=d+Math.imul(B,_e)|0,C=C+Math.imul(B,Se)|0;var ei=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(ei>>>26)|0,ei&=67108863,N=Math.imul(Ce,Pe),d=Math.imul(Ce,We),d=d+Math.imul(fe,Pe)|0,C=Math.imul(fe,We),N=N+Math.imul(Te,Be)|0,d=d+Math.imul(Te,Ke)|0,d=d+Math.imul(Me,Be)|0,C=C+Math.imul(Me,Ke)|0,N=N+Math.imul(Q,De)|0,d=d+Math.imul(Q,ie)|0,d=d+Math.imul(ae,De)|0,C=C+Math.imul(ae,ie)|0,N=N+Math.imul(Y,ve)|0,d=d+Math.imul(Y,de)|0,d=d+Math.imul(K,ve)|0,C=C+Math.imul(K,de)|0,N=N+Math.imul($,_e)|0,d=d+Math.imul($,Se)|0,d=d+Math.imul(V,_e)|0,C=C+Math.imul(V,Se)|0,N=N+Math.imul(x,Re)|0,d=d+Math.imul(x,Fe)|0,d=d+Math.imul(B,Re)|0,C=C+Math.imul(B,Fe)|0;var uc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(uc>>>26)|0,uc&=67108863,N=Math.imul(he,Pe),d=Math.imul(he,We),d=d+Math.imul(je,Pe)|0,C=Math.imul(je,We),N=N+Math.imul(Ce,Be)|0,d=d+Math.imul(Ce,Ke)|0,d=d+Math.imul(fe,Be)|0,C=C+Math.imul(fe,Ke)|0,N=N+Math.imul(Te,De)|0,d=d+Math.imul(Te,ie)|0,d=d+Math.imul(Me,De)|0,C=C+Math.imul(Me,ie)|0,N=N+Math.imul(Q,ve)|0,d=d+Math.imul(Q,de)|0,d=d+Math.imul(ae,ve)|0,C=C+Math.imul(ae,de)|0,N=N+Math.imul(Y,_e)|0,d=d+Math.imul(Y,Se)|0,d=d+Math.imul(K,_e)|0,C=C+Math.imul(K,Se)|0,N=N+Math.imul($,Re)|0,d=d+Math.imul($,Fe)|0,d=d+Math.imul(V,Re)|0,C=C+Math.imul(V,Fe)|0,N=N+Math.imul(x,Qe)|0,d=d+Math.imul(x,Je)|0,d=d+Math.imul(B,Qe)|0,C=C+Math.imul(B,Je)|0;var cc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(cc>>>26)|0,cc&=67108863,N=Math.imul(ge,Pe),d=Math.imul(ge,We),d=d+Math.imul(He,Pe)|0,C=Math.imul(He,We),N=N+Math.imul(he,Be)|0,d=d+Math.imul(he,Ke)|0,d=d+Math.imul(je,Be)|0,C=C+Math.imul(je,Ke)|0,N=N+Math.imul(Ce,De)|0,d=d+Math.imul(Ce,ie)|0,d=d+Math.imul(fe,De)|0,C=C+Math.imul(fe,ie)|0,N=N+Math.imul(Te,ve)|0,d=d+Math.imul(Te,de)|0,d=d+Math.imul(Me,ve)|0,C=C+Math.imul(Me,de)|0,N=N+Math.imul(Q,_e)|0,d=d+Math.imul(Q,Se)|0,d=d+Math.imul(ae,_e)|0,C=C+Math.imul(ae,Se)|0,N=N+Math.imul(Y,Re)|0,d=d+Math.imul(Y,Fe)|0,d=d+Math.imul(K,Re)|0,C=C+Math.imul(K,Fe)|0,N=N+Math.imul($,Qe)|0,d=d+Math.imul($,Je)|0,d=d+Math.imul(V,Qe)|0,C=C+Math.imul(V,Je)|0,N=N+Math.imul(x,Ie)|0,d=d+Math.imul(x,Ue)|0,d=d+Math.imul(B,Ie)|0,C=C+Math.imul(B,Ue)|0;var fc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(fc>>>26)|0,fc&=67108863,N=Math.imul(qe,Pe),d=Math.imul(qe,We),d=d+Math.imul(Ve,Pe)|0,C=Math.imul(Ve,We),N=N+Math.imul(ge,Be)|0,d=d+Math.imul(ge,Ke)|0,d=d+Math.imul(He,Be)|0,C=C+Math.imul(He,Ke)|0,N=N+Math.imul(he,De)|0,d=d+Math.imul(he,ie)|0,d=d+Math.imul(je,De)|0,C=C+Math.imul(je,ie)|0,N=N+Math.imul(Ce,ve)|0,d=d+Math.imul(Ce,de)|0,d=d+Math.imul(fe,ve)|0,C=C+Math.imul(fe,de)|0,N=N+Math.imul(Te,_e)|0,d=d+Math.imul(Te,Se)|0,d=d+Math.imul(Me,_e)|0,C=C+Math.imul(Me,Se)|0,N=N+Math.imul(Q,Re)|0,d=d+Math.imul(Q,Fe)|0,d=d+Math.imul(ae,Re)|0,C=C+Math.imul(ae,Fe)|0,N=N+Math.imul(Y,Qe)|0,d=d+Math.imul(Y,Je)|0,d=d+Math.imul(K,Qe)|0,C=C+Math.imul(K,Je)|0,N=N+Math.imul($,Ie)|0,d=d+Math.imul($,Ue)|0,d=d+Math.imul(V,Ie)|0,C=C+Math.imul(V,Ue)|0,N=N+Math.imul(x,Ne)|0,d=d+Math.imul(x,Ze)|0,d=d+Math.imul(B,Ne)|0,C=C+Math.imul(B,Ze)|0;var hc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(hc>>>26)|0,hc&=67108863,N=Math.imul(Le,Pe),d=Math.imul(Le,We),d=d+Math.imul(Ge,Pe)|0,C=Math.imul(Ge,We),N=N+Math.imul(qe,Be)|0,d=d+Math.imul(qe,Ke)|0,d=d+Math.imul(Ve,Be)|0,C=C+Math.imul(Ve,Ke)|0,N=N+Math.imul(ge,De)|0,d=d+Math.imul(ge,ie)|0,d=d+Math.imul(He,De)|0,C=C+Math.imul(He,ie)|0,N=N+Math.imul(he,ve)|0,d=d+Math.imul(he,de)|0,d=d+Math.imul(je,ve)|0,C=C+Math.imul(je,de)|0,N=N+Math.imul(Ce,_e)|0,d=d+Math.imul(Ce,Se)|0,d=d+Math.imul(fe,_e)|0,C=C+Math.imul(fe,Se)|0,N=N+Math.imul(Te,Re)|0,d=d+Math.imul(Te,Fe)|0,d=d+Math.imul(Me,Re)|0,C=C+Math.imul(Me,Fe)|0,N=N+Math.imul(Q,Qe)|0,d=d+Math.imul(Q,Je)|0,d=d+Math.imul(ae,Qe)|0,C=C+Math.imul(ae,Je)|0,N=N+Math.imul(Y,Ie)|0,d=d+Math.imul(Y,Ue)|0,d=d+Math.imul(K,Ie)|0,C=C+Math.imul(K,Ue)|0,N=N+Math.imul($,Ne)|0,d=d+Math.imul($,Ze)|0,d=d+Math.imul(V,Ne)|0,C=C+Math.imul(V,Ze)|0,N=N+Math.imul(x,et)|0,d=d+Math.imul(x,tt)|0,d=d+Math.imul(B,et)|0,C=C+Math.imul(B,tt)|0;var dc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(dc>>>26)|0,dc&=67108863,N=Math.imul(Le,Be),d=Math.imul(Le,Ke),d=d+Math.imul(Ge,Be)|0,C=Math.imul(Ge,Ke),N=N+Math.imul(qe,De)|0,d=d+Math.imul(qe,ie)|0,d=d+Math.imul(Ve,De)|0,C=C+Math.imul(Ve,ie)|0,N=N+Math.imul(ge,ve)|0,d=d+Math.imul(ge,de)|0,d=d+Math.imul(He,ve)|0,C=C+Math.imul(He,de)|0,N=N+Math.imul(he,_e)|0,d=d+Math.imul(he,Se)|0,d=d+Math.imul(je,_e)|0,C=C+Math.imul(je,Se)|0,N=N+Math.imul(Ce,Re)|0,d=d+Math.imul(Ce,Fe)|0,d=d+Math.imul(fe,Re)|0,C=C+Math.imul(fe,Fe)|0,N=N+Math.imul(Te,Qe)|0,d=d+Math.imul(Te,Je)|0,d=d+Math.imul(Me,Qe)|0,C=C+Math.imul(Me,Je)|0,N=N+Math.imul(Q,Ie)|0,d=d+Math.imul(Q,Ue)|0,d=d+Math.imul(ae,Ie)|0,C=C+Math.imul(ae,Ue)|0,N=N+Math.imul(Y,Ne)|0,d=d+Math.imul(Y,Ze)|0,d=d+Math.imul(K,Ne)|0,C=C+Math.imul(K,Ze)|0,N=N+Math.imul($,et)|0,d=d+Math.imul($,tt)|0,d=d+Math.imul(V,et)|0,C=C+Math.imul(V,tt)|0;var pc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(pc>>>26)|0,pc&=67108863,N=Math.imul(Le,De),d=Math.imul(Le,ie),d=d+Math.imul(Ge,De)|0,C=Math.imul(Ge,ie),N=N+Math.imul(qe,ve)|0,d=d+Math.imul(qe,de)|0,d=d+Math.imul(Ve,ve)|0,C=C+Math.imul(Ve,de)|0,N=N+Math.imul(ge,_e)|0,d=d+Math.imul(ge,Se)|0,d=d+Math.imul(He,_e)|0,C=C+Math.imul(He,Se)|0,N=N+Math.imul(he,Re)|0,d=d+Math.imul(he,Fe)|0,d=d+Math.imul(je,Re)|0,C=C+Math.imul(je,Fe)|0,N=N+Math.imul(Ce,Qe)|0,d=d+Math.imul(Ce,Je)|0,d=d+Math.imul(fe,Qe)|0,C=C+Math.imul(fe,Je)|0,N=N+Math.imul(Te,Ie)|0,d=d+Math.imul(Te,Ue)|0,d=d+Math.imul(Me,Ie)|0,C=C+Math.imul(Me,Ue)|0,N=N+Math.imul(Q,Ne)|0,d=d+Math.imul(Q,Ze)|0,d=d+Math.imul(ae,Ne)|0,C=C+Math.imul(ae,Ze)|0,N=N+Math.imul(Y,et)|0,d=d+Math.imul(Y,tt)|0,d=d+Math.imul(K,et)|0,C=C+Math.imul(K,tt)|0;var mc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(mc>>>26)|0,mc&=67108863,N=Math.imul(Le,ve),d=Math.imul(Le,de),d=d+Math.imul(Ge,ve)|0,C=Math.imul(Ge,de),N=N+Math.imul(qe,_e)|0,d=d+Math.imul(qe,Se)|0,d=d+Math.imul(Ve,_e)|0,C=C+Math.imul(Ve,Se)|0,N=N+Math.imul(ge,Re)|0,d=d+Math.imul(ge,Fe)|0,d=d+Math.imul(He,Re)|0,C=C+Math.imul(He,Fe)|0,N=N+Math.imul(he,Qe)|0,d=d+Math.imul(he,Je)|0,d=d+Math.imul(je,Qe)|0,C=C+Math.imul(je,Je)|0,N=N+Math.imul(Ce,Ie)|0,d=d+Math.imul(Ce,Ue)|0,d=d+Math.imul(fe,Ie)|0,C=C+Math.imul(fe,Ue)|0,N=N+Math.imul(Te,Ne)|0,d=d+Math.imul(Te,Ze)|0,d=d+Math.imul(Me,Ne)|0,C=C+Math.imul(Me,Ze)|0,N=N+Math.imul(Q,et)|0,d=d+Math.imul(Q,tt)|0,d=d+Math.imul(ae,et)|0,C=C+Math.imul(ae,tt)|0;var gc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(gc>>>26)|0,gc&=67108863,N=Math.imul(Le,_e),d=Math.imul(Le,Se),d=d+Math.imul(Ge,_e)|0,C=Math.imul(Ge,Se),N=N+Math.imul(qe,Re)|0,d=d+Math.imul(qe,Fe)|0,d=d+Math.imul(Ve,Re)|0,C=C+Math.imul(Ve,Fe)|0,N=N+Math.imul(ge,Qe)|0,d=d+Math.imul(ge,Je)|0,d=d+Math.imul(He,Qe)|0,C=C+Math.imul(He,Je)|0,N=N+Math.imul(he,Ie)|0,d=d+Math.imul(he,Ue)|0,d=d+Math.imul(je,Ie)|0,C=C+Math.imul(je,Ue)|0,N=N+Math.imul(Ce,Ne)|0,d=d+Math.imul(Ce,Ze)|0,d=d+Math.imul(fe,Ne)|0,C=C+Math.imul(fe,Ze)|0,N=N+Math.imul(Te,et)|0,d=d+Math.imul(Te,tt)|0,d=d+Math.imul(Me,et)|0,C=C+Math.imul(Me,tt)|0;var vc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(vc>>>26)|0,vc&=67108863,N=Math.imul(Le,Re),d=Math.imul(Le,Fe),d=d+Math.imul(Ge,Re)|0,C=Math.imul(Ge,Fe),N=N+Math.imul(qe,Qe)|0,d=d+Math.imul(qe,Je)|0,d=d+Math.imul(Ve,Qe)|0,C=C+Math.imul(Ve,Je)|0,N=N+Math.imul(ge,Ie)|0,d=d+Math.imul(ge,Ue)|0,d=d+Math.imul(He,Ie)|0,C=C+Math.imul(He,Ue)|0,N=N+Math.imul(he,Ne)|0,d=d+Math.imul(he,Ze)|0,d=d+Math.imul(je,Ne)|0,C=C+Math.imul(je,Ze)|0,N=N+Math.imul(Ce,et)|0,d=d+Math.imul(Ce,tt)|0,d=d+Math.imul(fe,et)|0,C=C+Math.imul(fe,tt)|0;var yc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(yc>>>26)|0,yc&=67108863,N=Math.imul(Le,Qe),d=Math.imul(Le,Je),d=d+Math.imul(Ge,Qe)|0,C=Math.imul(Ge,Je),N=N+Math.imul(qe,Ie)|0,d=d+Math.imul(qe,Ue)|0,d=d+Math.imul(Ve,Ie)|0,C=C+Math.imul(Ve,Ue)|0,N=N+Math.imul(ge,Ne)|0,d=d+Math.imul(ge,Ze)|0,d=d+Math.imul(He,Ne)|0,C=C+Math.imul(He,Ze)|0,N=N+Math.imul(he,et)|0,d=d+Math.imul(he,tt)|0,d=d+Math.imul(je,et)|0,C=C+Math.imul(je,tt)|0;var wc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(wc>>>26)|0,wc&=67108863,N=Math.imul(Le,Ie),d=Math.imul(Le,Ue),d=d+Math.imul(Ge,Ie)|0,C=Math.imul(Ge,Ue),N=N+Math.imul(qe,Ne)|0,d=d+Math.imul(qe,Ze)|0,d=d+Math.imul(Ve,Ne)|0,C=C+Math.imul(Ve,Ze)|0,N=N+Math.imul(ge,et)|0,d=d+Math.imul(ge,tt)|0,d=d+Math.imul(He,et)|0,C=C+Math.imul(He,tt)|0;var xc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(xc>>>26)|0,xc&=67108863,N=Math.imul(Le,Ne),d=Math.imul(Le,Ze),d=d+Math.imul(Ge,Ne)|0,C=Math.imul(Ge,Ze),N=N+Math.imul(qe,et)|0,d=d+Math.imul(qe,tt)|0,d=d+Math.imul(Ve,et)|0,C=C+Math.imul(Ve,tt)|0;var bc=(I+N|0)+((d&8191)<<13)|0;I=(C+(d>>>13)|0)+(bc>>>26)|0,bc&=67108863,N=Math.imul(Le,et),d=Math.imul(Le,tt),d=d+Math.imul(Ge,et)|0,C=Math.imul(Ge,tt);var Ec=(I+N|0)+((d&8191)<<13)|0;return I=(C+(d>>>13)|0)+(Ec>>>26)|0,Ec&=67108863,P[0]=Jn,P[1]=Yn,P[2]=Xn,P[3]=Zn,P[4]=ei,P[5]=uc,P[6]=cc,P[7]=fc,P[8]=hc,P[9]=dc,P[10]=pc,P[11]=mc,P[12]=gc,P[13]=vc,P[14]=yc,P[15]=wc,P[16]=xc,P[17]=bc,P[18]=Ec,I!==0&&(P[19]=I,E.length++),E};Math.imul||(m=y);function A(R,f,g){g.negative=f.negative^R.negative,g.length=R.length+f.length;for(var E=0,M=0,S=0;S>>26)|0,M+=P>>>26,P&=67108863}g.words[S]=I,E=P,P=M}return E!==0?g.words[S]=E:g.length--,g._strip()}function T(R,f,g){return A(R,f,g)}s.prototype.mulTo=function(f,g){var E,M=this.length+f.length;return this.length===10&&f.length===10?E=m(this,f,g):M<63?E=y(this,f,g):M<1024?E=A(this,f,g):E=T(this,f,g),E},s.prototype.mul=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},s.prototype.mulf=function(f){var g=new s(null);return g.words=new Array(this.length+f.length),T(this,f,g)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var E=0,M=0;M>=26,E+=S/67108864|0,E+=P>>>26,this.words[M]=P&67108863}return E!==0&&(this.words[M]=E,this.length++),g?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var g=k(f);if(g.length===0)return new s(1);for(var E=this,M=0;M=0);var g=f%26,E=(f-g)/26,M=67108863>>>26-g<<26-g,S;if(g!==0){var P=0;for(S=0;S>>26-g}P&&(this.words[S]=P,this.length++)}if(E!==0){for(S=this.length-1;S>=0;S--)this.words[S+E]=this.words[S];for(S=0;S=0);var M;g?M=(g-g%26)/26:M=0;var S=f%26,P=Math.min((f-S)/26,this.length),I=67108863^67108863>>>S<P)for(this.length-=P,d=0;d=0&&(C!==0||d>=M);d--){var ee=this.words[d]|0;this.words[d]=C<<26-S|ee>>>S,C=ee&I}return N&&C!==0&&(N.words[N.length++]=C),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,g,E){return n(this.negative===0),this.iushrn(f,g,E)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,E=(f-g)/26,M=1<=0);var g=f%26,E=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=E)return this;if(g!==0&&E++,this.length=Math.min(E,this.length),g!==0){var M=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(N/67108864|0),this.words[S+E]=P&67108863}for(;S>26,this.words[S+E]=P&67108863;if(I===0)return this._strip();for(n(I===-1),I=0,S=0;S>26,this.words[S]=P&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,g){var E=this.length-f.length,M=this.clone(),S=f,P=S.words[S.length-1]|0,I=this._countBits(P);E=26-I,E!==0&&(S=S.ushln(E),M.iushln(E),P=S.words[S.length-1]|0);var N=M.length-S.length,d;if(g!=="mod"){d=new s(null),d.length=N+1,d.words=new Array(d.length);for(var C=0;C=0;x--){var B=(M.words[S.length+x]|0)*67108864+(M.words[S.length+x-1]|0);for(B=Math.min(B/P|0,67108863),M._ishlnsubmul(S,B,x);M.negative!==0;)B--,M.negative=0,M._ishlnsubmul(S,1,x),M.isZero()||(M.negative^=1);d&&(d.words[x]=B)}return d&&d._strip(),M._strip(),g!=="div"&&E!==0&&M.iushrn(E),{div:d||null,mod:M}},s.prototype.divmod=function(f,g,E){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var M,S,P;return this.negative!==0&&f.negative===0?(P=this.neg().divmod(f,g),g!=="mod"&&(M=P.div.neg()),g!=="div"&&(S=P.mod.neg(),E&&S.negative!==0&&S.iadd(f)),{div:M,mod:S}):this.negative===0&&f.negative!==0?(P=this.divmod(f.neg(),g),g!=="mod"&&(M=P.div.neg()),{div:M,mod:P.mod}):this.negative&f.negative?(P=this.neg().divmod(f.neg(),g),g!=="div"&&(S=P.mod.neg(),E&&S.negative!==0&&S.isub(f)),{div:P.div,mod:S}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,g)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var E=g.div.negative!==0?g.mod.isub(f):g.mod,M=f.ushrn(1),S=f.andln(1),P=E.cmp(M);return P<0||S===1&&P===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var E=(1<<26)%f,M=0,S=this.length-1;S>=0;S--)M=(E*M+(this.words[S]|0))%f;return g?-M:M},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var E=0,M=this.length-1;M>=0;M--){var S=(this.words[M]|0)+E*67108864;this.words[M]=S/f|0,E=S%f}return this._strip(),g?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,E=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var M=new s(1),S=new s(0),P=new s(0),I=new s(1),N=0;g.isEven()&&E.isEven();)g.iushrn(1),E.iushrn(1),++N;for(var d=E.clone(),C=g.clone();!g.isZero();){for(var ee=0,x=1;!(g.words[0]&x)&&ee<26;++ee,x<<=1);if(ee>0)for(g.iushrn(ee);ee-- >0;)(M.isOdd()||S.isOdd())&&(M.iadd(d),S.isub(C)),M.iushrn(1),S.iushrn(1);for(var B=0,z=1;!(E.words[0]&z)&&B<26;++B,z<<=1);if(B>0)for(E.iushrn(B);B-- >0;)(P.isOdd()||I.isOdd())&&(P.iadd(d),I.isub(C)),P.iushrn(1),I.iushrn(1);g.cmp(E)>=0?(g.isub(E),M.isub(P),S.isub(I)):(E.isub(g),P.isub(M),I.isub(S))}return{a:P,b:I,gcd:E.iushln(N)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,E=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var M=new s(1),S=new s(0),P=E.clone();g.cmpn(1)>0&&E.cmpn(1)>0;){for(var I=0,N=1;!(g.words[0]&N)&&I<26;++I,N<<=1);if(I>0)for(g.iushrn(I);I-- >0;)M.isOdd()&&M.iadd(P),M.iushrn(1);for(var d=0,C=1;!(E.words[0]&C)&&d<26;++d,C<<=1);if(d>0)for(E.iushrn(d);d-- >0;)S.isOdd()&&S.iadd(P),S.iushrn(1);g.cmp(E)>=0?(g.isub(E),M.isub(S)):(E.isub(g),S.isub(M))}var ee;return g.cmpn(1)===0?ee=M:ee=S,ee.cmpn(0)<0&&ee.iadd(f),ee},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),E=f.clone();g.negative=0,E.negative=0;for(var M=0;g.isEven()&&E.isEven();M++)g.iushrn(1),E.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;E.isEven();)E.iushrn(1);var S=g.cmp(E);if(S<0){var P=g;g=E,E=P}else if(S===0||E.cmpn(1)===0)break;g.isub(E)}while(!0);return E.iushln(M)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,E=(f-g)/26,M=1<>>26,I&=67108863,this.words[P]=I}return S!==0&&(this.words[P]=S,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var E;if(this.length>1)E=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var M=this.words[0]|0;E=M===f?0:Mf.length)return 1;if(this.length=0;E--){var M=this.words[E]|0,S=f.words[E]|0;if(M!==S){MS&&(g=1);break}}return g},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new re(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var L={k256:null,p224:null,p192:null,p25519:null};function D(R,f){this.name=R,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}D.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},D.prototype.ireduce=function(f){var g=f,E;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),E=g.bitLength();while(E>this.n);var M=E0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},D.prototype.split=function(f,g){f.iushrn(this.n,0,g)},D.prototype.imulK=function(f){return f.imul(this.k)};function F(){D.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(F,D),F.prototype.split=function(f,g){for(var E=4194303,M=Math.min(f.length,9),S=0;S>>22,P=I}P>>>=22,f.words[S-10]=P,P===0&&f.length>10?f.length-=10:f.length-=9},F.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,E=0;E>>=26,f.words[E]=S,g=M}return g!==0&&(f.words[f.length++]=g),f},s._prime=function(f){if(L[f])return L[f];var g;if(f==="k256")g=new F;else if(f==="p224")g=new U;else if(f==="p192")g=new G;else if(f==="p25519")g=new J;else throw new Error("Unknown prime "+f);return L[f]=g,g};function re(R){if(typeof R=="string"){var f=s._prime(R);this.m=f.p,this.prime=f}else n(R.gtn(1),"modulus must be greater than 1"),this.m=R,this.prime=null}re.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},re.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},re.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},re.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},re.prototype.add=function(f,g){this._verify2(f,g);var E=f.add(g);return E.cmp(this.m)>=0&&E.isub(this.m),E._forceRed(this)},re.prototype.iadd=function(f,g){this._verify2(f,g);var E=f.iadd(g);return E.cmp(this.m)>=0&&E.isub(this.m),E},re.prototype.sub=function(f,g){this._verify2(f,g);var E=f.sub(g);return E.cmpn(0)<0&&E.iadd(this.m),E._forceRed(this)},re.prototype.isub=function(f,g){this._verify2(f,g);var E=f.isub(g);return E.cmpn(0)<0&&E.iadd(this.m),E},re.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},re.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},re.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},re.prototype.isqr=function(f){return this.imul(f,f.clone())},re.prototype.sqr=function(f){return this.mul(f,f)},re.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var E=this.m.add(new s(1)).iushrn(2);return this.pow(f,E)}for(var M=this.m.subn(1),S=0;!M.isZero()&&M.andln(1)===0;)S++,M.iushrn(1);n(!M.isZero());var P=new s(1).toRed(this),I=P.redNeg(),N=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new s(2*d*d).toRed(this);this.pow(d,N).cmp(I)!==0;)d.redIAdd(I);for(var C=this.pow(d,M),ee=this.pow(f,M.addn(1).iushrn(1)),x=this.pow(f,M),B=S;x.cmp(P)!==0;){for(var z=x,$=0;z.cmp(P)!==0;$++)z=z.redSqr();n($=0;S--){for(var C=g.words[S],ee=d-1;ee>=0;ee--){var x=C>>ee&1;if(P!==M[0]&&(P=this.sqr(P)),x===0&&I===0){N=0;continue}I<<=1,I|=x,N++,!(N!==E&&(S!==0||ee!==0))&&(P=this.mul(P,M[I]),N=0,I=0)}d=26}return P},re.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},re.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},s.mont=function(f){return new $e(f)};function $e(R){re.call(this,R),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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)}i($e,re),$e.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},$e.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},$e.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var E=f.imul(g),M=E.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=E.isub(M).iushrn(this.shift),P=S;return S.cmp(this.m)>=0?P=S.isub(this.m):S.cmpn(0)<0&&(P=S.iadd(this.m)),P._forceRed(this)},$e.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new s(0)._forceRed(this);var E=f.mul(g),M=E.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=E.isub(M).iushrn(this.shift),P=S;return S.cmp(this.m)>=0?P=S.isub(this.m):S.cmpn(0)<0&&(P=S.iadd(this.m)),P._forceRed(this)},$e.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,ze)})(Ud);var m3=Ud.exports;const ce=Si(m3),g3="bignumber/5.7.0";var ua=ce.BN;const kn=new O(g3),Xc={},Pp=9007199254740991;let Rp=!1;class W{constructor(e,r){e!==Xc&&kn.throwError("cannot call constructor directly; use BigNumber.from",O.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Zt(ye(this).fromTwos(e))}toTwos(e){return Zt(ye(this).toTwos(e))}abs(){return this._hex[0]==="-"?W.from(this._hex.substring(1)):this}add(e){return Zt(ye(this).add(ye(e)))}sub(e){return Zt(ye(this).sub(ye(e)))}div(e){return W.from(e).isZero()&&_r("division-by-zero","div"),Zt(ye(this).div(ye(e)))}mul(e){return Zt(ye(this).mul(ye(e)))}mod(e){const r=ye(e);return r.isNeg()&&_r("division-by-zero","mod"),Zt(ye(this).umod(r))}pow(e){const r=ye(e);return r.isNeg()&&_r("negative-power","pow"),Zt(ye(this).pow(r))}and(e){const r=ye(e);return(this.isNegative()||r.isNeg())&&_r("unbound-bitwise-result","and"),Zt(ye(this).and(r))}or(e){const r=ye(e);return(this.isNegative()||r.isNeg())&&_r("unbound-bitwise-result","or"),Zt(ye(this).or(r))}xor(e){const r=ye(e);return(this.isNegative()||r.isNeg())&&_r("unbound-bitwise-result","xor"),Zt(ye(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&_r("negative-width","mask"),Zt(ye(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&_r("negative-width","shl"),Zt(ye(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&_r("negative-width","shr"),Zt(ye(this).shrn(e))}eq(e){return ye(this).eq(ye(e))}lt(e){return ye(this).lt(ye(e))}lte(e){return ye(this).lte(ye(e))}gt(e){return ye(this).gt(ye(e))}gte(e){return ye(this).gte(ye(e))}isNegative(){return this._hex[0]==="-"}isZero(){return ye(this).isZero()}toNumber(){try{return ye(this).toNumber()}catch{_r("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return kn.throwError("this platform does not support BigInt",O.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Rp||(Rp=!0,kn.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?kn.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",O.errors.UNEXPECTED_ARGUMENT,{}):kn.throwError("BigNumber.toString does not accept parameters",O.errors.UNEXPECTED_ARGUMENT,{})),ye(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof W)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new W(Xc,ca(e)):e.match(/^-?[0-9]+$/)?new W(Xc,ca(new ua(e))):kn.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&_r("underflow","BigNumber.from",e),(e>=Pp||e<=-Pp)&&_r("overflow","BigNumber.from",e),W.from(String(e));const r=e;if(typeof r=="bigint")return W.from(r.toString());if(qu(r))return W.from(ne(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return W.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(me(n)||n[0]==="-"&&me(n.substring(1))))return W.from(n)}return kn.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function ca(t){if(typeof t!="string")return ca(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&kn.throwArgumentError("invalid hex","value",t),t=ca(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Zt(t){return W.from(ca(t))}function ye(t){const e=W.from(t).toHexString();return e[0]==="-"?new ua("-"+e.substring(3),16):new ua(e.substring(2),16)}function _r(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),kn.throwError(t,O.errors.NUMERIC_FAULT,n)}function v3(t){return new ua(t,36).toString(16)}function y3(t){return new ua(t,16).toString(36)}var C1={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=ze:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,l=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],h=[4,1024,262144,67108864],p=[1,256,65536,16777216],v=[6,1536,393216,100663296],y=[0,8,16,24],b=[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],k=[224,256,384,512],w=[128,256],m=["hex","buffer","arrayBuffer","array","digest"],A={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),l&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});for(var j=function(x,B,z){return function($){return new d(x,B,x).update($)[z]()}},L=function(x,B,z){return function($,V){return new d(x,B,V).update($)[z]()}},D=function(x,B,z){return function($,V,se,Y){return f["cshake"+x].update($,V,se,Y)[z]()}},F=function(x,B,z){return function($,V,se,Y){return f["kmac"+x].update($,V,se,Y)[z]()}},U=function(x,B,z,$){for(var V=0;V>5,this.byteCount=this.blockCount<<2,this.outputBlocks=z>>5,this.extraBytes=(z&31)>>3;for(var $=0;$<50;++$)this.s[$]=0}d.prototype.update=function(x){if(this.finalized)throw new Error(r);var B,z=typeof x;if(z!=="string"){if(z==="object"){if(x===null)throw new Error(e);if(l&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!l||!ArrayBuffer.isView(x)))throw new Error(e)}else throw new Error(e);B=!0}for(var $=this.blocks,V=this.byteCount,se=x.length,Y=this.blockCount,K=0,Xe=this.s,Q,ae;K>2]|=x[K]<>2]|=ae<>2]|=(192|ae>>6)<>2]|=(128|ae&63)<=57344?($[Q>>2]|=(224|ae>>12)<>2]|=(128|ae>>6&63)<>2]|=(128|ae&63)<>2]|=(240|ae>>18)<>2]|=(128|ae>>12&63)<>2]|=(128|ae>>6&63)<>2]|=(128|ae&63)<=V){for(this.start=Q-V,this.block=$[Y],Q=0;Q>8,z=x&255;z>0;)V.unshift(z),x=x>>8,z=x&255,++$;return B?V.push($):V.unshift($),this.update(V),V.length},d.prototype.encodeString=function(x){var B,z=typeof x;if(z!=="string"){if(z==="object"){if(x===null)throw new Error(e);if(l&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!l||!ArrayBuffer.isView(x)))throw new Error(e)}else throw new Error(e);B=!0}var $=0,V=x.length;if(B)$=V;else for(var se=0;se=57344?$+=3:(Y=65536+((Y&1023)<<10|x.charCodeAt(++se)&1023),$+=4)}return $+=this.encode($*8),this.update(x),$},d.prototype.bytepad=function(x,B){for(var z=this.encode(B),$=0;$>2]|=this.padding[B&3],this.lastByteIndex===this.byteCount)for(x[0]=x[z],B=1;B>4&15]+u[K&15]+u[K>>12&15]+u[K>>8&15]+u[K>>20&15]+u[K>>16&15]+u[K>>28&15]+u[K>>24&15];se%x===0&&(ee(B),V=0)}return $&&(K=B[V],Y+=u[K>>4&15]+u[K&15],$>1&&(Y+=u[K>>12&15]+u[K>>8&15]),$>2&&(Y+=u[K>>20&15]+u[K>>16&15])),Y},d.prototype.arrayBuffer=function(){this.finalize();var x=this.blockCount,B=this.s,z=this.outputBlocks,$=this.extraBytes,V=0,se=0,Y=this.outputBits>>3,K;$?K=new ArrayBuffer(z+1<<2):K=new ArrayBuffer(Y);for(var Xe=new Uint32Array(K);se>8&255,Y[K+2]=Xe>>16&255,Y[K+3]=Xe>>24&255;se%x===0&&ee(B)}return $&&(K=se<<2,Xe=B[V],Y[K]=Xe&255,$>1&&(Y[K+1]=Xe>>8&255),$>2&&(Y[K+2]=Xe>>16&255)),Y};function C(x,B,z){d.call(this,x,B,z)}C.prototype=new d,C.prototype.finalize=function(){return this.encode(this.outputBits,!0),d.prototype.finalize.call(this)};var ee=function(x){var B,z,$,V,se,Y,K,Xe,Q,ae,Xr,Te,Me,Zr,Ce,fe,Er,he,je,en,ge,He,En,qe,Ve,Gt,Le,Ge,Lr,Pe,We,An,Be,Ke,_n,De,ie,lt,ve,de,it,_e,Se,Pt,Re,Fe,Yt,Qe,Je,Xt,Ie,Ue,Ar,Ne,Ze,Ri,et,tt,Jn,Yn,Xn,Zn,ei;for($=0;$<48;$+=2)V=x[0]^x[10]^x[20]^x[30]^x[40],se=x[1]^x[11]^x[21]^x[31]^x[41],Y=x[2]^x[12]^x[22]^x[32]^x[42],K=x[3]^x[13]^x[23]^x[33]^x[43],Xe=x[4]^x[14]^x[24]^x[34]^x[44],Q=x[5]^x[15]^x[25]^x[35]^x[45],ae=x[6]^x[16]^x[26]^x[36]^x[46],Xr=x[7]^x[17]^x[27]^x[37]^x[47],Te=x[8]^x[18]^x[28]^x[38]^x[48],Me=x[9]^x[19]^x[29]^x[39]^x[49],B=Te^(Y<<1|K>>>31),z=Me^(K<<1|Y>>>31),x[0]^=B,x[1]^=z,x[10]^=B,x[11]^=z,x[20]^=B,x[21]^=z,x[30]^=B,x[31]^=z,x[40]^=B,x[41]^=z,B=V^(Xe<<1|Q>>>31),z=se^(Q<<1|Xe>>>31),x[2]^=B,x[3]^=z,x[12]^=B,x[13]^=z,x[22]^=B,x[23]^=z,x[32]^=B,x[33]^=z,x[42]^=B,x[43]^=z,B=Y^(ae<<1|Xr>>>31),z=K^(Xr<<1|ae>>>31),x[4]^=B,x[5]^=z,x[14]^=B,x[15]^=z,x[24]^=B,x[25]^=z,x[34]^=B,x[35]^=z,x[44]^=B,x[45]^=z,B=Xe^(Te<<1|Me>>>31),z=Q^(Me<<1|Te>>>31),x[6]^=B,x[7]^=z,x[16]^=B,x[17]^=z,x[26]^=B,x[27]^=z,x[36]^=B,x[37]^=z,x[46]^=B,x[47]^=z,B=ae^(V<<1|se>>>31),z=Xr^(se<<1|V>>>31),x[8]^=B,x[9]^=z,x[18]^=B,x[19]^=z,x[28]^=B,x[29]^=z,x[38]^=B,x[39]^=z,x[48]^=B,x[49]^=z,Zr=x[0],Ce=x[1],Fe=x[11]<<4|x[10]>>>28,Yt=x[10]<<4|x[11]>>>28,Ge=x[20]<<3|x[21]>>>29,Lr=x[21]<<3|x[20]>>>29,Yn=x[31]<<9|x[30]>>>23,Xn=x[30]<<9|x[31]>>>23,_e=x[40]<<18|x[41]>>>14,Se=x[41]<<18|x[40]>>>14,Ke=x[2]<<1|x[3]>>>31,_n=x[3]<<1|x[2]>>>31,fe=x[13]<<12|x[12]>>>20,Er=x[12]<<12|x[13]>>>20,Qe=x[22]<<10|x[23]>>>22,Je=x[23]<<10|x[22]>>>22,Pe=x[33]<<13|x[32]>>>19,We=x[32]<<13|x[33]>>>19,Zn=x[42]<<2|x[43]>>>30,ei=x[43]<<2|x[42]>>>30,Ne=x[5]<<30|x[4]>>>2,Ze=x[4]<<30|x[5]>>>2,De=x[14]<<6|x[15]>>>26,ie=x[15]<<6|x[14]>>>26,he=x[25]<<11|x[24]>>>21,je=x[24]<<11|x[25]>>>21,Xt=x[34]<<15|x[35]>>>17,Ie=x[35]<<15|x[34]>>>17,An=x[45]<<29|x[44]>>>3,Be=x[44]<<29|x[45]>>>3,qe=x[6]<<28|x[7]>>>4,Ve=x[7]<<28|x[6]>>>4,Ri=x[17]<<23|x[16]>>>9,et=x[16]<<23|x[17]>>>9,lt=x[26]<<25|x[27]>>>7,ve=x[27]<<25|x[26]>>>7,en=x[36]<<21|x[37]>>>11,ge=x[37]<<21|x[36]>>>11,Ue=x[47]<<24|x[46]>>>8,Ar=x[46]<<24|x[47]>>>8,Pt=x[8]<<27|x[9]>>>5,Re=x[9]<<27|x[8]>>>5,Gt=x[18]<<20|x[19]>>>12,Le=x[19]<<20|x[18]>>>12,tt=x[29]<<7|x[28]>>>25,Jn=x[28]<<7|x[29]>>>25,de=x[38]<<8|x[39]>>>24,it=x[39]<<8|x[38]>>>24,He=x[48]<<14|x[49]>>>18,En=x[49]<<14|x[48]>>>18,x[0]=Zr^~fe&he,x[1]=Ce^~Er&je,x[10]=qe^~Gt&Ge,x[11]=Ve^~Le&Lr,x[20]=Ke^~De<,x[21]=_n^~ie&ve,x[30]=Pt^~Fe&Qe,x[31]=Re^~Yt&Je,x[40]=Ne^~Ri&tt,x[41]=Ze^~et&Jn,x[2]=fe^~he&en,x[3]=Er^~je&ge,x[12]=Gt^~Ge&Pe,x[13]=Le^~Lr&We,x[22]=De^~lt&de,x[23]=ie^~ve&it,x[32]=Fe^~Qe&Xt,x[33]=Yt^~Je&Ie,x[42]=Ri^~tt&Yn,x[43]=et^~Jn&Xn,x[4]=he^~en&He,x[5]=je^~ge&En,x[14]=Ge^~Pe&An,x[15]=Lr^~We&Be,x[24]=lt^~de&_e,x[25]=ve^~it&Se,x[34]=Qe^~Xt&Ue,x[35]=Je^~Ie&Ar,x[44]=tt^~Yn&Zn,x[45]=Jn^~Xn&ei,x[6]=en^~He&Zr,x[7]=ge^~En&Ce,x[16]=Pe^~An&qe,x[17]=We^~Be&Ve,x[26]=de^~_e&Ke,x[27]=it^~Se&_n,x[36]=Xt^~Ue&Pt,x[37]=Ie^~Ar&Re,x[46]=Yn^~Zn&Ne,x[47]=Xn^~ei&Ze,x[8]=He^~Zr&fe,x[9]=En^~Ce&Er,x[18]=An^~qe&Gt,x[19]=Be^~Ve&Le,x[28]=_e^~Ke&De,x[29]=Se^~_n&ie,x[38]=Ue^~Pt&Fe,x[39]=Ar^~Re&Yt,x[48]=Zn^~Ne&Ri,x[49]=ei^~Ze&et,x[0]^=b[$],x[1]^=b[$+1]};if(a)t.exports=f;else for(E=0;E>=8;return e}function Op(t,e,r){let n=0;for(let i=0;ie+1+n&&sn.throwError("child data too short",O.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function P1(t,e){if(t.length===0&&sn.throwError("data too short",O.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&sn.throwError("data short segment too short",O.errors.BUFFER_OVERRUN,{});const n=Op(t,e+1,r);return e+1+r+n>t.length&&sn.throwError("data long segment too short",O.errors.BUFFER_OVERRUN,{}),Tp(t,e,e+1+r,r+n)}else if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&sn.throwError("data array too short",O.errors.BUFFER_OVERRUN,{}),Tp(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&sn.throwError("data array too short",O.errors.BUFFER_OVERRUN,{});const n=Op(t,e+1,r);e+1+r+n>t.length&&sn.throwError("data array too short",O.errors.BUFFER_OVERRUN,{});const i=ne(t.slice(e+1+r,e+1+r+n));return{consumed:1+r+n,result:i}}else if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&sn.throwError("data too short",O.errors.BUFFER_OVERRUN,{});const n=ne(t.slice(e+1,e+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:ne(t[e])}}function zd(t){const e=oe(t),r=P1(e,0);return r.consumed!==e.length&&sn.throwArgumentError("invalid rlp data","data",t),r.result}const b3="address/5.7.0",di=new O(b3);function jp(t){me(t,20)||di.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=oe(ot(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const E3=9007199254740991;function A3(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const $d={};for(let t=0;t<10;t++)$d[String(t)]=String(t);for(let t=0;t<26;t++)$d[String.fromCharCode(65+t)]=String(10+t);const Lp=Math.floor(A3(E3));function R1(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>$d[n]).join("");for(;e.length>=Lp;){let n=e.substring(0,Lp);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function vt(t){let e=null;if(typeof t!="string"&&di.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=jp(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&di.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==R1(t)&&di.throwArgumentError("bad icap checksum","address",t),e=g3(t.substring(4));e.length<40;)e="0"+e;e=jp("0x"+e)}else di.throwArgumentError("invalid address","address",t);return e}function _3(t){try{return vt(t),!0}catch{}return!1}function S3(t){let e=v3(vt(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+R1("XE00"+e)+e}function Hd(t){let e=null;try{e=vt(t.from)}catch{di.throwArgumentError("missing from address","transaction",t)}const r=qs(oe(W.from(t.nonce).toHexString()));return vt(Ot(ot(Wu([e,r])),12))}function k3(t,e,r){return zn(e)!==32&&di.throwArgumentError("salt must be 32 bytes","salt",e),zn(r)!==32&&di.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),vt(Ot(ot(zt(["0xff",vt(t),e,r])),12))}const N3=Object.freeze(Object.defineProperty({__proto__:null,getAddress:vt,getContractAddress:Hd,getCreate2Address:k3,getIcapAddress:S3,isAddress:_3},Symbol.toStringTag,{value:"Module"})),M3=Ys(N3);var C3={BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Bp=t=>{let e;const r=new Set,n=(l,u)=>{const c=typeof l=="function"?l(e):l;if(!Object.is(c,e)){const h=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,h))}},i=()=>e,a={setState:n,getState:i,subscribe:l=>(r.add(l),()=>r.delete(l)),destroy:()=>{(C3?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,a),a},I1=t=>t?Bp(t):Bp;var O1={exports:{}},T1={},j1={exports:{}},L1={};/** + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=ze:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,l=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],h=[4,1024,262144,67108864],p=[1,256,65536,16777216],v=[6,1536,393216,100663296],w=[0,8,16,24],b=[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],k=[224,256,384,512],y=[128,256],m=["hex","buffer","arrayBuffer","array","digest"],A={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),l&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});for(var T=function(x,B,z){return function($){return new d(x,B,x).update($)[z]()}},L=function(x,B,z){return function($,V){return new d(x,B,V).update($)[z]()}},D=function(x,B,z){return function($,V,se,Y){return f["cshake"+x].update($,V,se,Y)[z]()}},F=function(x,B,z){return function($,V,se,Y){return f["kmac"+x].update($,V,se,Y)[z]()}},U=function(x,B,z,$){for(var V=0;V>5,this.byteCount=this.blockCount<<2,this.outputBlocks=z>>5,this.extraBytes=(z&31)>>3;for(var $=0;$<50;++$)this.s[$]=0}d.prototype.update=function(x){if(this.finalized)throw new Error(r);var B,z=typeof x;if(z!=="string"){if(z==="object"){if(x===null)throw new Error(e);if(l&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!l||!ArrayBuffer.isView(x)))throw new Error(e)}else throw new Error(e);B=!0}for(var $=this.blocks,V=this.byteCount,se=x.length,Y=this.blockCount,K=0,Xe=this.s,Q,ae;K>2]|=x[K]<>2]|=ae<>2]|=(192|ae>>6)<>2]|=(128|ae&63)<=57344?($[Q>>2]|=(224|ae>>12)<>2]|=(128|ae>>6&63)<>2]|=(128|ae&63)<>2]|=(240|ae>>18)<>2]|=(128|ae>>12&63)<>2]|=(128|ae>>6&63)<>2]|=(128|ae&63)<=V){for(this.start=Q-V,this.block=$[Y],Q=0;Q>8,z=x&255;z>0;)V.unshift(z),x=x>>8,z=x&255,++$;return B?V.push($):V.unshift($),this.update(V),V.length},d.prototype.encodeString=function(x){var B,z=typeof x;if(z!=="string"){if(z==="object"){if(x===null)throw new Error(e);if(l&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!l||!ArrayBuffer.isView(x)))throw new Error(e)}else throw new Error(e);B=!0}var $=0,V=x.length;if(B)$=V;else for(var se=0;se=57344?$+=3:(Y=65536+((Y&1023)<<10|x.charCodeAt(++se)&1023),$+=4)}return $+=this.encode($*8),this.update(x),$},d.prototype.bytepad=function(x,B){for(var z=this.encode(B),$=0;$>2]|=this.padding[B&3],this.lastByteIndex===this.byteCount)for(x[0]=x[z],B=1;B>4&15]+u[K&15]+u[K>>12&15]+u[K>>8&15]+u[K>>20&15]+u[K>>16&15]+u[K>>28&15]+u[K>>24&15];se%x===0&&(ee(B),V=0)}return $&&(K=B[V],Y+=u[K>>4&15]+u[K&15],$>1&&(Y+=u[K>>12&15]+u[K>>8&15]),$>2&&(Y+=u[K>>20&15]+u[K>>16&15])),Y},d.prototype.arrayBuffer=function(){this.finalize();var x=this.blockCount,B=this.s,z=this.outputBlocks,$=this.extraBytes,V=0,se=0,Y=this.outputBits>>3,K;$?K=new ArrayBuffer(z+1<<2):K=new ArrayBuffer(Y);for(var Xe=new Uint32Array(K);se>8&255,Y[K+2]=Xe>>16&255,Y[K+3]=Xe>>24&255;se%x===0&&ee(B)}return $&&(K=se<<2,Xe=B[V],Y[K]=Xe&255,$>1&&(Y[K+1]=Xe>>8&255),$>2&&(Y[K+2]=Xe>>16&255)),Y};function C(x,B,z){d.call(this,x,B,z)}C.prototype=new d,C.prototype.finalize=function(){return this.encode(this.outputBits,!0),d.prototype.finalize.call(this)};var ee=function(x){var B,z,$,V,se,Y,K,Xe,Q,ae,Xr,Te,Me,Zr,Ce,fe,Er,he,je,en,ge,He,En,qe,Ve,Gt,Le,Ge,Lr,Pe,We,An,Be,Ke,_n,De,ie,lt,ve,de,it,_e,Se,Pt,Re,Fe,Yt,Qe,Je,Xt,Ie,Ue,Ar,Ne,Ze,Ri,et,tt,Jn,Yn,Xn,Zn,ei;for($=0;$<48;$+=2)V=x[0]^x[10]^x[20]^x[30]^x[40],se=x[1]^x[11]^x[21]^x[31]^x[41],Y=x[2]^x[12]^x[22]^x[32]^x[42],K=x[3]^x[13]^x[23]^x[33]^x[43],Xe=x[4]^x[14]^x[24]^x[34]^x[44],Q=x[5]^x[15]^x[25]^x[35]^x[45],ae=x[6]^x[16]^x[26]^x[36]^x[46],Xr=x[7]^x[17]^x[27]^x[37]^x[47],Te=x[8]^x[18]^x[28]^x[38]^x[48],Me=x[9]^x[19]^x[29]^x[39]^x[49],B=Te^(Y<<1|K>>>31),z=Me^(K<<1|Y>>>31),x[0]^=B,x[1]^=z,x[10]^=B,x[11]^=z,x[20]^=B,x[21]^=z,x[30]^=B,x[31]^=z,x[40]^=B,x[41]^=z,B=V^(Xe<<1|Q>>>31),z=se^(Q<<1|Xe>>>31),x[2]^=B,x[3]^=z,x[12]^=B,x[13]^=z,x[22]^=B,x[23]^=z,x[32]^=B,x[33]^=z,x[42]^=B,x[43]^=z,B=Y^(ae<<1|Xr>>>31),z=K^(Xr<<1|ae>>>31),x[4]^=B,x[5]^=z,x[14]^=B,x[15]^=z,x[24]^=B,x[25]^=z,x[34]^=B,x[35]^=z,x[44]^=B,x[45]^=z,B=Xe^(Te<<1|Me>>>31),z=Q^(Me<<1|Te>>>31),x[6]^=B,x[7]^=z,x[16]^=B,x[17]^=z,x[26]^=B,x[27]^=z,x[36]^=B,x[37]^=z,x[46]^=B,x[47]^=z,B=ae^(V<<1|se>>>31),z=Xr^(se<<1|V>>>31),x[8]^=B,x[9]^=z,x[18]^=B,x[19]^=z,x[28]^=B,x[29]^=z,x[38]^=B,x[39]^=z,x[48]^=B,x[49]^=z,Zr=x[0],Ce=x[1],Fe=x[11]<<4|x[10]>>>28,Yt=x[10]<<4|x[11]>>>28,Ge=x[20]<<3|x[21]>>>29,Lr=x[21]<<3|x[20]>>>29,Yn=x[31]<<9|x[30]>>>23,Xn=x[30]<<9|x[31]>>>23,_e=x[40]<<18|x[41]>>>14,Se=x[41]<<18|x[40]>>>14,Ke=x[2]<<1|x[3]>>>31,_n=x[3]<<1|x[2]>>>31,fe=x[13]<<12|x[12]>>>20,Er=x[12]<<12|x[13]>>>20,Qe=x[22]<<10|x[23]>>>22,Je=x[23]<<10|x[22]>>>22,Pe=x[33]<<13|x[32]>>>19,We=x[32]<<13|x[33]>>>19,Zn=x[42]<<2|x[43]>>>30,ei=x[43]<<2|x[42]>>>30,Ne=x[5]<<30|x[4]>>>2,Ze=x[4]<<30|x[5]>>>2,De=x[14]<<6|x[15]>>>26,ie=x[15]<<6|x[14]>>>26,he=x[25]<<11|x[24]>>>21,je=x[24]<<11|x[25]>>>21,Xt=x[34]<<15|x[35]>>>17,Ie=x[35]<<15|x[34]>>>17,An=x[45]<<29|x[44]>>>3,Be=x[44]<<29|x[45]>>>3,qe=x[6]<<28|x[7]>>>4,Ve=x[7]<<28|x[6]>>>4,Ri=x[17]<<23|x[16]>>>9,et=x[16]<<23|x[17]>>>9,lt=x[26]<<25|x[27]>>>7,ve=x[27]<<25|x[26]>>>7,en=x[36]<<21|x[37]>>>11,ge=x[37]<<21|x[36]>>>11,Ue=x[47]<<24|x[46]>>>8,Ar=x[46]<<24|x[47]>>>8,Pt=x[8]<<27|x[9]>>>5,Re=x[9]<<27|x[8]>>>5,Gt=x[18]<<20|x[19]>>>12,Le=x[19]<<20|x[18]>>>12,tt=x[29]<<7|x[28]>>>25,Jn=x[28]<<7|x[29]>>>25,de=x[38]<<8|x[39]>>>24,it=x[39]<<8|x[38]>>>24,He=x[48]<<14|x[49]>>>18,En=x[49]<<14|x[48]>>>18,x[0]=Zr^~fe&he,x[1]=Ce^~Er&je,x[10]=qe^~Gt&Ge,x[11]=Ve^~Le&Lr,x[20]=Ke^~De<,x[21]=_n^~ie&ve,x[30]=Pt^~Fe&Qe,x[31]=Re^~Yt&Je,x[40]=Ne^~Ri&tt,x[41]=Ze^~et&Jn,x[2]=fe^~he&en,x[3]=Er^~je&ge,x[12]=Gt^~Ge&Pe,x[13]=Le^~Lr&We,x[22]=De^~lt&de,x[23]=ie^~ve&it,x[32]=Fe^~Qe&Xt,x[33]=Yt^~Je&Ie,x[42]=Ri^~tt&Yn,x[43]=et^~Jn&Xn,x[4]=he^~en&He,x[5]=je^~ge&En,x[14]=Ge^~Pe&An,x[15]=Lr^~We&Be,x[24]=lt^~de&_e,x[25]=ve^~it&Se,x[34]=Qe^~Xt&Ue,x[35]=Je^~Ie&Ar,x[44]=tt^~Yn&Zn,x[45]=Jn^~Xn&ei,x[6]=en^~He&Zr,x[7]=ge^~En&Ce,x[16]=Pe^~An&qe,x[17]=We^~Be&Ve,x[26]=de^~_e&Ke,x[27]=it^~Se&_n,x[36]=Xt^~Ue&Pt,x[37]=Ie^~Ar&Re,x[46]=Yn^~Zn&Ne,x[47]=Xn^~ei&Ze,x[8]=He^~Zr&fe,x[9]=En^~Ce&Er,x[18]=An^~qe&Gt,x[19]=Be^~Ve&Le,x[28]=_e^~Ke&De,x[29]=Se^~_n&ie,x[38]=Ue^~Pt&Fe,x[39]=Ar^~Re&Yt,x[48]=Zn^~Ne&Ri,x[49]=ei^~Ze&et,x[0]^=b[$],x[1]^=b[$+1]};if(a)t.exports=f;else for(E=0;E>=8;return e}function Op(t,e,r){let n=0;for(let i=0;ie+1+n&&sn.throwError("child data too short",O.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function R1(t,e){if(t.length===0&&sn.throwError("data too short",O.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&sn.throwError("data short segment too short",O.errors.BUFFER_OVERRUN,{});const n=Op(t,e+1,r);return e+1+r+n>t.length&&sn.throwError("data long segment too short",O.errors.BUFFER_OVERRUN,{}),Tp(t,e,e+1+r,r+n)}else if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&sn.throwError("data array too short",O.errors.BUFFER_OVERRUN,{}),Tp(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&sn.throwError("data array too short",O.errors.BUFFER_OVERRUN,{});const n=Op(t,e+1,r);e+1+r+n>t.length&&sn.throwError("data array too short",O.errors.BUFFER_OVERRUN,{});const i=ne(t.slice(e+1+r,e+1+r+n));return{consumed:1+r+n,result:i}}else if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&sn.throwError("data too short",O.errors.BUFFER_OVERRUN,{});const n=ne(t.slice(e+1,e+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:ne(t[e])}}function zd(t){const e=oe(t),r=R1(e,0);return r.consumed!==e.length&&sn.throwArgumentError("invalid rlp data","data",t),r.result}const E3="address/5.7.0",di=new O(E3);function jp(t){me(t,20)||di.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=oe(ot(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const A3=9007199254740991;function _3(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const $d={};for(let t=0;t<10;t++)$d[String(t)]=String(t);for(let t=0;t<26;t++)$d[String.fromCharCode(65+t)]=String(10+t);const Lp=Math.floor(_3(A3));function I1(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>$d[n]).join("");for(;e.length>=Lp;){let n=e.substring(0,Lp);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function vt(t){let e=null;if(typeof t!="string"&&di.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=jp(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&di.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==I1(t)&&di.throwArgumentError("bad icap checksum","address",t),e=v3(t.substring(4));e.length<40;)e="0"+e;e=jp("0x"+e)}else di.throwArgumentError("invalid address","address",t);return e}function S3(t){try{return vt(t),!0}catch{}return!1}function k3(t){let e=y3(vt(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+I1("XE00"+e)+e}function Hd(t){let e=null;try{e=vt(t.from)}catch{di.throwArgumentError("missing from address","transaction",t)}const r=qs(oe(W.from(t.nonce).toHexString()));return vt(Ot(ot(Wu([e,r])),12))}function N3(t,e,r){return zn(e)!==32&&di.throwArgumentError("salt must be 32 bytes","salt",e),zn(r)!==32&&di.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),vt(Ot(ot(zt(["0xff",vt(t),e,r])),12))}const M3=Object.freeze(Object.defineProperty({__proto__:null,getAddress:vt,getContractAddress:Hd,getCreate2Address:N3,getIcapAddress:k3,isAddress:S3},Symbol.toStringTag,{value:"Module"})),C3=Ys(M3);var P3={BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Bp=t=>{let e;const r=new Set,n=(l,u)=>{const c=typeof l=="function"?l(e):l;if(!Object.is(c,e)){const h=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,h))}},i=()=>e,a={setState:n,getState:i,subscribe:l=>(r.add(l),()=>r.delete(l)),destroy:()=>{(P3?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,a),a},O1=t=>t?Bp(t):Bp;var T1={exports:{}},j1={},L1={exports:{}},B1={};/** * @license React * use-sync-external-store-shim.production.min.js * @@ -79,7 +79,7 @@ Error generating stack: `+s.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Vs=T;function P3(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var R3=typeof Object.is=="function"?Object.is:P3,I3=Vs.useState,O3=Vs.useEffect,T3=Vs.useLayoutEffect,j3=Vs.useDebugValue;function L3(t,e){var r=e(),n=I3({inst:{value:r,getSnapshot:e}}),i=n[0].inst,s=n[1];return T3(function(){i.value=r,i.getSnapshot=e,Zc(i)&&s({inst:i})},[t,r,e]),O3(function(){return Zc(i)&&s({inst:i}),t(function(){Zc(i)&&s({inst:i})})},[t]),j3(r),r}function Zc(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!R3(t,r)}catch{return!0}}function B3(t,e){return e()}var D3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?B3:L3;L1.useSyncExternalStore=Vs.useSyncExternalStore!==void 0?Vs.useSyncExternalStore:D3;j1.exports=L1;var F3=j1.exports;/** + */var Vs=j;function R3(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var I3=typeof Object.is=="function"?Object.is:R3,O3=Vs.useState,T3=Vs.useEffect,j3=Vs.useLayoutEffect,L3=Vs.useDebugValue;function B3(t,e){var r=e(),n=O3({inst:{value:r,getSnapshot:e}}),i=n[0].inst,s=n[1];return j3(function(){i.value=r,i.getSnapshot=e,Zc(i)&&s({inst:i})},[t,r,e]),T3(function(){return Zc(i)&&s({inst:i}),t(function(){Zc(i)&&s({inst:i})})},[t]),L3(r),r}function Zc(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!I3(t,r)}catch{return!0}}function D3(t,e){return e()}var F3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?D3:B3;B1.useSyncExternalStore=Vs.useSyncExternalStore!==void 0?Vs.useSyncExternalStore:F3;L1.exports=B1;var U3=L1.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * @@ -87,8 +87,8 @@ Error generating stack: `+s.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ku=T,U3=F3;function z3(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var $3=typeof Object.is=="function"?Object.is:z3,H3=U3.useSyncExternalStore,q3=Ku.useRef,V3=Ku.useEffect,G3=Ku.useMemo,W3=Ku.useDebugValue;T1.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var s=q3(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=G3(function(){function l(v){if(!u){if(u=!0,c=v,v=n(v),i!==void 0&&o.hasValue){var y=o.value;if(i(y,v))return h=y}return h=v}if(y=h,$3(c,v))return y;var b=n(v);return i!==void 0&&i(y,b)?y:(c=v,h=b)}var u=!1,c,h,p=r===void 0?null:r;return[function(){return l(e())},p===null?void 0:function(){return l(p())}]},[e,r,n,i]);var a=H3(t,s[0],s[1]);return V3(function(){o.hasValue=!0,o.value=a},[a]),W3(a),a};O1.exports=T1;var K3=O1.exports;const Qu=Si(K3),{useSyncExternalStoreWithSelector:Q3}=Qu;function B1(t,e=t.getState,r){const n=Q3(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return T.useDebugValue(n),n}const Dp=t=>{const e=typeof t=="function"?I1(t):t,r=(n,i)=>B1(e,n,i);return Object.assign(r,e),r},D1=t=>t?Dp(t):Dp;var J3=t=>D1(t);const Y3=Object.freeze(Object.defineProperty({__proto__:null,create:D1,createStore:I1,default:J3,useStore:B1},Symbol.toStringTag,{value:"Module"})),X3=Ys(Y3);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createWeb3ReactStoreAndActions=t.MAX_SAFE_CHAIN_ID=void 0;const e=M3,r=X3;t.MAX_SAFE_CHAIN_ID=0xfffffffffffec;function n(a){if(!Number.isInteger(a)||a<=0||a>t.MAX_SAFE_CHAIN_ID)throw new Error(`Invalid chainId ${a}`)}function i(a){return(0,e.getAddress)(a)}const s={chainId:void 0,accounts:void 0,activating:!1};function o(){const a=(0,r.createStore)()(()=>s);let l=0;function u(){const p=++l;return a.setState(Object.assign(Object.assign({},s),{activating:!0})),()=>{l===p&&a.setState({activating:!1})}}function c(p){if(p.chainId!==void 0&&n(p.chainId),p.accounts!==void 0)for(let v=0;v{var y,b;const k=(y=p.chainId)!==null&&y!==void 0?y:v.chainId,w=(b=p.accounts)!==null&&b!==void 0?b:v.accounts;let m=v.activating;return m&&k&&w&&(m=!1),{chainId:k,accounts:w,activating:m}})}function h(){l++,a.setState(s)}return[a,{startActivation:u,update:c,resetState:h}]}t.createWeb3ReactStoreAndActions=o})(k1);var Z3={BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Fp=t=>{let e;const r=new Set,n=(l,u)=>{const c=typeof l=="function"?l(e):l;if(!Object.is(c,e)){const h=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,h))}},i=()=>e,a={setState:n,getState:i,subscribe:l=>(r.add(l),()=>r.delete(l)),destroy:()=>{(Z3?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,a),a},qd=t=>t?Fp(t):Fp,{useSyncExternalStoreWithSelector:eE}=Qu;function F1(t,e=t.getState,r){const n=eE(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return T.useDebugValue(n),n}const Up=t=>{const e=typeof t=="function"?qd(t):t,r=(n,i)=>F1(e,n,i);return Object.assign(r,e),r},U1=t=>t?Up(t):Up;var tE=t=>U1(t);const rE=Object.freeze(Object.defineProperty({__proto__:null,create:U1,createStore:qd,default:tE,useStore:F1},Symbol.toStringTag,{value:"Module"})),nE=Ys(rE),{useSyncExternalStoreWithSelector:iE}=Qu;function z1(t,e=t.getState,r){const n=iE(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return T.useDebugValue(n),n}const zp=(t,e)=>{const r=qd(t),n=(i,s=e)=>z1(r,i,s);return Object.assign(n,r),n},sE=(t,e)=>t?zp(t,e):zp,oE=Object.freeze(Object.defineProperty({__proto__:null,createWithEqualityFn:sE,useStoreWithEqualityFn:z1},Symbol.toStringTag,{value:"Module"})),aE=Ys(oE),lE="properties/5.7.0";var uE=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const su=new O(lE);function H(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function mr(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function xt(t){return uE(this,void 0,void 0,function*(){const e=Object.keys(t).map(n=>{const i=t[n];return Promise.resolve(i).then(s=>({key:n,value:s}))});return(yield Promise.all(e)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function cE(t,e){(!t||typeof t!="object")&&su.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||su.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function at(t){const e={};for(const r in t)e[r]=t[r];return e}const fE={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function $1(t){if(t==null||fE[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rlr(e)));if(typeof t=="object"){const e={};for(const r in t){const n=t[r];n!==void 0&&H(e,r,lr(n))}return e}return su.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function lr(t){return hE(t)}class Ca{constructor(e){for(const r in e)this[r]=lr(e[r])}}const dE="abstract-provider/5.7.0";var pE=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const mE=new O(dE);class gE extends Ca{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class ro{constructor(){mE.checkAbstract(new.target,ro),H(this,"_isProvider",!0)}getFeeData(){return pE(this,void 0,void 0,function*(){const{block:e,gasPrice:r}=yield xt({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(o=>null)});let n=null,i=null,s=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,s=W.from("1500000000"),i=e.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:n,maxFeePerGas:i,maxPriorityFeePerGas:s,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}}const vE="networks/5.7.1",$p=new O(vE);function yE(t){return t&&typeof t.renetwork=="function"}function Cn(t){const e=function(r,n){n==null&&(n={});const i=[];if(r.InfuraProvider&&n.infura!=="-")try{i.push(new r.InfuraProvider(t,n.infura))}catch{}if(r.EtherscanProvider&&n.etherscan!=="-")try{i.push(new r.EtherscanProvider(t,n.etherscan))}catch{}if(r.AlchemyProvider&&n.alchemy!=="-")try{i.push(new r.AlchemyProvider(t,n.alchemy))}catch{}if(r.PocketProvider&&n.pocket!=="-"){const s=["goerli","ropsten","rinkeby","sepolia"];try{const o=new r.PocketProvider(t,n.pocket);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}}if(r.CloudflareProvider&&n.cloudflare!=="-")try{i.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&n.ankr!=="-")try{const s=["ropsten"],o=new r.AnkrProvider(t,n.ankr);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}if(i.length===0)return null;if(r.FallbackProvider){let s=1;return n.quorum!=null?s=n.quorum:t==="homestead"&&(s=2),new r.FallbackProvider(i,s)}return i[0]};return e.renetwork=function(r){return Cn(r)},e}function ou(t,e){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return r.renetwork=function(n){return ou(t,n)},r}const Hp={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Cn("homestead")},qp={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Cn("ropsten")},Vp={chainId:63,name:"classicMordor",_defaultProvider:ou("https://www.ethercluster.com/mordor","classicMordor")},Za={unspecified:{chainId:0,name:"unspecified"},homestead:Hp,mainnet:Hp,morden:{chainId:2,name:"morden"},ropsten:qp,testnet:qp,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Cn("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Cn("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Cn("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Cn("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:ou("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Vp,classicTestnet:Vp,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:ou("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Cn("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Cn("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Vd(t){if(t==null)return null;if(typeof t=="number"){for(const n in Za){const i=Za[n];if(i.chainId===t)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){const n=Za[t];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const e=Za[t.name];if(!e)return typeof t.chainId!="number"&&$p.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&$p.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(yE(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}function H1(t){t=atob(t);const e=[];for(let r=0;r0;)n.push(o%this.base),o=o/this.base|0}let i="";for(let s=0;r[s]===0&&s=0;--s)i+=this.alphabet[n[s]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let n=0;n>=8;for(;s>0;)r.push(s&255),s>>=8}for(let n=0;e[n]===this._leader&&n>6===2;o++)s++;return s}return t===hr.OVERRUN?r.length-e-1:0}function kE(t,e,r,n,i){return t===hr.OVERLONG?(n.push(i),0):(n.push(65533),K1(t,e,r))}const NE=Object.freeze({error:SE,ignore:K1,replace:kE});function Q1(t,e){e==null&&(e=NE.error),t=oe(t);const r=[];let n=0;for(;n>7)){r.push(i);continue}let s=null,o=null;if((i&224)===192)s=1,o=127;else if((i&240)===224)s=2,o=2047;else if((i&248)===240)s=3,o=65535;else{(i&192)===128?n+=e(hr.UNEXPECTED_CONTINUE,n-1,t,r):n+=e(hr.BAD_PREFIX,n-1,t,r);continue}if(n-1+s>=t.length){n+=e(hr.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){n+=e(hr.OUT_OF_RANGE,n-1-s,t,r,a);continue}if(a>=55296&&a<=57343){n+=e(hr.UTF16_SURROGATE,n-1-s,t,r,a);continue}if(a<=o){n+=e(hr.OVERLONG,n-1-s,t,r,a);continue}r.push(a)}}return r}function yr(t,e=fa.current){e!=fa.current&&(W1.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return oe(r)}function ME(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Pa(t,e){return ME(Q1(t,e))}function CE(t,e=fa.current){return Q1(yr(t,e))}function Es(t){return ot(yr(t))}const J1="hash/5.7.0";function Y1(t,e){e==null&&(e=1);const r=[],n=r.forEach,i=function(s,o){n.call(s,function(a){o>0&&Array.isArray(a)?i(a,o-1):r.push(a)})};return i(t,e),r}function PE(t){const e={};for(let r=0;r>--l&1}const h=31,p=Math.pow(2,h),v=p>>>1,y=v>>1,b=p-1;let k=0;for(let L=0;L1;){let J=D+F>>>1;L>>1|c(),U=U<<1^v,G=(G^v)<<1|v|1;m=U,A=1+G-U}let j=n-4;return w.map(L=>{switch(L-j){case 3:return j+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return j+256+(t[a++]<<8|t[a++]);case 1:return j+t[a++];default:return L-1}})}function IE(t){let e=0;return()=>t[e++]}function OE(t){return IE(RE(t))}function TE(t){return t&1?~t>>1:t>>1}function jE(t,e){let r=Array(t);for(let n=0;ne[o]):r}function BE(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(FE(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(UE(r,t))}return PE(Y1(e))}function DE(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function X1(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[o].push(s));return n}function FE(t,e){let r=1+e(),n=e(),i=DE(e),s=X1(i.length,1+t,e);return Y1(s.map((o,a)=>{const l=o[0],u=o.slice(1);return Array(i[a]).fill(void 0).map((c,h)=>{let p=h*n;return[l+h*r,u.map(v=>v+p)]})}))}function UE(t,e){let r=1+e();return X1(r,1+t,e).map(i=>[i[0],i.slice(1)])}function zE(t){let e=au(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=au(t,e);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,c)=>c.set.size-u.set.size);let i=t(),s=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let a=i==1,l=i==2;return{branches:n,valid:s,fe0f:o,save:a,check:l}}}function $E(){return OE(H1("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Ju=$E(),HE=new Set(au(Ju)),qE=new Set(au(Ju)),VE=BE(Ju),GE=zE(Ju),Wp=45,Kp=95;function Z1(t){return CE(t)}function WE(t){return t.filter(e=>e!=65039)}function ey(t){for(let e of t.split(".")){let r=Z1(e);try{for(let n=r.lastIndexOf(Kp)-1;n>=0;n--)if(r[n]!==Kp)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===Wp&&r[3]===Wp)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${e}": ${n.message}`)}}return t}function KE(t){return ey(QE(t,WE))}function QE(t,e){let r=Z1(t).reverse(),n=[];for(;r.length;){let i=YE(r);if(i){n.push(...e(i));continue}let s=r.pop();if(HE.has(s)){n.push(s);continue}if(qE.has(s))continue;let o=VE[s];if(o){n.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return ey(JE(String.fromCodePoint(...n)))}function JE(t){return t.normalize("NFC")}function YE(t,e){var r;let n=GE,i,s,o=[],a=t.length;for(e&&(e.length=0);a;){let l=t[--a];if(n=(r=n.branches.find(u=>u.set.has(l)))===null||r===void 0?void 0:r.node,!n)break;if(n.save)s=l;else if(n.check&&l===s)break;o.push(l),n.fe0f&&(o.push(65039),a>0&&t[a-1]==65039&&a--),n.valid&&(i=o.slice(),n.valid==2&&i.splice(1,1),e&&e.push(...t.slice(a).reverse()),t.length=a)}return i}const XE=new O(J1),ty=new Uint8Array(32);ty.fill(0);function Qp(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function ry(t){const e=yr(KE(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return r.push(Qp(e.slice(n))),r}function kl(t){typeof t!="string"&&XE.throwArgumentError("invalid ENS name; not a string","name",t);let e=ty;const r=ry(t);for(;r.length;)e=ot(zt([e,ot(r.pop())]));return ne(e)}function ZE(t){return ne(zt(ry(t).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}var eA=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const ct=new O(J1),ny=new Uint8Array(32);ny.fill(0);const tA=W.from(-1),iy=W.from(0),sy=W.from(1),rA=W.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function nA(t){const e=oe(t),r=e.length%32;return r?nr([e,ny.slice(r)]):ne(e)}const iA=gt(sy.toHexString(),32),sA=gt(iy.toHexString(),32),Jp={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},ef=["name","version","chainId","verifyingContract","salt"];function Yp(t){return function(e){return typeof e!="string"&&ct.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const oA={name:Yp("name"),version:Yp("version"),chainId:function(t){try{return W.from(t).toString()}catch{}return ct.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return vt(t).toLowerCase()}catch{}return ct.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=oe(t);if(e.length!==32)throw new Error("bad length");return ne(e)}catch{}return ct.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function tf(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=e[1]==="",n=parseInt(e[2]||"256");(n%8!==0||n>256||e[2]&&e[2]!==String(n))&&ct.throwArgumentError("invalid numeric width","type",t);const i=rA.mask(r?n-1:n),s=r?i.add(sy).mul(tA):iy;return function(o){const a=W.from(o);return(a.lt(s)||a.gt(i))&&ct.throwArgumentError(`value out-of-bounds for ${t}`,"value",o),gt(a.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&&ct.throwArgumentError("invalid bytes width","type",t),function(n){return oe(n).length!==r&&ct.throwArgumentError(`invalid length for ${t}`,"value",n),nA(n)}}}switch(t){case"address":return function(e){return gt(vt(e),32)};case"bool":return function(e){return e?iA:sA};case"bytes":return function(e){return ot(e)};case"string":return function(e){return Es(e)}}return null}function Xp(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}class cr{constructor(e){H(this,"types",Object.freeze(lr(e))),H(this,"_encoderCache",{}),H(this,"_types",{});const r={},n={},i={};Object.keys(e).forEach(a=>{r[a]={},n[a]=[],i[a]={}});for(const a in e){const l={};e[a].forEach(u=>{l[u.name]&&ct.throwArgumentError(`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(a)}`,"types",e),l[u.name]=!0;const c=u.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===a&&ct.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!tf(c)&&(n[c]||ct.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),n[c].push(a),r[a][c]=!0)})}const s=Object.keys(n).filter(a=>n[a].length===0);s.length===0?ct.throwArgumentError("missing primary type","types",e):s.length>1&&ct.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),H(this,"primaryType",s[0]);function o(a,l){l[a]&&ct.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),l[a]=!0,Object.keys(r[a]).forEach(u=>{n[u]&&(o(u,l),Object.keys(l).forEach(c=>{i[c][u]=!0}))}),delete l[a]}o(this.primaryType,{});for(const a in i){const l=Object.keys(i[a]);l.sort(),this._types[a]=Xp(a,e[a])+l.map(u=>Xp(u,e[u])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{const i=tf(e);if(i)return i}const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],s=this.getEncoder(i),o=parseInt(r[3]);return a=>{o>=0&&a.length!==o&&ct.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(ot)),ot(nr(l))}}const n=this.types[e];if(n){const i=Es(this._types[e]);return s=>{const o=n.map(({name:a,type:l})=>{const u=this.getEncoder(l)(s[a]);return this._types[l]?ot(u):u});return o.unshift(i),nr(o)}}return ct.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const r=this._types[e];return r||ct.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return ot(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if(tf(e))return n(e,r);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const o=i[1],a=parseInt(i[3]);return a>=0&&r.length!==a&&ct.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(l=>this._visit(o,l,n))}const s=this.types[e];return s?s.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,r[a],n),o),{}):ct.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new cr(e)}static getPrimaryType(e){return cr.from(e).primaryType}static hashStruct(e,r,n){return cr.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){const i=Jp[n];i||ct.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>ef.indexOf(n.name)-ef.indexOf(i.name)),cr.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return nr(["0x1901",cr.hashDomain(e),cr.from(r).hash(n)])}static hash(e,r,n){return ot(cr.encode(e,r,n))}static resolveNames(e,r,n,i){return eA(this,void 0,void 0,function*(){e=at(e);const s={};e.verifyingContract&&!me(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=cr.from(r);o.visit(n,(a,l)=>(a==="address"&&!me(l,20)&&(s[l]="0x"),l));for(const a in s)s[a]=yield i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),n=o.visit(n,(a,l)=>a==="address"&&s[l]?s[l]:l),{domain:e,value:n}})}static getPayload(e,r,n){cr.hashDomain(e);const i={},s=[];ef.forEach(l=>{const u=e[l];u!=null&&(i[l]=oA[l](u),s.push({name:l,type:Jp[l]}))});const o=cr.from(r),a=at(r);return a.EIP712Domain?ct.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):a.EIP712Domain=s,o.encode(n),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(n,(l,u)=>{if(l.match(/^bytes(\d*)/))return ne(oe(u));if(l.match(/^u?int/))return W.from(u).toString();switch(l){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return typeof u!="string"&&ct.throwArgumentError("invalid string","value",u),u}return ct.throwArgumentError("unsupported type","type",l)})}}}var oy={},xe={},Ra=ay;function ay(t,e){if(!t)throw new Error(e||"Assertion failed")}ay.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var _h={exports:{}};typeof Object.create=="function"?_h.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:_h.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var aA=_h.exports,lA=Ra,uA=aA;xe.inherits=uA;function cA(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function fA(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):cA(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}xe.htonl=ly;function dA(t,e){for(var r="",n=0;n>>0}return s}xe.join32=pA;function mA(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}xe.split32=mA;function gA(t,e){return t>>>e|t<<32-e}xe.rotr32=gA;function vA(t,e){return t<>>32-e}xe.rotl32=vA;function yA(t,e){return t+e>>>0}xe.sum32=yA;function wA(t,e,r){return t+e+r>>>0}xe.sum32_3=wA;function xA(t,e,r,n){return t+e+r+n>>>0}xe.sum32_4=xA;function bA(t,e,r,n,i){return t+e+r+n+i>>>0}xe.sum32_5=bA;function EA(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}xe.sum64=EA;function AA(t,e,r,n){var i=e+n>>>0,s=(i>>0}xe.sum64_hi=AA;function _A(t,e,r,n){var i=e+n;return i>>>0}xe.sum64_lo=_A;function SA(t,e,r,n,i,s,o,a){var l=0,u=e;u=u+n>>>0,l+=u>>0,l+=u>>0,l+=u>>0}xe.sum64_4_hi=SA;function kA(t,e,r,n,i,s,o,a){var l=e+n+s+a;return l>>>0}xe.sum64_4_lo=kA;function NA(t,e,r,n,i,s,o,a,l,u){var c=0,h=e;h=h+n>>>0,c+=h>>0,c+=h>>0,c+=h>>0,c+=h>>0}xe.sum64_5_hi=NA;function MA(t,e,r,n,i,s,o,a,l,u){var c=e+n+s+a+u;return c>>>0}xe.sum64_5_lo=MA;function CA(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}xe.rotr64_hi=CA;function PA(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}xe.rotr64_lo=PA;function RA(t,e,r){return t>>>r}xe.shr64_hi=RA;function IA(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}xe.shr64_lo=IA;var no={},Zp=xe,OA=Ra;function Yu(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}no.BlockHash=Yu;Yu.prototype.update=function(e,r){if(e=Zp.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Zp.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}bn.g0_256=DA;function FA(t){return dn(t,17)^dn(t,19)^t>>>10}bn.g1_256=FA;var Gs=xe,UA=no,zA=bn,rf=Gs.rotl32,go=Gs.sum32,$A=Gs.sum32_5,HA=zA.ft_1,py=UA.BlockHash,qA=[1518500249,1859775393,2400959708,3395469782];function yn(){if(!(this instanceof yn))return new yn;py.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Gs.inherits(yn,py);var VA=yn;yn.blockSize=512;yn.outSize=160;yn.hmacStrength=80;yn.padLength=64;yn.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),I5(e.length<=this.blockSize);for(var r=e.length;r{s[a.toLowerCase()]=o}):n.headers.keys().forEach(o=>{s[o.toLowerCase()]=n.headers.get(o)}),{headers:s,statusCode:n.status,statusMessage:n.statusText,body:oe(new Uint8Array(i))}})}var B5=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const Ur=new O(T5);function im(t){return new Promise(e=>{setTimeout(e,t)})}function ni(t,e){if(t==null)return null;if(typeof t=="string")return t;if(Fd(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return Pa(t)}catch{}return ne(t)}return t}function D5(t){return yr(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function F5(t,e,r){const n=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Ur.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i=typeof t=="object"?t.throttleCallback:null,s=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Ur.assertArgument(s>0&&s%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o=typeof t=="object"?!!t.errorPassThrough:!1,a={};let l=null;const u={method:"GET"};let c=!1,h=2*60*1e3;if(typeof t=="string")l=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Ur.throwArgumentError("missing URL","connection.url",t),l=t.url,typeof t.timeout=="number"&&t.timeout>0&&(h=t.timeout),t.headers)for(const w in t.headers)a[w.toLowerCase()]={key:w,value:String(t.headers[w])},["if-none-match","if-modified-since"].indexOf(w.toLowerCase())>=0&&(c=!0);if(u.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){l.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Ur.throwError("basic authentication requires a secure https url",O.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:t.user,password:"[REDACTED]"});const w=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+q1(yr(w))}}t.skipFetchSetup!=null&&(u.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(u.fetchOptions=at(t.fetchOptions))}const p=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),v=l?l.match(p):null;if(v)try{const w={statusCode:200,statusMessage:"OK",headers:{"content-type":v[1]||"text/plain"},body:v[2]?H1(v[3]):D5(v[3])};let m=w.body;return r&&(m=r(w.body,w)),Promise.resolve(m)}catch(w){Ur.throwError("processing response error",O.errors.SERVER_ERROR,{body:ni(v[1],v[2]),error:w,requestBody:null,requestMethod:"GET",url:l})}e&&(u.method="POST",u.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const y={};Object.keys(a).forEach(w=>{const m=a[w];y[m.key]=m.value}),u.headers=y;const b=function(){let w=null;return{promise:new Promise(function(j,L){h&&(w=setTimeout(()=>{w!=null&&(w=null,L(Ur.makeError("timeout",O.errors.TIMEOUT,{requestBody:ni(u.body,y["content-type"]),requestMethod:u.method,timeout:h,url:l})))},h))}),cancel:function(){w!=null&&(clearTimeout(w),w=null)}}}(),k=function(){return B5(this,void 0,void 0,function*(){for(let w=0;w=300)&&(b.cancel(),Ur.throwError("bad response",O.errors.SERVER_ERROR,{status:m.statusCode,headers:m.headers,body:ni(A,m.headers?m.headers["content-type"]:null),requestBody:ni(u.body,y["content-type"]),requestMethod:u.method,url:l})),r)try{const j=yield r(A,m);return b.cancel(),j}catch(j){if(j.throttleRetry&&w{let a=null;if(s!=null)try{a=JSON.parse(Pa(s))}catch(l){Ur.throwError("invalid JSON",O.errors.SERVER_ERROR,{body:s,error:l})}return r&&(a=r(a,o)),a},i=null;if(e!=null){i=yr(e);const s=typeof t=="string"?{url:t}:at(t);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=at(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},t=s}return F5(t,i,n)}function As(t,e){return e||(e={}),e=at(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,n){let i=null,s=!1;const o=()=>s?!1:(s=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{o()&&n(new Error("timeout"))},e.timeout));const a=e.retryLimit;let l=0;function u(){return t().then(function(c){if(c!==void 0)o()&&r(c);else if(e.oncePoll)e.oncePoll.once("poll",u);else if(e.onceBlock)e.onceBlock.once("block",u);else if(!s){if(l++,l>a){o()&&n(new Error("retry limit reached"));return}let h=e.interval*parseInt(String(Math.random()*Math.pow(2,l)));he.ceiling&&(h=e.ceiling),setTimeout(u,h)}return null},function(c){o()&&n(c)})}u()})}var lu="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Nh={};for(var tl=0;tl>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function Sy(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=js(e)^n>>5}for(e=js(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=Sy(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=js(n)^o,i+=lu.charAt(o)}for(s=0;s<6;++s)n=js(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=lu.charAt(a)}return i}function ky(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var a=Sy(s);if(typeof a=="string")return a;for(var l=[],u=0;u=o.length)&&l.push(h)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:l}}function z5(){var t=ky.apply(null,arguments);if(typeof t=="object")return t}function $5(t){var e=ky.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Xu(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<>8,p=c&255;h?l.push(h,p):l.push(p)}return l}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",l=0;l(p>>1)-1?b=(p>>1)-k:b=k,v.isubn(b)):b=0,h[y]=b,v.iushrn(1)}return h}r.getNAF=n;function i(l,u){var c=[[],[]];l=l.clone(),u=u.clone();for(var h=0,p=0,v;l.cmpn(-h)>0||u.cmpn(-p)>0;){var y=l.andln(3)+h&3,b=u.andln(3)+p&3;y===3&&(y=-1),b===3&&(b=-1);var k;y&1?(v=l.andln(7)+h&7,(v===3||v===5)&&b===2?k=-y:k=y):k=0,c[0].push(k);var w;b&1?(v=u.andln(7)+p&7,(v===3||v===5)&&y===2?w=-b:w=b):w=0,c[1].push(w),2*h===k+1&&(h=1-h),2*p===w+1&&(p=1-p),l.iushrn(1),u.iushrn(1)}return c}r.getJSF=i;function s(l,u,c){var h="_"+u;l.prototype[u]=function(){return this[h]!==void 0?this[h]:this[h]=c.call(this)}}r.cachedProperty=s;function o(l){return typeof l=="string"?r.toArray(l,"hex"):l}r.parseBytes=o;function a(l){return new ue(l,"hex","le")}r.intFromLE=a}),uu=br.getNAF,Q5=br.getJSF,cu=br.assert;function Ci(t,e){this.type=t,this.p=new ue(e.p,16),this.red=e.prime?ue.red(e.prime):ue.mont(this.p),this.zero=new ue(0).toRed(this.red),this.one=new ue(1).toRed(this.red),this.two=new ue(2).toRed(this.red),this.n=e.n&&new ue(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var ts=Ci;Ci.prototype.point=function(){throw new Error("Not implemented")};Ci.prototype.validate=function(){throw new Error("Not implemented")};Ci.prototype._fixedNafMul=function(e,r){cu(e.precomputed);var n=e._getDoubles(),i=uu(r,1,this._bitLength),s=(1<=a;u--)l=(l<<1)+i[u];o.push(l)}for(var c=this.jpoint(null,null,null),h=this.jpoint(null,null,null),p=s;p>0;p--){for(a=0;a=0;l--){for(var u=0;l>=0&&o[l]===0;l--)u++;if(l>=0&&u++,a=a.dblp(u),l<0)break;var c=o[l];cu(c!==0),e.type==="affine"?c>0?a=a.mixedAdd(s[c-1>>1]):a=a.mixedAdd(s[-c-1>>1].neg()):c>0?a=a.add(s[c-1>>1]):a=a.add(s[-c-1>>1].neg())}return e.type==="affine"?a.toP():a};Ci.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,u=0,c,h,p;for(c=0;c=1;c-=2){var y=c-1,b=c;if(o[y]!==1||o[b]!==1){l[y]=uu(n[y],o[y],this._bitLength),l[b]=uu(n[b],o[b],this._bitLength),u=Math.max(l[y].length,u),u=Math.max(l[b].length,u);continue}var k=[r[y],null,null,r[b]];r[y].y.cmp(r[b].y)===0?(k[1]=r[y].add(r[b]),k[2]=r[y].toJ().mixedAdd(r[b].neg())):r[y].y.cmp(r[b].y.redNeg())===0?(k[1]=r[y].toJ().mixedAdd(r[b]),k[2]=r[y].add(r[b].neg())):(k[1]=r[y].toJ().mixedAdd(r[b]),k[2]=r[y].toJ().mixedAdd(r[b].neg()));var w=[-3,-1,-5,-7,0,7,5,1,3],m=Q5(n[y],n[b]);for(u=Math.max(m[0].length,u),l[y]=new Array(u),l[b]=new Array(u),h=0;h=0;c--){for(var F=0;c>=0;){var U=!0;for(h=0;h=0&&F++,L=L.dblp(F),c<0)break;for(h=0;h0?p=a[h][G-1>>1]:G<0&&(p=a[h][-G-1>>1].neg()),p.type==="affine"?L=L.mixedAdd(p):L=L.add(p))}}for(c=0;c=Math.ceil((e.bitLength()+1)/r.step):!1};Tr.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(v=u,y=c),h.negative&&(h=h.neg(),p=p.neg()),v.negative&&(v=v.neg(),y=y.neg()),[{a:h,b:p},{a:v,b:y}]};jr.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),l=o.mul(i.a),u=s.mul(n.b),c=o.mul(i.b),h=e.sub(a).sub(l),p=u.add(c).neg();return{k1:h,k2:p}};jr.prototype.pointFromX=function(e,r){e=new ue(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};jr.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};jr.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Ct.prototype.isInfinity=function(){return this.inf};Ct.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Ct.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Ct.prototype.getX=function(){return this.x.fromRed()};Ct.prototype.getY=function(){return this.y.fromRed()};Ct.prototype.mul=function(e){return e=new ue(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Ct.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Ct.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Ct.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Ct.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Ct.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Lt(t,e,r,n){ts.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ue(0)):(this.x=new ue(e,16),this.y=new ue(r,16),this.z=new ue(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Wd(Lt,ts.BasePoint);jr.prototype.jpoint=function(e,r,n){return new Lt(this,e,r,n)};Lt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Lt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Lt.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),l=i.redSub(s),u=o.redSub(a);if(l.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=l.redSqr(),h=c.redMul(l),p=i.redMul(c),v=u.redSqr().redIAdd(h).redISub(p).redISub(p),y=u.redMul(p.redISub(v)).redISub(o.redMul(h)),b=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(v,y,b)};Lt.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),l=s.redSub(o);if(a.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),h=n.redMul(u),p=l.redSqr().redIAdd(c).redISub(h).redISub(h),v=l.redMul(h.redISub(p)).redISub(s.redMul(c)),y=this.z.redMul(a);return this.curve.jpoint(p,v,y)};Lt.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}};Lt.prototype.inspect=function(){return this.isInfinity()?"":""};Lt.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Nl=oo(function(t,e){var r=e;r.base=ts,r.short=Y5,r.mont=null,r.edwards=null}),Ml=oo(function(t,e){var r=e,n=br.assert;function i(a){a.type==="short"?this.curve=new Nl.short(a):a.type==="edwards"?this.curve=new Nl.edwards(a):this.curve=new Nl.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,l){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var u=new i(l);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:u}),u}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:nn.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:nn.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:nn.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:nn.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:nn.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:nn.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:nn.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:nn.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function _i(t){if(!(this instanceof _i))return new _i(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Gr.toArray(t.entropy,t.entropyEnc||"hex"),r=Gr.toArray(t.nonce,t.nonceEnc||"hex"),n=Gr.toArray(t.pers,t.persEnc||"hex");Gd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var My=_i;_i.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};_i.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Gr.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var X5=br.assert;function Zu(t,e){if(t instanceof Zu)return t;this._importDER(t,e)||(X5(t.r&&t.s,"Signature without r or s"),this.r=new ue(t.r,16),this.s=new ue(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var ec=Zu;function Z5(){this.place=0}function af(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function om(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Zu.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=om(r),n=om(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];lf(i,r.length),i=i.concat(r),i.push(2),lf(i,n.length);var s=i.concat(n),o=[48];return lf(o,s.length),o=o.concat(s),br.encode(o,e)};var e4=function(){throw new Error("unsupported")},Cy=br.assert;function Or(t){if(!(this instanceof Or))return new Or(t);typeof t=="string"&&(Cy(Object.prototype.hasOwnProperty.call(Ml,t),"Unknown curve "+t),t=Ml[t]),t instanceof Ml.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var t4=Or;Or.prototype.keyPair=function(e){return new Kd(this,e)};Or.prototype.keyFromPrivate=function(e,r){return Kd.fromPrivate(this,e,r)};Or.prototype.keyFromPublic=function(e,r){return Kd.fromPublic(this,e,r)};Or.prototype.genKeyPair=function(e){e||(e={});for(var r=new My({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||e4(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ue(2));;){var s=new ue(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};Or.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Or.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new ue(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),l=new My({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new ue(1)),c=0;;c++){var h=i.k?i.k(c):new ue(l.generate(this.n.byteLength()));if(h=this._truncateToN(h,!0),!(h.cmpn(1)<=0||h.cmp(u)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var v=p.getX(),y=v.umod(this.n);if(y.cmpn(0)!==0){var b=h.invm(this.n).mul(y.mul(r.getPrivate()).iadd(e));if(b=b.umod(this.n),b.cmpn(0)!==0){var k=(p.getY().isOdd()?1:0)|(v.cmp(y)!==0?2:0);return i.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),k^=1),new ec({r:y,s:b,recoveryParam:k})}}}}}};Or.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ue(e,16)),n=this.keyFromPublic(n,i),r=new ec(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),l=a.mul(e).umod(this.n),u=a.mul(s).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(l,n.getPublic(),u),c.isInfinity()?!1:c.eqXToP(s)):(c=this.g.mulAdd(l,n.getPublic(),u),c.isInfinity()?!1:c.getX().umod(this.n).cmp(s)===0)};Or.prototype.recoverPubKey=function(t,e,r,n){Cy((3&r)===r,"The recovery param is more than two bits"),e=new ec(e,n);var i=this.n,s=new ue(t),o=e.r,a=e.s,l=r&1,u=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var c=e.r.invm(i),h=i.sub(s).mul(c).umod(i),p=a.mul(c).umod(i);return this.g.mulAdd(h,o,p)};Or.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new ec(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var r4=oo(function(t,e){var r=e;r.version="6.5.4",r.utils=br,r.rand=function(){throw new Error("unsupported")},r.curve=Nl,r.curves=Ml,r.ec=t4,r.eddsa=null}),n4=r4.ec;const i4="signing-key/5.7.0",Ch=new O(i4);let uf=null;function on(){return uf||(uf=new n4("secp256k1")),uf}class s4{constructor(e){H(this,"curve","secp256k1"),H(this,"privateKey",ne(e)),zn(this.privateKey)!==32&&Ch.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=on().keyFromPrivate(oe(this.privateKey));H(this,"publicKey","0x"+r.getPublic(!1,"hex")),H(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),H(this,"_isSigningKey",!0)}_addPoint(e){const r=on().keyFromPublic(oe(this.publicKey)),n=on().keyFromPublic(oe(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=on().keyFromPrivate(oe(this.privateKey)),n=oe(e);n.length!==32&&Ch.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Gu({recoveryParam:i.recoveryParam,r:gt("0x"+i.r.toString(16),32),s:gt("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=on().keyFromPrivate(oe(this.privateKey)),n=on().keyFromPublic(oe(Py(e)));return gt("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function o4(t,e){const r=Gu(e),n={r:oe(r.r),s:oe(r.s)};return"0x"+on().recoverPubKey(oe(t),n,r.recoveryParam).encode("hex",!1)}function Py(t,e){const r=oe(t);if(r.length===32){const n=new s4(r);return e?"0x"+on().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?ne(r):"0x"+on().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+on().keyFromPublic(r).getPublic(!0,"hex"):ne(r)}return Ch.throwArgumentError("invalid public or private key","key","[REDACTED]")}const a4="transactions/5.7.0",Vn=new O(a4);var am;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(am||(am={}));function Qd(t){return t==="0x"?null:vt(t)}function Ut(t){return t==="0x"?G1:W.from(t)}function l4(t){const e=Py(t);return vt(Ot(ot(Ot(e,1)),12))}function Ry(t,e){return l4(o4(oe(t),e))}function dr(t,e){const r=qs(W.from(t).toHexString());return r.length>32&&Vn.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function cf(t,e){return{address:vt(t),storageKeys:(e||[]).map((r,n)=>(zn(r)!==32&&Vn.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,r),r.toLowerCase()))}}function rs(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(r.length>2&&Vn.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${n}]`,r),cf(r[0],r[1])):cf(r.address,r.storageKeys));const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,s)=>(i[s]=!0,i),{});return cf(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function Iy(t){return rs(t).map(e=>[e.address,e.storageKeys])}function u4(t,e){if(t.gasPrice!=null){const n=W.from(t.gasPrice),i=W.from(t.maxFeePerGas||0);n.eq(i)||Vn.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:i})}const r=[dr(t.chainId||0,"chainId"),dr(t.nonce||0,"nonce"),dr(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),dr(t.maxFeePerGas||0,"maxFeePerGas"),dr(t.gasLimit||0,"gasLimit"),t.to!=null?vt(t.to):"0x",dr(t.value||0,"value"),t.data||"0x",Iy(t.accessList||[])];if(e){const n=Gu(e);r.push(dr(n.recoveryParam,"recoveryParam")),r.push(qs(n.r)),r.push(qs(n.s))}return nr(["0x02",Wu(r)])}function c4(t,e){const r=[dr(t.chainId||0,"chainId"),dr(t.nonce||0,"nonce"),dr(t.gasPrice||0,"gasPrice"),dr(t.gasLimit||0,"gasLimit"),t.to!=null?vt(t.to):"0x",dr(t.value||0,"value"),t.data||"0x",Iy(t.accessList||[])];if(e){const n=Gu(e);r.push(dr(n.recoveryParam,"recoveryParam")),r.push(qs(n.r)),r.push(qs(n.s))}return nr(["0x01",Wu(r)])}function Oy(t,e,r){try{const n=Ut(e[0]).toNumber();if(n!==0&&n!==1)throw new Error("bad recid");t.v=n}catch{Vn.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=gt(e[1],32),t.s=gt(e[2],32);try{const n=ot(r(t));t.from=Ry(n,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function f4(t){const e=zd(t.slice(1));e.length!==9&&e.length!==12&&Vn.throwArgumentError("invalid component count for transaction type: 2","payload",ne(t));const r=Ut(e[2]),n=Ut(e[3]),i={type:2,chainId:Ut(e[0]).toNumber(),nonce:Ut(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:Ut(e[4]),to:Qd(e[5]),value:Ut(e[6]),data:e[7],accessList:rs(e[8])};return e.length===9||(i.hash=ot(t),Oy(i,e.slice(9),u4)),i}function h4(t){const e=zd(t.slice(1));e.length!==8&&e.length!==11&&Vn.throwArgumentError("invalid component count for transaction type: 1","payload",ne(t));const r={type:1,chainId:Ut(e[0]).toNumber(),nonce:Ut(e[1]).toNumber(),gasPrice:Ut(e[2]),gasLimit:Ut(e[3]),to:Qd(e[4]),value:Ut(e[5]),data:e[6],accessList:rs(e[7])};return e.length===8||(r.hash=ot(t),Oy(r,e.slice(8),c4)),r}function d4(t){const e=zd(t);e.length!==9&&e.length!==6&&Vn.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:Ut(e[0]).toNumber(),gasPrice:Ut(e[1]),gasLimit:Ut(e[2]),to:Qd(e[3]),value:Ut(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=W.from(e[6]).toNumber()}catch{return r}if(r.r=gt(e[7],32),r.s=gt(e[8],32),W.from(r.r).isZero()&&W.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);r.chainId!==0&&(i.push(ne(r.chainId)),i.push("0x"),i.push("0x"),n-=r.chainId*2+8);const s=ot(Wu(i));try{r.from=Ry(s,{r:ne(r.r),s:ne(r.s),recoveryParam:n})}catch{}r.hash=ot(t)}return r.type=null,r}function p4(t){const e=oe(t);if(e[0]>127)return d4(e);switch(e[0]){case 1:return h4(e);case 2:return f4(e)}return Vn.throwError(`unsupported transaction type: ${e[0]}`,O.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const yo=new O(qt);class Z{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},r=this.address.bind(this),n=this.bigNumber.bind(this),i=this.blockTag.bind(this),s=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),l=this.number.bind(this),u=this.type.bind(this),c=h=>this.data(h,!0);return e.transaction={hash:o,type:u,accessList:Z.allowNull(this.accessList.bind(this),null),blockHash:Z.allowNull(o,null),blockNumber:Z.allowNull(l,null),transactionIndex:Z.allowNull(l,null),confirmations:Z.allowNull(l,null),from:r,gasPrice:Z.allowNull(n),maxPriorityFeePerGas:Z.allowNull(n),maxFeePerGas:Z.allowNull(n),gasLimit:n,to:Z.allowNull(r,null),value:n,nonce:l,data:s,r:Z.allowNull(this.uint256),s:Z.allowNull(this.uint256),v:Z.allowNull(l),creates:Z.allowNull(r,null),raw:Z.allowNull(s)},e.transactionRequest={from:Z.allowNull(r),nonce:Z.allowNull(l),gasLimit:Z.allowNull(n),gasPrice:Z.allowNull(n),maxPriorityFeePerGas:Z.allowNull(n),maxFeePerGas:Z.allowNull(n),to:Z.allowNull(r),value:Z.allowNull(n),data:Z.allowNull(c),type:Z.allowNull(l),accessList:Z.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:l,blockNumber:l,transactionHash:o,address:r,topics:Z.arrayOf(o),data:s,logIndex:l,blockHash:o},e.receipt={to:Z.allowNull(this.address,null),from:Z.allowNull(this.address,null),contractAddress:Z.allowNull(r,null),transactionIndex:l,root:Z.allowNull(a),gasUsed:n,logsBloom:Z.allowNull(s),blockHash:o,transactionHash:o,logs:Z.arrayOf(this.receiptLog.bind(this)),blockNumber:l,confirmations:Z.allowNull(l,null),cumulativeGasUsed:n,effectiveGasPrice:Z.allowNull(n),status:Z.allowNull(l),type:u},e.block={hash:Z.allowNull(o),parentHash:o,number:l,timestamp:l,nonce:Z.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:Z.allowNull(r),extraData:s,transactions:Z.allowNull(Z.arrayOf(o)),baseFeePerGas:Z.allowNull(n)},e.blockWithTransactions=at(e.block),e.blockWithTransactions.transactions=Z.allowNull(Z.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:Z.allowNull(i,void 0),toBlock:Z.allowNull(i,void 0),blockHash:Z.allowNull(o,void 0),address:Z.allowNull(r,void 0),topics:Z.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:Z.allowNull(l),blockHash:Z.allowNull(o),transactionIndex:l,removed:Z.allowNull(this.boolean.bind(this)),address:r,data:Z.allowFalsish(s,"0x"),topics:Z.arrayOf(o),transactionHash:o,logIndex:l},e}accessList(e){return rs(e||[])}number(e){return e==="0x"?0:W.from(e).toNumber()}type(e){return e==="0x"||e==null?0:W.from(e).toNumber()}bigNumber(e){return W.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),me(e))?e.toLowerCase():yo.throwArgumentError("invalid hash","value",e)}data(e,r){const n=this.hex(e,r);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return vt(e)}callAddress(e){if(!me(e,32))return null;const r=vt(Ot(e,12));return r===wE?null:r}contractAddress(e){return Hd(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||me(e))return Vu(e);throw new Error("invalid blockTag")}hash(e,r){const n=this.hex(e,r);return zn(n)!==32?yo.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(e==null)return null;const r=W.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!me(e))throw new Error("invalid uint256");return gt(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);const n=e._difficulty!=null?e._difficulty:e.difficulty,i=Z.check(r,e);return i._difficulty=n==null?null:W.from(n),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return Z.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&W.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const r=Z.check(this.formats.transaction,e);if(e.chainId!=null){let n=e.chainId;me(n)&&(n=W.from(n).toNumber()),r.chainId=n}else{let n=e.networkId;n==null&&r.v==null&&(n=e.chainId),me(n)&&(n=W.from(n).toNumber()),typeof n!="number"&&r.v!=null&&(n=(r.v-35)/2,n<0&&(n=0),n=parseInt(n)),typeof n!="number"&&(n=0),r.chainId=n}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return p4(e)}receiptLog(e){return Z.check(this.formats.receiptLog,e)}receipt(e){const r=Z.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){const n=W.from(r.root).toNumber();n===0||n===1?(r.status!=null&&r.status!==n&&yo.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):yo.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&yo.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return Z.check(this.formats.filter,e)}filterLog(e){return Z.check(this.formats.filterLog,e)}static check(e,r){const n={};for(const i in e)try{const s=e[i](r[i]);s!==void 0&&(n[i]=s)}catch(s){throw s.checkKey=i,s.checkValue=r[i],s}return n}static allowNull(e,r){return function(n){return n==null?r:e(n)}}static allowFalsish(e,r){return function(n){return n?e(n):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");const n=[];return r.forEach(function(i){n.push(e(i))}),n}}}function Ty(t){return t&&typeof t.isCommunityResource=="function"}function Ph(t){return Ty(t)&&t.isCommunityResource()}let lm=!1;function Oa(){lm||(lm=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var le=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const pe=new O(qt),m4=10;function um(t){return t==null?"null":(zn(t)!==32&&pe.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function cm(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){const r={};e.forEach(i=>{r[um(i)]=!0});const n=Object.keys(r);return n.sort(),n.join("|")}else return um(e)}).join("&")}function g4(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];const r=e.split("|").map(n=>n==="null"?null:n);return r.length===1?r[0]:r})}function is(t){if(typeof t=="string"){if(t=t.toLowerCase(),zn(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+cm(t);if(gE.isForkEvent(t))throw pe.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+cm(t.topics||[])}throw new Error("invalid event - "+t)}function wo(){return new Date().getTime()}function fm(t){return new Promise(e=>{setTimeout(e,t)})}const v4=["block","network","pending","poll"];class y4{constructor(e,r,n){H(this,"tag",e),H(this,"listener",r),H(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const r=e[1],n=g4(e[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||v4.indexOf(this.tag)>=0}}const w4={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function ff(t){return gt(W.from(t).toHexString(),32)}function hm(t){return Ah.encode(zt([t,Ot(nm(nm(t)),0,4)]))}const jy=new RegExp("^(ipfs)://(.*)$","i"),dm=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),jy,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Cl(t,e){try{return Pa(ha(t,e))}catch{}return null}function ha(t,e){if(t==="0x")return null;const r=W.from(Ot(t,e,e+32)).toNumber(),n=W.from(Ot(t,r,r+32)).toNumber();return Ot(t,r+32,r+32+n)}function hf(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):pe.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function pm(t){const e=oe(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function x4(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function Ly(t){const e=[];let r=0;for(let n=0;nW.from(e).eq(1)).catch(e=>{if(e.code===O.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return le(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:nr([e,kl(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=nr(["0x9061b923",Ly([ZE(this.name),n.data])]));try{let s=yield this.provider.call(n);return oe(s).length%32===4&&pe.throwError("resolver threw error",O.errors.CALL_EXCEPTION,{transaction:n,data:s}),i&&(s=ha(s,0)),s}catch(s){if(s.code===O.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,r){return le(this,void 0,void 0,function*(){const n=yield this._fetch(e,r);return n!=null?ha(n,0):null})}_getAddress(e,r){const n=w4[String(e)];if(n==null&&pe.throwError(`unsupported coin type: ${e}`,O.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),n.ilk==="eth")return this.provider.formatter.address(r);const i=oe(r);if(n.p2pkh!=null){const s=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return hm(zt([[n.p2pkh],"0x"+s[2]]))}}if(n.p2sh!=null){const s=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return hm(zt([[n.p2sh],"0x"+s[2]]))}}if(n.prefix!=null){const s=i[1];let o=i[0];if(o===0?s!==20&&s!==32&&(o=-1):o=-1,o>=0&&i.length===2+s&&s>=1&&s<=75){const a=sm.toWords(i.slice(2));return a.unshift(o),sm.encode(n.prefix,a)}}return null}getAddress(e){return le(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===AE?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===O.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",ff(e));if(r==null||r==="0x")return null;const n=this._getAddress(e,r);return n==null&&pe.throwError("invalid or unsupported coin data",O.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),n})}getAvatar(){return le(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const r=yield this.getText("avatar");if(r==null)return null;for(let n=0;no[l])}return pe.throwError("invalid or unsupported content hash data",O.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return le(this,void 0,void 0,function*(){let r=yr(e);r=zt([ff(64),ff(r.length),r]),r.length%32!==0&&(r=zt([r,gt("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",ne(r));return n==null||n==="0x"?null:Pa(n)})}}let df=null,b4=1;class tc extends ro{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),H(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{const r=mr(new.target,"getNetwork")(e);r?(H(this,"_network",r),this.emit("network",r,null)):pe.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return le(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||pe.throwError("no network detected",O.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:H(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return As(()=>this._ready().then(e=>e,e=>{if(!(e.code===O.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return df==null&&(df=new Z),df}static getNetwork(e){return Vd(e??"homestead")}ccipReadFetch(e,r,n){return le(this,void 0,void 0,function*(){if(this.disableCcipRead||n.length===0)return null;const i=e.to.toLowerCase(),s=r.toLowerCase(),o=[];for(let a=0;a=0?null:JSON.stringify({data:s,sender:i}),h=yield Ia({url:u,errorPassThrough:!0},c,(v,y)=>(v.status=y.statusCode,v));if(h.data)return h.data;const p=h.message||"unknown error";if(h.status>=400&&h.status<500)return pe.throwError(`response not found during CCIP fetch: ${p}`,O.errors.SERVER_ERROR,{url:l,errorMessage:p});o.push(p)}return pe.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,O.errors.SERVER_ERROR,{urls:n,errorMessages:o})})}_getInternalBlockNumber(e){return le(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const s=yield i;if(wo()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=wo(),n=xt({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:s})=>{if(s)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),s;const o=wo();return i=W.from(i).toNumber(),i{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return le(this,void 0,void 0,function*(){const e=b4++,r=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)pe.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",pe.makeError("network block skew detected",O.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let i=this._emitted.block+1;i<=n;i++)this.emit("block",i);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const s=this._emitted[i];s!=="pending"&&n-s>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=n-1),this._events.forEach(i=>{switch(i.type){case"tx":{const s=i.hash;let o=this.getTransactionReceipt(s).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+s]=a.blockNumber,this.emit(s,a)),null)).catch(a=>{this.emit("error",a)});r.push(o);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=n-1);const s=i.filter;s.fromBlock=i._lastBlockNumber+1,s.toBlock=n;const o=s.toBlock-this._maxFilterBlockRange;o>s.fromBlock&&(s.fromBlock=o),s.fromBlock<0&&(s.fromBlock=0);const a=this.getLogs(s).then(l=>{i._inflight=!1,l.length!==0&&l.forEach(u=>{u.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=u.blockNumber),this._emitted["b:"+u.blockHash]=u.blockNumber,this._emitted["t:"+u.transactionHash]=u.blockNumber,this.emit(s,u)})}).catch(l=>{this.emit("error",l),i._inflight=!1});r.push(a)}break}}}),this._lastBlockNumber=n,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return le(this,void 0,void 0,function*(){return pe.throwError("provider does not support network detection",O.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return le(this,void 0,void 0,function*(){const e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield fm(0),this._network;const n=pe.makeError("underlying network changed",O.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",n),n}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=wo();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,n){return le(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,n||0,null)})}_waitForTransaction(e,r,n,i){return le(this,void 0,void 0,function*(){const s=yield this.getTransactionReceipt(e);return(s?s.confirmations:0)>=r?s:new Promise((o,a)=>{const l=[];let u=!1;const c=function(){return u?!0:(u=!0,l.forEach(p=>{p()}),!1)},h=p=>{p.confirmations{this.removeListener(e,h)}),i){let p=i.startBlock,v=null;const y=b=>le(this,void 0,void 0,function*(){u||(yield fm(1e3),this.getTransactionCount(i.from).then(k=>le(this,void 0,void 0,function*(){if(!u){if(k<=i.nonce)p=b;else{{const w=yield this.getTransaction(e);if(w&&w.blockNumber!=null)return}for(v==null&&(v=p-3,v{u||this.once("block",y)}))});if(u)return;this.once("block",y),l.push(()=>{this.removeListener("block",y)})}if(typeof n=="number"&&n>0){const p=setTimeout(()=>{c()||a(pe.makeError("timeout exceeded",O.errors.TIMEOUT,{timeout:n}))},n);p.unref&&p.unref(),l.push(()=>{clearTimeout(p)})}})})}getBlockNumber(){return le(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return le(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return W.from(e)}catch(r){return pe.throwError("bad result from backend",O.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return le(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield xt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getBalance",n);try{return W.from(i)}catch(s){return pe.throwError("bad result from backend",O.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:s})}})}getTransactionCount(e,r){return le(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield xt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getTransactionCount",n);try{return W.from(i).toNumber()}catch(s){return pe.throwError("bad result from backend",O.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:s})}})}getCode(e,r){return le(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield xt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getCode",n);try{return ne(i)}catch(s){return pe.throwError("bad result from backend",O.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:s})}})}getStorageAt(e,r,n){return le(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield xt({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(r).then(o=>Vu(o))}),s=yield this.perform("getStorageAt",i);try{return ne(s)}catch(o){return pe.throwError("bad result from backend",O.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,r,n){if(r!=null&&zn(r)!==32)throw new Error("invalid response - sendTransaction");const i=e;return r!=null&&e.hash!==r&&pe.throwError("Transaction hash mismatch from Provider.sendTransaction.",O.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),i.wait=(s,o)=>le(this,void 0,void 0,function*(){s==null&&(s=1),o==null&&(o=0);let a;s!==0&&n!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const l=yield this._waitForTransaction(e.hash,s,o,a);return l==null&&s===0?null:(this._emitted["t:"+e.hash]=l.blockNumber,l.status===0&&pe.throwError("transaction failed",O.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return le(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Promise.resolve(e).then(s=>ne(s)),n=this.formatter.transaction(e);n.confirmations==null&&(n.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const s=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(n,s,i)}catch(s){throw s.transaction=n,s.transactionHash=n.hash,s}})}_getTransactionRequest(e){return le(this,void 0,void 0,function*(){const r=yield e,n={};return["from","to"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s?this._getAddress(s):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s?W.from(s):null))}),["type"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s??null))}),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s?ne(s):null))}),this.formatter.transactionRequest(yield xt(n))})}_getFilter(e){return le(this,void 0,void 0,function*(){e=yield e;const r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(n=>{e[n]!=null&&(r[n]=e[n])}),["fromBlock","toBlock"].forEach(n=>{e[n]!=null&&(r[n]=this._getBlockTag(e[n]))}),this.formatter.filter(yield xt(r))})}_call(e,r,n){return le(this,void 0,void 0,function*(){n>=m4&&pe.throwError("CCIP read exceeded maximum redirections",O.errors.SERVER_ERROR,{redirects:n,transaction:e});const i=e.to,s=yield this.perform("call",{transaction:e,blockTag:r});if(n>=0&&r==="latest"&&i!=null&&s.substring(0,10)==="0x556f1830"&&zn(s)%32===4)try{const o=Ot(s,4),a=Ot(o,0,32);W.from(a).eq(i)||pe.throwError("CCIP Read sender did not match",O.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],u=W.from(Ot(o,32,64)).toNumber(),c=W.from(Ot(o,u,u+32)).toNumber(),h=Ot(o,u+32);for(let w=0;wle(this,void 0,void 0,function*(){const s=yield this.perform("getBlock",i);if(s==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&n>this._emitted.block?null:void 0;if(r){let o=null;for(let l=0;lthis._wrapTransaction(l)),a}return this.formatter.block(s)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return le(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return As(()=>le(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return le(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return As(()=>le(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;if(n.blockHash==null)return;const i=this.formatter.receipt(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return i}),{oncePoll:this})})}getLogs(e){return le(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield xt({filter:this._getFilter(e)}),n=yield this.perform("getLogs",r);return n.forEach(i=>{i.removed==null&&(i.removed=!1)}),Z.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return le(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return le(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&pe.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return le(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const n=yield this._getResolver(r,"getResolver");if(n!=null){const i=new Rh(this,n,e);return r!==e&&!(yield i.supportsWildcard())?null:i}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return le(this,void 0,void 0,function*(){r==null&&(r="ENS");const n=yield this.getNetwork();n.ensAddress||pe.throwError("network does not support ENS",O.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+kl(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return le(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if(me(e))throw n}typeof e!="string"&&pe.throwArgumentError("invalid ENS name","name",e);const r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return le(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const r=e.substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"lookupAddress");if(n==null)return null;const i=Cl(yield this.call({to:n,data:"0x691f3431"+kl(r).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return le(this,void 0,void 0,function*(){let r=null;if(me(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;r=new Rh(this,o,s);try{const a=yield r.getAvatar();if(a)return a.url}catch(a){if(a.code!==O.errors.CALL_EXCEPTION)throw a}try{const a=Cl(yield this.call({to:o,data:"0x691f3431"+kl(s).substring(2)}),0);r=yield this.getResolver(a)}catch(a){if(a.code!==O.errors.CALL_EXCEPTION)throw a;return null}}else if(r=yield this.getResolver(e),!r)return null;const n=yield r.getAvatar();return n==null?null:n.url})}perform(e,r){return pe.throwError(e+" not implemented",O.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,n){const i=new y4(is(e),r,n);return this._events.push(i),this._startEvent(i),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let n=!1,i=[],s=is(e);return this._events=this._events.filter(o=>o.tag!==s?!0:(setTimeout(()=>{o.listener.apply(this,r)},0),n=!0,o.once?(i.push(o),!1):!0)),i.forEach(o=>{this._stopEvent(o)}),n}listenerCount(e){if(!e)return this._events.length;let r=is(e);return this._events.filter(n=>n.tag===r).length}listeners(e){if(e==null)return this._events.map(n=>n.listener);let r=is(e);return this._events.filter(n=>n.tag===r).map(n=>n.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);const n=[];let i=!1,s=is(e);return this._events=this._events.filter(o=>o.tag!==s||o.listener!=r||i?!0:(i=!0,n.push(o),!1)),n.forEach(o=>{this._stopEvent(o)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{const n=is(e);this._events=this._events.filter(i=>i.tag!==n?!0:(r.push(i),!1))}return r.forEach(n=>{this._stopEvent(n)}),this}}const E4="abstract-signer/5.7.0";var Fr=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const Sr=new O(E4),A4=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],_4=[O.errors.INSUFFICIENT_FUNDS,O.errors.NONCE_EXPIRED,O.errors.REPLACEMENT_UNDERPRICED];class Ta{constructor(){Sr.checkAbstract(new.target,Ta),H(this,"_isSigner",!0)}getBalance(e){return Fr(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Fr(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Fr(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const r=yield xt(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Fr(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield xt(this.checkTransaction(e));return yield this.provider.call(n,r)})}sendTransaction(e){return Fr(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(e),n=yield this.signTransaction(r);return yield this.provider.sendTransaction(n)})}getChainId(){return Fr(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Fr(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Fr(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Fr(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const n in e)A4.indexOf(n)===-1&&Sr.throwArgumentError("invalid transaction key: "+n,"transaction",e);const r=at(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(n=>(n[0].toLowerCase()!==n[1].toLowerCase()&&Sr.throwArgumentError("from address mismatch","transaction",e),n[0])),r}populateTransaction(e){return Fr(this,void 0,void 0,function*(){const r=yield xt(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Fr(this,void 0,void 0,function*(){if(i==null)return null;const s=yield this.resolveName(i);return s==null&&Sr.throwArgumentError("provided ENS name resolves to null","tx.to",i),s})),r.to.catch(i=>{}));const n=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||n)?Sr.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&n&&Sr.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const s=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=s,r.maxPriorityFeePerGas=s}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(n&&Sr.throwError("network does not support EIP-1559",O.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):Sr.throwError("failed to get consistent fee data",O.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(_4.indexOf(i.code)>=0)throw i;return Sr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",O.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Sr.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield xt(r)})}_checkProvider(e){this.provider||Sr.throwError("missing provider",O.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class Jd extends Ta{constructor(e,r){super(),H(this,"address",e),H(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{Sr.throwError(e,O.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Jd(this.address,e)}}var Nn=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const bt=new O(qt),S4=["call","estimateGas"];function Do(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){const r=me(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(const r in t){const n=Do(t[r],e);if(n)return n}return null}if(typeof t=="string")try{return Do(JSON.parse(t),e)}catch{}return null}function By(t,e,r){const n=r.transaction||r.signedTransaction;if(t==="call"){const s=Do(e,!0);if(s)return s.data;bt.throwError("missing revert data in call exception; Transaction reverted without a reason string",O.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if(t==="estimateGas"){let s=Do(e.body,!1);s==null&&(s=Do(e,!1)),s&&bt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",O.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===O.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&bt.throwError("insufficient funds for intrinsic transaction cost",O.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&bt.throwError("nonce has already been used",O.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&bt.throwError("replacement fee too low",O.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&bt.throwError("legacy pre-eip-155 transactions not supported",O.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),S4.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&bt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",O.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function mm(t){return new Promise(function(e){setTimeout(e,t)})}function k4(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function xo(t){return t&&t.toLowerCase()}const Ih={};class Yd extends Ta{constructor(e,r,n){if(super(),e!==Ih)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");H(this,"provider",r),n==null&&(n=0),typeof n=="string"?(H(this,"_address",this.provider.formatter.address(n)),H(this,"_index",null)):typeof n=="number"?(H(this,"_index",n),H(this,"_address",null)):bt.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return bt.throwError("cannot alter JSON-RPC Signer connection",O.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new N4(Ih,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&bt.throwError("unknown account #"+this._index,O.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=at(e);const r=this.getAddress().then(n=>(n&&(n=n.toLowerCase()),n));if(e.gasLimit==null){const n=at(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(n=>Nn(this,void 0,void 0,function*(){if(n==null)return null;const i=yield this.provider.resolveName(n);return i==null&&bt.throwArgumentError("provided ENS name resolves to null","tx.to",n),i}))),xt({tx:xt(e),sender:r}).then(({tx:n,sender:i})=>{n.from!=null?n.from.toLowerCase()!==i&&bt.throwArgumentError("from address mismatch","transaction",e):n.from=i;const s=this.provider.constructor.hexlifyTransaction(n,{from:!0});return this.provider.send("eth_sendTransaction",[s]).then(o=>o,o=>(typeof o.message=="string"&&o.message.match(/user denied/i)&&bt.throwError("user rejected transaction",O.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),By("sendTransaction",o,s)))})}signTransaction(e){return bt.throwError("signing transactions is unsupported",O.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Nn(this,void 0,void 0,function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield As(()=>Nn(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(n);if(i!==null)return this.provider._wrapTransaction(i,n,r)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=n,i}})}signMessage(e){return Nn(this,void 0,void 0,function*(){const r=typeof e=="string"?yr(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[ne(r),n.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&bt.throwError("user rejected signing",O.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),i}})}_legacySignMessage(e){return Nn(this,void 0,void 0,function*(){const r=typeof e=="string"?yr(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),ne(r)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&bt.throwError("user rejected signing",O.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),i}})}_signTypedData(e,r,n){return Nn(this,void 0,void 0,function*(){const i=yield cr.resolveNames(e,r,n,o=>this.provider.resolveName(o)),s=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[s.toLowerCase(),JSON.stringify(cr.getPayload(i.domain,r,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&bt.throwError("user rejected signing",O.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:r,value:i.value}}),o}})}unlock(e){return Nn(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class N4 extends Yd{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:n=>this.provider.waitForTransaction(r,n)}))}}const M4={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Qi extends tc{constructor(e,r){let n=r;n==null&&(n=new Promise((i,s)=>{setTimeout(()=>{this.detectNetwork().then(o=>{i(o)},o=>{s(o)})},0)})),super(n),e||(e=mr(this.constructor,"defaultUrl")()),typeof e=="string"?H(this,"connection",Object.freeze({url:e})):H(this,"connection",Object.freeze(at(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Nn(this,void 0,void 0,function*(){yield mm(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const r=mr(this.constructor,"getNetwork");try{return r(W.from(e).toNumber())}catch(n){return bt.throwError("could not detect network",O.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:n})}}return bt.throwError("could not detect network",O.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new Yd(Ih,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:lr(n),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=Ia(this.connection,JSON.stringify(n),k4).then(o=>(this.emit("debug",{action:"response",request:n,response:o,provider:this}),o),o=>{throw this.emit("debug",{action:"response",error:o,request:n,provider:this}),o});return i&&(this._cache[e]=s,setTimeout(()=>{this._cache[e]=null},0)),s}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[xo(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[xo(r.address),r.blockTag]];case"getCode":return["eth_getCode",[xo(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[xo(r.address),gt(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[mr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[mr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=xo(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(e,r){return Nn(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=r.transaction;if(i&&i.type!=null&&W.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=yield this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(r=at(r),r.transaction=at(i),delete r.transaction.type)}}const n=this.prepareRequest(e,r);n==null&&bt.throwError(e+" not implemented",O.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(i){return By(e,i,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(n){function i(){e.send("eth_getFilterChanges",[n]).then(function(s){if(e._pendingFilter!=r)return null;let o=Promise.resolve();return s.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",o=o.then(function(){return e.getTransaction(a).then(function(l){return e.emit("pending",l),null})})}),o.then(function(){return mm(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[n]);return}return setTimeout(function(){i()},0),null}).catch(s=>{})}return i(),n}).catch(n=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){const n=at(M4);if(r)for(const s in r)r[s]&&(n[s]=!0);cE(e,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=Vu(W.from(e[s]));s==="gasLimit"&&(s="gas"),i[s]=o}),["from","to","data"].forEach(function(s){e[s]!=null&&(i[s]=ne(e[s]))}),e.accessList&&(i.accessList=rs(e.accessList)),i}}let Fo=null;try{if(Fo=WebSocket,Fo==null)throw new Error("inject please")}catch{const e=new O(qt);Fo=function(){e.throwError("WebSockets not supported in this environment",O.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var pf=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const rl=new O(qt);let C4=1;class rc extends Qi{constructor(e,r){r==="any"&&rl.throwError("WebSocketProvider does not support 'any' network yet",O.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?H(this,"_websocket",new Fo(this.connection.url)):H(this,"_websocket",e),H(this,"_requests",{}),H(this,"_subs",{}),H(this,"_subIds",{}),H(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const s=i.data,o=JSON.parse(s);if(o.id!=null){const a=String(o.id),l=this._requests[a];if(delete this._requests[a],o.result!==void 0)l.callback(null,o.result),this.emit("debug",{action:"response",request:JSON.parse(l.payload),response:o.result,provider:this});else{let u=null;o.error?(u=new Error(o.error.message||"unknown error"),H(u,"code",o.error.code||null),H(u,"response",s)):u=new Error("unknown error"),l.callback(u,void 0),this.emit("debug",{action:"response",error:u,request:JSON.parse(l.payload),provider:this})}}else if(o.method==="eth_subscription"){const a=this._subs[o.params.subscription];a&&a.processFunc(o.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){rl.throwError("cannot reset events block on WebSocketProvider",O.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){rl.throwError("cannot set polling interval on WebSocketProvider",O.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return pf(this,void 0,void 0,function*(){return null})}set polling(e){e&&rl.throwError("cannot set polling on WebSocketProvider",O.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){const n=C4++;return new Promise((i,s)=>{function o(l,u){return l?s(l):i(u)}const a=JSON.stringify({method:e,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(n)]={callback:o,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,n){return pf(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(r).then(o=>this.send("eth_subscribe",o)),this._subIds[e]=i);const s=yield i;this._subs[s]={tag:e,processFunc:n}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=W.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const i=n.hash;this.getTransactionReceipt(i).then(s=>{s&&this.emit(i,s)})};r(e),this._subscribe("tx",["newHeads"],n=>{this._events.filter(i=>i.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return pf(this,void 0,void 0,function*(){this.websocket.readyState===Fo.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var P4=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const No=new O(qt);class Dy extends Qi{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return P4(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||No.throwError("no network detected",O.errors.UNKNOWN_ERROR,{}),this._network==null&&(H(this,"_network",r),this.emit("network",r,null))),r})}}class Gn extends Dy{constructor(e,r){No.checkAbstract(new.target,Gn),e=mr(new.target,"getNetwork")(e),r=mr(new.target,"getApiKey")(r);const n=mr(new.target,"getUrl")(e,r);super(n,e),typeof r=="string"?H(this,"apiKey",r):r!=null&&Object.keys(r).forEach(i=>{H(this,i,r[i])})}_startPending(){No.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return No.throwError("API provider does not support signing",O.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return No.throwError("not implemented; sub-classes must override getUrl",O.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const gm=new O(qt),Pl="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class Fy extends rc{constructor(e,r){const n=new Xd(e,r),i=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,n.network),H(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===Pl}}class Xd extends Gn{static getWebSocketProvider(e,r){return new Fy(e,r)}static getApiKey(e){return e==null?Pl:(e&&typeof e!="string"&&gm.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;default:gm.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(i,s)=>(r===Pl&&Oa(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Pl}}const R4=new O(qt),nl="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function I4(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return R4.throwArgumentError("unsupported network","name",t)}class Uy extends Gn{isCommunityResource(){return this.apiKey===nl}static getApiKey(e){return e??nl}static getUrl(e,r){r==null&&(r=nl);const n={allowGzip:!0,url:"https://"+I4(e.name)+r,throttleCallback:(i,s)=>(r.apiKey===nl&&Oa(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var O4=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const vm=new O(qt);class zy extends Gn{static getApiKey(e){return e!=null&&vm.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="https://cloudflare-eth.com/";break;default:vm.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return O4(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,e,r)})}}var il=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const li=new O(qt);function ym(t){const e={};for(let r in t){if(t[r]==null)continue;let n=t[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=Vu(ne(n)):r==="accessList"?n="["+rs(n).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":n=ne(n),e[r]=n)}return e}function T4(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function wm(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function xm(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function mf(t,e,r){if(t==="call"&&e.code===O.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let s=i.data;if(s&&(s="0x"+s.replace(/^.*0x/i,"")),me(s))return s;li.throwError("missing revert data in call exception",O.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===O.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&li.throwError("insufficient funds for intrinsic transaction cost",O.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&li.throwError("nonce has already been used",O.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&li.throwError("replacement fee too low",O.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&li.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",O.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class $y extends tc{constructor(e,r){super(e),H(this,"baseUrl",this.getBaseUrl()),H(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return li.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){const n=Object.keys(r).reduce((s,o)=>{const a=r[o];return a!=null&&(s+=`&${o}=${a}`),s},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${n}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,n){return il(this,void 0,void 0,function*(){const i=n?this.getPostUrl():this.getUrl(e,r),s=n?this.getPostData(e,r):null,o=e==="proxy"?wm:T4;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(c,h)=>(this.isCommunityResource()&&Oa(),Promise.resolve(!0))};let l=null;s&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},l=Object.keys(s).map(c=>`${c}=${s[c]}`).join("&"));const u=yield Ia(a,l,o||wm);return this.emit("debug",{action:"response",request:i,response:lr(u),provider:this}),u})}detectNetwork(){return il(this,void 0,void 0,function*(){return this.network})}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return il(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(i=>mf("sendTransaction",i,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=ym(r.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return mf("call",s,r.transaction)}}case"estimateGas":{const i=ym(r.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return mf("estimateGas",s,r.transaction)}}case"getLogs":{const i={action:"getLogs"};if(r.filter.fromBlock&&(i.fromBlock=xm(r.filter.fromBlock)),r.filter.toBlock&&(i.toBlock=xm(r.filter.toBlock)),r.filter.address&&(i.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&li.throwError("unsupported topic count",O.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const a=r.filter.topics[0];(typeof a!="string"||a.length!==66)&&li.throwError("unsupported topic format",O.errors.UNSUPPORTED_OPERATION,{topic0:a}),i.topic0=a}const s=yield this.fetch("logs",i);let o={};for(let a=0;a{["contractAddress","to"].forEach(function(l){o[l]==""&&delete o[l]}),o.creates==null&&o.contractAddress!=null&&(o.creates=o.contractAddress);const a=this.formatter.transactionResponse(o);return o.timeStamp&&(a.timestamp=parseInt(o.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}}function j4(t){t=t.slice();for(let e=t.length-1;e>0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}var fu=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const Ti=new O(qt);function sl(){return new Date().getTime()}function bm(t){let e=null;for(let r=0;re?null:(n+i)/2}function _s(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(W.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>_s(e)));if(typeof t=="object"){const e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let n=t[r];return typeof n=="function"?n="[function]":n=_s(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let L4=1;function Am(t){let e=null,r=null,n=new Promise(o=>{e=function(){r&&(clearTimeout(r),r=null),o()},r=setTimeout(e,t)});const i=o=>(n=n.then(o),n);function s(){return n}return{cancel:e,getPromise:s,wait:i}}const B4=[O.errors.CALL_EXCEPTION,O.errors.INSUFFICIENT_FUNDS,O.errors.NONCE_EXPIRED,O.errors.REPLACEMENT_UNDERPRICED,O.errors.UNPREDICTABLE_GAS_LIMIT],D4=["address","args","errorArgs","errorSignature","method","transaction"];function ol(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function F4(t,e){return function(r){const n={};r.forEach(s=>{const o=t(s.result);n[o]||(n[o]={count:0,result:s.result}),n[o].count++});const i=Object.keys(n);for(let s=0;s=e)return o.result}}}function U4(t,e,r){let n=_s;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=Em(i.map(a=>a.result),2);if(o!=null)return o=Math.ceil(o),s.indexOf(o+1)>=0&&o++,o>=t._highestBlockNumber&&(t._highestBlockNumber=o),t._highestBlockNumber};case"getGasPrice":return function(i){const s=i.map(o=>o.result);return s.sort(),s[Math.floor(s.length/2)]};case"getEtherPrice":return function(i){return Em(i.map(s=>s.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(i){return i==null?null:(i=at(i),i.confirmations=-1,_s(i))};break;case"getBlock":r.includeTransactions?n=function(i){return i==null?null:(i=at(i),i.transactions=i.transactions.map(s=>(s=at(s),s.confirmations=-1,s)),_s(i))}:n=function(i){return i==null?null:_s(i)};break;default:throw new Error("unknown method: "+e)}return F4(n,t.quorum)}function bo(t,e){return fu(this,void 0,void 0,function*(){const r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:As(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function z4(t,e,r,n){return fu(this,void 0,void 0,function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&me(n.blockTag)&&(i=yield bo(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&me(n.blockTag)&&(i=yield bo(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&me(n.blockTag)&&(i=yield bo(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&me(n.blockTag)&&(i=yield bo(t,e)),r==="call"&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let s=n.filter;return(s.fromBlock&&me(s.fromBlock)||s.toBlock&&me(s.toBlock))&&(i=yield bo(t,e)),i.getLogs(s)}}return Ti.throwError("unknown method error",O.errors.UNKNOWN_ERROR,{method:r,params:n})})}class Hy extends tc{constructor(e,r){e.length===0&&Ti.throwArgumentError("missing providers","providers",e);const n=e.map((o,a)=>{if(ro.isProvider(o)){const c=Ph(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:c,priority:1})}const l=at(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=Ph(o)?2e3:750),l.weight==null&&(l.weight=1);const u=l.weight;return(u%1||u>512||u<1)&&Ti.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,u),Object.freeze(l)}),i=n.reduce((o,a)=>o+a.weight,0);r==null?r=i/2:r>i&&Ti.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let s=bm(n.map(o=>o.provider.network));s==null&&(s=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(s),H(this,"providerConfigs",Object.freeze(n)),H(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return fu(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return bm(e)})}perform(e,r){return fu(this,void 0,void 0,function*(){if(e==="sendTransaction"){const l=yield Promise.all(this.providerConfigs.map(u=>u.provider.sendTransaction(r.signedTransaction).then(c=>c.hash,c=>c)));for(let u=0;ul.priority-u.priority);const s=this._highestBlockNumber;let o=0,a=!0;for(;;){const l=sl();let u=i.filter(v=>v.runner&&l-v.startv+y.weight,0);for(;u{v.staller=null}),v.runner=z4(v,s,e,r).then(b=>{v.done=!0,v.result=b,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:y,backend:ol(v,sl()),request:{method:e,params:lr(r)},provider:this})},b=>{v.done=!0,v.error=b,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:y,backend:ol(v,sl()),request:{method:e,params:lr(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:y,backend:ol(v,null),request:{method:e,params:lr(r)},provider:this}),u+=v.weight}const c=[];i.forEach(v=>{v.done||!v.runner||(c.push(v.runner),v.staller&&c.push(v.staller.getPromise()))}),c.length&&(yield Promise.race(c));const h=i.filter(v=>v.done&&v.error==null);if(h.length>=this.quorum){const v=n(h);if(v!==void 0)return i.forEach(y=>{y.staller&&y.staller.cancel(),y.cancelled=!0}),v;a||(yield Am(100).getPromise()),a=!1}const p=i.reduce((v,y)=>{if(!y.done||y.error==null)return v;const b=y.error.code;return B4.indexOf(b)>=0&&(v[b]||(v[b]={error:y.error,weight:0}),v[b].weight+=y.weight),v},{});if(Object.keys(p).forEach(v=>{const y=p[v];if(y.weight{w.staller&&w.staller.cancel(),w.cancelled=!0});const b=y.error,k={};D4.forEach(w=>{b[w]!=null&&(k[w]=b[w])}),Ti.throwError(b.reason||b.message,v,k)}),i.filter(v=>!v.done).length===0)break}return i.forEach(l=>{l.staller&&l.staller.cancel(),l.cancelled=!0}),Ti.throwError("failed to meet quorum",O.errors.SERVER_ERROR,{method:e,params:r,results:i.map(l=>ol(l)),provider:this})})}}const qy=null,Rl=new O(qt),Mo="84842078b09946638c03157f83405213";class Vy extends rc{constructor(e,r){const n=new Zd(e,r),i=n.connection;i.password&&Rl.throwError("INFURA WebSocket project secrets unsupported",O.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const s=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(s,e),H(this,"apiKey",n.projectId),H(this,"projectId",n.projectId),H(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===Mo}}class Zd extends Gn{static getWebSocketProvider(e,r){return new Vy(e,r)}static getApiKey(e){const r={apiKey:Mo,projectId:Mo,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(Rl.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),Rl.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;default:Rl.throwError("unsupported network",O.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(s,o)=>(r.projectId===Mo&&Oa(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}isCommunityResource(){return this.projectId===Mo}}class $4 extends Qi{send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const i={request:n,resolve:null,reject:null},s=new Promise((o,a)=>{i.resolve=o,i.reject=a});return this._pendingBatch.push(i),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const o=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const a=o.map(l=>l.request);return this.emit("debug",{action:"requestBatch",request:lr(a),provider:this}),Ia(this.connection,JSON.stringify(a)).then(l=>{this.emit("debug",{action:"response",request:a,response:l,provider:this}),o.forEach((u,c)=>{const h=l[c];if(h.error){const p=new Error(h.error.message);p.code=h.error.code,p.data=h.error.data,u.reject(p)}else u.resolve(h.result)})},l=>{this.emit("debug",{action:"response",error:l,request:a,provider:this}),o.forEach(u=>{u.reject(l)})})},10)),s}}const gf=new O(qt),H4="ETHERS_JS_SHARED";class Gy extends Gn{static getApiKey(e){return e&&typeof e!="string"&&gf.throwArgumentError("invalid apiKey","apiKey",e),e||H4}static getUrl(e,r){gf.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(e.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:gf.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const _m=new O(qt),Sm="62e1ad51b37b8e00394bda3b";class Wy extends Gn{static getApiKey(e){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=Sm:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:_m.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:_m.throwError("unsupported network",O.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${n}/v1/lb/${r.applicationId}`,s={headers:{},url:i};return r.applicationSecretKey!=null&&(s.user="",s.password=r.applicationSecretKey),s}isCommunityResource(){return this.applicationId===Sm}}const km=new O(qt);let q4=1;function Nm(t,e){const r="Web3LegacyFetcher";return function(n,i){const s={method:n,params:i,id:q4++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:r,request:lr(s),provider:this}),e(s,(l,u)=>{if(l)return this.emit("debug",{action:"response",fetcher:r,error:l,request:s,provider:this}),a(l);if(this.emit("debug",{action:"response",fetcher:r,request:s,response:u,provider:this}),u.error){const c=new Error(u.error.message);return c.code=u.error.code,c.data=u.error.data,a(c)}o(u.result)})})}}function V4(t){return function(e,r){r==null&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:lr(n),provider:this}),t.request(n).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:i,provider:this}),i})}}class Ky extends Qi{constructor(e,r){e==null&&km.throwArgumentError("missing provider","provider",e);let n=null,i=null,s=null;typeof e=="function"?(n="unknown:",i=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),s=e,e.request?(n===""&&(n="eip-1193:"),i=V4(e)):e.sendAsync?i=Nm(e,e.sendAsync.bind(e)):e.send?i=Nm(e,e.send.bind(e)):km.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,r),H(this,"jsonRpcFetchFunc",i),H(this,"provider",s)}send(e,r){return this.jsonRpcFetchFunc(e,r)}}const Mm=new O(qt);function G4(t,e){if(t==null&&(t="homestead"),typeof t=="string"){const n=t.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new Qi(t);case"ws":case"wss":return new rc(t);default:Mm.throwArgumentError("unsupported URL scheme","network",t)}}const r=Vd(t);return(!r||!r._defaultProvider)&&Mm.throwError("unsupported getDefaultProvider network",O.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:Hy,AlchemyProvider:Xd,AnkrProvider:Uy,CloudflareProvider:zy,EtherscanProvider:$y,InfuraProvider:Zd,JsonRpcProvider:Qi,NodesmithProvider:Gy,PocketProvider:Wy,Web3Provider:Ky,IpcProvider:qy},e)}const W4=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:Xd,AlchemyWebSocketProvider:Fy,AnkrProvider:Uy,BaseProvider:tc,CloudflareProvider:zy,EtherscanProvider:$y,FallbackProvider:Hy,Formatter:Z,InfuraProvider:Zd,InfuraWebSocketProvider:Vy,IpcProvider:qy,JsonRpcBatchProvider:$4,JsonRpcProvider:Qi,JsonRpcSigner:Yd,NodesmithProvider:Gy,PocketProvider:Wy,Provider:ro,Resolver:Rh,StaticJsonRpcProvider:Dy,UrlJsonRpcProvider:Gn,Web3Provider:Ky,WebSocketProvider:rc,getDefaultProvider:G4,getNetwork:Vd,isCommunityResourcable:Ty,isCommunityResource:Ph,showThrottleMessage:Oa},Symbol.toStringTag,{value:"Module"})),K4=Ys(W4);var Q4=ze&&ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J4=ze&&ze.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y4=ze&&ze.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Q4(e,t,r);return J4(e,t),e},X4=ze&&ze.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.getPriorityConnector=Ln.getSelectedConnector=Ln.initializeConnector=void 0;const Z4=k1,Ss=T,Cm=nE,e_=aE;let Ls;function t_(){return X4(this,void 0,void 0,function*(){if(Ls===void 0)try{const{Web3Provider:t}=yield Promise.resolve().then(()=>Y4(K4));Ls=t}catch{console.debug("@ethersproject/providers not available"),Ls=null}})}function r_(t){const[e,r]=(0,Z4.createWeb3ReactStoreAndActions)(),n=t(r),i=u_(e),s=c_(i),o=f_(n,i,s);return[n,Object.assign(Object.assign(Object.assign({},i),s),o),e]}Ln.initializeConnector=r_;function n_({chainId:t,accounts:e,activating:r}){return!!(t&&e&&!r)}function Qy(...t){function e(h){const p=t.findIndex(([v])=>h===v);if(p===-1)throw new Error("Connector not found");return p}function r(h){const p=t[e(h)][2];if(!p)throw new Error("Stores not passed");return p}function n(h){return t.map(([,{useChainId:v}])=>v())[e(h)]}function i(h){return t.map(([,{useAccounts:v}])=>v())[e(h)]}function s(h){return t.map(([,{useIsActivating:v}])=>v())[e(h)]}function o(h){return t.map(([,{useAccount:v}])=>v())[e(h)]}function a(h){return t.map(([,{useIsActive:v}])=>v())[e(h)]}function l(h,p){const v=e(h);return t.map(([,{useProvider:b}],k)=>b(p,k===v))[v]}function u(h,p){const v=e(h);return t.map(([,{useENSNames:b}],k)=>b(k===v?p:void 0))[v]}function c(h,p){const v=e(h);return t.map(([,{useENSName:b}],k)=>b(k===v?p:void 0))[v]}return{useSelectedStore:r,useSelectedChainId:n,useSelectedAccounts:i,useSelectedIsActivating:s,useSelectedAccount:o,useSelectedIsActive:a,useSelectedProvider:l,useSelectedENSNames:u,useSelectedENSName:c}}Ln.getSelectedConnector=Qy;function i_(...t){const{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:s,useSelectedIsActive:o,useSelectedProvider:a,useSelectedENSNames:l,useSelectedENSName:u}=Qy(...t);function c(){const L=t.map(([,{useIsActive:D}])=>D()).findIndex(D=>D);return t[L===-1?0:L][0]}function h(){return e(c())}function p(){return r(c())}function v(){return n(c())}function y(){return i(c())}function b(){return s(c())}function k(){return o(c())}function w(j){return a(c(),j)}function m(j){return l(c(),j)}function A(j){return u(c(),j)}return{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:s,useSelectedIsActive:o,useSelectedProvider:a,useSelectedENSNames:l,useSelectedENSName:u,usePriorityConnector:c,usePriorityStore:h,usePriorityChainId:p,usePriorityAccounts:v,usePriorityIsActivating:y,usePriorityAccount:b,usePriorityIsActive:k,usePriorityProvider:w,usePriorityENSNames:m,usePriorityENSName:A}}Ln.getPriorityConnector=i_;const s_=({chainId:t})=>t,o_=({accounts:t})=>t,a_=({activating:t})=>t,l_=(t,e)=>t===void 0&&e===void 0||t!==void 0&&t.length===(e==null?void 0:e.length)&&t.every((r,n)=>r===e[n]);function u_(t){function e(){return(0,Cm.useStore)(t,s_)}function r(){return(0,e_.useStoreWithEqualityFn)(t,o_,l_)}function n(){return(0,Cm.useStore)(t,a_)}return{useChainId:e,useAccounts:r,useIsActivating:n}}function c_({useChainId:t,useAccounts:e,useIsActivating:r}){function n(){var s;return(s=e())===null||s===void 0?void 0:s[0]}function i(){const s=t(),o=e(),a=r();return n_({chainId:s,accounts:o,activating:a})}return{useAccount:n,useIsActive:i}}function Pm(t,e=[]){const[r,n]=(0,Ss.useState)();return(0,Ss.useEffect)(()=>{if(t&&e.length){let i=!1;return Promise.all(e.map(s=>t.lookupAddress(s))).then(s=>{i||n(s)}).catch(s=>{i||(console.debug("Could not fetch ENS names",s),n(new Array(e.length).fill(null)))}),()=>{i=!0,n(void 0)}}},[t,e]),r??new Array(e.length).fill(void 0)}function f_(t,{useAccounts:e,useChainId:r},{useAccount:n,useIsActive:i}){function s(l,u=!0){const c=i(),h=r(),[p,v]=(0,Ss.useState)(Ls!==void 0);return(0,Ss.useEffect)(()=>{if(p)return;let y=!1;return t_().then(()=>{y||v(!0)}),()=>{y=!0}},[p]),(0,Ss.useMemo)(()=>{if(u){if(t.customProvider)return t.customProvider;if(Ls&&t.provider)return new Ls(t.provider,l)}},[p,u,c,h,l])}function o(l){const u=e();return Pm(l,u)}function a(l){var u;const c=n(),h=(0,Ss.useMemo)(()=>c===void 0?void 0:[c],[c]);return(u=Pm(l,h))===null||u===void 0?void 0:u[0]}return{useProvider:s,useENSNames:o,useENSName:a}}var nc={},Jy={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function s(l,u,c,h,p){if(typeof c!="function")throw new TypeError("The listener must be a function");var v=new i(c,h||l,p),y=r?r+u:u;return l._events[y]?l._events[y].fn?l._events[y]=[l._events[y],v]:l._events[y].push(v):(l._events[y]=v,l._eventsCount++),l}function o(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)e.call(c,h)&&u.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},a.prototype.listeners=function(u){var c=r?r+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var p=0,v=h.length,y=new Array(v);pe),this.eth_accounts=jest.fn(e=>e),this.eth_requestAccounts=jest.fn(e=>e)}request(e){if(!this.chainId)return Promise.reject(new Error);switch(e.method){case"eth_chainId":return Promise.resolve(this.eth_chainId(this.chainId));case"eth_accounts":return Promise.resolve(this.eth_accounts(this.accounts));case"eth_requestAccounts":return Promise.resolve(this.eth_requestAccounts(this.accounts));default:throw new Error(`Method not supported on mock: ${JSON.stringify(e)}`)}}emitConnect(e){this.emit("connect",{chainId:e})}emitDisconnect(e){this.emit("disconnect",e)}emitChainChanged(e){this.emit("chainChanged",e)}emitAccountsChanged(e){this.emit("accountsChanged",e)}}nc.MockEIP1193Provider=p_;var Qs={},m_=ze&&ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),g_=ze&&ze.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v_=ze&&ze.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&m_(e,t,r);return g_(e,t),e};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.useWeb3React=Qs.Web3ReactProvider=void 0;const hu=v_(T),y_=Ln,Yy=(0,hu.createContext)(void 0);function w_({children:t,connectors:e,connectorOverride:r,network:n,lookupENS:i=!0}){const s=(0,hu.useRef)(e);if(e.length!=s.current.length||e.some((J,re)=>{const $e=s.current[re];return J[0]!==$e[0]}))throw new Error("The connectors prop passed to Web3ReactProvider must be referentially static. If connectors is changing, try providing a key prop to Web3ReactProvider that changes every time connectors changes.");const o=(0,y_.getPriorityConnector)(...e),{usePriorityConnector:a,useSelectedChainId:l,useSelectedAccounts:u,useSelectedIsActivating:c,useSelectedAccount:h,useSelectedIsActive:p,useSelectedProvider:v,useSelectedENSNames:y,useSelectedENSName:b}=o,k=a(),w=r??k,m=l(w),A=u(w),j=c(w),L=h(w),D=p(w),F=v(w,n),U=y(w,i?F:void 0),G=b(w,i?F:void 0);return hu.default.createElement(Yy.Provider,{value:{connector:w,chainId:m,accounts:A,isActivating:j,account:L,isActive:D,provider:F,ENSNames:U,ENSName:G,hooks:o}},t)}Qs.Web3ReactProvider=w_;function x_(){const t=(0,hu.useContext)(Yy);if(!t)throw Error("useWeb3React can only be used within the Web3ReactProvider component");return t}Qs.useWeb3React=x_;(function(t){var e=ze&&ze.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=ze&&ze.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(t,"__esModule",{value:!0}),r(Ln,t),r(nc,t),r(Qs,t)})(Hu);const ja="abi/5.7.0",be=new O(ja),Ji={};let Rm={calldata:!0,memory:!0,storage:!0},b_={calldata:!0,memory:!0};function al(t,e){if(t==="bytes"||t==="string"){if(Rm[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&b_[e])return!0;return(Rm[e]||e==="payable")&&be.throwArgumentError("invalid modifier","name",e),!1}function E_(t,e){let r=t;function n(a){be.throwArgumentError(`unexpected character at position ${a}`,"param",t)}t=t.replace(/\s/g," ");function i(a){let l={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(l.indexed=!1),l}let s={type:"",name:"",state:{allowType:!0}},o=s;for(let a=0;aJSON.parse(i.format(e)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==ke.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(e)).join(e===ke.full?", ":",")+")"):r+=this.type,e!==ke.sighash&&(this.indexed===!0&&(r+=" indexed"),e===ke.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?Nt.fromString(e,r):Nt.fromObject(e)}static fromObject(e){return Nt.isParamType(e)?e:new Nt(Ji,{name:e.name||null,type:as(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(Nt.fromObject):null})}static fromString(e,r){function n(i){return Nt.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n(E_(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function da(t,e){return S_(t).map(r=>Nt.fromString(r,e))}class Tn{constructor(e,r){e!==Ji&&be.throwError("use a static from method",O.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Il(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return Tn.isFragment(e)?e:typeof e=="string"?Tn.fromString(e):Tn.fromObject(e)}static fromObject(e){if(Tn.isFragment(e))return e;switch(e.type){case"function":return un.fromObject(e);case"event":return Pn.fromObject(e);case"constructor":return ln.fromObject(e);case"error":return ui.fromObject(e);case"fallback":case"receive":return null}return be.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?Pn.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?un.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?ln.fromString(e.trim()):e.split(" ")[0]==="error"?ui.fromString(e.substring(5).trim()):be.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class Pn extends Tn{format(e){if(e||(e=ke.sighash),ke[e]||be.throwArgumentError("invalid format type","format",e),e===ke.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==ke.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===ke.full?", ":",")+") ",e!==ke.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?Pn.fromString(e):Pn.fromObject(e)}static fromObject(e){if(Pn.isEventFragment(e))return e;e.type!=="event"&&be.throwArgumentError("invalid event object","value",e);const r={name:pa(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Nt.fromObject):[],type:"event"};return new Pn(Ji,r)}static fromString(e){let r=e.match(ma);r||be.throwArgumentError("invalid event string","value",e);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:be.warn("unknown modifier: "+i)}}),Pn.fromObject({name:r[1].trim(),anonymous:n,inputs:da(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function Xy(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&be.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||be.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=W.from(r[1]),r[0]):t}function Zy(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function e2(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&be.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&be.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&be.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&be.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&be.throwArgumentError("unable to determine stateMutability","value",t),e}class ln extends Tn{format(e){if(e||(e=ke.sighash),ke[e]||be.throwArgumentError("invalid format type","format",e),e===ke.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});e===ke.sighash&&be.throwError("cannot format a constructor for sighash",O.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(e)).join(e===ke.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?ln.fromString(e):ln.fromObject(e)}static fromObject(e){if(ln.isConstructorFragment(e))return e;e.type!=="constructor"&&be.throwArgumentError("invalid constructor object","value",e);let r=e2(e);r.constant&&be.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Nt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?W.from(e.gas):null};return new ln(Ji,n)}static fromString(e){let r={type:"constructor"};e=Xy(e,r);let n=e.match(ma);return(!n||n[1].trim()!=="constructor")&&be.throwArgumentError("invalid constructor string","value",e),r.inputs=da(n[2].trim(),!1),Zy(n[3].trim(),r),ln.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class un extends ln{format(e){if(e||(e=ke.sighash),ke[e]||be.throwArgumentError("invalid format type","format",e),e===ke.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==ke.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===ke.full?", ":",")+") ",e!==ke.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?un.fromString(e):un.fromObject(e)}static fromObject(e){if(un.isFunctionFragment(e))return e;e.type!=="function"&&be.throwArgumentError("invalid function object","value",e);let r=e2(e);const n={type:e.type,name:pa(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(Nt.fromObject):[],outputs:e.outputs?e.outputs.map(Nt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?W.from(e.gas):null};return new un(Ji,n)}static fromString(e){let r={type:"function"};e=Xy(e,r);let n=e.split(" returns ");n.length>2&&be.throwArgumentError("invalid function string","value",e);let i=n[0].match(ma);if(i||be.throwArgumentError("invalid function signature","value",e),r.name=i[1].trim(),r.name&&pa(r.name),r.inputs=da(i[2],!1),Zy(i[3].trim(),r),n.length>1){let s=n[1].match(ma);(s[1].trim()!=""||s[3].trim()!="")&&be.throwArgumentError("unexpected tokens","value",e),r.outputs=da(s[2],!1)}else r.outputs=[];return un.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function Im(t){const e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&be.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ui extends Tn{format(e){if(e||(e=ke.sighash),ke[e]||be.throwArgumentError("invalid format type","format",e),e===ke.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==ke.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===ke.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?ui.fromString(e):ui.fromObject(e)}static fromObject(e){if(ui.isErrorFragment(e))return e;e.type!=="error"&&be.throwArgumentError("invalid error object","value",e);const r={type:e.type,name:pa(e.name),inputs:e.inputs?e.inputs.map(Nt.fromObject):[]};return Im(new ui(Ji,r))}static fromString(e){let r={type:"error"},n=e.match(ma);return n||be.throwArgumentError("invalid error signature","value",e),r.name=n[1].trim(),r.name&&pa(r.name),r.inputs=da(n[2],!1),Im(ui.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function as(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const __=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function pa(t){return(!t||!t.match(__))&&be.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const ma=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function S_(t){t=t.trim();let e=[],r="",n=0;for(let i=0;ithis.wordSize&&e0.throwError("value out-of-bounds",O.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=zt([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}}class du{constructor(e,r,n,i){H(this,"_data",oe(e)),H(this,"wordSize",r||32),H(this,"_coerceFunc",n),H(this,"allowLoose",i),this._offset=0}get data(){return ne(this._data)}get consumed(){return this._offset}static coerce(e,r){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):du.coerce(e,r)}_peekBytes(e,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:e0.throwError("data out-of-bounds",O.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new du(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let n=this._peekBytes(0,e,!!r);return this._offset+=n.length,n.slice(0,e)}readValue(){return W.from(this.readBytes(this.wordSize))}}class N_ extends Wn{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=vt(r)}catch(n){this._throwError(n.message,r)}return e.writeValue(r)}decode(e){return vt(gt(e.readValue().toHexString(),20))}}class M_ extends Wn{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}}const ks=new O(ja);function t2(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let l={};n=e.map(u=>{const c=u.localName;return c||ks.throwError("cannot encode object for signature with missing names",O.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),l[c]&&ks.throwError("cannot encode object for signature with duplicate names",O.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),l[c]=!0,r[c]})}else ks.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&ks.throwArgumentError("types/value length mismatch","tuple",r);let i=new Oh(t.wordSize),s=new Oh(t.wordSize),o=[];e.forEach((l,u)=>{let c=n[u];if(l.dynamic){let h=s.length;l.encode(s,c);let p=i.writeUpdatableValue();o.push(v=>{p(v+h)})}else l.encode(i,c)}),o.forEach(l=>{l(i.length)});let a=t.appendWriter(i);return a+=t.appendWriter(s),a}function r2(t,e){let r=[],n=t.subReader(0);e.forEach(s=>{let o=null;if(s.dynamic){let a=t.readValue(),l=n.subReader(a.toNumber());try{o=s.decode(l)}catch(u){if(u.code===O.errors.BUFFER_OVERRUN)throw u;o=u,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(t)}catch(a){if(a.code===O.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}o!=null&&r.push(o)});const i=e.reduce((s,o)=>{const a=o.localName;return a&&(s[a]||(s[a]=0),s[a]++),s},{});e.forEach((s,o)=>{let a=s.localName;if(!a||i[a]!==1||(a==="length"&&(a="_length"),r[a]!=null))return;const l=r[o];l instanceof Error?Object.defineProperty(r,a,{enumerable:!0,get:()=>{throw l}}):r[a]=l});for(let s=0;s{throw o}})}return Object.freeze(r)}class C_ extends Wn{constructor(e,r,n){const i=e.type+"["+(r>=0?r:"")+"]",s=r===-1||e.dynamic;super("array",i,n,s),this.coder=e,this.length=r}defaultValue(){const e=this.coder.defaultValue(),r=[];for(let n=0;ne._data.length&&ks.throwError("insufficient data length",O.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let n=[];for(let i=0;i{o.dynamic&&(n=!0),i.push(o.type)});const s="tuple("+i.join(",")+")";super("tuple",s,r,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const s=i.localName;return s&&(n[s]||(n[s]=0),n[s]++),n},{});return this.coders.forEach((n,i)=>{let s=n.localName;!s||r[s]!==1||(s==="length"&&(s="_length"),e[s]==null&&(e[s]=e[i]))}),Object.freeze(e)}encode(e,r){return t2(e,this.coders,r)}decode(e){return e.coerce(this.name,r2(e,this.coders))}}const ul=new O(ja),L_=new RegExp(/^bytes([0-9]*)$/),B_=new RegExp(/^(u?int)([0-9]*)$/);class D_{constructor(e){H(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new N_(e.name);case"bool":return new P_(e.name);case"string":return new j_(e.name);case"bytes":return new R_(e.name);case"array":return new C_(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new ll((e.components||[]).map(n=>this._getCoder(n)),e.name);case"":return new O_(e.name)}let r=e.type.match(B_);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&ul.throwArgumentError("invalid "+r[1]+" bit length","param",e),new T_(n/8,r[1]==="int",e.name)}if(r=e.type.match(L_),r){let n=parseInt(r[1]);return(n===0||n>32)&&ul.throwArgumentError("invalid bytes length","param",e),new I_(n,e.name)}return ul.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new du(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new Oh(this._getWordSize())}getDefaultValue(e){const r=e.map(i=>this._getCoder(Nt.from(i)));return new ll(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&ul.throwError("types/values length mismatch",O.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});const n=e.map(o=>this._getCoder(Nt.from(o))),i=new ll(n,"_"),s=this._getWriter();return i.encode(s,r),s.data}decode(e,r,n){const i=e.map(o=>this._getCoder(Nt.from(o)));return new ll(i,"_").decode(this._getReader(oe(r),n))}}const F_=new D_,ut=new O(ja);class U_ extends Ca{}class z_ extends Ca{}class $_ extends Ca{}class Th extends Ca{static isIndexed(e){return!!(e&&e._isIndexed)}}const H_={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Om(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class jh{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,H(this,"fragments",r.map(n=>Tn.from(n)).filter(n=>n!=null)),H(this,"_abiCoder",mr(new.target,"getAbiCoder")()),H(this,"functions",{}),H(this,"errors",{}),H(this,"events",{}),H(this,"structs",{}),this.fragments.forEach(n=>{let i=null;switch(n.type){case"constructor":if(this.deploy){ut.warn("duplicate definition - constructor");return}H(this,"deploy",n);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let s=n.format();if(i[s]){ut.warn("duplicate definition - "+s);return}i[s]=n}),this.deploy||H(this,"deploy",ln.from({payable:!1,type:"constructor"})),H(this,"_isInterface",!0)}format(e){e||(e=ke.full),e===ke.sighash&&ut.throwArgumentError("interface does not support formatting sighash","format",e);const r=this.fragments.map(n=>n.format(e));return e===ke.json?JSON.stringify(r.map(n=>JSON.parse(n))):r}static getAbiCoder(){return F_}static getAddress(e){return vt(e)}static getSighash(e){return Ot(Es(e.format()),0,4)}static getEventTopic(e){return Es(e.format())}getFunction(e){if(me(e)){for(const n in this.functions)if(e===this.getSighash(n))return this.functions[n];ut.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.functions).filter(s=>s.split("(")[0]===n);return i.length===0?ut.throwArgumentError("no matching function","name",n):i.length>1&&ut.throwArgumentError("multiple matching functions","name",n),this.functions[i[0]]}const r=this.functions[un.fromString(e).format()];return r||ut.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(me(e)){const n=e.toLowerCase();for(const i in this.events)if(n===this.getEventTopic(i))return this.events[i];ut.throwArgumentError("no matching event","topichash",n)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.events).filter(s=>s.split("(")[0]===n);return i.length===0?ut.throwArgumentError("no matching event","name",n):i.length>1&&ut.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}const r=this.events[Pn.fromString(e).format()];return r||ut.throwArgumentError("no matching event","signature",e),r}getError(e){if(me(e)){const n=mr(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===n(s))return this.errors[i]}ut.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.errors).filter(s=>s.split("(")[0]===n);return i.length===0?ut.throwArgumentError("no matching error","name",n):i.length>1&&ut.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}const r=this.errors[un.fromString(e).format()];return r||ut.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return mr(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),mr(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));const n=oe(r);return ne(n.slice(0,4))!==this.getSighash(e)&&ut.throwArgumentError(`data signature does not match error ${e.name}.`,"data",ne(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),ne(zt([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));const n=oe(r);return ne(n.slice(0,4))!==this.getSighash(e)&&ut.throwArgumentError(`data signature does not match function ${e.name}.`,"data",ne(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),ne(zt([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let n=oe(r),i=null,s="",o=null,a=null,l=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch{}break;case 4:{const u=ne(n.slice(0,4)),c=H_[u];if(c)o=this._abiCoder.decode(c.inputs,n.slice(4)),a=c.name,l=c.signature,c.reason&&(i=o[0]),a==="Error"?s=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(s=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const h=this.getError(u);o=this._abiCoder.decode(h.inputs,n.slice(4)),a=h.name,l=h.format()}catch{}break}}return ut.throwError("call revert exception"+s,O.errors.CALL_EXCEPTION,{method:e.format(),data:ne(r),errorArgs:o,errorName:a,errorSignature:l,reason:i})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),ne(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&ut.throwError("too many arguments for "+e.format(),O.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];e.anonymous||n.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?Es(o):s.type==="bytes"?ot(ne(o)):(s.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),s.type.match(/^u?int/)&&(o=W.from(o).toHexString()),s.type==="address"&&this._abiCoder.encode(["address"],[o]),gt(ne(o),32));for(r.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&ut.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?n.push(null):a.baseType==="array"||a.baseType==="tuple"?ut.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?n.push(s.map(l=>i(a,l))):n.push(i(a,s))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));const n=[],i=[],s=[];return e.anonymous||n.push(this.getEventTopic(e)),r.length!==e.inputs.length&&ut.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{const l=r[a];if(o.indexed)if(o.type==="string")n.push(Es(l));else if(o.type==="bytes")n.push(ot(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");n.push(this._abiCoder.encode([o.type],[l]))}else i.push(o),s.push(l)}),{data:this._abiCoder.encode(i,s),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"&&(e=this.getEvent(e)),n!=null&&!e.anonymous){let p=this.getEventTopic(e);(!me(n[0],32)||n[0].toLowerCase()!==p)&&ut.throwError("fragment/topic mismatch",O.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:p,value:n[0]}),n=n.slice(1)}let i=[],s=[],o=[];e.inputs.forEach((p,v)=>{p.indexed?p.type==="string"||p.type==="bytes"||p.baseType==="tuple"||p.baseType==="array"?(i.push(Nt.fromObject({type:"bytes32",name:p.name})),o.push(!0)):(i.push(p),o.push(!1)):(s.push(p),o.push(!1))});let a=n!=null?this._abiCoder.decode(i,zt(n)):null,l=this._abiCoder.decode(s,r,!0),u=[],c=0,h=0;e.inputs.forEach((p,v)=>{if(p.indexed)if(a==null)u[v]=new Th({_isIndexed:!0,hash:null});else if(o[v])u[v]=new Th({_isIndexed:!0,hash:a[h++]});else try{u[v]=a[h++]}catch(y){u[v]=y}else try{u[v]=l[c++]}catch(y){u[v]=y}if(p.name&&u[p.name]==null){const y=u[v];y instanceof Error?Object.defineProperty(u,p.name,{enumerable:!0,get:()=>{throw Om(`property ${JSON.stringify(p.name)}`,y)}}):u[p.name]=y}});for(let p=0;p{throw Om(`index ${p}`,v)}})}return Object.freeze(u)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new z_({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:W.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new U_({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){const r=ne(e);let n=this.getError(r.substring(0,10).toLowerCase());return n?new $_({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const q_="contracts/5.7.0";var Yi=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const yt=new O(q_);function pu(t,e){return Yi(this,void 0,void 0,function*(){const r=yield e;typeof r!="string"&&yt.throwArgumentError("invalid address or ENS name","name",r);try{return vt(r)}catch{}t||yt.throwError("a provider or signer is needed to resolve ENS names",O.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return n==null&&yt.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function Ol(t,e,r){return Yi(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>Ol(t,Array.isArray(e)?e[i]:e[n.name],n))):r.type==="address"?yield pu(t,e):r.type==="tuple"?yield Ol(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(n=>Ol(t,n,r.arrayChildren))):Promise.reject(yt.makeError("invalid value for array",O.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function ic(t,e,r){return Yi(this,void 0,void 0,function*(){let n={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(n=at(r.pop())),yt.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=xt({override:pu(t.signer,n.from),signer:t.signer.getAddress()}).then(u=>Yi(this,void 0,void 0,function*(){return vt(u.signer)!==u.override&&yt.throwError("Contract with a Signer cannot override from",O.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),u.override})):n.from=t.signer.getAddress():n.from&&(n.from=pu(t.provider,n.from));const i=yield xt({args:Ol(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:xt(n)||{}}),s=t.interface.encodeFunctionData(e,i.args),o={data:s,to:i.address},a=i.overrides;if(a.nonce!=null&&(o.nonce=W.from(a.nonce).toNumber()),a.gasLimit!=null&&(o.gasLimit=W.from(a.gasLimit)),a.gasPrice!=null&&(o.gasPrice=W.from(a.gasPrice)),a.maxFeePerGas!=null&&(o.maxFeePerGas=W.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(o.maxPriorityFeePerGas=W.from(a.maxPriorityFeePerGas)),a.from!=null&&(o.from=a.from),a.type!=null&&(o.type=a.type),a.accessList!=null&&(o.accessList=rs(a.accessList)),o.gasLimit==null&&e.gas!=null){let u=21e3;const c=oe(s);for(let h=0;hn[u]!=null);return l.length&&yt.throwError(`cannot override ${l.map(u=>JSON.stringify(u)).join(",")}`,O.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function V_(t,e){return function(...r){return ic(t,e,r)}}function G_(t,e){const r=t.signer||t.provider;return function(...n){return Yi(this,void 0,void 0,function*(){r||yt.throwError("estimate require a provider or signer",O.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield ic(t,e,n);return yield r.estimateGas(i)})}}function W_(t,e){const r=e.wait.bind(e);e.wait=n=>r(n).then(i=>(i.events=i.logs.map(s=>{let o=lr(s),a=null;try{a=t.interface.parseLog(s)}catch{}return a&&(o.args=a.args,o.decode=(l,u)=>t.interface.decodeEventLog(a.eventFragment,l,u),o.event=a.name,o.eventSignature=a.signature),o.removeListener=()=>t.provider,o.getBlock=()=>t.provider.getBlock(i.blockHash),o.getTransaction=()=>t.provider.getTransaction(i.transactionHash),o.getTransactionReceipt=()=>Promise.resolve(i),o}),i))}function i2(t,e,r){const n=t.signer||t.provider;return function(...i){return Yi(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=at(i.pop());l.blockTag!=null&&(s=yield l.blockTag),delete l.blockTag,i.push(l)}t.deployTransaction!=null&&(yield t._deployed(s));const o=yield ic(t,e,i),a=yield n.call(o,s);try{let l=t.interface.decodeFunctionResult(e,a);return r&&e.outputs.length===1&&(l=l[0]),l}catch(l){throw l.code===O.errors.CALL_EXCEPTION&&(l.address=t.address,l.args=i,l.transaction=o),l}})}}function K_(t,e){return function(...r){return Yi(this,void 0,void 0,function*(){t.signer||yt.throwError("sending a transaction requires a signer",O.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());const n=yield ic(t,e,r),i=yield t.signer.sendTransaction(n);return W_(t,i),i})}}function Tm(t,e,r){return e.constant?i2(t,e,r):K_(t,e)}function s2(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class ga{constructor(e,r){H(this,"tag",e),H(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(n=>r||n.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const r=this.listenerCount();return this._listeners=this._listeners.filter(n=>{const i=e.slice();return setTimeout(()=>{n.listener.apply(this,i)},0),!n.once}),r}prepareEvent(e){}getEmit(e){return[e]}}class Q_ extends ga{constructor(){super("error",null)}}class jm extends ga{constructor(e,r,n,i){const s={address:e};let o=r.getEventTopic(n);i?(o!==i[0]&&yt.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(s2(s),s),H(this,"address",e),H(this,"interface",r),H(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,n)=>this.interface.decodeEventLog(this.fragment,r,n);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){const r=k_(e.args);if(r.length)throw r[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class Lm extends ga{constructor(e,r){super("*",{address:e}),H(this,"address",e),H(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{const r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(n,i)=>this.interface.decodeEventLog(r.eventFragment,n,i),e.args=r.args}catch{}}}class J_{constructor(e,r,n){H(this,"interface",mr(new.target,"getInterface")(r)),n==null?(H(this,"provider",null),H(this,"signer",null)):Ta.isSigner(n)?(H(this,"provider",n.provider||null),H(this,"signer",n)):ro.isProvider(n)?(H(this,"provider",n),H(this,"signer",null)):yt.throwArgumentError("invalid signer or provider","signerOrProvider",n),H(this,"callStatic",{}),H(this,"estimateGas",{}),H(this,"functions",{}),H(this,"populateTransaction",{}),H(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];H(this.filters,a,(...u)=>({address:this.address,topics:this.interface.encodeFilterTopics(l,u)})),o[l.name]||(o[l.name]=[]),o[l.name].push(a)}),Object.keys(o).forEach(a=>{const l=o[a];l.length===1?H(this.filters,a,this.filters[l[0]]):yt.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(H(this,"_runningEvents",{}),H(this,"_wrappedEmits",{}),e==null&&yt.throwArgumentError("invalid contract address or ENS name","addressOrName",e),H(this,"address",e),this.provider)H(this,"resolvedAddress",pu(this.provider,e));else try{H(this,"resolvedAddress",Promise.resolve(vt(e)))}catch{yt.throwError("provider is required to use ENS name as contract address",O.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(o=>{});const i={},s={};Object.keys(this.interface.functions).forEach(o=>{const a=this.interface.functions[o];if(s[o]){yt.warn(`Duplicate ABI entry for ${JSON.stringify(o)}`);return}s[o]=!0;{const l=a.name;i[`%${l}`]||(i[`%${l}`]=[]),i[`%${l}`].push(o)}this[o]==null&&H(this,o,Tm(this,a,!0)),this.functions[o]==null&&H(this.functions,o,Tm(this,a,!1)),this.callStatic[o]==null&&H(this.callStatic,o,i2(this,a,!0)),this.populateTransaction[o]==null&&H(this.populateTransaction,o,V_(this,a)),this.estimateGas[o]==null&&H(this.estimateGas,o,G_(this,a))}),Object.keys(i).forEach(o=>{const a=i[o];if(a.length>1)return;o=o.substring(1);const l=a[0];try{this[o]==null&&H(this,o,this[l])}catch{}this.functions[o]==null&&H(this.functions,o,this.functions[l]),this.callStatic[o]==null&&H(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&H(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&H(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return Hd(e)}static getInterface(e){return jh.isInterface(e)?e:new jh(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&&yt.throwError("contract not deployed",O.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||yt.throwError("sending a transactions require a signer",O.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=at(e||{});return["from","to"].forEach(function(n){r[n]!=null&&yt.throwError("cannot override "+n,O.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new Jd(e,this.provider));const r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&H(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return Th.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new Q_);if(e==="event")return this._normalizeRunningEvent(new ga("event",null));if(e==="*")return this._normalizeRunningEvent(new Lm(this.address,this.interface));const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new jm(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{const n=e.topics[0];if(typeof n!="string")throw new Error("invalid topic");const i=this.interface.getEvent(n);return this._normalizeRunningEvent(new jm(this.address,this.interface,i,e.topics))}catch{}const r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new ga(s2(r),r))}return this._normalizeRunningEvent(new Lm(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,n){const i=lr(r);return i.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(r.blockHash),i.getTransaction=()=>this.provider.getTransaction(r.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(i),i}_addEventListener(e,r,n){if(this.provider||yt.throwError("events require a provider or a signer with a provider",O.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=s=>{let o=this._wrapEvent(e,s,r);if(o.decodeError==null)try{const a=e.getEmit(o);this.emit(e.filter,...a)}catch(a){o.decodeError=a.error}e.filter!=null&&this.emit("event",o),o.decodeError!=null&&this.emit("error",o.decodeError,o)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,r,n){const i=this._getRunningEvent(e),s=at(i.filter);return typeof r=="string"&&me(r,32)?(n!=null&&yt.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),s.blockHash=r):(s.fromBlock=r??0,s.toBlock=n??"latest"),this.provider.getLogs(s).then(o=>o.map(a=>this._wrapEvent(i,a,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;const n=this._getRunningEvent(e),i=n.run(r)>0;return this._checkRunningEvents(n),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,n)=>r+this._runningEvents[n].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const r=[];for(let n in this._runningEvents)this._runningEvents[n].listeners().forEach(i=>{r.push(i)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const n in this._runningEvents){const i=this._runningEvents[n];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(r),this._checkRunningEvents(n),this}removeListener(e,r){return this.off(e,r)}}class Y_ extends J_{}const X_="solidity/5.7.0",Z_=new RegExp("^bytes([0-9]+)$"),e6=new RegExp("^(u?int)([0-9]*)$"),t6=new RegExp("^(.*)\\[([0-9]*)\\]$"),r6="0000000000000000000000000000000000000000000000000000000000000000",ls=new O(X_);function o2(t,e,r){switch(t){case"address":return r?Sl(e,32):oe(e);case"string":return yr(e);case"bytes":return oe(e);case"bool":return e=e?"0x01":"0x00",r?Sl(e,32):oe(e)}let n=t.match(e6);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!==0||i===0||i>256)&&ls.throwArgumentError("invalid number type","type",t),r&&(i=256),e=W.from(e).toTwos(i),Sl(e,i/8)}if(n=t.match(Z_),n){const i=parseInt(n[1]);return(String(i)!==n[1]||i===0||i>32)&&ls.throwArgumentError("invalid bytes type","type",t),oe(e).byteLength!==i&&ls.throwArgumentError(`invalid value for ${t}`,"value",e),r?oe((e+r6).substring(0,66)):e}if(n=t.match(t6),n&&Array.isArray(e)){const i=n[1];parseInt(n[2]||String(e.length))!=e.length&&ls.throwArgumentError(`invalid array length for ${t}`,"value",e);const o=[];return e.forEach(function(a){o.push(o2(i,a,!0))}),zt(o)}return ls.throwArgumentError("invalid type","type",t)}function a2(t,e){t.length!=e.length&&ls.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(n,i){r.push(o2(n,e[i]))}),ne(zt(r))}function n6(t,e){return ot(a2(t,e))}const vf=[{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"apps",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"contractURI",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getInitializedVersion",inputs:[],outputs:[{name:"",type:"uint64",internalType:"uint64"}],stateMutability:"view"},{type:"function",name:"getPackageId",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"pure"},{type:"function",name:"getPackageInfo",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"getPackageInfo",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_knsResolver",type:"address",internalType:"contract KNSRegistryResolver"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"knsResolver",inputs:[],outputs:[{name:"",type:"address",internalType:"contract KNSRegistryResolver"}],stateMutability:"view"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"registerApp",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unlistPacakge",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateContractURI",inputs:[{name:"uri",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateMetadata",inputs:[{name:"package",type:"uint256",internalType:"uint256"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AppMetadataUpdated",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"AppRegistered",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"packageName",type:"string",indexed:!1,internalType:"string"},{name:"publisherName",type:"bytes",indexed:!1,internalType:"bytes"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC721IncorrectOwner",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InsufficientApproval",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC721InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOperator",inputs:[{name:"operator",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC721NonexistentToken",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]}];class l2{static createInterface(){return new jh(vf)}static connect(e,r){return new Y_(e,vf,r)}}o0(l2,"abi",vf);var u2={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Bm=Wr.createContext&&Wr.createContext(u2),i6=["attr","size","title"];function s6(t,e){if(t==null)return{};var r=o6(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function o6(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}function mu(){return mu=Object.assign?Object.assign.bind():function(t){for(var e=1;eWr.createElement(e.tag,gu({key:r},e.attr),c2(e.child)))}function Vt(t){return e=>Wr.createElement(c6,mu({attr:gu({},t.attr)},e),c2(t.child))}function c6(t){var e=r=>{var{attr:n,size:i,title:s}=t,o=s6(t,i6),a=i||r.size||"1em",l;return r.className&&(l=r.className),t.className&&(l=(l?l+" ":"")+t.className),Wr.createElement("svg",mu({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,o,{className:l,style:gu(gu({color:t.color||r.color},r.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&Wr.createElement("title",null,s),t.children)};return Bm!==void 0?Wr.createElement(Bm.Consumer,null,r=>e(r)):e(u2)}function f6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(t)}function h6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(t)}function d6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"},child:[]}]})(t)}function f2(t){return Vt({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31A12 12 0 0 0 45.15 301l235.22-193.74a12.19 12.19 0 0 1 15.3 0L530.9 301a12 12 0 0 0 16.9-1.6l25.5-31a12 12 0 0 0-1.7-16.93z"},child:[]}]})(t)}function p6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}var m6={BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Fm=t=>{let e;const r=new Set,n=(l,u)=>{const c=typeof l=="function"?l(e):l;if(!Object.is(c,e)){const h=e;e=u??(typeof c!="object"||c===null)?c:Object.assign({},e,c),r.forEach(p=>p(e,h))}},i=()=>e,a={setState:n,getState:i,subscribe:l=>(r.add(l),()=>r.delete(l)),destroy:()=>{(m6?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,a),a},g6=t=>t?Fm(t):Fm;var h2={BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:v6}=Wr,{useSyncExternalStoreWithSelector:y6}=Qu;let Um=!1;function w6(t,e=t.getState,r){(h2?"production":void 0)!=="production"&&r&&!Um&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Um=!0);const n=y6(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return v6(n),n}const zm=t=>{(h2?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?g6(t):t,r=(n,i)=>w6(e,n,i);return Object.assign(r,e),r},x6=t=>t?zm(t):zm;var b6={BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function d2(t,e){let r;try{r=t()}catch{return}return{getItem:i=>{var s;const o=l=>l===null?null:JSON.parse(l,e==null?void 0:e.reviver),a=(s=r.getItem(i))!=null?s:null;return a instanceof Promise?a.then(o):o(a)},setItem:(i,s)=>r.setItem(i,JSON.stringify(s,e==null?void 0:e.replacer)),removeItem:i=>r.removeItem(i)}}const va=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return va(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return va(n)(r)}}}},E6=(t,e)=>(r,n,i)=>{let s={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:k=>k,version:0,merge:(k,w)=>({...w,...k}),...e},o=!1;const a=new Set,l=new Set;let u;try{u=s.getStorage()}catch{}if(!u)return t((...k)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...k)},n,i);const c=va(s.serialize),h=()=>{const k=s.partialize({...n()});let w;const m=c({state:k,version:s.version}).then(A=>u.setItem(s.name,A)).catch(A=>{w=A});if(w)throw w;return m},p=i.setState;i.setState=(k,w)=>{p(k,w),h()};const v=t((...k)=>{r(...k),h()},n,i);let y;const b=()=>{var k;if(!u)return;o=!1,a.forEach(m=>m(n()));const w=((k=s.onRehydrateStorage)==null?void 0:k.call(s,n()))||void 0;return va(u.getItem.bind(u))(s.name).then(m=>{if(m)return s.deserialize(m)}).then(m=>{if(m)if(typeof m.version=="number"&&m.version!==s.version){if(s.migrate)return s.migrate(m.state,m.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return m.state}).then(m=>{var A;return y=s.merge(m,(A=n())!=null?A:v),r(y,!0),h()}).then(()=>{w==null||w(y,void 0),o=!0,l.forEach(m=>m(y))}).catch(m=>{w==null||w(void 0,m)})};return i.persist={setOptions:k=>{s={...s,...k},k.getStorage&&(u=k.getStorage())},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>b(),hasHydrated:()=>o,onHydrate:k=>(a.add(k),()=>{a.delete(k)}),onFinishHydration:k=>(l.add(k),()=>{l.delete(k)})},b(),y||v},A6=(t,e)=>(r,n,i)=>{let s={storage:d2(()=>localStorage),partialize:b=>b,version:0,merge:(b,k)=>({...k,...b}),...e},o=!1;const a=new Set,l=new Set;let u=s.storage;if(!u)return t((...b)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...b)},n,i);const c=()=>{const b=s.partialize({...n()});return u.setItem(s.name,{state:b,version:s.version})},h=i.setState;i.setState=(b,k)=>{h(b,k),c()};const p=t((...b)=>{r(...b),c()},n,i);let v;const y=()=>{var b,k;if(!u)return;o=!1,a.forEach(m=>{var A;return m((A=n())!=null?A:p)});const w=((k=s.onRehydrateStorage)==null?void 0:k.call(s,(b=n())!=null?b:p))||void 0;return va(u.getItem.bind(u))(s.name).then(m=>{if(m)if(typeof m.version=="number"&&m.version!==s.version){if(s.migrate)return s.migrate(m.state,m.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return m.state}).then(m=>{var A;return v=s.merge(m,(A=n())!=null?A:p),r(v,!0),c()}).then(()=>{w==null||w(v,void 0),v=n(),o=!0,l.forEach(m=>m(v))}).catch(m=>{w==null||w(void 0,m)})};return i.persist={setOptions:b=>{s={...s,...b},b.storage&&(u=b.storage)},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>y(),hasHydrated:()=>o,onHydrate:b=>(a.add(b),()=>{a.delete(b)}),onFinishHydration:b=>(l.add(b),()=>{l.delete(b)})},s.skipHydration||y(),v||p},_6=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((b6?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),E6(t,e)):A6(t,e),S6=_6;var kr=(t=>(t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t))(kr||{});const Ee=t=>`${t.package}:${t.publisher}`,Js=t=>{var e;return((e=t.metadata)==null?void 0:e.name)||Ee(t)},yf=t=>{var e,r;return t.publisher==="sys"?"system":(e=t.state)!=null&&e.our_version&&!((r=t.state)!=null&&r.caps_approved)?"downloaded":t.metadata?"installed":"local"},er="/main:app_store:sys",cl=(t,e)=>t.package===e.package&&t.publisher===e.publisher,Pi=x6()(S6((t,e)=>({myApps:{downloaded:[],installed:[],local:[],system:[]},listedApps:[],searchResults:[],query:"",getMyApps:async()=>{const r=await e().getListedApps(),s=(await(await fetch(`${er}/apps`)).json()).reduce((o,a)=>{const l=yf(a);return r.find(u=>u.metadata_hash===a.metadata_hash)&&console.log({listedappmatch:a}),o[l].push(a),o},{downloaded:[],installed:[],local:[],system:[]});return t(()=>({myApps:s})),s},getListedApps:async()=>{const n=await(await fetch(`${er}/apps/listed`)).json();return t({listedApps:n}),n},getMyApp:async r=>{const i=await(await fetch(`${er}/apps/${Ee(r)}`)).json(),s=yf(i),o=e().myApps;o[s]=o[s].map(l=>cl(l,i)?i:l);const a=[...e().listedApps].map(l=>cl(l,i)?i:l);return t({myApps:o,listedApps:a}),i},installApp:async r=>{if((await fetch(`${er}/apps/${Ee(r)}/caps`,{method:"POST"})).status!==kr.OK)throw new Error(`Failed to approve caps for app: ${Ee(r)}`);if((await fetch(`${er}/apps/${Ee(r)}`,{method:"POST"})).status!==kr.CREATED)throw new Error(`Failed to install app: ${Ee(r)}`)},updateApp:async r=>{if((await fetch(`${er}/apps/${Ee(r)}`,{method:"PUT"})).status!==kr.NO_CONTENT)throw new Error(`Failed to update app: ${Ee(r)}`)},uninstallApp:async r=>{if(!confirm(`Are you sure you want to remove ${Ee(r)}?`))return;if((await fetch(`${er}/apps/${Ee(r)}`,{method:"DELETE"})).status!==kr.NO_CONTENT)throw new Error(`Failed to remove app: ${Ee(r)}`);const i={...e().myApps},s=yf(r);i[s]=i[s].filter(a=>!cl(a,r));const o=e().listedApps.map(a=>cl(a,r)?{...a,state:void 0,installed:!1}:a);t({myApps:i,listedApps:o})},getListedApp:async r=>{const n=await fetch(`${er}/apps/listed/${r}`);if(n.status!==kr.OK)throw new Error(`Failed to get app: ${r}`);return await n.json()},downloadApp:async(r,n)=>{if((await fetch(`${er}/apps/listed/${Ee(r)}`,{method:"POST",body:JSON.stringify({download_from:n})})).status!==kr.CREATED)throw new Error(`Failed to get app: ${Ee(r)}`)},getCaps:async r=>{const n=await fetch(`${er}/apps/${Ee(r)}/caps`);if(n.status!==kr.OK)throw new Error(`Failed to get app: ${Ee(r)}`);return(await n.json())[0]},approveCaps:async r=>{if((await fetch(`${er}/apps/${Ee(r)}/caps`,{method:"POST"})).status!==kr.OK)throw new Error(`Failed to get app: ${Ee(r)}`)},rebuildIndex:async()=>{if((await fetch(`${er}/apps/rebuild-index`,{method:"POST"})).status!==kr.OK)throw new Error("Failed to rebuild index")},setMirroring:async(r,n)=>{if((await fetch(`${er}/apps/${Ee(r)}/mirror`,{method:n?"PUT":"DELETE"})).status!==kr.OK)throw new Error(`Failed to start mirror: ${Ee(r)}`);e().getMyApp(r)},setAutoUpdate:async(r,n)=>{if((await fetch(`${er}/apps/${Ee(r)}/auto-update`,{method:n?"PUT":"DELETE"})).status!==kr.OK)throw new Error(`Failed to change auto update: ${Ee(r)}`);e().getMyApp(r)},get:e,set:t}),{name:"app_store",storage:d2(()=>sessionStorage)}));var p2={exports:{}};/*! + */var Ku=j,z3=U3;function $3(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var H3=typeof Object.is=="function"?Object.is:$3,q3=z3.useSyncExternalStore,V3=Ku.useRef,G3=Ku.useEffect,W3=Ku.useMemo,K3=Ku.useDebugValue;j1.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var s=V3(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=W3(function(){function l(v){if(!u){if(u=!0,c=v,v=n(v),i!==void 0&&o.hasValue){var w=o.value;if(i(w,v))return h=w}return h=v}if(w=h,H3(c,v))return w;var b=n(v);return i!==void 0&&i(w,b)?w:(c=v,h=b)}var u=!1,c,h,p=r===void 0?null:r;return[function(){return l(e())},p===null?void 0:function(){return l(p())}]},[e,r,n,i]);var a=q3(t,s[0],s[1]);return G3(function(){o.hasValue=!0,o.value=a},[a]),K3(a),a};T1.exports=j1;var Q3=T1.exports;const Qu=Si(Q3),{useSyncExternalStoreWithSelector:J3}=Qu;function D1(t,e=t.getState,r){const n=J3(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return j.useDebugValue(n),n}const Dp=t=>{const e=typeof t=="function"?O1(t):t,r=(n,i)=>D1(e,n,i);return Object.assign(r,e),r},F1=t=>t?Dp(t):Dp;var Y3=t=>F1(t);const X3=Object.freeze(Object.defineProperty({__proto__:null,create:F1,createStore:O1,default:Y3,useStore:D1},Symbol.toStringTag,{value:"Module"})),Z3=Ys(X3);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createWeb3ReactStoreAndActions=t.MAX_SAFE_CHAIN_ID=void 0;const e=C3,r=Z3;t.MAX_SAFE_CHAIN_ID=0xfffffffffffec;function n(a){if(!Number.isInteger(a)||a<=0||a>t.MAX_SAFE_CHAIN_ID)throw new Error(`Invalid chainId ${a}`)}function i(a){return(0,e.getAddress)(a)}const s={chainId:void 0,accounts:void 0,activating:!1};function o(){const a=(0,r.createStore)()(()=>s);let l=0;function u(){const p=++l;return a.setState(Object.assign(Object.assign({},s),{activating:!0})),()=>{l===p&&a.setState({activating:!1})}}function c(p){if(p.chainId!==void 0&&n(p.chainId),p.accounts!==void 0)for(let v=0;v{var w,b;const k=(w=p.chainId)!==null&&w!==void 0?w:v.chainId,y=(b=p.accounts)!==null&&b!==void 0?b:v.accounts;let m=v.activating;return m&&k&&y&&(m=!1),{chainId:k,accounts:y,activating:m}})}function h(){l++,a.setState(s)}return[a,{startActivation:u,update:c,resetState:h}]}t.createWeb3ReactStoreAndActions=o})(N1);var eE={BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Fp=t=>{let e;const r=new Set,n=(l,u)=>{const c=typeof l=="function"?l(e):l;if(!Object.is(c,e)){const h=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,h))}},i=()=>e,a={setState:n,getState:i,subscribe:l=>(r.add(l),()=>r.delete(l)),destroy:()=>{(eE?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,a),a},qd=t=>t?Fp(t):Fp,{useSyncExternalStoreWithSelector:tE}=Qu;function U1(t,e=t.getState,r){const n=tE(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return j.useDebugValue(n),n}const Up=t=>{const e=typeof t=="function"?qd(t):t,r=(n,i)=>U1(e,n,i);return Object.assign(r,e),r},z1=t=>t?Up(t):Up;var rE=t=>z1(t);const nE=Object.freeze(Object.defineProperty({__proto__:null,create:z1,createStore:qd,default:rE,useStore:U1},Symbol.toStringTag,{value:"Module"})),iE=Ys(nE),{useSyncExternalStoreWithSelector:sE}=Qu;function $1(t,e=t.getState,r){const n=sE(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return j.useDebugValue(n),n}const zp=(t,e)=>{const r=qd(t),n=(i,s=e)=>$1(r,i,s);return Object.assign(n,r),n},oE=(t,e)=>t?zp(t,e):zp,aE=Object.freeze(Object.defineProperty({__proto__:null,createWithEqualityFn:oE,useStoreWithEqualityFn:$1},Symbol.toStringTag,{value:"Module"})),lE=Ys(aE),uE="properties/5.7.0";var cE=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const su=new O(uE);function H(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function mr(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function xt(t){return cE(this,void 0,void 0,function*(){const e=Object.keys(t).map(n=>{const i=t[n];return Promise.resolve(i).then(s=>({key:n,value:s}))});return(yield Promise.all(e)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function fE(t,e){(!t||typeof t!="object")&&su.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||su.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function at(t){const e={};for(const r in t)e[r]=t[r];return e}const hE={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function H1(t){if(t==null||hE[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rlr(e)));if(typeof t=="object"){const e={};for(const r in t){const n=t[r];n!==void 0&&H(e,r,lr(n))}return e}return su.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function lr(t){return dE(t)}class Ca{constructor(e){for(const r in e)this[r]=lr(e[r])}}const pE="abstract-provider/5.7.0";var mE=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const gE=new O(pE);class vE extends Ca{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class ro{constructor(){gE.checkAbstract(new.target,ro),H(this,"_isProvider",!0)}getFeeData(){return mE(this,void 0,void 0,function*(){const{block:e,gasPrice:r}=yield xt({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(o=>null)});let n=null,i=null,s=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,s=W.from("1500000000"),i=e.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:n,maxFeePerGas:i,maxPriorityFeePerGas:s,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}}const yE="networks/5.7.1",$p=new O(yE);function wE(t){return t&&typeof t.renetwork=="function"}function Cn(t){const e=function(r,n){n==null&&(n={});const i=[];if(r.InfuraProvider&&n.infura!=="-")try{i.push(new r.InfuraProvider(t,n.infura))}catch{}if(r.EtherscanProvider&&n.etherscan!=="-")try{i.push(new r.EtherscanProvider(t,n.etherscan))}catch{}if(r.AlchemyProvider&&n.alchemy!=="-")try{i.push(new r.AlchemyProvider(t,n.alchemy))}catch{}if(r.PocketProvider&&n.pocket!=="-"){const s=["goerli","ropsten","rinkeby","sepolia"];try{const o=new r.PocketProvider(t,n.pocket);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}}if(r.CloudflareProvider&&n.cloudflare!=="-")try{i.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&n.ankr!=="-")try{const s=["ropsten"],o=new r.AnkrProvider(t,n.ankr);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}if(i.length===0)return null;if(r.FallbackProvider){let s=1;return n.quorum!=null?s=n.quorum:t==="homestead"&&(s=2),new r.FallbackProvider(i,s)}return i[0]};return e.renetwork=function(r){return Cn(r)},e}function ou(t,e){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return r.renetwork=function(n){return ou(t,n)},r}const Hp={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Cn("homestead")},qp={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Cn("ropsten")},Vp={chainId:63,name:"classicMordor",_defaultProvider:ou("https://www.ethercluster.com/mordor","classicMordor")},Za={unspecified:{chainId:0,name:"unspecified"},homestead:Hp,mainnet:Hp,morden:{chainId:2,name:"morden"},ropsten:qp,testnet:qp,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Cn("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Cn("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Cn("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Cn("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:ou("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Vp,classicTestnet:Vp,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:ou("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Cn("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Cn("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Vd(t){if(t==null)return null;if(typeof t=="number"){for(const n in Za){const i=Za[n];if(i.chainId===t)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){const n=Za[t];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const e=Za[t.name];if(!e)return typeof t.chainId!="number"&&$p.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&$p.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(wE(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}function q1(t){t=atob(t);const e=[];for(let r=0;r0;)n.push(o%this.base),o=o/this.base|0}let i="";for(let s=0;r[s]===0&&s=0;--s)i+=this.alphabet[n[s]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let n=0;n>=8;for(;s>0;)r.push(s&255),s>>=8}for(let n=0;e[n]===this._leader&&n>6===2;o++)s++;return s}return t===hr.OVERRUN?r.length-e-1:0}function NE(t,e,r,n,i){return t===hr.OVERLONG?(n.push(i),0):(n.push(65533),Q1(t,e,r))}const ME=Object.freeze({error:kE,ignore:Q1,replace:NE});function J1(t,e){e==null&&(e=ME.error),t=oe(t);const r=[];let n=0;for(;n>7)){r.push(i);continue}let s=null,o=null;if((i&224)===192)s=1,o=127;else if((i&240)===224)s=2,o=2047;else if((i&248)===240)s=3,o=65535;else{(i&192)===128?n+=e(hr.UNEXPECTED_CONTINUE,n-1,t,r):n+=e(hr.BAD_PREFIX,n-1,t,r);continue}if(n-1+s>=t.length){n+=e(hr.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){n+=e(hr.OUT_OF_RANGE,n-1-s,t,r,a);continue}if(a>=55296&&a<=57343){n+=e(hr.UTF16_SURROGATE,n-1-s,t,r,a);continue}if(a<=o){n+=e(hr.OVERLONG,n-1-s,t,r,a);continue}r.push(a)}}return r}function yr(t,e=fa.current){e!=fa.current&&(K1.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return oe(r)}function CE(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Pa(t,e){return CE(J1(t,e))}function PE(t,e=fa.current){return J1(yr(t,e))}function Es(t){return ot(yr(t))}const Y1="hash/5.7.0";function X1(t,e){e==null&&(e=1);const r=[],n=r.forEach,i=function(s,o){n.call(s,function(a){o>0&&Array.isArray(a)?i(a,o-1):r.push(a)})};return i(t,e),r}function RE(t){const e={};for(let r=0;r>--l&1}const h=31,p=Math.pow(2,h),v=p>>>1,w=v>>1,b=p-1;let k=0;for(let L=0;L1;){let J=D+F>>>1;L>>1|c(),U=U<<1^v,G=(G^v)<<1|v|1;m=U,A=1+G-U}let T=n-4;return y.map(L=>{switch(L-T){case 3:return T+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return T+256+(t[a++]<<8|t[a++]);case 1:return T+t[a++];default:return L-1}})}function OE(t){let e=0;return()=>t[e++]}function TE(t){return OE(IE(t))}function jE(t){return t&1?~t>>1:t>>1}function LE(t,e){let r=Array(t);for(let n=0;ne[o]):r}function DE(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(UE(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(zE(r,t))}return RE(X1(e))}function FE(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function Z1(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[o].push(s));return n}function UE(t,e){let r=1+e(),n=e(),i=FE(e),s=Z1(i.length,1+t,e);return X1(s.map((o,a)=>{const l=o[0],u=o.slice(1);return Array(i[a]).fill(void 0).map((c,h)=>{let p=h*n;return[l+h*r,u.map(v=>v+p)]})}))}function zE(t,e){let r=1+e();return Z1(r,1+t,e).map(i=>[i[0],i.slice(1)])}function $E(t){let e=au(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=au(t,e);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,c)=>c.set.size-u.set.size);let i=t(),s=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let a=i==1,l=i==2;return{branches:n,valid:s,fe0f:o,save:a,check:l}}}function HE(){return TE(q1("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Ju=HE(),qE=new Set(au(Ju)),VE=new Set(au(Ju)),GE=DE(Ju),WE=$E(Ju),Wp=45,Kp=95;function ey(t){return PE(t)}function KE(t){return t.filter(e=>e!=65039)}function ty(t){for(let e of t.split(".")){let r=ey(e);try{for(let n=r.lastIndexOf(Kp)-1;n>=0;n--)if(r[n]!==Kp)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===Wp&&r[3]===Wp)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${e}": ${n.message}`)}}return t}function QE(t){return ty(JE(t,KE))}function JE(t,e){let r=ey(t).reverse(),n=[];for(;r.length;){let i=XE(r);if(i){n.push(...e(i));continue}let s=r.pop();if(qE.has(s)){n.push(s);continue}if(VE.has(s))continue;let o=GE[s];if(o){n.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return ty(YE(String.fromCodePoint(...n)))}function YE(t){return t.normalize("NFC")}function XE(t,e){var r;let n=WE,i,s,o=[],a=t.length;for(e&&(e.length=0);a;){let l=t[--a];if(n=(r=n.branches.find(u=>u.set.has(l)))===null||r===void 0?void 0:r.node,!n)break;if(n.save)s=l;else if(n.check&&l===s)break;o.push(l),n.fe0f&&(o.push(65039),a>0&&t[a-1]==65039&&a--),n.valid&&(i=o.slice(),n.valid==2&&i.splice(1,1),e&&e.push(...t.slice(a).reverse()),t.length=a)}return i}const ZE=new O(Y1),ry=new Uint8Array(32);ry.fill(0);function Qp(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function ny(t){const e=yr(QE(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return r.push(Qp(e.slice(n))),r}function kl(t){typeof t!="string"&&ZE.throwArgumentError("invalid ENS name; not a string","name",t);let e=ry;const r=ny(t);for(;r.length;)e=ot(zt([e,ot(r.pop())]));return ne(e)}function eA(t){return ne(zt(ny(t).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}var tA=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const ct=new O(Y1),iy=new Uint8Array(32);iy.fill(0);const rA=W.from(-1),sy=W.from(0),oy=W.from(1),nA=W.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function iA(t){const e=oe(t),r=e.length%32;return r?nr([e,iy.slice(r)]):ne(e)}const sA=gt(oy.toHexString(),32),oA=gt(sy.toHexString(),32),Jp={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},ef=["name","version","chainId","verifyingContract","salt"];function Yp(t){return function(e){return typeof e!="string"&&ct.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const aA={name:Yp("name"),version:Yp("version"),chainId:function(t){try{return W.from(t).toString()}catch{}return ct.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return vt(t).toLowerCase()}catch{}return ct.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=oe(t);if(e.length!==32)throw new Error("bad length");return ne(e)}catch{}return ct.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function tf(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=e[1]==="",n=parseInt(e[2]||"256");(n%8!==0||n>256||e[2]&&e[2]!==String(n))&&ct.throwArgumentError("invalid numeric width","type",t);const i=nA.mask(r?n-1:n),s=r?i.add(oy).mul(rA):sy;return function(o){const a=W.from(o);return(a.lt(s)||a.gt(i))&&ct.throwArgumentError(`value out-of-bounds for ${t}`,"value",o),gt(a.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&&ct.throwArgumentError("invalid bytes width","type",t),function(n){return oe(n).length!==r&&ct.throwArgumentError(`invalid length for ${t}`,"value",n),iA(n)}}}switch(t){case"address":return function(e){return gt(vt(e),32)};case"bool":return function(e){return e?sA:oA};case"bytes":return function(e){return ot(e)};case"string":return function(e){return Es(e)}}return null}function Xp(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}class cr{constructor(e){H(this,"types",Object.freeze(lr(e))),H(this,"_encoderCache",{}),H(this,"_types",{});const r={},n={},i={};Object.keys(e).forEach(a=>{r[a]={},n[a]=[],i[a]={}});for(const a in e){const l={};e[a].forEach(u=>{l[u.name]&&ct.throwArgumentError(`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(a)}`,"types",e),l[u.name]=!0;const c=u.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===a&&ct.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!tf(c)&&(n[c]||ct.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),n[c].push(a),r[a][c]=!0)})}const s=Object.keys(n).filter(a=>n[a].length===0);s.length===0?ct.throwArgumentError("missing primary type","types",e):s.length>1&&ct.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),H(this,"primaryType",s[0]);function o(a,l){l[a]&&ct.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),l[a]=!0,Object.keys(r[a]).forEach(u=>{n[u]&&(o(u,l),Object.keys(l).forEach(c=>{i[c][u]=!0}))}),delete l[a]}o(this.primaryType,{});for(const a in i){const l=Object.keys(i[a]);l.sort(),this._types[a]=Xp(a,e[a])+l.map(u=>Xp(u,e[u])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{const i=tf(e);if(i)return i}const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],s=this.getEncoder(i),o=parseInt(r[3]);return a=>{o>=0&&a.length!==o&&ct.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(ot)),ot(nr(l))}}const n=this.types[e];if(n){const i=Es(this._types[e]);return s=>{const o=n.map(({name:a,type:l})=>{const u=this.getEncoder(l)(s[a]);return this._types[l]?ot(u):u});return o.unshift(i),nr(o)}}return ct.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const r=this._types[e];return r||ct.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return ot(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if(tf(e))return n(e,r);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const o=i[1],a=parseInt(i[3]);return a>=0&&r.length!==a&&ct.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(l=>this._visit(o,l,n))}const s=this.types[e];return s?s.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,r[a],n),o),{}):ct.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new cr(e)}static getPrimaryType(e){return cr.from(e).primaryType}static hashStruct(e,r,n){return cr.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){const i=Jp[n];i||ct.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>ef.indexOf(n.name)-ef.indexOf(i.name)),cr.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return nr(["0x1901",cr.hashDomain(e),cr.from(r).hash(n)])}static hash(e,r,n){return ot(cr.encode(e,r,n))}static resolveNames(e,r,n,i){return tA(this,void 0,void 0,function*(){e=at(e);const s={};e.verifyingContract&&!me(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=cr.from(r);o.visit(n,(a,l)=>(a==="address"&&!me(l,20)&&(s[l]="0x"),l));for(const a in s)s[a]=yield i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),n=o.visit(n,(a,l)=>a==="address"&&s[l]?s[l]:l),{domain:e,value:n}})}static getPayload(e,r,n){cr.hashDomain(e);const i={},s=[];ef.forEach(l=>{const u=e[l];u!=null&&(i[l]=aA[l](u),s.push({name:l,type:Jp[l]}))});const o=cr.from(r),a=at(r);return a.EIP712Domain?ct.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):a.EIP712Domain=s,o.encode(n),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(n,(l,u)=>{if(l.match(/^bytes(\d*)/))return ne(oe(u));if(l.match(/^u?int/))return W.from(u).toString();switch(l){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return typeof u!="string"&&ct.throwArgumentError("invalid string","value",u),u}return ct.throwArgumentError("unsupported type","type",l)})}}}var ay={},xe={},Ra=ly;function ly(t,e){if(!t)throw new Error(e||"Assertion failed")}ly.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var _h={exports:{}};typeof Object.create=="function"?_h.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:_h.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var lA=_h.exports,uA=Ra,cA=lA;xe.inherits=cA;function fA(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function hA(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):fA(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}xe.htonl=uy;function pA(t,e){for(var r="",n=0;n>>0}return s}xe.join32=mA;function gA(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}xe.split32=gA;function vA(t,e){return t>>>e|t<<32-e}xe.rotr32=vA;function yA(t,e){return t<>>32-e}xe.rotl32=yA;function wA(t,e){return t+e>>>0}xe.sum32=wA;function xA(t,e,r){return t+e+r>>>0}xe.sum32_3=xA;function bA(t,e,r,n){return t+e+r+n>>>0}xe.sum32_4=bA;function EA(t,e,r,n,i){return t+e+r+n+i>>>0}xe.sum32_5=EA;function AA(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}xe.sum64=AA;function _A(t,e,r,n){var i=e+n>>>0,s=(i>>0}xe.sum64_hi=_A;function SA(t,e,r,n){var i=e+n;return i>>>0}xe.sum64_lo=SA;function kA(t,e,r,n,i,s,o,a){var l=0,u=e;u=u+n>>>0,l+=u>>0,l+=u>>0,l+=u>>0}xe.sum64_4_hi=kA;function NA(t,e,r,n,i,s,o,a){var l=e+n+s+a;return l>>>0}xe.sum64_4_lo=NA;function MA(t,e,r,n,i,s,o,a,l,u){var c=0,h=e;h=h+n>>>0,c+=h>>0,c+=h>>0,c+=h>>0,c+=h>>0}xe.sum64_5_hi=MA;function CA(t,e,r,n,i,s,o,a,l,u){var c=e+n+s+a+u;return c>>>0}xe.sum64_5_lo=CA;function PA(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}xe.rotr64_hi=PA;function RA(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}xe.rotr64_lo=RA;function IA(t,e,r){return t>>>r}xe.shr64_hi=IA;function OA(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}xe.shr64_lo=OA;var no={},Zp=xe,TA=Ra;function Yu(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}no.BlockHash=Yu;Yu.prototype.update=function(e,r){if(e=Zp.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Zp.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}bn.g0_256=FA;function UA(t){return dn(t,17)^dn(t,19)^t>>>10}bn.g1_256=UA;var Gs=xe,zA=no,$A=bn,rf=Gs.rotl32,go=Gs.sum32,HA=Gs.sum32_5,qA=$A.ft_1,my=zA.BlockHash,VA=[1518500249,1859775393,2400959708,3395469782];function yn(){if(!(this instanceof yn))return new yn;my.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Gs.inherits(yn,my);var GA=yn;yn.blockSize=512;yn.outSize=160;yn.hmacStrength=80;yn.padLength=64;yn.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),O5(e.length<=this.blockSize);for(var r=e.length;r{s[a.toLowerCase()]=o}):n.headers.keys().forEach(o=>{s[o.toLowerCase()]=n.headers.get(o)}),{headers:s,statusCode:n.status,statusMessage:n.statusText,body:oe(new Uint8Array(i))}})}var D5=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const Ur=new O(j5);function im(t){return new Promise(e=>{setTimeout(e,t)})}function ni(t,e){if(t==null)return null;if(typeof t=="string")return t;if(Fd(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return Pa(t)}catch{}return ne(t)}return t}function F5(t){return yr(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function U5(t,e,r){const n=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Ur.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i=typeof t=="object"?t.throttleCallback:null,s=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Ur.assertArgument(s>0&&s%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o=typeof t=="object"?!!t.errorPassThrough:!1,a={};let l=null;const u={method:"GET"};let c=!1,h=2*60*1e3;if(typeof t=="string")l=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Ur.throwArgumentError("missing URL","connection.url",t),l=t.url,typeof t.timeout=="number"&&t.timeout>0&&(h=t.timeout),t.headers)for(const y in t.headers)a[y.toLowerCase()]={key:y,value:String(t.headers[y])},["if-none-match","if-modified-since"].indexOf(y.toLowerCase())>=0&&(c=!0);if(u.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){l.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Ur.throwError("basic authentication requires a secure https url",O.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:t.user,password:"[REDACTED]"});const y=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+V1(yr(y))}}t.skipFetchSetup!=null&&(u.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(u.fetchOptions=at(t.fetchOptions))}const p=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),v=l?l.match(p):null;if(v)try{const y={statusCode:200,statusMessage:"OK",headers:{"content-type":v[1]||"text/plain"},body:v[2]?q1(v[3]):F5(v[3])};let m=y.body;return r&&(m=r(y.body,y)),Promise.resolve(m)}catch(y){Ur.throwError("processing response error",O.errors.SERVER_ERROR,{body:ni(v[1],v[2]),error:y,requestBody:null,requestMethod:"GET",url:l})}e&&(u.method="POST",u.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const w={};Object.keys(a).forEach(y=>{const m=a[y];w[m.key]=m.value}),u.headers=w;const b=function(){let y=null;return{promise:new Promise(function(T,L){h&&(y=setTimeout(()=>{y!=null&&(y=null,L(Ur.makeError("timeout",O.errors.TIMEOUT,{requestBody:ni(u.body,w["content-type"]),requestMethod:u.method,timeout:h,url:l})))},h))}),cancel:function(){y!=null&&(clearTimeout(y),y=null)}}}(),k=function(){return D5(this,void 0,void 0,function*(){for(let y=0;y=300)&&(b.cancel(),Ur.throwError("bad response",O.errors.SERVER_ERROR,{status:m.statusCode,headers:m.headers,body:ni(A,m.headers?m.headers["content-type"]:null),requestBody:ni(u.body,w["content-type"]),requestMethod:u.method,url:l})),r)try{const T=yield r(A,m);return b.cancel(),T}catch(T){if(T.throttleRetry&&y{let a=null;if(s!=null)try{a=JSON.parse(Pa(s))}catch(l){Ur.throwError("invalid JSON",O.errors.SERVER_ERROR,{body:s,error:l})}return r&&(a=r(a,o)),a},i=null;if(e!=null){i=yr(e);const s=typeof t=="string"?{url:t}:at(t);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=at(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},t=s}return U5(t,i,n)}function As(t,e){return e||(e={}),e=at(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,n){let i=null,s=!1;const o=()=>s?!1:(s=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{o()&&n(new Error("timeout"))},e.timeout));const a=e.retryLimit;let l=0;function u(){return t().then(function(c){if(c!==void 0)o()&&r(c);else if(e.oncePoll)e.oncePoll.once("poll",u);else if(e.onceBlock)e.onceBlock.once("block",u);else if(!s){if(l++,l>a){o()&&n(new Error("retry limit reached"));return}let h=e.interval*parseInt(String(Math.random()*Math.pow(2,l)));he.ceiling&&(h=e.ceiling),setTimeout(u,h)}return null},function(c){o()&&n(c)})}u()})}var lu="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Nh={};for(var tl=0;tl>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function ky(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=js(e)^n>>5}for(e=js(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=ky(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=js(n)^o,i+=lu.charAt(o)}for(s=0;s<6;++s)n=js(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=lu.charAt(a)}return i}function Ny(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var a=ky(s);if(typeof a=="string")return a;for(var l=[],u=0;u=o.length)&&l.push(h)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:l}}function $5(){var t=Ny.apply(null,arguments);if(typeof t=="object")return t}function H5(t){var e=Ny.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Xu(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<>8,p=c&255;h?l.push(h,p):l.push(p)}return l}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",l=0;l(p>>1)-1?b=(p>>1)-k:b=k,v.isubn(b)):b=0,h[w]=b,v.iushrn(1)}return h}r.getNAF=n;function i(l,u){var c=[[],[]];l=l.clone(),u=u.clone();for(var h=0,p=0,v;l.cmpn(-h)>0||u.cmpn(-p)>0;){var w=l.andln(3)+h&3,b=u.andln(3)+p&3;w===3&&(w=-1),b===3&&(b=-1);var k;w&1?(v=l.andln(7)+h&7,(v===3||v===5)&&b===2?k=-w:k=w):k=0,c[0].push(k);var y;b&1?(v=u.andln(7)+p&7,(v===3||v===5)&&w===2?y=-b:y=b):y=0,c[1].push(y),2*h===k+1&&(h=1-h),2*p===y+1&&(p=1-p),l.iushrn(1),u.iushrn(1)}return c}r.getJSF=i;function s(l,u,c){var h="_"+u;l.prototype[u]=function(){return this[h]!==void 0?this[h]:this[h]=c.call(this)}}r.cachedProperty=s;function o(l){return typeof l=="string"?r.toArray(l,"hex"):l}r.parseBytes=o;function a(l){return new ce(l,"hex","le")}r.intFromLE=a}),uu=br.getNAF,J5=br.getJSF,cu=br.assert;function Ci(t,e){this.type=t,this.p=new ce(e.p,16),this.red=e.prime?ce.red(e.prime):ce.mont(this.p),this.zero=new ce(0).toRed(this.red),this.one=new ce(1).toRed(this.red),this.two=new ce(2).toRed(this.red),this.n=e.n&&new ce(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var ts=Ci;Ci.prototype.point=function(){throw new Error("Not implemented")};Ci.prototype.validate=function(){throw new Error("Not implemented")};Ci.prototype._fixedNafMul=function(e,r){cu(e.precomputed);var n=e._getDoubles(),i=uu(r,1,this._bitLength),s=(1<=a;u--)l=(l<<1)+i[u];o.push(l)}for(var c=this.jpoint(null,null,null),h=this.jpoint(null,null,null),p=s;p>0;p--){for(a=0;a=0;l--){for(var u=0;l>=0&&o[l]===0;l--)u++;if(l>=0&&u++,a=a.dblp(u),l<0)break;var c=o[l];cu(c!==0),e.type==="affine"?c>0?a=a.mixedAdd(s[c-1>>1]):a=a.mixedAdd(s[-c-1>>1].neg()):c>0?a=a.add(s[c-1>>1]):a=a.add(s[-c-1>>1].neg())}return e.type==="affine"?a.toP():a};Ci.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,u=0,c,h,p;for(c=0;c=1;c-=2){var w=c-1,b=c;if(o[w]!==1||o[b]!==1){l[w]=uu(n[w],o[w],this._bitLength),l[b]=uu(n[b],o[b],this._bitLength),u=Math.max(l[w].length,u),u=Math.max(l[b].length,u);continue}var k=[r[w],null,null,r[b]];r[w].y.cmp(r[b].y)===0?(k[1]=r[w].add(r[b]),k[2]=r[w].toJ().mixedAdd(r[b].neg())):r[w].y.cmp(r[b].y.redNeg())===0?(k[1]=r[w].toJ().mixedAdd(r[b]),k[2]=r[w].add(r[b].neg())):(k[1]=r[w].toJ().mixedAdd(r[b]),k[2]=r[w].toJ().mixedAdd(r[b].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],m=J5(n[w],n[b]);for(u=Math.max(m[0].length,u),l[w]=new Array(u),l[b]=new Array(u),h=0;h=0;c--){for(var F=0;c>=0;){var U=!0;for(h=0;h=0&&F++,L=L.dblp(F),c<0)break;for(h=0;h0?p=a[h][G-1>>1]:G<0&&(p=a[h][-G-1>>1].neg()),p.type==="affine"?L=L.mixedAdd(p):L=L.add(p))}}for(c=0;c=Math.ceil((e.bitLength()+1)/r.step):!1};Tr.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(v=u,w=c),h.negative&&(h=h.neg(),p=p.neg()),v.negative&&(v=v.neg(),w=w.neg()),[{a:h,b:p},{a:v,b:w}]};jr.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),l=o.mul(i.a),u=s.mul(n.b),c=o.mul(i.b),h=e.sub(a).sub(l),p=u.add(c).neg();return{k1:h,k2:p}};jr.prototype.pointFromX=function(e,r){e=new ce(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};jr.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};jr.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Ct.prototype.isInfinity=function(){return this.inf};Ct.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Ct.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Ct.prototype.getX=function(){return this.x.fromRed()};Ct.prototype.getY=function(){return this.y.fromRed()};Ct.prototype.mul=function(e){return e=new ce(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Ct.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Ct.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Ct.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Ct.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Ct.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Lt(t,e,r,n){ts.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ce(0)):(this.x=new ce(e,16),this.y=new ce(r,16),this.z=new ce(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Wd(Lt,ts.BasePoint);jr.prototype.jpoint=function(e,r,n){return new Lt(this,e,r,n)};Lt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Lt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Lt.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),l=i.redSub(s),u=o.redSub(a);if(l.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=l.redSqr(),h=c.redMul(l),p=i.redMul(c),v=u.redSqr().redIAdd(h).redISub(p).redISub(p),w=u.redMul(p.redISub(v)).redISub(o.redMul(h)),b=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(v,w,b)};Lt.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),l=s.redSub(o);if(a.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),h=n.redMul(u),p=l.redSqr().redIAdd(c).redISub(h).redISub(h),v=l.redMul(h.redISub(p)).redISub(s.redMul(c)),w=this.z.redMul(a);return this.curve.jpoint(p,v,w)};Lt.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}};Lt.prototype.inspect=function(){return this.isInfinity()?"":""};Lt.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Nl=oo(function(t,e){var r=e;r.base=ts,r.short=X5,r.mont=null,r.edwards=null}),Ml=oo(function(t,e){var r=e,n=br.assert;function i(a){a.type==="short"?this.curve=new Nl.short(a):a.type==="edwards"?this.curve=new Nl.edwards(a):this.curve=new Nl.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,l){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var u=new i(l);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:u}),u}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:nn.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:nn.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:nn.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:nn.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:nn.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:nn.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:nn.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:nn.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function _i(t){if(!(this instanceof _i))return new _i(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Gr.toArray(t.entropy,t.entropyEnc||"hex"),r=Gr.toArray(t.nonce,t.nonceEnc||"hex"),n=Gr.toArray(t.pers,t.persEnc||"hex");Gd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Cy=_i;_i.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};_i.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Gr.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var Z5=br.assert;function Zu(t,e){if(t instanceof Zu)return t;this._importDER(t,e)||(Z5(t.r&&t.s,"Signature without r or s"),this.r=new ce(t.r,16),this.s=new ce(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var ec=Zu;function e4(){this.place=0}function af(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function om(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Zu.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=om(r),n=om(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];lf(i,r.length),i=i.concat(r),i.push(2),lf(i,n.length);var s=i.concat(n),o=[48];return lf(o,s.length),o=o.concat(s),br.encode(o,e)};var t4=function(){throw new Error("unsupported")},Py=br.assert;function Or(t){if(!(this instanceof Or))return new Or(t);typeof t=="string"&&(Py(Object.prototype.hasOwnProperty.call(Ml,t),"Unknown curve "+t),t=Ml[t]),t instanceof Ml.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var r4=Or;Or.prototype.keyPair=function(e){return new Kd(this,e)};Or.prototype.keyFromPrivate=function(e,r){return Kd.fromPrivate(this,e,r)};Or.prototype.keyFromPublic=function(e,r){return Kd.fromPublic(this,e,r)};Or.prototype.genKeyPair=function(e){e||(e={});for(var r=new Cy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||t4(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ce(2));;){var s=new ce(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};Or.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Or.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new ce(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),l=new Cy({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new ce(1)),c=0;;c++){var h=i.k?i.k(c):new ce(l.generate(this.n.byteLength()));if(h=this._truncateToN(h,!0),!(h.cmpn(1)<=0||h.cmp(u)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var v=p.getX(),w=v.umod(this.n);if(w.cmpn(0)!==0){var b=h.invm(this.n).mul(w.mul(r.getPrivate()).iadd(e));if(b=b.umod(this.n),b.cmpn(0)!==0){var k=(p.getY().isOdd()?1:0)|(v.cmp(w)!==0?2:0);return i.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),k^=1),new ec({r:w,s:b,recoveryParam:k})}}}}}};Or.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ce(e,16)),n=this.keyFromPublic(n,i),r=new ec(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),l=a.mul(e).umod(this.n),u=a.mul(s).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(l,n.getPublic(),u),c.isInfinity()?!1:c.eqXToP(s)):(c=this.g.mulAdd(l,n.getPublic(),u),c.isInfinity()?!1:c.getX().umod(this.n).cmp(s)===0)};Or.prototype.recoverPubKey=function(t,e,r,n){Py((3&r)===r,"The recovery param is more than two bits"),e=new ec(e,n);var i=this.n,s=new ce(t),o=e.r,a=e.s,l=r&1,u=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var c=e.r.invm(i),h=i.sub(s).mul(c).umod(i),p=a.mul(c).umod(i);return this.g.mulAdd(h,o,p)};Or.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new ec(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var n4=oo(function(t,e){var r=e;r.version="6.5.4",r.utils=br,r.rand=function(){throw new Error("unsupported")},r.curve=Nl,r.curves=Ml,r.ec=r4,r.eddsa=null}),i4=n4.ec;const s4="signing-key/5.7.0",Ch=new O(s4);let uf=null;function on(){return uf||(uf=new i4("secp256k1")),uf}class o4{constructor(e){H(this,"curve","secp256k1"),H(this,"privateKey",ne(e)),zn(this.privateKey)!==32&&Ch.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=on().keyFromPrivate(oe(this.privateKey));H(this,"publicKey","0x"+r.getPublic(!1,"hex")),H(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),H(this,"_isSigningKey",!0)}_addPoint(e){const r=on().keyFromPublic(oe(this.publicKey)),n=on().keyFromPublic(oe(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=on().keyFromPrivate(oe(this.privateKey)),n=oe(e);n.length!==32&&Ch.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Gu({recoveryParam:i.recoveryParam,r:gt("0x"+i.r.toString(16),32),s:gt("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=on().keyFromPrivate(oe(this.privateKey)),n=on().keyFromPublic(oe(Ry(e)));return gt("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function a4(t,e){const r=Gu(e),n={r:oe(r.r),s:oe(r.s)};return"0x"+on().recoverPubKey(oe(t),n,r.recoveryParam).encode("hex",!1)}function Ry(t,e){const r=oe(t);if(r.length===32){const n=new o4(r);return e?"0x"+on().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?ne(r):"0x"+on().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+on().keyFromPublic(r).getPublic(!0,"hex"):ne(r)}return Ch.throwArgumentError("invalid public or private key","key","[REDACTED]")}const l4="transactions/5.7.0",Vn=new O(l4);var am;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(am||(am={}));function Qd(t){return t==="0x"?null:vt(t)}function Ut(t){return t==="0x"?W1:W.from(t)}function u4(t){const e=Ry(t);return vt(Ot(ot(Ot(e,1)),12))}function Iy(t,e){return u4(a4(oe(t),e))}function dr(t,e){const r=qs(W.from(t).toHexString());return r.length>32&&Vn.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function cf(t,e){return{address:vt(t),storageKeys:(e||[]).map((r,n)=>(zn(r)!==32&&Vn.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,r),r.toLowerCase()))}}function rs(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(r.length>2&&Vn.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${n}]`,r),cf(r[0],r[1])):cf(r.address,r.storageKeys));const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,s)=>(i[s]=!0,i),{});return cf(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function Oy(t){return rs(t).map(e=>[e.address,e.storageKeys])}function c4(t,e){if(t.gasPrice!=null){const n=W.from(t.gasPrice),i=W.from(t.maxFeePerGas||0);n.eq(i)||Vn.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:i})}const r=[dr(t.chainId||0,"chainId"),dr(t.nonce||0,"nonce"),dr(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),dr(t.maxFeePerGas||0,"maxFeePerGas"),dr(t.gasLimit||0,"gasLimit"),t.to!=null?vt(t.to):"0x",dr(t.value||0,"value"),t.data||"0x",Oy(t.accessList||[])];if(e){const n=Gu(e);r.push(dr(n.recoveryParam,"recoveryParam")),r.push(qs(n.r)),r.push(qs(n.s))}return nr(["0x02",Wu(r)])}function f4(t,e){const r=[dr(t.chainId||0,"chainId"),dr(t.nonce||0,"nonce"),dr(t.gasPrice||0,"gasPrice"),dr(t.gasLimit||0,"gasLimit"),t.to!=null?vt(t.to):"0x",dr(t.value||0,"value"),t.data||"0x",Oy(t.accessList||[])];if(e){const n=Gu(e);r.push(dr(n.recoveryParam,"recoveryParam")),r.push(qs(n.r)),r.push(qs(n.s))}return nr(["0x01",Wu(r)])}function Ty(t,e,r){try{const n=Ut(e[0]).toNumber();if(n!==0&&n!==1)throw new Error("bad recid");t.v=n}catch{Vn.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=gt(e[1],32),t.s=gt(e[2],32);try{const n=ot(r(t));t.from=Iy(n,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function h4(t){const e=zd(t.slice(1));e.length!==9&&e.length!==12&&Vn.throwArgumentError("invalid component count for transaction type: 2","payload",ne(t));const r=Ut(e[2]),n=Ut(e[3]),i={type:2,chainId:Ut(e[0]).toNumber(),nonce:Ut(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:Ut(e[4]),to:Qd(e[5]),value:Ut(e[6]),data:e[7],accessList:rs(e[8])};return e.length===9||(i.hash=ot(t),Ty(i,e.slice(9),c4)),i}function d4(t){const e=zd(t.slice(1));e.length!==8&&e.length!==11&&Vn.throwArgumentError("invalid component count for transaction type: 1","payload",ne(t));const r={type:1,chainId:Ut(e[0]).toNumber(),nonce:Ut(e[1]).toNumber(),gasPrice:Ut(e[2]),gasLimit:Ut(e[3]),to:Qd(e[4]),value:Ut(e[5]),data:e[6],accessList:rs(e[7])};return e.length===8||(r.hash=ot(t),Ty(r,e.slice(8),f4)),r}function p4(t){const e=zd(t);e.length!==9&&e.length!==6&&Vn.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:Ut(e[0]).toNumber(),gasPrice:Ut(e[1]),gasLimit:Ut(e[2]),to:Qd(e[3]),value:Ut(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=W.from(e[6]).toNumber()}catch{return r}if(r.r=gt(e[7],32),r.s=gt(e[8],32),W.from(r.r).isZero()&&W.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);r.chainId!==0&&(i.push(ne(r.chainId)),i.push("0x"),i.push("0x"),n-=r.chainId*2+8);const s=ot(Wu(i));try{r.from=Iy(s,{r:ne(r.r),s:ne(r.s),recoveryParam:n})}catch{}r.hash=ot(t)}return r.type=null,r}function m4(t){const e=oe(t);if(e[0]>127)return p4(e);switch(e[0]){case 1:return d4(e);case 2:return h4(e)}return Vn.throwError(`unsupported transaction type: ${e[0]}`,O.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const yo=new O(qt);class Z{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},r=this.address.bind(this),n=this.bigNumber.bind(this),i=this.blockTag.bind(this),s=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),l=this.number.bind(this),u=this.type.bind(this),c=h=>this.data(h,!0);return e.transaction={hash:o,type:u,accessList:Z.allowNull(this.accessList.bind(this),null),blockHash:Z.allowNull(o,null),blockNumber:Z.allowNull(l,null),transactionIndex:Z.allowNull(l,null),confirmations:Z.allowNull(l,null),from:r,gasPrice:Z.allowNull(n),maxPriorityFeePerGas:Z.allowNull(n),maxFeePerGas:Z.allowNull(n),gasLimit:n,to:Z.allowNull(r,null),value:n,nonce:l,data:s,r:Z.allowNull(this.uint256),s:Z.allowNull(this.uint256),v:Z.allowNull(l),creates:Z.allowNull(r,null),raw:Z.allowNull(s)},e.transactionRequest={from:Z.allowNull(r),nonce:Z.allowNull(l),gasLimit:Z.allowNull(n),gasPrice:Z.allowNull(n),maxPriorityFeePerGas:Z.allowNull(n),maxFeePerGas:Z.allowNull(n),to:Z.allowNull(r),value:Z.allowNull(n),data:Z.allowNull(c),type:Z.allowNull(l),accessList:Z.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:l,blockNumber:l,transactionHash:o,address:r,topics:Z.arrayOf(o),data:s,logIndex:l,blockHash:o},e.receipt={to:Z.allowNull(this.address,null),from:Z.allowNull(this.address,null),contractAddress:Z.allowNull(r,null),transactionIndex:l,root:Z.allowNull(a),gasUsed:n,logsBloom:Z.allowNull(s),blockHash:o,transactionHash:o,logs:Z.arrayOf(this.receiptLog.bind(this)),blockNumber:l,confirmations:Z.allowNull(l,null),cumulativeGasUsed:n,effectiveGasPrice:Z.allowNull(n),status:Z.allowNull(l),type:u},e.block={hash:Z.allowNull(o),parentHash:o,number:l,timestamp:l,nonce:Z.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:Z.allowNull(r),extraData:s,transactions:Z.allowNull(Z.arrayOf(o)),baseFeePerGas:Z.allowNull(n)},e.blockWithTransactions=at(e.block),e.blockWithTransactions.transactions=Z.allowNull(Z.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:Z.allowNull(i,void 0),toBlock:Z.allowNull(i,void 0),blockHash:Z.allowNull(o,void 0),address:Z.allowNull(r,void 0),topics:Z.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:Z.allowNull(l),blockHash:Z.allowNull(o),transactionIndex:l,removed:Z.allowNull(this.boolean.bind(this)),address:r,data:Z.allowFalsish(s,"0x"),topics:Z.arrayOf(o),transactionHash:o,logIndex:l},e}accessList(e){return rs(e||[])}number(e){return e==="0x"?0:W.from(e).toNumber()}type(e){return e==="0x"||e==null?0:W.from(e).toNumber()}bigNumber(e){return W.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),me(e))?e.toLowerCase():yo.throwArgumentError("invalid hash","value",e)}data(e,r){const n=this.hex(e,r);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return vt(e)}callAddress(e){if(!me(e,32))return null;const r=vt(Ot(e,12));return r===xE?null:r}contractAddress(e){return Hd(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||me(e))return Vu(e);throw new Error("invalid blockTag")}hash(e,r){const n=this.hex(e,r);return zn(n)!==32?yo.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(e==null)return null;const r=W.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!me(e))throw new Error("invalid uint256");return gt(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);const n=e._difficulty!=null?e._difficulty:e.difficulty,i=Z.check(r,e);return i._difficulty=n==null?null:W.from(n),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return Z.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&W.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const r=Z.check(this.formats.transaction,e);if(e.chainId!=null){let n=e.chainId;me(n)&&(n=W.from(n).toNumber()),r.chainId=n}else{let n=e.networkId;n==null&&r.v==null&&(n=e.chainId),me(n)&&(n=W.from(n).toNumber()),typeof n!="number"&&r.v!=null&&(n=(r.v-35)/2,n<0&&(n=0),n=parseInt(n)),typeof n!="number"&&(n=0),r.chainId=n}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return m4(e)}receiptLog(e){return Z.check(this.formats.receiptLog,e)}receipt(e){const r=Z.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){const n=W.from(r.root).toNumber();n===0||n===1?(r.status!=null&&r.status!==n&&yo.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):yo.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&yo.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return Z.check(this.formats.filter,e)}filterLog(e){return Z.check(this.formats.filterLog,e)}static check(e,r){const n={};for(const i in e)try{const s=e[i](r[i]);s!==void 0&&(n[i]=s)}catch(s){throw s.checkKey=i,s.checkValue=r[i],s}return n}static allowNull(e,r){return function(n){return n==null?r:e(n)}}static allowFalsish(e,r){return function(n){return n?e(n):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");const n=[];return r.forEach(function(i){n.push(e(i))}),n}}}function jy(t){return t&&typeof t.isCommunityResource=="function"}function Ph(t){return jy(t)&&t.isCommunityResource()}let lm=!1;function Oa(){lm||(lm=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var le=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const pe=new O(qt),g4=10;function um(t){return t==null?"null":(zn(t)!==32&&pe.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function cm(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){const r={};e.forEach(i=>{r[um(i)]=!0});const n=Object.keys(r);return n.sort(),n.join("|")}else return um(e)}).join("&")}function v4(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];const r=e.split("|").map(n=>n==="null"?null:n);return r.length===1?r[0]:r})}function is(t){if(typeof t=="string"){if(t=t.toLowerCase(),zn(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+cm(t);if(vE.isForkEvent(t))throw pe.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+cm(t.topics||[])}throw new Error("invalid event - "+t)}function wo(){return new Date().getTime()}function fm(t){return new Promise(e=>{setTimeout(e,t)})}const y4=["block","network","pending","poll"];class w4{constructor(e,r,n){H(this,"tag",e),H(this,"listener",r),H(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const r=e[1],n=v4(e[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||y4.indexOf(this.tag)>=0}}const x4={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function ff(t){return gt(W.from(t).toHexString(),32)}function hm(t){return Ah.encode(zt([t,Ot(nm(nm(t)),0,4)]))}const Ly=new RegExp("^(ipfs)://(.*)$","i"),dm=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Ly,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Cl(t,e){try{return Pa(ha(t,e))}catch{}return null}function ha(t,e){if(t==="0x")return null;const r=W.from(Ot(t,e,e+32)).toNumber(),n=W.from(Ot(t,r,r+32)).toNumber();return Ot(t,r+32,r+32+n)}function hf(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):pe.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function pm(t){const e=oe(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function b4(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function By(t){const e=[];let r=0;for(let n=0;nW.from(e).eq(1)).catch(e=>{if(e.code===O.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return le(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:nr([e,kl(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=nr(["0x9061b923",By([eA(this.name),n.data])]));try{let s=yield this.provider.call(n);return oe(s).length%32===4&&pe.throwError("resolver threw error",O.errors.CALL_EXCEPTION,{transaction:n,data:s}),i&&(s=ha(s,0)),s}catch(s){if(s.code===O.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,r){return le(this,void 0,void 0,function*(){const n=yield this._fetch(e,r);return n!=null?ha(n,0):null})}_getAddress(e,r){const n=x4[String(e)];if(n==null&&pe.throwError(`unsupported coin type: ${e}`,O.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),n.ilk==="eth")return this.provider.formatter.address(r);const i=oe(r);if(n.p2pkh!=null){const s=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return hm(zt([[n.p2pkh],"0x"+s[2]]))}}if(n.p2sh!=null){const s=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return hm(zt([[n.p2sh],"0x"+s[2]]))}}if(n.prefix!=null){const s=i[1];let o=i[0];if(o===0?s!==20&&s!==32&&(o=-1):o=-1,o>=0&&i.length===2+s&&s>=1&&s<=75){const a=sm.toWords(i.slice(2));return a.unshift(o),sm.encode(n.prefix,a)}}return null}getAddress(e){return le(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===_E?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===O.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",ff(e));if(r==null||r==="0x")return null;const n=this._getAddress(e,r);return n==null&&pe.throwError("invalid or unsupported coin data",O.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),n})}getAvatar(){return le(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const r=yield this.getText("avatar");if(r==null)return null;for(let n=0;no[l])}return pe.throwError("invalid or unsupported content hash data",O.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return le(this,void 0,void 0,function*(){let r=yr(e);r=zt([ff(64),ff(r.length),r]),r.length%32!==0&&(r=zt([r,gt("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",ne(r));return n==null||n==="0x"?null:Pa(n)})}}let df=null,E4=1;class tc extends ro{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),H(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{const r=mr(new.target,"getNetwork")(e);r?(H(this,"_network",r),this.emit("network",r,null)):pe.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return le(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||pe.throwError("no network detected",O.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:H(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return As(()=>this._ready().then(e=>e,e=>{if(!(e.code===O.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return df==null&&(df=new Z),df}static getNetwork(e){return Vd(e??"homestead")}ccipReadFetch(e,r,n){return le(this,void 0,void 0,function*(){if(this.disableCcipRead||n.length===0)return null;const i=e.to.toLowerCase(),s=r.toLowerCase(),o=[];for(let a=0;a=0?null:JSON.stringify({data:s,sender:i}),h=yield Ia({url:u,errorPassThrough:!0},c,(v,w)=>(v.status=w.statusCode,v));if(h.data)return h.data;const p=h.message||"unknown error";if(h.status>=400&&h.status<500)return pe.throwError(`response not found during CCIP fetch: ${p}`,O.errors.SERVER_ERROR,{url:l,errorMessage:p});o.push(p)}return pe.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,O.errors.SERVER_ERROR,{urls:n,errorMessages:o})})}_getInternalBlockNumber(e){return le(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const s=yield i;if(wo()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=wo(),n=xt({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:s})=>{if(s)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),s;const o=wo();return i=W.from(i).toNumber(),i{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return le(this,void 0,void 0,function*(){const e=E4++,r=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)pe.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",pe.makeError("network block skew detected",O.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let i=this._emitted.block+1;i<=n;i++)this.emit("block",i);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const s=this._emitted[i];s!=="pending"&&n-s>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=n-1),this._events.forEach(i=>{switch(i.type){case"tx":{const s=i.hash;let o=this.getTransactionReceipt(s).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+s]=a.blockNumber,this.emit(s,a)),null)).catch(a=>{this.emit("error",a)});r.push(o);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=n-1);const s=i.filter;s.fromBlock=i._lastBlockNumber+1,s.toBlock=n;const o=s.toBlock-this._maxFilterBlockRange;o>s.fromBlock&&(s.fromBlock=o),s.fromBlock<0&&(s.fromBlock=0);const a=this.getLogs(s).then(l=>{i._inflight=!1,l.length!==0&&l.forEach(u=>{u.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=u.blockNumber),this._emitted["b:"+u.blockHash]=u.blockNumber,this._emitted["t:"+u.transactionHash]=u.blockNumber,this.emit(s,u)})}).catch(l=>{this.emit("error",l),i._inflight=!1});r.push(a)}break}}}),this._lastBlockNumber=n,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return le(this,void 0,void 0,function*(){return pe.throwError("provider does not support network detection",O.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return le(this,void 0,void 0,function*(){const e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield fm(0),this._network;const n=pe.makeError("underlying network changed",O.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",n),n}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=wo();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,n){return le(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,n||0,null)})}_waitForTransaction(e,r,n,i){return le(this,void 0,void 0,function*(){const s=yield this.getTransactionReceipt(e);return(s?s.confirmations:0)>=r?s:new Promise((o,a)=>{const l=[];let u=!1;const c=function(){return u?!0:(u=!0,l.forEach(p=>{p()}),!1)},h=p=>{p.confirmations{this.removeListener(e,h)}),i){let p=i.startBlock,v=null;const w=b=>le(this,void 0,void 0,function*(){u||(yield fm(1e3),this.getTransactionCount(i.from).then(k=>le(this,void 0,void 0,function*(){if(!u){if(k<=i.nonce)p=b;else{{const y=yield this.getTransaction(e);if(y&&y.blockNumber!=null)return}for(v==null&&(v=p-3,v{u||this.once("block",w)}))});if(u)return;this.once("block",w),l.push(()=>{this.removeListener("block",w)})}if(typeof n=="number"&&n>0){const p=setTimeout(()=>{c()||a(pe.makeError("timeout exceeded",O.errors.TIMEOUT,{timeout:n}))},n);p.unref&&p.unref(),l.push(()=>{clearTimeout(p)})}})})}getBlockNumber(){return le(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return le(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return W.from(e)}catch(r){return pe.throwError("bad result from backend",O.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return le(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield xt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getBalance",n);try{return W.from(i)}catch(s){return pe.throwError("bad result from backend",O.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:s})}})}getTransactionCount(e,r){return le(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield xt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getTransactionCount",n);try{return W.from(i).toNumber()}catch(s){return pe.throwError("bad result from backend",O.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:s})}})}getCode(e,r){return le(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield xt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getCode",n);try{return ne(i)}catch(s){return pe.throwError("bad result from backend",O.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:s})}})}getStorageAt(e,r,n){return le(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield xt({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(r).then(o=>Vu(o))}),s=yield this.perform("getStorageAt",i);try{return ne(s)}catch(o){return pe.throwError("bad result from backend",O.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,r,n){if(r!=null&&zn(r)!==32)throw new Error("invalid response - sendTransaction");const i=e;return r!=null&&e.hash!==r&&pe.throwError("Transaction hash mismatch from Provider.sendTransaction.",O.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),i.wait=(s,o)=>le(this,void 0,void 0,function*(){s==null&&(s=1),o==null&&(o=0);let a;s!==0&&n!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const l=yield this._waitForTransaction(e.hash,s,o,a);return l==null&&s===0?null:(this._emitted["t:"+e.hash]=l.blockNumber,l.status===0&&pe.throwError("transaction failed",O.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return le(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Promise.resolve(e).then(s=>ne(s)),n=this.formatter.transaction(e);n.confirmations==null&&(n.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const s=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(n,s,i)}catch(s){throw s.transaction=n,s.transactionHash=n.hash,s}})}_getTransactionRequest(e){return le(this,void 0,void 0,function*(){const r=yield e,n={};return["from","to"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s?this._getAddress(s):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s?W.from(s):null))}),["type"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s??null))}),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s?ne(s):null))}),this.formatter.transactionRequest(yield xt(n))})}_getFilter(e){return le(this,void 0,void 0,function*(){e=yield e;const r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(n=>{e[n]!=null&&(r[n]=e[n])}),["fromBlock","toBlock"].forEach(n=>{e[n]!=null&&(r[n]=this._getBlockTag(e[n]))}),this.formatter.filter(yield xt(r))})}_call(e,r,n){return le(this,void 0,void 0,function*(){n>=g4&&pe.throwError("CCIP read exceeded maximum redirections",O.errors.SERVER_ERROR,{redirects:n,transaction:e});const i=e.to,s=yield this.perform("call",{transaction:e,blockTag:r});if(n>=0&&r==="latest"&&i!=null&&s.substring(0,10)==="0x556f1830"&&zn(s)%32===4)try{const o=Ot(s,4),a=Ot(o,0,32);W.from(a).eq(i)||pe.throwError("CCIP Read sender did not match",O.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],u=W.from(Ot(o,32,64)).toNumber(),c=W.from(Ot(o,u,u+32)).toNumber(),h=Ot(o,u+32);for(let y=0;yle(this,void 0,void 0,function*(){const s=yield this.perform("getBlock",i);if(s==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&n>this._emitted.block?null:void 0;if(r){let o=null;for(let l=0;lthis._wrapTransaction(l)),a}return this.formatter.block(s)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return le(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return As(()=>le(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return le(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return As(()=>le(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;if(n.blockHash==null)return;const i=this.formatter.receipt(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return i}),{oncePoll:this})})}getLogs(e){return le(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield xt({filter:this._getFilter(e)}),n=yield this.perform("getLogs",r);return n.forEach(i=>{i.removed==null&&(i.removed=!1)}),Z.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return le(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return le(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&pe.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return le(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const n=yield this._getResolver(r,"getResolver");if(n!=null){const i=new Rh(this,n,e);return r!==e&&!(yield i.supportsWildcard())?null:i}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return le(this,void 0,void 0,function*(){r==null&&(r="ENS");const n=yield this.getNetwork();n.ensAddress||pe.throwError("network does not support ENS",O.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+kl(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return le(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if(me(e))throw n}typeof e!="string"&&pe.throwArgumentError("invalid ENS name","name",e);const r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return le(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const r=e.substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"lookupAddress");if(n==null)return null;const i=Cl(yield this.call({to:n,data:"0x691f3431"+kl(r).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return le(this,void 0,void 0,function*(){let r=null;if(me(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;r=new Rh(this,o,s);try{const a=yield r.getAvatar();if(a)return a.url}catch(a){if(a.code!==O.errors.CALL_EXCEPTION)throw a}try{const a=Cl(yield this.call({to:o,data:"0x691f3431"+kl(s).substring(2)}),0);r=yield this.getResolver(a)}catch(a){if(a.code!==O.errors.CALL_EXCEPTION)throw a;return null}}else if(r=yield this.getResolver(e),!r)return null;const n=yield r.getAvatar();return n==null?null:n.url})}perform(e,r){return pe.throwError(e+" not implemented",O.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,n){const i=new w4(is(e),r,n);return this._events.push(i),this._startEvent(i),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let n=!1,i=[],s=is(e);return this._events=this._events.filter(o=>o.tag!==s?!0:(setTimeout(()=>{o.listener.apply(this,r)},0),n=!0,o.once?(i.push(o),!1):!0)),i.forEach(o=>{this._stopEvent(o)}),n}listenerCount(e){if(!e)return this._events.length;let r=is(e);return this._events.filter(n=>n.tag===r).length}listeners(e){if(e==null)return this._events.map(n=>n.listener);let r=is(e);return this._events.filter(n=>n.tag===r).map(n=>n.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);const n=[];let i=!1,s=is(e);return this._events=this._events.filter(o=>o.tag!==s||o.listener!=r||i?!0:(i=!0,n.push(o),!1)),n.forEach(o=>{this._stopEvent(o)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{const n=is(e);this._events=this._events.filter(i=>i.tag!==n?!0:(r.push(i),!1))}return r.forEach(n=>{this._stopEvent(n)}),this}}const A4="abstract-signer/5.7.0";var Fr=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const Sr=new O(A4),_4=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],S4=[O.errors.INSUFFICIENT_FUNDS,O.errors.NONCE_EXPIRED,O.errors.REPLACEMENT_UNDERPRICED];class Ta{constructor(){Sr.checkAbstract(new.target,Ta),H(this,"_isSigner",!0)}getBalance(e){return Fr(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Fr(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Fr(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const r=yield xt(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Fr(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield xt(this.checkTransaction(e));return yield this.provider.call(n,r)})}sendTransaction(e){return Fr(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(e),n=yield this.signTransaction(r);return yield this.provider.sendTransaction(n)})}getChainId(){return Fr(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Fr(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Fr(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Fr(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const n in e)_4.indexOf(n)===-1&&Sr.throwArgumentError("invalid transaction key: "+n,"transaction",e);const r=at(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(n=>(n[0].toLowerCase()!==n[1].toLowerCase()&&Sr.throwArgumentError("from address mismatch","transaction",e),n[0])),r}populateTransaction(e){return Fr(this,void 0,void 0,function*(){const r=yield xt(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Fr(this,void 0,void 0,function*(){if(i==null)return null;const s=yield this.resolveName(i);return s==null&&Sr.throwArgumentError("provided ENS name resolves to null","tx.to",i),s})),r.to.catch(i=>{}));const n=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||n)?Sr.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&n&&Sr.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const s=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=s,r.maxPriorityFeePerGas=s}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(n&&Sr.throwError("network does not support EIP-1559",O.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):Sr.throwError("failed to get consistent fee data",O.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(S4.indexOf(i.code)>=0)throw i;return Sr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",O.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Sr.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield xt(r)})}_checkProvider(e){this.provider||Sr.throwError("missing provider",O.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class Jd extends Ta{constructor(e,r){super(),H(this,"address",e),H(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{Sr.throwError(e,O.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Jd(this.address,e)}}var Nn=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const bt=new O(qt),k4=["call","estimateGas"];function Do(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){const r=me(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(const r in t){const n=Do(t[r],e);if(n)return n}return null}if(typeof t=="string")try{return Do(JSON.parse(t),e)}catch{}return null}function Dy(t,e,r){const n=r.transaction||r.signedTransaction;if(t==="call"){const s=Do(e,!0);if(s)return s.data;bt.throwError("missing revert data in call exception; Transaction reverted without a reason string",O.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if(t==="estimateGas"){let s=Do(e.body,!1);s==null&&(s=Do(e,!1)),s&&bt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",O.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===O.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&bt.throwError("insufficient funds for intrinsic transaction cost",O.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&bt.throwError("nonce has already been used",O.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&bt.throwError("replacement fee too low",O.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&bt.throwError("legacy pre-eip-155 transactions not supported",O.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),k4.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&bt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",O.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function mm(t){return new Promise(function(e){setTimeout(e,t)})}function N4(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function xo(t){return t&&t.toLowerCase()}const Ih={};class Yd extends Ta{constructor(e,r,n){if(super(),e!==Ih)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");H(this,"provider",r),n==null&&(n=0),typeof n=="string"?(H(this,"_address",this.provider.formatter.address(n)),H(this,"_index",null)):typeof n=="number"?(H(this,"_index",n),H(this,"_address",null)):bt.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return bt.throwError("cannot alter JSON-RPC Signer connection",O.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new M4(Ih,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&bt.throwError("unknown account #"+this._index,O.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=at(e);const r=this.getAddress().then(n=>(n&&(n=n.toLowerCase()),n));if(e.gasLimit==null){const n=at(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(n=>Nn(this,void 0,void 0,function*(){if(n==null)return null;const i=yield this.provider.resolveName(n);return i==null&&bt.throwArgumentError("provided ENS name resolves to null","tx.to",n),i}))),xt({tx:xt(e),sender:r}).then(({tx:n,sender:i})=>{n.from!=null?n.from.toLowerCase()!==i&&bt.throwArgumentError("from address mismatch","transaction",e):n.from=i;const s=this.provider.constructor.hexlifyTransaction(n,{from:!0});return this.provider.send("eth_sendTransaction",[s]).then(o=>o,o=>(typeof o.message=="string"&&o.message.match(/user denied/i)&&bt.throwError("user rejected transaction",O.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),Dy("sendTransaction",o,s)))})}signTransaction(e){return bt.throwError("signing transactions is unsupported",O.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Nn(this,void 0,void 0,function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield As(()=>Nn(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(n);if(i!==null)return this.provider._wrapTransaction(i,n,r)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=n,i}})}signMessage(e){return Nn(this,void 0,void 0,function*(){const r=typeof e=="string"?yr(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[ne(r),n.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&bt.throwError("user rejected signing",O.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),i}})}_legacySignMessage(e){return Nn(this,void 0,void 0,function*(){const r=typeof e=="string"?yr(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),ne(r)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&bt.throwError("user rejected signing",O.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),i}})}_signTypedData(e,r,n){return Nn(this,void 0,void 0,function*(){const i=yield cr.resolveNames(e,r,n,o=>this.provider.resolveName(o)),s=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[s.toLowerCase(),JSON.stringify(cr.getPayload(i.domain,r,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&bt.throwError("user rejected signing",O.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:r,value:i.value}}),o}})}unlock(e){return Nn(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class M4 extends Yd{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:n=>this.provider.waitForTransaction(r,n)}))}}const C4={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Qi extends tc{constructor(e,r){let n=r;n==null&&(n=new Promise((i,s)=>{setTimeout(()=>{this.detectNetwork().then(o=>{i(o)},o=>{s(o)})},0)})),super(n),e||(e=mr(this.constructor,"defaultUrl")()),typeof e=="string"?H(this,"connection",Object.freeze({url:e})):H(this,"connection",Object.freeze(at(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Nn(this,void 0,void 0,function*(){yield mm(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const r=mr(this.constructor,"getNetwork");try{return r(W.from(e).toNumber())}catch(n){return bt.throwError("could not detect network",O.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:n})}}return bt.throwError("could not detect network",O.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new Yd(Ih,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:lr(n),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=Ia(this.connection,JSON.stringify(n),N4).then(o=>(this.emit("debug",{action:"response",request:n,response:o,provider:this}),o),o=>{throw this.emit("debug",{action:"response",error:o,request:n,provider:this}),o});return i&&(this._cache[e]=s,setTimeout(()=>{this._cache[e]=null},0)),s}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[xo(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[xo(r.address),r.blockTag]];case"getCode":return["eth_getCode",[xo(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[xo(r.address),gt(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[mr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[mr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=xo(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(e,r){return Nn(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=r.transaction;if(i&&i.type!=null&&W.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=yield this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(r=at(r),r.transaction=at(i),delete r.transaction.type)}}const n=this.prepareRequest(e,r);n==null&&bt.throwError(e+" not implemented",O.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(i){return Dy(e,i,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(n){function i(){e.send("eth_getFilterChanges",[n]).then(function(s){if(e._pendingFilter!=r)return null;let o=Promise.resolve();return s.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",o=o.then(function(){return e.getTransaction(a).then(function(l){return e.emit("pending",l),null})})}),o.then(function(){return mm(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[n]);return}return setTimeout(function(){i()},0),null}).catch(s=>{})}return i(),n}).catch(n=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){const n=at(C4);if(r)for(const s in r)r[s]&&(n[s]=!0);fE(e,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=Vu(W.from(e[s]));s==="gasLimit"&&(s="gas"),i[s]=o}),["from","to","data"].forEach(function(s){e[s]!=null&&(i[s]=ne(e[s]))}),e.accessList&&(i.accessList=rs(e.accessList)),i}}let Fo=null;try{if(Fo=WebSocket,Fo==null)throw new Error("inject please")}catch{const e=new O(qt);Fo=function(){e.throwError("WebSockets not supported in this environment",O.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var pf=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const rl=new O(qt);let P4=1;class rc extends Qi{constructor(e,r){r==="any"&&rl.throwError("WebSocketProvider does not support 'any' network yet",O.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?H(this,"_websocket",new Fo(this.connection.url)):H(this,"_websocket",e),H(this,"_requests",{}),H(this,"_subs",{}),H(this,"_subIds",{}),H(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const s=i.data,o=JSON.parse(s);if(o.id!=null){const a=String(o.id),l=this._requests[a];if(delete this._requests[a],o.result!==void 0)l.callback(null,o.result),this.emit("debug",{action:"response",request:JSON.parse(l.payload),response:o.result,provider:this});else{let u=null;o.error?(u=new Error(o.error.message||"unknown error"),H(u,"code",o.error.code||null),H(u,"response",s)):u=new Error("unknown error"),l.callback(u,void 0),this.emit("debug",{action:"response",error:u,request:JSON.parse(l.payload),provider:this})}}else if(o.method==="eth_subscription"){const a=this._subs[o.params.subscription];a&&a.processFunc(o.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){rl.throwError("cannot reset events block on WebSocketProvider",O.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){rl.throwError("cannot set polling interval on WebSocketProvider",O.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return pf(this,void 0,void 0,function*(){return null})}set polling(e){e&&rl.throwError("cannot set polling on WebSocketProvider",O.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){const n=P4++;return new Promise((i,s)=>{function o(l,u){return l?s(l):i(u)}const a=JSON.stringify({method:e,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(n)]={callback:o,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,n){return pf(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(r).then(o=>this.send("eth_subscribe",o)),this._subIds[e]=i);const s=yield i;this._subs[s]={tag:e,processFunc:n}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=W.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const i=n.hash;this.getTransactionReceipt(i).then(s=>{s&&this.emit(i,s)})};r(e),this._subscribe("tx",["newHeads"],n=>{this._events.filter(i=>i.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return pf(this,void 0,void 0,function*(){this.websocket.readyState===Fo.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var R4=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const No=new O(qt);class Fy extends Qi{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return R4(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||No.throwError("no network detected",O.errors.UNKNOWN_ERROR,{}),this._network==null&&(H(this,"_network",r),this.emit("network",r,null))),r})}}class Gn extends Fy{constructor(e,r){No.checkAbstract(new.target,Gn),e=mr(new.target,"getNetwork")(e),r=mr(new.target,"getApiKey")(r);const n=mr(new.target,"getUrl")(e,r);super(n,e),typeof r=="string"?H(this,"apiKey",r):r!=null&&Object.keys(r).forEach(i=>{H(this,i,r[i])})}_startPending(){No.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return No.throwError("API provider does not support signing",O.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return No.throwError("not implemented; sub-classes must override getUrl",O.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const gm=new O(qt),Pl="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class Uy extends rc{constructor(e,r){const n=new Xd(e,r),i=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,n.network),H(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===Pl}}class Xd extends Gn{static getWebSocketProvider(e,r){return new Uy(e,r)}static getApiKey(e){return e==null?Pl:(e&&typeof e!="string"&&gm.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;default:gm.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(i,s)=>(r===Pl&&Oa(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Pl}}const I4=new O(qt),nl="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function O4(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return I4.throwArgumentError("unsupported network","name",t)}class zy extends Gn{isCommunityResource(){return this.apiKey===nl}static getApiKey(e){return e??nl}static getUrl(e,r){r==null&&(r=nl);const n={allowGzip:!0,url:"https://"+O4(e.name)+r,throttleCallback:(i,s)=>(r.apiKey===nl&&Oa(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var T4=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const vm=new O(qt);class $y extends Gn{static getApiKey(e){return e!=null&&vm.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="https://cloudflare-eth.com/";break;default:vm.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return T4(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,e,r)})}}var il=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const li=new O(qt);function ym(t){const e={};for(let r in t){if(t[r]==null)continue;let n=t[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=Vu(ne(n)):r==="accessList"?n="["+rs(n).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":n=ne(n),e[r]=n)}return e}function j4(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function wm(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function xm(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function mf(t,e,r){if(t==="call"&&e.code===O.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let s=i.data;if(s&&(s="0x"+s.replace(/^.*0x/i,"")),me(s))return s;li.throwError("missing revert data in call exception",O.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===O.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&li.throwError("insufficient funds for intrinsic transaction cost",O.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&li.throwError("nonce has already been used",O.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&li.throwError("replacement fee too low",O.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&li.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",O.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class Hy extends tc{constructor(e,r){super(e),H(this,"baseUrl",this.getBaseUrl()),H(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return li.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){const n=Object.keys(r).reduce((s,o)=>{const a=r[o];return a!=null&&(s+=`&${o}=${a}`),s},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${n}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,n){return il(this,void 0,void 0,function*(){const i=n?this.getPostUrl():this.getUrl(e,r),s=n?this.getPostData(e,r):null,o=e==="proxy"?wm:j4;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(c,h)=>(this.isCommunityResource()&&Oa(),Promise.resolve(!0))};let l=null;s&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},l=Object.keys(s).map(c=>`${c}=${s[c]}`).join("&"));const u=yield Ia(a,l,o||wm);return this.emit("debug",{action:"response",request:i,response:lr(u),provider:this}),u})}detectNetwork(){return il(this,void 0,void 0,function*(){return this.network})}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return il(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(i=>mf("sendTransaction",i,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=ym(r.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return mf("call",s,r.transaction)}}case"estimateGas":{const i=ym(r.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return mf("estimateGas",s,r.transaction)}}case"getLogs":{const i={action:"getLogs"};if(r.filter.fromBlock&&(i.fromBlock=xm(r.filter.fromBlock)),r.filter.toBlock&&(i.toBlock=xm(r.filter.toBlock)),r.filter.address&&(i.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&li.throwError("unsupported topic count",O.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const a=r.filter.topics[0];(typeof a!="string"||a.length!==66)&&li.throwError("unsupported topic format",O.errors.UNSUPPORTED_OPERATION,{topic0:a}),i.topic0=a}const s=yield this.fetch("logs",i);let o={};for(let a=0;a{["contractAddress","to"].forEach(function(l){o[l]==""&&delete o[l]}),o.creates==null&&o.contractAddress!=null&&(o.creates=o.contractAddress);const a=this.formatter.transactionResponse(o);return o.timeStamp&&(a.timestamp=parseInt(o.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}}function L4(t){t=t.slice();for(let e=t.length-1;e>0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}var fu=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const Ti=new O(qt);function sl(){return new Date().getTime()}function bm(t){let e=null;for(let r=0;re?null:(n+i)/2}function _s(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(W.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>_s(e)));if(typeof t=="object"){const e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let n=t[r];return typeof n=="function"?n="[function]":n=_s(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let B4=1;function Am(t){let e=null,r=null,n=new Promise(o=>{e=function(){r&&(clearTimeout(r),r=null),o()},r=setTimeout(e,t)});const i=o=>(n=n.then(o),n);function s(){return n}return{cancel:e,getPromise:s,wait:i}}const D4=[O.errors.CALL_EXCEPTION,O.errors.INSUFFICIENT_FUNDS,O.errors.NONCE_EXPIRED,O.errors.REPLACEMENT_UNDERPRICED,O.errors.UNPREDICTABLE_GAS_LIMIT],F4=["address","args","errorArgs","errorSignature","method","transaction"];function ol(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function U4(t,e){return function(r){const n={};r.forEach(s=>{const o=t(s.result);n[o]||(n[o]={count:0,result:s.result}),n[o].count++});const i=Object.keys(n);for(let s=0;s=e)return o.result}}}function z4(t,e,r){let n=_s;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=Em(i.map(a=>a.result),2);if(o!=null)return o=Math.ceil(o),s.indexOf(o+1)>=0&&o++,o>=t._highestBlockNumber&&(t._highestBlockNumber=o),t._highestBlockNumber};case"getGasPrice":return function(i){const s=i.map(o=>o.result);return s.sort(),s[Math.floor(s.length/2)]};case"getEtherPrice":return function(i){return Em(i.map(s=>s.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(i){return i==null?null:(i=at(i),i.confirmations=-1,_s(i))};break;case"getBlock":r.includeTransactions?n=function(i){return i==null?null:(i=at(i),i.transactions=i.transactions.map(s=>(s=at(s),s.confirmations=-1,s)),_s(i))}:n=function(i){return i==null?null:_s(i)};break;default:throw new Error("unknown method: "+e)}return U4(n,t.quorum)}function bo(t,e){return fu(this,void 0,void 0,function*(){const r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:As(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function $4(t,e,r,n){return fu(this,void 0,void 0,function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&me(n.blockTag)&&(i=yield bo(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&me(n.blockTag)&&(i=yield bo(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&me(n.blockTag)&&(i=yield bo(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&me(n.blockTag)&&(i=yield bo(t,e)),r==="call"&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let s=n.filter;return(s.fromBlock&&me(s.fromBlock)||s.toBlock&&me(s.toBlock))&&(i=yield bo(t,e)),i.getLogs(s)}}return Ti.throwError("unknown method error",O.errors.UNKNOWN_ERROR,{method:r,params:n})})}class qy extends tc{constructor(e,r){e.length===0&&Ti.throwArgumentError("missing providers","providers",e);const n=e.map((o,a)=>{if(ro.isProvider(o)){const c=Ph(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:c,priority:1})}const l=at(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=Ph(o)?2e3:750),l.weight==null&&(l.weight=1);const u=l.weight;return(u%1||u>512||u<1)&&Ti.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,u),Object.freeze(l)}),i=n.reduce((o,a)=>o+a.weight,0);r==null?r=i/2:r>i&&Ti.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let s=bm(n.map(o=>o.provider.network));s==null&&(s=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(s),H(this,"providerConfigs",Object.freeze(n)),H(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return fu(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return bm(e)})}perform(e,r){return fu(this,void 0,void 0,function*(){if(e==="sendTransaction"){const l=yield Promise.all(this.providerConfigs.map(u=>u.provider.sendTransaction(r.signedTransaction).then(c=>c.hash,c=>c)));for(let u=0;ul.priority-u.priority);const s=this._highestBlockNumber;let o=0,a=!0;for(;;){const l=sl();let u=i.filter(v=>v.runner&&l-v.startv+w.weight,0);for(;u{v.staller=null}),v.runner=$4(v,s,e,r).then(b=>{v.done=!0,v.result=b,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:w,backend:ol(v,sl()),request:{method:e,params:lr(r)},provider:this})},b=>{v.done=!0,v.error=b,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:w,backend:ol(v,sl()),request:{method:e,params:lr(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:w,backend:ol(v,null),request:{method:e,params:lr(r)},provider:this}),u+=v.weight}const c=[];i.forEach(v=>{v.done||!v.runner||(c.push(v.runner),v.staller&&c.push(v.staller.getPromise()))}),c.length&&(yield Promise.race(c));const h=i.filter(v=>v.done&&v.error==null);if(h.length>=this.quorum){const v=n(h);if(v!==void 0)return i.forEach(w=>{w.staller&&w.staller.cancel(),w.cancelled=!0}),v;a||(yield Am(100).getPromise()),a=!1}const p=i.reduce((v,w)=>{if(!w.done||w.error==null)return v;const b=w.error.code;return D4.indexOf(b)>=0&&(v[b]||(v[b]={error:w.error,weight:0}),v[b].weight+=w.weight),v},{});if(Object.keys(p).forEach(v=>{const w=p[v];if(w.weight{y.staller&&y.staller.cancel(),y.cancelled=!0});const b=w.error,k={};F4.forEach(y=>{b[y]!=null&&(k[y]=b[y])}),Ti.throwError(b.reason||b.message,v,k)}),i.filter(v=>!v.done).length===0)break}return i.forEach(l=>{l.staller&&l.staller.cancel(),l.cancelled=!0}),Ti.throwError("failed to meet quorum",O.errors.SERVER_ERROR,{method:e,params:r,results:i.map(l=>ol(l)),provider:this})})}}const Vy=null,Rl=new O(qt),Mo="84842078b09946638c03157f83405213";class Gy extends rc{constructor(e,r){const n=new Zd(e,r),i=n.connection;i.password&&Rl.throwError("INFURA WebSocket project secrets unsupported",O.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const s=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(s,e),H(this,"apiKey",n.projectId),H(this,"projectId",n.projectId),H(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===Mo}}class Zd extends Gn{static getWebSocketProvider(e,r){return new Gy(e,r)}static getApiKey(e){const r={apiKey:Mo,projectId:Mo,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(Rl.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),Rl.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;default:Rl.throwError("unsupported network",O.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(s,o)=>(r.projectId===Mo&&Oa(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}isCommunityResource(){return this.projectId===Mo}}class H4 extends Qi{send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const i={request:n,resolve:null,reject:null},s=new Promise((o,a)=>{i.resolve=o,i.reject=a});return this._pendingBatch.push(i),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const o=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const a=o.map(l=>l.request);return this.emit("debug",{action:"requestBatch",request:lr(a),provider:this}),Ia(this.connection,JSON.stringify(a)).then(l=>{this.emit("debug",{action:"response",request:a,response:l,provider:this}),o.forEach((u,c)=>{const h=l[c];if(h.error){const p=new Error(h.error.message);p.code=h.error.code,p.data=h.error.data,u.reject(p)}else u.resolve(h.result)})},l=>{this.emit("debug",{action:"response",error:l,request:a,provider:this}),o.forEach(u=>{u.reject(l)})})},10)),s}}const gf=new O(qt),q4="ETHERS_JS_SHARED";class Wy extends Gn{static getApiKey(e){return e&&typeof e!="string"&&gf.throwArgumentError("invalid apiKey","apiKey",e),e||q4}static getUrl(e,r){gf.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(e.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:gf.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const _m=new O(qt),Sm="62e1ad51b37b8e00394bda3b";class Ky extends Gn{static getApiKey(e){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=Sm:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:_m.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:_m.throwError("unsupported network",O.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${n}/v1/lb/${r.applicationId}`,s={headers:{},url:i};return r.applicationSecretKey!=null&&(s.user="",s.password=r.applicationSecretKey),s}isCommunityResource(){return this.applicationId===Sm}}const km=new O(qt);let V4=1;function Nm(t,e){const r="Web3LegacyFetcher";return function(n,i){const s={method:n,params:i,id:V4++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:r,request:lr(s),provider:this}),e(s,(l,u)=>{if(l)return this.emit("debug",{action:"response",fetcher:r,error:l,request:s,provider:this}),a(l);if(this.emit("debug",{action:"response",fetcher:r,request:s,response:u,provider:this}),u.error){const c=new Error(u.error.message);return c.code=u.error.code,c.data=u.error.data,a(c)}o(u.result)})})}}function G4(t){return function(e,r){r==null&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:lr(n),provider:this}),t.request(n).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:i,provider:this}),i})}}class Qy extends Qi{constructor(e,r){e==null&&km.throwArgumentError("missing provider","provider",e);let n=null,i=null,s=null;typeof e=="function"?(n="unknown:",i=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),s=e,e.request?(n===""&&(n="eip-1193:"),i=G4(e)):e.sendAsync?i=Nm(e,e.sendAsync.bind(e)):e.send?i=Nm(e,e.send.bind(e)):km.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,r),H(this,"jsonRpcFetchFunc",i),H(this,"provider",s)}send(e,r){return this.jsonRpcFetchFunc(e,r)}}const Mm=new O(qt);function W4(t,e){if(t==null&&(t="homestead"),typeof t=="string"){const n=t.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new Qi(t);case"ws":case"wss":return new rc(t);default:Mm.throwArgumentError("unsupported URL scheme","network",t)}}const r=Vd(t);return(!r||!r._defaultProvider)&&Mm.throwError("unsupported getDefaultProvider network",O.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:qy,AlchemyProvider:Xd,AnkrProvider:zy,CloudflareProvider:$y,EtherscanProvider:Hy,InfuraProvider:Zd,JsonRpcProvider:Qi,NodesmithProvider:Wy,PocketProvider:Ky,Web3Provider:Qy,IpcProvider:Vy},e)}const K4=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:Xd,AlchemyWebSocketProvider:Uy,AnkrProvider:zy,BaseProvider:tc,CloudflareProvider:$y,EtherscanProvider:Hy,FallbackProvider:qy,Formatter:Z,InfuraProvider:Zd,InfuraWebSocketProvider:Gy,IpcProvider:Vy,JsonRpcBatchProvider:H4,JsonRpcProvider:Qi,JsonRpcSigner:Yd,NodesmithProvider:Wy,PocketProvider:Ky,Provider:ro,Resolver:Rh,StaticJsonRpcProvider:Fy,UrlJsonRpcProvider:Gn,Web3Provider:Qy,WebSocketProvider:rc,getDefaultProvider:W4,getNetwork:Vd,isCommunityResourcable:jy,isCommunityResource:Ph,showThrottleMessage:Oa},Symbol.toStringTag,{value:"Module"})),Q4=Ys(K4);var J4=ze&&ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y4=ze&&ze.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X4=ze&&ze.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&J4(e,t,r);return Y4(e,t),e},Z4=ze&&ze.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.getPriorityConnector=Ln.getSelectedConnector=Ln.initializeConnector=void 0;const e_=N1,Ss=j,Cm=iE,t_=lE;let Ls;function r_(){return Z4(this,void 0,void 0,function*(){if(Ls===void 0)try{const{Web3Provider:t}=yield Promise.resolve().then(()=>X4(Q4));Ls=t}catch{console.debug("@ethersproject/providers not available"),Ls=null}})}function n_(t){const[e,r]=(0,e_.createWeb3ReactStoreAndActions)(),n=t(r),i=c_(e),s=f_(i),o=h_(n,i,s);return[n,Object.assign(Object.assign(Object.assign({},i),s),o),e]}Ln.initializeConnector=n_;function i_({chainId:t,accounts:e,activating:r}){return!!(t&&e&&!r)}function Jy(...t){function e(h){const p=t.findIndex(([v])=>h===v);if(p===-1)throw new Error("Connector not found");return p}function r(h){const p=t[e(h)][2];if(!p)throw new Error("Stores not passed");return p}function n(h){return t.map(([,{useChainId:v}])=>v())[e(h)]}function i(h){return t.map(([,{useAccounts:v}])=>v())[e(h)]}function s(h){return t.map(([,{useIsActivating:v}])=>v())[e(h)]}function o(h){return t.map(([,{useAccount:v}])=>v())[e(h)]}function a(h){return t.map(([,{useIsActive:v}])=>v())[e(h)]}function l(h,p){const v=e(h);return t.map(([,{useProvider:b}],k)=>b(p,k===v))[v]}function u(h,p){const v=e(h);return t.map(([,{useENSNames:b}],k)=>b(k===v?p:void 0))[v]}function c(h,p){const v=e(h);return t.map(([,{useENSName:b}],k)=>b(k===v?p:void 0))[v]}return{useSelectedStore:r,useSelectedChainId:n,useSelectedAccounts:i,useSelectedIsActivating:s,useSelectedAccount:o,useSelectedIsActive:a,useSelectedProvider:l,useSelectedENSNames:u,useSelectedENSName:c}}Ln.getSelectedConnector=Jy;function s_(...t){const{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:s,useSelectedIsActive:o,useSelectedProvider:a,useSelectedENSNames:l,useSelectedENSName:u}=Jy(...t);function c(){const L=t.map(([,{useIsActive:D}])=>D()).findIndex(D=>D);return t[L===-1?0:L][0]}function h(){return e(c())}function p(){return r(c())}function v(){return n(c())}function w(){return i(c())}function b(){return s(c())}function k(){return o(c())}function y(T){return a(c(),T)}function m(T){return l(c(),T)}function A(T){return u(c(),T)}return{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:s,useSelectedIsActive:o,useSelectedProvider:a,useSelectedENSNames:l,useSelectedENSName:u,usePriorityConnector:c,usePriorityStore:h,usePriorityChainId:p,usePriorityAccounts:v,usePriorityIsActivating:w,usePriorityAccount:b,usePriorityIsActive:k,usePriorityProvider:y,usePriorityENSNames:m,usePriorityENSName:A}}Ln.getPriorityConnector=s_;const o_=({chainId:t})=>t,a_=({accounts:t})=>t,l_=({activating:t})=>t,u_=(t,e)=>t===void 0&&e===void 0||t!==void 0&&t.length===(e==null?void 0:e.length)&&t.every((r,n)=>r===e[n]);function c_(t){function e(){return(0,Cm.useStore)(t,o_)}function r(){return(0,t_.useStoreWithEqualityFn)(t,a_,u_)}function n(){return(0,Cm.useStore)(t,l_)}return{useChainId:e,useAccounts:r,useIsActivating:n}}function f_({useChainId:t,useAccounts:e,useIsActivating:r}){function n(){var s;return(s=e())===null||s===void 0?void 0:s[0]}function i(){const s=t(),o=e(),a=r();return i_({chainId:s,accounts:o,activating:a})}return{useAccount:n,useIsActive:i}}function Pm(t,e=[]){const[r,n]=(0,Ss.useState)();return(0,Ss.useEffect)(()=>{if(t&&e.length){let i=!1;return Promise.all(e.map(s=>t.lookupAddress(s))).then(s=>{i||n(s)}).catch(s=>{i||(console.debug("Could not fetch ENS names",s),n(new Array(e.length).fill(null)))}),()=>{i=!0,n(void 0)}}},[t,e]),r??new Array(e.length).fill(void 0)}function h_(t,{useAccounts:e,useChainId:r},{useAccount:n,useIsActive:i}){function s(l,u=!0){const c=i(),h=r(),[p,v]=(0,Ss.useState)(Ls!==void 0);return(0,Ss.useEffect)(()=>{if(p)return;let w=!1;return r_().then(()=>{w||v(!0)}),()=>{w=!0}},[p]),(0,Ss.useMemo)(()=>{if(u){if(t.customProvider)return t.customProvider;if(Ls&&t.provider)return new Ls(t.provider,l)}},[p,u,c,h,l])}function o(l){const u=e();return Pm(l,u)}function a(l){var u;const c=n(),h=(0,Ss.useMemo)(()=>c===void 0?void 0:[c],[c]);return(u=Pm(l,h))===null||u===void 0?void 0:u[0]}return{useProvider:s,useENSNames:o,useENSName:a}}var nc={},Yy={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function s(l,u,c,h,p){if(typeof c!="function")throw new TypeError("The listener must be a function");var v=new i(c,h||l,p),w=r?r+u:u;return l._events[w]?l._events[w].fn?l._events[w]=[l._events[w],v]:l._events[w].push(v):(l._events[w]=v,l._eventsCount++),l}function o(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)e.call(c,h)&&u.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},a.prototype.listeners=function(u){var c=r?r+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var p=0,v=h.length,w=new Array(v);pe),this.eth_accounts=jest.fn(e=>e),this.eth_requestAccounts=jest.fn(e=>e)}request(e){if(!this.chainId)return Promise.reject(new Error);switch(e.method){case"eth_chainId":return Promise.resolve(this.eth_chainId(this.chainId));case"eth_accounts":return Promise.resolve(this.eth_accounts(this.accounts));case"eth_requestAccounts":return Promise.resolve(this.eth_requestAccounts(this.accounts));default:throw new Error(`Method not supported on mock: ${JSON.stringify(e)}`)}}emitConnect(e){this.emit("connect",{chainId:e})}emitDisconnect(e){this.emit("disconnect",e)}emitChainChanged(e){this.emit("chainChanged",e)}emitAccountsChanged(e){this.emit("accountsChanged",e)}}nc.MockEIP1193Provider=m_;var Qs={},g_=ze&&ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v_=ze&&ze.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y_=ze&&ze.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g_(e,t,r);return v_(e,t),e};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.useWeb3React=Qs.Web3ReactProvider=void 0;const hu=y_(j),w_=Ln,Xy=(0,hu.createContext)(void 0);function x_({children:t,connectors:e,connectorOverride:r,network:n,lookupENS:i=!0}){const s=(0,hu.useRef)(e);if(e.length!=s.current.length||e.some((J,re)=>{const $e=s.current[re];return J[0]!==$e[0]}))throw new Error("The connectors prop passed to Web3ReactProvider must be referentially static. If connectors is changing, try providing a key prop to Web3ReactProvider that changes every time connectors changes.");const o=(0,w_.getPriorityConnector)(...e),{usePriorityConnector:a,useSelectedChainId:l,useSelectedAccounts:u,useSelectedIsActivating:c,useSelectedAccount:h,useSelectedIsActive:p,useSelectedProvider:v,useSelectedENSNames:w,useSelectedENSName:b}=o,k=a(),y=r??k,m=l(y),A=u(y),T=c(y),L=h(y),D=p(y),F=v(y,n),U=w(y,i?F:void 0),G=b(y,i?F:void 0);return hu.default.createElement(Xy.Provider,{value:{connector:y,chainId:m,accounts:A,isActivating:T,account:L,isActive:D,provider:F,ENSNames:U,ENSName:G,hooks:o}},t)}Qs.Web3ReactProvider=x_;function b_(){const t=(0,hu.useContext)(Xy);if(!t)throw Error("useWeb3React can only be used within the Web3ReactProvider component");return t}Qs.useWeb3React=b_;(function(t){var e=ze&&ze.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=ze&&ze.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(t,"__esModule",{value:!0}),r(Ln,t),r(nc,t),r(Qs,t)})(Hu);const ja="abi/5.7.0",be=new O(ja),Ji={};let Rm={calldata:!0,memory:!0,storage:!0},E_={calldata:!0,memory:!0};function al(t,e){if(t==="bytes"||t==="string"){if(Rm[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&E_[e])return!0;return(Rm[e]||e==="payable")&&be.throwArgumentError("invalid modifier","name",e),!1}function A_(t,e){let r=t;function n(a){be.throwArgumentError(`unexpected character at position ${a}`,"param",t)}t=t.replace(/\s/g," ");function i(a){let l={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(l.indexed=!1),l}let s={type:"",name:"",state:{allowType:!0}},o=s;for(let a=0;aJSON.parse(i.format(e)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==ke.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(e)).join(e===ke.full?", ":",")+")"):r+=this.type,e!==ke.sighash&&(this.indexed===!0&&(r+=" indexed"),e===ke.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?Nt.fromString(e,r):Nt.fromObject(e)}static fromObject(e){return Nt.isParamType(e)?e:new Nt(Ji,{name:e.name||null,type:as(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(Nt.fromObject):null})}static fromString(e,r){function n(i){return Nt.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n(A_(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function da(t,e){return k_(t).map(r=>Nt.fromString(r,e))}class Tn{constructor(e,r){e!==Ji&&be.throwError("use a static from method",O.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Il(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return Tn.isFragment(e)?e:typeof e=="string"?Tn.fromString(e):Tn.fromObject(e)}static fromObject(e){if(Tn.isFragment(e))return e;switch(e.type){case"function":return un.fromObject(e);case"event":return Pn.fromObject(e);case"constructor":return ln.fromObject(e);case"error":return ui.fromObject(e);case"fallback":case"receive":return null}return be.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?Pn.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?un.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?ln.fromString(e.trim()):e.split(" ")[0]==="error"?ui.fromString(e.substring(5).trim()):be.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class Pn extends Tn{format(e){if(e||(e=ke.sighash),ke[e]||be.throwArgumentError("invalid format type","format",e),e===ke.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==ke.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===ke.full?", ":",")+") ",e!==ke.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?Pn.fromString(e):Pn.fromObject(e)}static fromObject(e){if(Pn.isEventFragment(e))return e;e.type!=="event"&&be.throwArgumentError("invalid event object","value",e);const r={name:pa(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Nt.fromObject):[],type:"event"};return new Pn(Ji,r)}static fromString(e){let r=e.match(ma);r||be.throwArgumentError("invalid event string","value",e);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:be.warn("unknown modifier: "+i)}}),Pn.fromObject({name:r[1].trim(),anonymous:n,inputs:da(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function Zy(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&be.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||be.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=W.from(r[1]),r[0]):t}function e2(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function t2(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&be.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&be.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&be.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&be.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&be.throwArgumentError("unable to determine stateMutability","value",t),e}class ln extends Tn{format(e){if(e||(e=ke.sighash),ke[e]||be.throwArgumentError("invalid format type","format",e),e===ke.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});e===ke.sighash&&be.throwError("cannot format a constructor for sighash",O.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(e)).join(e===ke.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?ln.fromString(e):ln.fromObject(e)}static fromObject(e){if(ln.isConstructorFragment(e))return e;e.type!=="constructor"&&be.throwArgumentError("invalid constructor object","value",e);let r=t2(e);r.constant&&be.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Nt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?W.from(e.gas):null};return new ln(Ji,n)}static fromString(e){let r={type:"constructor"};e=Zy(e,r);let n=e.match(ma);return(!n||n[1].trim()!=="constructor")&&be.throwArgumentError("invalid constructor string","value",e),r.inputs=da(n[2].trim(),!1),e2(n[3].trim(),r),ln.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class un extends ln{format(e){if(e||(e=ke.sighash),ke[e]||be.throwArgumentError("invalid format type","format",e),e===ke.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==ke.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===ke.full?", ":",")+") ",e!==ke.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?un.fromString(e):un.fromObject(e)}static fromObject(e){if(un.isFunctionFragment(e))return e;e.type!=="function"&&be.throwArgumentError("invalid function object","value",e);let r=t2(e);const n={type:e.type,name:pa(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(Nt.fromObject):[],outputs:e.outputs?e.outputs.map(Nt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?W.from(e.gas):null};return new un(Ji,n)}static fromString(e){let r={type:"function"};e=Zy(e,r);let n=e.split(" returns ");n.length>2&&be.throwArgumentError("invalid function string","value",e);let i=n[0].match(ma);if(i||be.throwArgumentError("invalid function signature","value",e),r.name=i[1].trim(),r.name&&pa(r.name),r.inputs=da(i[2],!1),e2(i[3].trim(),r),n.length>1){let s=n[1].match(ma);(s[1].trim()!=""||s[3].trim()!="")&&be.throwArgumentError("unexpected tokens","value",e),r.outputs=da(s[2],!1)}else r.outputs=[];return un.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function Im(t){const e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&be.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ui extends Tn{format(e){if(e||(e=ke.sighash),ke[e]||be.throwArgumentError("invalid format type","format",e),e===ke.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==ke.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===ke.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?ui.fromString(e):ui.fromObject(e)}static fromObject(e){if(ui.isErrorFragment(e))return e;e.type!=="error"&&be.throwArgumentError("invalid error object","value",e);const r={type:e.type,name:pa(e.name),inputs:e.inputs?e.inputs.map(Nt.fromObject):[]};return Im(new ui(Ji,r))}static fromString(e){let r={type:"error"},n=e.match(ma);return n||be.throwArgumentError("invalid error signature","value",e),r.name=n[1].trim(),r.name&&pa(r.name),r.inputs=da(n[2],!1),Im(ui.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function as(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const S_=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function pa(t){return(!t||!t.match(S_))&&be.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const ma=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function k_(t){t=t.trim();let e=[],r="",n=0;for(let i=0;ithis.wordSize&&e0.throwError("value out-of-bounds",O.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=zt([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}}class du{constructor(e,r,n,i){H(this,"_data",oe(e)),H(this,"wordSize",r||32),H(this,"_coerceFunc",n),H(this,"allowLoose",i),this._offset=0}get data(){return ne(this._data)}get consumed(){return this._offset}static coerce(e,r){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):du.coerce(e,r)}_peekBytes(e,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:e0.throwError("data out-of-bounds",O.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new du(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let n=this._peekBytes(0,e,!!r);return this._offset+=n.length,n.slice(0,e)}readValue(){return W.from(this.readBytes(this.wordSize))}}class M_ extends Wn{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=vt(r)}catch(n){this._throwError(n.message,r)}return e.writeValue(r)}decode(e){return vt(gt(e.readValue().toHexString(),20))}}class C_ extends Wn{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}}const ks=new O(ja);function r2(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let l={};n=e.map(u=>{const c=u.localName;return c||ks.throwError("cannot encode object for signature with missing names",O.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),l[c]&&ks.throwError("cannot encode object for signature with duplicate names",O.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),l[c]=!0,r[c]})}else ks.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&ks.throwArgumentError("types/value length mismatch","tuple",r);let i=new Oh(t.wordSize),s=new Oh(t.wordSize),o=[];e.forEach((l,u)=>{let c=n[u];if(l.dynamic){let h=s.length;l.encode(s,c);let p=i.writeUpdatableValue();o.push(v=>{p(v+h)})}else l.encode(i,c)}),o.forEach(l=>{l(i.length)});let a=t.appendWriter(i);return a+=t.appendWriter(s),a}function n2(t,e){let r=[],n=t.subReader(0);e.forEach(s=>{let o=null;if(s.dynamic){let a=t.readValue(),l=n.subReader(a.toNumber());try{o=s.decode(l)}catch(u){if(u.code===O.errors.BUFFER_OVERRUN)throw u;o=u,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(t)}catch(a){if(a.code===O.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}o!=null&&r.push(o)});const i=e.reduce((s,o)=>{const a=o.localName;return a&&(s[a]||(s[a]=0),s[a]++),s},{});e.forEach((s,o)=>{let a=s.localName;if(!a||i[a]!==1||(a==="length"&&(a="_length"),r[a]!=null))return;const l=r[o];l instanceof Error?Object.defineProperty(r,a,{enumerable:!0,get:()=>{throw l}}):r[a]=l});for(let s=0;s{throw o}})}return Object.freeze(r)}class P_ extends Wn{constructor(e,r,n){const i=e.type+"["+(r>=0?r:"")+"]",s=r===-1||e.dynamic;super("array",i,n,s),this.coder=e,this.length=r}defaultValue(){const e=this.coder.defaultValue(),r=[];for(let n=0;ne._data.length&&ks.throwError("insufficient data length",O.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let n=[];for(let i=0;i{o.dynamic&&(n=!0),i.push(o.type)});const s="tuple("+i.join(",")+")";super("tuple",s,r,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const s=i.localName;return s&&(n[s]||(n[s]=0),n[s]++),n},{});return this.coders.forEach((n,i)=>{let s=n.localName;!s||r[s]!==1||(s==="length"&&(s="_length"),e[s]==null&&(e[s]=e[i]))}),Object.freeze(e)}encode(e,r){return r2(e,this.coders,r)}decode(e){return e.coerce(this.name,n2(e,this.coders))}}const ul=new O(ja),B_=new RegExp(/^bytes([0-9]*)$/),D_=new RegExp(/^(u?int)([0-9]*)$/);class F_{constructor(e){H(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new M_(e.name);case"bool":return new R_(e.name);case"string":return new L_(e.name);case"bytes":return new I_(e.name);case"array":return new P_(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new ll((e.components||[]).map(n=>this._getCoder(n)),e.name);case"":return new T_(e.name)}let r=e.type.match(D_);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&ul.throwArgumentError("invalid "+r[1]+" bit length","param",e),new j_(n/8,r[1]==="int",e.name)}if(r=e.type.match(B_),r){let n=parseInt(r[1]);return(n===0||n>32)&&ul.throwArgumentError("invalid bytes length","param",e),new O_(n,e.name)}return ul.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new du(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new Oh(this._getWordSize())}getDefaultValue(e){const r=e.map(i=>this._getCoder(Nt.from(i)));return new ll(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&ul.throwError("types/values length mismatch",O.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});const n=e.map(o=>this._getCoder(Nt.from(o))),i=new ll(n,"_"),s=this._getWriter();return i.encode(s,r),s.data}decode(e,r,n){const i=e.map(o=>this._getCoder(Nt.from(o)));return new ll(i,"_").decode(this._getReader(oe(r),n))}}const U_=new F_,ut=new O(ja);class z_ extends Ca{}class $_ extends Ca{}class H_ extends Ca{}class Th extends Ca{static isIndexed(e){return!!(e&&e._isIndexed)}}const q_={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Om(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class jh{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,H(this,"fragments",r.map(n=>Tn.from(n)).filter(n=>n!=null)),H(this,"_abiCoder",mr(new.target,"getAbiCoder")()),H(this,"functions",{}),H(this,"errors",{}),H(this,"events",{}),H(this,"structs",{}),this.fragments.forEach(n=>{let i=null;switch(n.type){case"constructor":if(this.deploy){ut.warn("duplicate definition - constructor");return}H(this,"deploy",n);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let s=n.format();if(i[s]){ut.warn("duplicate definition - "+s);return}i[s]=n}),this.deploy||H(this,"deploy",ln.from({payable:!1,type:"constructor"})),H(this,"_isInterface",!0)}format(e){e||(e=ke.full),e===ke.sighash&&ut.throwArgumentError("interface does not support formatting sighash","format",e);const r=this.fragments.map(n=>n.format(e));return e===ke.json?JSON.stringify(r.map(n=>JSON.parse(n))):r}static getAbiCoder(){return U_}static getAddress(e){return vt(e)}static getSighash(e){return Ot(Es(e.format()),0,4)}static getEventTopic(e){return Es(e.format())}getFunction(e){if(me(e)){for(const n in this.functions)if(e===this.getSighash(n))return this.functions[n];ut.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.functions).filter(s=>s.split("(")[0]===n);return i.length===0?ut.throwArgumentError("no matching function","name",n):i.length>1&&ut.throwArgumentError("multiple matching functions","name",n),this.functions[i[0]]}const r=this.functions[un.fromString(e).format()];return r||ut.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(me(e)){const n=e.toLowerCase();for(const i in this.events)if(n===this.getEventTopic(i))return this.events[i];ut.throwArgumentError("no matching event","topichash",n)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.events).filter(s=>s.split("(")[0]===n);return i.length===0?ut.throwArgumentError("no matching event","name",n):i.length>1&&ut.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}const r=this.events[Pn.fromString(e).format()];return r||ut.throwArgumentError("no matching event","signature",e),r}getError(e){if(me(e)){const n=mr(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===n(s))return this.errors[i]}ut.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.errors).filter(s=>s.split("(")[0]===n);return i.length===0?ut.throwArgumentError("no matching error","name",n):i.length>1&&ut.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}const r=this.errors[un.fromString(e).format()];return r||ut.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return mr(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),mr(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));const n=oe(r);return ne(n.slice(0,4))!==this.getSighash(e)&&ut.throwArgumentError(`data signature does not match error ${e.name}.`,"data",ne(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),ne(zt([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));const n=oe(r);return ne(n.slice(0,4))!==this.getSighash(e)&&ut.throwArgumentError(`data signature does not match function ${e.name}.`,"data",ne(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),ne(zt([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let n=oe(r),i=null,s="",o=null,a=null,l=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch{}break;case 4:{const u=ne(n.slice(0,4)),c=q_[u];if(c)o=this._abiCoder.decode(c.inputs,n.slice(4)),a=c.name,l=c.signature,c.reason&&(i=o[0]),a==="Error"?s=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(s=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const h=this.getError(u);o=this._abiCoder.decode(h.inputs,n.slice(4)),a=h.name,l=h.format()}catch{}break}}return ut.throwError("call revert exception"+s,O.errors.CALL_EXCEPTION,{method:e.format(),data:ne(r),errorArgs:o,errorName:a,errorSignature:l,reason:i})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),ne(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&ut.throwError("too many arguments for "+e.format(),O.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];e.anonymous||n.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?Es(o):s.type==="bytes"?ot(ne(o)):(s.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),s.type.match(/^u?int/)&&(o=W.from(o).toHexString()),s.type==="address"&&this._abiCoder.encode(["address"],[o]),gt(ne(o),32));for(r.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&ut.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?n.push(null):a.baseType==="array"||a.baseType==="tuple"?ut.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?n.push(s.map(l=>i(a,l))):n.push(i(a,s))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));const n=[],i=[],s=[];return e.anonymous||n.push(this.getEventTopic(e)),r.length!==e.inputs.length&&ut.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{const l=r[a];if(o.indexed)if(o.type==="string")n.push(Es(l));else if(o.type==="bytes")n.push(ot(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");n.push(this._abiCoder.encode([o.type],[l]))}else i.push(o),s.push(l)}),{data:this._abiCoder.encode(i,s),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"&&(e=this.getEvent(e)),n!=null&&!e.anonymous){let p=this.getEventTopic(e);(!me(n[0],32)||n[0].toLowerCase()!==p)&&ut.throwError("fragment/topic mismatch",O.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:p,value:n[0]}),n=n.slice(1)}let i=[],s=[],o=[];e.inputs.forEach((p,v)=>{p.indexed?p.type==="string"||p.type==="bytes"||p.baseType==="tuple"||p.baseType==="array"?(i.push(Nt.fromObject({type:"bytes32",name:p.name})),o.push(!0)):(i.push(p),o.push(!1)):(s.push(p),o.push(!1))});let a=n!=null?this._abiCoder.decode(i,zt(n)):null,l=this._abiCoder.decode(s,r,!0),u=[],c=0,h=0;e.inputs.forEach((p,v)=>{if(p.indexed)if(a==null)u[v]=new Th({_isIndexed:!0,hash:null});else if(o[v])u[v]=new Th({_isIndexed:!0,hash:a[h++]});else try{u[v]=a[h++]}catch(w){u[v]=w}else try{u[v]=l[c++]}catch(w){u[v]=w}if(p.name&&u[p.name]==null){const w=u[v];w instanceof Error?Object.defineProperty(u,p.name,{enumerable:!0,get:()=>{throw Om(`property ${JSON.stringify(p.name)}`,w)}}):u[p.name]=w}});for(let p=0;p{throw Om(`index ${p}`,v)}})}return Object.freeze(u)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new $_({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:W.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new z_({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){const r=ne(e);let n=this.getError(r.substring(0,10).toLowerCase());return n?new H_({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const V_="contracts/5.7.0";var Yi=function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};const yt=new O(V_);function pu(t,e){return Yi(this,void 0,void 0,function*(){const r=yield e;typeof r!="string"&&yt.throwArgumentError("invalid address or ENS name","name",r);try{return vt(r)}catch{}t||yt.throwError("a provider or signer is needed to resolve ENS names",O.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return n==null&&yt.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function Ol(t,e,r){return Yi(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>Ol(t,Array.isArray(e)?e[i]:e[n.name],n))):r.type==="address"?yield pu(t,e):r.type==="tuple"?yield Ol(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(n=>Ol(t,n,r.arrayChildren))):Promise.reject(yt.makeError("invalid value for array",O.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function ic(t,e,r){return Yi(this,void 0,void 0,function*(){let n={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(n=at(r.pop())),yt.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=xt({override:pu(t.signer,n.from),signer:t.signer.getAddress()}).then(u=>Yi(this,void 0,void 0,function*(){return vt(u.signer)!==u.override&&yt.throwError("Contract with a Signer cannot override from",O.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),u.override})):n.from=t.signer.getAddress():n.from&&(n.from=pu(t.provider,n.from));const i=yield xt({args:Ol(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:xt(n)||{}}),s=t.interface.encodeFunctionData(e,i.args),o={data:s,to:i.address},a=i.overrides;if(a.nonce!=null&&(o.nonce=W.from(a.nonce).toNumber()),a.gasLimit!=null&&(o.gasLimit=W.from(a.gasLimit)),a.gasPrice!=null&&(o.gasPrice=W.from(a.gasPrice)),a.maxFeePerGas!=null&&(o.maxFeePerGas=W.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(o.maxPriorityFeePerGas=W.from(a.maxPriorityFeePerGas)),a.from!=null&&(o.from=a.from),a.type!=null&&(o.type=a.type),a.accessList!=null&&(o.accessList=rs(a.accessList)),o.gasLimit==null&&e.gas!=null){let u=21e3;const c=oe(s);for(let h=0;hn[u]!=null);return l.length&&yt.throwError(`cannot override ${l.map(u=>JSON.stringify(u)).join(",")}`,O.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function G_(t,e){return function(...r){return ic(t,e,r)}}function W_(t,e){const r=t.signer||t.provider;return function(...n){return Yi(this,void 0,void 0,function*(){r||yt.throwError("estimate require a provider or signer",O.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield ic(t,e,n);return yield r.estimateGas(i)})}}function K_(t,e){const r=e.wait.bind(e);e.wait=n=>r(n).then(i=>(i.events=i.logs.map(s=>{let o=lr(s),a=null;try{a=t.interface.parseLog(s)}catch{}return a&&(o.args=a.args,o.decode=(l,u)=>t.interface.decodeEventLog(a.eventFragment,l,u),o.event=a.name,o.eventSignature=a.signature),o.removeListener=()=>t.provider,o.getBlock=()=>t.provider.getBlock(i.blockHash),o.getTransaction=()=>t.provider.getTransaction(i.transactionHash),o.getTransactionReceipt=()=>Promise.resolve(i),o}),i))}function s2(t,e,r){const n=t.signer||t.provider;return function(...i){return Yi(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=at(i.pop());l.blockTag!=null&&(s=yield l.blockTag),delete l.blockTag,i.push(l)}t.deployTransaction!=null&&(yield t._deployed(s));const o=yield ic(t,e,i),a=yield n.call(o,s);try{let l=t.interface.decodeFunctionResult(e,a);return r&&e.outputs.length===1&&(l=l[0]),l}catch(l){throw l.code===O.errors.CALL_EXCEPTION&&(l.address=t.address,l.args=i,l.transaction=o),l}})}}function Q_(t,e){return function(...r){return Yi(this,void 0,void 0,function*(){t.signer||yt.throwError("sending a transaction requires a signer",O.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());const n=yield ic(t,e,r),i=yield t.signer.sendTransaction(n);return K_(t,i),i})}}function Tm(t,e,r){return e.constant?s2(t,e,r):Q_(t,e)}function o2(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class ga{constructor(e,r){H(this,"tag",e),H(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(n=>r||n.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const r=this.listenerCount();return this._listeners=this._listeners.filter(n=>{const i=e.slice();return setTimeout(()=>{n.listener.apply(this,i)},0),!n.once}),r}prepareEvent(e){}getEmit(e){return[e]}}class J_ extends ga{constructor(){super("error",null)}}class jm extends ga{constructor(e,r,n,i){const s={address:e};let o=r.getEventTopic(n);i?(o!==i[0]&&yt.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(o2(s),s),H(this,"address",e),H(this,"interface",r),H(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,n)=>this.interface.decodeEventLog(this.fragment,r,n);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){const r=N_(e.args);if(r.length)throw r[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class Lm extends ga{constructor(e,r){super("*",{address:e}),H(this,"address",e),H(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{const r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(n,i)=>this.interface.decodeEventLog(r.eventFragment,n,i),e.args=r.args}catch{}}}class Y_{constructor(e,r,n){H(this,"interface",mr(new.target,"getInterface")(r)),n==null?(H(this,"provider",null),H(this,"signer",null)):Ta.isSigner(n)?(H(this,"provider",n.provider||null),H(this,"signer",n)):ro.isProvider(n)?(H(this,"provider",n),H(this,"signer",null)):yt.throwArgumentError("invalid signer or provider","signerOrProvider",n),H(this,"callStatic",{}),H(this,"estimateGas",{}),H(this,"functions",{}),H(this,"populateTransaction",{}),H(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];H(this.filters,a,(...u)=>({address:this.address,topics:this.interface.encodeFilterTopics(l,u)})),o[l.name]||(o[l.name]=[]),o[l.name].push(a)}),Object.keys(o).forEach(a=>{const l=o[a];l.length===1?H(this.filters,a,this.filters[l[0]]):yt.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(H(this,"_runningEvents",{}),H(this,"_wrappedEmits",{}),e==null&&yt.throwArgumentError("invalid contract address or ENS name","addressOrName",e),H(this,"address",e),this.provider)H(this,"resolvedAddress",pu(this.provider,e));else try{H(this,"resolvedAddress",Promise.resolve(vt(e)))}catch{yt.throwError("provider is required to use ENS name as contract address",O.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(o=>{});const i={},s={};Object.keys(this.interface.functions).forEach(o=>{const a=this.interface.functions[o];if(s[o]){yt.warn(`Duplicate ABI entry for ${JSON.stringify(o)}`);return}s[o]=!0;{const l=a.name;i[`%${l}`]||(i[`%${l}`]=[]),i[`%${l}`].push(o)}this[o]==null&&H(this,o,Tm(this,a,!0)),this.functions[o]==null&&H(this.functions,o,Tm(this,a,!1)),this.callStatic[o]==null&&H(this.callStatic,o,s2(this,a,!0)),this.populateTransaction[o]==null&&H(this.populateTransaction,o,G_(this,a)),this.estimateGas[o]==null&&H(this.estimateGas,o,W_(this,a))}),Object.keys(i).forEach(o=>{const a=i[o];if(a.length>1)return;o=o.substring(1);const l=a[0];try{this[o]==null&&H(this,o,this[l])}catch{}this.functions[o]==null&&H(this.functions,o,this.functions[l]),this.callStatic[o]==null&&H(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&H(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&H(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return Hd(e)}static getInterface(e){return jh.isInterface(e)?e:new jh(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&&yt.throwError("contract not deployed",O.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||yt.throwError("sending a transactions require a signer",O.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=at(e||{});return["from","to"].forEach(function(n){r[n]!=null&&yt.throwError("cannot override "+n,O.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new Jd(e,this.provider));const r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&H(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return Th.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new J_);if(e==="event")return this._normalizeRunningEvent(new ga("event",null));if(e==="*")return this._normalizeRunningEvent(new Lm(this.address,this.interface));const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new jm(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{const n=e.topics[0];if(typeof n!="string")throw new Error("invalid topic");const i=this.interface.getEvent(n);return this._normalizeRunningEvent(new jm(this.address,this.interface,i,e.topics))}catch{}const r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new ga(o2(r),r))}return this._normalizeRunningEvent(new Lm(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,n){const i=lr(r);return i.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(r.blockHash),i.getTransaction=()=>this.provider.getTransaction(r.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(i),i}_addEventListener(e,r,n){if(this.provider||yt.throwError("events require a provider or a signer with a provider",O.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=s=>{let o=this._wrapEvent(e,s,r);if(o.decodeError==null)try{const a=e.getEmit(o);this.emit(e.filter,...a)}catch(a){o.decodeError=a.error}e.filter!=null&&this.emit("event",o),o.decodeError!=null&&this.emit("error",o.decodeError,o)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,r,n){const i=this._getRunningEvent(e),s=at(i.filter);return typeof r=="string"&&me(r,32)?(n!=null&&yt.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),s.blockHash=r):(s.fromBlock=r??0,s.toBlock=n??"latest"),this.provider.getLogs(s).then(o=>o.map(a=>this._wrapEvent(i,a,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;const n=this._getRunningEvent(e),i=n.run(r)>0;return this._checkRunningEvents(n),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,n)=>r+this._runningEvents[n].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const r=[];for(let n in this._runningEvents)this._runningEvents[n].listeners().forEach(i=>{r.push(i)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const n in this._runningEvents){const i=this._runningEvents[n];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(r),this._checkRunningEvents(n),this}removeListener(e,r){return this.off(e,r)}}class X_ extends Y_{}const Z_="solidity/5.7.0",e6=new RegExp("^bytes([0-9]+)$"),t6=new RegExp("^(u?int)([0-9]*)$"),r6=new RegExp("^(.*)\\[([0-9]*)\\]$"),n6="0000000000000000000000000000000000000000000000000000000000000000",ls=new O(Z_);function a2(t,e,r){switch(t){case"address":return r?Sl(e,32):oe(e);case"string":return yr(e);case"bytes":return oe(e);case"bool":return e=e?"0x01":"0x00",r?Sl(e,32):oe(e)}let n=t.match(t6);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!==0||i===0||i>256)&&ls.throwArgumentError("invalid number type","type",t),r&&(i=256),e=W.from(e).toTwos(i),Sl(e,i/8)}if(n=t.match(e6),n){const i=parseInt(n[1]);return(String(i)!==n[1]||i===0||i>32)&&ls.throwArgumentError("invalid bytes type","type",t),oe(e).byteLength!==i&&ls.throwArgumentError(`invalid value for ${t}`,"value",e),r?oe((e+n6).substring(0,66)):e}if(n=t.match(r6),n&&Array.isArray(e)){const i=n[1];parseInt(n[2]||String(e.length))!=e.length&&ls.throwArgumentError(`invalid array length for ${t}`,"value",e);const o=[];return e.forEach(function(a){o.push(a2(i,a,!0))}),zt(o)}return ls.throwArgumentError("invalid type","type",t)}function l2(t,e){t.length!=e.length&&ls.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(n,i){r.push(a2(n,e[i]))}),ne(zt(r))}function i6(t,e){return ot(l2(t,e))}const vf=[{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"apps",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"contractURI",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getInitializedVersion",inputs:[],outputs:[{name:"",type:"uint64",internalType:"uint64"}],stateMutability:"view"},{type:"function",name:"getPackageId",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"pure"},{type:"function",name:"getPackageInfo",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"getPackageInfo",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_knsResolver",type:"address",internalType:"contract KNSRegistryResolver"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"knsResolver",inputs:[],outputs:[{name:"",type:"address",internalType:"contract KNSRegistryResolver"}],stateMutability:"view"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"registerApp",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unlistPacakge",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateContractURI",inputs:[{name:"uri",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateMetadata",inputs:[{name:"package",type:"uint256",internalType:"uint256"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AppMetadataUpdated",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"AppRegistered",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"packageName",type:"string",indexed:!1,internalType:"string"},{name:"publisherName",type:"bytes",indexed:!1,internalType:"bytes"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC721IncorrectOwner",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InsufficientApproval",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC721InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOperator",inputs:[{name:"operator",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC721NonexistentToken",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]}];class u2{static createInterface(){return new jh(vf)}static connect(e,r){return new X_(e,vf,r)}}o0(u2,"abi",vf);var c2={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Bm=Wr.createContext&&Wr.createContext(c2),s6=["attr","size","title"];function o6(t,e){if(t==null)return{};var r=a6(t,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function a6(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}function mu(){return mu=Object.assign?Object.assign.bind():function(t){for(var e=1;eWr.createElement(e.tag,gu({key:r},e.attr),f2(e.child)))}function Vt(t){return e=>Wr.createElement(f6,mu({attr:gu({},t.attr)},e),f2(t.child))}function f6(t){var e=r=>{var{attr:n,size:i,title:s}=t,o=o6(t,s6),a=i||r.size||"1em",l;return r.className&&(l=r.className),t.className&&(l=(l?l+" ":"")+t.className),Wr.createElement("svg",mu({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,o,{className:l,style:gu(gu({color:t.color||r.color},r.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&Wr.createElement("title",null,s),t.children)};return Bm!==void 0?Wr.createElement(Bm.Consumer,null,r=>e(r)):e(c2)}function h6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(t)}function d6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(t)}function p6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"},child:[]}]})(t)}function h2(t){return Vt({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31A12 12 0 0 0 45.15 301l235.22-193.74a12.19 12.19 0 0 1 15.3 0L530.9 301a12 12 0 0 0 16.9-1.6l25.5-31a12 12 0 0 0-1.7-16.93z"},child:[]}]})(t)}function m6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}var g6={BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Fm=t=>{let e;const r=new Set,n=(l,u)=>{const c=typeof l=="function"?l(e):l;if(!Object.is(c,e)){const h=e;e=u??(typeof c!="object"||c===null)?c:Object.assign({},e,c),r.forEach(p=>p(e,h))}},i=()=>e,a={setState:n,getState:i,subscribe:l=>(r.add(l),()=>r.delete(l)),destroy:()=>{(g6?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,a),a},v6=t=>t?Fm(t):Fm;var d2={BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:y6}=Wr,{useSyncExternalStoreWithSelector:w6}=Qu;let Um=!1;function x6(t,e=t.getState,r){(d2?"production":void 0)!=="production"&&r&&!Um&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Um=!0);const n=w6(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return y6(n),n}const zm=t=>{(d2?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?v6(t):t,r=(n,i)=>x6(e,n,i);return Object.assign(r,e),r},b6=t=>t?zm(t):zm;var E6={BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function p2(t,e){let r;try{r=t()}catch{return}return{getItem:i=>{var s;const o=l=>l===null?null:JSON.parse(l,e==null?void 0:e.reviver),a=(s=r.getItem(i))!=null?s:null;return a instanceof Promise?a.then(o):o(a)},setItem:(i,s)=>r.setItem(i,JSON.stringify(s,e==null?void 0:e.replacer)),removeItem:i=>r.removeItem(i)}}const va=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return va(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return va(n)(r)}}}},A6=(t,e)=>(r,n,i)=>{let s={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:k=>k,version:0,merge:(k,y)=>({...y,...k}),...e},o=!1;const a=new Set,l=new Set;let u;try{u=s.getStorage()}catch{}if(!u)return t((...k)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...k)},n,i);const c=va(s.serialize),h=()=>{const k=s.partialize({...n()});let y;const m=c({state:k,version:s.version}).then(A=>u.setItem(s.name,A)).catch(A=>{y=A});if(y)throw y;return m},p=i.setState;i.setState=(k,y)=>{p(k,y),h()};const v=t((...k)=>{r(...k),h()},n,i);let w;const b=()=>{var k;if(!u)return;o=!1,a.forEach(m=>m(n()));const y=((k=s.onRehydrateStorage)==null?void 0:k.call(s,n()))||void 0;return va(u.getItem.bind(u))(s.name).then(m=>{if(m)return s.deserialize(m)}).then(m=>{if(m)if(typeof m.version=="number"&&m.version!==s.version){if(s.migrate)return s.migrate(m.state,m.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return m.state}).then(m=>{var A;return w=s.merge(m,(A=n())!=null?A:v),r(w,!0),h()}).then(()=>{y==null||y(w,void 0),o=!0,l.forEach(m=>m(w))}).catch(m=>{y==null||y(void 0,m)})};return i.persist={setOptions:k=>{s={...s,...k},k.getStorage&&(u=k.getStorage())},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>b(),hasHydrated:()=>o,onHydrate:k=>(a.add(k),()=>{a.delete(k)}),onFinishHydration:k=>(l.add(k),()=>{l.delete(k)})},b(),w||v},_6=(t,e)=>(r,n,i)=>{let s={storage:p2(()=>localStorage),partialize:b=>b,version:0,merge:(b,k)=>({...k,...b}),...e},o=!1;const a=new Set,l=new Set;let u=s.storage;if(!u)return t((...b)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...b)},n,i);const c=()=>{const b=s.partialize({...n()});return u.setItem(s.name,{state:b,version:s.version})},h=i.setState;i.setState=(b,k)=>{h(b,k),c()};const p=t((...b)=>{r(...b),c()},n,i);let v;const w=()=>{var b,k;if(!u)return;o=!1,a.forEach(m=>{var A;return m((A=n())!=null?A:p)});const y=((k=s.onRehydrateStorage)==null?void 0:k.call(s,(b=n())!=null?b:p))||void 0;return va(u.getItem.bind(u))(s.name).then(m=>{if(m)if(typeof m.version=="number"&&m.version!==s.version){if(s.migrate)return s.migrate(m.state,m.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return m.state}).then(m=>{var A;return v=s.merge(m,(A=n())!=null?A:p),r(v,!0),c()}).then(()=>{y==null||y(v,void 0),v=n(),o=!0,l.forEach(m=>m(v))}).catch(m=>{y==null||y(void 0,m)})};return i.persist={setOptions:b=>{s={...s,...b},b.storage&&(u=b.storage)},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>w(),hasHydrated:()=>o,onHydrate:b=>(a.add(b),()=>{a.delete(b)}),onFinishHydration:b=>(l.add(b),()=>{l.delete(b)})},s.skipHydration||w(),v||p},S6=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((E6?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),A6(t,e)):_6(t,e),k6=S6;var kr=(t=>(t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t))(kr||{});const Ee=t=>`${t.package}:${t.publisher}`,Js=t=>{var e;return((e=t.metadata)==null?void 0:e.name)||Ee(t)},yf=t=>{var e,r;return t.publisher==="sys"?"system":(e=t.state)!=null&&e.our_version&&!((r=t.state)!=null&&r.caps_approved)?"downloaded":t.metadata?"installed":"local"},er="/main:app_store:sys",cl=(t,e)=>t.package===e.package&&t.publisher===e.publisher,Pi=b6()(k6((t,e)=>({myApps:{downloaded:[],installed:[],local:[],system:[]},listedApps:[],searchResults:[],query:"",getMyApps:async()=>{const r=await e().getListedApps(),s=(await(await fetch(`${er}/apps`)).json()).reduce((o,a)=>{const l=yf(a);return r.find(u=>u.metadata_hash===a.metadata_hash)&&console.log({listedappmatch:a}),o[l].push(a),o},{downloaded:[],installed:[],local:[],system:[]});return t(()=>({myApps:s})),s},getListedApps:async()=>{const n=await(await fetch(`${er}/apps/listed`)).json();return t({listedApps:n}),n},getMyApp:async r=>{const i=await(await fetch(`${er}/apps/${Ee(r)}`)).json(),s=yf(i),o=e().myApps;o[s]=o[s].map(l=>cl(l,i)?i:l);const a=[...e().listedApps].map(l=>cl(l,i)?i:l);return t({myApps:o,listedApps:a}),i},installApp:async r=>{if((await fetch(`${er}/apps/${Ee(r)}/caps`,{method:"POST"})).status!==kr.OK)throw new Error(`Failed to approve caps for app: ${Ee(r)}`);if((await fetch(`${er}/apps/${Ee(r)}`,{method:"POST"})).status!==kr.CREATED)throw new Error(`Failed to install app: ${Ee(r)}`)},updateApp:async r=>{if((await fetch(`${er}/apps/${Ee(r)}`,{method:"PUT"})).status!==kr.NO_CONTENT)throw new Error(`Failed to update app: ${Ee(r)}`)},uninstallApp:async r=>{if(!confirm(`Are you sure you want to remove ${Ee(r)}?`))return;if((await fetch(`${er}/apps/${Ee(r)}`,{method:"DELETE"})).status!==kr.NO_CONTENT)throw new Error(`Failed to remove app: ${Ee(r)}`);const i={...e().myApps},s=yf(r);i[s]=i[s].filter(a=>!cl(a,r));const o=e().listedApps.map(a=>cl(a,r)?{...a,state:void 0,installed:!1}:a);t({myApps:i,listedApps:o})},getListedApp:async r=>{const n=await fetch(`${er}/apps/listed/${r}`);if(n.status!==kr.OK)throw new Error(`Failed to get app: ${r}`);return await n.json()},downloadApp:async(r,n)=>{if((await fetch(`${er}/apps/listed/${Ee(r)}`,{method:"POST",body:JSON.stringify({download_from:n})})).status!==kr.CREATED)throw new Error(`Failed to get app: ${Ee(r)}`)},getCaps:async r=>{const n=await fetch(`${er}/apps/${Ee(r)}/caps`);if(n.status!==kr.OK)throw new Error(`Failed to get app: ${Ee(r)}`);return(await n.json())[0]},approveCaps:async r=>{if((await fetch(`${er}/apps/${Ee(r)}/caps`,{method:"POST"})).status!==kr.OK)throw new Error(`Failed to get app: ${Ee(r)}`)},rebuildIndex:async()=>{if((await fetch(`${er}/apps/rebuild-index`,{method:"POST"})).status!==kr.OK)throw new Error("Failed to rebuild index")},setMirroring:async(r,n)=>{if((await fetch(`${er}/apps/${Ee(r)}/mirror`,{method:n?"PUT":"DELETE"})).status!==kr.OK)throw new Error(`Failed to start mirror: ${Ee(r)}`);e().getMyApp(r)},setAutoUpdate:async(r,n)=>{if((await fetch(`${er}/apps/${Ee(r)}/auto-update`,{method:n?"PUT":"DELETE"})).status!==kr.OK)throw new Error(`Failed to change auto update: ${Ee(r)}`);e().getMyApp(r)},get:e,set:t}),{name:"app_store",storage:p2(()=>sessionStorage)}));var m2={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(t){(function(){var e={}.hasOwnProperty;function r(){for(var s="",o=0;owindow.innerWidth<=600,N6=({text:t,className:e,size:r})=>{var o;const i=`/icons/${((o=t.split("").pop())==null?void 0:o.toUpperCase())||"0"}`;if(!i)return null;const s=Kn();return S.jsx("img",{src:i,className:ce("m-0 align-self-center rounded-full",{"h-32 w-32":!s&&r==="large","h-18 w-18":!s&&r==="medium","h-12 w-12":s||r==="small"},e)})};function m2({app:t,size:e="medium",overrideImageSize:r,...n}){var a,l,u,c,h;const i=Kn(),s=S.jsx("div",{className:ce({"text-3xl font-[OpenSans]":!i&&e==="large","text-xl":!i&&e!=="large","text-lg":i}),children:((a=t.metadata)==null?void 0:a.name)||Ee(t)}),o=r||e;return S.jsxs("div",{...n,className:ce("flex w-full justify-content-start",e,n.className,{"flex-col":e==="small","gap-2":i,"gap-4":!i,"gap-6":!i&&e==="large"}),children:[e==="small"&&s,(l=t.metadata)!=null&&l.image?S.jsx("img",{src:t.metadata.image,alt:"app icon",className:ce("object-cover",{rounded:!o,"rounded-md":o==="small","rounded-lg":o==="medium","rounded-2xl":o==="large","h-32":o==="large"||o==="small","h-20":o==="medium"})}):S.jsx(N6,{text:t.metadata_hash||((c=(u=t.state)==null?void 0:u.our_version)==null?void 0:c.toString())||"",size:o}),S.jsxs("div",{className:ce("flex flex-col",{"gap-2":i,"gap-4 max-w-3/4":i&&e!=="small"}),children:[e!=="small"&&s,((h=t.metadata)==null?void 0:h.description)&&S.jsx("div",{style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"},className:ce({"text-2xl":e==="large"}),children:t.metadata.description})]})]})}function M6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.2 288 416 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0L214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"},child:[]}]})(t)}function C6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M386.3 160H336c-17.7 0-32 14.3-32 32s14.3 32 32 32H464c17.7 0 32-14.3 32-32V64c0-17.7-14.3-32-32-32s-32 14.3-32 32v51.2L414.4 97.6c-87.5-87.5-229.3-87.5-316.8 0s-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3s163.8-62.5 226.3 0L386.3 160z"},child:[]}]})(t)}function g2(t){return Vt({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"},child:[]}]})(t)}function v2(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32V274.7l-73.4-73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L288 274.7V32zM64 352c-35.3 0-64 28.7-64 64v32c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V416c0-35.3-28.7-64-64-64H346.5l-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352H64zm368 56a24 24 0 1 1 0 48 24 24 0 1 1 0-48z"},child:[]}]})(t)}function P6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M352 256c0 22.2-1.2 43.6-3.3 64H163.3c-2.2-20.4-3.3-41.8-3.3-64s1.2-43.6 3.3-64H348.7c2.2 20.4 3.3 41.8 3.3 64zm28.8-64H503.9c5.3 20.5 8.1 41.9 8.1 64s-2.8 43.5-8.1 64H380.8c2.1-20.6 3.2-42 3.2-64s-1.1-43.4-3.2-64zm112.6-32H376.7c-10-63.9-29.8-117.4-55.3-151.6c78.3 20.7 142 77.5 171.9 151.6zm-149.1 0H167.7c6.1-36.4 15.5-68.6 27-94.7c10.5-23.6 22.2-40.7 33.5-51.5C239.4 3.2 248.7 0 256 0s16.6 3.2 27.8 13.8c11.3 10.8 23 27.9 33.5 51.5c11.6 26 20.9 58.2 27 94.7zm-209 0H18.6C48.6 85.9 112.2 29.1 190.6 8.4C165.1 42.6 145.3 96.1 135.3 160zM8.1 192H131.2c-2.1 20.6-3.2 42-3.2 64s1.1 43.4 3.2 64H8.1C2.8 299.5 0 278.1 0 256s2.8-43.5 8.1-64zM194.7 446.6c-11.6-26-20.9-58.2-27-94.6H344.3c-6.1 36.4-15.5 68.6-27 94.6c-10.5 23.6-22.2 40.7-33.5 51.5C272.6 508.8 263.3 512 256 512s-16.6-3.2-27.8-13.8c-11.3-10.8-23-27.9-33.5-51.5zM135.3 352c10 63.9 29.8 117.4 55.3 151.6C112.2 482.9 48.6 426.1 18.6 352H135.3zm358.1 0c-30 74.1-93.6 130.9-171.9 151.6c25.5-34.2 45.2-87.7 55.3-151.6H493.4z"},child:[]}]})(t)}function R6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M32 32C14.3 32 0 46.3 0 64S14.3 96 32 96h96V416H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H288c17.7 0 32-14.3 32-32s-14.3-32-32-32H192V96h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H160 32z"},child:[]}]})(t)}function I6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"},child:[]}]})(t)}function O6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M72 88a56 56 0 1 1 112 0A56 56 0 1 1 72 88zM64 245.7C54 256.9 48 271.8 48 288s6 31.1 16 42.3V245.7zm144.4-49.3C178.7 222.7 160 261.2 160 304c0 34.3 12 65.8 32 90.5V416c0 17.7-14.3 32-32 32H96c-17.7 0-32-14.3-32-32V389.2C26.2 371.2 0 332.7 0 288c0-61.9 50.1-112 112-112h32c24 0 46.2 7.5 64.4 20.3zM448 416V394.5c20-24.7 32-56.2 32-90.5c0-42.8-18.7-81.3-48.4-107.7C449.8 183.5 472 176 496 176h32c61.9 0 112 50.1 112 112c0 44.7-26.2 83.2-64 101.2V416c0 17.7-14.3 32-32 32H480c-17.7 0-32-14.3-32-32zm8-328a56 56 0 1 1 112 0A56 56 0 1 1 456 88zM576 245.7v84.7c10-11.3 16-26.1 16-42.3s-6-31.1-16-42.3zM320 32a64 64 0 1 1 0 128 64 64 0 1 1 0-128zM240 304c0 16.2 6 31 16 42.3V261.7c-10 11.3-16 26.1-16 42.3zm144-42.3v84.7c10-11.3 16-26.1 16-42.3s-6-31.1-16-42.3zM448 304c0 44.7-26.2 83.2-64 101.2V448c0 17.7-14.3 32-32 32H288c-17.7 0-32-14.3-32-32V405.2c-37.8-18-64-56.5-64-101.2c0-61.9 50.1-112 112-112h32c61.9 0 112 50.1 112 112z"},child:[]}]})(t)}function T6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M73 39c-14.8-9.1-33.4-9.4-48.5-.9S0 62.6 0 80V432c0 17.4 9.4 33.4 24.5 41.9s33.7 8.1 48.5-.9L361 297c14.3-8.7 23-24.2 23-41s-8.7-32.2-23-41L73 39z"},child:[]}]})(t)}function j6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M288 109.3V352c0 17.7-14.3 32-32 32s-32-14.3-32-32V109.3l-73.4 73.4c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l128-128c12.5-12.5 32.8-12.5 45.3 0l128 128c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L288 109.3zM64 352H192c0 35.3 28.7 64 64 64s64-28.7 64-64H448c35.3 0 64 28.7 64 64v32c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V416c0-35.3 28.7-64 64-64zM432 456a24 24 0 1 0 0-48 24 24 0 1 0 0 48z"},child:[]}]})(t)}function y2(t){return Vt({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M376.6 84.5c11.3-13.6 9.5-33.8-4.1-45.1s-33.8-9.5-45.1 4.1L192 206 56.6 43.5C45.3 29.9 25.1 28.1 11.5 39.4S-3.9 70.9 7.4 84.5L150.3 256 7.4 427.5c-11.3 13.6-9.5 33.8 4.1 45.1s33.8 9.5 45.1-4.1L192 306 327.4 468.5c11.3 13.6 31.5 15.4 45.1 4.1s15.4-31.5 4.1-45.1L233.7 256 376.6 84.5z"},child:[]}]})(t)}const t0=({show:t,hide:e,hideClose:r=!1,title:n,...i})=>{const s=o=>{o.stopPropagation()};return t?S.jsx("div",{className:ce("bg-black/25 backdrop-blur-lg fixed top-0 bottom-0 left-0 right-0 flex flex-col c z-30 min-h-[10em] min-w-[30em]",{show:t}),onClick:e,children:S.jsxs("div",{...i,className:`flex flex-col relative bg-black/90 rounded-lg py-6 px-12 ${i.className||""}`,onClick:s,children:[!!n&&S.jsx("h4",{className:"mt-0 mb-2",children:n}),!r&&S.jsx("button",{className:"icon absolute top-1 right-1",onClick:e,children:S.jsx(y2,{})}),S.jsx("div",{className:"flex flex-col items-center w-full",onClick:s,children:i.children})]})}):null};function ya({msg:t}){return S.jsxs("div",{id:"loading",className:"flex flex-col text-center",children:[S.jsx("h4",{children:t}),S.jsxs("div",{id:"loader",children:[" ",S.jsx("div",{})," ",S.jsx("div",{})," ",S.jsx("div",{})," ",S.jsx("div",{})," "]})]})}function L6({app:t,isIcon:e=!1,...r}){const{updateApp:n,getCaps:i,getMyApp:s,getMyApps:o}=Pi(),[a,l]=T.useState(!1),[u,c]=T.useState([]),[h,p]=T.useState(""),v=T.useCallback(async b=>{b.preventDefault(),i(t).then(k=>{c(k.request_capabilities)}),l(!0)},[t,l,i]),y=T.useCallback(async()=>{try{p(`Updating ${Js(t)}...`),await n(t);const b=setInterval(()=>{s(t).then(k=>{k.installed&&(p(""),l(!1),clearInterval(b),o())}).catch(console.log)},2e3)}catch(b){console.error(b),window.alert("Failed to update, please try again."),p("")}},[t,n,s]);return S.jsxs(S.Fragment,{children:[S.jsx("button",{...r,type:"button",className:ce("text-sm self-start",r.className),onClick:v,children:"Update"}),S.jsx(t0,{show:a,hide:()=>l(!1),children:h?S.jsx(ya,{msg:h}):S.jsxs(S.Fragment,{children:[S.jsx("h4",{children:"Approve App Permissions"}),S.jsxs("h5",{className:"m-0",children:[Js(t)," needs the following permissions:"]}),S.jsx("br",{}),S.jsx("ul",{className:"flex flex-col items-start",children:u.map(b=>S.jsx("li",{children:b},b))}),S.jsx("button",{type:"button",onClick:y,children:"Approve & Update"})]})})]})}function B6({app:t,isIcon:e=!1,...r}){var m,A,j,L,D,F,U;const{downloadApp:n,getCaps:i,getMyApp:s,getMyApps:o}=Pi(),[a,l]=T.useState(!1),[u,c]=T.useState(((j=(A=(m=t.metadata)==null?void 0:m.properties)==null?void 0:A.mirrors)==null?void 0:j[0])||"Other"),[h,p]=T.useState(""),[v,y]=T.useState("");T.useEffect(()=>{var G,J,re;c(((re=(J=(G=t.metadata)==null?void 0:G.properties)==null?void 0:J.mirrors)==null?void 0:re[0])||"Other")},[(D=(L=t.metadata)==null?void 0:L.properties)==null?void 0:D.mirrors]);const b=T.useCallback(async G=>{G.preventDefault(),l(!0)},[t,l,i]),k=T.useCallback(async G=>{G.preventDefault(),G.stopPropagation();const J=u==="Other"?h:u;if(!J){window.alert("Please select a mirror");return}try{y(`Downloading ${Js(t)}...`),await n(t,J);const re=setInterval(()=>{s(t).then(()=>{y(""),l(!1),clearInterval(re),o()}).catch(console.log)},2e3)}catch(re){console.error(re),window.alert(`Failed to download app from ${J}, please try a different mirror.`),y("")}},[u,h,t,n,s]),w=Js(t);return S.jsxs(S.Fragment,{children:[S.jsx("button",{...r,type:"button",className:ce("text-sm self-start",r.className,{"icon clear":e,black:!e}),onClick:b,children:e?S.jsx(v2,{}):"Download"}),S.jsx(t0,{show:a,hide:()=>l(!1),children:v?S.jsx(ya,{msg:v}):S.jsxs("form",{className:"flex flex-col items-center gap-2",onSubmit:k,children:[S.jsxs("h4",{children:["Download '",w,"'"]}),S.jsx("h5",{children:"Select Mirror"}),S.jsx("select",{value:u,onChange:G=>c(G.target.value),children:(((U=(F=t.metadata)==null?void 0:F.properties)==null?void 0:U.mirrors)||[]).concat(["Other"]).map(G=>S.jsx("option",{value:G,children:G},G))}),u==="Other"&&S.jsx("input",{type:"text",value:h,onChange:G=>p(G.target.value),placeholder:"Mirror, i.e. 'template.os'",className:"p-1 max-w-[240px] w-full",required:!0,autoFocus:!0}),S.jsx("button",{type:"submit",children:"Download"})]})})]})}function D6({app:t,isIcon:e=!1,...r}){const{installApp:n,getCaps:i,getMyApp:s,getMyApps:o}=Pi(),[a,l]=T.useState(!1),[u,c]=T.useState([]),[h,p]=T.useState(""),v=T.useCallback(async b=>{b.preventDefault(),i(t).then(k=>{c(k.request_capabilities)}),l(!0)},[t,l,i]),y=T.useCallback(async()=>{try{p(`Installing ${Js(t)}...`),await n(t);const b=setInterval(()=>{s(t).then(k=>{k.installed&&(p(""),l(!1),clearInterval(b),o())}).catch(console.log)},2e3)}catch(b){console.error(b),window.alert("Failed to install, please try again."),p("")}},[t,n,s]);return S.jsxs(S.Fragment,{children:[S.jsx("button",{...r,type:"button",className:ce("text-sm self-start",r.className,{"icon clear":e}),onClick:v,children:e?S.jsx(R6,{}):"Install"}),S.jsx(t0,{show:a,hide:()=>l(!1),children:h?S.jsx(ya,{msg:h}):S.jsxs(S.Fragment,{children:[S.jsx("h4",{children:"Approve App Permissions"}),S.jsxs("h5",{className:"m-0",children:[Js(t)," needs the following permissions:"]}),S.jsx("ul",{className:"flex flex-col items-start",children:u.map(b=>S.jsx("li",{children:b},b))}),S.jsx("button",{type:"button",onClick:y,children:"Approve & Install"})]})})]})}function F6({app:t,launchPath:e,isIcon:r=!1,...n}){const i=T.useCallback(async s=>{s.preventDefault(),window.location.href=`/${e.replace("/","")}`},[t,e]);return S.jsx(S.Fragment,{children:S.jsx("button",{...n,type:"button",className:ce("text-sm self-start",n.className,{"icon clear":r,alt:!r}),onClick:i,children:r?S.jsx(T6,{}):"Launch"})})}function w2({app:t,isIcon:e=!1,...r}){const{installed:n,downloaded:i,updatable:s}=T.useMemo(()=>{var v,y,b,k;const u=(Object.entries(((y=(v=t==null?void 0:t.metadata)==null?void 0:v.properties)==null?void 0:y.code_hashes)||{}).find(([w])=>{var m,A;return w===((A=(m=t.metadata)==null?void 0:m.properties)==null?void 0:A.current_version)})||[])[1],c=t.installed,h=!!t.state,p=!!((b=t.state)!=null&&b.our_version&&u)&&((k=t.state)==null?void 0:k.our_version)!==u&&t.publisher!==window.our.node;return{installed:c,downloaded:h,updatable:p}},[t]),[o,a]=T.useState("");return T.useEffect(()=>{fetch("/apps").then(l=>l.json()).then(l=>{if(Array.isArray(l)){const u=l.find(c=>t.package===c.package_name);u&&a(u.path)}})},[t]),S.jsx(S.Fragment,{children:n&&o?S.jsx(F6,{app:t,...r,isIcon:e,launchPath:o}):n&&s?S.jsx(L6,{app:t,...r,isIcon:e}):i?n?e?S.jsx("button",{className:"pointer-events none icon clear absolute top-0 right-0",children:S.jsx(g2,{})}):S.jsx(S.Fragment,{}):S.jsx(D6,{app:t,...r,isIcon:e}):S.jsx(B6,{app:t,...r,isIcon:e})})}const Lh="/my-apps",U6="/",sc="/publish",vu="/app-details",x2=t=>!!t&&t[0]==="o",$m=oa.unstable_batchedUpdates||(t=>t()),ss=(t,e,r=1e-4)=>Math.abs(t-e)t===!0||!!(t&&t[e]),gn=(t,e)=>typeof t=="function"?t(e):t,b2="_szhsinMenu",z6=t=>t[b2],$6=(t,e)=>Object.defineProperty(e,b2,{value:t}),r0=(t,e)=>(e&&Object.keys(e).forEach(r=>{const n=t[r],i=e[r];typeof i=="function"&&n?t[r]=(...s)=>{i(...s),n(...s)}:t[r]=i}),t),H6=t=>{if(typeof t!="string")return{top:0,right:0,bottom:0,left:0};const e=t.trim().split(/\s+/,4).map(parseFloat),r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?r:e[1];return{top:r,right:n,bottom:isNaN(e[2])?r:e[2],left:isNaN(e[3])?n:e[3]}},wf=t=>{for(;t;){if(t=t.parentNode,!t||t===document.body||!t.parentNode)return;const{overflow:e,overflowX:r,overflowY:n}=getComputedStyle(t);if(/auto|scroll|overlay|hidden/.test(e+n+r))return t}};function q6(t,e){return{"aria-disabled":t||void 0,tabIndex:e?0:-1}}function Hm(t,e){for(let r=0;rT.useMemo(()=>{const i=e?`${t}__${e}`:t;let s=i;r&&Object.keys(r).forEach(a=>{const l=r[a];l&&(s+=` ${i}--${l===!0?a:`${a}-${l}`}`)});let o=typeof n=="function"?n(r):n;return typeof o=="string"&&(o=o.trim(),o&&(s+=` ${o}`)),s},[t,e,r,n]),V6="szh-menu-container",xf="szh-menu",G6="szh-menu-button",W6="arrow",K6=T.createContext(),Q6=T.createContext({}),qm=T.createContext({}),J6=T.createContext({}),E2=T.createContext({}),Rn=Object.freeze({ENTER:"Enter",ESC:"Escape",SPACE:" ",HOME:"Home",END:"End",LEFT:"ArrowLeft",RIGHT:"ArrowRight",UP:"ArrowUp",DOWN:"ArrowDown"}),It=Object.freeze({RESET:0,SET:1,UNSET:2,INCREASE:3,DECREASE:4,FIRST:5,LAST:6,SET_INDEX:7}),xa=Object.freeze({CLICK:"click",CANCEL:"cancel",BLUR:"blur",SCROLL:"scroll"}),Uo=Object.freeze({FIRST:"first",LAST:"last"}),Y6=Object.freeze({entering:"opening",entered:"open",exiting:"closing",exited:"closed"}),bf="absolute",X6="menuitem",Vm={"aria-hidden":!0,role:X6},Z6=$6("MenuButton",T.forwardRef(function({className:e,isOpen:r,disabled:n,children:i,...s},o){const a=T.useMemo(()=>({open:r}),[r]);return S.jsx("button",{"aria-haspopup":!0,"aria-expanded":r,"aria-disabled":n||void 0,type:"button",disabled:n,...s,ref:o,className:yu({block:G6,modifiers:a,className:e}),children:i})})),eS=({className:t,containerRef:e,containerProps:r,children:n,isOpen:i,theming:s,transition:o,onClose:a})=>{const l=wa(o,"item"),u=({key:h})=>{switch(h){case Rn.ESC:gn(a,{key:h,reason:xa.CANCEL});break}},c=h=>{i&&!h.currentTarget.contains(h.relatedTarget)&&gn(a,{reason:xa.BLUR})};return S.jsx("div",{...r0({onKeyDown:u,onBlur:c},r),className:yu({block:V6,modifiers:T.useMemo(()=>({theme:s,itemTransition:l}),[s,l]),className:t}),style:{position:"absolute",...r==null?void 0:r.style},ref:e,children:n})},tS=()=>{let t,e=0;return{toggle:r=>{r?e++:e--,e=Math.max(e,0)},on:(r,n,i)=>{e?t||(t=setTimeout(()=>{t=0,n()},r)):i==null||i()},off:()=>{t&&(clearTimeout(t),t=0)}}},rS=(t,e)=>{const[r,n]=T.useState(),s=T.useRef({items:[],hoverIndex:-1,sorted:!1}).current,o=T.useCallback((l,u)=>{const{items:c}=s;if(!l)s.items=[];else if(u)c.push(l);else{const h=c.indexOf(l);h>-1&&(c.splice(h,1),l.contains(document.activeElement)&&(e.current.focus(),n()))}s.hoverIndex=-1,s.sorted=!1},[s,e]),a=T.useCallback((l,u,c)=>{const{items:h,hoverIndex:p}=s,v=()=>{if(s.sorted)return;const k=t.current.querySelectorAll(".szh-menu__item");h.sort((w,m)=>Hm(k,w)-Hm(k,m)),s.sorted=!0};let y=-1,b;switch(l){case It.RESET:break;case It.SET:b=u;break;case It.UNSET:b=k=>k===u?void 0:k;break;case It.FIRST:v(),y=0,b=h[y];break;case It.LAST:v(),y=h.length-1,b=h[y];break;case It.SET_INDEX:v(),y=c,b=h[y];break;case It.INCREASE:v(),y=p,y<0&&(y=h.indexOf(u)),y++,y>=h.length&&(y=0),b=h[y];break;case It.DECREASE:v(),y=p,y<0&&(y=h.indexOf(u)),y--,y<0&&(y=h.length-1),b=h[y];break}b||(y=-1),n(b),s.hoverIndex=y},[t,s]);return{hoverItem:r,dispatch:a,updateItems:o}},nS=(t,e,r,n)=>{const i=e.current.getBoundingClientRect(),s=t.current.getBoundingClientRect(),o=r===window?{left:0,top:0,right:document.documentElement.clientWidth,bottom:window.innerHeight}:r.getBoundingClientRect(),a=H6(n),l=y=>y+s.left-o.left-a.left,u=y=>y+s.left+i.width-o.right+a.right,c=y=>y+s.top-o.top-a.top,h=y=>y+s.top+i.height-o.bottom+a.bottom;return{menuRect:i,containerRect:s,getLeftOverflow:l,getRightOverflow:u,getTopOverflow:c,getBottomOverflow:h,confineHorizontally:y=>{let b=l(y);if(b<0)y-=b;else{const k=u(y);k>0&&(y-=k,b=l(y),b<0&&(y-=b))}return y},confineVertically:y=>{let b=c(y);if(b<0)y-=b;else{const k=h(y);k>0&&(y-=k,b=c(y),b<0&&(y-=b))}return y}}},iS=({arrowRef:t,menuY:e,anchorRect:r,containerRect:n,menuRect:i})=>{let s=r.top-n.top-e+r.height/2;const o=t.current.offsetHeight*1.25;return s=Math.max(o,s),s=Math.min(s,i.height-o),s},sS=({anchorRect:t,containerRect:e,menuRect:r,placeLeftorRightY:n,placeLeftX:i,placeRightX:s,getLeftOverflow:o,getRightOverflow:a,confineHorizontally:l,confineVertically:u,arrowRef:c,arrow:h,direction:p,position:v})=>{let y=p,b=n;v!=="initial"&&(b=u(b),v==="anchor"&&(b=Math.min(b,t.bottom-e.top),b=Math.max(b,t.top-e.top-r.height)));let k,w,m;return y==="left"?(k=i,v!=="initial"&&(w=o(k),w<0&&(m=a(s),(m<=0||-w>m)&&(k=s,y="right")))):(k=s,v!=="initial"&&(m=a(k),m>0&&(w=o(i),(w>=0||-w{let s=r.left-n.left-e+r.width/2;const o=t.current.offsetWidth*1.25;return s=Math.max(o,s),s=Math.min(s,i.width-o),s},aS=({anchorRect:t,containerRect:e,menuRect:r,placeToporBottomX:n,placeTopY:i,placeBottomY:s,getTopOverflow:o,getBottomOverflow:a,confineHorizontally:l,confineVertically:u,arrowRef:c,arrow:h,direction:p,position:v})=>{let y=p==="top"?"top":"bottom",b=n;v!=="initial"&&(b=l(b),v==="anchor"&&(b=Math.min(b,t.right-e.left),b=Math.max(b,t.left-e.left-r.width)));let k,w,m;return y==="top"?(k=i,v!=="initial"&&(w=o(k),w<0&&(m=a(s),(m<=0||-w>m)&&(k=s,y="bottom")))):(k=s,v!=="initial"&&(m=a(k),m>0&&(w=o(i),(w>=0||-w{const{menuRect:u,containerRect:c}=l,h=r==="left"||r==="right";let p=h?n:i,v=h?i:n;if(t){const L=a.current;h?p+=L.offsetWidth:v+=L.offsetHeight}const y=o.left-c.left-u.width-p,b=o.right-c.left+p,k=o.top-c.top-u.height-v,w=o.bottom-c.top+v;let m,A;e==="end"?(m=o.right-c.left-u.width,A=o.bottom-c.top-u.height):e==="center"?(m=o.left-c.left-(u.width-o.width)/2,A=o.top-c.top-(u.height-o.height)/2):(m=o.left-c.left,A=o.top-c.top),m+=p,A+=v;const j={...l,anchorRect:o,placeLeftX:y,placeRightX:b,placeLeftorRightY:A,placeTopY:k,placeBottomY:w,placeToporBottomX:m,arrowRef:a,arrow:t,direction:r,position:s};switch(r){case"left":case"right":return sS(j);case"top":case"bottom":default:return aS(j)}},Ef=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?T.useLayoutEffect:T.useEffect;function Gm(t,e){typeof t=="function"?t(e):t.current=e}const A2=(t,e)=>T.useMemo(()=>t?e?r=>{Gm(t,r),Gm(e,r)}:t:e,[t,e]),Wm=-9999,uS=({ariaLabel:t,menuClassName:e,menuStyle:r,arrow:n,arrowProps:i={},anchorPoint:s,anchorRef:o,containerRef:a,containerProps:l,focusProps:u,externalRef:c,parentScrollingRef:h,align:p="start",direction:v="bottom",position:y="auto",overflow:b="visible",setDownOverflow:k,repositionFlag:w,captureFocus:m=!0,state:A,endTransition:j,isDisabled:L,menuItemFocus:D,gap:F=0,shift:U=0,children:G,onClose:J,...re})=>{const[$e,R]=T.useState({x:Wm,y:Wm}),[f,g]=T.useState({}),[E,M]=T.useState(),[_,P]=T.useState(v),[I]=T.useState(tS),[N,d]=T.useReducer(ie=>ie+1,1),{transition:C,boundingBoxRef:ee,boundingBoxPadding:x,rootMenuRef:B,rootAnchorRef:z,scrollNodesRef:$,reposition:V,viewScroll:se,submenuCloseDelay:Y}=T.useContext(E2),{submenuCtx:K,reposSubmenu:Xe=w}=T.useContext(qm),Q=T.useRef(null),ae=T.useRef(),Xr=T.useRef(),Te=T.useRef(!1),Me=T.useRef({width:0,height:0}),Zr=T.useRef(()=>{}),{hoverItem:Ce,dispatch:fe,updateItems:Er}=rS(Q,ae),he=x2(A),je=wa(C,"open"),en=wa(C,"close"),ge=$.current,He=ie=>{switch(ie.key){case Rn.HOME:fe(It.FIRST);break;case Rn.END:fe(It.LAST);break;case Rn.UP:fe(It.DECREASE,Ce);break;case Rn.DOWN:fe(It.INCREASE,Ce);break;case Rn.SPACE:ie.target&&ie.target.className.indexOf(xf)!==-1&&ie.preventDefault();return;default:return}ie.preventDefault(),ie.stopPropagation()},En=()=>{A==="closing"&&M(),gn(j)},qe=ie=>{ie.stopPropagation(),I.on(Y,()=>{fe(It.RESET),ae.current.focus()})},Ve=ie=>{ie.target===ie.currentTarget&&I.off()},Gt=T.useCallback(ie=>{var lt;const ve=o?(lt=o.current)==null?void 0:lt.getBoundingClientRect():s?{left:s.x,right:s.x,top:s.y,bottom:s.y,width:0,height:0}:null;if(!ve)return;ge.menu||(ge.menu=(ee?ee.current:wf(B.current))||window);const de=nS(a,Q,ge.menu,x);let{arrowX:it,arrowY:_e,x:Se,y:Pt,computedDirection:Re}=lS({arrow:n,align:p,direction:v,gap:F,shift:U,position:y,anchorRect:ve,arrowRef:Xr,positionHelpers:de});const{menuRect:Fe}=de;let Yt=Fe.height;if(!ie&&b!=="visible"){const{getTopOverflow:Qe,getBottomOverflow:Je}=de;let Xt,Ie;const Ue=Me.current.height,Ar=Je(Pt);if(Ar>0||ss(Ar,0)&&ss(Yt,Ue))Xt=Yt-Ar,Ie=Ar;else{const Ne=Qe(Pt);(Ne<0||ss(Ne,0)&&ss(Yt,Ue))&&(Xt=Yt+Ne,Ie=0-Ne,Xt>=0&&(Pt-=Ne))}Xt>=0?(Yt=Xt,M({height:Xt,overflowAmt:Ie})):M()}n&&g({x:it,y:_e}),R({x:Se,y:Pt}),P(Re),Me.current={width:Fe.width,height:Yt}},[n,p,x,v,F,U,y,b,s,o,a,ee,B,ge]);Ef(()=>{he&&(Gt(),Te.current&&d()),Te.current=he,Zr.current=Gt},[he,Gt,Xe]),Ef(()=>{E&&!k&&(Q.current.scrollTop=0)},[E,k]),Ef(()=>Er,[Er]),T.useEffect(()=>{let{menu:ie}=ge;if(!he||!ie)return;if(ie=ie.addEventListener?ie:window,!ge.anchors){ge.anchors=[];let it=wf(z&&z.current);for(;it&&it!==ie;)ge.anchors.push(it),it=wf(it)}let lt=se;if(ge.anchors.length&<==="initial"&&(lt="auto"),lt==="initial")return;const ve=()=>{lt==="auto"?$m(()=>Gt(!0)):gn(J,{reason:xa.SCROLL})},de=ge.anchors.concat(se!=="initial"?ie:[]);return de.forEach(it=>it.addEventListener("scroll",ve)),()=>de.forEach(it=>it.removeEventListener("scroll",ve))},[z,ge,he,J,se,Gt]);const Le=!!E&&E.overflowAmt>0;T.useEffect(()=>{if(Le||!he||!h)return;const ie=()=>$m(Gt),lt=h.current;return lt.addEventListener("scroll",ie),()=>lt.removeEventListener("scroll",ie)},[he,Le,h,Gt]),T.useEffect(()=>{if(typeof ResizeObserver!="function"||V==="initial")return;const ie=new ResizeObserver(([ve])=>{const{borderBoxSize:de,target:it}=ve;let _e,Se;if(de){const{inlineSize:Pt,blockSize:Re}=de[0]||de;_e=Pt,Se=Re}else{const Pt=it.getBoundingClientRect();_e=Pt.width,Se=Pt.height}_e===0||Se===0||ss(_e,Me.current.width,1)&&ss(Se,Me.current.height,1)||oa.flushSync(()=>{Zr.current(),d()})}),lt=Q.current;return ie.observe(lt,{box:"border-box"}),()=>ie.unobserve(lt)},[V]),T.useEffect(()=>{if(!he){fe(It.RESET),en||M();return}const{position:ie,alwaysUpdate:lt}=D||{},ve=()=>{ie===Uo.FIRST?fe(It.FIRST):ie===Uo.LAST?fe(It.LAST):ie>=-1&&fe(It.SET_INDEX,void 0,ie)};if(lt)ve();else if(m){const de=setTimeout(()=>{const it=Q.current;it&&!it.contains(document.activeElement)&&(ae.current.focus(),ve())},je?170:100);return()=>clearTimeout(de)}},[he,je,en,m,D,fe]);const Ge=T.useMemo(()=>({isParentOpen:he,submenuCtx:I,dispatch:fe,updateItems:Er}),[he,I,fe,Er]);let Lr,Pe;E&&(k?Pe=E.overflowAmt:Lr=E.height);const We=T.useMemo(()=>({reposSubmenu:N,submenuCtx:I,overflow:b,overflowAmt:Pe,parentMenuRef:Q,parentDir:_}),[N,I,b,Pe,_]),An=Lr>=0?{maxHeight:Lr,overflow:b}:void 0,Be=T.useMemo(()=>({state:A,dir:_}),[A,_]),Ke=T.useMemo(()=>({dir:_}),[_]),_n=yu({block:xf,element:W6,modifiers:Ke,className:i.className}),De=S.jsxs("ul",{role:"menu","aria-label":t,...q6(L),...r0({onPointerEnter:K==null?void 0:K.off,onPointerMove:qe,onPointerLeave:Ve,onKeyDown:He,onAnimationEnd:En},re),ref:A2(c,Q),className:yu({block:xf,modifiers:Be,className:e}),style:{...r,...An,margin:0,display:A==="closed"?"none":void 0,position:bf,left:$e.x,top:$e.y},children:[S.jsx("li",{tabIndex:-1,style:{position:bf,left:0,top:0,display:"block",outline:"none"},ref:ae,...Vm,...u}),n&&S.jsx("li",{...Vm,...i,className:_n,style:{display:"block",position:bf,left:f.x,top:f.y,...i.style},ref:Xr}),S.jsx(qm.Provider,{value:We,children:S.jsx(Q6.Provider,{value:Ge,children:S.jsx(K6.Provider,{value:Ce,children:gn(G,Be)})})})]});return l?S.jsx(eS,{...l,isOpen:he,children:De}):De},cS=T.forwardRef(function({"aria-label":e,className:r,containerProps:n,initialMounted:i,unmountOnClose:s,transition:o,transitionTimeout:a,boundingBoxRef:l,boundingBoxPadding:u,reposition:c="auto",submenuOpenDelay:h=300,submenuCloseDelay:p=150,viewScroll:v="initial",portal:y,theming:b,onItemClick:k,...w},m){const A=T.useRef(null),j=T.useRef({}),{anchorRef:L,state:D,onClose:F}=w,U=T.useMemo(()=>({initialMounted:i,unmountOnClose:s,transition:o,transitionTimeout:a,boundingBoxRef:l,boundingBoxPadding:u,rootMenuRef:A,rootAnchorRef:L,scrollNodesRef:j,reposition:c,viewScroll:v,submenuOpenDelay:h,submenuCloseDelay:p}),[i,s,o,a,L,l,u,c,v,h,p]),G=T.useMemo(()=>({handleClick(re,$e){re.stopPropagation||gn(k,re);let R=re.keepOpen;R===void 0&&(R=$e&&re.key===Rn.SPACE),R||gn(F,{value:re.value,key:re.key,reason:xa.CLICK})},handleClose(re){gn(F,{key:re,reason:xa.CLICK})}}),[k,F]);if(!D)return null;const J=S.jsx(E2.Provider,{value:U,children:S.jsx(J6.Provider,{value:G,children:S.jsx(uS,{...w,ariaLabel:e||"Menu",externalRef:m,containerRef:A,containerProps:{className:r,containerRef:A,containerProps:n,theming:b,transition:o,onClose:F}})})});return y===!0&&typeof document<"u"?oa.createPortal(J,document.body):y?y.target?oa.createPortal(J,y.target):y.stablePosition?null:J:J}),Bh=0,Dh=1,wu=2,xu=3,bu=4,fS=5,_2=6,hS=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],S2=t=>({_s:t,status:hS[t],isEnter:tbu}),Fh=t=>t?_2:fS,dS=(t,e)=>{switch(t){case Dh:case Bh:return wu;case bu:case xu:return Fh(e)}},pS=t=>typeof t=="object"?[t.enter,t.exit]:[t,t],mS=(t,e)=>setTimeout(()=>{isNaN(document.body.offsetTop)||t(e+1)},0),Km=(t,e,r,n,i)=>{clearTimeout(n.current);const s=S2(t);e(s),r.current=s,i&&i({current:s})},gS=({enter:t=!0,exit:e=!0,preEnter:r,preExit:n,timeout:i,initialEntered:s,mountOnEnter:o,unmountOnExit:a,onStateChange:l}={})=>{const[u,c]=T.useState(()=>S2(s?wu:Fh(o))),h=T.useRef(u),p=T.useRef(),[v,y]=pS(i),b=T.useCallback(()=>{const w=dS(h.current._s,a);w&&Km(w,c,h,p,l)},[l,a]),k=T.useCallback(w=>{const m=j=>{switch(Km(j,c,h,p,l),j){case Dh:v>=0&&(p.current=setTimeout(b,v));break;case bu:y>=0&&(p.current=setTimeout(b,y));break;case Bh:case xu:p.current=mS(m,j);break}},A=h.current.isEnter;typeof w!="boolean"&&(w=!A),w?!A&&m(t?r?Bh:Dh:wu):A&&m(e?n?xu:bu:Fh(a))},[b,l,t,e,r,n,v,y,a]);return T.useEffect(()=>()=>clearTimeout(p.current),[]),[u,k,b]},vS=({initialOpen:t,initialMounted:e,unmountOnClose:r,transition:n,transitionTimeout:i=500}={})=>{const[{status:s},o,a]=gS({initialEntered:t,mountOnEnter:!e,unmountOnExit:r,timeout:i,enter:wa(n,"open"),exit:wa(n,"close")});return[{state:Y6[s],endTransition:a},o]},yS=t=>{const[e,r]=vS(t),[n,i]=T.useState(),s=(o,a)=>{i({position:o,alwaysUpdate:a}),r(!0)};return[{menuItemFocus:n,...e},r,s]},wS=(t,e)=>{const[r]=T.useState({});return{onMouseDown:()=>{r.v=t&&t!=="closed"},onClick:n=>r.v?r.v=!1:e(!0,n)}},xS=(t,e)=>{const r=T.useRef(e);T.useEffect(()=>{r.current!==e&&gn(t,{open:e}),r.current=e},[t,e])},bS=T.forwardRef(function({"aria-label":e,captureFocus:r,initialOpen:n,menuButton:i,instanceRef:s,onMenuChange:o,...a},l){const[u,c,h]=yS(a),{state:p}=u,v=x2(p),y=T.useRef(null),b=wS(p,(L,D)=>h(D.detail?void 0:Uo.FIRST)),k=T.useCallback(L=>{c(!1),L.key&&y.current.focus()},[c]),w=L=>{switch(L.key){case Rn.UP:h(Uo.LAST);break;case Rn.DOWN:h(Uo.FIRST);break;default:return}L.preventDefault()},m=gn(i,{open:v});if(!m||!m.type)throw new Error("Menu requires a menuButton prop.");const A={ref:A2(m.ref,y),...r0({onKeyDown:w,...b},m.props)};z6(m.type)==="MenuButton"&&(A.isOpen=v);const j=T.cloneElement(m,A);return xS(o,v),T.useImperativeHandle(s,()=>({openMenu:h,closeMenu:()=>c(!1)})),S.jsxs(T.Fragment,{children:[j,S.jsx(cS,{...a,...u,"aria-label":e||(typeof m.props.children=="string"?m.props.children:"Menu"),anchorRef:y,ref:l,onClose:k})]})});function Qm({...t}){return S.jsx(bS,{...t,unmountOnClose:!0,className:ce("relative",t.className),direction:"left",menuButton:S.jsx(Z6,{className:"small",children:S.jsx(d6,{className:"-mb-1"})}),children:t.children})}function ES({app:t,className:e}){var a,l,u,c,h;const{uninstallApp:r,setMirroring:n,setAutoUpdate:i}=Pi(),s=Ma();return!t.state?t.metadata?S.jsx(Qm,{className:e,children:S.jsxs("div",{className:"flex flex-col backdrop-blur-lg bg-black/10 p-2 rounded-lg relative z-10",children:[((a=t.metadata)==null?void 0:a.description)&&S.jsx("button",{className:"my-1 whitespace-nowrap clear",onClick:()=>s(`/${vu}/${Ee(t)}`),children:"View Details"}),((l=t.metadata)==null?void 0:l.external_url)&&S.jsx("a",{target:"_blank",href:(u=t.metadata)==null?void 0:u.external_url,className:"mb-1 whitespace-nowrap button clear",children:"View Site"})]})}):S.jsx(S.Fragment,{}):S.jsx(Qm,{className:e,children:S.jsxs("div",{className:"flex flex-col p-2 rounded-lg backdrop-blur-lg relative z-10",children:[S.jsx("button",{className:"my-1 whitespace-nowrap clear",onClick:()=>s(`/${vu}/${Ee(t)}`),children:"View Details"}),t.installed&&S.jsxs(S.Fragment,{children:[S.jsx("button",{className:"mb-1 whitespace-nowrap clear",onClick:()=>r(t),children:"Uninstall"}),S.jsxs("button",{className:"mb-1 whitespace-nowrap clear",onClick:()=>{var p;return n(t,!((p=t.state)!=null&&p.mirroring))},children:[(c=t.state)!=null&&c.mirroring?"Stop":"Start"," Mirroring"]}),S.jsxs("button",{className:"mb-1 whitespace-nowrap clear",onClick:()=>{var p;return i(t,!((p=t.state)!=null&&p.auto_update))},children:[(h=t.state)!=null&&h.auto_update?"Disable":"Enable"," Auto Update"]})]})]})})}function Ns({app:t,size:e="medium",overrideImageSize:r,showMoreActions:n,...i}){const s=Kn(),o=Ma();return T.createElement("div",{...i,key:Ee(t),className:ce("flex justify-between rounded-lg hover:bg-white/10 card cursor-pointer",i.className,{"flex-wrap gap-2":s,"flex-col relative":e!=="large"}),onClick:()=>{n||o(`/${vu}/${Ee(t)}`)}},S.jsx(m2,{app:t,size:e,overrideImageSize:r}),S.jsxs("div",{className:ce("flex items-center",{absolute:e!=="large","top-2 right-2":e!=="large"&&n,"top-0 right-0":e!=="large"&&!n,"ml-auto":e==="large"&&s,"min-w-1/5":e==="large"}),children:[S.jsx(w2,{app:t,isIcon:!n&&e!=="large",className:ce({"bg-orange text-lg":e==="large","mr-2":n,"w-full":e==="large"})}),n&&S.jsx(ES,{app:t,className:"self-stretch"})]}))}function oc({value:t="",onChange:e=()=>null,onBack:r,hideSearch:n=!1,hidePublish:i=!1}){const s=Ma(),o=$u(),a=Wr.useRef(null),l=o.key!=="default",u=o.pathname===Lh,c=Kn();return S.jsxs("div",{className:ce("flex justify-between",{"gap-4":c,"gap-8":!c}),children:[o.pathname!=="/"?S.jsx("button",{className:"flex flex-col c icon icon-orange",onClick:()=>{r?r():s(l?-1:"/")},children:S.jsx(M6,{})}):c?S.jsx("button",{className:ce("icon icon-orange",{}),onClick:()=>window.location.href="/",children:S.jsx(f2,{})}):S.jsx(S.Fragment,{}),!i&&S.jsx("button",{className:"flex flex-col c icon icon-orange",onClick:()=>s(sc),children:S.jsx(j6,{})}),!n&&S.jsxs("div",{className:"flex flex-1 rounded-md relative",children:[S.jsx("input",{type:"text",ref:a,onChange:h=>e(h.target.value),value:t,placeholder:"Search for apps...",className:"w-full self-stretch grow"}),S.jsx("button",{className:ce("icon border-0 absolute top-1/2 -translate-y-1/2",{"right-2":c,"right-4":!c}),type:"button",onClick:()=>{var h;return(h=a.current)==null?void 0:h.focus()},children:S.jsx(I6,{})})]}),S.jsxs("button",{className:ce("flex c",{"gap-4":c,"gap-8 basis-1/5":!c}),onClick:()=>s(u?-1:Lh),children:[!c&&S.jsx("span",{children:"My Apps"}),S.jsx(v2,{})]})]})}const ac=()=>{const t=Kn();return S.jsx("button",{className:ce("clear absolute p-2",{"top-2 left-2":t,"top-8 left-8":!t}),onClick:()=>window.location.href="/",children:S.jsx(f2,{size:24})})};function AS(){const{listedApps:t,getListedApps:e,rebuildIndex:r}=Pi(),[n,i]=T.useState("Recently published"),[s,o]=T.useState(""),[a,l]=T.useState(t),[u,c]=T.useState(1),[h,p]=T.useState([]),v=T.useMemo(()=>Array.from({length:Math.ceil(a.length/10)},(m,A)=>A+1),[a]);T.useEffect(()=>{const m=(u-1)*10,A=m+10;l(t.slice(m,A))},[t,u]),T.useEffect(()=>{e().then(m=>{l(Object.values(m));let A=[];for(const j of Object.values(m))A=A.concat((j.metadata||{}).tags||[]);A.length===0&&(A=["App","Tags","Coming","Soon","tm"]),p(Array.from(new Set(A)))}).catch(m=>console.error(m))},[]);const y=T.useCallback(async m=>{},[]),b=T.useCallback(m=>{o(m);const A=t.filter(j=>{var L,D,F,U;return j.package.toLowerCase().includes(m.toLowerCase())||((D=(L=j.metadata)==null?void 0:L.description)==null?void 0:D.toLowerCase().includes(m.toLowerCase()))||((U=(F=j.metadata)==null?void 0:F.description)==null?void 0:U.toLowerCase().includes(m.toLowerCase()))},[t]);l(A)},[t]),k=T.useCallback(async()=>{try{await r(),alert("Index rebuilt successfully."),await e()}catch(m){console.error(m)}},[r]),w=Kn();return S.jsxs("div",{className:ce("flex flex-col w-full max-h-screen p-2",{"gap-4 max-w-screen":w,"gap-6 max-w-[900px]":!w}),children:[!w&&S.jsx(ac,{}),S.jsx(oc,{value:s,onChange:b}),S.jsxs("div",{className:ce("flex items-center self-stretch justify-between",{"gap-4 flex-wrap":w,"gap-8 grow":!w}),children:[S.jsx("button",{className:"flex flex-col c icon icon-orange",onClick:k,title:"Rebuild index",children:S.jsx(C6,{})}),h.slice(0,w?3:6).map(m=>S.jsx("button",{className:"clear flex c rounded-full !bg-white/10 !hover:bg-white/25",onClick:()=>{console.log("clicked tag",m)},children:m},m)),S.jsxs("select",{value:n,onChange:m=>{i(m.target.value),y(m.target.value)},className:ce("hidden",{"basis-1/5":!w}),children:[S.jsx("option",{children:"Recently published"}),S.jsx("option",{children:"Most popular"}),S.jsx("option",{children:"Best rating"}),S.jsx("option",{children:"Recently updated"})]})]}),!s&&S.jsxs("div",{className:ce("flex flex-col",{"gap-4":!w,"grow overflow-y-auto gap-2 items-center px-2":w}),children:[S.jsx("h2",{children:"Featured Apps"}),S.jsx("div",{className:ce("flex gap-2",{"flex-col":w}),children:a.filter(m=>["kcal","command_center","memedeck","filter"].indexOf(m.package)!==-1).map(m=>{var A;return S.jsx(Ns,{size:"medium",app:m,className:ce("grow",{"w-1/4":!w,"w-full":w})},Ee(m)+(((A=m.state)==null?void 0:A.our_version)||""))})})]}),S.jsx("h2",{children:s?"Search Results":"All Apps"}),S.jsx("div",{className:ce("flex flex-col grow overflow-y-auto",{"gap-2":w,"gap-4":!w}),children:a.map(m=>{var A;return S.jsx(Ns,{size:"large",app:m,className:"self-stretch",overrideImageSize:"medium"},Ee(m)+(((A=m.state)==null?void 0:A.our_version)||""))})}),v.length>1&&S.jsxs("div",{className:"flex self-center",children:[u!==v[0]&&S.jsx("button",{className:"icon",onClick:()=>c(u-1),children:S.jsx(f6,{})}),v.map(m=>S.jsx("button",{className:ce("my-1 mx-2 clear",{"font-bold":m===u}),onClick:()=>c(m),children:m},`page-${m}`)),u!==v[v.length-1]&&S.jsx("button",{className:"icon",onClick:()=>c(u+1),children:S.jsx(h6,{})})]})]})}function _S(){const{myApps:t,getMyApps:e}=Pi(),r=Ma(),[n,i]=T.useState(""),[s,o]=T.useState(t);T.useEffect(()=>{e().then(o).catch(u=>console.error(u))},[]);const a=T.useCallback(u=>{i(u);const c=Object.keys(t).reduce((h,p)=>(h[p]=t[p].filter(v=>{var y,b,k,w;return v.package.toLowerCase().includes(u.toLowerCase())||((b=(y=v.metadata)==null?void 0:y.description)==null?void 0:b.toLowerCase().includes(u.toLowerCase()))||((w=(k=v.metadata)==null?void 0:k.description)==null?void 0:w.toLowerCase().includes(u.toLowerCase()))}),h),{downloaded:[],installed:[],local:[],system:[]});o(c)},[t]);T.useEffect(()=>{n?a(n):o(t)},[t]);const l=Kn();return console.log({myApps:t}),S.jsxs("div",{className:ce("flex flex-col w-full h-screen p-2",{"gap-4 max-w-screen":l,"gap-8 max-w-[900px]":!l}),children:[S.jsx(ac,{}),S.jsx(oc,{value:n,onChange:a}),S.jsxs("div",{className:"flex justify-between items-center mt-2",children:[S.jsx("h3",{children:"My Packages"}),S.jsxs("button",{onClick:()=>r(sc),children:[S.jsx(p6,{className:"mr-2"}),"Publish Package"]})]}),S.jsxs("div",{className:ce("flex flex-col card gap-2 mt-2",{"max-h-[80vh] overflow-y-scroll overflow-x-visible":!l}),style:{scrollbarWidth:"thin",scrollbarColor:"#FFF5D9 transparent"},children:[s.downloaded.length>0&&S.jsx("h4",{children:"Downloaded"}),(s.downloaded||[]).map(u=>S.jsx(Ns,{app:u,showMoreActions:!0},Ee(u))),s.installed.length>0&&S.jsx("h4",{children:"Installed"}),(s.installed||[]).map(u=>S.jsx(Ns,{app:u,showMoreActions:!0},Ee(u))),s.local.length>0&&S.jsx("h4",{children:"Local"}),(s.local||[]).map(u=>S.jsx(Ns,{app:u,showMoreActions:!0},Ee(u))),s.system.length>0&&S.jsx("h4",{children:"System"}),(s.system||[]).map(u=>S.jsx(Ns,{app:u,showMoreActions:!0},Ee(u)))]})]})}function SS(){var v,y,b,k,w,m,A,j,L,D;const{myApps:t,listedApps:e,getListedApp:r}=Pi(),n=Ma(),i=Hb(),[s,o]=T.useState(void 0);T.useEffect(()=>{const F=t.local.find(U=>Ee(U)===i.id);if(F)return o(F);if(i.id){const U=e.find(G=>Ee(G)===i.id);U?o(U):r(i.id).then(G=>o(G)).catch(console.error)}},[i.id,t,e]);const a=T.useCallback(()=>{n(sc,{state:{app:s}})},[s,n]),l=T.useMemo(()=>{var F,U;return((U=(F=s==null?void 0:s.metadata)==null?void 0:F.properties)==null?void 0:U.current_version)||"Unknown"},[s]),u=Object.entries(((y=(v=s==null?void 0:s.metadata)==null?void 0:v.properties)==null?void 0:y.code_hashes)||{}),c=((b=s==null?void 0:s.state)==null?void 0:b.our_version)||(u[(u.length||1)-1]||["",""])[1],h=Kn(),p=[{top:S.jsx("div",{className:ce({"text-sm":h}),children:"Developer"}),middle:S.jsx(O6,{size:36}),bottom:S.jsx("div",{className:ce({"text-sm":h}),children:s==null?void 0:s.publisher})},{top:S.jsx("div",{className:ce({"text-sm":h}),children:"Version"}),middle:S.jsx("span",{className:"text-2xl",children:l}),bottom:S.jsxs("div",{className:ce({"text-xs":h}),children:[c.slice(0,5),"...",c.slice(-5)]})},{top:S.jsx("div",{className:ce({"text-sm":h}),children:"Mirrors"}),middle:S.jsx(P6,{size:36}),bottom:S.jsx("div",{className:ce({"text-sm":h}),children:((m=(w=(k=s==null?void 0:s.metadata)==null?void 0:k.properties)==null?void 0:w.mirrors)==null?void 0:m.length)||0})}];return S.jsxs("div",{className:ce("flex flex-col w-full p-2",{"gap-4 max-w-screen":h,"gap-8 max-w-[900px]":!h}),children:[!h&&S.jsx(ac,{}),S.jsx(oc,{value:"",onChange:()=>null,hideSearch:!0,hidePublish:!0}),S.jsx("div",{className:ce("flex-col-center card !rounded-3xl",{"p-12 gap-4 grow overflow-y-auto":h,"p-24 gap-8":!h}),children:s?S.jsxs(S.Fragment,{children:[S.jsx(m2,{app:s,size:h?"medium":"large"}),S.jsx("div",{className:"w-5/6 h-0 border border-orange"}),S.jsx("div",{className:ce("flex items-start text-xl",{"gap-4 flex-wrap":h,"gap-8":!h}),children:p.map((F,U)=>S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:ce("flex-col-center gap-2 justify-between self-stretch",{"rounded-lg bg-white/10 p-1 min-w-1/4 grow":h,"opacity-50":!h}),children:[F.top,F.middle,F.bottom]},U),!h&&U!==p.length-1&&S.jsx("div",{className:"h-3/4 w-0 border border-orange self-center"})]}))}),Array.isArray((j=(A=s.metadata)==null?void 0:A.properties)==null?void 0:j.screenshots)&&((L=s.metadata)==null?void 0:L.properties.screenshots.length)>0&&S.jsx("div",{className:"flex flex-wrap overflow-x-auto max-w-full",children:s.metadata.properties.screenshots.map((F,U)=>S.jsx("img",{src:F,className:"mr-2 max-h-20 max-w-full rounded border border-black"},U+F))}),S.jsx(w2,{app:s,className:ce("self-center bg-orange text-lg px-12")}),s.installed&&((D=s.state)==null?void 0:D.mirroring)&&S.jsx("button",{type:"button",onClick:a,children:"Publish"})]}):S.jsxs(S.Fragment,{children:[S.jsx("h4",{children:"App details not found for "}),S.jsx("h4",{children:i.id})]})})]})}var Uh=(t=>(t[t.SEPOLIA=11155111]="SEPOLIA",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.LOCAL=1337]="LOCAL",t))(Uh||{});const Jm="0xaa36a7",zo="0xa",kS={10:"0x52185B6a6017E6f079B994452F234f7C2533787B"},NS="4902",Ym={[Jm]:{chainId:Jm,chainName:"Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://rpc.sepolia.org"],blockExplorerUrls:["https://sepolia.etherscan.io"]},[zo]:{chainId:zo,chainName:"Optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://mainnet.optimism.io"],blockExplorerUrls:["https://optimistic.etherscan.io"]}},MS=t=>{switch(t){case"1":case"0x1":return"Ethereum";case"10":case"a":case"0xa":return"Optimism";case"42161":return"Arbitrum";case"11155111":case"aa36a7":case"0xaa36a7":return"Sepolia";default:return"Unknown"}},Af=async t=>{var r,n,i;let e=await((r=window.ethereum)==null?void 0:r.request({method:"net_version"}).catch(()=>"1"));if(e="0x"+(typeof e=="string"?e.replace(/^0x/,""):e.toString(16)),!Ym[t]){console.error(`Invalid chain ID: ${t}`);return}if(t!==e)try{await((n=window.ethereum)==null?void 0:n.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}))}catch(s){if(String(s).includes(NS))await((i=window.ethereum)==null?void 0:i.request({method:"wallet_addEthereumChain",params:[Ym[t]]}));else throw window.alert(`You must enable the ${MS(t)} network in your wallet.`),new Error(`User cancelled connection to ${t}`)}};var ba={},lc={};Object.defineProperty(lc,"__esModule",{value:!0});lc.Connector=void 0;class CS{constructor(e,r){this.actions=e,this.onError=r}resetState(){this.actions.resetState()}}lc.Connector=CS;var _f,Xm;function PS(){if(Xm)return _f;Xm=1;function t({mustBeMetaMask:e=!1,silent:r=!1,timeout:n=3e3}={}){s();let i=!1;return new Promise(o=>{window.ethereum?a():(window.addEventListener("ethereum#initialized",a,{once:!0}),setTimeout(()=>{a()},n));function a(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",a);const{ethereum:l}=window;l&&(!e||l.isMetaMask)?o(l):(!r&&console.error("@metamask/detect-provider:",e&&l?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum."),o(null))}});function s(){if(typeof e!="boolean")throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if(typeof r!="boolean")throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if(typeof n!="number")throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}}return _f=t,_f}var RS=ze&&ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IS=ze&&ze.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OS=ze&&ze.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RS(e,t,r);return IS(e,t),e},os=ze&&ze.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(ba,"__esModule",{value:!0});var k2=ba.MetaMask=ba.NoMetaMaskError=void 0;const TS=lc;class Ea extends Error{constructor(){super("MetaMask not installed"),this.name=Ea.name,Object.setPrototypeOf(this,Ea.prototype)}}ba.NoMetaMaskError=Ea;function fl(t){return Number.parseInt(t,16)}class jS extends TS.Connector{constructor({actions:e,options:r,onError:n}){super(e,n),this.options=r}isomorphicInitialize(){return os(this,void 0,void 0,function*(){if(!this.eagerConnection)return this.eagerConnection=Promise.resolve().then(()=>OS(PS())).then(e=>os(this,void 0,void 0,function*(){var r,n;const i=yield e.default(this.options);i&&(this.provider=i,!((r=this.provider.providers)===null||r===void 0)&&r.length&&(this.provider=(n=this.provider.providers.find(s=>s.isMetaMask))!==null&&n!==void 0?n:this.provider.providers[0]),this.provider.on("connect",({chainId:s})=>{this.actions.update({chainId:fl(s)})}),this.provider.on("disconnect",s=>{var o;if(s.code===1013){console.debug('MetaMask logged connection error 1013: "Try again later"');return}this.actions.resetState(),(o=this.onError)===null||o===void 0||o.call(this,s)}),this.provider.on("chainChanged",s=>{this.actions.update({chainId:fl(s)})}),this.provider.on("accountsChanged",s=>{s.length===0?this.actions.resetState():this.actions.update({accounts:s})}))}))})}connectEagerly(){return os(this,void 0,void 0,function*(){const e=this.actions.startActivation();try{if(yield this.isomorphicInitialize(),!this.provider)return e();const r=yield this.provider.request({method:"eth_accounts"});if(!r.length)throw new Error("No accounts returned");const n=yield this.provider.request({method:"eth_chainId"});this.actions.update({chainId:fl(n),accounts:r})}catch(r){console.debug("Could not connect eagerly",r),this.actions.resetState()}})}activate(e){var r,n;return os(this,void 0,void 0,function*(){let i;return!((n=(r=this.provider)===null||r===void 0?void 0:r.isConnected)===null||n===void 0)&&n.call(r)||(i=this.actions.startActivation()),this.isomorphicInitialize().then(()=>os(this,void 0,void 0,function*(){if(!this.provider)throw new Ea;const s=yield this.provider.request({method:"eth_requestAccounts"}),o=yield this.provider.request({method:"eth_chainId"}),a=fl(o),l=typeof e=="number"?e:e==null?void 0:e.chainId;if(!l||a===l)return this.actions.update({chainId:a,accounts:s});const u=`0x${l.toString(16)}`;return this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:u}]}).catch(c=>{var h,p;if((((p=(h=c.data)===null||h===void 0?void 0:h.originalError)===null||p===void 0?void 0:p.code)||c.code)===4902&&typeof e!="number"){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_addEthereumChain",params:[Object.assign(Object.assign({},e),{chainId:u})]})}throw c}).then(()=>this.activate(l))})).catch(s=>{throw i==null||i(),s})})}watchAsset({address:e,symbol:r,decimals:n,image:i}){return os(this,void 0,void 0,function*(){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:e,symbol:r,decimals:n,image:i}}}).then(s=>{if(!s)throw new Error("Rejected");return!0})})}}k2=ba.MetaMask=jS;const[N2,n0]=Hu.initializeConnector(t=>new k2({actions:t}));function Zm(t){const e=t.split("."),r=new Uint8Array(t.length+e.length);let n=0;for(const i of e){const s=i.length;r[n]=s,n++;for(let o=0;oi.toString(16).padStart(2,"0")).join("")}`}const eg=/^\d+\.\d+\.\d+$/,LS=({app:t,packageName:e,publisherId:r,goBack:n})=>{var h,p,v,y,b,k,w,m;const[i,s]=T.useState({name:((h=t==null?void 0:t.metadata)==null?void 0:h.name)||"",description:((p=t==null?void 0:t.metadata)==null?void 0:p.description)||"",image:((v=t==null?void 0:t.metadata)==null?void 0:v.image)||"",external_url:((y=t==null?void 0:t.metadata)==null?void 0:y.external_url)||"",animation_url:((b=t==null?void 0:t.metadata)==null?void 0:b.animation_url)||"",package_name:e,current_version:"",publisher:r,mirrors:[r]}),[o,a]=T.useState(Object.entries(((w=(k=t==null?void 0:t.metadata)==null?void 0:k.properties)==null?void 0:w.code_hashes)||{}).concat([["",((m=t==null?void 0:t.state)==null?void 0:m.our_version)||""]])),l=(A,j)=>{s({...i,[A]:j})};T.useEffect(()=>{l("package_name",e)},[e]),T.useEffect(()=>{l("publisher",r)},[r]);const u=T.useCallback(()=>{const A=o.reduce((U,[G,J])=>(U[G]=J,U),{});if(eg.test(i.current_version))if(A[i.current_version]){if(!Object.keys(A).reduce((U,G)=>U&&eg.test(G),!0)){window.alert("Code hashes must be a JSON object with valid version keys");return}}else{window.alert(`Code hashes must include current version (${i.current_version})`);return}else{window.alert("Current version must be in the format x.y.z");return}const j=JSON.stringify({name:i.name,description:i.description,image:i.image,external_url:i.external_url,animation_url:i.animation_url,properties:{package_name:i.package_name,current_version:i.current_version,publisher:i.publisher,mirrors:i.mirrors,code_hashes:A}}),L=new Blob([j],{type:"application/json"}),D=URL.createObjectURL(L),F=document.createElement("a");F.href=D,F.download=i.package_name+"_"+i.publisher+"_metadata.json",F.click(),URL.revokeObjectURL(D)},[i,o]),c=()=>{s({name:"",description:"",image:"",external_url:"",animation_url:"",package_name:"",current_version:"",publisher:"",mirrors:[]}),a([])};return S.jsxs("form",{className:"flex flex-col card mt-2 gap-2",children:[S.jsx("h4",{children:"Fill out metadata"}),S.jsxs("div",{className:"flex flex-col w-3/4",children:[S.jsx("label",{className:"metadata-label",children:"Name"}),S.jsx("input",{type:"text",placeholder:"Name",value:i.name,onChange:A=>l("name",A.target.value)})]}),S.jsxs("div",{className:"flex flex-col w-3/4",children:[S.jsx("label",{className:"metadata-label",children:"Description"}),S.jsx("input",{type:"text",placeholder:"Description",value:i.description,onChange:A=>l("description",A.target.value)})]}),S.jsxs("div",{className:"flex flex-col w-3/4",children:[S.jsx("label",{className:"metadata-label",children:"Image URL"}),S.jsx("input",{type:"text",placeholder:"Image URL",value:i.image,onChange:A=>l("image",A.target.value)})]}),S.jsxs("div",{className:"flex flex-col w-3/4",children:[S.jsx("label",{className:"metadata-label",children:"External URL"}),S.jsx("input",{type:"text",placeholder:"External URL",value:i.external_url,onChange:A=>l("external_url",A.target.value)})]}),S.jsxs("div",{className:"flex flex-col w-3/4",children:[S.jsx("label",{className:"metadata-label",children:"Animation URL"}),S.jsx("input",{type:"text",placeholder:"Animation URL",value:i.animation_url,onChange:A=>l("animation_url",A.target.value)})]}),S.jsxs("div",{className:"flex flex-col w-3/4",children:[S.jsx("label",{className:"metadata-label",children:"Package Name"}),S.jsx("input",{type:"text",placeholder:"Package Name",value:i.package_name,onChange:A=>l("package_name",A.target.value)})]}),S.jsxs("div",{className:"flex flex-col w-3/4",children:[S.jsx("label",{className:"metadata-label",children:"Current Version"}),S.jsx("input",{type:"text",placeholder:"Current Version",value:i.current_version,onChange:A=>l("current_version",A.target.value)})]}),S.jsxs("div",{className:"flex flex-col w-3/4",children:[S.jsx("label",{className:"metadata-label",children:"Publisher"}),S.jsx("input",{type:"text",placeholder:"Publisher",value:i.publisher,onChange:A=>l("publisher",A.target.value)})]}),S.jsxs("div",{className:"flex flex-col w-3/4",children:[S.jsx("label",{className:"metadata-label",children:"Mirrors (separated by commas)"}),S.jsx("input",{type:"text",placeholder:"Mirrors (separated by commas)",value:i.mirrors.join(","),onChange:A=>l("mirrors",A.target.value.split(",").map(j=>j.trim()))})]}),S.jsxs("div",{className:"flex flex-col w-3/4 gap-2",children:[S.jsxs("div",{className:"flex gap-2 mt-0 justify-between w-full",children:[S.jsx("h5",{className:"m-0",children:"Code Hashes"}),S.jsx("button",{type:"button",onClick:()=>a([...o,["",""]]),className:"clear",children:"Add code hash"})]}),o.map(([A,j],L,D)=>S.jsxs("div",{className:"flex gap-2 mt-0 w-full",children:[S.jsx("input",{type:"text",placeholder:"Version",value:A,onChange:F=>a(U=>{const G=[...U];return G[L][0]=F.target.value,G}),className:"flex-1"}),S.jsx("input",{type:"text",placeholder:"Hash",value:j,onChange:F=>a(U=>{const G=[...U];return G[L][1]=F.target.value,G}),className:"flex-5"}),D.length>1&&S.jsx("button",{type:"button",onClick:()=>a(F=>F.filter((U,G)=>G!==L)),className:"icon",children:S.jsx(y2,{})})]},L+"_code_hash"))]}),S.jsxs("div",{className:"flex gap-2 my-4",children:[S.jsx("button",{type:"button",onClick:u,className:"alt",children:"Download JSON"}),S.jsx("button",{type:"button",onClick:c,className:"clear",children:"Clear Form"}),S.jsx("button",{type:"button",onClick:n,children:"Done"})]})]})};function BS({readOnly:t=!1,checked:e,setChecked:r}){return S.jsxs("div",{className:"relative",children:[S.jsx("input",{type:"checkbox",id:"checked",name:"checked",checked:e,onChange:n=>r&&r(n.target.checked),autoFocus:!0,readOnly:t}),e&&S.jsx(g2,{className:"absolute left-1 top-1 cursor-pointer",onClick:()=>r&&r(!1)})]})}var Qn=function(t){t==null&&(t=new Date().getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,t.constructor==Array?this.init_by_array(t,t.length):this.init_seed(t)};Qn.prototype.init_seed=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti>>30;this.mt[this.mti]=(((t&4294901760)>>>16)*1812433253<<16)+(t&65535)*1812433253+this.mti,this.mt[this.mti]>>>=0}};Qn.prototype.init_by_array=function(t,e){var r,n,i;for(this.init_seed(19650218),r=1,n=0,i=this.N>e?this.N:e;i;i--){var s=this.mt[r-1]^this.mt[r-1]>>>30;this.mt[r]=(this.mt[r]^(((s&4294901760)>>>16)*1664525<<16)+(s&65535)*1664525)+t[n]+n,this.mt[r]>>>=0,r++,n++,r>=this.N&&(this.mt[0]=this.mt[this.N-1],r=1),n>=e&&(n=0)}for(i=this.N-1;i;i--){var s=this.mt[r-1]^this.mt[r-1]>>>30;this.mt[r]=(this.mt[r]^(((s&4294901760)>>>16)*1566083941<<16)+(s&65535)*1566083941)-r,this.mt[r]>>>=0,r++,r>=this.N&&(this.mt[0]=this.mt[this.N-1],r=1)}this.mt[0]=2147483648};Qn.prototype.random_int=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_seed(5489),r=0;r>>1^e[t&1];for(;r>>1^e[t&1];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[t&1],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,t^=t>>>18,t>>>0};Qn.prototype.random_int31=function(){return this.random_int()>>>1};Qn.prototype.random_incl=function(){return this.random_int()*(1/4294967295)};Qn.prototype.random=function(){return this.random_int()*(1/4294967296)};Qn.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)};Qn.prototype.random_long=function(){var t=this.random_int()>>>5,e=this.random_int()>>>6;return(t*67108864+e)*(1/9007199254740992)};var DS=Qn;function FS(t,e){var r=document.createElement("div");return r.style.borderRadius="50px",r.style.overflow="hidden",r.style.padding="0px",r.style.margin="0px",r.style.width=""+t+"px",r.style.height=""+t+"px",r.style.display="inline-block",r.style.background=e,{container:r}}var US=FS,M2={exports:{}};(function(t){var e=function(){function r(l,u,c,h){typeof u=="object"&&(c=u.depth,h=u.prototype,u.filter,u=u.circular);var p=[],v=[],y=typeof Buffer<"u";typeof u>"u"&&(u=!0),typeof c>"u"&&(c=1/0);function b(k,w){if(k===null)return null;if(w==0)return k;var m,A;if(typeof k!="object")return k;if(r.__isArray(k))m=[];else if(r.__isRegExp(k))m=new RegExp(k.source,a(k)),k.lastIndex&&(m.lastIndex=k.lastIndex);else if(r.__isDate(k))m=new Date(k.getTime());else{if(y&&Buffer.isBuffer(k))return Buffer.allocUnsafe?m=Buffer.allocUnsafe(k.length):m=new Buffer(k.length),k.copy(m),m;typeof h>"u"?(A=Object.getPrototypeOf(k),m=Object.create(A)):(m=Object.create(h),A=h)}if(u){var j=p.indexOf(k);if(j!=-1)return v[j];p.push(k),v.push(m)}for(var L in k){var D;A&&(D=Object.getOwnPropertyDescriptor(A,L)),!(D&&D.set==null)&&(m[L]=b(k[L],w-1))}return m}return b(l,c)}r.clonePrototype=function(u){if(u===null)return null;var c=function(){};return c.prototype=u,new c};function n(l){return Object.prototype.toString.call(l)}r.__objToStr=n;function i(l){return typeof l=="object"&&n(l)==="[object Date]"}r.__isDate=i;function s(l){return typeof l=="object"&&n(l)==="[object Array]"}r.__isArray=s;function o(l){return typeof l=="object"&&n(l)==="[object RegExp]"}r.__isRegExp=o;function a(l){var u="";return l.global&&(u+="g"),l.ignoreCase&&(u+="i"),l.multiline&&(u+="m"),u}return r.__getRegExpFlags=a,r}();t.exports&&(t.exports=e)})(M2);var zS=M2.exports,C2={exports:{}},$S={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},zi=$S,P2={};for(var Sf in zi)zi.hasOwnProperty(Sf)&&(P2[zi[Sf]]=Sf);var te=C2.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var tr in te)if(te.hasOwnProperty(tr)){if(!("channels"in te[tr]))throw new Error("missing channels property: "+tr);if(!("labels"in te[tr]))throw new Error("missing channel labels property: "+tr);if(te[tr].labels.length!==te[tr].channels)throw new Error("channel and label counts mismatch: "+tr);var HS=te[tr].channels,qS=te[tr].labels;delete te[tr].channels,delete te[tr].labels,Object.defineProperty(te[tr],"channels",{value:HS}),Object.defineProperty(te[tr],"labels",{value:qS})}te.rgb.hsl=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(e,r,n),s=Math.max(e,r,n),o=s-i,a,l,u;return s===i?a=0:e===s?a=(r-n)/o:r===s?a=2+(n-e)/o:n===s&&(a=4+(e-r)/o),a=Math.min(a*60,360),a<0&&(a+=360),u=(i+s)/2,s===i?l=0:u<=.5?l=o/(s+i):l=o/(2-s-i),[a,l*100,u*100]};te.rgb.hsv=function(t){var e,r,n,i,s,o=t[0]/255,a=t[1]/255,l=t[2]/255,u=Math.max(o,a,l),c=u-Math.min(o,a,l),h=function(p){return(u-p)/6/c+1/2};return c===0?i=s=0:(s=c/u,e=h(o),r=h(a),n=h(l),o===u?i=n-r:a===u?i=1/3+e-n:l===u&&(i=2/3+r-e),i<0?i+=1:i>1&&(i-=1)),[i*360,s*100,u*100]};te.rgb.hwb=function(t){var e=t[0],r=t[1],n=t[2],i=te.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[i,s*100,n*100]};te.rgb.cmyk=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,i,s,o,a;return a=Math.min(1-e,1-r,1-n),i=(1-e-a)/(1-a)||0,s=(1-r-a)/(1-a)||0,o=(1-n-a)/(1-a)||0,[i*100,s*100,o*100,a*100]};function VS(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2)}te.rgb.keyword=function(t){var e=P2[t];if(e)return e;var r=1/0,n;for(var i in zi)if(zi.hasOwnProperty(i)){var s=zi[i],o=VS(t,s);o.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var i=e*.4124+r*.3576+n*.1805,s=e*.2126+r*.7152+n*.0722,o=e*.0193+r*.1192+n*.9505;return[i*100,s*100,o*100]};te.rgb.lab=function(t){var e=te.rgb.xyz(t),r=e[0],n=e[1],i=e[2],s,o,a;return r/=95.047,n/=100,i/=108.883,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=i>.008856?Math.pow(i,1/3):7.787*i+16/116,s=116*n-16,o=500*(r-n),a=200*(n-i),[s,o,a]};te.hsl.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100,i,s,o,a,l;if(r===0)return l=n*255,[l,l,l];n<.5?s=n*(1+r):s=n+r-n*r,i=2*n-s,a=[0,0,0];for(var u=0;u<3;u++)o=e+1/3*-(u-1),o<0&&o++,o>1&&o--,6*o<1?l=i+(s-i)*6*o:2*o<1?l=s:3*o<2?l=i+(s-i)*(2/3-o)*6:l=i,a[u]=l*255;return a};te.hsl.hsv=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,i=r,s=Math.max(n,.01),o,a;return n*=2,r*=n<=1?n:2-n,i*=s<=1?s:2-s,a=(n+r)/2,o=n===0?2*i/(s+i):2*r/(n+r),[e,o*100,a*100]};te.hsv.rgb=function(t){var e=t[0]/60,r=t[1]/100,n=t[2]/100,i=Math.floor(e)%6,s=e-Math.floor(e),o=255*n*(1-r),a=255*n*(1-r*s),l=255*n*(1-r*(1-s));switch(n*=255,i){case 0:return[n,l,o];case 1:return[a,n,o];case 2:return[o,n,l];case 3:return[o,a,n];case 4:return[l,o,n];case 5:return[n,o,a]}};te.hsv.hsl=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,i=Math.max(n,.01),s,o,a;return a=(2-r)*n,s=(2-r)*i,o=r*i,o/=s<=1?s:2-s,o=o||0,a/=2,[e,o*100,a*100]};te.hwb.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100,i=r+n,s,o,a,l;i>1&&(r/=i,n/=i),s=Math.floor(6*e),o=1-n,a=6*e-s,s&1&&(a=1-a),l=r+a*(o-r);var u,c,h;switch(s){default:case 6:case 0:u=o,c=l,h=r;break;case 1:u=l,c=o,h=r;break;case 2:u=r,c=o,h=l;break;case 3:u=r,c=l,h=o;break;case 4:u=l,c=r,h=o;break;case 5:u=o,c=r,h=l;break}return[u*255,c*255,h*255]};te.cmyk.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,i=t[3]/100,s,o,a;return s=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,r*(1-i)+i),a=1-Math.min(1,n*(1-i)+i),[s*255,o*255,a*255]};te.xyz.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,i,s,o;return i=e*3.2406+r*-1.5372+n*-.4986,s=e*-.9689+r*1.8758+n*.0415,o=e*.0557+r*-.204+n*1.057,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*12.92,s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s*12.92,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),[i*255,s*255,o*255]};te.xyz.lab=function(t){var e=t[0],r=t[1],n=t[2],i,s,o;return e/=95.047,r/=100,n/=108.883,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=116*r-16,s=500*(e-r),o=200*(r-n),[i,s,o]};te.lab.xyz=function(t){var e=t[0],r=t[1],n=t[2],i,s,o;s=(e+16)/116,i=r/500+s,o=s-n/200;var a=Math.pow(s,3),l=Math.pow(i,3),u=Math.pow(o,3);return s=a>.008856?a:(s-16/116)/7.787,i=l>.008856?l:(i-16/116)/7.787,o=u>.008856?u:(o-16/116)/7.787,i*=95.047,s*=100,o*=108.883,[i,s,o]};te.lab.lch=function(t){var e=t[0],r=t[1],n=t[2],i,s,o;return i=Math.atan2(n,r),s=i*360/2/Math.PI,s<0&&(s+=360),o=Math.sqrt(r*r+n*n),[e,o,s]};te.lch.lab=function(t){var e=t[0],r=t[1],n=t[2],i,s,o;return o=n/360*2*Math.PI,i=r*Math.cos(o),s=r*Math.sin(o),[e,i,s]};te.rgb.ansi16=function(t){var e=t[0],r=t[1],n=t[2],i=1 in arguments?arguments[1]:te.rgb.hsv(t)[2];if(i=Math.round(i/50),i===0)return 30;var s=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(e/255));return i===2&&(s+=60),s};te.hsv.ansi16=function(t){return te.rgb.ansi16(te.hsv.rgb(t),t[2])};te.rgb.ansi256=function(t){var e=t[0],r=t[1],n=t[2];if(e===r&&r===n)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;var i=16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5);return i};te.ansi16.rgb=function(t){var e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];var r=(~~(t>50)+1)*.5,n=(e&1)*r*255,i=(e>>1&1)*r*255,s=(e>>2&1)*r*255;return[n,i,s]};te.ansi256.rgb=function(t){if(t>=232){var e=(t-232)*10+8;return[e,e,e]}t-=16;var r,n=Math.floor(t/36)/5*255,i=Math.floor((r=t%36)/6)/5*255,s=r%6/5*255;return[n,i,s]};te.rgb.hex=function(t){var e=((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255),r=e.toString(16).toUpperCase();return"000000".substring(r.length)+r};te.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var r=e[0];e[0].length===3&&(r=r.split("").map(function(a){return a+a}).join(""));var n=parseInt(r,16),i=n>>16&255,s=n>>8&255,o=n&255;return[i,s,o]};te.rgb.hcg=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.max(Math.max(e,r),n),s=Math.min(Math.min(e,r),n),o=i-s,a,l;return o<1?a=s/(1-o):a=0,o<=0?l=0:i===e?l=(r-n)/o%6:i===r?l=2+(n-e)/o:l=4+(e-r)/o+4,l/=6,l%=1,[l*360,o*100,a*100]};te.hsl.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=1,i=0;return r<.5?n=2*e*r:n=2*e*(1-r),n<1&&(i=(r-.5*n)/(1-n)),[t[0],n*100,i*100]};te.hsv.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=e*r,i=0;return n<1&&(i=(r-n)/(1-n)),[t[0],n*100,i*100]};te.hcg.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];var i=[0,0,0],s=e%1*6,o=s%1,a=1-o,l=0;switch(Math.floor(s)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return l=(1-r)*n,[(r*i[0]+l)*255,(r*i[1]+l)*255,(r*i[2]+l)*255]};te.hcg.hsv=function(t){var e=t[1]/100,r=t[2]/100,n=e+r*(1-e),i=0;return n>0&&(i=e/n),[t[0],i*100,n*100]};te.hcg.hsl=function(t){var e=t[1]/100,r=t[2]/100,n=r*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],i*100,n*100]};te.hcg.hwb=function(t){var e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};te.hwb.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=1-r,i=n-e,s=0;return i<1&&(s=(n-i)/(1-i)),[t[0],i*100,s*100]};te.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};te.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};te.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};te.gray.hsl=te.gray.hsv=function(t){return[0,0,t[0]]};te.gray.hwb=function(t){return[0,100,t[0]]};te.gray.cmyk=function(t){return[0,0,0,t[0]]};te.gray.lab=function(t){return[t[0],0,0]};te.gray.hex=function(t){var e=Math.round(t[0]/100*255)&255,r=(e<<16)+(e<<8)+e,n=r.toString(16).toUpperCase();return"000000".substring(n.length)+n};te.rgb.gray=function(t){var e=(t[0]+t[1]+t[2])/3;return[e/255*100]};var R2=C2.exports,Eu=R2;function GS(){for(var t={},e=Object.keys(Eu),r=e.length,n=0;n1&&(r=Array.prototype.slice.call(arguments)),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function ek(t){var e=function(r){if(r==null)return r;arguments.length>1&&(r=Array.prototype.slice.call(arguments));var n=t(r);if(typeof n=="object")for(var i=n.length,s=0;sr?(e+.05)/(r+.05):(r+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb,e=(t[0]*299+t[1]*587+t[2]*114)/1e3;return e<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){return this.values.hsl[2]+=this.values.hsl[2]*t,this.setValues("hsl",this.values.hsl),this},darken:function(t){return this.values.hsl[2]-=this.values.hsl[2]*t,this.setValues("hsl",this.values.hsl),this},saturate:function(t){return this.values.hsl[1]+=this.values.hsl[1]*t,this.setValues("hsl",this.values.hsl),this},desaturate:function(t){return this.values.hsl[1]-=this.values.hsl[1]*t,this.setValues("hsl",this.values.hsl),this},whiten:function(t){return this.values.hwb[1]+=this.values.hwb[1]*t,this.setValues("hwb",this.values.hwb),this},blacken:function(t){return this.values.hwb[2]+=this.values.hwb[2]*t,this.setValues("hwb",this.values.hwb),this},greyscale:function(){var t=this.values.rgb,e=t[0]*.3+t[1]*.59+t[2]*.11;return this.setValues("rgb",[e,e,e]),this},clearer:function(t){return this.setValues("alpha",this.values.alpha-this.values.alpha*t),this},opaquer:function(t){return this.setValues("alpha",this.values.alpha+this.values.alpha*t),this},rotate:function(t){var e=this.values.hsl[0];return e=(e+t)%360,e=e<0?360+e:e,this.values.hsl[0]=e,this.setValues("hsl",this.values.hsl),this},mix:function(t,e){var r=this,n=t,i=e===void 0?.5:e,s=2*i-1,o=r.alpha()-n.alpha(),a=((s*o===-1?s:(s+o)/(1+s*o))+1)/2,l=1-a;return this.rgb(a*r.red()+l*n.red(),a*r.green()+l*n.green(),a*r.blue()+l*n.blue()).alpha(r.alpha()*i+n.alpha()*(1-i))},toJSON:function(){return this.rgb()},clone:function(){var t=new vn;return t.values=dk(this.values),t}};vn.prototype.getValues=function(t){for(var e={},r=0;r{const n=T.useRef(null);return T.useEffect(()=>{if(t&&n.current){const i=parseInt(t.slice(2,10),16),s=kk(e,i);n.current.innerHTML="",n.current.appendChild(s)}},[t,e]),S.jsx("div",{...r,ref:n})},{useIsActivating:Nk}=n0;function Mk({provider:t,packageAbi:e}){var g;const{state:r}=$u(),{listedApps:n}=Pi(),{account:i,isActive:s}=Hu.useWeb3React(),o=Nk(),[a,l]=T.useState(""),[u,c]=T.useState(),[h,p]=T.useState(!1),[v,y]=T.useState(""),[b,k]=T.useState(((g=window.our)==null?void 0:g.node)||""),[w,m]=T.useState(""),[A,j]=T.useState(""),[L,D]=T.useState(!1),[F,U]=T.useState([]);T.useEffect(()=>{const E=r==null?void 0:r.app;E&&(y(E.package),k(E.publisher),D(!0))},[r]),T.useEffect(()=>{U(n.filter(E=>{var M;return((M=E.owner)==null?void 0:M.toLowerCase())===(i==null?void 0:i.toLowerCase())}))},[n,i]);const G=T.useCallback(async()=>{await N2.activate().catch(()=>{});try{Af(zo)}catch(E){console.error(E)}},[]),J=T.useCallback(async()=>{if(!w){j("");return}try{const M=await(await fetch(w)).text();JSON.parse(M);const _=ot(yr(M));j(_)}catch{window.alert("Error calculating metadata hash. Please ensure the URL is valid and the metadata is in JSON format.")}},[w]),re=T.useCallback(async E=>{var _;E.preventDefault(),E.stopPropagation();let M=A;try{if(!M){const N=await fetch(w);await N.json();const d=await N.text();M=ot(yr(d))}l("Please confirm the transaction in your wallet");const P=Zm(b);await Af(zo);const I=await(L?e==null?void 0:e.updateMetadata(W.from(n6(["string","bytes"],[v,P])),w,M):e==null?void 0:e.registerApp(v,P,w,M));await new Promise(N=>setTimeout(N,2e3)),l("Publishing package..."),await(I==null?void 0:I.wait()),c({packageName:v,publisherId:b}),y(""),k(((_=window.our)==null?void 0:_.node)||b),m(""),j(""),D(!1)}catch(P){console.error(P),window.alert("Error publishing package. Please ensure the package name and publisher ID are valid, and the metadata is in JSON format.")}finally{l("")}},[v,L,b,w,A,e,c,y,k,m,j,D]),$e=T.useCallback(async(E,M)=>{try{await Af(zo);const _=await(e==null?void 0:e.unlistPacakge(ot(a2(["string","bytes"],[E,Zm(M)]))));await new Promise(P=>setTimeout(P,2e3)),l("Unlisting package..."),await(_==null?void 0:_.wait())}catch(_){console.error(_),window.alert("Error unlisting package")}finally{l("")}},[e,l]),R=T.useCallback(async()=>{L||v&&b&&n.find(E=>E.package===v&&E.publisher===b)&&D(!0)},[n,v,b,L,D]),f=Kn();return S.jsxs("div",{className:ce("w-full flex flex-col gap-2",{"max-w-[900px]":!f,"p-2 h-screen w-screen":f}),children:[!f&&S.jsx(ac,{}),S.jsx(oc,{hideSearch:!0,hidePublish:!0,onBack:h?()=>p(!1):void 0}),S.jsxs("div",{className:"flex-center justify-between",children:[S.jsx("h4",{children:"Publish Package"}),!!i&&S.jsxs("div",{className:"card flex-center",children:[S.jsx("span",{children:"Publishing as:"}),S.jsx(ng,{address:i,className:"mx-2"}),S.jsxs("span",{className:"font-mono",children:[i==null?void 0:i.slice(0,4),"...",i==null?void 0:i.slice(-4)]})]})]}),a?S.jsx("div",{className:"flex-col-center",children:S.jsx(ya,{msg:a})}):u?S.jsxs("div",{className:"flex-col-center gap-2",children:[S.jsx("h4",{children:"Package Published!"}),S.jsxs("div",{children:[S.jsx("strong",{children:"Package Name:"})," ",u.packageName]}),S.jsxs("div",{children:[S.jsx("strong",{children:"Publisher ID:"})," ",u.publisherId]}),S.jsx("button",{className:"flex ml-2",onClick:()=>c(void 0),children:"Publish Another Package"})]}):h?S.jsx(LS,{packageName:v,publisherId:b,app:r==null?void 0:r.app,goBack:()=>p(!1)}):!i||!s?S.jsxs(S.Fragment,{children:[S.jsxs("h4",{children:["Please connect your wallet ",f&&S.jsx("br",{})," to publish a package"]}),S.jsx("button",{className:"connect-wallet row",onClick:G,children:"Connect Wallet"})]}):o?S.jsx(ya,{msg:"Approve connection in your wallet"}):S.jsxs("form",{className:"flex flex-col flex-1 overflow-y-auto gap-2",onSubmit:re,children:[S.jsxs("div",{className:"flex cursor-pointer p-2 -mb-2",onClick:()=>D(!L),children:[S.jsx(BS,{checked:L,readOnly:!0}),S.jsx("label",{htmlFor:"update",className:"cursor-pointer ml-4",children:"Update existing package"})]}),S.jsxs("div",{className:"flex flex-col",children:[S.jsx("label",{htmlFor:"package-name",children:"Package Name"}),S.jsx("input",{id:"package-name",type:"text",required:!0,placeholder:"my-package",value:v,onChange:E=>y(E.target.value),onBlur:R})]}),S.jsxs("div",{className:"flex flex-col",children:[S.jsx("label",{htmlFor:"publisher-id",children:"Publisher ID"}),S.jsx("input",{id:"publisher-id",type:"text",required:!0,value:b,onChange:E=>k(E.target.value),onBlur:R})]}),S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsx("label",{htmlFor:"metadata-url",children:"Metadata URL"}),S.jsx("input",{id:"metadata-url",type:"text",required:!0,value:w,onChange:E=>m(E.target.value),onBlur:J,placeholder:"https://github/my-org/my-repo/metadata.json"}),S.jsxs("div",{children:["Metadata is a JSON file that describes your package.",S.jsx("br",{})," You can"," ",S.jsx("a",{onClick:()=>p(!0),className:"underline cursor-pointer",children:"fill out a template here"}),"."]})]}),S.jsxs("div",{className:"flex flex-col",children:[S.jsx("label",{htmlFor:"metadata-hash",children:"Metadata Hash"}),S.jsx("input",{readOnly:!0,id:"metadata-hash",type:"text",value:A,onChange:E=>j(E.target.value),placeholder:"Calculated automatically from metadata URL"})]}),S.jsx("button",{type:"submit",children:"Publish"})]}),S.jsxs("div",{className:"flex flex-col",children:[S.jsx("h4",{children:"Packages You Own"}),F.length>0?S.jsx("div",{className:"flex flex-col",children:F.map(E=>S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center",children:[S.jsx(ng,{address:E.publisher,className:"mr-2"}),S.jsx("span",{children:E.package})]}),S.jsx("button",{className:"flex items-center",onClick:()=>$e(E.package,E.publisher),children:S.jsx("span",{children:"Unpublish"})})]},`${E.package}${E.publisher}`))}):S.jsx("div",{className:"flex items-center",children:S.jsx("span",{children:"No packages published"})})]})]})}var Ck={BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Pk=[[N2,n0]],{useProvider:Rk}=n0,$o="/main:app_store:sys";window.our&&(window.our.process=$o==null?void 0:$o.replace("/",""));const Ik=`${Ck.VITE_NODE_URL||"http://localhost:8080"}${$o}`;function Ok(){const t=Rk(),[e,r]=T.useState(!0),[n,i]=T.useState(void 0);if(T.useEffect(()=>{if(!t)return;(async()=>{(await t.getNetwork()).chainId===Uh.OPTIMISM&&i(l2.connect(kS[Uh.OPTIMISM],t.getSigner()))})()},[t]),T.useEffect(()=>{},[]),!e)return S.jsxs("div",{className:"flex flex-col c",children:[S.jsx("h2",{style:{color:"red"},children:"Node not connected"}),S.jsxs("h4",{children:["You need to start a node at ",Ik," before you can use this UI in development."]})]});const s={provider:t,packageAbi:n};return S.jsx("div",{className:"flex flex-col c h-screen w-screen max-h-screen max-w-screen overflow-x-hidden special-appstore-background",children:S.jsx(Hu.Web3ReactProvider,{connectors:Pk,children:S.jsx(o3,{basename:$o,children:S.jsxs(i3,{children:[S.jsx(ko,{path:U6,element:S.jsx(AS,{})}),S.jsx(ko,{path:Lh,element:S.jsx(_S,{})}),S.jsx(ko,{path:`${vu}/:id`,element:S.jsx(SS,{})}),S.jsx(ko,{path:sc,element:S.jsx(Mk,{...s})})]})})})})}Nf.createRoot(document.getElementById("root")).render(S.jsx(Wr.StrictMode,{children:S.jsx(Ok,{})})); +*/(function(t){(function(){var e={}.hasOwnProperty;function r(){for(var s="",o=0;owindow.innerWidth<=600,M6=({text:t,className:e,size:r})=>{var o;const i=`/icons/${((o=t.split("").pop())==null?void 0:o.toUpperCase())||"0"}`;if(!i)return null;const s=Kn();return _.jsx("img",{src:i,className:ue("m-0 align-self-center rounded-full",{"h-32 w-32":!s&&r==="large","h-18 w-18":!s&&r==="medium","h-12 w-12":s||r==="small"},e)})};function g2({app:t,size:e="medium",overrideImageSize:r,...n}){var a,l,u,c,h;const i=Kn(),s=_.jsx("div",{className:ue({"text-3xl font-[OpenSans]":!i&&e==="large","text-xl":!i&&e!=="large","text-lg":i}),children:((a=t.metadata)==null?void 0:a.name)||Ee(t)}),o=r||e;return _.jsxs("div",{...n,className:ue("flex w-full justify-content-start",e,n.className,{"flex-col":e==="small","gap-2":i,"gap-4":!i,"gap-6":!i&&e==="large"}),children:[e==="small"&&s,(l=t.metadata)!=null&&l.image?_.jsx("img",{src:t.metadata.image,alt:"app icon",className:ue("object-cover",{rounded:!o,"rounded-md":o==="small","rounded-lg":o==="medium","rounded-2xl":o==="large","h-32":o==="large"||o==="small","h-20":o==="medium"})}):_.jsx(M6,{text:t.metadata_hash||((c=(u=t.state)==null?void 0:u.our_version)==null?void 0:c.toString())||"",size:o}),_.jsxs("div",{className:ue("flex flex-col",{"gap-2":i,"gap-4 max-w-3/4":i&&e!=="small"}),children:[e!=="small"&&s,((h=t.metadata)==null?void 0:h.description)&&_.jsx("div",{style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"},className:ue({"text-2xl":e==="large"}),children:t.metadata.description})]})]})}function C6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.2 288 416 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0L214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"},child:[]}]})(t)}function P6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M386.3 160H336c-17.7 0-32 14.3-32 32s14.3 32 32 32H464c17.7 0 32-14.3 32-32V64c0-17.7-14.3-32-32-32s-32 14.3-32 32v51.2L414.4 97.6c-87.5-87.5-229.3-87.5-316.8 0s-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3s163.8-62.5 226.3 0L386.3 160z"},child:[]}]})(t)}function v2(t){return Vt({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"},child:[]}]})(t)}function y2(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32V274.7l-73.4-73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L288 274.7V32zM64 352c-35.3 0-64 28.7-64 64v32c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V416c0-35.3-28.7-64-64-64H346.5l-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352H64zm368 56a24 24 0 1 1 0 48 24 24 0 1 1 0-48z"},child:[]}]})(t)}function R6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M352 256c0 22.2-1.2 43.6-3.3 64H163.3c-2.2-20.4-3.3-41.8-3.3-64s1.2-43.6 3.3-64H348.7c2.2 20.4 3.3 41.8 3.3 64zm28.8-64H503.9c5.3 20.5 8.1 41.9 8.1 64s-2.8 43.5-8.1 64H380.8c2.1-20.6 3.2-42 3.2-64s-1.1-43.4-3.2-64zm112.6-32H376.7c-10-63.9-29.8-117.4-55.3-151.6c78.3 20.7 142 77.5 171.9 151.6zm-149.1 0H167.7c6.1-36.4 15.5-68.6 27-94.7c10.5-23.6 22.2-40.7 33.5-51.5C239.4 3.2 248.7 0 256 0s16.6 3.2 27.8 13.8c11.3 10.8 23 27.9 33.5 51.5c11.6 26 20.9 58.2 27 94.7zm-209 0H18.6C48.6 85.9 112.2 29.1 190.6 8.4C165.1 42.6 145.3 96.1 135.3 160zM8.1 192H131.2c-2.1 20.6-3.2 42-3.2 64s1.1 43.4 3.2 64H8.1C2.8 299.5 0 278.1 0 256s2.8-43.5 8.1-64zM194.7 446.6c-11.6-26-20.9-58.2-27-94.6H344.3c-6.1 36.4-15.5 68.6-27 94.6c-10.5 23.6-22.2 40.7-33.5 51.5C272.6 508.8 263.3 512 256 512s-16.6-3.2-27.8-13.8c-11.3-10.8-23-27.9-33.5-51.5zM135.3 352c10 63.9 29.8 117.4 55.3 151.6C112.2 482.9 48.6 426.1 18.6 352H135.3zm358.1 0c-30 74.1-93.6 130.9-171.9 151.6c25.5-34.2 45.2-87.7 55.3-151.6H493.4z"},child:[]}]})(t)}function I6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M32 32C14.3 32 0 46.3 0 64S14.3 96 32 96h96V416H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H288c17.7 0 32-14.3 32-32s-14.3-32-32-32H192V96h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H160 32z"},child:[]}]})(t)}function O6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"},child:[]}]})(t)}function T6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M72 88a56 56 0 1 1 112 0A56 56 0 1 1 72 88zM64 245.7C54 256.9 48 271.8 48 288s6 31.1 16 42.3V245.7zm144.4-49.3C178.7 222.7 160 261.2 160 304c0 34.3 12 65.8 32 90.5V416c0 17.7-14.3 32-32 32H96c-17.7 0-32-14.3-32-32V389.2C26.2 371.2 0 332.7 0 288c0-61.9 50.1-112 112-112h32c24 0 46.2 7.5 64.4 20.3zM448 416V394.5c20-24.7 32-56.2 32-90.5c0-42.8-18.7-81.3-48.4-107.7C449.8 183.5 472 176 496 176h32c61.9 0 112 50.1 112 112c0 44.7-26.2 83.2-64 101.2V416c0 17.7-14.3 32-32 32H480c-17.7 0-32-14.3-32-32zm8-328a56 56 0 1 1 112 0A56 56 0 1 1 456 88zM576 245.7v84.7c10-11.3 16-26.1 16-42.3s-6-31.1-16-42.3zM320 32a64 64 0 1 1 0 128 64 64 0 1 1 0-128zM240 304c0 16.2 6 31 16 42.3V261.7c-10 11.3-16 26.1-16 42.3zm144-42.3v84.7c10-11.3 16-26.1 16-42.3s-6-31.1-16-42.3zM448 304c0 44.7-26.2 83.2-64 101.2V448c0 17.7-14.3 32-32 32H288c-17.7 0-32-14.3-32-32V405.2c-37.8-18-64-56.5-64-101.2c0-61.9 50.1-112 112-112h32c61.9 0 112 50.1 112 112z"},child:[]}]})(t)}function j6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M73 39c-14.8-9.1-33.4-9.4-48.5-.9S0 62.6 0 80V432c0 17.4 9.4 33.4 24.5 41.9s33.7 8.1 48.5-.9L361 297c14.3-8.7 23-24.2 23-41s-8.7-32.2-23-41L73 39z"},child:[]}]})(t)}function L6(t){return Vt({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M288 109.3V352c0 17.7-14.3 32-32 32s-32-14.3-32-32V109.3l-73.4 73.4c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l128-128c12.5-12.5 32.8-12.5 45.3 0l128 128c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L288 109.3zM64 352H192c0 35.3 28.7 64 64 64s64-28.7 64-64H448c35.3 0 64 28.7 64 64v32c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V416c0-35.3 28.7-64 64-64zM432 456a24 24 0 1 0 0-48 24 24 0 1 0 0 48z"},child:[]}]})(t)}function w2(t){return Vt({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M376.6 84.5c11.3-13.6 9.5-33.8-4.1-45.1s-33.8-9.5-45.1 4.1L192 206 56.6 43.5C45.3 29.9 25.1 28.1 11.5 39.4S-3.9 70.9 7.4 84.5L150.3 256 7.4 427.5c-11.3 13.6-9.5 33.8 4.1 45.1s33.8 9.5 45.1-4.1L192 306 327.4 468.5c11.3 13.6 31.5 15.4 45.1 4.1s15.4-31.5 4.1-45.1L233.7 256 376.6 84.5z"},child:[]}]})(t)}const t0=({show:t,hide:e,hideClose:r=!1,title:n,...i})=>{const s=o=>{o.stopPropagation()};return t?_.jsx("div",{className:ue("bg-black/25 backdrop-blur-lg fixed top-0 bottom-0 left-0 right-0 flex flex-col c z-30 min-h-[10em] min-w-[30em]",{show:t}),onClick:e,children:_.jsxs("div",{...i,className:`flex flex-col relative bg-black/90 rounded-lg py-6 px-12 ${i.className||""}`,onClick:s,children:[!!n&&_.jsx("h4",{className:"mt-0 mb-2",children:n}),!r&&_.jsx("button",{className:"icon absolute top-1 right-1",onClick:e,children:_.jsx(w2,{})}),_.jsx("div",{className:"flex flex-col items-center w-full",onClick:s,children:i.children})]})}):null};function ya({msg:t}){return _.jsxs("div",{id:"loading",className:"flex flex-col text-center",children:[_.jsx("h4",{children:t}),_.jsxs("div",{id:"loader",children:[" ",_.jsx("div",{})," ",_.jsx("div",{})," ",_.jsx("div",{})," ",_.jsx("div",{})," "]})]})}function $m({app:t,isIcon:e=!1,...r}){const{updateApp:n,getCaps:i,getMyApp:s,getMyApps:o}=Pi(),[a,l]=j.useState(!1),[u,c]=j.useState([]),[h,p]=j.useState(""),v=j.useCallback(async b=>{b.preventDefault(),i(t).then(k=>{c(k.request_capabilities)}),l(!0)},[t,l,i]),w=j.useCallback(async()=>{try{p(`Updating ${Js(t)}...`),await n(t);const b=setInterval(()=>{s(t).then(k=>{k.installed&&(p(""),l(!1),clearInterval(b),o())}).catch(console.log)},2e3)}catch(b){console.error(b),window.alert("Failed to update, please try again."),p("")}},[t,n,s]);return _.jsxs(_.Fragment,{children:[_.jsx("button",{...r,type:"button",className:ue("text-sm self-start",r.className),onClick:v,children:"Update"}),_.jsx(t0,{show:a,hide:()=>l(!1),children:h?_.jsx(ya,{msg:h}):_.jsxs(_.Fragment,{children:[_.jsx("h4",{children:"Approve App Permissions"}),_.jsxs("h5",{className:"m-0",children:[Js(t)," needs the following permissions:"]}),_.jsx("br",{}),_.jsx("ul",{className:"flex flex-col items-start",children:u.map(b=>_.jsx("li",{children:b},b))}),_.jsx("button",{type:"button",onClick:w,children:"Approve & Update"})]})})]})}function B6({app:t,isIcon:e=!1,...r}){var m,A,T,L,D,F,U;const{downloadApp:n,getCaps:i,getMyApp:s,getMyApps:o}=Pi(),[a,l]=j.useState(!1),[u,c]=j.useState(((T=(A=(m=t.metadata)==null?void 0:m.properties)==null?void 0:A.mirrors)==null?void 0:T[0])||"Other"),[h,p]=j.useState(""),[v,w]=j.useState("");j.useEffect(()=>{var G,J,re;c(((re=(J=(G=t.metadata)==null?void 0:G.properties)==null?void 0:J.mirrors)==null?void 0:re[0])||"Other")},[(D=(L=t.metadata)==null?void 0:L.properties)==null?void 0:D.mirrors]);const b=j.useCallback(async G=>{G.preventDefault(),l(!0)},[t,l,i]),k=j.useCallback(async G=>{G.preventDefault(),G.stopPropagation();const J=u==="Other"?h:u;if(!J){window.alert("Please select a mirror");return}try{w(`Downloading ${Js(t)}...`),await n(t,J);const re=setInterval(()=>{s(t).then(()=>{w(""),l(!1),clearInterval(re),o()}).catch(console.log)},2e3)}catch(re){console.error(re),window.alert(`Failed to download app from ${J}, please try a different mirror.`),w("")}},[u,h,t,n,s]),y=Js(t);return _.jsxs(_.Fragment,{children:[_.jsx("button",{...r,type:"button",className:ue("text-sm self-start",r.className,{"icon clear":e,black:!e}),onClick:b,children:e?_.jsx(y2,{}):"Download"}),_.jsx(t0,{show:a,hide:()=>l(!1),children:v?_.jsx(ya,{msg:v}):_.jsxs("form",{className:"flex flex-col items-center gap-2",onSubmit:k,children:[_.jsxs("h4",{children:["Download '",y,"'"]}),_.jsx("h5",{children:"Select Mirror"}),_.jsx("select",{value:u,onChange:G=>c(G.target.value),children:(((U=(F=t.metadata)==null?void 0:F.properties)==null?void 0:U.mirrors)||[]).concat(["Other"]).map(G=>_.jsx("option",{value:G,children:G},G))}),u==="Other"&&_.jsx("input",{type:"text",value:h,onChange:G=>p(G.target.value),placeholder:"Mirror, i.e. 'template.os'",className:"p-1 max-w-[240px] w-full",required:!0,autoFocus:!0}),_.jsx("button",{type:"submit",children:"Download"})]})})]})}function D6({app:t,isIcon:e=!1,...r}){const{installApp:n,getCaps:i,getMyApp:s,getMyApps:o}=Pi(),[a,l]=j.useState(!1),[u,c]=j.useState([]),[h,p]=j.useState(""),v=j.useCallback(async b=>{b.preventDefault(),i(t).then(k=>{c(k.request_capabilities)}),l(!0)},[t,l,i]),w=j.useCallback(async()=>{try{p(`Installing ${Js(t)}...`),await n(t);const b=setInterval(()=>{s(t).then(k=>{k.installed&&(p(""),l(!1),clearInterval(b),o())}).catch(console.log)},2e3)}catch(b){console.error(b),window.alert("Failed to install, please try again."),p("")}},[t,n,s]);return _.jsxs(_.Fragment,{children:[_.jsx("button",{...r,type:"button",className:ue("text-sm self-start",r.className,{"icon clear":e}),onClick:v,children:e?_.jsx(I6,{}):"Install"}),_.jsx(t0,{show:a,hide:()=>l(!1),children:h?_.jsx(ya,{msg:h}):_.jsxs(_.Fragment,{children:[_.jsx("h4",{children:"Approve App Permissions"}),_.jsxs("h5",{className:"m-0",children:[Js(t)," needs the following permissions:"]}),_.jsx("ul",{className:"flex flex-col items-start",children:u.map(b=>_.jsx("li",{children:b},b))}),_.jsx("button",{type:"button",onClick:w,children:"Approve & Install"})]})})]})}function F6({app:t,launchPath:e,isIcon:r=!1,...n}){const i=j.useCallback(async s=>{s.preventDefault(),window.location.href=`/${e.replace("/","")}`},[t,e]);return _.jsx(_.Fragment,{children:_.jsx("button",{...n,type:"button",className:ue("text-sm self-start",n.className,{"icon clear":r,alt:!r}),onClick:i,children:r?_.jsx(j6,{}):"Launch"})})}function x2({app:t,isIcon:e=!1,permitMultiButton:r=!1,...n}){const{installed:i,downloaded:s,updatable:o}=j.useMemo(()=>{var w,b,k,y;const c=(Object.entries(((b=(w=t==null?void 0:t.metadata)==null?void 0:w.properties)==null?void 0:b.code_hashes)||{}).find(([m])=>{var A,T;return m===((T=(A=t.metadata)==null?void 0:A.properties)==null?void 0:T.current_version)})||[])[1],h=t.installed,p=!!t.state,v=!!((k=t.state)!=null&&k.our_version&&c)&&((y=t.state)==null?void 0:y.our_version)!==c&&t.publisher!==window.our.node;return{installed:h,downloaded:p,updatable:v}},[t]),[a,l]=j.useState("");return j.useEffect(()=>{fetch("/apps").then(u=>u.json()).then(u=>{if(Array.isArray(u)){const c=u.find(h=>t.package===h.package_name);c&&l(c.path)}})},[t]),_.jsxs(_.Fragment,{children:[r&&i&&o&&a&&_.jsx($m,{app:t,...n,isIcon:e}),i&&a?_.jsx(F6,{app:t,...n,isIcon:e,launchPath:a}):i&&o?_.jsx($m,{app:t,...n,isIcon:e}):s?i?e?_.jsx("button",{className:"pointer-events none icon clear absolute top-0 right-0",children:_.jsx(v2,{})}):_.jsx(_.Fragment,{}):_.jsx(D6,{app:t,...n,isIcon:e}):_.jsx(B6,{app:t,...n,isIcon:e})]})}const Lh="/my-apps",U6="/",sc="/publish",vu="/app-details",b2=t=>!!t&&t[0]==="o",Hm=oa.unstable_batchedUpdates||(t=>t()),ss=(t,e,r=1e-4)=>Math.abs(t-e)t===!0||!!(t&&t[e]),gn=(t,e)=>typeof t=="function"?t(e):t,E2="_szhsinMenu",z6=t=>t[E2],$6=(t,e)=>Object.defineProperty(e,E2,{value:t}),r0=(t,e)=>(e&&Object.keys(e).forEach(r=>{const n=t[r],i=e[r];typeof i=="function"&&n?t[r]=(...s)=>{i(...s),n(...s)}:t[r]=i}),t),H6=t=>{if(typeof t!="string")return{top:0,right:0,bottom:0,left:0};const e=t.trim().split(/\s+/,4).map(parseFloat),r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?r:e[1];return{top:r,right:n,bottom:isNaN(e[2])?r:e[2],left:isNaN(e[3])?n:e[3]}},wf=t=>{for(;t;){if(t=t.parentNode,!t||t===document.body||!t.parentNode)return;const{overflow:e,overflowX:r,overflowY:n}=getComputedStyle(t);if(/auto|scroll|overlay|hidden/.test(e+n+r))return t}};function q6(t,e){return{"aria-disabled":t||void 0,tabIndex:e?0:-1}}function qm(t,e){for(let r=0;rj.useMemo(()=>{const i=e?`${t}__${e}`:t;let s=i;r&&Object.keys(r).forEach(a=>{const l=r[a];l&&(s+=` ${i}--${l===!0?a:`${a}-${l}`}`)});let o=typeof n=="function"?n(r):n;return typeof o=="string"&&(o=o.trim(),o&&(s+=` ${o}`)),s},[t,e,r,n]),V6="szh-menu-container",xf="szh-menu",G6="szh-menu-button",W6="arrow",K6=j.createContext(),Q6=j.createContext({}),Vm=j.createContext({}),J6=j.createContext({}),A2=j.createContext({}),Rn=Object.freeze({ENTER:"Enter",ESC:"Escape",SPACE:" ",HOME:"Home",END:"End",LEFT:"ArrowLeft",RIGHT:"ArrowRight",UP:"ArrowUp",DOWN:"ArrowDown"}),It=Object.freeze({RESET:0,SET:1,UNSET:2,INCREASE:3,DECREASE:4,FIRST:5,LAST:6,SET_INDEX:7}),xa=Object.freeze({CLICK:"click",CANCEL:"cancel",BLUR:"blur",SCROLL:"scroll"}),Uo=Object.freeze({FIRST:"first",LAST:"last"}),Y6=Object.freeze({entering:"opening",entered:"open",exiting:"closing",exited:"closed"}),bf="absolute",X6="menuitem",Gm={"aria-hidden":!0,role:X6},Z6=$6("MenuButton",j.forwardRef(function({className:e,isOpen:r,disabled:n,children:i,...s},o){const a=j.useMemo(()=>({open:r}),[r]);return _.jsx("button",{"aria-haspopup":!0,"aria-expanded":r,"aria-disabled":n||void 0,type:"button",disabled:n,...s,ref:o,className:yu({block:G6,modifiers:a,className:e}),children:i})})),eS=({className:t,containerRef:e,containerProps:r,children:n,isOpen:i,theming:s,transition:o,onClose:a})=>{const l=wa(o,"item"),u=({key:h})=>{switch(h){case Rn.ESC:gn(a,{key:h,reason:xa.CANCEL});break}},c=h=>{i&&!h.currentTarget.contains(h.relatedTarget)&&gn(a,{reason:xa.BLUR})};return _.jsx("div",{...r0({onKeyDown:u,onBlur:c},r),className:yu({block:V6,modifiers:j.useMemo(()=>({theme:s,itemTransition:l}),[s,l]),className:t}),style:{position:"absolute",...r==null?void 0:r.style},ref:e,children:n})},tS=()=>{let t,e=0;return{toggle:r=>{r?e++:e--,e=Math.max(e,0)},on:(r,n,i)=>{e?t||(t=setTimeout(()=>{t=0,n()},r)):i==null||i()},off:()=>{t&&(clearTimeout(t),t=0)}}},rS=(t,e)=>{const[r,n]=j.useState(),s=j.useRef({items:[],hoverIndex:-1,sorted:!1}).current,o=j.useCallback((l,u)=>{const{items:c}=s;if(!l)s.items=[];else if(u)c.push(l);else{const h=c.indexOf(l);h>-1&&(c.splice(h,1),l.contains(document.activeElement)&&(e.current.focus(),n()))}s.hoverIndex=-1,s.sorted=!1},[s,e]),a=j.useCallback((l,u,c)=>{const{items:h,hoverIndex:p}=s,v=()=>{if(s.sorted)return;const k=t.current.querySelectorAll(".szh-menu__item");h.sort((y,m)=>qm(k,y)-qm(k,m)),s.sorted=!0};let w=-1,b;switch(l){case It.RESET:break;case It.SET:b=u;break;case It.UNSET:b=k=>k===u?void 0:k;break;case It.FIRST:v(),w=0,b=h[w];break;case It.LAST:v(),w=h.length-1,b=h[w];break;case It.SET_INDEX:v(),w=c,b=h[w];break;case It.INCREASE:v(),w=p,w<0&&(w=h.indexOf(u)),w++,w>=h.length&&(w=0),b=h[w];break;case It.DECREASE:v(),w=p,w<0&&(w=h.indexOf(u)),w--,w<0&&(w=h.length-1),b=h[w];break}b||(w=-1),n(b),s.hoverIndex=w},[t,s]);return{hoverItem:r,dispatch:a,updateItems:o}},nS=(t,e,r,n)=>{const i=e.current.getBoundingClientRect(),s=t.current.getBoundingClientRect(),o=r===window?{left:0,top:0,right:document.documentElement.clientWidth,bottom:window.innerHeight}:r.getBoundingClientRect(),a=H6(n),l=w=>w+s.left-o.left-a.left,u=w=>w+s.left+i.width-o.right+a.right,c=w=>w+s.top-o.top-a.top,h=w=>w+s.top+i.height-o.bottom+a.bottom;return{menuRect:i,containerRect:s,getLeftOverflow:l,getRightOverflow:u,getTopOverflow:c,getBottomOverflow:h,confineHorizontally:w=>{let b=l(w);if(b<0)w-=b;else{const k=u(w);k>0&&(w-=k,b=l(w),b<0&&(w-=b))}return w},confineVertically:w=>{let b=c(w);if(b<0)w-=b;else{const k=h(w);k>0&&(w-=k,b=c(w),b<0&&(w-=b))}return w}}},iS=({arrowRef:t,menuY:e,anchorRect:r,containerRect:n,menuRect:i})=>{let s=r.top-n.top-e+r.height/2;const o=t.current.offsetHeight*1.25;return s=Math.max(o,s),s=Math.min(s,i.height-o),s},sS=({anchorRect:t,containerRect:e,menuRect:r,placeLeftorRightY:n,placeLeftX:i,placeRightX:s,getLeftOverflow:o,getRightOverflow:a,confineHorizontally:l,confineVertically:u,arrowRef:c,arrow:h,direction:p,position:v})=>{let w=p,b=n;v!=="initial"&&(b=u(b),v==="anchor"&&(b=Math.min(b,t.bottom-e.top),b=Math.max(b,t.top-e.top-r.height)));let k,y,m;return w==="left"?(k=i,v!=="initial"&&(y=o(k),y<0&&(m=a(s),(m<=0||-y>m)&&(k=s,w="right")))):(k=s,v!=="initial"&&(m=a(k),m>0&&(y=o(i),(y>=0||-y{let s=r.left-n.left-e+r.width/2;const o=t.current.offsetWidth*1.25;return s=Math.max(o,s),s=Math.min(s,i.width-o),s},aS=({anchorRect:t,containerRect:e,menuRect:r,placeToporBottomX:n,placeTopY:i,placeBottomY:s,getTopOverflow:o,getBottomOverflow:a,confineHorizontally:l,confineVertically:u,arrowRef:c,arrow:h,direction:p,position:v})=>{let w=p==="top"?"top":"bottom",b=n;v!=="initial"&&(b=l(b),v==="anchor"&&(b=Math.min(b,t.right-e.left),b=Math.max(b,t.left-e.left-r.width)));let k,y,m;return w==="top"?(k=i,v!=="initial"&&(y=o(k),y<0&&(m=a(s),(m<=0||-y>m)&&(k=s,w="bottom")))):(k=s,v!=="initial"&&(m=a(k),m>0&&(y=o(i),(y>=0||-y{const{menuRect:u,containerRect:c}=l,h=r==="left"||r==="right";let p=h?n:i,v=h?i:n;if(t){const L=a.current;h?p+=L.offsetWidth:v+=L.offsetHeight}const w=o.left-c.left-u.width-p,b=o.right-c.left+p,k=o.top-c.top-u.height-v,y=o.bottom-c.top+v;let m,A;e==="end"?(m=o.right-c.left-u.width,A=o.bottom-c.top-u.height):e==="center"?(m=o.left-c.left-(u.width-o.width)/2,A=o.top-c.top-(u.height-o.height)/2):(m=o.left-c.left,A=o.top-c.top),m+=p,A+=v;const T={...l,anchorRect:o,placeLeftX:w,placeRightX:b,placeLeftorRightY:A,placeTopY:k,placeBottomY:y,placeToporBottomX:m,arrowRef:a,arrow:t,direction:r,position:s};switch(r){case"left":case"right":return sS(T);case"top":case"bottom":default:return aS(T)}},Ef=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?j.useLayoutEffect:j.useEffect;function Wm(t,e){typeof t=="function"?t(e):t.current=e}const _2=(t,e)=>j.useMemo(()=>t?e?r=>{Wm(t,r),Wm(e,r)}:t:e,[t,e]),Km=-9999,uS=({ariaLabel:t,menuClassName:e,menuStyle:r,arrow:n,arrowProps:i={},anchorPoint:s,anchorRef:o,containerRef:a,containerProps:l,focusProps:u,externalRef:c,parentScrollingRef:h,align:p="start",direction:v="bottom",position:w="auto",overflow:b="visible",setDownOverflow:k,repositionFlag:y,captureFocus:m=!0,state:A,endTransition:T,isDisabled:L,menuItemFocus:D,gap:F=0,shift:U=0,children:G,onClose:J,...re})=>{const[$e,R]=j.useState({x:Km,y:Km}),[f,g]=j.useState({}),[E,M]=j.useState(),[S,P]=j.useState(v),[I]=j.useState(tS),[N,d]=j.useReducer(ie=>ie+1,1),{transition:C,boundingBoxRef:ee,boundingBoxPadding:x,rootMenuRef:B,rootAnchorRef:z,scrollNodesRef:$,reposition:V,viewScroll:se,submenuCloseDelay:Y}=j.useContext(A2),{submenuCtx:K,reposSubmenu:Xe=y}=j.useContext(Vm),Q=j.useRef(null),ae=j.useRef(),Xr=j.useRef(),Te=j.useRef(!1),Me=j.useRef({width:0,height:0}),Zr=j.useRef(()=>{}),{hoverItem:Ce,dispatch:fe,updateItems:Er}=rS(Q,ae),he=b2(A),je=wa(C,"open"),en=wa(C,"close"),ge=$.current,He=ie=>{switch(ie.key){case Rn.HOME:fe(It.FIRST);break;case Rn.END:fe(It.LAST);break;case Rn.UP:fe(It.DECREASE,Ce);break;case Rn.DOWN:fe(It.INCREASE,Ce);break;case Rn.SPACE:ie.target&&ie.target.className.indexOf(xf)!==-1&&ie.preventDefault();return;default:return}ie.preventDefault(),ie.stopPropagation()},En=()=>{A==="closing"&&M(),gn(T)},qe=ie=>{ie.stopPropagation(),I.on(Y,()=>{fe(It.RESET),ae.current.focus()})},Ve=ie=>{ie.target===ie.currentTarget&&I.off()},Gt=j.useCallback(ie=>{var lt;const ve=o?(lt=o.current)==null?void 0:lt.getBoundingClientRect():s?{left:s.x,right:s.x,top:s.y,bottom:s.y,width:0,height:0}:null;if(!ve)return;ge.menu||(ge.menu=(ee?ee.current:wf(B.current))||window);const de=nS(a,Q,ge.menu,x);let{arrowX:it,arrowY:_e,x:Se,y:Pt,computedDirection:Re}=lS({arrow:n,align:p,direction:v,gap:F,shift:U,position:w,anchorRect:ve,arrowRef:Xr,positionHelpers:de});const{menuRect:Fe}=de;let Yt=Fe.height;if(!ie&&b!=="visible"){const{getTopOverflow:Qe,getBottomOverflow:Je}=de;let Xt,Ie;const Ue=Me.current.height,Ar=Je(Pt);if(Ar>0||ss(Ar,0)&&ss(Yt,Ue))Xt=Yt-Ar,Ie=Ar;else{const Ne=Qe(Pt);(Ne<0||ss(Ne,0)&&ss(Yt,Ue))&&(Xt=Yt+Ne,Ie=0-Ne,Xt>=0&&(Pt-=Ne))}Xt>=0?(Yt=Xt,M({height:Xt,overflowAmt:Ie})):M()}n&&g({x:it,y:_e}),R({x:Se,y:Pt}),P(Re),Me.current={width:Fe.width,height:Yt}},[n,p,x,v,F,U,w,b,s,o,a,ee,B,ge]);Ef(()=>{he&&(Gt(),Te.current&&d()),Te.current=he,Zr.current=Gt},[he,Gt,Xe]),Ef(()=>{E&&!k&&(Q.current.scrollTop=0)},[E,k]),Ef(()=>Er,[Er]),j.useEffect(()=>{let{menu:ie}=ge;if(!he||!ie)return;if(ie=ie.addEventListener?ie:window,!ge.anchors){ge.anchors=[];let it=wf(z&&z.current);for(;it&&it!==ie;)ge.anchors.push(it),it=wf(it)}let lt=se;if(ge.anchors.length&<==="initial"&&(lt="auto"),lt==="initial")return;const ve=()=>{lt==="auto"?Hm(()=>Gt(!0)):gn(J,{reason:xa.SCROLL})},de=ge.anchors.concat(se!=="initial"?ie:[]);return de.forEach(it=>it.addEventListener("scroll",ve)),()=>de.forEach(it=>it.removeEventListener("scroll",ve))},[z,ge,he,J,se,Gt]);const Le=!!E&&E.overflowAmt>0;j.useEffect(()=>{if(Le||!he||!h)return;const ie=()=>Hm(Gt),lt=h.current;return lt.addEventListener("scroll",ie),()=>lt.removeEventListener("scroll",ie)},[he,Le,h,Gt]),j.useEffect(()=>{if(typeof ResizeObserver!="function"||V==="initial")return;const ie=new ResizeObserver(([ve])=>{const{borderBoxSize:de,target:it}=ve;let _e,Se;if(de){const{inlineSize:Pt,blockSize:Re}=de[0]||de;_e=Pt,Se=Re}else{const Pt=it.getBoundingClientRect();_e=Pt.width,Se=Pt.height}_e===0||Se===0||ss(_e,Me.current.width,1)&&ss(Se,Me.current.height,1)||oa.flushSync(()=>{Zr.current(),d()})}),lt=Q.current;return ie.observe(lt,{box:"border-box"}),()=>ie.unobserve(lt)},[V]),j.useEffect(()=>{if(!he){fe(It.RESET),en||M();return}const{position:ie,alwaysUpdate:lt}=D||{},ve=()=>{ie===Uo.FIRST?fe(It.FIRST):ie===Uo.LAST?fe(It.LAST):ie>=-1&&fe(It.SET_INDEX,void 0,ie)};if(lt)ve();else if(m){const de=setTimeout(()=>{const it=Q.current;it&&!it.contains(document.activeElement)&&(ae.current.focus(),ve())},je?170:100);return()=>clearTimeout(de)}},[he,je,en,m,D,fe]);const Ge=j.useMemo(()=>({isParentOpen:he,submenuCtx:I,dispatch:fe,updateItems:Er}),[he,I,fe,Er]);let Lr,Pe;E&&(k?Pe=E.overflowAmt:Lr=E.height);const We=j.useMemo(()=>({reposSubmenu:N,submenuCtx:I,overflow:b,overflowAmt:Pe,parentMenuRef:Q,parentDir:S}),[N,I,b,Pe,S]),An=Lr>=0?{maxHeight:Lr,overflow:b}:void 0,Be=j.useMemo(()=>({state:A,dir:S}),[A,S]),Ke=j.useMemo(()=>({dir:S}),[S]),_n=yu({block:xf,element:W6,modifiers:Ke,className:i.className}),De=_.jsxs("ul",{role:"menu","aria-label":t,...q6(L),...r0({onPointerEnter:K==null?void 0:K.off,onPointerMove:qe,onPointerLeave:Ve,onKeyDown:He,onAnimationEnd:En},re),ref:_2(c,Q),className:yu({block:xf,modifiers:Be,className:e}),style:{...r,...An,margin:0,display:A==="closed"?"none":void 0,position:bf,left:$e.x,top:$e.y},children:[_.jsx("li",{tabIndex:-1,style:{position:bf,left:0,top:0,display:"block",outline:"none"},ref:ae,...Gm,...u}),n&&_.jsx("li",{...Gm,...i,className:_n,style:{display:"block",position:bf,left:f.x,top:f.y,...i.style},ref:Xr}),_.jsx(Vm.Provider,{value:We,children:_.jsx(Q6.Provider,{value:Ge,children:_.jsx(K6.Provider,{value:Ce,children:gn(G,Be)})})})]});return l?_.jsx(eS,{...l,isOpen:he,children:De}):De},cS=j.forwardRef(function({"aria-label":e,className:r,containerProps:n,initialMounted:i,unmountOnClose:s,transition:o,transitionTimeout:a,boundingBoxRef:l,boundingBoxPadding:u,reposition:c="auto",submenuOpenDelay:h=300,submenuCloseDelay:p=150,viewScroll:v="initial",portal:w,theming:b,onItemClick:k,...y},m){const A=j.useRef(null),T=j.useRef({}),{anchorRef:L,state:D,onClose:F}=y,U=j.useMemo(()=>({initialMounted:i,unmountOnClose:s,transition:o,transitionTimeout:a,boundingBoxRef:l,boundingBoxPadding:u,rootMenuRef:A,rootAnchorRef:L,scrollNodesRef:T,reposition:c,viewScroll:v,submenuOpenDelay:h,submenuCloseDelay:p}),[i,s,o,a,L,l,u,c,v,h,p]),G=j.useMemo(()=>({handleClick(re,$e){re.stopPropagation||gn(k,re);let R=re.keepOpen;R===void 0&&(R=$e&&re.key===Rn.SPACE),R||gn(F,{value:re.value,key:re.key,reason:xa.CLICK})},handleClose(re){gn(F,{key:re,reason:xa.CLICK})}}),[k,F]);if(!D)return null;const J=_.jsx(A2.Provider,{value:U,children:_.jsx(J6.Provider,{value:G,children:_.jsx(uS,{...y,ariaLabel:e||"Menu",externalRef:m,containerRef:A,containerProps:{className:r,containerRef:A,containerProps:n,theming:b,transition:o,onClose:F}})})});return w===!0&&typeof document<"u"?oa.createPortal(J,document.body):w?w.target?oa.createPortal(J,w.target):w.stablePosition?null:J:J}),Bh=0,Dh=1,wu=2,xu=3,bu=4,fS=5,S2=6,hS=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],k2=t=>({_s:t,status:hS[t],isEnter:tbu}),Fh=t=>t?S2:fS,dS=(t,e)=>{switch(t){case Dh:case Bh:return wu;case bu:case xu:return Fh(e)}},pS=t=>typeof t=="object"?[t.enter,t.exit]:[t,t],mS=(t,e)=>setTimeout(()=>{isNaN(document.body.offsetTop)||t(e+1)},0),Qm=(t,e,r,n,i)=>{clearTimeout(n.current);const s=k2(t);e(s),r.current=s,i&&i({current:s})},gS=({enter:t=!0,exit:e=!0,preEnter:r,preExit:n,timeout:i,initialEntered:s,mountOnEnter:o,unmountOnExit:a,onStateChange:l}={})=>{const[u,c]=j.useState(()=>k2(s?wu:Fh(o))),h=j.useRef(u),p=j.useRef(),[v,w]=pS(i),b=j.useCallback(()=>{const y=dS(h.current._s,a);y&&Qm(y,c,h,p,l)},[l,a]),k=j.useCallback(y=>{const m=T=>{switch(Qm(T,c,h,p,l),T){case Dh:v>=0&&(p.current=setTimeout(b,v));break;case bu:w>=0&&(p.current=setTimeout(b,w));break;case Bh:case xu:p.current=mS(m,T);break}},A=h.current.isEnter;typeof y!="boolean"&&(y=!A),y?!A&&m(t?r?Bh:Dh:wu):A&&m(e?n?xu:bu:Fh(a))},[b,l,t,e,r,n,v,w,a]);return j.useEffect(()=>()=>clearTimeout(p.current),[]),[u,k,b]},vS=({initialOpen:t,initialMounted:e,unmountOnClose:r,transition:n,transitionTimeout:i=500}={})=>{const[{status:s},o,a]=gS({initialEntered:t,mountOnEnter:!e,unmountOnExit:r,timeout:i,enter:wa(n,"open"),exit:wa(n,"close")});return[{state:Y6[s],endTransition:a},o]},yS=t=>{const[e,r]=vS(t),[n,i]=j.useState(),s=(o,a)=>{i({position:o,alwaysUpdate:a}),r(!0)};return[{menuItemFocus:n,...e},r,s]},wS=(t,e)=>{const[r]=j.useState({});return{onMouseDown:()=>{r.v=t&&t!=="closed"},onClick:n=>r.v?r.v=!1:e(!0,n)}},xS=(t,e)=>{const r=j.useRef(e);j.useEffect(()=>{r.current!==e&&gn(t,{open:e}),r.current=e},[t,e])},bS=j.forwardRef(function({"aria-label":e,captureFocus:r,initialOpen:n,menuButton:i,instanceRef:s,onMenuChange:o,...a},l){const[u,c,h]=yS(a),{state:p}=u,v=b2(p),w=j.useRef(null),b=wS(p,(L,D)=>h(D.detail?void 0:Uo.FIRST)),k=j.useCallback(L=>{c(!1),L.key&&w.current.focus()},[c]),y=L=>{switch(L.key){case Rn.UP:h(Uo.LAST);break;case Rn.DOWN:h(Uo.FIRST);break;default:return}L.preventDefault()},m=gn(i,{open:v});if(!m||!m.type)throw new Error("Menu requires a menuButton prop.");const A={ref:_2(m.ref,w),...r0({onKeyDown:y,...b},m.props)};z6(m.type)==="MenuButton"&&(A.isOpen=v);const T=j.cloneElement(m,A);return xS(o,v),j.useImperativeHandle(s,()=>({openMenu:h,closeMenu:()=>c(!1)})),_.jsxs(j.Fragment,{children:[T,_.jsx(cS,{...a,...u,"aria-label":e||(typeof m.props.children=="string"?m.props.children:"Menu"),anchorRef:w,ref:l,onClose:k})]})});function Jm({...t}){return _.jsx(bS,{...t,unmountOnClose:!0,className:ue("relative",t.className),direction:"left",menuButton:_.jsx(Z6,{className:"small",children:_.jsx(p6,{className:"-mb-1"})}),children:t.children})}function ES({app:t,className:e}){var a,l,u,c,h;const{uninstallApp:r,setMirroring:n,setAutoUpdate:i}=Pi(),s=Ma();return!t.state?t.metadata?_.jsx(Jm,{className:e,children:_.jsxs("div",{className:"flex flex-col backdrop-blur-lg bg-black/10 p-2 rounded-lg relative z-10",children:[((a=t.metadata)==null?void 0:a.description)&&_.jsx("button",{className:"my-1 whitespace-nowrap clear",onClick:()=>s(`/${vu}/${Ee(t)}`),children:"View Details"}),((l=t.metadata)==null?void 0:l.external_url)&&_.jsx("a",{target:"_blank",href:(u=t.metadata)==null?void 0:u.external_url,className:"mb-1 whitespace-nowrap button clear",children:"View Site"})]})}):_.jsx(_.Fragment,{}):_.jsx(Jm,{className:e,children:_.jsxs("div",{className:"flex flex-col p-2 rounded-lg backdrop-blur-lg relative z-10",children:[_.jsx("button",{className:"my-1 whitespace-nowrap clear",onClick:()=>s(`/${vu}/${Ee(t)}`),children:"View Details"}),t.installed&&_.jsxs(_.Fragment,{children:[_.jsx("button",{className:"mb-1 whitespace-nowrap clear",onClick:()=>r(t),children:"Uninstall"}),_.jsxs("button",{className:"mb-1 whitespace-nowrap clear",onClick:()=>{var p;return n(t,!((p=t.state)!=null&&p.mirroring))},children:[(c=t.state)!=null&&c.mirroring?"Stop":"Start"," Mirroring"]}),_.jsxs("button",{className:"mb-1 whitespace-nowrap clear",onClick:()=>{var p;return i(t,!((p=t.state)!=null&&p.auto_update))},children:[(h=t.state)!=null&&h.auto_update?"Disable":"Enable"," Auto Update"]})]})]})})}function Ns({app:t,size:e="medium",overrideImageSize:r,showMoreActions:n,...i}){const s=Kn(),o=Ma();return j.createElement("div",{...i,key:Ee(t),className:ue("flex justify-between rounded-lg hover:bg-white/10 card cursor-pointer",i.className,{"flex-wrap gap-2":s,"flex-col relative":e!=="large"}),onClick:()=>{n||o(`/${vu}/${Ee(t)}`)}},_.jsx(g2,{app:t,size:e,overrideImageSize:r}),_.jsxs("div",{className:ue("flex items-center",{absolute:e!=="large","top-2 right-2":e!=="large"&&n,"top-0 right-0":e!=="large"&&!n,"ml-auto":e==="large"&&s,"min-w-1/5":e==="large"}),children:[_.jsx(x2,{app:t,isIcon:!n&&e!=="large",className:ue({"bg-orange text-lg":e==="large","mr-2":n,"w-full":e==="large"})}),n&&_.jsx(ES,{app:t,className:"self-stretch"})]}))}function oc({value:t="",onChange:e=()=>null,onBack:r,hideSearch:n=!1,hidePublish:i=!1}){const s=Ma(),o=$u(),a=Wr.useRef(null),l=o.key!=="default",u=o.pathname===Lh,c=Kn();return _.jsxs("div",{className:ue("flex justify-between",{"gap-4":c,"gap-8":!c}),children:[o.pathname!=="/"?_.jsx("button",{className:"flex flex-col c icon icon-orange",onClick:()=>{r?r():s(l?-1:"/")},children:_.jsx(C6,{})}):c?_.jsx("button",{className:ue("icon icon-orange",{}),onClick:()=>window.location.href="/",children:_.jsx(h2,{})}):_.jsx(_.Fragment,{}),!i&&_.jsx("button",{className:"flex flex-col c icon icon-orange",onClick:()=>s(sc),children:_.jsx(L6,{})}),!n&&_.jsxs("div",{className:"flex flex-1 rounded-md relative",children:[_.jsx("input",{type:"text",ref:a,onChange:h=>e(h.target.value),value:t,placeholder:"Search for apps...",className:"w-full self-stretch grow"}),_.jsx("button",{className:ue("icon border-0 absolute top-1/2 -translate-y-1/2",{"right-2":c,"right-4":!c}),type:"button",onClick:()=>{var h;return(h=a.current)==null?void 0:h.focus()},children:_.jsx(O6,{})})]}),_.jsxs("button",{className:ue("flex c",{"gap-4":c,"gap-8 basis-1/5":!c}),onClick:()=>s(u?-1:Lh),children:[!c&&_.jsx("span",{children:"My Apps"}),_.jsx(y2,{})]})]})}const ac=()=>{const t=Kn();return _.jsx("button",{className:ue("clear absolute p-2",{"top-2 left-2":t,"top-8 left-8":!t}),onClick:()=>window.location.href="/",children:_.jsx(h2,{size:24})})};function AS(){const{listedApps:t,getListedApps:e,rebuildIndex:r}=Pi(),[n,i]=j.useState("Recently published"),[s,o]=j.useState(""),[a,l]=j.useState(t),[u,c]=j.useState(1),[h,p]=j.useState([]),v=j.useMemo(()=>Array.from({length:Math.ceil(a.length/10)},(m,A)=>A+1),[a]);j.useEffect(()=>{const m=(u-1)*10,A=m+10;l(t.slice(m,A))},[t,u]),j.useEffect(()=>{e().then(m=>{l(Object.values(m));let A=[];for(const T of Object.values(m))A=A.concat((T.metadata||{}).tags||[]);A.length===0&&(A=["App","Tags","Coming","Soon","tm"]),p(Array.from(new Set(A)))}).catch(m=>console.error(m))},[]);const w=j.useCallback(async m=>{},[]),b=j.useCallback(m=>{o(m);const A=t.filter(T=>{var L,D,F,U;return T.package.toLowerCase().includes(m.toLowerCase())||((D=(L=T.metadata)==null?void 0:L.description)==null?void 0:D.toLowerCase().includes(m.toLowerCase()))||((U=(F=T.metadata)==null?void 0:F.description)==null?void 0:U.toLowerCase().includes(m.toLowerCase()))},[t]);l(A)},[t]),k=j.useCallback(async()=>{try{await r(),alert("Index rebuilt successfully."),await e()}catch(m){console.error(m)}},[r]),y=Kn();return _.jsxs("div",{className:ue("flex flex-col w-full max-h-screen p-2",{"gap-4 max-w-screen":y,"gap-6 max-w-[900px]":!y}),children:[!y&&_.jsx(ac,{}),_.jsx(oc,{value:s,onChange:b}),_.jsxs("div",{className:ue("flex items-center self-stretch justify-between",{"gap-4 flex-wrap":y,"gap-8 grow":!y}),children:[_.jsx("button",{className:"flex flex-col c icon icon-orange",onClick:k,title:"Rebuild index",children:_.jsx(P6,{})}),h.slice(0,y?3:6).map(m=>_.jsx("button",{className:"clear flex c rounded-full !bg-white/10 !hover:bg-white/25",onClick:()=>{console.log("clicked tag",m)},children:m},m)),_.jsxs("select",{value:n,onChange:m=>{i(m.target.value),w(m.target.value)},className:ue("hidden",{"basis-1/5":!y}),children:[_.jsx("option",{children:"Recently published"}),_.jsx("option",{children:"Most popular"}),_.jsx("option",{children:"Best rating"}),_.jsx("option",{children:"Recently updated"})]})]}),!s&&_.jsxs("div",{className:ue("flex flex-col",{"gap-4":!y,"grow overflow-y-auto gap-2 items-center px-2":y}),children:[_.jsx("h2",{children:"Featured Apps"}),_.jsx("div",{className:ue("flex gap-2",{"flex-col":y}),children:a.filter(m=>["kcal","command_center","memedeck","filter"].indexOf(m.package)!==-1).map(m=>{var A;return _.jsx(Ns,{size:"medium",app:m,className:ue("grow",{"w-1/4":!y,"w-full":y})},Ee(m)+(((A=m.state)==null?void 0:A.our_version)||""))})})]}),_.jsx("h2",{children:s?"Search Results":"All Apps"}),_.jsx("div",{className:ue("flex flex-col grow overflow-y-auto",{"gap-2":y,"gap-4":!y}),children:a.map(m=>{var A;return _.jsx(Ns,{size:"large",app:m,className:"self-stretch",overrideImageSize:"medium"},Ee(m)+(((A=m.state)==null?void 0:A.our_version)||""))})}),v.length>1&&_.jsxs("div",{className:"flex self-center",children:[u!==v[0]&&_.jsx("button",{className:"icon",onClick:()=>c(u-1),children:_.jsx(h6,{})}),v.map(m=>_.jsx("button",{className:ue("my-1 mx-2 clear",{"font-bold":m===u}),onClick:()=>c(m),children:m},`page-${m}`)),u!==v[v.length-1]&&_.jsx("button",{className:"icon",onClick:()=>c(u+1),children:_.jsx(d6,{})})]})]})}function _S(){const{myApps:t,getMyApps:e}=Pi(),r=Ma(),[n,i]=j.useState(""),[s,o]=j.useState(t);j.useEffect(()=>{e().then(o).catch(u=>console.error(u))},[]);const a=j.useCallback(u=>{i(u);const c=Object.keys(t).reduce((h,p)=>(h[p]=t[p].filter(v=>{var w,b,k,y;return v.package.toLowerCase().includes(u.toLowerCase())||((b=(w=v.metadata)==null?void 0:w.description)==null?void 0:b.toLowerCase().includes(u.toLowerCase()))||((y=(k=v.metadata)==null?void 0:k.description)==null?void 0:y.toLowerCase().includes(u.toLowerCase()))}),h),{downloaded:[],installed:[],local:[],system:[]});o(c)},[t]);j.useEffect(()=>{n?a(n):o(t)},[t]);const l=Kn();return console.log({myApps:t}),_.jsxs("div",{className:ue("flex flex-col w-full h-screen p-2",{"gap-4 max-w-screen":l,"gap-8 max-w-[900px]":!l}),children:[_.jsx(ac,{}),_.jsx(oc,{value:n,onChange:a}),_.jsxs("div",{className:"flex justify-between items-center mt-2",children:[_.jsx("h3",{children:"My Packages"}),_.jsxs("button",{onClick:()=>r(sc),children:[_.jsx(m6,{className:"mr-2"}),"Publish Package"]})]}),_.jsxs("div",{className:ue("flex flex-col card gap-2 mt-2",{"max-h-[80vh] overflow-y-scroll overflow-x-visible":!l}),style:{scrollbarWidth:"thin",scrollbarColor:"#FFF5D9 transparent"},children:[s.downloaded.length>0&&_.jsx("h4",{children:"Downloaded"}),(s.downloaded||[]).map(u=>_.jsx(Ns,{app:u,showMoreActions:!0},Ee(u))),s.installed.length>0&&_.jsx("h4",{children:"Installed"}),(s.installed||[]).map(u=>_.jsx(Ns,{app:u,showMoreActions:!0},Ee(u))),s.local.length>0&&_.jsx("h4",{children:"Local"}),(s.local||[]).map(u=>_.jsx(Ns,{app:u,showMoreActions:!0},Ee(u))),s.system.length>0&&_.jsx("h4",{children:"System"}),(s.system||[]).map(u=>_.jsx(Ns,{app:u,showMoreActions:!0},Ee(u)))]})]})}function SS(){var v,w,b,k,y,m,A,T,L,D;const{myApps:t,listedApps:e,getListedApp:r}=Pi(),n=Ma(),i=qb(),[s,o]=j.useState(void 0);j.useEffect(()=>{const F=t.local.find(U=>Ee(U)===i.id);if(F)return o(F);if(i.id){const U=e.find(G=>Ee(G)===i.id);U?o(U):r(i.id).then(G=>o(G)).catch(console.error)}},[i.id,t,e]);const a=j.useCallback(()=>{n(sc,{state:{app:s}})},[s,n]),l=j.useMemo(()=>{var F,U;return((U=(F=s==null?void 0:s.metadata)==null?void 0:F.properties)==null?void 0:U.current_version)||"Unknown"},[s]),u=Object.entries(((w=(v=s==null?void 0:s.metadata)==null?void 0:v.properties)==null?void 0:w.code_hashes)||{}),c=((b=s==null?void 0:s.state)==null?void 0:b.our_version)||(u[(u.length||1)-1]||["",""])[1],h=Kn(),p=[{top:_.jsx("div",{className:ue({"text-sm":h}),children:"Developer"}),middle:_.jsx(T6,{size:36}),bottom:_.jsx("div",{className:ue({"text-sm":h}),children:s==null?void 0:s.publisher})},{top:_.jsx("div",{className:ue({"text-sm":h}),children:"Version"}),middle:_.jsx("span",{className:"text-2xl",children:l}),bottom:_.jsxs("div",{className:ue({"text-xs":h}),children:[c.slice(0,5),"...",c.slice(-5)]})},{top:_.jsx("div",{className:ue({"text-sm":h}),children:"Mirrors"}),middle:_.jsx(R6,{size:36}),bottom:_.jsx("div",{className:ue({"text-sm":h}),children:((m=(y=(k=s==null?void 0:s.metadata)==null?void 0:k.properties)==null?void 0:y.mirrors)==null?void 0:m.length)||0})}];return _.jsxs("div",{className:ue("flex flex-col w-full p-2",{"gap-4 max-w-screen":h,"gap-8 max-w-[900px]":!h}),children:[!h&&_.jsx(ac,{}),_.jsx(oc,{value:"",onChange:()=>null,hideSearch:!0,hidePublish:!0}),_.jsx("div",{className:ue("flex-col-center card !rounded-3xl",{"p-12 gap-4 grow overflow-y-auto":h,"p-24 gap-8":!h}),children:s?_.jsxs(_.Fragment,{children:[_.jsx(g2,{app:s,size:h?"medium":"large"}),_.jsx("div",{className:"w-5/6 h-0 border border-orange"}),_.jsx("div",{className:ue("flex items-start text-xl",{"gap-4 flex-wrap":h,"gap-8":!h}),children:p.map((F,U)=>_.jsxs(_.Fragment,{children:[_.jsxs("div",{className:ue("flex-col-center gap-2 justify-between self-stretch",{"rounded-lg bg-white/10 p-1 min-w-1/4 grow":h,"opacity-50":!h}),children:[F.top,F.middle,F.bottom]},U),!h&&U!==p.length-1&&_.jsx("div",{className:"h-3/4 w-0 border border-orange self-center"})]}))}),Array.isArray((T=(A=s.metadata)==null?void 0:A.properties)==null?void 0:T.screenshots)&&((L=s.metadata)==null?void 0:L.properties.screenshots.length)>0&&_.jsx("div",{className:"flex flex-wrap overflow-x-auto max-w-full",children:s.metadata.properties.screenshots.map((F,U)=>_.jsx("img",{src:F,className:"mr-2 max-h-20 max-w-full rounded border border-black"},U+F))}),_.jsx("div",{className:ue("flex-center gap-2",{"flex-col":h}),children:_.jsx(x2,{app:s,className:ue("self-center bg-orange text-lg px-12"),permitMultiButton:!0})}),s.installed&&((D=s.state)==null?void 0:D.mirroring)&&_.jsx("button",{type:"button",onClick:a,children:"Publish"})]}):_.jsxs(_.Fragment,{children:[_.jsx("h4",{children:"App details not found for "}),_.jsx("h4",{children:i.id})]})})]})}var Uh=(t=>(t[t.SEPOLIA=11155111]="SEPOLIA",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.LOCAL=1337]="LOCAL",t))(Uh||{});const Ym="0xaa36a7",zo="0xa",kS={10:"0x52185B6a6017E6f079B994452F234f7C2533787B"},NS="4902",Xm={[Ym]:{chainId:Ym,chainName:"Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://rpc.sepolia.org"],blockExplorerUrls:["https://sepolia.etherscan.io"]},[zo]:{chainId:zo,chainName:"Optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://mainnet.optimism.io"],blockExplorerUrls:["https://optimistic.etherscan.io"]}},MS=t=>{switch(t){case"1":case"0x1":return"Ethereum";case"10":case"a":case"0xa":return"Optimism";case"42161":return"Arbitrum";case"11155111":case"aa36a7":case"0xaa36a7":return"Sepolia";default:return"Unknown"}},Af=async t=>{var r,n,i;let e=await((r=window.ethereum)==null?void 0:r.request({method:"net_version"}).catch(()=>"1"));if(e="0x"+(typeof e=="string"?e.replace(/^0x/,""):e.toString(16)),!Xm[t]){console.error(`Invalid chain ID: ${t}`);return}if(t!==e)try{await((n=window.ethereum)==null?void 0:n.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}))}catch(s){if(String(s).includes(NS))await((i=window.ethereum)==null?void 0:i.request({method:"wallet_addEthereumChain",params:[Xm[t]]}));else throw window.alert(`You must enable the ${MS(t)} network in your wallet.`),new Error(`User cancelled connection to ${t}`)}};var ba={},lc={};Object.defineProperty(lc,"__esModule",{value:!0});lc.Connector=void 0;class CS{constructor(e,r){this.actions=e,this.onError=r}resetState(){this.actions.resetState()}}lc.Connector=CS;var _f,Zm;function PS(){if(Zm)return _f;Zm=1;function t({mustBeMetaMask:e=!1,silent:r=!1,timeout:n=3e3}={}){s();let i=!1;return new Promise(o=>{window.ethereum?a():(window.addEventListener("ethereum#initialized",a,{once:!0}),setTimeout(()=>{a()},n));function a(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",a);const{ethereum:l}=window;l&&(!e||l.isMetaMask)?o(l):(!r&&console.error("@metamask/detect-provider:",e&&l?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum."),o(null))}});function s(){if(typeof e!="boolean")throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if(typeof r!="boolean")throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if(typeof n!="number")throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}}return _f=t,_f}var RS=ze&&ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IS=ze&&ze.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OS=ze&&ze.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RS(e,t,r);return IS(e,t),e},os=ze&&ze.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(ba,"__esModule",{value:!0});var N2=ba.MetaMask=ba.NoMetaMaskError=void 0;const TS=lc;class Ea extends Error{constructor(){super("MetaMask not installed"),this.name=Ea.name,Object.setPrototypeOf(this,Ea.prototype)}}ba.NoMetaMaskError=Ea;function fl(t){return Number.parseInt(t,16)}class jS extends TS.Connector{constructor({actions:e,options:r,onError:n}){super(e,n),this.options=r}isomorphicInitialize(){return os(this,void 0,void 0,function*(){if(!this.eagerConnection)return this.eagerConnection=Promise.resolve().then(()=>OS(PS())).then(e=>os(this,void 0,void 0,function*(){var r,n;const i=yield e.default(this.options);i&&(this.provider=i,!((r=this.provider.providers)===null||r===void 0)&&r.length&&(this.provider=(n=this.provider.providers.find(s=>s.isMetaMask))!==null&&n!==void 0?n:this.provider.providers[0]),this.provider.on("connect",({chainId:s})=>{this.actions.update({chainId:fl(s)})}),this.provider.on("disconnect",s=>{var o;if(s.code===1013){console.debug('MetaMask logged connection error 1013: "Try again later"');return}this.actions.resetState(),(o=this.onError)===null||o===void 0||o.call(this,s)}),this.provider.on("chainChanged",s=>{this.actions.update({chainId:fl(s)})}),this.provider.on("accountsChanged",s=>{s.length===0?this.actions.resetState():this.actions.update({accounts:s})}))}))})}connectEagerly(){return os(this,void 0,void 0,function*(){const e=this.actions.startActivation();try{if(yield this.isomorphicInitialize(),!this.provider)return e();const r=yield this.provider.request({method:"eth_accounts"});if(!r.length)throw new Error("No accounts returned");const n=yield this.provider.request({method:"eth_chainId"});this.actions.update({chainId:fl(n),accounts:r})}catch(r){console.debug("Could not connect eagerly",r),this.actions.resetState()}})}activate(e){var r,n;return os(this,void 0,void 0,function*(){let i;return!((n=(r=this.provider)===null||r===void 0?void 0:r.isConnected)===null||n===void 0)&&n.call(r)||(i=this.actions.startActivation()),this.isomorphicInitialize().then(()=>os(this,void 0,void 0,function*(){if(!this.provider)throw new Ea;const s=yield this.provider.request({method:"eth_requestAccounts"}),o=yield this.provider.request({method:"eth_chainId"}),a=fl(o),l=typeof e=="number"?e:e==null?void 0:e.chainId;if(!l||a===l)return this.actions.update({chainId:a,accounts:s});const u=`0x${l.toString(16)}`;return this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:u}]}).catch(c=>{var h,p;if((((p=(h=c.data)===null||h===void 0?void 0:h.originalError)===null||p===void 0?void 0:p.code)||c.code)===4902&&typeof e!="number"){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_addEthereumChain",params:[Object.assign(Object.assign({},e),{chainId:u})]})}throw c}).then(()=>this.activate(l))})).catch(s=>{throw i==null||i(),s})})}watchAsset({address:e,symbol:r,decimals:n,image:i}){return os(this,void 0,void 0,function*(){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:e,symbol:r,decimals:n,image:i}}}).then(s=>{if(!s)throw new Error("Rejected");return!0})})}}N2=ba.MetaMask=jS;const[M2,n0]=Hu.initializeConnector(t=>new N2({actions:t}));function eg(t){const e=t.split("."),r=new Uint8Array(t.length+e.length);let n=0;for(const i of e){const s=i.length;r[n]=s,n++;for(let o=0;oi.toString(16).padStart(2,"0")).join("")}`}const tg=/^\d+\.\d+\.\d+$/,LS=({app:t,packageName:e,publisherId:r,goBack:n})=>{var h,p,v,w,b,k,y,m;const[i,s]=j.useState({name:((h=t==null?void 0:t.metadata)==null?void 0:h.name)||"",description:((p=t==null?void 0:t.metadata)==null?void 0:p.description)||"",image:((v=t==null?void 0:t.metadata)==null?void 0:v.image)||"",external_url:((w=t==null?void 0:t.metadata)==null?void 0:w.external_url)||"",animation_url:((b=t==null?void 0:t.metadata)==null?void 0:b.animation_url)||"",package_name:e,current_version:"",publisher:r,mirrors:[r]}),[o,a]=j.useState(Object.entries(((y=(k=t==null?void 0:t.metadata)==null?void 0:k.properties)==null?void 0:y.code_hashes)||{}).concat([["",((m=t==null?void 0:t.state)==null?void 0:m.our_version)||""]])),l=(A,T)=>{s({...i,[A]:T})};j.useEffect(()=>{l("package_name",e)},[e]),j.useEffect(()=>{l("publisher",r)},[r]);const u=j.useCallback(()=>{const A=o.reduce((U,[G,J])=>(U[G]=J,U),{});if(tg.test(i.current_version))if(A[i.current_version]){if(!Object.keys(A).reduce((U,G)=>U&&tg.test(G),!0)){window.alert("Code hashes must be a JSON object with valid version keys");return}}else{window.alert(`Code hashes must include current version (${i.current_version})`);return}else{window.alert("Current version must be in the format x.y.z");return}const T=JSON.stringify({name:i.name,description:i.description,image:i.image,external_url:i.external_url,animation_url:i.animation_url,properties:{package_name:i.package_name,current_version:i.current_version,publisher:i.publisher,mirrors:i.mirrors,code_hashes:A}}),L=new Blob([T],{type:"application/json"}),D=URL.createObjectURL(L),F=document.createElement("a");F.href=D,F.download=i.package_name+"_"+i.publisher+"_metadata.json",F.click(),URL.revokeObjectURL(D)},[i,o]),c=()=>{s({name:"",description:"",image:"",external_url:"",animation_url:"",package_name:"",current_version:"",publisher:"",mirrors:[]}),a([])};return _.jsxs("form",{className:"flex flex-col card mt-2 gap-2",children:[_.jsx("h4",{children:"Fill out metadata"}),_.jsxs("div",{className:"flex flex-col w-3/4",children:[_.jsx("label",{className:"metadata-label",children:"Name"}),_.jsx("input",{type:"text",placeholder:"Name",value:i.name,onChange:A=>l("name",A.target.value)})]}),_.jsxs("div",{className:"flex flex-col w-3/4",children:[_.jsx("label",{className:"metadata-label",children:"Description"}),_.jsx("input",{type:"text",placeholder:"Description",value:i.description,onChange:A=>l("description",A.target.value)})]}),_.jsxs("div",{className:"flex flex-col w-3/4",children:[_.jsx("label",{className:"metadata-label",children:"Image URL"}),_.jsx("input",{type:"text",placeholder:"Image URL",value:i.image,onChange:A=>l("image",A.target.value)})]}),_.jsxs("div",{className:"flex flex-col w-3/4",children:[_.jsx("label",{className:"metadata-label",children:"External URL"}),_.jsx("input",{type:"text",placeholder:"External URL",value:i.external_url,onChange:A=>l("external_url",A.target.value)})]}),_.jsxs("div",{className:"flex flex-col w-3/4",children:[_.jsx("label",{className:"metadata-label",children:"Animation URL"}),_.jsx("input",{type:"text",placeholder:"Animation URL",value:i.animation_url,onChange:A=>l("animation_url",A.target.value)})]}),_.jsxs("div",{className:"flex flex-col w-3/4",children:[_.jsx("label",{className:"metadata-label",children:"Package Name"}),_.jsx("input",{type:"text",placeholder:"Package Name",value:i.package_name,onChange:A=>l("package_name",A.target.value)})]}),_.jsxs("div",{className:"flex flex-col w-3/4",children:[_.jsx("label",{className:"metadata-label",children:"Current Version"}),_.jsx("input",{type:"text",placeholder:"Current Version",value:i.current_version,onChange:A=>l("current_version",A.target.value)})]}),_.jsxs("div",{className:"flex flex-col w-3/4",children:[_.jsx("label",{className:"metadata-label",children:"Publisher"}),_.jsx("input",{type:"text",placeholder:"Publisher",value:i.publisher,onChange:A=>l("publisher",A.target.value)})]}),_.jsxs("div",{className:"flex flex-col w-3/4",children:[_.jsx("label",{className:"metadata-label",children:"Mirrors (separated by commas)"}),_.jsx("input",{type:"text",placeholder:"Mirrors (separated by commas)",value:i.mirrors.join(","),onChange:A=>l("mirrors",A.target.value.split(",").map(T=>T.trim()))})]}),_.jsxs("div",{className:"flex flex-col w-3/4 gap-2",children:[_.jsxs("div",{className:"flex gap-2 mt-0 justify-between w-full",children:[_.jsx("h5",{className:"m-0",children:"Code Hashes"}),_.jsx("button",{type:"button",onClick:()=>a([...o,["",""]]),className:"clear",children:"Add code hash"})]}),o.map(([A,T],L,D)=>_.jsxs("div",{className:"flex gap-2 mt-0 w-full",children:[_.jsx("input",{type:"text",placeholder:"Version",value:A,onChange:F=>a(U=>{const G=[...U];return G[L][0]=F.target.value,G}),className:"flex-1"}),_.jsx("input",{type:"text",placeholder:"Hash",value:T,onChange:F=>a(U=>{const G=[...U];return G[L][1]=F.target.value,G}),className:"flex-5"}),D.length>1&&_.jsx("button",{type:"button",onClick:()=>a(F=>F.filter((U,G)=>G!==L)),className:"icon",children:_.jsx(w2,{})})]},L+"_code_hash"))]}),_.jsxs("div",{className:"flex gap-2 my-4",children:[_.jsx("button",{type:"button",onClick:u,className:"alt",children:"Download JSON"}),_.jsx("button",{type:"button",onClick:c,className:"clear",children:"Clear Form"}),_.jsx("button",{type:"button",onClick:n,children:"Done"})]})]})};function BS({readOnly:t=!1,checked:e,setChecked:r}){return _.jsxs("div",{className:"relative",children:[_.jsx("input",{type:"checkbox",id:"checked",name:"checked",checked:e,onChange:n=>r&&r(n.target.checked),autoFocus:!0,readOnly:t}),e&&_.jsx(v2,{className:"absolute left-1 top-1 cursor-pointer",onClick:()=>r&&r(!1)})]})}var Qn=function(t){t==null&&(t=new Date().getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,t.constructor==Array?this.init_by_array(t,t.length):this.init_seed(t)};Qn.prototype.init_seed=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti>>30;this.mt[this.mti]=(((t&4294901760)>>>16)*1812433253<<16)+(t&65535)*1812433253+this.mti,this.mt[this.mti]>>>=0}};Qn.prototype.init_by_array=function(t,e){var r,n,i;for(this.init_seed(19650218),r=1,n=0,i=this.N>e?this.N:e;i;i--){var s=this.mt[r-1]^this.mt[r-1]>>>30;this.mt[r]=(this.mt[r]^(((s&4294901760)>>>16)*1664525<<16)+(s&65535)*1664525)+t[n]+n,this.mt[r]>>>=0,r++,n++,r>=this.N&&(this.mt[0]=this.mt[this.N-1],r=1),n>=e&&(n=0)}for(i=this.N-1;i;i--){var s=this.mt[r-1]^this.mt[r-1]>>>30;this.mt[r]=(this.mt[r]^(((s&4294901760)>>>16)*1566083941<<16)+(s&65535)*1566083941)-r,this.mt[r]>>>=0,r++,r>=this.N&&(this.mt[0]=this.mt[this.N-1],r=1)}this.mt[0]=2147483648};Qn.prototype.random_int=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_seed(5489),r=0;r>>1^e[t&1];for(;r>>1^e[t&1];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[t&1],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,t^=t>>>18,t>>>0};Qn.prototype.random_int31=function(){return this.random_int()>>>1};Qn.prototype.random_incl=function(){return this.random_int()*(1/4294967295)};Qn.prototype.random=function(){return this.random_int()*(1/4294967296)};Qn.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)};Qn.prototype.random_long=function(){var t=this.random_int()>>>5,e=this.random_int()>>>6;return(t*67108864+e)*(1/9007199254740992)};var DS=Qn;function FS(t,e){var r=document.createElement("div");return r.style.borderRadius="50px",r.style.overflow="hidden",r.style.padding="0px",r.style.margin="0px",r.style.width=""+t+"px",r.style.height=""+t+"px",r.style.display="inline-block",r.style.background=e,{container:r}}var US=FS,C2={exports:{}};(function(t){var e=function(){function r(l,u,c,h){typeof u=="object"&&(c=u.depth,h=u.prototype,u.filter,u=u.circular);var p=[],v=[],w=typeof Buffer<"u";typeof u>"u"&&(u=!0),typeof c>"u"&&(c=1/0);function b(k,y){if(k===null)return null;if(y==0)return k;var m,A;if(typeof k!="object")return k;if(r.__isArray(k))m=[];else if(r.__isRegExp(k))m=new RegExp(k.source,a(k)),k.lastIndex&&(m.lastIndex=k.lastIndex);else if(r.__isDate(k))m=new Date(k.getTime());else{if(w&&Buffer.isBuffer(k))return Buffer.allocUnsafe?m=Buffer.allocUnsafe(k.length):m=new Buffer(k.length),k.copy(m),m;typeof h>"u"?(A=Object.getPrototypeOf(k),m=Object.create(A)):(m=Object.create(h),A=h)}if(u){var T=p.indexOf(k);if(T!=-1)return v[T];p.push(k),v.push(m)}for(var L in k){var D;A&&(D=Object.getOwnPropertyDescriptor(A,L)),!(D&&D.set==null)&&(m[L]=b(k[L],y-1))}return m}return b(l,c)}r.clonePrototype=function(u){if(u===null)return null;var c=function(){};return c.prototype=u,new c};function n(l){return Object.prototype.toString.call(l)}r.__objToStr=n;function i(l){return typeof l=="object"&&n(l)==="[object Date]"}r.__isDate=i;function s(l){return typeof l=="object"&&n(l)==="[object Array]"}r.__isArray=s;function o(l){return typeof l=="object"&&n(l)==="[object RegExp]"}r.__isRegExp=o;function a(l){var u="";return l.global&&(u+="g"),l.ignoreCase&&(u+="i"),l.multiline&&(u+="m"),u}return r.__getRegExpFlags=a,r}();t.exports&&(t.exports=e)})(C2);var zS=C2.exports,P2={exports:{}},$S={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},zi=$S,R2={};for(var Sf in zi)zi.hasOwnProperty(Sf)&&(R2[zi[Sf]]=Sf);var te=P2.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var tr in te)if(te.hasOwnProperty(tr)){if(!("channels"in te[tr]))throw new Error("missing channels property: "+tr);if(!("labels"in te[tr]))throw new Error("missing channel labels property: "+tr);if(te[tr].labels.length!==te[tr].channels)throw new Error("channel and label counts mismatch: "+tr);var HS=te[tr].channels,qS=te[tr].labels;delete te[tr].channels,delete te[tr].labels,Object.defineProperty(te[tr],"channels",{value:HS}),Object.defineProperty(te[tr],"labels",{value:qS})}te.rgb.hsl=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(e,r,n),s=Math.max(e,r,n),o=s-i,a,l,u;return s===i?a=0:e===s?a=(r-n)/o:r===s?a=2+(n-e)/o:n===s&&(a=4+(e-r)/o),a=Math.min(a*60,360),a<0&&(a+=360),u=(i+s)/2,s===i?l=0:u<=.5?l=o/(s+i):l=o/(2-s-i),[a,l*100,u*100]};te.rgb.hsv=function(t){var e,r,n,i,s,o=t[0]/255,a=t[1]/255,l=t[2]/255,u=Math.max(o,a,l),c=u-Math.min(o,a,l),h=function(p){return(u-p)/6/c+1/2};return c===0?i=s=0:(s=c/u,e=h(o),r=h(a),n=h(l),o===u?i=n-r:a===u?i=1/3+e-n:l===u&&(i=2/3+r-e),i<0?i+=1:i>1&&(i-=1)),[i*360,s*100,u*100]};te.rgb.hwb=function(t){var e=t[0],r=t[1],n=t[2],i=te.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[i,s*100,n*100]};te.rgb.cmyk=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,i,s,o,a;return a=Math.min(1-e,1-r,1-n),i=(1-e-a)/(1-a)||0,s=(1-r-a)/(1-a)||0,o=(1-n-a)/(1-a)||0,[i*100,s*100,o*100,a*100]};function VS(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2)}te.rgb.keyword=function(t){var e=R2[t];if(e)return e;var r=1/0,n;for(var i in zi)if(zi.hasOwnProperty(i)){var s=zi[i],o=VS(t,s);o.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var i=e*.4124+r*.3576+n*.1805,s=e*.2126+r*.7152+n*.0722,o=e*.0193+r*.1192+n*.9505;return[i*100,s*100,o*100]};te.rgb.lab=function(t){var e=te.rgb.xyz(t),r=e[0],n=e[1],i=e[2],s,o,a;return r/=95.047,n/=100,i/=108.883,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=i>.008856?Math.pow(i,1/3):7.787*i+16/116,s=116*n-16,o=500*(r-n),a=200*(n-i),[s,o,a]};te.hsl.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100,i,s,o,a,l;if(r===0)return l=n*255,[l,l,l];n<.5?s=n*(1+r):s=n+r-n*r,i=2*n-s,a=[0,0,0];for(var u=0;u<3;u++)o=e+1/3*-(u-1),o<0&&o++,o>1&&o--,6*o<1?l=i+(s-i)*6*o:2*o<1?l=s:3*o<2?l=i+(s-i)*(2/3-o)*6:l=i,a[u]=l*255;return a};te.hsl.hsv=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,i=r,s=Math.max(n,.01),o,a;return n*=2,r*=n<=1?n:2-n,i*=s<=1?s:2-s,a=(n+r)/2,o=n===0?2*i/(s+i):2*r/(n+r),[e,o*100,a*100]};te.hsv.rgb=function(t){var e=t[0]/60,r=t[1]/100,n=t[2]/100,i=Math.floor(e)%6,s=e-Math.floor(e),o=255*n*(1-r),a=255*n*(1-r*s),l=255*n*(1-r*(1-s));switch(n*=255,i){case 0:return[n,l,o];case 1:return[a,n,o];case 2:return[o,n,l];case 3:return[o,a,n];case 4:return[l,o,n];case 5:return[n,o,a]}};te.hsv.hsl=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,i=Math.max(n,.01),s,o,a;return a=(2-r)*n,s=(2-r)*i,o=r*i,o/=s<=1?s:2-s,o=o||0,a/=2,[e,o*100,a*100]};te.hwb.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100,i=r+n,s,o,a,l;i>1&&(r/=i,n/=i),s=Math.floor(6*e),o=1-n,a=6*e-s,s&1&&(a=1-a),l=r+a*(o-r);var u,c,h;switch(s){default:case 6:case 0:u=o,c=l,h=r;break;case 1:u=l,c=o,h=r;break;case 2:u=r,c=o,h=l;break;case 3:u=r,c=l,h=o;break;case 4:u=l,c=r,h=o;break;case 5:u=o,c=r,h=l;break}return[u*255,c*255,h*255]};te.cmyk.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,i=t[3]/100,s,o,a;return s=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,r*(1-i)+i),a=1-Math.min(1,n*(1-i)+i),[s*255,o*255,a*255]};te.xyz.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,i,s,o;return i=e*3.2406+r*-1.5372+n*-.4986,s=e*-.9689+r*1.8758+n*.0415,o=e*.0557+r*-.204+n*1.057,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*12.92,s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s*12.92,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),[i*255,s*255,o*255]};te.xyz.lab=function(t){var e=t[0],r=t[1],n=t[2],i,s,o;return e/=95.047,r/=100,n/=108.883,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=116*r-16,s=500*(e-r),o=200*(r-n),[i,s,o]};te.lab.xyz=function(t){var e=t[0],r=t[1],n=t[2],i,s,o;s=(e+16)/116,i=r/500+s,o=s-n/200;var a=Math.pow(s,3),l=Math.pow(i,3),u=Math.pow(o,3);return s=a>.008856?a:(s-16/116)/7.787,i=l>.008856?l:(i-16/116)/7.787,o=u>.008856?u:(o-16/116)/7.787,i*=95.047,s*=100,o*=108.883,[i,s,o]};te.lab.lch=function(t){var e=t[0],r=t[1],n=t[2],i,s,o;return i=Math.atan2(n,r),s=i*360/2/Math.PI,s<0&&(s+=360),o=Math.sqrt(r*r+n*n),[e,o,s]};te.lch.lab=function(t){var e=t[0],r=t[1],n=t[2],i,s,o;return o=n/360*2*Math.PI,i=r*Math.cos(o),s=r*Math.sin(o),[e,i,s]};te.rgb.ansi16=function(t){var e=t[0],r=t[1],n=t[2],i=1 in arguments?arguments[1]:te.rgb.hsv(t)[2];if(i=Math.round(i/50),i===0)return 30;var s=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(e/255));return i===2&&(s+=60),s};te.hsv.ansi16=function(t){return te.rgb.ansi16(te.hsv.rgb(t),t[2])};te.rgb.ansi256=function(t){var e=t[0],r=t[1],n=t[2];if(e===r&&r===n)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;var i=16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5);return i};te.ansi16.rgb=function(t){var e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];var r=(~~(t>50)+1)*.5,n=(e&1)*r*255,i=(e>>1&1)*r*255,s=(e>>2&1)*r*255;return[n,i,s]};te.ansi256.rgb=function(t){if(t>=232){var e=(t-232)*10+8;return[e,e,e]}t-=16;var r,n=Math.floor(t/36)/5*255,i=Math.floor((r=t%36)/6)/5*255,s=r%6/5*255;return[n,i,s]};te.rgb.hex=function(t){var e=((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255),r=e.toString(16).toUpperCase();return"000000".substring(r.length)+r};te.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var r=e[0];e[0].length===3&&(r=r.split("").map(function(a){return a+a}).join(""));var n=parseInt(r,16),i=n>>16&255,s=n>>8&255,o=n&255;return[i,s,o]};te.rgb.hcg=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.max(Math.max(e,r),n),s=Math.min(Math.min(e,r),n),o=i-s,a,l;return o<1?a=s/(1-o):a=0,o<=0?l=0:i===e?l=(r-n)/o%6:i===r?l=2+(n-e)/o:l=4+(e-r)/o+4,l/=6,l%=1,[l*360,o*100,a*100]};te.hsl.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=1,i=0;return r<.5?n=2*e*r:n=2*e*(1-r),n<1&&(i=(r-.5*n)/(1-n)),[t[0],n*100,i*100]};te.hsv.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=e*r,i=0;return n<1&&(i=(r-n)/(1-n)),[t[0],n*100,i*100]};te.hcg.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];var i=[0,0,0],s=e%1*6,o=s%1,a=1-o,l=0;switch(Math.floor(s)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return l=(1-r)*n,[(r*i[0]+l)*255,(r*i[1]+l)*255,(r*i[2]+l)*255]};te.hcg.hsv=function(t){var e=t[1]/100,r=t[2]/100,n=e+r*(1-e),i=0;return n>0&&(i=e/n),[t[0],i*100,n*100]};te.hcg.hsl=function(t){var e=t[1]/100,r=t[2]/100,n=r*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],i*100,n*100]};te.hcg.hwb=function(t){var e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};te.hwb.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=1-r,i=n-e,s=0;return i<1&&(s=(n-i)/(1-i)),[t[0],i*100,s*100]};te.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};te.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};te.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};te.gray.hsl=te.gray.hsv=function(t){return[0,0,t[0]]};te.gray.hwb=function(t){return[0,100,t[0]]};te.gray.cmyk=function(t){return[0,0,0,t[0]]};te.gray.lab=function(t){return[t[0],0,0]};te.gray.hex=function(t){var e=Math.round(t[0]/100*255)&255,r=(e<<16)+(e<<8)+e,n=r.toString(16).toUpperCase();return"000000".substring(n.length)+n};te.rgb.gray=function(t){var e=(t[0]+t[1]+t[2])/3;return[e/255*100]};var I2=P2.exports,Eu=I2;function GS(){for(var t={},e=Object.keys(Eu),r=e.length,n=0;n1&&(r=Array.prototype.slice.call(arguments)),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function ek(t){var e=function(r){if(r==null)return r;arguments.length>1&&(r=Array.prototype.slice.call(arguments));var n=t(r);if(typeof n=="object")for(var i=n.length,s=0;sr?(e+.05)/(r+.05):(r+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb,e=(t[0]*299+t[1]*587+t[2]*114)/1e3;return e<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){return this.values.hsl[2]+=this.values.hsl[2]*t,this.setValues("hsl",this.values.hsl),this},darken:function(t){return this.values.hsl[2]-=this.values.hsl[2]*t,this.setValues("hsl",this.values.hsl),this},saturate:function(t){return this.values.hsl[1]+=this.values.hsl[1]*t,this.setValues("hsl",this.values.hsl),this},desaturate:function(t){return this.values.hsl[1]-=this.values.hsl[1]*t,this.setValues("hsl",this.values.hsl),this},whiten:function(t){return this.values.hwb[1]+=this.values.hwb[1]*t,this.setValues("hwb",this.values.hwb),this},blacken:function(t){return this.values.hwb[2]+=this.values.hwb[2]*t,this.setValues("hwb",this.values.hwb),this},greyscale:function(){var t=this.values.rgb,e=t[0]*.3+t[1]*.59+t[2]*.11;return this.setValues("rgb",[e,e,e]),this},clearer:function(t){return this.setValues("alpha",this.values.alpha-this.values.alpha*t),this},opaquer:function(t){return this.setValues("alpha",this.values.alpha+this.values.alpha*t),this},rotate:function(t){var e=this.values.hsl[0];return e=(e+t)%360,e=e<0?360+e:e,this.values.hsl[0]=e,this.setValues("hsl",this.values.hsl),this},mix:function(t,e){var r=this,n=t,i=e===void 0?.5:e,s=2*i-1,o=r.alpha()-n.alpha(),a=((s*o===-1?s:(s+o)/(1+s*o))+1)/2,l=1-a;return this.rgb(a*r.red()+l*n.red(),a*r.green()+l*n.green(),a*r.blue()+l*n.blue()).alpha(r.alpha()*i+n.alpha()*(1-i))},toJSON:function(){return this.rgb()},clone:function(){var t=new vn;return t.values=dk(this.values),t}};vn.prototype.getValues=function(t){for(var e={},r=0;r{const n=j.useRef(null);return j.useEffect(()=>{if(t&&n.current){const i=parseInt(t.slice(2,10),16),s=kk(e,i);n.current.innerHTML="",n.current.appendChild(s)}},[t,e]),_.jsx("div",{...r,ref:n})},{useIsActivating:Nk}=n0;function Mk({provider:t,packageAbi:e}){var g;const{state:r}=$u(),{listedApps:n}=Pi(),{account:i,isActive:s}=Hu.useWeb3React(),o=Nk(),[a,l]=j.useState(""),[u,c]=j.useState(),[h,p]=j.useState(!1),[v,w]=j.useState(""),[b,k]=j.useState(((g=window.our)==null?void 0:g.node)||""),[y,m]=j.useState(""),[A,T]=j.useState(""),[L,D]=j.useState(!1),[F,U]=j.useState([]);j.useEffect(()=>{const E=r==null?void 0:r.app;E&&(w(E.package),k(E.publisher),D(!0))},[r]),j.useEffect(()=>{U(n.filter(E=>{var M;return((M=E.owner)==null?void 0:M.toLowerCase())===(i==null?void 0:i.toLowerCase())}))},[n,i]);const G=j.useCallback(async()=>{await M2.activate().catch(()=>{});try{Af(zo)}catch(E){console.error(E)}},[]),J=j.useCallback(async()=>{if(!y){T("");return}try{const M=await(await fetch(y)).text();JSON.parse(M);const S=ot(yr(M));T(S)}catch{window.alert("Error calculating metadata hash. Please ensure the URL is valid and the metadata is in JSON format.")}},[y]),re=j.useCallback(async E=>{var S;E.preventDefault(),E.stopPropagation();let M=A;try{if(!M){const N=await fetch(y);await N.json();const d=await N.text();M=ot(yr(d))}l("Please confirm the transaction in your wallet");const P=eg(b);await Af(zo);const I=await(L?e==null?void 0:e.updateMetadata(W.from(i6(["string","bytes"],[v,P])),y,M):e==null?void 0:e.registerApp(v,P,y,M));await new Promise(N=>setTimeout(N,2e3)),l("Publishing package..."),await(I==null?void 0:I.wait()),c({packageName:v,publisherId:b}),w(""),k(((S=window.our)==null?void 0:S.node)||b),m(""),T(""),D(!1)}catch(P){console.error(P),window.alert("Error publishing package. Please ensure the package name and publisher ID are valid, and the metadata is in JSON format.")}finally{l("")}},[v,L,b,y,A,e,c,w,k,m,T,D]),$e=j.useCallback(async(E,M)=>{try{await Af(zo);const S=await(e==null?void 0:e.unlistPacakge(ot(l2(["string","bytes"],[E,eg(M)]))));await new Promise(P=>setTimeout(P,2e3)),l("Unlisting package..."),await(S==null?void 0:S.wait())}catch(S){console.error(S),window.alert("Error unlisting package")}finally{l("")}},[e,l]),R=j.useCallback(async()=>{L||v&&b&&n.find(E=>E.package===v&&E.publisher===b)&&D(!0)},[n,v,b,L,D]),f=Kn();return _.jsxs("div",{className:ue("w-full flex flex-col gap-2",{"max-w-[900px]":!f,"p-2 h-screen w-screen":f}),children:[!f&&_.jsx(ac,{}),_.jsx(oc,{hideSearch:!0,hidePublish:!0,onBack:h?()=>p(!1):void 0}),_.jsxs("div",{className:"flex-center justify-between",children:[_.jsx("h4",{children:"Publish Package"}),!!i&&_.jsxs("div",{className:"card flex-center",children:[_.jsx("span",{children:"Publishing as:"}),_.jsx(ig,{address:i,className:"mx-2"}),_.jsxs("span",{className:"font-mono",children:[i==null?void 0:i.slice(0,4),"...",i==null?void 0:i.slice(-4)]})]})]}),a?_.jsx("div",{className:"flex-col-center",children:_.jsx(ya,{msg:a})}):u?_.jsxs("div",{className:"flex-col-center gap-2",children:[_.jsx("h4",{children:"Package Published!"}),_.jsxs("div",{children:[_.jsx("strong",{children:"Package Name:"})," ",u.packageName]}),_.jsxs("div",{children:[_.jsx("strong",{children:"Publisher ID:"})," ",u.publisherId]}),_.jsx("button",{className:"flex ml-2",onClick:()=>c(void 0),children:"Publish Another Package"})]}):h?_.jsx(LS,{packageName:v,publisherId:b,app:r==null?void 0:r.app,goBack:()=>p(!1)}):!i||!s?_.jsxs(_.Fragment,{children:[_.jsxs("h4",{children:["Please connect your wallet ",f&&_.jsx("br",{})," to publish a package"]}),_.jsx("button",{className:"connect-wallet row",onClick:G,children:"Connect Wallet"})]}):o?_.jsx(ya,{msg:"Approve connection in your wallet"}):_.jsxs("form",{className:"flex flex-col flex-1 overflow-y-auto gap-2",onSubmit:re,children:[_.jsxs("div",{className:"flex cursor-pointer p-2 -mb-2",onClick:()=>D(!L),children:[_.jsx(BS,{checked:L,readOnly:!0}),_.jsx("label",{htmlFor:"update",className:"cursor-pointer ml-4",children:"Update existing package"})]}),_.jsxs("div",{className:"flex flex-col",children:[_.jsx("label",{htmlFor:"package-name",children:"Package Name"}),_.jsx("input",{id:"package-name",type:"text",required:!0,placeholder:"my-package",value:v,onChange:E=>w(E.target.value),onBlur:R})]}),_.jsxs("div",{className:"flex flex-col",children:[_.jsx("label",{htmlFor:"publisher-id",children:"Publisher ID"}),_.jsx("input",{id:"publisher-id",type:"text",required:!0,value:b,onChange:E=>k(E.target.value),onBlur:R})]}),_.jsxs("div",{className:"flex flex-col gap-2",children:[_.jsx("label",{htmlFor:"metadata-url",children:"Metadata URL"}),_.jsx("input",{id:"metadata-url",type:"text",required:!0,value:y,onChange:E=>m(E.target.value),onBlur:J,placeholder:"https://github/my-org/my-repo/metadata.json"}),_.jsxs("div",{children:["Metadata is a JSON file that describes your package.",_.jsx("br",{})," You can"," ",_.jsx("a",{onClick:()=>p(!0),className:"underline cursor-pointer",children:"fill out a template here"}),"."]})]}),_.jsxs("div",{className:"flex flex-col",children:[_.jsx("label",{htmlFor:"metadata-hash",children:"Metadata Hash"}),_.jsx("input",{readOnly:!0,id:"metadata-hash",type:"text",value:A,onChange:E=>T(E.target.value),placeholder:"Calculated automatically from metadata URL"})]}),_.jsx("button",{type:"submit",children:"Publish"})]}),_.jsxs("div",{className:"flex flex-col",children:[_.jsx("h4",{children:"Packages You Own"}),F.length>0?_.jsx("div",{className:"flex flex-col",children:F.map(E=>_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsxs("div",{className:"flex items-center",children:[_.jsx(ig,{address:E.publisher,className:"mr-2"}),_.jsx("span",{children:E.package})]}),_.jsx("button",{className:"flex items-center",onClick:()=>$e(E.package,E.publisher),children:_.jsx("span",{children:"Unpublish"})})]},`${E.package}${E.publisher}`))}):_.jsx("div",{className:"flex items-center",children:_.jsx("span",{children:"No packages published"})})]})]})}var Ck={BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Pk=[[M2,n0]],{useProvider:Rk}=n0,$o="/main:app_store:sys";window.our&&(window.our.process=$o==null?void 0:$o.replace("/",""));const Ik=`${Ck.VITE_NODE_URL||"http://localhost:8080"}${$o}`;function Ok(){const t=Rk(),[e,r]=j.useState(!0),[n,i]=j.useState(void 0);if(j.useEffect(()=>{if(!t)return;(async()=>{(await t.getNetwork()).chainId===Uh.OPTIMISM&&i(u2.connect(kS[Uh.OPTIMISM],t.getSigner()))})()},[t]),j.useEffect(()=>{},[]),!e)return _.jsxs("div",{className:"flex flex-col c",children:[_.jsx("h2",{style:{color:"red"},children:"Node not connected"}),_.jsxs("h4",{children:["You need to start a node at ",Ik," before you can use this UI in development."]})]});const s={provider:t,packageAbi:n};return _.jsx("div",{className:"flex flex-col c h-screen w-screen max-h-screen max-w-screen overflow-x-hidden special-appstore-background",children:_.jsx(Hu.Web3ReactProvider,{connectors:Pk,children:_.jsx(a3,{basename:$o,children:_.jsxs(s3,{children:[_.jsx(ko,{path:U6,element:_.jsx(AS,{})}),_.jsx(ko,{path:Lh,element:_.jsx(_S,{})}),_.jsx(ko,{path:`${vu}/:id`,element:_.jsx(SS,{})}),_.jsx(ko,{path:sc,element:_.jsx(Mk,{...s})})]})})})})}Nf.createRoot(document.getElementById("root")).render(_.jsx(Wr.StrictMode,{children:_.jsx(Ok,{})})); diff --git a/kinode/packages/app_store/pkg/ui/index.html b/kinode/packages/app_store/pkg/ui/index.html index 960a5cf4..7a4c0a9b 100644 --- a/kinode/packages/app_store/pkg/ui/index.html +++ b/kinode/packages/app_store/pkg/ui/index.html @@ -14,7 +14,7 @@ - + diff --git a/kinode/packages/app_store/ui/src/components/ActionButton.tsx b/kinode/packages/app_store/ui/src/components/ActionButton.tsx index 882380e9..a0e7ff22 100644 --- a/kinode/packages/app_store/ui/src/components/ActionButton.tsx +++ b/kinode/packages/app_store/ui/src/components/ActionButton.tsx @@ -10,9 +10,10 @@ import classNames from "classnames"; interface ActionButtonProps extends React.HTMLAttributes { app: AppInfo; isIcon?: boolean; + permitMultiButton?: boolean; } -export default function ActionButton({ app, isIcon = false, ...props }: ActionButtonProps) { +export default function ActionButton({ app, isIcon = false, permitMultiButton = false, ...props }: ActionButtonProps) { const { installed, downloaded, updatable } = useMemo(() => { const versions = Object.entries(app?.metadata?.properties?.code_hashes || {}); const latestHash = (versions.find(([v]) => v === app.metadata?.properties?.current_version) || [])[1]; @@ -48,6 +49,8 @@ export default function ActionButton({ app, isIcon = false, ...props }: ActionBu return ( <> + {/* if it's got a UI and it's updatable, show both buttons if we have space (launch will otherwise push out update) */} + {permitMultiButton && installed && updatable && launchPath && } {(installed && launchPath) ? : (installed && updatable) diff --git a/kinode/packages/app_store/ui/src/pages/AppPage.tsx b/kinode/packages/app_store/ui/src/pages/AppPage.tsx index 874d5808..93919f27 100644 --- a/kinode/packages/app_store/ui/src/pages/AppPage.tsx +++ b/kinode/packages/app_store/ui/src/pages/AppPage.tsx @@ -140,7 +140,11 @@ export default function AppPage() { ) )} } - +
+ +
{app.installed && app.state?.mirroring && (