browser-rpc 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4187 -0
- package/package.json +34 -0
- package/web-dist/assets/Arc-R3PUWRPJ-CUdEQO8X.js +1 -0
- package/web-dist/assets/Brave-24BM36UM-C6C5mkTK.js +1 -0
- package/web-dist/assets/Browser-4R4QKTV2-D3ON1q-S.js +1 -0
- package/web-dist/assets/Chrome-TLI42HDP-BgiVz-ma.js +1 -0
- package/web-dist/assets/Edge-AZ34LAFM-EBh9cG_z.js +1 -0
- package/web-dist/assets/Firefox-ZDK7RHKK-5nyhB0sj.js +1 -0
- package/web-dist/assets/Linux-VYP66PDO--MOvpQUa.js +1 -0
- package/web-dist/assets/Macos-5QL4JBJE-DLNYPiln.js +1 -0
- package/web-dist/assets/Opera-BKMCKUXC-CCypmVaM.js +1 -0
- package/web-dist/assets/Safari-PXQIVS6N-B-Lfxb9r.js +1 -0
- package/web-dist/assets/Windows-GTAT3OTE-K9Pt3pUF.js +1 -0
- package/web-dist/assets/add-Bt6ug9as.js +15 -0
- package/web-dist/assets/all-wallets-ClkSG7YV.js +6 -0
- package/web-dist/assets/app-store-BnzgCmML.js +17 -0
- package/web-dist/assets/apple-D3CNMHuT.js +18 -0
- package/web-dist/assets/ar_AR-ZRPPM56D-d2WEfzQ_.js +1349 -0
- package/web-dist/assets/arbitrum-IA4OWRTN-B0aI2PBQ.js +1 -0
- package/web-dist/assets/arrow-bottom-BrYwqDZR.js +8 -0
- package/web-dist/assets/arrow-bottom-circle-CBoHFkqN.js +11 -0
- package/web-dist/assets/arrow-left-CHVgplmz.js +8 -0
- package/web-dist/assets/arrow-right-Do5EdrXQ.js +8 -0
- package/web-dist/assets/arrow-top-BOPLd2d5.js +8 -0
- package/web-dist/assets/assets-NU2OP443-COMs-Mo6.js +1 -0
- package/web-dist/assets/avalanche-MXEFEDSW-DcC5FNt3.js +1 -0
- package/web-dist/assets/bank-DafdJl1O.js +14 -0
- package/web-dist/assets/base-Z4LFBE5D-DHfqMzJC.js +1 -0
- package/web-dist/assets/basic-CLeG2Fx1.js +2124 -0
- package/web-dist/assets/blast-TN2WIMWF-BUZNbRBy.js +1 -0
- package/web-dist/assets/browser-DRuHXezx.js +14 -0
- package/web-dist/assets/bsc-RVE67I5L-DVYEF0vl.js +1 -0
- package/web-dist/assets/card-YgaTGJnf.js +14 -0
- package/web-dist/assets/ccip-B4x4TU0w.js +1 -0
- package/web-dist/assets/ccip-ConwrR6S.js +1 -0
- package/web-dist/assets/celo-E6XU57FO-C5IguUgF.js +1 -0
- package/web-dist/assets/checkmark-Dgr_oUfC.js +11 -0
- package/web-dist/assets/checkmark-bold-b4BEKMa-.js +8 -0
- package/web-dist/assets/chevron-bottom-BlzLXicX.js +8 -0
- package/web-dist/assets/chevron-left-DWsjEedN.js +8 -0
- package/web-dist/assets/chevron-right-B-GnUH_e.js +8 -0
- package/web-dist/assets/chevron-top-lK6t2THp.js +8 -0
- package/web-dist/assets/chrome-store-CbBGk8YS.js +61 -0
- package/web-dist/assets/clock-ByEA0e_s.js +8 -0
- package/web-dist/assets/close-BxDaavrr.js +8 -0
- package/web-dist/assets/coinPlaceholder-B9aaOU5j.js +8 -0
- package/web-dist/assets/coinbaseWallet-WWX6LF36-BMRj6mTC.js +1 -0
- package/web-dist/assets/compass-CBP6oSW9.js +8 -0
- package/web-dist/assets/connect-MR6XDLIE-BET5HMNk.js +1 -0
- package/web-dist/assets/copy-Dp304nbr.js +15 -0
- package/web-dist/assets/core-Bf6VrE6v.js +896 -0
- package/web-dist/assets/create-X4WFHLCW-De9pC3ym.js +1 -0
- package/web-dist/assets/cronos-ROYR77VZ-Prn3LRPZ.js +1 -0
- package/web-dist/assets/cursor-WUohjLCE.js +3 -0
- package/web-dist/assets/cursor-transparent-CutfCQQz.js +12 -0
- package/web-dist/assets/de_DE-GYZFZXWH-CYZf24IR.js +1349 -0
- package/web-dist/assets/desktop-kZiy9C-p.js +9 -0
- package/web-dist/assets/disconnect-CG5TDY_m.js +8 -0
- package/web-dist/assets/discord-JyHSI7q0.js +17 -0
- package/web-dist/assets/es_419-OGVOQEFZ-D6BJPTeQ.js +1349 -0
- package/web-dist/assets/ethereum-RFBAMUVK-WsW8NXqo.js +1 -0
- package/web-dist/assets/etherscan-CyB1NBm9.js +6 -0
- package/web-dist/assets/events-DQ172AOg.js +1 -0
- package/web-dist/assets/exclamation-triangle-7y5nglSL.js +4 -0
- package/web-dist/assets/extension-BjB3--xE.js +8 -0
- package/web-dist/assets/external-link-BW0O7z6_.js +8 -0
- package/web-dist/assets/facebook-682BXGmP.js +26 -0
- package/web-dist/assets/farcaster-BOaaCMAh.js +12 -0
- package/web-dist/assets/filters-DFWbfLJh.js +8 -0
- package/web-dist/assets/flow-NBCRNYVF-D2XasjKk.js +1 -0
- package/web-dist/assets/fr_FR-Q5QBQBX2-lQoTmpTH.js +1349 -0
- package/web-dist/assets/github-DpRqYyal.js +18 -0
- package/web-dist/assets/gnosis-T7U5EW2Q-CoPEM_sI.js +1 -0
- package/web-dist/assets/google-CgUt7hYq.js +18 -0
- package/web-dist/assets/hardhat-NEEC6JX7-DzuWQYyS.js +1 -0
- package/web-dist/assets/help-circle-DwVgKpjs.js +12 -0
- package/web-dist/assets/hi_IN-7I7LRHGW-CTQjmeYe.js +1349 -0
- package/web-dist/assets/id-BaTvs6Gs.js +12 -0
- package/web-dist/assets/id_ID-ZMGZ2JFV-CgKQKAmU.js +1349 -0
- package/web-dist/assets/image-BieDxoY2.js +4 -0
- package/web-dist/assets/index-Burh8TwV.js +47 -0
- package/web-dist/assets/index-C4Lbscxg.js +1532 -0
- package/web-dist/assets/index-C5m0fBnu.js +7 -0
- package/web-dist/assets/index-CteTNahN.js +50 -0
- package/web-dist/assets/index-DgKl8WD4.js +9 -0
- package/web-dist/assets/index-GJH9xypQ.css +1 -0
- package/web-dist/assets/index-My90LZL7.js +1 -0
- package/web-dist/assets/index-aVimijSo.js +359 -0
- package/web-dist/assets/index.es-Me6_HSoS.js +13 -0
- package/web-dist/assets/info-CaUhPhOk.js +3 -0
- package/web-dist/assets/info-circle-Dgdf-_kY.js +12 -0
- package/web-dist/assets/ja_JP-NYBCHQTZ-CMaBl8Za.js +1349 -0
- package/web-dist/assets/klaytn-QTDBZIB3-DyuKTpxX.js +1 -0
- package/web-dist/assets/ko_KR-67WE736M-DHWhIjcm.js +1349 -0
- package/web-dist/assets/lightbulb-h5NbP99t.js +3 -0
- package/web-dist/assets/login-CWDTIDNK-DhDUYE4b.js +1 -0
- package/web-dist/assets/mail-DUTW6gdU.js +8 -0
- package/web-dist/assets/manta-5V6W5D7G-BnjsGzeJ.js +1 -0
- package/web-dist/assets/mantle-KBL3OIYT-DIpe0poV.js +1 -0
- package/web-dist/assets/metaMaskWallet-YFHEHW7V-BggUDXad.js +1 -0
- package/web-dist/assets/mobile-BFFFlSgH.js +9 -0
- package/web-dist/assets/more-s9g8TvGr.js +11 -0
- package/web-dist/assets/ms_MY-65AJIBUS-BLlUrxe6.js +1349 -0
- package/web-dist/assets/network-placeholder-DBVOULy6.js +14 -0
- package/web-dist/assets/nftPlaceholder-D8q6GiE5.js +8 -0
- package/web-dist/assets/off-7mG5bayL.js +8 -0
- package/web-dist/assets/optimism-VD7XDD2W-DpJY1TMb.js +1 -0
- package/web-dist/assets/play-store-BFa605Jk.js +32 -0
- package/web-dist/assets/plus-BgZ-WP7A.js +13 -0
- package/web-dist/assets/polygon-WWEUOMKW-CNBYSB1T.js +1 -0
- package/web-dist/assets/pt_BR-DMJANC65-DMs4DrlC.js +1349 -0
- package/web-dist/assets/qr-code-B_1WHzPs.js +6 -0
- package/web-dist/assets/rainbowWallet-2SR6TVBF-kimcGeuf.js +1 -0
- package/web-dist/assets/recycle-horizontal-CuuA7YIy.js +9 -0
- package/web-dist/assets/refresh-CSXbxAuT.js +8 -0
- package/web-dist/assets/refresh-HJGJRASX-D0rkc63_.js +1 -0
- package/web-dist/assets/reown-logo-OK1pdOfH.js +12 -0
- package/web-dist/assets/ronin-PNHX5V6H-BS-WPXjQ.js +1 -0
- package/web-dist/assets/ru_RU-WER7RQ6A-DsJK55uv.js +1349 -0
- package/web-dist/assets/safeWallet-VUYZPLY4-CXnodgMs.js +1 -0
- package/web-dist/assets/scan-DEOT2M37-1-mJ5OyF.js +1 -0
- package/web-dist/assets/scroll-NMZWDUQH-fIxBV-y0.js +1 -0
- package/web-dist/assets/search-b77MGgNN.js +8 -0
- package/web-dist/assets/secp256k1-CqlnLpBV.js +1 -0
- package/web-dist/assets/secp256k1-xC50DJGj.js +1 -0
- package/web-dist/assets/send-DlJtxaMX.js +15 -0
- package/web-dist/assets/sign-A7IJEUT5-CGsRnPrd.js +1 -0
- package/web-dist/assets/swapHorizontal-BmG4i-CJ.js +8 -0
- package/web-dist/assets/swapHorizontalBold-CrnzAaq6.js +8 -0
- package/web-dist/assets/swapHorizontalMedium-DuPE93B2.js +16 -0
- package/web-dist/assets/swapHorizontalRoundedBold-clkEaP-W.js +8 -0
- package/web-dist/assets/swapVertical-DXvCmf9g.js +8 -0
- package/web-dist/assets/telegram-uHX2mx77.js +16 -0
- package/web-dist/assets/th_TH-JOSHEZ6D-Cp87mIRZ.js +1349 -0
- package/web-dist/assets/three-dots-BoFVtYRM.js +5 -0
- package/web-dist/assets/tr_TR-EAMG2YPO-C52_xfsf.js +1349 -0
- package/web-dist/assets/twitch-BbZVXa-k.js +18 -0
- package/web-dist/assets/twitterIcon-DTDEnPwP.js +6 -0
- package/web-dist/assets/uk_UA-GO2TRVWA-C1C1400t.js +1349 -0
- package/web-dist/assets/verify-DSwt0ow9.js +8 -0
- package/web-dist/assets/verify-filled-Dd2saJZ0.js +8 -0
- package/web-dist/assets/vi_VN-5HLLSOJA-Dj7ferOp.js +1349 -0
- package/web-dist/assets/w3m-modal-Dkca-GXY.js +642 -0
- package/web-dist/assets/wallet-DFQUKIzv.js +8 -0
- package/web-dist/assets/wallet-placeholder-DBESmMOJ.js +14 -0
- package/web-dist/assets/walletConnectWallet-FNSU4KNU-B0ci71fU.js +1 -0
- package/web-dist/assets/walletconnect-Byk_h0ya.js +30 -0
- package/web-dist/assets/warning-circle-BjOhgUMO.js +12 -0
- package/web-dist/assets/x-qhswnC92.js +12 -0
- package/web-dist/assets/xdc-X7V4QFNF-CSGs0o6M.js +1 -0
- package/web-dist/assets/zetachain-BMJKVYBN-IK2CZBr3.js +1 -0
- package/web-dist/assets/zh_CN-THPIFVWJ-Cbp71xMR.js +1349 -0
- package/web-dist/assets/zh_HK-R7XP4TGF-CyJtfKGw.js +1349 -0
- package/web-dist/assets/zh_TW-F5LD752V-AHFgsYw-.js +1349 -0
- package/web-dist/assets/zkSync-JL26RB7U-BYMs9Lzo.js +1 -0
- package/web-dist/assets/zora-YZH32HP3-CY3tp3EJ.js +1 -0
- package/web-dist/index.html +13 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-C4Lbscxg.js","assets/index-GJH9xypQ.css","assets/ccip-ConwrR6S.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as aa,F as oa,p as Uf,q as Ff,u as zf,E as Gf,_ as du,v as lu,h as Hf}from"./index-C4Lbscxg.js";const fu=oa(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),qf=fu.create(BigInt("-3")),Wf=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Vf=aa({a:qf,b:Wf,Fp:fu,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},Uf),pu=oa(BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff")),Kf=pu.create(BigInt("-3")),Jf=BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef");aa({a:Kf,b:Jf,Fp:pu,n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f"),h:BigInt(1),lowS:!1},Ff);const hu=oa(BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),Zf=hu.create(BigInt("-3")),Yf=BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00");aa({a:Zf,b:Yf,Fp:hu,n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650"),h:BigInt(1),lowS:!1,allowedPrivateKeyLengths:[130,131,132]},zf);const yo=Vf;var Zr,J,mu,_t,go,bu,Js,ca,Zs,Ys,Pn={},yu=[],Qf=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ua=Array.isArray;function bt(e,t){for(var n in t)e[n]=t[n];return e}function gu(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function q(e,t,n){var r,s,i,a={};for(i in t)i=="key"?r=t[i]:i=="ref"?s=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?Zr.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return xr(e,a,r,s,null)}function xr(e,t,n,r,s){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:s??++mu,__i:-1,__u:0};return s==null&&J.vnode!=null&&J.vnode(i),i}function Yr(e){return e.children}function _r(e,t){this.props=e,this.context=t}function Zt(e,t){if(t==null)return e.__?Zt(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Zt(e):null}function wu(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return wu(e)}}function wo(e){(!e.__d&&(e.__d=!0)&&_t.push(e)&&!Ar.__r++||go!==J.debounceRendering)&&((go=J.debounceRendering)||bu)(Ar)}function Ar(){var e,t,n,r,s,i,a,o;for(_t.sort(Js);e=_t.shift();)e.__d&&(t=_t.length,r=void 0,i=(s=(n=e).__v).__e,a=[],o=[],n.__P&&((r=bt({},s)).__v=s.__v+1,J.vnode&&J.vnode(r),da(n.__P,r,s,n.__n,n.__P.namespaceURI,32&s.__u?[i]:null,a,i??Zt(s),!!(32&s.__u),o),r.__v=s.__v,r.__.__k[r.__i]=r,_u(a,r,o),r.__e!=i&&wu(r)),_t.length>t&&_t.sort(Js));Ar.__r=0}function vu(e,t,n,r,s,i,a,o,c,u,l){var d,f,p,m,h,b=r&&r.__k||yu,y=t.length;for(n.__d=c,Xf(n,t,b),c=n.__d,d=0;d<y;d++)(p=n.__k[d])!=null&&(f=p.__i===-1?Pn:b[p.__i]||Pn,p.__i=d,da(e,p,f,s,i,a,o,c,u,l),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&la(f.ref,null,p),l.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),65536&p.__u||f.__k===p.__k?c=xu(p,c,e):typeof p.type=="function"&&p.__d!==void 0?c=p.__d:m&&(c=m.nextSibling),p.__d=void 0,p.__u&=-196609);n.__d=c,n.__e=h}function Xf(e,t,n){var r,s,i,a,o,c=t.length,u=n.length,l=u,d=0;for(e.__k=[],r=0;r<c;r++)(s=t[r])!=null&&typeof s!="boolean"&&typeof s!="function"?(a=r+d,(s=e.__k[r]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?xr(null,s,null,null,null):ua(s)?xr(Yr,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?xr(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,i=null,(o=s.__i=e0(s,n,a,l))!==-1&&(l--,(i=n[o])&&(i.__u|=131072)),i==null||i.__v===null?(o==-1&&d--,typeof s.type!="function"&&(s.__u|=65536)):o!==a&&(o==a-1?d--:o==a+1?d++:(o>a?d--:d++,s.__u|=65536))):s=e.__k[r]=null;if(l)for(r=0;r<u;r++)(i=n[r])!=null&&(131072&i.__u)==0&&(i.__e==e.__d&&(e.__d=Zt(i)),Eu(i,i))}function xu(e,t,n){var r,s;if(typeof e.type=="function"){for(r=e.__k,s=0;r&&s<r.length;s++)r[s]&&(r[s].__=e,t=xu(r[s],t,n));return t}e.__e!=t&&(t&&e.type&&!n.contains(t)&&(t=Zt(e)),n.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType===8);return t}function e0(e,t,n,r){var s=e.key,i=e.type,a=n-1,o=n+1,c=t[n];if(c===null||c&&s==c.key&&i===c.type&&(131072&c.__u)==0)return n;if(r>(c!=null&&(131072&c.__u)==0?1:0))for(;a>=0||o<t.length;){if(a>=0){if((c=t[a])&&(131072&c.__u)==0&&s==c.key&&i===c.type)return a;a--}if(o<t.length){if((c=t[o])&&(131072&c.__u)==0&&s==c.key&&i===c.type)return o;o++}}return-1}function vo(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Qf.test(t)?n:n+"px"}function ar(e,t,n,r,s){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||vo(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||vo(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||t==="onFocusOut"||t==="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=ca,e.addEventListener(t,i?Ys:Zs,i)):e.removeEventListener(t,i?Ys:Zs,i);else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function xo(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=ca++;else if(t.t<n.u)return;return n(J.event?J.event(t):t)}}}function da(e,t,n,r,s,i,a,o,c,u){var l,d,f,p,m,h,b,y,g,_,w,x,k,A,T,S,v=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),i=[o=t.__e=n.__e]),(l=J.__b)&&l(t);e:if(typeof v=="function")try{if(y=t.props,g="prototype"in v&&v.prototype.render,_=(l=v.contextType)&&r[l.__c],w=l?_?_.props.value:l.__:r,n.__c?b=(d=t.__c=n.__c).__=d.__E:(g?t.__c=d=new v(y,w):(t.__c=d=new _r(y,w),d.constructor=v,d.render=n0),_&&_.sub(d),d.props=y,d.state||(d.state={}),d.context=w,d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),g&&d.__s==null&&(d.__s=d.state),g&&v.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=bt({},d.__s)),bt(d.__s,v.getDerivedStateFromProps(y,d.__s))),p=d.props,m=d.state,d.__v=t,f)g&&v.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),g&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(g&&v.getDerivedStateFromProps==null&&y!==p&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(y,w),!d.__e&&(d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(y,d.__s,w)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(d.props=y,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(I){I&&(I.__=t)}),x=0;x<d._sb.length;x++)d.__h.push(d._sb[x]);d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(y,d.__s,w),g&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(p,m,h)})}if(d.context=w,d.props=y,d.__P=e,d.__e=!1,k=J.__r,A=0,g){for(d.state=d.__s,d.__d=!1,k&&k(t),l=d.render(d.props,d.state,d.context),T=0;T<d._sb.length;T++)d.__h.push(d._sb[T]);d._sb=[]}else do d.__d=!1,k&&k(t),l=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++A<25);d.state=d.__s,d.getChildContext!=null&&(r=bt(bt({},r),d.getChildContext())),g&&!f&&d.getSnapshotBeforeUpdate!=null&&(h=d.getSnapshotBeforeUpdate(p,m)),vu(e,ua(S=l!=null&&l.type===Yr&&l.key==null?l.props.children:l)?S:[S],t,n,r,s,i,a,o,c,u),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),b&&(d.__E=d.__=null)}catch(I){if(t.__v=null,c||i!=null){for(t.__u|=c?160:32;o&&o.nodeType===8&&o.nextSibling;)o=o.nextSibling;i[i.indexOf(o)]=null,t.__e=o}else t.__e=n.__e,t.__k=n.__k;J.__e(I,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=t0(n.__e,t,n,r,s,i,a,c,u);(l=J.diffed)&&l(t)}function _u(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)la(n[r],n[++r],n[++r]);J.__c&&J.__c(t,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(i){i.call(s)})}catch(i){J.__e(i,s.__v)}})}function t0(e,t,n,r,s,i,a,o,c){var u,l,d,f,p,m,h,b=n.props,y=t.props,g=t.type;if(g==="svg"?s="http://www.w3.org/2000/svg":g==="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),i!=null){for(u=0;u<i.length;u++)if((p=i[u])&&"setAttribute"in p==!!g&&(g?p.localName===g:p.nodeType===3)){e=p,i[u]=null;break}}if(e==null){if(g===null)return document.createTextNode(y);e=document.createElementNS(s,g,y.is&&y),o&&(J.__m&&J.__m(t,i),o=!1),i=null}if(g===null)b===y||o&&e.data===y||(e.data=y);else{if(i=i&&Zr.call(e.childNodes),b=n.props||Pn,!o&&i!=null)for(b={},u=0;u<e.attributes.length;u++)b[(p=e.attributes[u]).name]=p.value;for(u in b)if(p=b[u],u!="children"){if(u=="dangerouslySetInnerHTML")d=p;else if(!(u in y)){if(u=="value"&&"defaultValue"in y||u=="checked"&&"defaultChecked"in y)continue;ar(e,u,null,p,s)}}for(u in y)p=y[u],u=="children"?f=p:u=="dangerouslySetInnerHTML"?l=p:u=="value"?m=p:u=="checked"?h=p:o&&typeof p!="function"||b[u]===p||ar(e,u,p,b[u],s);if(l)o||d&&(l.__html===d.__html||l.__html===e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(d&&(e.innerHTML=""),vu(e,ua(f)?f:[f],t,n,r,g==="foreignObject"?"http://www.w3.org/1999/xhtml":s,i,a,i?i[0]:n.__k&&Zt(n,0),o,c),i!=null)for(u=i.length;u--;)gu(i[u]);o||(u="value",g==="progress"&&m==null?e.removeAttribute("value"):m!==void 0&&(m!==e[u]||g==="progress"&&!m||g==="option"&&m!==b[u])&&ar(e,u,m,b[u],s),u="checked",h!==void 0&&h!==e[u]&&ar(e,u,h,b[u],s))}return e}function la(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(s){J.__e(s,n)}}function Eu(e,t,n){var r,s;if(J.unmount&&J.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||la(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){J.__e(i,t)}r.base=r.__P=null}if(r=e.__k)for(s=0;s<r.length;s++)r[s]&&Eu(r[s],t,n||typeof e.type!="function");n||gu(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function n0(e,t,n){return this.constructor(e,n)}function Qs(e,t,n){var r,s,i,a;J.__&&J.__(e,t),s=(r=!1)?null:t.__k,i=[],a=[],da(t,e=t.__k=q(Yr,null,[e]),s||Pn,Pn,t.namespaceURI,s?null:t.firstChild?Zr.call(t.childNodes):null,i,s?s.__e:t.firstChild,r,a),_u(i,e,a)}Zr=yu.slice,J={__e:function(e,t,n,r){for(var s,i,a;t=t.__;)if((s=t.__c)&&!s.__)try{if((i=s.constructor)&&i.getDerivedStateFromError!=null&&(s.setState(i.getDerivedStateFromError(e)),a=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),a=s.__d),a)return s.__E=s}catch(o){e=o}throw e}},mu=0,_r.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=bt({},this.state),typeof e=="function"&&(e=e(bt({},n),this.props)),e&&bt(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),wo(this))},_r.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),wo(this))},_r.prototype.render=Yr,_t=[],bu=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Js=function(e,t){return e.__v.__b-t.__v.__b},Ar.__r=0,ca=0,Zs=xo(!1),Ys=xo(!0);var Sr,ee,_s,_o,Xs=0,Pu=[],ne=J,Eo=ne.__b,Po=ne.__r,ko=ne.diffed,Ao=ne.__c,So=ne.unmount,Io=ne.__;function ku(e,t){ne.__h&&ne.__h(ee,e,Xs||t),Xs=0;var n=ee.__H||(ee.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function To(e){return Xs=1,r0(Au,e)}function r0(e,t,n){var r=ku(Sr++,2);if(r.t=e,!r.__c&&(r.__=[Au(void 0,t),function(o){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,o);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=ee,!ee.u)){var s=function(o,c,u){if(!r.__c.__H)return!0;var l=r.__c.__H.__.filter(function(f){return!!f.__c});if(l.every(function(f){return!f.__N}))return!i||i.call(this,o,c,u);var d=!1;return l.forEach(function(f){if(f.__N){var p=f.__[0];f.__=f.__N,f.__N=void 0,p!==f.__[0]&&(d=!0)}}),!(!d&&r.__c.props===o)&&(!i||i.call(this,o,c,u))};ee.u=!0;var i=ee.shouldComponentUpdate,a=ee.componentWillUpdate;ee.componentWillUpdate=function(o,c,u){if(this.__e){var l=i;i=void 0,s(o,c,u),i=l}a&&a.call(this,o,c,u)},ee.shouldComponentUpdate=s}return r.__N||r.__}function s0(e,t){var n=ku(Sr++,3);!ne.__s&&o0(n.__H,t)&&(n.__=e,n.i=t,ee.__H.__h.push(n))}function i0(){for(var e;e=Pu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Er),e.__H.__h.forEach(ei),e.__H.__h=[]}catch(t){e.__H.__h=[],ne.__e(t,e.__v)}}ne.__b=function(e){ee=null,Eo&&Eo(e)},ne.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Io&&Io(e,t)},ne.__r=function(e){Po&&Po(e),Sr=0;var t=(ee=e.__c).__H;t&&(_s===ee?(t.__h=[],ee.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(t.__h.forEach(Er),t.__h.forEach(ei),t.__h=[],Sr=0)),_s=ee},ne.diffed=function(e){ko&&ko(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Pu.push(t)!==1&&_o===ne.requestAnimationFrame||((_o=ne.requestAnimationFrame)||a0)(i0)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),_s=ee=null},ne.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Er),n.__h=n.__h.filter(function(r){return!r.__||ei(r)})}catch(r){t.some(function(s){s.__h&&(s.__h=[])}),t=[],ne.__e(r,n.__v)}}),Ao&&Ao(e,t)},ne.unmount=function(e){So&&So(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Er(r)}catch(s){t=s}}),n.__H=void 0,t&&ne.__e(t,n.__v))};var Oo=typeof requestAnimationFrame=="function";function a0(e){var t,n=function(){clearTimeout(r),Oo&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Oo&&(t=requestAnimationFrame(n))}function Er(e){var t=ee,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ee=t}function ei(e){var t=ee;e.__c=e.__(),ee=t}function o0(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Au(e,t){return typeof t=="function"?t(e):t}function Qr(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function Su(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=Qr(n);return(s,i)=>r.then(a=>i(a.transaction(t,s).objectStore(t)))}let Es;function fa(){return Es||(Es=Su("keyval-store","keyval")),Es}function c0(e,t=fa()){return t("readonly",n=>Qr(n.get(e)))}function u0(e,t,n=fa()){return n("readwrite",r=>(r.put(t,e),Qr(r.transaction)))}function d0(e,t=fa()){return t("readwrite",n=>(n.delete(e),Qr(n.transaction)))}function Iu(e,t){let n;try{n=e()}catch{return}return{getItem:s=>{var i;const a=c=>c===null?null:JSON.parse(c,void 0),o=(i=n.getItem(s))!=null?i:null;return o instanceof Promise?o.then(a):a(o)},setItem:(s,i)=>n.setItem(s,JSON.stringify(i,void 0)),removeItem:s=>n.removeItem(s)}}const ti=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return ti(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return ti(r)(n)}}}},l0=(e,t)=>(n,r,s)=>{let i={storage:Iu(()=>localStorage),partialize:h=>h,version:0,merge:(h,b)=>({...b,...h}),...t},a=!1;const o=new Set,c=new Set;let u=i.storage;if(!u)return e((...h)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...h)},r,s);const l=()=>{const h=i.partialize({...r()});return u.setItem(i.name,{state:h,version:i.version})},d=s.setState;s.setState=(h,b)=>{d(h,b),l()};const f=e((...h)=>{n(...h),l()},r,s);s.getInitialState=()=>f;let p;const m=()=>{var h,b;if(!u)return;a=!1,o.forEach(g=>{var _;return g((_=r())!=null?_:f)});const y=((b=i.onRehydrateStorage)==null?void 0:b.call(i,(h=r())!=null?h:f))||void 0;return ti(u.getItem.bind(u))(i.name).then(g=>{if(g)if(typeof g.version=="number"&&g.version!==i.version){if(i.migrate){const _=i.migrate(g.state,g.version);return _ instanceof Promise?_.then(w=>[!0,w]):[!0,_]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,g.state];return[!1,void 0]}).then(g=>{var _;const[w,x]=g;if(p=i.merge(x,(_=r())!=null?_:f),n(p,!0),w)return l()}).then(()=>{y?.(p,void 0),p=r(),a=!0,c.forEach(g=>g(p))}).catch(g=>{y?.(void 0,g)})};return s.persist={setOptions:h=>{i={...i,...h},h.storage&&(u=h.storage)},clearStorage:()=>{u?.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>m(),hasHydrated:()=>a,onHydrate:h=>(o.add(h),()=>{o.delete(h)}),onFinishHydration:h=>(c.add(h),()=>{c.delete(h)})},i.skipHydration||m(),p||f},f0=l0,Co=e=>{let t;const n=new Set,r=(u,l)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const f=t;t=l??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(p=>p(t,f))}},s=()=>t,o={setState:r,getState:s,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=t=e(r,s,o);return o},pa=e=>e?Co(e):Co,sn="4.3.6",Tu="@coinbase/wallet-sdk",p0=()=>({chains:[]}),h0=()=>({keys:{}}),m0=()=>({account:{}}),b0=()=>({subAccount:void 0}),y0=()=>({subAccountConfig:{}}),g0=()=>({spendPermissions:[]}),w0=()=>({config:{version:sn}}),te=pa(f0((...e)=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},p0(...e)),h0(...e)),m0(...e)),b0(...e)),g0(...e)),w0(...e)),y0(...e)),{name:"cbwsdk.store",storage:Iu(()=>localStorage),partialize:e=>({chains:e.chains,keys:e.keys,account:e.account,subAccount:e.subAccount,spendPermissions:e.spendPermissions,config:e.config})})),v0={get:()=>te.getState().subAccountConfig,set:e=>{te.setState(t=>({subAccountConfig:Object.assign(Object.assign({},t.subAccountConfig),e)}))},clear:()=>{te.setState({subAccountConfig:{}})}},x0={get:()=>te.getState().subAccount,set:e=>{te.setState(t=>({subAccount:t.subAccount?Object.assign(Object.assign({},t.subAccount),e):Object.assign({address:e.address},e)}))},clear:()=>{te.setState({subAccount:void 0})}},_0={get:()=>te.getState().spendPermissions,set:e=>{te.setState({spendPermissions:e})},clear:()=>{te.setState({spendPermissions:[]})}},E0={get:()=>te.getState().account,set:e=>{te.setState(t=>({account:Object.assign(Object.assign({},t.account),e)}))},clear:()=>{te.setState({account:{}})}},P0={get:()=>te.getState().chains,set:e=>{te.setState({chains:e})},clear:()=>{te.setState({chains:[]})}},k0={get:e=>te.getState().keys[e],set:(e,t)=>{te.setState(n=>({keys:Object.assign(Object.assign({},n.keys),{[e]:t})}))},clear:()=>{te.setState({keys:{}})}},Ou={get:()=>te.getState().config,set:e=>{te.setState(t=>({config:Object.assign(Object.assign({},t.config),e)}))}},A0={subAccounts:x0,subAccountsConfig:v0,spendPermissions:_0,account:E0,chains:P0,keys:k0,config:Ou},$=Object.assign(Object.assign({},te),A0),S0='!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ClientAnalytics=t():e.ClientAnalytics=t()}(this,(function(){return(()=>{var e={792:e=>{var t={utf8:{stringToBytes:function(e){return t.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(t.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}};e.exports=t},562:e=>{var t,n;t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var i=e[r]<<16|e[r+1]<<8|e[r+2],a=0;a<4;a++)8*r+6*a<=8*e.length?n.push(t.charAt(i>>>6*(3-a)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\\/]/gi,"");for(var n=[],r=0,i=0;r<e.length;i=++r%4)0!=i&&n.push((t.indexOf(e.charAt(r-1))&Math.pow(2,-2*i+8)-1)<<2*i|t.indexOf(e.charAt(r))>>>6-2*i);return n}},e.exports=n},335:e=>{function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},762:(e,t,n)=>{var r,i,a,o,s;r=n(562),i=n(792).utf8,a=n(335),o=n(792).bin,(s=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?o.stringToBytes(e):i.stringToBytes(e):a(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=r.bytesToWords(e),c=8*e.length,u=1732584193,l=-271733879,d=-1732584194,p=271733878,m=0;m<n.length;m++)n[m]=16711935&(n[m]<<8|n[m]>>>24)|4278255360&(n[m]<<24|n[m]>>>8);n[c>>>5]|=128<<c%32,n[14+(c+64>>>9<<4)]=c;var f=s._ff,v=s._gg,g=s._hh,b=s._ii;for(m=0;m<n.length;m+=16){var h=u,w=l,y=d,T=p;u=f(u,l,d,p,n[m+0],7,-680876936),p=f(p,u,l,d,n[m+1],12,-389564586),d=f(d,p,u,l,n[m+2],17,606105819),l=f(l,d,p,u,n[m+3],22,-1044525330),u=f(u,l,d,p,n[m+4],7,-176418897),p=f(p,u,l,d,n[m+5],12,1200080426),d=f(d,p,u,l,n[m+6],17,-1473231341),l=f(l,d,p,u,n[m+7],22,-45705983),u=f(u,l,d,p,n[m+8],7,1770035416),p=f(p,u,l,d,n[m+9],12,-1958414417),d=f(d,p,u,l,n[m+10],17,-42063),l=f(l,d,p,u,n[m+11],22,-1990404162),u=f(u,l,d,p,n[m+12],7,1804603682),p=f(p,u,l,d,n[m+13],12,-40341101),d=f(d,p,u,l,n[m+14],17,-1502002290),u=v(u,l=f(l,d,p,u,n[m+15],22,1236535329),d,p,n[m+1],5,-165796510),p=v(p,u,l,d,n[m+6],9,-1069501632),d=v(d,p,u,l,n[m+11],14,643717713),l=v(l,d,p,u,n[m+0],20,-373897302),u=v(u,l,d,p,n[m+5],5,-701558691),p=v(p,u,l,d,n[m+10],9,38016083),d=v(d,p,u,l,n[m+15],14,-660478335),l=v(l,d,p,u,n[m+4],20,-405537848),u=v(u,l,d,p,n[m+9],5,568446438),p=v(p,u,l,d,n[m+14],9,-1019803690),d=v(d,p,u,l,n[m+3],14,-187363961),l=v(l,d,p,u,n[m+8],20,1163531501),u=v(u,l,d,p,n[m+13],5,-1444681467),p=v(p,u,l,d,n[m+2],9,-51403784),d=v(d,p,u,l,n[m+7],14,1735328473),u=g(u,l=v(l,d,p,u,n[m+12],20,-1926607734),d,p,n[m+5],4,-378558),p=g(p,u,l,d,n[m+8],11,-2022574463),d=g(d,p,u,l,n[m+11],16,1839030562),l=g(l,d,p,u,n[m+14],23,-35309556),u=g(u,l,d,p,n[m+1],4,-1530992060),p=g(p,u,l,d,n[m+4],11,1272893353),d=g(d,p,u,l,n[m+7],16,-155497632),l=g(l,d,p,u,n[m+10],23,-1094730640),u=g(u,l,d,p,n[m+13],4,681279174),p=g(p,u,l,d,n[m+0],11,-358537222),d=g(d,p,u,l,n[m+3],16,-722521979),l=g(l,d,p,u,n[m+6],23,76029189),u=g(u,l,d,p,n[m+9],4,-640364487),p=g(p,u,l,d,n[m+12],11,-421815835),d=g(d,p,u,l,n[m+15],16,530742520),u=b(u,l=g(l,d,p,u,n[m+2],23,-995338651),d,p,n[m+0],6,-198630844),p=b(p,u,l,d,n[m+7],10,1126891415),d=b(d,p,u,l,n[m+14],15,-1416354905),l=b(l,d,p,u,n[m+5],21,-57434055),u=b(u,l,d,p,n[m+12],6,1700485571),p=b(p,u,l,d,n[m+3],10,-1894986606),d=b(d,p,u,l,n[m+10],15,-1051523),l=b(l,d,p,u,n[m+1],21,-2054922799),u=b(u,l,d,p,n[m+8],6,1873313359),p=b(p,u,l,d,n[m+15],10,-30611744),d=b(d,p,u,l,n[m+6],15,-1560198380),l=b(l,d,p,u,n[m+13],21,1309151649),u=b(u,l,d,p,n[m+4],6,-145523070),p=b(p,u,l,d,n[m+11],10,-1120210379),d=b(d,p,u,l,n[m+2],15,718787259),l=b(l,d,p,u,n[m+9],21,-343485551),u=u+h>>>0,l=l+w>>>0,d=d+y>>>0,p=p+T>>>0}return r.endian([u,l,d,p])})._ff=function(e,t,n,r,i,a,o){var s=e+(t&n|~t&r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._gg=function(e,t,n,r,i,a,o){var s=e+(t&r|n&~r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._hh=function(e,t,n,r,i,a,o){var s=e+(t^n^r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._ii=function(e,t,n,r,i,a,o){var s=e+(n^(t|~r))+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._blocksize=16,s._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var n=r.wordsToBytes(s(e,t));return t&&t.asBytes?n:t&&t.asString?o.bytesToString(n):r.bytesToHex(n)}},2:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Perfume:()=>ze,incrementUjNavigation:()=>Le,markStep:()=>Re,markStepOnce:()=>qe});var r,i,a={isResourceTiming:!1,isElementTiming:!1,maxTime:3e4,reportOptions:{},enableNavigationTracking:!0},o=window,s=o.console,c=o.navigator,u=o.performance,l=function(){return c.deviceMemory},d=function(){return c.hardwareConcurrency},p="mark.",m=function(){return u&&!!u.getEntriesByType&&!!u.now&&!!u.mark},f="4g",v=!1,g={},b={value:0},h={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},w={value:0},y={value:0},T={},k={isHidden:!1,didChange:!1},_=function(){k.isHidden=!1,document.hidden&&(k.isHidden=document.hidden,k.didChange=!0)},S=function(e,t){try{var n=new PerformanceObserver((function(e){t(e.getEntries())}));return n.observe({type:e,buffered:!0}),n}catch(e){s.warn("Perfume.js:",e)}return null},E=function(){return!!(d()&&d()<=4)||!!(l()&&l()<=4)},x=function(e,t){switch(e){case"slow-2g":case"2g":case"3g":return!0;default:return E()||t}},O=function(e){return parseFloat(e.toFixed(4))},j=function(e){return"number"!=typeof e?null:O(e/Math.pow(1024,2))},N=function(e,t,n,r,i){var s,u=function(){a.analyticsTracker&&(k.isHidden&&!["CLS","INP"].includes(e)||a.analyticsTracker({attribution:r,metricName:e,data:t,navigatorInformation:c?{deviceMemory:l()||0,hardwareConcurrency:d()||0,serviceWorkerStatus:"serviceWorker"in c?c.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:E(),isLowEndExperience:x(f,v)}:{},rating:n,navigationType:i}))};["CLS","INP"].includes(e)?u():(s=u,"requestIdleCallback"in o?o.requestIdleCallback(s,{timeout:3e3}):s())},I=function(e){e.forEach((function(e){if(!("self"!==e.name||e.startTime<b.value)){var t=e.duration-50;t>0&&(w.value+=t,y.value+=t)}}))};!function(e){e.instant="instant",e.quick="quick",e.moderate="moderate",e.slow="slow",e.unavoidable="unavoidable"}(r||(r={}));var P,M,B,C,D,A=((i={})[r.instant]={vitalsThresholds:[100,200],maxOutlierThreshold:1e4},i[r.quick]={vitalsThresholds:[200,500],maxOutlierThreshold:1e4},i[r.moderate]={vitalsThresholds:[500,1e3],maxOutlierThreshold:1e4},i[r.slow]={vitalsThresholds:[1e3,2e3],maxOutlierThreshold:1e4},i[r.unavoidable]={vitalsThresholds:[2e3,5e3],maxOutlierThreshold:2e4},i),L={RT:[100,200],TBT:[200,600],NTBT:[200,600]},U=function(e,t){return L[e]?t<=L[e][0]?"good":t<=L[e][1]?"needsImprovement":"poor":null},R=function(e,t,n){Object.keys(t).forEach((function(e){"number"==typeof t[e]&&(t[e]=O(t[e]))})),N(e,t,null,n||{})},q=function(e){var t=e.attribution,n=e.name,r=e.rating,i=e.value,o=e.navigationType;"FCP"===n&&(b.value=i),["FCP","LCP"].includes(n)&&!T[0]&&(T[0]=S("longtask",I)),"FID"===n&&setTimeout((function(){k.didChange||(q({attribution:t,name:"TBT",rating:U("TBT",w.value),value:w.value,navigationType:o}),R("dataConsumption",h.value))}),1e4);var s=O(i);s<=a.maxTime&&s>=0&&N(n,s,r,t,o)},F=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},z=function(e){if("loading"===document.readyState)return"loading";var t=F();if(t){if(e<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||e<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||e<t.domComplete)return"dom-content-loaded"}return"complete"},K=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},$=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var r=e,i=r.id?"#"+r.id:K(r)+(r.className&&r.className.length?"."+r.className.replace(/\\s+/g,"."):"");if(n.length+i.length>(t||100)-1)return n||i;if(n=n?i+">"+n:i,r.id)break;e=r.parentNode}}catch(e){}return n},Q=-1,W=function(){return Q},H=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Q=t.timeStamp,e(t))}),!0)},V=function(){var e=F();return e&&e.activationStart||0},J=function(e,t){var n=F(),r="navigate";return W()>=0?r="back-forward-cache":n&&(r=document.prerendering||V()>0?"prerender":document.wasDiscarded?"restore":n.type.replace(/_/g,"-")),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},X=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},G=function(e,t){var n=function n(r){"pagehide"!==r.type&&"hidden"!==document.visibilityState||(e(r),t&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Z=function(e,t,n,r){var i,a;return function(o){t.value>=0&&(o||r)&&((a=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=a,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},Y=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},ee=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},te=-1,ne=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},re=function(e){"hidden"===document.visibilityState&&te>-1&&(te="visibilitychange"===e.type?e.timeStamp:0,ae())},ie=function(){addEventListener("visibilitychange",re,!0),addEventListener("prerenderingchange",re,!0)},ae=function(){removeEventListener("visibilitychange",re,!0),removeEventListener("prerenderingchange",re,!0)},oe=function(){return te<0&&(te=ne(),ie(),H((function(){setTimeout((function(){te=ne(),ie()}),0)}))),{get firstHiddenTime(){return te}}},se=function(e,t){t=t||{},ee((function(){var n,r=[1800,3e3],i=oe(),a=J("FCP"),o=X("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<i.firstHiddenTime&&(a.value=Math.max(e.startTime-V(),0),a.entries.push(e),n(!0)))}))}));o&&(n=Z(e,a,r,t.reportAllChanges),H((function(i){a=J("FCP"),n=Z(e,a,r,t.reportAllChanges),Y((function(){a.value=performance.now()-i.timeStamp,n(!0)}))})))}))},ce={passive:!0,capture:!0},ue=new Date,le=function(e,t){P||(P=t,M=e,B=new Date,me(removeEventListener),de())},de=function(){if(M>=0&&M<B-ue){var e={entryType:"first-input",name:P.type,target:P.target,cancelable:P.cancelable,startTime:P.timeStamp,processingStart:P.timeStamp+M};C.forEach((function(t){t(e)})),C=[]}},pe=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){le(e,t),i()},r=function(){i()},i=function(){removeEventListener("pointerup",n,ce),removeEventListener("pointercancel",r,ce)};addEventListener("pointerup",n,ce),addEventListener("pointercancel",r,ce)}(t,e):le(t,e)}},me=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,pe,ce)}))},fe=0,ve=1/0,ge=0,be=function(e){e.forEach((function(e){e.interactionId&&(ve=Math.min(ve,e.interactionId),ge=Math.max(ge,e.interactionId),fe=ge?(ge-ve)/7+1:0)}))},he=function(){return D?fe:performance.interactionCount||0},we=0,ye=function(){return he()-we},Te=[],ke={},_e=function(e){var t=Te[Te.length-1],n=ke[e.interactionId];if(n||Te.length<10||e.duration>t.latency){if(n)n.entries.push(e),n.latency=Math.max(n.latency,e.duration);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};ke[r.id]=r,Te.push(r)}Te.sort((function(e,t){return t.latency-e.latency})),Te.splice(10).forEach((function(e){delete ke[e.id]}))}},Se={},Ee=function e(t){document.prerendering?ee((function(){return e(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},xe=function(e,t){t=t||{};var n=[800,1800],r=J("TTFB"),i=Z(e,r,n,t.reportAllChanges);Ee((function(){var a=F();if(a){var o=a.responseStart;if(o<=0||o>performance.now())return;r.value=Math.max(o-V(),0),r.entries=[a],i(!0),H((function(){r=J("TTFB",0),(i=Z(e,r,n,t.reportAllChanges))(!0)}))}}))},Oe=function(e){e.forEach((function(e){e.identifier&&q({attribution:{identifier:e.identifier},name:"ET",rating:null,value:e.startTime})}))},je=function(e){e.forEach((function(e){if(a.isResourceTiming&&R("resourceTiming",e),e.decodedBodySize&&e.initiatorType){var t=e.decodedBodySize/1e3;h.value[e.initiatorType]+=t,h.value.total+=t}}))},Ne=function(){!function(e,t){xe((function(e){!function(e){if(e.entries.length){var t=e.entries[0],n=t.activationStart||0,r=Math.max(t.domainLookupStart-n,0),i=Math.max(t.connectStart-n,0),a=Math.max(t.requestStart-n,0);e.attribution={waitingTime:r,dnsTime:i-r,connectionTime:a-i,requestTime:e.value-a,navigationEntry:t}}else e.attribution={waitingTime:0,dnsTime:0,connectionTime:0,requestTime:0}}(e),function(e){e.value>0&&q(e)}(e)}),t)}(0,a.reportOptions.ttfb),function(e,t){!function(e,t){t=t||{},ee((function(){var e,n=[.1,.25],r=J("CLS"),i=-1,a=0,o=[],s=function(e){i>-1&&function(e){!function(e){if(e.entries.length){var t=e.entries.reduce((function(e,t){return e&&e.value>t.value?e:t}));if(t&&t.sources&&t.sources.length){var n=(r=t.sources).find((function(e){return e.node&&1===e.node.nodeType}))||r[0];if(n)return void(e.attribution={largestShiftTarget:$(n.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:n,largestShiftEntry:t,loadState:z(t.startTime)})}}var r;e.attribution={}}(e),function(e){q(e)}(e)}(e)},c=function(t){t.forEach((function(t){if(!t.hadRecentInput){var n=o[0],i=o[o.length-1];a&&t.startTime-i.startTime<1e3&&t.startTime-n.startTime<5e3?(a+=t.value,o.push(t)):(a=t.value,o=[t]),a>r.value&&(r.value=a,r.entries=o,e())}}))},u=X("layout-shift",c);u&&(e=Z(s,r,n,t.reportAllChanges),se((function(t){i=t.value,r.value<0&&(r.value=0,e())})),G((function(){c(u.takeRecords()),e(!0)})),H((function(){a=0,i=-1,r=J("CLS",0),e=Z(s,r,n,t.reportAllChanges),Y((function(){return e()}))})))}))}(0,t)}(0,a.reportOptions.cls),function(e,t){se((function(e){!function(e){if(e.entries.length){var t=F(),n=e.entries[e.entries.length-1];if(t){var r=t.activationStart||0,i=Math.max(0,t.responseStart-r);return void(e.attribution={timeToFirstByte:i,firstByteToFCP:e.value-i,loadState:z(e.entries[0].startTime),navigationEntry:t,fcpEntry:n})}}e.attribution={timeToFirstByte:0,firstByteToFCP:e.value,loadState:z(W())}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.fcp),function(e,t){!function(e,t){t=t||{},ee((function(){var n,r=[100,300],i=oe(),a=J("FID"),o=function(e){e.startTime<i.firstHiddenTime&&(a.value=e.processingStart-e.startTime,a.entries.push(e),n(!0))},s=function(e){e.forEach(o)},c=X("first-input",s);n=Z(e,a,r,t.reportAllChanges),c&&G((function(){s(c.takeRecords()),c.disconnect()}),!0),c&&H((function(){var i;a=J("FID"),n=Z(e,a,r,t.reportAllChanges),C=[],M=-1,P=null,me(addEventListener),i=o,C.push(i),de()}))}))}((function(e){!function(e){var t=e.entries[0];e.attribution={eventTarget:$(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:z(t.startTime)}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.fid),function(e,t){!function(e,t){t=t||{},ee((function(){var n,r=[2500,4e3],i=oe(),a=J("LCP"),o=function(e){var t=e[e.length-1];if(t){var r=Math.max(t.startTime-V(),0);r<i.firstHiddenTime&&(a.value=r,a.entries=[t],n())}},s=X("largest-contentful-paint",o);if(s){n=Z(e,a,r,t.reportAllChanges);var c=function(){Se[a.id]||(o(s.takeRecords()),s.disconnect(),Se[a.id]=!0,n(!0))};["keydown","click"].forEach((function(e){addEventListener(e,c,{once:!0,capture:!0})})),G(c,!0),H((function(i){a=J("LCP"),n=Z(e,a,r,t.reportAllChanges),Y((function(){a.value=performance.now()-i.timeStamp,Se[a.id]=!0,n(!0)}))}))}}))}((function(e){!function(e){if(e.entries.length){var t=F();if(t){var n=t.activationStart||0,r=e.entries[e.entries.length-1],i=r.url&&performance.getEntriesByType("resource").filter((function(e){return e.name===r.url}))[0],a=Math.max(0,t.responseStart-n),o=Math.max(a,i?(i.requestStart||i.startTime)-n:0),s=Math.max(o,i?i.responseEnd-n:0),c=Math.max(s,r?r.startTime-n:0),u={element:$(r.element),timeToFirstByte:a,resourceLoadDelay:o-a,resourceLoadTime:s-o,elementRenderDelay:c-s,navigationEntry:t,lcpEntry:r};return r.url&&(u.url=r.url),i&&(u.lcpResourceEntry=i),void(e.attribution=u)}}e.attribution={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadTime:0,elementRenderDelay:e.value}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.lcp),function(e,t){!function(e,t){t=t||{},ee((function(){var n=[200,500];"interactionCount"in performance||D||(D=X("event",be,{type:"event",buffered:!0,durationThreshold:0}));var r,i=J("INP"),a=function(e){e.forEach((function(e){e.interactionId&&_e(e),"first-input"===e.entryType&&!Te.some((function(t){return t.entries.some((function(t){return e.duration===t.duration&&e.startTime===t.startTime}))}))&&_e(e)}));var t,n=(t=Math.min(Te.length-1,Math.floor(ye()/50)),Te[t]);n&&n.latency!==i.value&&(i.value=n.latency,i.entries=n.entries,r())},o=X("event",a,{durationThreshold:t.durationThreshold||40});r=Z(e,i,n,t.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),G((function(){a(o.takeRecords()),i.value<0&&ye()>0&&(i.value=0,i.entries=[]),r(!0)})),H((function(){Te=[],we=he(),i=J("INP"),r=Z(e,i,n,t.reportAllChanges)})))}))}((function(t){!function(e){if(e.entries.length){var t=e.entries.sort((function(e,t){return t.duration-e.duration||t.processingEnd-t.processingStart-(e.processingEnd-e.processingStart)}))[0];e.attribution={eventTarget:$(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:z(t.startTime)}}else e.attribution={}}(t),e(t)}),t)}((function(e){return q(e)}),a.reportOptions.inp),a.isResourceTiming&&S("resource",je),a.isElementTiming&&S("element",Oe)},Ie=function(e){var t="usageDetails"in e?e.usageDetails:{};R("storageEstimate",{quota:j(e.quota),usage:j(e.usage),caches:j(t.caches),indexedDB:j(t.indexedDB),serviceWorker:j(t.serviceWorkerRegistrations)})},Pe={finalMarkToStepsMap:{},startMarkToStepsMap:{},active:{},navigationSteps:{}},Me=function(e){delete Pe.active[e]},Be=function(){return Pe.navigationSteps},Ce=function(e){var t;return null!==(t=Be()[e])&&void 0!==t?t:{}},De=function(e,t,n){var r="step."+e,i=u.getEntriesByName(p+t).length>0;if(u.getEntriesByName(p+n).length>0&&a.steps){var o=A[a.steps[e].threshold],s=o.maxOutlierThreshold,c=o.vitalsThresholds;if(i){var l=u.measure(r,p+t,p+n),d=l.duration;if(d<=s){var m=function(e,t){return e<=t[0]?"good":e<=t[1]?"needsImprovement":"poor"}(d,c);d>=0&&(N("userJourneyStep",d,m,{stepName:e},void 0),u.measure("step.".concat(e,"_vitals_").concat(m),{start:l.startTime+l.duration,end:l.startTime+l.duration,detail:{type:"stepVital",duration:d}}))}}}},Ae=function(){var e=Be(),t=Pe.startMarkToStepsMap,n=Object.keys(e).length;if(0===n)return{};var r={},i=n-1,a=Ce(i);if(Object.keys(a).forEach((function(e){var n,i=null!==(n=t[e])&&void 0!==n?n:[];Object.keys(i).forEach((function(e){r[e]=!0}))})),n>1){var o=Ce(i-1);Object.keys(o).forEach((function(e){var n,i=null!==(n=t[e])&&void 0!==n?n:[];Object.keys(i).forEach((function(e){r[e]=!0}))}))}return r},Le=function(){var e,t=Object.keys(Pe.navigationSteps).length;Pe.navigationSteps[t]={};var n=Ae();null===(e=a.onMarkStep)||void 0===e||e.call(a,"",Object.keys(n))},Ue=function(e){var t,n,r,i,o,s,c;if(Pe.finalMarkToStepsMap[e]){!function(e){var t=Pe.navigationSteps,n=Pe.finalMarkToStepsMap,r=Object.keys(t).length;if(0!==r){var i=r-1,a=Ce(i);if(a&&n[e]){var o=n[e];o&&Object.keys(o).forEach((function(e){if(a[e]){var n=Ce(i)||{};n[e]=!1,t[i]=n}if(r>1){var o=i-1,s=Ce(o);s[e]&&(s[e]=!1,t[o]=s)}}))}}}(e);var u=Pe.finalMarkToStepsMap[e];Object.keys(u).forEach((function(t){var n=u[t];n.forEach(Me),Promise.all(n.map((function(n){return function(e,t,n,r){return new(n||(n=Promise))((function(e,t){function i(e){try{o(r.next(e))}catch(e){t(e)}}function a(e){try{o(r.throw(e))}catch(e){t(e)}}function o(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(i,a)}o((r=r.apply(undefined,[])).next())}))}(0,0,void 0,(function(){return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}(this,(function(r){switch(r.label){case 0:return[4,De(n,t,e)];case 1:return r.sent(),[2]}}))}))}))).catch((function(){}))}))}else r=e,i=Pe.navigationSteps,o=Object.keys(i).length,(c=Ce(s=(o>0?o:1)-1)||[])[r]=!0,i[s]=c,function(e){var t,n=null!==(t=Pe.startMarkToStepsMap[e])&&void 0!==t?t:[];Object.keys(n).forEach((function(e){Pe.active[e]||(Pe.active[e]=!0)}))}(e);if(a.enableNavigationTracking){var l=Ae();null===(t=a.onMarkStep)||void 0===t||t.call(a,e,Object.keys(l))}else null===(n=a.onMarkStep)||void 0===n||n.call(a,e,Object.keys(Pe.active))},Re=function(e){u.mark(p+e),Ue(e)},qe=function(e){0===u.getEntriesByName(p+e).length&&(u.mark(p+e),Ue(e))},Fe=0,ze=function(){function e(e){if(void 0===e&&(e={}),this.v="9.0.0-rc.3",a.analyticsTracker=e.analyticsTracker,a.isResourceTiming=!!e.resourceTiming,a.isElementTiming=!!e.elementTiming,a.maxTime=e.maxMeasureTime||a.maxTime,a.reportOptions=e.reportOptions||a.reportOptions,a.steps=e.steps,a.onMarkStep=e.onMarkStep,a.enableNavigationTracking=e.enableNavigationTracking,m()){"PerformanceObserver"in o&&Ne(),void 0!==document.hidden&&document.addEventListener("visibilitychange",_);var t=function(){if(!m())return{};var e=u.getEntriesByType("navigation")[0];if(!e)return{};var t=e.responseStart,n=e.responseEnd;return{fetchTime:n-e.fetchStart,workerTime:e.workerStart>0?n-e.workerStart:0,totalTime:n-e.requestStart,downloadTime:n-t,timeToFirstByte:t-e.requestStart,headerSize:e.transferSize-e.encodedBodySize||0,dnsLookupTime:e.domainLookupEnd-e.domainLookupStart,redirectTime:e.redirectEnd-e.redirectStart}}();R("navigationTiming",t),t.redirectTime&&q({attribution:{},name:"RT",rating:U("RT",t.redirectTime),value:t.redirectTime}),R("networkInformation",function(){if("connection"in c){var e=c.connection;return"object"!=typeof e?{}:(f=e.effectiveType,v=!!e.saveData,{downlink:e.downlink,effectiveType:e.effectiveType,rtt:e.rtt,saveData:!!e.saveData})}return{}}()),c&&c.storage&&"function"==typeof c.storage.estimate&&c.storage.estimate().then(Ie),a.steps&&a.steps&&(Pe.startMarkToStepsMap={},Pe.finalMarkToStepsMap={},Pe.active={},Pe.navigationSteps={},Object.entries(a.steps).forEach((function(e){var t,n,r=e[0],i=e[1].marks,a=i[0],o=i[1],s=null!==(n=Pe.startMarkToStepsMap[a])&&void 0!==n?n:{};if(s[r]=!0,Pe.startMarkToStepsMap[a]=s,Pe.finalMarkToStepsMap[o]){var c=Pe.finalMarkToStepsMap[o][a]||[];c.push(r),Pe.finalMarkToStepsMap[o][a]=c}else Pe.finalMarkToStepsMap[o]=((t={})[a]=[r],t)})))}}return e.prototype.start=function(e){m()&&!g[e]&&(g[e]=!0,u.mark("mark_".concat(e,"_start")))},e.prototype.end=function(e,t,n){if(void 0===t&&(t={}),void 0===n&&(n=!0),m()&&g[e]){u.mark("mark_".concat(e,"_end")),delete g[e];var r=function(e){u.measure(e,"mark_".concat(e,"_start"),"mark_".concat(e,"_end"));var t=u.getEntriesByName(e).pop();return t&&"measure"===t.entryType?t.duration:-1}(e);n&&R(e,O(r),t)}},e.prototype.endPaint=function(e,t){var n=this;setTimeout((function(){n.end(e,t)}))},e.prototype.clear=function(e){delete g[e],u.clearMarks&&(u.clearMarks("mark_".concat(e,"_start")),u.clearMarks("mark_".concat(e,"_end")))},e.prototype.markNTBT=function(){var e=this;this.start("ntbt"),y.value=0,clearTimeout(Fe),Fe=setTimeout((function(){e.end("ntbt",{},!1),q({attribution:{},name:"NTBT",rating:U("NTBT",y.value),value:y.value}),y.value=0}),2e3)},e}()},426:(e,t)=>{"use strict";Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.iterator;var n={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},r=Object.assign,i={};function a(e,t,r){this.props=e,this.context=t,this.refs=i,this.updater=r||n}function o(){}function s(e,t,r){this.props=e,this.context=t,this.refs=i,this.updater=r||n}a.prototype.isReactComponent={},a.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)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,e,t,"setState")},a.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},o.prototype=a.prototype;var c=s.prototype=new o;c.constructor=s,r(c,a.prototype),c.isPureReactComponent=!0;Array.isArray,Object.prototype.hasOwnProperty;var u={current:null};t.useCallback=function(e,t){return u.current.useCallback(e,t)},t.useEffect=function(e,t){return u.current.useEffect(e,t)},t.useRef=function(e){return u.current.useRef(e)}},784:(e,t,n)=>{"use strict";e.exports=n(426)},353:function(e,t,n){var r;!function(i,a){"use strict";var o="function",s="undefined",c="object",u="string",l="major",d="model",p="name",m="type",f="vendor",v="version",g="architecture",b="console",h="mobile",w="tablet",y="smarttv",T="wearable",k="embedded",_="Amazon",S="Apple",E="ASUS",x="BlackBerry",O="Browser",j="Chrome",N="Firefox",I="Google",P="Huawei",M="LG",B="Microsoft",C="Motorola",D="Opera",A="Samsung",L="Sharp",U="Sony",R="Xiaomi",q="Zebra",F="Facebook",z="Chromium OS",K="Mac OS",$=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},Q=function(e,t){return typeof e===u&&-1!==W(t).indexOf(W(e))},W=function(e){return e.toLowerCase()},H=function(e,t){if(typeof e===u)return e=e.replace(/^\\s\\s*/,""),typeof t===s?e:e.substring(0,350)},V=function(e,t){for(var n,r,i,s,u,l,d=0;d<t.length&&!u;){var p=t[d],m=t[d+1];for(n=r=0;n<p.length&&!u&&p[n];)if(u=p[n++].exec(e))for(i=0;i<m.length;i++)l=u[++r],typeof(s=m[i])===c&&s.length>0?2===s.length?typeof s[1]==o?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:3===s.length?typeof s[1]!==o||s[1].exec&&s[1].test?this[s[0]]=l?l.replace(s[1],s[2]):a:this[s[0]]=l?s[1].call(this,l,s[2]):a:4===s.length&&(this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):a):this[s]=l||a;d+=2}},J=function(e,t){for(var n in t)if(typeof t[n]===c&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(Q(t[n][r],e))return"?"===n?a:n}else if(Q(t[n],e))return"?"===n?a:n;return e},X={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},G={browser:[[/\\b(?:crmo|crios)\\/([\\w\\.]+)/i],[v,[p,"Chrome"]],[/edg(?:e|ios|a)?\\/([\\w\\.]+)/i],[v,[p,"Edge"]],[/(opera mini)\\/([-\\w\\.]+)/i,/(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i,/(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i],[p,v],[/opios[\\/ ]+([\\w\\.]+)/i],[v,[p,D+" Mini"]],[/\\bopr\\/([\\w\\.]+)/i],[v,[p,D]],[/(kindle)\\/([\\w\\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i,/(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i,/(?:ms|\\()(ie) ([\\w\\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,/(heytap|ovi)browser\\/([\\d\\.]+)/i,/(weibo)__([\\d\\.]+)/i],[p,v],[/(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i],[v,[p,"UC"+O]],[/microm.+\\bqbcore\\/([\\w\\.]+)/i,/\\bqbcore\\/([\\w\\.]+).+microm/i],[v,[p,"WeChat(Win) Desktop"]],[/micromessenger\\/([\\w\\.]+)/i],[v,[p,"WeChat"]],[/konqueror\\/([\\w\\.]+)/i],[v,[p,"Konqueror"]],[/trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i],[v,[p,"IE"]],[/ya(?:search)?browser\\/([\\w\\.]+)/i],[v,[p,"Yandex"]],[/(avast|avg)\\/([\\w\\.]+)/i],[[p,/(.+)/,"$1 Secure "+O],v],[/\\bfocus\\/([\\w\\.]+)/i],[v,[p,N+" Focus"]],[/\\bopt\\/([\\w\\.]+)/i],[v,[p,D+" Touch"]],[/coc_coc\\w+\\/([\\w\\.]+)/i],[v,[p,"Coc Coc"]],[/dolfin\\/([\\w\\.]+)/i],[v,[p,"Dolphin"]],[/coast\\/([\\w\\.]+)/i],[v,[p,D+" Coast"]],[/miuibrowser\\/([\\w\\.]+)/i],[v,[p,"MIUI "+O]],[/fxios\\/([-\\w\\.]+)/i],[v,[p,N]],[/\\bqihu|(qi?ho?o?|360)browser/i],[[p,"360 "+O]],[/(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i],[[p,/(.+)/,"$1 "+O],v],[/(comodo_dragon)\\/([\\w\\.]+)/i],[[p,/_/g," "],v],[/(electron)\\/([\\w\\.]+) safari/i,/(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i],[p,v],[/(metasr)[\\/ ]?([\\w\\.]+)/i,/(lbbrowser)/i,/\\[(linkedin)app\\]/i],[p],[/((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i],[[p,F],v],[/(kakao(?:talk|story))[\\/ ]([\\w\\.]+)/i,/(naver)\\(.*?(\\d+\\.[\\w\\.]+).*\\)/i,/safari (line)\\/([\\w\\.]+)/i,/\\b(line)\\/([\\w\\.]+)\\/iab/i,/(chromium|instagram)[\\/ ]([-\\w\\.]+)/i],[p,v],[/\\bgsa\\/([\\w\\.]+) .*safari\\//i],[v,[p,"GSA"]],[/musical_ly(?:.+app_?version\\/|_)([\\w\\.]+)/i],[v,[p,"TikTok"]],[/headlesschrome(?:\\/([\\w\\.]+)| )/i],[v,[p,j+" Headless"]],[/ wv\\).+(chrome)\\/([\\w\\.]+)/i],[[p,j+" WebView"],v],[/droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i],[v,[p,"Android "+O]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i],[p,v],[/version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i],[v,[p,"Mobile Safari"]],[/version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i],[v,p],[/webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i],[p,[v,J,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\\/([\\w\\.]+)/i],[p,v],[/(navigator|netscape\\d?)\\/([-\\w\\.]+)/i],[[p,"Netscape"],v],[/mobile vr; rv:([\\w\\.]+)\\).+firefox/i],[v,[p,N+" Reality"]],[/ekiohf.+(flow)\\/([\\w\\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,/(firefox)\\/([\\w\\.]+)/i,/(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,/(links) \\(([\\w\\.]+)/i,/panasonic;(viera)/i],[p,v],[/(cobalt)\\/([\\w\\.]+)/i],[p,[v,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,W]],[/((?:i[346]|x)86)[;\\)]/i],[[g,"ia32"]],[/\\b(aarch64|arm(v?8e?l?|_?64))\\b/i],[[g,"arm64"]],[/\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i],[[g,/ower/,"",W]],[/(sun4\\w)[;\\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i],[[g,W]]],device:[[/\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[f,A],[m,w]],[/\\b((?:s[cgp]h|gt|sm)-\\w+|sc[g-]?[\\d]+a?|galaxy nexus)/i,/samsung[- ]([-\\w]+)/i,/sec-(sgh\\w+)/i],[d,[f,A],[m,h]],[/(?:\\/|\\()(ip(?:hone|od)[\\w, ]*)(?:\\/|;)/i],[d,[f,S],[m,h]],[/\\((ipad);[-\\w\\),; ]+apple/i,/applecoremedia\\/[\\w\\.]+ \\((ipad)/i,/\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i],[d,[f,S],[m,w]],[/(macintosh);/i],[d,[f,S]],[/\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i],[d,[f,L],[m,h]],[/\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i],[d,[f,P],[m,w]],[/(?:huawei|honor)([-\\w ]+)[;\\)]/i,/\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i],[d,[f,P],[m,h]],[/\\b(poco[\\w ]+)(?: bui|\\))/i,/\\b; (\\w+) build\\/hm\\1/i,/\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i,/\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i,/\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i],[[d,/_/g," "],[f,R],[m,h]],[/\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i],[[d,/_/g," "],[f,R],[m,w]],[/; (\\w+) bui.+ oppo/i,/\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i],[d,[f,"OPPO"],[m,h]],[/vivo (\\w+)(?: bui|\\))/i,/\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i],[d,[f,"Vivo"],[m,h]],[/\\b(rmx[12]\\d{3})(?: bui|;|\\))/i],[d,[f,"Realme"],[m,h]],[/\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,/\\bmot(?:orola)?[- ](\\w*)/i,/((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i],[d,[f,C],[m,h]],[/\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i],[d,[f,C],[m,w]],[/((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[f,M],[m,w]],[/(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,/\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,/\\blg-?([\\d\\w]+) bui/i],[d,[f,M],[m,h]],[/(ideatab[-\\w ]+)/i,/lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i],[d,[f,"Lenovo"],[m,w]],[/(?:maemo|nokia).*(n900|lumia \\d+)/i,/nokia[-_ ]?([-\\w\\.]*)/i],[[d,/_/g," "],[f,"Nokia"],[m,h]],[/(pixel c)\\b/i],[d,[f,I],[m,w]],[/droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i],[d,[f,I],[m,h]],[/droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i],[d,[f,U],[m,h]],[/sony tablet [ps]/i,/\\b(?:sony)?sgp\\w+(?: bui|\\))/i],[[d,"Xperia Tablet"],[f,U],[m,w]],[/ (kb2005|in20[12]5|be20[12][59])\\b/i,/(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i],[d,[f,"OnePlus"],[m,h]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\\))/i,/(kf[a-z]+)( bui|\\)).+silk\\//i],[d,[f,_],[m,w]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i],[[d,/(.+)/g,"Fire Phone $1"],[f,_],[m,h]],[/(playbook);[-\\w\\),; ]+(rim)/i],[d,f,[m,w]],[/\\b((?:bb[a-f]|st[hv])100-\\d)/i,/\\(bb10; (\\w+)/i],[d,[f,x],[m,h]],[/(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i],[d,[f,E],[m,w]],[/ (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i],[d,[f,E],[m,h]],[/(nexus 9)/i],[d,[f,"HTC"],[m,w]],[/(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i,/(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\\.))|sony(?!-bra))[-_ ]?([-\\w]*)/i],[f,[d,/_/g," "],[m,h]],[/droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i],[d,[f,"Acer"],[m,w]],[/droid.+; (m[1-5] note) bui/i,/\\bmz-([-\\w]{2,})/i],[d,[f,"Meizu"],[m,h]],[/(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,/(hp) ([\\w ]+\\w)/i,/(asus)-?(\\w+)/i,/(microsoft); (lumia[\\w ]+)/i,/(lenovo)[-_ ]?([-\\w]+)/i,/(jolla)/i,/(oppo) ?([\\w ]+) bui/i],[f,d,[m,h]],[/(kobo)\\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\\/([\\w\\.]+)/i,/(nook)[\\w ]+build\\/(\\w+)/i,/(dell) (strea[kpr\\d ]*[\\dko])/i,/(le[- ]+pan)[- ]+(\\w{1,9}) bui/i,/(trinity)[- ]*(t\\d{3}) bui/i,/(gigaset)[- ]+(q\\w{1,9}) bui/i,/(vodafone) ([\\w ]+)(?:\\)| bui)/i],[f,d,[m,w]],[/(surface duo)/i],[d,[f,B],[m,w]],[/droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i],[d,[f,"Fairphone"],[m,h]],[/(u304aa)/i],[d,[f,"AT&T"],[m,h]],[/\\bsie-(\\w*)/i],[d,[f,"Siemens"],[m,h]],[/\\b(rct\\w+) b/i],[d,[f,"RCA"],[m,w]],[/\\b(venue[\\d ]{2,7}) b/i],[d,[f,"Dell"],[m,w]],[/\\b(q(?:mv|ta)\\w+) b/i],[d,[f,"Verizon"],[m,w]],[/\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i],[d,[f,"Barnes & Noble"],[m,w]],[/\\b(tm\\d{3}\\w+) b/i],[d,[f,"NuVision"],[m,w]],[/\\b(k88) b/i],[d,[f,"ZTE"],[m,w]],[/\\b(nx\\d{3}j) b/i],[d,[f,"ZTE"],[m,h]],[/\\b(gen\\d{3}) b.+49h/i],[d,[f,"Swiss"],[m,h]],[/\\b(zur\\d{3}) b/i],[d,[f,"Swiss"],[m,w]],[/\\b((zeki)?tb.*\\b) b/i],[d,[f,"Zeki"],[m,w]],[/\\b([yr]\\d{2}) b/i,/\\b(dragon[- ]+touch |dt)(\\w{5}) b/i],[[f,"Dragon Touch"],d,[m,w]],[/\\b(ns-?\\w{0,9}) b/i],[d,[f,"Insignia"],[m,w]],[/\\b((nxa|next)-?\\w{0,9}) b/i],[d,[f,"NextBook"],[m,w]],[/\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],d,[m,h]],[/\\b(lvtel\\-)?(v1[12]) b/i],[[f,"LvTel"],d,[m,h]],[/\\b(ph-1) /i],[d,[f,"Essential"],[m,h]],[/\\b(v(100md|700na|7011|917g).*\\b) b/i],[d,[f,"Envizen"],[m,w]],[/\\b(trio[-\\w\\. ]+) b/i],[d,[f,"MachSpeed"],[m,w]],[/\\btu_(1491) b/i],[d,[f,"Rotor"],[m,w]],[/(shield[\\w ]+) b/i],[d,[f,"Nvidia"],[m,w]],[/(sprint) (\\w+)/i],[f,d,[m,h]],[/(kin\\.[onetw]{3})/i],[[d,/\\./g," "],[f,B],[m,h]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i],[d,[f,q],[m,w]],[/droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i],[d,[f,q],[m,h]],[/smart-tv.+(samsung)/i],[f,[m,y]],[/hbbtv.+maple;(\\d+)/i],[[d,/^/,"SmartTV"],[f,A],[m,y]],[/(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i],[[f,M],[m,y]],[/(apple) ?tv/i],[f,[d,S+" TV"],[m,y]],[/crkey/i],[[d,j+"cast"],[f,I],[m,y]],[/droid.+aft(\\w)( bui|\\))/i],[d,[f,_],[m,y]],[/\\(dtv[\\);].+(aquos)/i,/(aquos-tv[\\w ]+)\\)/i],[d,[f,L],[m,y]],[/(bravia[\\w ]+)( bui|\\))/i],[d,[f,U],[m,y]],[/(mitv-\\w{5}) bui/i],[d,[f,R],[m,y]],[/Hbbtv.*(technisat) (.*);/i],[f,d,[m,y]],[/\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i,/hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w\\+ ]*; *([\\w\\d][^;]*);([^;]*)/i],[[f,H],[d,H],[m,y]],[/\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i],[[m,y]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,d,[m,b]],[/droid.+; (shield) bui/i],[d,[f,"Nvidia"],[m,b]],[/(playstation [345portablevi]+)/i],[d,[f,U],[m,b]],[/\\b(xbox(?: one)?(?!; xbox))[\\); ]/i],[d,[f,B],[m,b]],[/((pebble))app/i],[f,d,[m,T]],[/(watch)(?: ?os[,\\/]|\\d,\\d\\/)[\\d\\.]+/i],[d,[f,S],[m,T]],[/droid.+; (glass) \\d/i],[d,[f,I],[m,T]],[/droid.+; (wt63?0{2,3})\\)/i],[d,[f,q],[m,T]],[/(quest( 2| pro)?)/i],[d,[f,F],[m,T]],[/(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i],[f,[m,k]],[/(aeobc)\\b/i],[d,[f,_],[m,k]],[/droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i],[d,[m,h]],[/droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i],[d,[m,w]],[/\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i],[[m,w]],[/(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i],[[m,h]],[/(android[-\\w\\. ]{0,9});.+buil/i],[d,[f,"Generic"]]],engine:[[/windows.+ edge\\/([\\w\\.]+)/i],[v,[p,"EdgeHTML"]],[/webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i],[v,[p,"Blink"]],[/(presto)\\/([\\w\\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i,/ekioh(flow)\\/([\\w\\.]+)/i,/(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i,/(icab)[\\/ ]([23]\\.[\\d\\.]+)/i,/\\b(libweb)/i],[p,v],[/rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i],[v,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,v],[/(windows) nt 6\\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i,/(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i],[p,[v,J,X]],[/(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i],[[p,"Windows"],[v,J,X]],[/ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i,/ios;fbsv\\/([\\d\\.]+)/i,/cfnetwork\\/.+darwin/i],[[v,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\\w\\. ]*)/i,/(macintosh|mac_powerpc\\b)(?!.+haiku)/i],[[p,K],[v,/_/g,"."]],[/droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i],[v,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,/(blackberry)\\w*\\/([\\w\\.]*)/i,/(tizen|kaios)[\\/ ]([\\w\\.]+)/i,/\\((series40);/i],[p,v],[/\\(bb(10);/i],[v,[p,x]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i],[v,[p,"Symbian"]],[/mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i],[v,[p,N+" OS"]],[/web0s;.+rt(tv)/i,/\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i],[v,[p,"webOS"]],[/watch(?: ?os[,\\/]|\\d,\\d\\/)([\\d\\.]+)/i],[v,[p,"watchOS"]],[/crkey\\/([\\d\\.]+)/i],[v,[p,j+"cast"]],[/(cros) [\\w]+(?:\\)| ([\\w\\.]+)\\b)/i],[[p,z],v],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\\/(\\d+\\.[\\w\\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\\);]+)/i,/\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i,/(mint)[\\/\\(\\) ]?(\\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,/(hurd|linux) ?([\\w\\.]*)/i,/(gnu) ?([\\w\\.]*)/i,/\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i,/(haiku) (\\w+)/i],[p,v],[/(sunos) ?([\\w\\.\\d]*)/i],[[p,"Solaris"],v],[/((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i,/(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i,/\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\\w\\.]*)/i],[p,v]]},Z=function(e,t){if(typeof e===c&&(t=e,e=a),!(this instanceof Z))return new Z(e,t).getResult();var n=typeof i!==s&&i.navigator?i.navigator:a,r=e||(n&&n.userAgent?n.userAgent:""),b=n&&n.userAgentData?n.userAgentData:a,y=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(G,t):G,T=n&&n.userAgent==r;return this.getBrowser=function(){var e,t={};return t[p]=a,t[v]=a,V.call(t,r,y.browser),t[l]=typeof(e=t[v])===u?e.replace(/[^\\d\\.]/g,"").split(".")[0]:a,T&&n&&n.brave&&typeof n.brave.isBrave==o&&(t[p]="Brave"),t},this.getCPU=function(){var e={};return e[g]=a,V.call(e,r,y.cpu),e},this.getDevice=function(){var e={};return e[f]=a,e[d]=a,e[m]=a,V.call(e,r,y.device),T&&!e[m]&&b&&b.mobile&&(e[m]=h),T&&"Macintosh"==e[d]&&n&&typeof n.standalone!==s&&n.maxTouchPoints&&n.maxTouchPoints>2&&(e[d]="iPad",e[m]=w),e},this.getEngine=function(){var e={};return e[p]=a,e[v]=a,V.call(e,r,y.engine),e},this.getOS=function(){var e={};return e[p]=a,e[v]=a,V.call(e,r,y.os),T&&!e[p]&&b&&"Unknown"!=b.platform&&(e[p]=b.platform.replace(/chrome os/i,z).replace(/macos/i,K)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(e){return r=typeof e===u&&e.length>350?H(e,350):e,this},this.setUA(r),this};Z.VERSION="1.0.35",Z.BROWSER=$([p,v,l]),Z.CPU=$([g]),Z.DEVICE=$([d,f,m,b,h,y,w,T,k]),Z.ENGINE=Z.OS=$([p,v]),typeof t!==s?(e.exports&&(t=e.exports=Z),t.UAParser=Z):n.amdO?(r=function(){return Z}.call(t,n,t,e))===a||(e.exports=r):typeof i!==s&&(i.UAParser=Z);var Y=typeof i!==s&&(i.jQuery||i.Zepto);if(Y&&!Y.ua){var ee=new Z;Y.ua=ee.getResult(),Y.ua.get=function(){return ee.getUA()},Y.ua.set=function(e){ee.setUA(e);var t=ee.getResult();for(var n in t)Y.ua[n]=t[n]}}}("object"==typeof window?window:this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{ActionType:()=>f,AmplitudePlatformName:()=>g,AnalyticsEventImportance:()=>l,AnalyticsQueries:()=>e,AuthStatus:()=>b,ComponentType:()=>m,IThresholdTier:()=>Jt,MetricType:()=>d,PlatformName:()=>v,SessionActions:()=>h,SessionAutomatedEvents:()=>w,SessionRank:()=>y,SubjectType:()=>p,UserTypeCommerce:()=>c,UserTypeInsto:()=>i,UserTypeRetail:()=>t,UserTypeRetailBusinessBanking:()=>s,UserTypeRetailEmployeeInternal:()=>a,UserTypeRetailEmployeePersonal:()=>o,UserTypeWallet:()=>u,automatedEvents:()=>xn,automatedMappingConfig:()=>In,clearMarkEntry:()=>Vn,clearPerformanceMarkEntries:()=>Xn,config:()=>A,createEventConfig:()=>On,createNewSpan:()=>Ln,createNewTrace:()=>Un,device:()=>W,endPerfMark:()=>Jn,exposeExperiment:()=>wn,flushQueue:()=>or,generateUUID:()=>V,getAnalyticsHeaders:()=>sr,getReferrerData:()=>le,getTracingHeaders:()=>An,getTracingId:()=>Dn,getUrlHostname:()=>pe,getUrlParams:()=>me,getUrlPathname:()=>fe,getUserContext:()=>ar,identify:()=>Tn,identifyFlow:()=>xe,identity:()=>H,identityFlow:()=>Se,incrementUjNavigation:()=>an,init:()=>yn,initNextJsTrackPageview:()=>_n,initTrackPageview:()=>kn,isEventKeyFormatValid:()=>we,isSessionEnded:()=>pt,location:()=>re,logEvent:()=>$t,logMetric:()=>Ht,logPageView:()=>on,logTrace:()=>Rn,markNTBT:()=>tn,markStep:()=>nn,markStepOnce:()=>rn,onVisibilityChange:()=>ln,optIn:()=>En,optOut:()=>Sn,perfMark:()=>Wn,persistentData:()=>oe,postMessage:()=>K,recordSessionDuration:()=>pn,removeFromIdentifyFlow:()=>Ee,savePersistentData:()=>st,sendScheduledEvents:()=>Bt,setBreadcrumbs:()=>ie,setConfig:()=>U,setLocation:()=>ae,setPagePath:()=>ve,setPageview:()=>Kt,setPersistentData:()=>se,setSessionStart:()=>dt,setTime:()=>Ue,startPerfMark:()=>Hn,timeStone:()=>Le,useEventLogger:()=>Yn,useLogEventOnMount:()=>tr,usePerformanceMarks:()=>rr});let e=function(e){return e.fbclid="fbclid",e.gclid="gclid",e.msclkid="msclkid",e.ptclid="ptclid",e.ttclid="ttclid",e.utm_source="utm_source",e.utm_medium="utm_medium",e.utm_campaign="utm_campaign",e.utm_term="utm_term",e.utm_content="utm_content",e}({});const t=0,i=1,a=2,o=3,s=4,c=5,u=6;let l=function(e){return e.low="low",e.high="high",e}({}),d=function(e){return e.count="count",e.rate="rate",e.gauge="gauge",e.distribution="distribution",e.histogram="histogram",e}({}),p=function(e){return e.commerce_merchant="commerce_merchant",e.device="device",e.edp_fingerprint_id="edp_fingerprint_id",e.nft_user="nft_user",e.user="user",e.wallet_user="wallet_user",e.uuid="user_uuid",e}({}),m=function(e){return e.unknown="unknown",e.banner="banner",e.button="button",e.card="card",e.chart="chart",e.content_script="content_script",e.dropdown="dropdown",e.link="link",e.page="page",e.modal="modal",e.table="table",e.search_bar="search_bar",e.service_worker="service_worker",e.text="text",e.text_input="text_input",e.tray="tray",e.checkbox="checkbox",e.icon="icon",e}({}),f=function(e){return e.unknown="unknown",e.blur="blur",e.click="click",e.change="change",e.dismiss="dismiss",e.focus="focus",e.hover="hover",e.select="select",e.measurement="measurement",e.move="move",e.process="process",e.render="render",e.scroll="scroll",e.view="view",e.search="search",e.keyPress="keyPress",e}({}),v=function(e){return e.unknown="unknown",e.web="web",e.android="android",e.ios="ios",e.mobile_web="mobile_web",e.tablet_web="tablet_web",e.server="server",e.windows="windows",e.macos="macos",e.extension="extension",e}({}),g=function(e){return e.web="Web",e.ios="iOS",e.android="Android",e}({}),b=function(e){return e[e.notLoggedIn=0]="notLoggedIn",e[e.loggedIn=1]="loggedIn",e}({}),h=function(e){return e.ac="ac",e.af="af",e.ah="ah",e.al="al",e.am="am",e.ar="ar",e.as="as",e}({}),w=function(e){return e.pv="pv",e}({}),y=function(e){return e.xs="xs",e.s="s",e.m="m",e.l="l",e.xl="xl",e.xxl="xxl",e}({});const T="https://analytics-service-dev.cbhq.net",k=3e5,_=5e3,S="analytics-db",E="experiment-exposure-db",x="Analytics SDK:",O=Object.values(e),j="pageview",N="session_duration",I={navigationTiming:{eventName:"perf_navigation_timing"},redirectTime:{eventName:"perf_redirect_time"},RT:{eventName:"perf_redirect_time"},TTFB:{eventName:"perf_time_to_first_byte"},networkInformation:{eventName:"perf_network_information"},storageEstimate:{eventName:"perf_storage_estimate"},FCP:{eventName:"perf_first_contentful_paint"},FID:{eventName:"perf_first_input_delay"},LCP:{eventName:"perf_largest_contentful_paint"},CLS:{eventName:"perf_cumulative_layout_shift"},TBT:{eventName:"perf_total_blocking_time"},NTBT:{eventName:"perf_navigation_total_blocking_time"},INP:{eventName:"perf_interact_to_next_paint"},ET:{eventName:"perf_element_timing"},userJourneyStep:{eventName:"perf_user_journey_step"}},P="1",M="web";function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(this,arguments)}const C=/^(https?:\\/\\/)/;function D(e){return{eventsEndpoint:e+"/amp",metricsEndPoint:e+"/metrics",exposureEndpoint:e+"/track-exposures",tracesEndpoint:e+"/traces"}}const A=B({authCookie:"logged_in",amplitudeApiKey:"",batchEventsPeriod:_,batchEventsThreshold:30,batchMetricsPeriod:_,batchMetricsThreshold:30,batchTracesPeriod:_,batchTracesThreshold:30,headers:{},interactionManager:null,isAlwaysAuthed:!1,isProd:!1,isInternalApplication:!1,onError:(e,t)=>{console.error(x,e,t)},platform:v.unknown,projectName:"",ricTimeoutScheduleEvent:1e3,ricTimeoutSetDevice:500,showDebugLogging:!1,trackUserId:!1,version:null,apiEndpoint:T},D(T),{steps:{}}),L=[].reduce(((e,t)=>n=>e(t(n))),(e=>{if(!e.isProd)return e.isInternalApplication?(e.apiEndpoint="https://analytics-service-internal-dev.cbhq.net",B({},e,D(e.apiEndpoint))):e;const t=(e=>e.apiEndpoint?C.test(e.apiEndpoint)?e.apiEndpoint:`https://${e.apiEndpoint}`:e.isInternalApplication?"https://analytics-service-internal.cbhq.net":"https://as.coinbase.com")(e);return B({},e,{apiEndpoint:t},D(t))})),U=e=>{const{batchEventsThreshold:t,batchMetricsThreshold:n,batchTracesThreshold:r}=e,i=[t,n,r];for(const e of i)if((e||0)>30){console.warn("You are setting the threshhold for the batch limit to be greater than 30. This may cause request overload.");break}Object.assign(A,L(e))},R=[v.web,v.mobile_web,v.tablet_web];function q(){return"android"===A.platform}function F(){return"ios"===A.platform}function z(){return R.includes(A.platform)}function K(e){if(z()&&navigator&&"serviceWorker"in navigator&&navigator.serviceWorker.controller)try{navigator.serviceWorker.controller.postMessage(e)}catch(e){e instanceof Error&&A.onError(e)}}var $=n(353),Q=n.n($);const W={amplitudeOSName:null,amplitudeOSVersion:null,amplitudeDeviceModel:null,amplitudePlatform:null,browserName:null,browserMajor:null,osName:null,userAgent:null,width:null,height:null},H={countryCode:null,deviceId:null,device_os:null,isOptOut:!1,languageCode:null,locale:null,jwt:null,session_lcc_id:null,userAgent:null,userId:null},V=e=>e?(e^16*Math.random()>>e/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,V),J=()=>A.isAlwaysAuthed||!!H.userId,X=()=>{const e={};return H.countryCode&&(e.country_code=H.countryCode),e},G=()=>{const{platform:e}=A;if(e===v.web)switch(!0){case window.matchMedia("(max-width: 560px)").matches:return v.mobile_web;case window.matchMedia("(max-width: 1024px, min-width: 561px)").matches:return v.tablet_web}return e},Z=()=>{var e,t,n,r,i;z()?("requestIdleCallback"in window?window.requestIdleCallback(ne,{timeout:A.ricTimeoutSetDevice}):ne(),W.amplitudePlatform=g.web,W.userAgent=(null==(e=window)||null==(e=e.navigator)?void 0:e.userAgent)||null,ee({height:null!=(t=null==(n=window)?void 0:n.innerHeight)?t:null,width:null!=(r=null==(i=window)?void 0:i.innerWidth)?r:null})):F()?(W.amplitudePlatform=g.ios,W.userAgent=H.userAgent,W.userAgent&&ne()):q()&&(W.userAgent=H.userAgent,W.amplitudePlatform=g.android,W.userAgent&&ne())},Y=e=>{Object.assign(H,e),z()&&K({identity:{isAuthed:!!H.userId,locale:H.locale||null}})},ee=e=>{W.height=e.height,W.width=e.width},te=()=>{U({platform:G()}),z()&&K({config:{platform:A.platform}})},ne=()=>{var e;performance.mark&&performance.mark("ua_parser_start");const t=new(Q())(null!=(e=W.userAgent)?e:"").getResult();W.browserName=t.browser.name||null,W.browserMajor=t.browser.major||null,W.osName=t.os.name||null,W.amplitudeOSName=W.browserName,W.amplitudeOSVersion=W.browserMajor,W.amplitudeDeviceModel=W.osName,K({device:{browserName:W.browserName,osName:W.osName}}),performance.mark&&(performance.mark("ua_parser_end"),performance.measure("ua_parser","ua_parser_start","ua_parser_end"))},re={breadcrumbs:[],initialUAAData:{},pageKey:"",pageKeyRegex:{},pagePath:"",prevPageKey:"",prevPagePath:""};function ie(e){Object.assign(re,{breadcrumbs:e})}function ae(e){Object.assign(re,e)}const oe={eventId:0,sequenceNumber:0,sessionId:0,lastEventTime:0,sessionStart:0,sessionUUID:null,userId:null,ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0};function se(e){Object.assign(oe,e)}function ce(){var e,t;return null!=(e=null==(t=document)?void 0:t.referrer)?e:""}function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ue.apply(this,arguments)}const le=()=>{const e=ce();if(!e)return{};const t=new URL(e);return t.hostname===pe()?{}:{referrer:e,referring_domain:t.hostname}},de=()=>{const e=new URLSearchParams(me()),t={};return O.forEach((n=>{e.has(n)&&(t[n]=(e.get(n)||"").toLowerCase())})),t},pe=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.hostname)||""},me=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.search)||""},fe=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.pathname)||""},ve=()=>{const e=A.overrideWindowLocation?re.pagePath:fe()+me();e&&e!==re.pagePath&&(e!==re.pagePath&&ge(),re.pagePath=e,re.pageKeyRegex&&Object.keys(re.pageKeyRegex).some((e=>{if(re.pageKeyRegex[e].test(re.pagePath))return re.pageKey=e,!0})))},ge=()=>{if(z()){const e=ce();if(!re.prevPagePath&&e){const t=new URL(e);if(t.hostname===pe())return void(re.prevPagePath=t.pathname)}}re.prevPagePath=re.pagePath,re.prevPageKey=re.pageKey},be=e=>{z()&&Object.assign(e,z()?(Object.keys(re.initialUAAData).length>0||(new URLSearchParams(me()),re.initialUAAData=ue({},(()=>{const e={};return O.forEach((t=>{oe[t]&&(e[t]=oe[t])})),e})(),de(),le())),re.initialUAAData):re.initialUAAData)},he=/^[a-zd]+(_[a-zd]+)*$/;function we(e){return he.test(e)}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ye.apply(this,arguments)}const Te=["action","component_type","component_name","context","logging_id"],ke=["num_non_hardware_accounts","ujs"],_e="ujs_",Se={};function Ee(e){e.forEach((e=>{ke.includes(e)&&delete Se[e]}))}function xe(e){var t;const n=Object.entries(e).reduce(((e,t)=>{const[n,r]=t;return!Te.includes(n)&&ke.includes(n)?we(n)?ye({},e,{[n]:r}):(A.onError(new Error("IdentityFlow property names must have snake case format"),{[n]:r}),e):e}),{});null!=(t=n.ujs)&&t.length&&(n.ujs=n.ujs.map((e=>`${_e}${e}`))),Object.assign(Se,n)}function Oe(){return A.platform!==v.unknown||(A.onError(new Error("SDK platform not initialized")),!1)}const je={eventsQueue:[],eventsScheduled:!1,metricsQueue:[],metricsScheduled:!1,tracesQueue:[],tracesScheduled:!1};function Ne(e){Object.assign(je,e)}const Ie={ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0,sqs:0},Pe={ac:20,af:5,ah:1,al:1,am:0,ar:10,as:20},Me={pv:25},Be={xs:0,s:1,m:1,l:2,xl:2,xxl:2},Ce=e=>e<15?y.xs:e<60?y.s:e<240?y.m:e<960?y.l:e<3840?y.xl:y.xxl,De=e=>{Object.assign(Ie,e)};function Ae(){return(new Date).getTime()}const Le={timeStart:Ae(),timeOnPagePath:0,timeOnPageKey:0,prevTimeOnPagePath:0,prevTimeOnPageKey:0,sessionDuration:0,sessionEnd:0,sessionStart:0,prevSessionDuration:0};function Ue(e){Object.assign(Le,e)}const Re=(e,t)=>t.some((t=>e instanceof t));let qe,Fe;const ze=new WeakMap,Ke=new WeakMap,$e=new WeakMap,Qe=new WeakMap,We=new WeakMap;let He={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return Ke.get(e);if("objectStoreNames"===t)return e.objectStoreNames||$e.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Je(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Ve(e){return"function"==typeof e?(t=e)!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(Fe||(Fe=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(Xe(this),e),Je(ze.get(this))}:function(...e){return Je(t.apply(Xe(this),e))}:function(e,...n){const r=t.call(Xe(this),e,...n);return $e.set(r,e.sort?e.sort():[e]),Je(r)}:(e instanceof IDBTransaction&&function(e){if(Ke.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",a),e.removeEventListener("abort",a)},i=()=>{t(),r()},a=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",a),e.addEventListener("abort",a)}));Ke.set(e,t)}(e),Re(e,qe||(qe=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,He):e);var t}function Je(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",a)},i=()=>{t(Je(e.result)),r()},a=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",a)}));return t.then((t=>{t instanceof IDBCursor&&ze.set(t,e)})).catch((()=>{})),We.set(t,e),t}(e);if(Qe.has(e))return Qe.get(e);const t=Ve(e);return t!==e&&(Qe.set(e,t),We.set(t,e)),t}const Xe=e=>We.get(e),Ge=["get","getKey","getAll","getAllKeys","count"],Ze=["put","add","delete","clear"],Ye=new Map;function et(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Ye.get(t))return Ye.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=Ze.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Ge.includes(n))return;const a=async function(e,...t){const a=this.transaction(e,i?"readwrite":"readonly");let o=a.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&a.done]))[0]};return Ye.set(t,a),a}var tt;tt=He,He={...tt,get:(e,t,n)=>et(e,t)||tt.get(e,t,n),has:(e,t)=>!!et(e,t)||tt.has(e,t)};const nt={isReady:!1,idbKeyval:null};function rt(e){Object.assign(nt,e)}const it={},at=async e=>{if(!nt.idbKeyval)return Promise.resolve(null);try{return await nt.idbKeyval.get(e)}catch(e){return A.onError(new Error("IndexedDB:Get:InternalError")),Promise.resolve(null)}},ot=async(e,t)=>{if(nt.idbKeyval)try{await nt.idbKeyval.set(e,t)}catch(e){A.onError(new Error("IndexedDB:Set:InternalError"))}},st=()=>{"server"!==A.platform&&(se({sessionStart:Le.sessionStart,ac:Ie.ac,af:Ie.af,ah:Ie.ah,al:Ie.al,am:Ie.am,ar:Ie.ar,as:Ie.as,pv:Ie.pv}),H.userId&&se({userId:H.userId}),ot(S,oe))},ct="rgb(5,177,105)",ut=e=>{const{metricName:t,data:n}=e,r=e.importance||l.low;if(!A.showDebugLogging||!console)return;const i=`%c ${x}`,a=`color:${ct};font-size:11px;`,o=`Importance: ${r}`;console.group(i,a,t,o),n.forEach((e=>{e.event_type?console.log(e.event_type,e):console.log(e)})),console.groupEnd()},lt=e=>{const{metricName:t,data:n}=e,r=e.importance||l.low;if(!A.showDebugLogging||!console)return;const i=`color:${ct};font-size:11px;`,a=`%c ${x}`,o=`Importance: ${r}`;console.log(a,i,t,n,o)},dt=()=>{const e=Ae();oe.sessionId&&oe.lastEventTime&&oe.sessionUUID&&!pt(e)||(oe.sessionId=e,oe.sessionUUID=V(),Ue({sessionStart:e}),lt({metricName:"Started new session:",data:{persistentData:oe,timeStone:Le}})),oe.lastEventTime=e},pt=e=>e-oe.lastEventTime>18e5;function mt(){return mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mt.apply(this,arguments)}const ft=e=>{var t;(e=>{switch(e.action){case f.click:Ie.ac+=1;break;case f.focus:Ie.af+=1;break;case f.hover:Ie.ah+=1;break;case f.move:Ie.am+=1;break;case f.scroll:Ie.al+=1;break;case f.search:Ie.ar+=1;break;case f.select:Ie.as+=1}})(t=e),t.event_type!==j?t.event_type===N&&((e=>{if(!e.session_rank)return;const t=e.session_rank;Object.values(h).forEach((e=>{Ie.sqs+=Ie[e]*Pe[e]})),Object.values(w).forEach((e=>{Ie.sqs+=Ie[e]*Me[e]})),Ie.sqs*=Be[t]})(t),Object.assign(t,Ie),De({ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0,sqs:0})):Ie.pv+=1;const n=e.event_type;delete e.event_type;const r=e.deviceId?e.deviceId:null,i=e.timestamp;return delete e.timestamp,se({eventId:oe.eventId+1}),se({sequenceNumber:oe.sequenceNumber+1}),dt(),st(),{device_id:H.deviceId||r||null,user_id:H.userId,timestamp:i,event_id:oe.eventId,session_id:oe.sessionId||-1,event_type:n,version_name:A.version||null,platform:W.amplitudePlatform,os_name:W.amplitudeOSName,os_version:W.amplitudeOSVersion,device_model:W.amplitudeDeviceModel,language:H.languageCode,event_properties:mt({},e,{session_uuid:oe.sessionUUID,height:W.height,width:W.width}),user_properties:X(),uuid:V(),library:{name:"@cbhq/client-analytics",version:"10.6.0"},sequence_number:oe.sequenceNumber,user_agent:W.userAgent||H.userAgent}},vt=e=>e.map((e=>ft(e)));function gt(){return gt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gt.apply(this,arguments)}const bt=e=>e.map((e=>(e=>{const t=e.tags||{},n=gt({authed:J()?"true":"false",platform:A.platform},t,{project_name:A.projectName,version_name:A.version||null});return{metric_name:e.metricName,page_path:e.pagePath||null,value:e.value,tags:n,type:e.metricType}})(e))),ht=e=>0!==je.metricsQueue.length&&(je.metricsQueue.length>=A.batchMetricsThreshold||(je.metricsScheduled||(je.metricsScheduled=!0,setTimeout((()=>{je.metricsScheduled=!1,e(bt(je.metricsQueue)),je.metricsQueue=[]}),A.batchMetricsPeriod)),!1)),wt=e=>0!==je.tracesQueue.length&&(je.tracesQueue.length>=A.batchTracesThreshold||(je.tracesScheduled||(je.tracesScheduled=!0,setTimeout((()=>{je.tracesScheduled=!1,e(je.tracesQueue),je.tracesQueue=[]}),A.batchTracesPeriod)),!1)),yt=e=>{var t;z()&&null!=(t=window)&&t.requestIdleCallback?window.requestIdleCallback(e,{timeout:A.ricTimeoutScheduleEvent}):(q()||F())&&A.interactionManager?A.interactionManager.runAfterInteractions(e):e()};function Tt(){return Tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Tt.apply(this,arguments)}const kt="application/x-www-form-urlencoded; charset=UTF-8",_t=e=>{const{data:t,importance:n,isJSON:r,onError:i,url:a}=e,o=r?"application/json":kt,s=n||l.low,c=r?JSON.stringify(t):new URLSearchParams(t).toString();function u(){const e=new XMLHttpRequest;e.open("POST",a,!0),Object.keys(A.headers||{}).forEach((t=>{e.setRequestHeader(t,A.headers[t])})),e.setRequestHeader("Content-Type",kt),H.jwt&&e.setRequestHeader("authorization",`Bearer ${H.jwt}`),e.send(c)}if(!z()||r||!("sendBeacon"in navigator)||s!==l.low||A.headers&&0!==Object.keys(A.headers).length)if(z()&&!r)u();else{const e=Tt({},A.headers,{"Content-Type":o});H.jwt&&(e.Authorization=`Bearer ${H.jwt}`),fetch(a,{method:"POST",mode:"no-cors",headers:e,body:c}).catch((e=>{i(e,{context:"AnalyticsSDKApiError"})}))}else{const e=new Blob([c],{type:kt});try{navigator.sendBeacon.bind(navigator)(a,e)||u()}catch(e){console.error(e),u()}}};var St=n(762),Et=n.n(St);const xt=(e,t,n)=>{const r=e||"";return Et()("2"+r+t+n)};function Ot(){return Ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ot.apply(this,arguments)}class jt extends Error{constructor(e){super(e),this.name="CircularJsonReference",this.message=e,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}}class Nt extends jt{constructor(...e){super(...e),this.name="DomReferenceInAnalyticsEvent"}}function It(){return It=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},It.apply(this,arguments)}const Pt=(e,t=l.low)=>{var n;e&&je.eventsQueue.push(e),nt.isReady&&(!A.trackUserId||H.userId?(t===l.high||(n=Mt,0!==je.eventsQueue.length&&(je.eventsQueue.length>=A.batchEventsThreshold||(je.eventsScheduled||(je.eventsScheduled=!0,setTimeout((()=>{je.eventsScheduled=!1,n(vt(je.eventsQueue)),je.eventsQueue=[]}),A.batchEventsPeriod)),0))))&&Bt():je.eventsQueue.length>10&&(A.trackUserId=!1,A.onError(new Error("userId not set in Logged-in"))))},Mt=(e,t=l.low)=>{if(H.isOptOut||0===e.length)return;let n;try{n=JSON.stringify(e)}catch(t){const r=e.map((e=>e.event_type)).join(", "),[i,a]=(e=>{try{const n=[];for(const r of e){const e=Ot({},r);r.event_properties&&(e.event_properties=Ot({},e.event_properties,{currentTarget:null,target:null,relatedTarget:null,_dispatchInstances:null,_targetInst:null,view:(t=r.event_properties.view,["string","number","boolean"].includes(typeof t)?r.event_properties.view:null)})),n.push(e)}return[!0,JSON.stringify(n)]}catch(e){return[!1,""]}var t})(e);if(!i)return void A.onError(new jt(t instanceof Error?t.message:"unknown"),{listEventType:r});n=a,A.onError(new Nt("Found DOM element reference"),{listEventType:r,stringifiedEventData:n})}const r=Ae().toString(),i=It({},{e:n,v:"2",upload_time:r},{client:A.amplitudeApiKey,checksum:xt(A.amplitudeApiKey,n,r)});_t({url:A.eventsEndpoint,data:i,importance:t,onError:A.onError}),ut({metricName:"Batch Events",data:e,importance:t})},Bt=()=>{Mt(vt(je.eventsQueue)),Ne({eventsQueue:[]})};function Ct(){return Ct=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ct.apply(this,arguments)}const Dt=Object.values(f),At=Object.values(m),Lt=e=>Dt.includes(e)?e:f.unknown,Ut=e=>At.includes(e)?e:m.unknown,Rt=(e,t,n)=>{const r={auth:J()?b.loggedIn:b.notLoggedIn,action:Lt(e),component_type:Ut(t),logging_id:n,platform:A.platform,project_name:A.projectName};return"number"==typeof H.userTypeEnum&&(r.user_type_enum=H.userTypeEnum),r},qt=e=>{const t=Ae();if(!e)return A.onError(new Error("missing logData")),Ct({},Rt(f.unknown,m.unknown),{locale:H.locale,session_lcc_id:H.session_lcc_id,timestamp:t,time_start:Le.timeStart});const n=Ct({},e,Rt(e.action,e.componentType,e.loggingId),{locale:H.locale,session_lcc_id:H.session_lcc_id,timestamp:t,time_start:Le.timeStart});return delete n.componentType,delete n.loggingId,n},Ft={blacklistRegex:[],isEnabled:!1};function zt(){return{page_key:re.pageKey,page_path:re.pagePath,prev_page_key:re.prevPageKey,prev_page_path:re.prevPagePath}}function Kt(e){Object.assign(Ft,e)}function $t(e,t,n=l.low){if(H.isOptOut)return;if(!Oe())return;const r=qt(t);!function(e){Ft.isEnabled&&(ve(),Object.assign(e,zt()))}(r),be(r),function(e){Object.keys(Se).length>0&&Object.assign(e,Se)}(r),r.has_double_fired=!1,r.event_type=e,n===l.high?Pt(r,n):yt((()=>{Pt(r)}))}function Qt(e,t=!1){t?_t({url:A.metricsEndPoint,data:{metrics:e},isJSON:!0,onError:A.onError}):yt((()=>{_t({url:A.metricsEndPoint,data:{metrics:e},isJSON:!0,onError:A.onError})})),ut({metricName:"Batch Metrics",data:e})}function Wt(){return Wt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wt.apply(this,arguments)}function Ht(e){if(!Oe())return;v.server!==A.platform&&!e.pagePath&&re.pagePath&&(e.pagePath=re.pagePath);const t=Object.keys(Se).length?Wt({},e.tags,Se):e.tags;t&&Object.assign(e,{tags:t}),je.metricsQueue.push(e),ht(Qt)&&(Qt(bt(je.metricsQueue)),je.metricsQueue=[])}function Vt(){return Vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vt.apply(this,arguments)}let Jt=function(e){return e.instant="instant",e.quick="quick",e.moderate="moderate",e.slow="slow",e.unavoidable="unavoidable",e}({});function Xt(e){return e.toLowerCase()}let Gt={};const Zt=(e,t)=>{null!=A&&A.onMarkStep&&A.onMarkStep(e,t),xe({ujs:t})};let Yt;const en={Perfume:()=>{},markStep:e=>{},markStepOnce:e=>{},incrementUjNavigation:()=>{}},tn=()=>{z()&&Yt&&Yt.markNTBT&&Yt.markNTBT()},nn=e=>{z()&&Yt&&en.markStep&&en.markStep(e)},rn=e=>{z()&&Yt&&en.markStepOnce&&en.markStepOnce(e)},an=()=>{z()&&Yt&&en.incrementUjNavigation&&en.incrementUjNavigation()};function on(e={callMarkNTBT:!0}){"unknown"!==A.platform&&(Ft.blacklistRegex.some((e=>e.test(fe())))||($t(j,{action:f.render,componentType:m.page}),e.callMarkNTBT&&tn()))}let sn=!1,cn=!1;const un=e=>{sn=!e.persisted},ln=(e,t="hidden",n=!1)=>{cn||(addEventListener("pagehide",un),addEventListener("beforeunload",(()=>{})),cn=!0),addEventListener("visibilitychange",(({timeStamp:n})=>{document.visibilityState===t&&e({timeStamp:n,isUnloading:sn})}),{capture:!0,once:n})},dn=36e3;function pn(){const e=pt(Ae());if(e&&(O.forEach((e=>{oe[e]&&delete oe[e]})),st()),!oe.lastEventTime||!Le.sessionStart||!e)return;const t=Math.round((oe.lastEventTime-Le.sessionStart)/1e3);if(t<1||t>dn)return;const n=Ce(t);$t(N,{action:f.measurement,componentType:m.page,session_duration:t,session_end:oe.lastEventTime,session_start:Le.sessionStart,session_rank:n})}function mn(){return mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mn.apply(this,arguments)}const fn=[],vn=[],gn=()=>{const e=fn.shift();e&&e()},bn=()=>{const e=vn.shift();e&&e()};let hn={};function wn(e){const t=function(e){return{test_name:e.testName,group_name:e.group,subject_id:e.subjectId,exposed_at:Ae(),subject_type:e.subjectType,platform:A.platform}}(e);hn[e.testName]=hn[e.testName]||0,hn[e.testName]+k>Ae()?lt({metricName:`Event: exposeExperiment ${e.testName} not sent`,data:t}):(hn[e.testName]=Ae(),ot(E,hn),lt({metricName:`Event: exposeExperiment ${e.testName} sent`,data:t}),_t({url:A.exposureEndpoint,data:[t],onError:(t,n)=>{hn[e.testName]=0,ot(E,hn),A.onError(t,n)},isJSON:!0,importance:l.high}))}const yn=e=>{var t,r,i;U(e),z()&&(H.languageCode=(null==(t=navigator)?void 0:t.languages[0])||(null==(r=navigator)?void 0:r.language)||""),te(),(()=>{var e;if(z()&&null!=(e=window)&&e.indexedDB){const e=function(e,t,{blocked:n,upgrade:r,blocking:i,terminated:a}={}){const o=indexedDB.open(e,t),s=Je(o);return r&&o.addEventListener("upgradeneeded",(e=>{r(Je(o.result),e.oldVersion,e.newVersion,Je(o.transaction),e)})),n&&o.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),s.then((e=>{a&&e.addEventListener("close",(()=>a())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),s}("keyval-store",1,{upgrade(e){e.createObjectStore("keyval")}});rt({idbKeyval:{get:async t=>(await e).get("keyval",t),set:async(t,n)=>(await e).put("keyval",n,t),delete:async t=>(await e).delete("keyval",t),keys:async()=>(await e).getAllKeys("keyval")}})}else rt({idbKeyval:{get:async e=>new Promise((t=>{t(it[e])})),set:async(e,t)=>new Promise((n=>{it[e]=t,n(e)})),delete:async e=>new Promise((()=>{delete it[e]})),keys:async()=>new Promise((e=>{e(Object.keys(it))}))}})})(),lt({metricName:"Initialized Analytics:",data:{deviceId:H.deviceId}}),fn.push((()=>{Pt()})),(async()=>{const e=await at(S);rt({isReady:!0}),gn(),e&&(bn(),se({eventId:e.eventId||oe.eventId,sequenceNumber:e.sequenceNumber||oe.sequenceNumber,sessionId:e.sessionId||oe.sessionId,lastEventTime:e.lastEventTime||oe.lastEventTime,sessionUUID:e.sessionUUID||oe.sessionUUID}),function(e){se(mn({},function(e){const t={};return O.forEach((n=>{e[n]&&(t[n]=e[n])})),t}(e),de()))}(e),Ue({sessionStart:e.sessionStart||oe.sessionStart}),De({ac:e.ac||Ie.ac,af:e.af||Ie.af,ah:e.ah||Ie.ah,al:e.al||Ie.al,am:e.am||Ie.am,ar:e.ar||Ie.ar,as:e.as||Ie.as,pv:e.pv||Ie.pv}),A.trackUserId&&Y({userId:e.userId||H.userId}),pn(),lt({metricName:"Initialized Analytics IndexedDB:",data:e}))})(),async function(){at(E).then((e=>{hn=null!=e?e:{}})).catch((e=>{e instanceof Error&&A.onError(e)}))}(),Z(),z()&&(ln((()=>{se({lastEventTime:Ae()}),st(),Bt()}),"hidden"),ln((()=>{pn()}),"visible")),z()&&(i=()=>{var e,t,n,r;te(),ee({width:null!=(e=null==(t=window)?void 0:t.innerWidth)?e:null,height:null!=(n=null==(r=window)?void 0:r.innerHeight)?n:null})},addEventListener("resize",(()=>{requestAnimationFrame((()=>{i()}))}))),(()=>{if(z())try{const e=n(2);en.markStep=e.markStep,en.markStepOnce=e.markStepOnce,en.incrementUjNavigation=e.incrementUjNavigation,Yt=new e.Perfume({analyticsTracker:e=>{const{data:t,attribution:n,metricName:r,navigatorInformation:i,rating:a}=e,o=I[r],s=(null==n?void 0:n.category)||null;if(!o&&!s)return;const c=(null==i?void 0:i.deviceMemory)||0,u=(null==i?void 0:i.hardwareConcurrency)||0,l=(null==i?void 0:i.isLowEndDevice)||!1,p=(null==i?void 0:i.isLowEndExperience)||!1,v=(null==i?void 0:i.serviceWorkerStatus)||"unsupported",g=Vt({deviceMemory:c,hardwareConcurrency:u,isLowEndDevice:l,isLowEndExperience:p,serviceWorkerStatus:v},Gt),b={is_low_end_device:l,is_low_end_experience:p,page_key:re.pageKey||"",save_data:t.saveData||!1,service_worker:v,is_perf_metric:!0};if("navigationTiming"===r)t&&"number"==typeof t.redirectTime&&Ht({metricName:I.redirectTime.eventName,metricType:d.histogram,tags:b,value:t.redirectTime||0});else if("TTFB"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,vitalsScore:a||null},g)),Ht({metricName:I.TTFB.eventName,metricType:d.histogram,tags:Vt({},b),value:t}),a&&Ht({metricName:`perf_web_vitals_ttfb_${a}`,metricType:d.count,tags:b,value:1});else if("networkInformation"===r)null!=t&&t.effectiveType&&(Gt=t,$t(o.eventName,{action:f.measurement,componentType:m.page,networkInformationDownlink:t.downlink,networkInformationEffectiveType:t.effectiveType,networkInformationRtt:t.rtt,networkInformationSaveData:t.saveData,navigatorDeviceMemory:c,navigatorHardwareConcurrency:u}));else if("storageEstimate"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page},t,g)),Ht({metricName:"perf_storage_estimate_caches",metricType:d.histogram,tags:b,value:t.caches}),Ht({metricName:"perf_storage_estimate_indexed_db",metricType:d.histogram,tags:b,value:t.indexedDB});else if("CLS"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page,score:100*t||null,vitalsScore:a||null},g)),a&&Ht({metricName:`perf_web_vitals_cls_${a}`,metricType:d.count,tags:b,value:1});else if("FID"===r){const e=(null==n?void 0:n.performanceEntry)||null,r=parseInt((null==e?void 0:e.processingStart)||"");$t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,processingStart:null!=e&&e.processingStart?r:null,startTime:null!=e&&e.startTime?parseInt(e.startTime):null,vitalsScore:a||null},g)),a&&Ht({metricName:`perf_web_vitals_fidVitals_${a}`,metricType:d.count,tags:b,value:1})}else"userJourneyStep"===r?($t("perf_user_journey_step",Vt({action:f.measurement,componentType:m.page,duration:t||null,rating:null!=a?a:null,step_name:(null==n?void 0:n.stepName)||""},g)),Ht({metricName:`user_journey_step.${A.projectName}.${A.platform}.${(null==n?void 0:n.stepName)||""}_vitals_${a}`,metricType:d.count,tags:b,value:1}),Ht({metricName:`user_journey_step.${A.projectName}.${A.platform}.${(null==n?void 0:n.stepName)||""}`,metricType:d.distribution,tags:b,value:t||null})):I[r]&&t&&($t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,vitalsScore:a||null},g)),a&&(Ht({metricName:`perf_web_vitals_${Xt(r)}_${a}`,metricType:d.count,tags:b,value:1}),"LCP"===r&&Ht({metricName:`perf_web_vitals_${Xt(r)}`,metricType:d.distribution,tags:b,value:t})))},maxMeasureTime:3e4,steps:A.steps,onMarkStep:Zt})}catch(e){e instanceof Error&&A.onError(e)}})()},Tn=e=>{Y(e),e.userAgent&&Z(),lt({metricName:"Identify:",data:{countryCode:H.countryCode,deviceId:H.deviceId,userId:H.userId}})},kn=({blacklistRegex:e,pageKeyRegex:t,browserHistory:n})=>{Kt({blacklistRegex:e||[],isEnabled:!0}),ae({pageKeyRegex:t}),on({callMarkNTBT:!1}),n.listen((()=>{on()}))},_n=({blacklistRegex:e,pageKeyRegex:t,nextJsRouter:n})=>{Kt({blacklistRegex:e||[],isEnabled:!0}),ae({pageKeyRegex:t}),on({callMarkNTBT:!1}),n.events.on("routeChangeComplete",(()=>{on()}))},Sn=()=>{Y({isOptOut:!0}),ot(S,{})},En=()=>{Y({isOptOut:!1})},xn={Button:{label:"cb_button",uuid:"e921a074-40e6-4371-8700-134d5cd633e6",componentType:m.button}};function On(e,t,n){return{componentName:e,actions:t,data:n}}function jn(){return jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jn.apply(this,arguments)}function Nn(e,t,n){const{componentName:r,data:i}=n;$t(e.label,jn({componentType:e.componentType,action:t,loggingId:e.uuid,component_name:r},i))}const In={actionMapping:{onPress:f.click,onHover:f.hover},handlers:{Button:{[f.click]:e=>Nn(xn.Button,f.click,e),[f.hover]:e=>Nn(xn.Button,f.hover,e)}}};function Pn(e,t=!1){t?_t({url:A.tracesEndpoint,data:{traces:e},isJSON:!0,onError:A.onError}):yt((()=>{_t({url:A.tracesEndpoint,data:{traces:e},isJSON:!0,onError:A.onError})})),ut({metricName:"Batch Traces",data:e})}function Mn(){return Mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Mn.apply(this,arguments)}const Bn=1e6;function Cn(e){return e*Bn}function Dn(e=function(){var e;return null==(e=window)?void 0:e.crypto}()){const t=new Uint32Array(2);return null==e||e.getRandomValues(t),((BigInt(t[0])<<BigInt(32))+BigInt(t[1])).toString()}function An(e,t){return{"x-datadog-origin":"rum","x-datadog-parent-id":t,"x-datadog-sampling-priority":"1","x-datadog-trace-id":e}}function Ln(e){var t;const{name:n,traceId:r,spanId:i,start:a,duration:o,resource:s,meta:c}=e;return{duration:o?Cn(o):0,name:n,resource:s,service:A.projectName,span_id:null!=i?i:Dn(),start:a?Cn(a):0,trace_id:null!=r?r:Dn(),parent_id:P,type:M,meta:Mn({platform:A.platform},re.pageKey?{page_key:re.pageKey}:{},null!=(t=Se.ujs)&&t.length?{last_ujs:Se.ujs[Se.ujs.length-1]}:{},null!=c?c:{})}}function Un(e){return[Ln(e)]}function Rn(e,t){Oe()&&function(e){return e.length>0}(e)&&(t&&function(e,t){e.forEach((e=>function(e,t){const n=Mn({},e.meta,t.meta),r={start:t.start?Cn(t.start):e.start,duration:t.duration?Cn(t.duration):e.duration};Object.assign(e,t,Mn({meta:n},r))}(e,t)))}(e,t),je.tracesQueue.push(e),wt(Pn)&&(Pn(je.tracesQueue),je.tracesQueue=[]))}function qn(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Fn(){return Fn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fn.apply(this,arguments)}function zn(){return void 0!==typeof window&&"performance"in window&&"mark"in performance&&"getEntriesByName"in performance}function Kn(e,t){return`perf_${e}${null!=t&&t.label?`_${t.label}`:""}`}function $n(e,t,n){return`${Kn(e,n)}__${t}`}let Qn={};function Wn(e,t,n){if(!zn())return;const r=$n(e,t,n);if(performance.mark(r),"end"===t){const t=Kn(e,n);!function(e,t,n){try{performance.measure(e,t,n)}catch(e){A.onError(e)}}(t,$n(e,"start",n),r);const i=performance.getEntriesByName(t).pop();i&&Ht(Fn({metricName:e,metricType:d.distribution,value:i.duration},null!=n&&n.tags?{tags:n.tags}:{}))}}function Hn(e,t){if(!zn())return;const n=$n(e,"start",t);Qn[n]||(Wn(e,"start",t),Qn[n]=!0)}function Vn(e,t){const n=$n(e,"start",t),r=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(Qn,[n].map(qn));Qn=r}function Jn(e,t){if(!zn())return;const n=$n(e,"start",t);Qn[n]&&(Wn(e,"end",t),Vn(e,t))}function Xn(){zn()&&(performance.clearMarks(),Qn={})}var Gn=n(784);function Zn(){return Zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zn.apply(this,arguments)}function Yn(e,t,n=l.low){const r=(0,Gn.useRef)(t);return(0,Gn.useEffect)((()=>{r.current=t}),[t]),(0,Gn.useCallback)((t=>{$t(e,Zn({},r.current,t),n)}),[e,n])}function er(){return er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},er.apply(this,arguments)}function tr(e,t,n=l.low){(0,Gn.useEffect)((()=>{const r=er({},t,{action:f.render});$t(e,r,n)}),[])}function nr(){return nr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nr.apply(this,arguments)}const rr=function(e,t){return{markStartPerf:(0,Gn.useCallback)((()=>Hn(e,t)),[e,t]),markEndPerf:(0,Gn.useCallback)((n=>Jn(e,nr({},t,n))),[e,t])}};function ir(){return ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ir.apply(this,arguments)}function ar(){return Object.entries(ir({},Se,zt(),{sessionUUID:oe.sessionUUID,userId:oe.userId})).reduce(((e,t)=>{return null!=(n=t[1])&&""!==n?ir({},e,{[t[0]]:t[1]}):e;var n}),{})}async function or(){return new Promise((e=>{Mt(vt(je.eventsQueue)),Qt(bt(je.metricsQueue),!0),Pn(je.tracesQueue,!0),Ne({eventsQueue:[],metricsQueue:[],tracesQueue:[]}),e()}))}function sr(){return{"X-CB-Device-ID":H.deviceId||"unknown","X-CB-Is-Logged-In":H.userId?"true":"false","X-CB-Pagekey":re.pageKey||"unknown","X-CB-UJS":(e=Se.ujs,void 0===e||0===e.length?"":e.join(",")),"X-CB-Platform":A.platform||"unknown","X-CB-Project-Name":A.projectName||"unknown","X-CB-Session-UUID":oe.sessionUUID||"unknown","X-CB-Version-Name":A.version?String(A.version):"unknown"};var e}})(),r})()}));',I0=()=>new Promise((e,t)=>{if(window.ClientAnalytics)return e();try{const n=document.createElement("script");n.textContent=S0,n.type="text/javascript",document.head.appendChild(n),T0(),document.head.removeChild(n),e()}catch{console.error("Failed to execute inlined telemetry script"),t()}}),T0=()=>{var e,t,n;if(typeof window<"u"){const r=(n=(e=$.config.get().deviceId)!==null&&e!==void 0?e:(t=window.crypto)===null||t===void 0?void 0:t.randomUUID())!==null&&n!==void 0?n:"";if(window.ClientAnalytics){const{init:s,identify:i,PlatformName:a}=window.ClientAnalytics;s({isProd:!0,amplitudeApiKey:"c66737ad47ec354ced777935b0af822e",platform:a.web,projectName:"base_account_sdk",showDebugLogging:!1,version:"1.0.0",apiEndpoint:"https://cca-lite.coinbase.com"}),i({deviceId:r}),$.config.set({deviceId:r})}}},X={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},ni={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},Cu="Unspecified error message.",O0="Unspecified server error.";function ha(e,t=Cu){if(e&&Number.isInteger(e)){const n=e.toString();if(ri(ni,n))return ni[n].message;if(Bu(e))return O0}return t}function C0(e){if(!Number.isInteger(e))return!1;const t=e.toString();return!!(ni[t]||Bu(e))}function B0(e,{shouldIncludeStack:t=!1}={}){const n={};if(e&&typeof e=="object"&&!Array.isArray(e)&&ri(e,"code")&&C0(e.code)){const r=e;n.code=r.code,r.message&&typeof r.message=="string"?(n.message=r.message,ri(r,"data")&&(n.data=r.data)):(n.message=ha(n.code),n.data={originalError:Bo(e)})}else n.code=X.rpc.internal,n.message=$o(e,"message")?e.message:Cu,n.data={originalError:Bo(e)};return t&&(n.stack=$o(e,"stack")?e.stack:void 0),n}function Bu(e){return e>=-32099&&e<=-32e3}function Bo(e){return e&&typeof e=="object"&&!Array.isArray(e)?Object.assign({},e):e}function ri(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function $o(e,t){return typeof e=="object"&&e!==null&&t in e&&typeof e[t]=="string"}const B={rpc:{parse:e=>Ie(X.rpc.parse,e),invalidRequest:e=>Ie(X.rpc.invalidRequest,e),invalidParams:e=>Ie(X.rpc.invalidParams,e),methodNotFound:e=>Ie(X.rpc.methodNotFound,e),internal:e=>Ie(X.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Ie(t,e)},invalidInput:e=>Ie(X.rpc.invalidInput,e),resourceNotFound:e=>Ie(X.rpc.resourceNotFound,e),resourceUnavailable:e=>Ie(X.rpc.resourceUnavailable,e),transactionRejected:e=>Ie(X.rpc.transactionRejected,e),methodNotSupported:e=>Ie(X.rpc.methodNotSupported,e),limitExceeded:e=>Ie(X.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Lt(X.provider.userRejectedRequest,e),unauthorized:e=>Lt(X.provider.unauthorized,e),unsupportedMethod:e=>Lt(X.provider.unsupportedMethod,e),disconnected:e=>Lt(X.provider.disconnected,e),chainDisconnected:e=>Lt(X.provider.chainDisconnected,e),unsupportedChain:e=>Lt(X.provider.unsupportedChain,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new Mu(t,n,r)}}};function Ie(e,t){const[n,r]=$u(t);return new ma(e,n||ha(e),r)}function Lt(e,t){const[n,r]=$u(t);return new Mu(e,n||ha(e),r)}function $u(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}class ma extends Error{constructor(t,n,r){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string.');super(n),this.code=t,r!==void 0&&(this.data=r)}}class Mu extends ma{constructor(t,n,r){if(!$0(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,n,r)}}function $0(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function Mo(e){return typeof e=="object"&&e!==null&&"code"in e&&"data"in e&&e.code===-32090&&typeof e.data=="object"&&e.data!==null&&"type"in e.data&&e.data.type==="INSUFFICIENT_FUNDS"}function Nu(e){return typeof e=="object"&&e!==null&&"details"in e}function M0(e){try{const t=JSON.parse(e.details);return new ma(t.code,t.message,t.data)}catch{return null}}function Ru(){return e=>e}const kn=Ru(),N0=Ru();function Xe(e){return Math.floor(e)}const ju=/^[0-9]*$/,Lu=/^[a-f0-9]*$/;function Et(e){return ba(crypto.getRandomValues(new Uint8Array(e)))}function ba(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}function Pr(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>Number.parseInt(t,16)))}function wn(e,t=!1){const n=e.toString("hex");return kn(t?`0x${n}`:n)}function Ps(e){return wn(ii(e),!0)}function De(e){return N0(e.toString(10))}function Ft(e){return kn(`0x${BigInt(e).toString(16)}`)}function Du(e){return e.startsWith("0x")||e.startsWith("0X")}function ya(e){return Du(e)?e.slice(2):e}function Uu(e){return Du(e)?`0x${e.slice(2)}`:`0x${e}`}function Xr(e){if(typeof e!="string")return!1;const t=ya(e).toLowerCase();return Lu.test(t)}function si(e,t=!1){if(typeof e=="string"){const n=ya(e).toLowerCase();if(Lu.test(n))return kn(t?`0x${n}`:n)}throw B.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function ga(e,t=!1){let n=si(e,!1);return n.length%2===1&&(n=kn(`0${n}`)),t?kn(`0x${n}`):n}function ct(e){if(typeof e=="string"){const t=ya(e).toLowerCase();if(Xr(t)&&t.length===40)return Uu(t)}throw B.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}function ii(e){if(Buffer.isBuffer(e))return e;if(typeof e=="string"){if(Xr(e)){const t=ga(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw B.rpc.invalidParams(`Not binary data: ${String(e)}`)}function vn(e){if(typeof e=="number"&&Number.isInteger(e))return Xe(e);if(typeof e=="string"){if(ju.test(e))return Xe(Number(e));if(Xr(e))return Xe(Number(BigInt(ga(e,!0))))}throw B.rpc.invalidParams(`Not an integer: ${String(e)}`)}function pn(e){if(e!==null&&(typeof e=="bigint"||j0(e)))return BigInt(e.toString(10));if(typeof e=="number")return BigInt(vn(e));if(typeof e=="string"){if(ju.test(e))return BigInt(e);if(Xr(e))return BigInt(ga(e,!0))}throw B.rpc.invalidParams(`Not an integer: ${String(e)}`)}function R0(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw B.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}function j0(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}const L0=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app.
|
|
3
|
+
|
|
4
|
+
Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,D0=()=>{let e;return{getCrossOriginOpenerPolicy:()=>e===void 0?"undefined":e,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){e="non-browser-env";return}try{const t=`${window.location.origin}${window.location.pathname}`,n=await fetch(t,{method:"HEAD"});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const r=n.headers.get("Cross-Origin-Opener-Policy");e=r??"null",e==="same-origin"&&console.error(L0)}catch(t){console.error("Error checking Cross-Origin-Opener-Policy:",t.message),e="error"}}}},{checkCrossOriginOpenerPolicy:U0,getCrossOriginOpenerPolicy:F0}=D0();async function xn(e,t){const n=Object.assign(Object.assign({},e),{jsonrpc:"2.0",id:crypto.randomUUID()}),r=await window.fetch(t,{method:"POST",body:JSON.stringify(n),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":sn,"X-Cbw-Sdk-Platform":Tu}}),{result:s,error:i}=await r.json();if(i)throw i;return s}function z0(){return globalThis.coinbaseWalletExtension}function G0(){var e,t;try{const n=globalThis;return(e=n.ethereum)!==null&&e!==void 0?e:(t=n.top)===null||t===void 0?void 0:t.ethereum}catch{return}}function H0({metadata:e,preference:t}){var n,r;const{appName:s,appLogoUrl:i,appChainIds:a}=e;if(t.options!=="smartWalletOnly"){const c=z0();if(c)return(n=c.setAppInfo)===null||n===void 0||n.call(c,s,i,a,t),c}const o=G0();if(o?.isCoinbaseBrowser)return(r=o.setAppInfo)===null||r===void 0||r.call(o,s,i,a,t),o}function q0(e){if(!e||typeof e!="object"||Array.isArray(e))throw B.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:n}=e;if(typeof t!="string"||t.length===0)throw B.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:e});if(n!==void 0&&!Array.isArray(n)&&(typeof n!="object"||n===null))throw B.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:e});switch(t){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw B.provider.unsupportedMethod()}}function W0(e){if(e){if(!["all","smartWalletOnly","eoaOnly"].includes(e.options))throw new Error(`Invalid options: ${e.options}`);if(e.attribution&&e.attribution.auto!==void 0&&e.attribution.dataSuffix!==void 0)throw new Error("Attribution cannot contain both auto and dataSuffix properties");if(e.telemetry&&typeof e.telemetry!="boolean")throw new Error("Telemetry must be a boolean")}}function No(e){if(typeof e!="function")throw new Error("toAccount is not a function")}const V0="https://keys.coinbase.com/connect",Fu="https://rpc.wallet.coinbase.com",Ro="https://www.walletlink.org",K0="https://go.cb-w.com/walletlink";var U;(function(e){e.unknown="unknown",e.banner="banner",e.button="button",e.card="card",e.chart="chart",e.content_script="content_script",e.dropdown="dropdown",e.link="link",e.page="page",e.modal="modal",e.table="table",e.search_bar="search_bar",e.service_worker="service_worker",e.text="text",e.text_input="text_input",e.tray="tray",e.checkbox="checkbox",e.icon="icon"})(U||(U={}));var F;(function(e){e.unknown="unknown",e.blur="blur",e.click="click",e.change="change",e.dismiss="dismiss",e.focus="focus",e.hover="hover",e.select="select",e.measurement="measurement",e.move="move",e.process="process",e.render="render",e.scroll="scroll",e.view="view",e.search="search",e.keyPress="keyPress",e.error="error"})(F||(F={}));var z;(function(e){e.low="low",e.high="high"})(z||(z={}));function G(e,t,n){var r,s,i,a;window.ClientAnalytics&&((r=window.ClientAnalytics)===null||r===void 0||r.logEvent(e,Object.assign(Object.assign({},t),{sdkVersion:sn,appName:(i=(s=$.config.get().metadata)===null||s===void 0?void 0:s.appName)!==null&&i!==void 0?i:"",appOrigin:window.location.origin,appPreferredSigner:(a=$.config.get().preference)===null||a===void 0?void 0:a.options}),n))}const J0=()=>{G("communicator.popup_setup.started",{action:F.unknown,componentType:U.unknown},z.high)},Z0=()=>{G("communicator.popup_setup.completed",{action:F.unknown,componentType:U.unknown},z.high)},Y0=()=>{G("communicator.popup_unload.received",{action:F.unknown,componentType:U.unknown},z.high)},wa=({snackbarContext:e})=>{G(`snackbar.${e}.shown`,{action:F.render,componentType:U.modal,snackbarContext:e},z.high)},qt=({snackbarContext:e,snackbarAction:t})=>{G(`snackbar.${e}.action_clicked`,{action:F.click,componentType:U.button,snackbarContext:e,snackbarAction:t},z.high)},Q0='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';function zu(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Q0)),document.documentElement.appendChild(e)}function Gu(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Gu(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function _n(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Gu(e))&&(r&&(r+=" "),r+=t);return r}function X0(){try{return window.frameElement!==null}catch{return!1}}function ep(){try{return X0()&&window.top?window.top.location:window.location}catch{return window.location}}function tp(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window?.navigator)===null||e===void 0?void 0:e.userAgent)}function Hu(){var e,t;return(t=(e=window?.matchMedia)===null||e===void 0?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)!==null&&t!==void 0?t:!1}const np=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}",rp="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",sp="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class qu{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=Hu()}attach(t){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",t.appendChild(this.root),this.render()}presentItem(t){const n=this.nextItemKey++;return this.items.set(n,t),this.render(),()=>{this.items.delete(n),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Qs(q("div",null,q(Wu,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([t,n])=>q(ip,Object.assign({},n,{key:t}))))),this.root)}}const Wu=e=>q("div",{class:_n("-cbwsdk-snackbar-container")},q("style",null,np),q("div",{class:"-cbwsdk-snackbar"},e.children)),ip=({autoExpand:e,message:t,menuItems:n})=>{const[r,s]=To(!0),[i,a]=To(e??!1);s0(()=>{const c=[window.setTimeout(()=>{s(!1)},1),window.setTimeout(()=>{a(!0)},1e4)];return()=>{c.forEach(window.clearTimeout)}});const o=()=>{a(!i)};return q("div",{class:_n("-cbwsdk-snackbar-instance",r&&"-cbwsdk-snackbar-instance-hidden",i&&"-cbwsdk-snackbar-instance-expanded")},q("div",{class:"-cbwsdk-snackbar-instance-header",onClick:o},q("img",{src:rp,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",q("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),q("div",{class:"-gear-container"},!i&&q("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},q("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),q("img",{src:sp,class:"-gear-icon",title:"Expand"}))),n&&n.length>0&&q("div",{class:"-cbwsdk-snackbar-instance-menu"},n.map((c,u)=>q("div",{class:_n("-cbwsdk-snackbar-instance-menu-item",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:c.onClick,key:u},q("svg",{width:c.svgWidth,height:c.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},q("path",{"fill-rule":c.defaultFillRule,"clip-rule":c.defaultClipRule,d:c.path,fill:"#AAAAAA"})),q("span",{class:_n("-cbwsdk-snackbar-instance-menu-item-info",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},c.info)))))},Vu="M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z";class ap{constructor(){this.attached=!1,this.snackbar=new qu}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const t=document.documentElement,n=document.createElement("div");n.className="-cbwsdk-css-reset",t.appendChild(n),this.snackbar.attach(n),this.attached=!0,zu()}showConnecting(t){let n;return t.isUnlinkedErrorState?n={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]}:n={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:t.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:Vu,defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]},this.snackbar.presentItem(n)}}const jo=420,Lo=700,op={isRed:!1,info:"Retry",svgWidth:"10",svgHeight:"11",path:Vu,defaultFillRule:"evenodd",defaultClipRule:"evenodd"},cp="Popup was blocked. Try again.";let or=null;function up(e){const t=(window.innerWidth-jo)/2+window.screenX,n=(window.innerHeight-Lo)/2+window.screenY;lp(e);function r(){const i=`wallet_${crypto.randomUUID()}`,a=window.open(e,i,`width=${jo}, height=${Lo}, left=${t}, top=${n}`);return a?.focus(),a||null}let s=r();if(!s){const i=va();return new Promise((a,o)=>{wa({snackbarContext:"popup_blocked"}),i.presentItem({autoExpand:!0,message:cp,menuItems:[Object.assign(Object.assign({},op),{onClick:()=>{qt({snackbarContext:"popup_blocked",snackbarAction:"confirm"}),s=r(),s?a(s):o(B.rpc.internal("Popup window was blocked")),i.clear()}})]})})}return Promise.resolve(s)}function dp(e){e&&!e.closed&&e.close()}function lp(e){const t={sdkName:Tu,sdkVersion:sn,origin:window.location.origin,coop:F0()};for(const[n,r]of Object.entries(t))e.searchParams.has(n)||e.searchParams.append(n,r.toString())}function va(){if(!or){const e=document.createElement("div");e.className="-cbwsdk-css-reset",document.body.appendChild(e),or=new qu,or.attach(e)}return or}class fp{constructor({url:t=V0,metadata:n,preference:r}){this.popup=null,this.listeners=new Map,this.postMessage=async s=>{(await this.waitForPopupLoaded()).postMessage(s,this.url.origin)},this.postRequestAndWaitForResponse=async s=>{const i=this.onMessage(({requestId:a})=>a===s.id);return this.postMessage(s),await i},this.onMessage=async s=>new Promise((i,a)=>{const o=c=>{if(c.origin!==this.url.origin)return;const u=c.data;s(u)&&(i(u),window.removeEventListener("message",o),this.listeners.delete(o))};window.addEventListener("message",o),this.listeners.set(o,{reject:a})}),this.disconnect=()=>{dp(this.popup),this.popup=null,this.listeners.forEach(({reject:s},i)=>{s(B.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",i)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(J0(),this.popup=await up(this.url),this.onMessage(({event:s})=>s==="PopupUnload").then(()=>{this.disconnect(),Y0()}).catch(()=>{}),this.onMessage(({event:s})=>s==="PopupLoaded").then(s=>{this.postMessage({requestId:s.id,data:{version:sn,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw B.rpc.internal();return Z0(),this.popup})),this.url=new URL(t),this.metadata=n,this.preference=r}}function de(e){return e.errorMessage!==void 0}function pp(e){const t=B0(hp(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return n.searchParams.set("version",sn),n.searchParams.set("code",t.code.toString()),n.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:n.href})}function hp(e){var t;if(typeof e=="string")return{message:e,code:X.rpc.internal};if(de(e)){const n=e.errorMessage,r=(t=e.errorCode)!==null&&t!==void 0?t:n.match(/(denied|rejected)/i)?X.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},e),{message:n,code:r,data:{method:e.method}})}return e}class mp extends Gf{}class St{constructor(t,n){this.scope=t,this.module=n}storeObject(t,n){this.setItem(t,JSON.stringify(n))}loadObject(t){const n=this.getItem(t);return n?JSON.parse(n):void 0}setItem(t,n){localStorage.setItem(this.scopedKey(t),n)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),n=[];for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);typeof s=="string"&&s.startsWith(t)&&n.push(s)}n.forEach(r=>localStorage.removeItem(r))}scopedKey(t){return`-${this.scope}${this.module?`:${this.module}`:""}:${t}`}static clearAll(){new St("CBWSDK").clear(),new St("walletlink").clear()}}const bp=({signerType:e})=>{G("provider.signer.loaded_from_storage",{action:F.measurement,componentType:U.unknown,signerType:e},z.low)},yp=({method:e,correlationId:t})=>{G("provider.request.started",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t},z.high)},gp=({method:e,correlationId:t,signerType:n,errorMessage:r})=>{G("provider.request.error",{action:F.error,componentType:U.unknown,method:e,signerType:n,correlationId:t,errorMessage:r},z.high)},wp=({method:e,signerType:t,correlationId:n})=>{G("provider.request.responded",{action:F.unknown,componentType:U.unknown,method:e,signerType:t,correlationId:n},z.high)},vp=()=>{G("provider.enable_function.called",{action:F.measurement,componentType:U.unknown},z.high)},xp=()=>{G("signer.selection.requested",{action:F.unknown,componentType:U.unknown},z.high)},_p=e=>{G("signer.selection.responded",{action:F.unknown,componentType:U.unknown,signerType:e},z.high)},cr=pa(()=>({correlationIds:new Map})),Ce={get:e=>cr.getState().correlationIds.get(e),set:(e,t)=>{cr.setState(n=>{const r=new Map(n.correlationIds);return r.set(e,t),{correlationIds:r}})},delete:e=>{cr.setState(t=>{const n=new Map(t.correlationIds);return n.delete(e),{correlationIds:n}})},clear:()=>{cr.setState({correlationIds:new Map})}},Ep="1.2.3";let ve=class ai extends Error{constructor(t,n={}){const r=n.cause instanceof ai?n.cause.details:n.cause?.message?n.cause.message:n.details,s=n.cause instanceof ai&&n.cause.docsPath||n.docsPath,i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${Ep}`].join(`
|
|
5
|
+
`);super(i),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=t}};function at(e,t){return e.exec(t)?.groups}const Ku=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ju=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Zu=/^\(.+?\).*?$/,Do=/^tuple(?<array>(\[(\d*)\])*)$/;function oi(e){let t=e.type;if(Do.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let s=0;s<n;s++){const i=e.components[s];t+=oi(i),s<n-1&&(t+=", ")}const r=at(Do,e.type);return t+=`)${r?.array||""}`,oi({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Ut(e){let t="";const n=e.length;for(let r=0;r<n;r++){const s=e[r];t+=oi(s),r!==n-1&&(t+=", ")}return t}function Ir(e){return e.type==="function"?`function ${e.name}(${Ut(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${Ut(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Ut(e.inputs)})`:e.type==="error"?`error ${e.name}(${Ut(e.inputs)})`:e.type==="constructor"?`constructor(${Ut(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Yu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Pp(e){return Yu.test(e)}function kp(e){return at(Yu,e)}const Qu=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Ap(e){return Qu.test(e)}function Sp(e){return at(Qu,e)}const Xu=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Ip(e){return Xu.test(e)}function Tp(e){return at(Xu,e)}const ed=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function es(e){return ed.test(e)}function Op(e){return at(ed,e)}const td=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Cp(e){return td.test(e)}function Bp(e){return at(td,e)}const nd=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function $p(e){return nd.test(e)}function Mp(e){return at(nd,e)}const Np=/^receive\(\) external payable$/;function Rp(e){return Np.test(e)}const Uo=new Set(["memory","indexed","storage","calldata"]),jp=new Set(["indexed"]),ci=new Set(["calldata","memory","storage"]);class Lp extends ve{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Dp extends ve{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Up extends ve{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Fp extends ve{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class zp extends ve{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Gp extends ve{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Hp extends ve{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class qp extends ve{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class Wp extends ve{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class an extends ve{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Vp extends ve{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Kp extends ve{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Jp extends ve{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Zp extends ve{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Yp(e,t,n){let r="";if(n)for(const s of Object.entries(n)){if(!s)continue;let i="";for(const a of s[1])i+=`[${a.type}${a.name?`:${a.name}`:""}]`;r+=`(${s[0]}{${i}})`}return t?`${t}:${e}${r}`:`${e}${r}`}const ks=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function ui(e,t={}){if(Ip(e))return Qp(e,t);if(Ap(e))return Xp(e,t);if(Pp(e))return eh(e,t);if(Cp(e))return th(e,t);if($p(e))return nh(e);if(Rp(e))return{type:"receive",stateMutability:"payable"};throw new Vp({signature:e})}function Qp(e,t={}){const n=Tp(e);if(!n)throw new an({signature:e,type:"function"});const r=Ee(n.parameters),s=[],i=r.length;for(let o=0;o<i;o++)s.push(st(r[o],{modifiers:ci,structs:t,type:"function"}));const a=[];if(n.returns){const o=Ee(n.returns),c=o.length;for(let u=0;u<c;u++)a.push(st(o[u],{modifiers:ci,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:a}}function Xp(e,t={}){const n=Sp(e);if(!n)throw new an({signature:e,type:"event"});const r=Ee(n.parameters),s=[],i=r.length;for(let a=0;a<i;a++)s.push(st(r[a],{modifiers:jp,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:s}}function eh(e,t={}){const n=kp(e);if(!n)throw new an({signature:e,type:"error"});const r=Ee(n.parameters),s=[],i=r.length;for(let a=0;a<i;a++)s.push(st(r[a],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:s}}function th(e,t={}){const n=Bp(e);if(!n)throw new an({signature:e,type:"constructor"});const r=Ee(n.parameters),s=[],i=r.length;for(let a=0;a<i;a++)s.push(st(r[a],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}function nh(e){const t=Mp(e);if(!t)throw new an({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const rh=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,sh=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,ih=/^u?int$/;function st(e,t){const n=Yp(e,t?.type,t?.structs);if(ks.has(n))return ks.get(n);const r=Zu.test(e),s=at(r?sh:rh,e);if(!s)throw new zp({param:e});if(s.name&&oh(s.name))throw new Gp({param:e,name:s.name});const i=s.name?{name:s.name}:{},a=s.modifier==="indexed"?{indexed:!0}:{},o=t?.structs??{};let c,u={};if(r){c="tuple";const d=Ee(s.type),f=[],p=d.length;for(let m=0;m<p;m++)f.push(st(d[m],{structs:o}));u={components:f}}else if(s.type in o)c="tuple",u={components:o[s.type]};else if(ih.test(s.type))c=`${s.type}256`;else if(s.type==="address payable")c="address";else if(c=s.type,t?.type!=="struct"&&!rd(c))throw new Up({type:c});if(s.modifier){if(!t?.modifiers?.has?.(s.modifier))throw new Hp({param:e,type:t?.type,modifier:s.modifier});if(ci.has(s.modifier)&&!ch(c,!!s.array))throw new qp({param:e,type:t?.type,modifier:s.modifier})}const l={type:`${c}${s.array??""}`,...i,...a,...u};return ks.set(n,l),l}function Ee(e,t=[],n="",r=0){const s=e.trim().length;for(let i=0;i<s;i++){const a=e[i],o=e.slice(i+1);switch(a){case",":return r===0?Ee(o,[...t,n.trim()]):Ee(o,t,`${n}${a}`,r);case"(":return Ee(o,t,`${n}${a}`,r+1);case")":return Ee(o,t,`${n}${a}`,r-1);default:return Ee(o,t,`${n}${a}`,r)}}if(n==="")return t;if(r!==0)throw new Zp({current:n,depth:r});return t.push(n.trim()),t}function rd(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Ku.test(e)||Ju.test(e)}const ah=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function oh(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Ku.test(e)||Ju.test(e)||ah.test(e)}function ch(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function xa(e){const t={},n=e.length;for(let a=0;a<n;a++){const o=e[a];if(!es(o))continue;const c=Op(o);if(!c)throw new an({signature:o,type:"struct"});const u=c.properties.split(";"),l=[],d=u.length;for(let f=0;f<d;f++){const m=u[f].trim();if(!m)continue;const h=st(m,{type:"struct"});l.push(h)}if(!l.length)throw new Kp({signature:o});t[c.name]=l}const r={},s=Object.entries(t),i=s.length;for(let a=0;a<i;a++){const[o,c]=s[a];r[o]=sd(c,t)}return r}const uh=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function sd(e=[],t={},n=new Set){const r=[],s=e.length;for(let i=0;i<s;i++){const a=e[i];if(Zu.test(a.type))r.push(a);else{const c=at(uh,a.type);if(!c?.type)throw new Wp({abiParameter:a});const{array:u,type:l}=c;if(l in t){if(n.has(l))throw new Jp({type:l});r.push({...a,type:`tuple${u??""}`,components:sd(t[l],t,new Set([...n,l]))})}else if(rd(l))r.push(a);else throw new Dp({type:l})}}return r}function _a(e){const t=xa(e),n=[],r=e.length;for(let s=0;s<r;s++){const i=e[s];es(i)||n.push(ui(i,t))}return n}function Fo(e){let t;if(typeof e=="string")t=ui(e);else{const n=xa(e),r=e.length;for(let s=0;s<r;s++){const i=e[s];if(!es(i)){t=ui(i,n);break}}}if(!t)throw new Lp({signature:e});return t}function zo(e){const t=[];if(typeof e=="string"){const n=Ee(e),r=n.length;for(let s=0;s<r;s++)t.push(st(n[s],{modifiers:Uo}))}else{const n=xa(e),r=e.length;for(let s=0;s<r;s++){const i=e[s];if(es(i))continue;const a=Ee(i),o=a.length;for(let c=0;c<o;c++)t.push(st(a[c],{modifiers:Uo,structs:n}))}}if(t.length===0)throw new Fp({params:e});return t}function M(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const s=e[n];return typeof s=="function"?s:i=>t(e,i)}function Ne(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new xh(e.type);return`${e.name}(${ts(e.inputs,{includeName:t})})`}function ts(e,{includeName:t=!1}={}){return e?e.map(n=>dh(n,{includeName:t})).join(t?", ":","):""}function dh(e,{includeName:t}){return e.type.startsWith("tuple")?`(${ts(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function fe(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Z(e){return fe(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const id="2.44.1";let As={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${id}`},P=class di extends Error{constructor(t,n={}){const r=n.cause instanceof di?n.cause.details:n.cause?.message?n.cause.message:n.details,s=n.cause instanceof di&&n.cause.docsPath||n.docsPath,i=As.getDocsUrl?.({...n,docsPath:s}),a=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...As.version?[`Version: ${As.version}`]:[]].join(`
|
|
6
|
+
`);super(a,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=id}walk(t){return ad(this,t)}};function ad(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?ad(e.cause,t):t?null:e}class lh extends P{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
|
|
7
|
+
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Go extends P{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
|
|
8
|
+
`),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class od extends P{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
9
|
+
`),{metaMessages:[`Params: (${ts(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=r}}class Yn extends P{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class fh extends P{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
|
|
10
|
+
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class ph extends P{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Z(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class cd extends P{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
|
|
11
|
+
`),{name:"AbiEncodingLengthMismatchError"})}}class hh extends P{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
|
|
12
|
+
`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Ho extends P{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
|
|
13
|
+
`),{docsPath:n,name:"AbiErrorNotFoundError"})}}class ud extends P{constructor(t,{docsPath:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
14
|
+
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class mh extends P{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class bh extends P{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
15
|
+
`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class qo extends P{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
|
|
16
|
+
`),{docsPath:n,name:"AbiEventNotFoundError"})}}class Yt extends P{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
17
|
+
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class dd extends P{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
18
|
+
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class yh extends P{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
19
|
+
`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class gh extends P{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Ne(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Ne(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let ld=class extends P{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Tr extends P{constructor({abiItem:t,data:n,params:r,size:s}){super([`Data size of ${s} bytes is too small for non-indexed event parameters.`].join(`
|
|
20
|
+
`),{metaMessages:[`Params: (${ts(r,{includeName:!0})})`,`Data: ${n} (${s} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t,this.data=n,this.params=r,this.size=s}}class Ea extends P{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${Ne(t,{includeName:!0})}".`].join(`
|
|
21
|
+
`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class wh extends P{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
22
|
+
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class vh extends P{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
|
|
23
|
+
`),{docsPath:n,name:"InvalidAbiDecodingType"})}}let fd=class extends P{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
24
|
+
`),{name:"InvalidArrayError"})}};class xh extends P{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
25
|
+
`),{name:"InvalidDefinitionTypeError"})}}class _h extends P{constructor(t){super(`Type "${t}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}class Eh extends P{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let pd=class extends P{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},hd=class extends P{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class Wo extends P{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function re(e,{dir:t,size:n=32}={}){return typeof e=="string"?yt(e,{dir:t,size:n}):Ph(e,{dir:t,size:n})}function yt(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new hd({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Ph(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new hd({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;s<n;s++){const i=t==="right";r[i?s:n-s-1]=e[i?s:e.length-s-1]}return r}let md=class extends P{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number "${i}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},kh=class extends P{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}};class Ah extends P{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let Sh=class extends P{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Me(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let s=0;s<n.length-1&&n[t==="left"?s:n.length-s-1].toString()==="0";s++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function Oe(e,{size:t}){if(Z(e)>t)throw new Sh({givenSize:Z(e),maxSize:t})}function se(e,t={}){const{signed:n}=t;t.size&&Oe(e,{size:t.size});const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n-1n)-1n;return r<=i?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function Ih(e,t={}){let n=e;if(t.size&&(Oe(n,{size:t.size}),n=Me(n)),Me(n)==="0x00")return!1;if(Me(n)==="0x01")return!0;throw new Ah(n)}function ye(e,t={}){return Number(se(e,t))}function Vo(e,t={}){let n=be(e);return t.size&&(Oe(n,{size:t.size}),n=Me(n,{dir:"right"})),new TextDecoder().decode(n)}const Th=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ge(e,t={}){return typeof e=="number"||typeof e=="bigint"?O(e,t):typeof e=="string"?It(e,t):typeof e=="boolean"?Pa(e,t):oe(e,t)}function Pa(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Oe(n,{size:t.size}),re(n,{size:t.size})):n}function oe(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=Th[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(Oe(r,{size:t.size}),re(r,{dir:"right",size:t.size})):r}function O(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<a){const c=typeof e=="bigint"?"n":"";throw new md({max:i?`${i}${c}`:void 0,min:`${a}${c}`,signed:n,size:r,value:`${e}${c}`})}const o=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?re(o,{size:r}):o}const Oh=new TextEncoder;function It(e,t={}){const n=Oh.encode(e);return oe(n,t)}const Ch=new TextEncoder;function on(e,t={}){return typeof e=="number"||typeof e=="bigint"?$h(e,t):typeof e=="boolean"?Bh(e,t):fe(e)?be(e,t):tt(e,t)}function Bh(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Oe(n,{size:t.size}),re(n,{size:t.size})):n}const Je={zero:48,nine:57,A:65,F:70,a:97,f:102};function Ko(e){if(e>=Je.zero&&e<=Je.nine)return e-Je.zero;if(e>=Je.A&&e<=Je.F)return e-(Je.A-10);if(e>=Je.a&&e<=Je.f)return e-(Je.a-10)}function be(e,t={}){let n=e;t.size&&(Oe(n,{size:t.size}),n=re(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,i=new Uint8Array(s);for(let a=0,o=0;a<s;a++){const c=Ko(r.charCodeAt(o++)),u=Ko(r.charCodeAt(o++));if(c===void 0||u===void 0)throw new P(`Invalid byte sequence ("${r[o-2]}${r[o-1]}" in "${r}").`);i[a]=c*16+u}return i}function $h(e,t){const n=O(e,t);return be(n)}function tt(e,t={}){const n=Ch.encode(e);return typeof t.size=="number"?(Oe(n,{size:t.size}),re(n,{dir:"right",size:t.size})):n}const ur=BigInt(2**32-1),Jo=BigInt(32);function Mh(e,t=!1){return t?{h:Number(e&ur),l:Number(e>>Jo&ur)}:{h:Number(e>>Jo&ur)|0,l:Number(e&ur)|0}}function Nh(e,t=!1){const n=e.length;let r=new Uint32Array(n),s=new Uint32Array(n);for(let i=0;i<n;i++){const{h:a,l:o}=Mh(e[i],t);[r[i],s[i]]=[a,o]}return[r,s]}const Rh=(e,t,n)=>e<<n|t>>>32-n,jh=(e,t,n)=>t<<n|e>>>32-n,Lh=(e,t,n)=>t<<n-32|e>>>64-n,Dh=(e,t,n)=>e<<n-32|t>>>64-n;function Uh(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Zo(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function An(e,...t){if(!Uh(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Or(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function bd(e,t){An(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Fh(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Sn(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ss(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ue(e,t){return e<<32-t|e>>>t}const zh=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Gh(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Hh(e){for(let t=0;t<e.length;t++)e[t]=Gh(e[t]);return e}const Yo=zh?e=>e:Hh;function qh(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function ka(e){return typeof e=="string"&&(e=qh(e)),An(e),e}let yd=class{};function gd(e){const t=r=>e().update(ka(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const Wh=BigInt(0),hn=BigInt(1),Vh=BigInt(2),Kh=BigInt(7),Jh=BigInt(256),Zh=BigInt(113),wd=[],vd=[],xd=[];for(let e=0,t=hn,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],wd.push(2*(5*r+n)),vd.push((e+1)*(e+2)/2%64);let s=Wh;for(let i=0;i<7;i++)t=(t<<hn^(t>>Kh)*Zh)%Jh,t&Vh&&(s^=hn<<(hn<<BigInt(i))-hn);xd.push(s)}const _d=Nh(xd,!0),Yh=_d[0],Qh=_d[1],Qo=(e,t,n)=>n>32?Lh(e,t,n):Rh(e,t,n),Xo=(e,t,n)=>n>32?Dh(e,t,n):jh(e,t,n);function Xh(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let a=0;a<10;a++)n[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){const o=(a+8)%10,c=(a+2)%10,u=n[c],l=n[c+1],d=Qo(u,l,1)^n[o],f=Xo(u,l,1)^n[o+1];for(let p=0;p<50;p+=10)e[a+p]^=d,e[a+p+1]^=f}let s=e[2],i=e[3];for(let a=0;a<24;a++){const o=vd[a],c=Qo(s,i,o),u=Xo(s,i,o),l=wd[a];s=e[l],i=e[l+1],e[l]=c,e[l+1]=u}for(let a=0;a<50;a+=10){for(let o=0;o<10;o++)n[o]=e[a+o];for(let o=0;o<10;o++)e[a+o]^=~n[(o+2)%10]&n[(o+4)%10]}e[0]^=Yh[r],e[1]^=Qh[r]}Sn(n)}class Aa extends yd{constructor(t,n,r,s=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,Zo(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Fh(this.state)}clone(){return this._cloneInto()}keccak(){Yo(this.state32),Xh(this.state32,this.rounds),Yo(this.state32),this.posOut=0,this.pos=0}update(t){Or(this),t=ka(t),An(t);const{blockLen:n,state:r}=this,s=t.length;for(let i=0;i<s;){const a=Math.min(n-this.pos,s-i);for(let o=0;o<a;o++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,(n&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){Or(this,!1),An(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=t.length;s<i;){this.posOut>=r&&this.keccak();const a=Math.min(r-this.posOut,i-s);t.set(n.subarray(this.posOut,this.posOut+a),s),this.posOut+=a,s+=a}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Zo(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(bd(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Sn(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:a}=this;return t||(t=new Aa(n,r,s,a,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=s,t.enableXOF=a,t.destroyed=this.destroyed,t}}const em=(e,t,n)=>gd(()=>new Aa(t,e,n)),Ed=em(1,136,256/8);function K(e,t){const n=t||"hex",r=Ed(fe(e,{strict:!1})?on(e):e);return n==="bytes"?r:ge(r)}const tm=e=>K(on(e));function nm(e){return tm(e)}function rm(e){let t=!0,n="",r=0,s="",i=!1;for(let a=0;a<e.length;a++){const o=e[a];if(["(",")",","].includes(o)&&(t=!0),o==="("&&r++,o===")"&&r--,!!t){if(r===0){if(o===" "&&["event","function",""].includes(s))s="";else if(s+=o,o===")"){i=!0;break}continue}if(o===" "){e[a-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=o,n+=o}}if(!i)throw new P("Unable to normalize signature.");return s}const sm=e=>{const t=typeof e=="string"?e:Ir(e);return rm(t)};function Pd(e){return nm(sm(e))}const ns=Pd;let it=class extends P{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},Qn=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const Is=new Qn(8192);function rs(e,t){if(Is.has(`${e}.${t}`))return Is.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=K(tt(n),"bytes"),s=n.split("");for(let a=0;a<40;a+=2)r[a>>1]>>4>=8&&s[a]&&(s[a]=s[a].toUpperCase()),(r[a>>1]&15)>=8&&s[a+1]&&(s[a+1]=s[a+1].toUpperCase());const i=`0x${s.join("")}`;return Is.set(`${e}.${t}`,i),i}function Cr(e,t){if(!le(e,{strict:!1}))throw new it({address:e});return rs(e,t)}const im=/^0x[a-fA-F0-9]{40}$/,Ts=new Qn(8192);function le(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Ts.has(r))return Ts.get(r);const s=im.test(e)?e.toLowerCase()===e?!0:n?rs(e)===e:!0:!1;return Ts.set(r,s),s}function pe(e){return typeof e[0]=="string"?ot(e):am(e)}function am(e){let t=0;for(const s of e)t+=s.length;const n=new Uint8Array(t);let r=0;for(const s of e)n.set(s,r),r+=s.length;return n}function ot(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Tt(e,t,n,{strict:r}={}){return fe(e,{strict:!1})?li(e,t,n,{strict:r}):Sd(e,t,n,{strict:r})}function kd(e,t){if(typeof t=="number"&&t>0&&t>Z(e)-1)throw new pd({offset:t,position:"start",size:Z(e)})}function Ad(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Z(e)!==n-t)throw new pd({offset:n,position:"end",size:Z(e)})}function Sd(e,t,n,{strict:r}={}){kd(e,t);const s=e.slice(t,n);return r&&Ad(s,t,n),s}function li(e,t,n,{strict:r}={}){kd(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Ad(s,t,n),s}const om=/^(.*)\[([0-9]*)\]$/,Id=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Sa=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function ke(e,t){if(e.length!==t.length)throw new cd({expectedLength:e.length,givenLength:t.length});const n=cm({params:e,values:t}),r=Ta(n);return r.length===0?"0x":r}function cm({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Ia({param:e[r],value:t[r]}));return n}function Ia({param:e,value:t}){const n=Oa(e.type);if(n){const[r,s]=n;return dm(t,{length:r,param:{...e,type:s}})}if(e.type==="tuple")return mm(t,{param:e});if(e.type==="address")return um(t);if(e.type==="bool")return fm(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,s="256"]=Sa.exec(e.type)??[];return pm(t,{signed:r,size:Number(s)})}if(e.type.startsWith("bytes"))return lm(t,{param:e});if(e.type==="string")return hm(t);throw new wh(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Ta(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:a,encoded:o}=e[i];a?t+=32:t+=Z(o)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:a,encoded:o}=e[i];a?(n.push(O(t+s,{size:32})),r.push(o),s+=Z(o)):n.push(o)}return pe([...n,...r])}function um(e){if(!le(e))throw new it({address:e});return{dynamic:!1,encoded:yt(e.toLowerCase())}}function dm(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new fd(e);if(!r&&e.length!==t)throw new fh({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let s=!1;const i=[];for(let a=0;a<e.length;a++){const o=Ia({param:n,value:e[a]});o.dynamic&&(s=!0),i.push(o)}if(r||s){const a=Ta(i);if(r){const o=O(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?pe([o,a]):o}}if(s)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:pe(i.map(({encoded:a})=>a))}}function lm(e,{param:t}){const[,n]=t.type.split("bytes"),r=Z(e);if(!n){let s=e;return r%32!==0&&(s=yt(s,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:pe([yt(O(r,{size:32})),s])}}if(r!==Number.parseInt(n,10))throw new ph({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:yt(e,{dir:"right"})}}function fm(e){if(typeof e!="boolean")throw new P(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:yt(Pa(e))}}function pm(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new md({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:O(e,{size:32,signed:t})}}function hm(e){const t=It(e),n=Math.ceil(Z(t)/32),r=[];for(let s=0;s<n;s++)r.push(yt(Tt(t,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:pe([yt(O(Z(t),{size:32})),...r])}}function mm(e,{param:t}){let n=!1;const r=[];for(let s=0;s<t.components.length;s++){const i=t.components[s],a=Array.isArray(e)?s:i.name,o=Ia({param:i,value:e[a]});r.push(o),o.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Ta(r):pe(r.map(({encoded:s})=>s))}}function Oa(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Xn=e=>Tt(Pd(e),0,4);function Mt(e){const{abi:t,args:n=[],name:r}=e,s=fe(r,{strict:!1}),i=t.filter(o=>s?o.type==="function"?Xn(o)===r:o.type==="event"?ns(o)===r:!1:"name"in o&&o.name===r);if(i.length===0)return;if(i.length===1)return i[0];let a;for(const o of i){if(!("inputs"in o))continue;if(!n||n.length===0){if(!o.inputs||o.inputs.length===0)return o;continue}if(!o.inputs||o.inputs.length===0||o.inputs.length!==n.length)continue;if(n.every((u,l)=>{const d="inputs"in o&&o.inputs[l];return d?fi(u,d):!1})){if(a&&"inputs"in a&&a.inputs){const u=Td(o.inputs,a.inputs,n);if(u)throw new gh({abiItem:o,type:u[0]},{abiItem:a,type:u[1]})}a=o}}return a||i[0]}function fi(e,t){const n=typeof e,r=t.type;switch(r){case"address":return le(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((s,i)=>n==="object"&&fi(Object.values(e)[i],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(s=>fi(s,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Td(e,t,n){for(const r in e){const s=e[r],i=t[r];if(s.type==="tuple"&&i.type==="tuple"&&"components"in s&&"components"in i)return Td(s.components,i.components,n[r]);const a=[s.type,i.type];if(a.includes("address")&&a.includes("bytes20")?!0:a.includes("address")&&a.includes("string")?le(n[r],{strict:!1}):a.includes("address")&&a.includes("bytes")?le(n[r],{strict:!1}):!1)return a}}const ec="/docs/contract/encodeEventTopics";function er(e){const{abi:t,eventName:n,args:r}=e;let s=t[0];if(n){const c=Mt({abi:t,name:n});if(!c)throw new qo(n,{docsPath:ec});s=c}if(s.type!=="event")throw new qo(void 0,{docsPath:ec});const i=Ne(s),a=ns(i);let o=[];if(r&&"inputs"in s){const c=s.inputs?.filter(l=>"indexed"in l&&l.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?c?.map(l=>r[l.name])??[]:[];u.length>0&&(o=c?.map((l,d)=>Array.isArray(u[d])?u[d].map((f,p)=>tc({param:l,value:u[d][p]})):typeof u[d]<"u"&&u[d]!==null?tc({param:l,value:u[d]}):null)??[])}return[a,...o]}function tc({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return K(on(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Eh(e.type);return ke([e],[t])}function ss(e,{method:t}){const n={};return e.transport.type==="fallback"&&e.transport.onResponse?.(({method:r,response:s,status:i,transport:a})=>{i==="success"&&t===r&&(n[s]=a.request)}),(r=>n[r]||e.request)}async function Od(e,t){const{address:n,abi:r,args:s,eventName:i,fromBlock:a,strict:o,toBlock:c}=t,u=ss(e,{method:"eth_newFilter"}),l=i?er({abi:r,args:s,eventName:i}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof a=="bigint"?O(a):a,toBlock:typeof c=="bigint"?O(c):c,topics:l}]});return{abi:r,args:s,eventName:i,id:d,request:u(d),strict:!!o,type:"event"}}function ue(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const nc="/docs/contract/encodeFunctionData";function bm(e){const{abi:t,args:n,functionName:r}=e;let s=t[0];if(r){const i=Mt({abi:t,args:n,name:r});if(!i)throw new Yt(r,{docsPath:nc});s=i}if(s.type!=="function")throw new Yt(void 0,{docsPath:nc});return{abi:[s],functionName:Xn(Ne(s))}}function ie(e){const{args:t}=e,{abi:n,functionName:r}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:bm(e),s=n[0],i=r,a="inputs"in s&&s.inputs?ke(s.inputs,t??[]):void 0;return ot([i,a??"0x"])}const ym={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},Cd={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},gm={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let rc=class extends P{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},Bd=class extends P{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},wm=class extends P{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const vm={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new wm({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Bd({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new rc({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new rc({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function Ca(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(vm);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function xm(e,t={}){typeof t.size<"u"&&Oe(e,{size:t.size});const n=oe(e,t);return se(n,t)}function _m(e,t={}){let n=e;if(typeof t.size<"u"&&(Oe(n,{size:t.size}),n=Me(n)),n.length>1||n[0]>1)throw new kh(n);return!!n[0]}function nt(e,t={}){typeof t.size<"u"&&Oe(e,{size:t.size});const n=oe(e,t);return ye(n,t)}function Em(e,t={}){let n=e;return typeof t.size<"u"&&(Oe(n,{size:t.size}),n=Me(n,{dir:"right"})),new TextDecoder().decode(n)}function Nt(e,t){const n=typeof t=="string"?be(t):t,r=Ca(n);if(Z(n)===0&&e.length>0)throw new Yn;if(Z(t)&&Z(t)<32)throw new od({data:typeof t=="string"?t:oe(t),params:e,size:Z(t)});let s=0;const i=[];for(let a=0;a<e.length;++a){const o=e[a];r.setPosition(s);const[c,u]=Wt(r,o,{staticPosition:0});s+=u,i.push(c)}return i}function Wt(e,t,{staticPosition:n}){const r=Oa(t.type);if(r){const[s,i]=r;return km(e,{...t,type:i},{length:s,staticPosition:n})}if(t.type==="tuple")return Tm(e,t,{staticPosition:n});if(t.type==="address")return Pm(e);if(t.type==="bool")return Am(e);if(t.type.startsWith("bytes"))return Sm(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Im(e,t);if(t.type==="string")return Om(e,{staticPosition:n});throw new vh(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const sc=32,pi=32;function Pm(e){const t=e.readBytes(32);return[rs(oe(Sd(t,-20))),32]}function km(e,t,{length:n,staticPosition:r}){if(!n){const a=nt(e.readBytes(pi)),o=r+a,c=o+sc;e.setPosition(o);const u=nt(e.readBytes(sc)),l=In(t);let d=0;const f=[];for(let p=0;p<u;++p){e.setPosition(c+(l?p*32:d));const[m,h]=Wt(e,t,{staticPosition:c});d+=h,f.push(m)}return e.setPosition(r+32),[f,32]}if(In(t)){const a=nt(e.readBytes(pi)),o=r+a,c=[];for(let u=0;u<n;++u){e.setPosition(o+u*32);const[l]=Wt(e,t,{staticPosition:o});c.push(l)}return e.setPosition(r+32),[c,32]}let s=0;const i=[];for(let a=0;a<n;++a){const[o,c]=Wt(e,t,{staticPosition:r+s});s+=c,i.push(o)}return[i,s]}function Am(e){return[_m(e.readBytes(32),{size:32}),32]}function Sm(e,t,{staticPosition:n}){const[r,s]=t.type.split("bytes");if(!s){const a=nt(e.readBytes(32));e.setPosition(n+a);const o=nt(e.readBytes(32));if(o===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(o);return e.setPosition(n+32),[oe(c),32]}return[oe(e.readBytes(Number.parseInt(s,10),32)),32]}function Im(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),s=e.readBytes(32);return[r>48?xm(s,{signed:n}):nt(s,{signed:n}),32]}function Tm(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:a})=>!a),s=r?[]:{};let i=0;if(In(t)){const a=nt(e.readBytes(pi)),o=n+a;for(let c=0;c<t.components.length;++c){const u=t.components[c];e.setPosition(o+i);const[l,d]=Wt(e,u,{staticPosition:o});i+=d,s[r?c:u?.name]=l}return e.setPosition(n+32),[s,32]}for(let a=0;a<t.components.length;++a){const o=t.components[a],[c,u]=Wt(e,o,{staticPosition:n});s[r?a:o?.name]=c,i+=u}return[s,i]}function Om(e,{staticPosition:t}){const n=nt(e.readBytes(32)),r=t+n;e.setPosition(r);const s=nt(e.readBytes(32));if(s===0)return e.setPosition(t+32),["",32];const i=e.readBytes(s,32),a=Em(Me(i));return e.setPosition(t+32),[a,32]}function In(e){const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(In);const n=Oa(e.type);return!!(n&&In({...e,type:n[1]}))}function $d(e){const{abi:t,data:n}=e,r=Tt(n,0,4);if(r==="0x")throw new Yn;const i=[...t||[],Cd,gm].find(a=>a.type==="error"&&r===Xn(Ne(a)));if(!i)throw new ud(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:i,args:"inputs"in i&&i.inputs&&i.inputs.length>0?Nt(i.inputs,Tt(n,4)):void 0,errorName:i.name}}const ae=(e,t,n)=>JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString():s,n);function Md({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((s,i)=>`${r&&s.name?`${s.name}: `:""}${typeof t[i]=="object"?ae(t[i]):t[i]}`).join(", ")})`}const Cm={gwei:9,wei:18},Bm={ether:-9,wei:9};function Nd(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[s,i]=[n.slice(0,n.length-t),n.slice(n.length-t)];return i=i.replace(/(0+)$/,""),`${r?"-":""}${s||"0"}${i?`.${i}`:""}`}function Ba(e,t="wei"){return Nd(e,Cm[t])}function he(e,t="wei"){return Nd(e,Bm[t])}class $m extends P{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Mm extends P{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function ic(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
|
|
26
|
+
`,"")}function Nm(e){return e.reduce((t,{address:n,...r})=>{let s=`${t} ${n}:
|
|
27
|
+
`;return r.nonce&&(s+=` nonce: ${r.nonce}
|
|
28
|
+
`),r.balance&&(s+=` balance: ${r.balance}
|
|
29
|
+
`),r.code&&(s+=` code: ${r.code}
|
|
30
|
+
`),r.state&&(s+=` state:
|
|
31
|
+
`,s+=ic(r.state)),r.stateDiff&&(s+=` stateDiff:
|
|
32
|
+
`,s+=ic(r.stateDiff)),s},` State Override:
|
|
33
|
+
`).slice(0,-1)}function cn(e){const t=Object.entries(e).map(([r,s])=>s===void 0||s===!1?null:[r,s]).filter(Boolean),n=t.reduce((r,[s])=>Math.max(r,s.length),0);return t.map(([r,s])=>` ${`${r}:`.padEnd(n+1)} ${s}`).join(`
|
|
34
|
+
`)}class Rm extends P{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",cn(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class jm extends P{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:a,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:d,value:f}){const p=cn({chain:s&&`${s?.name} (id: ${s?.id})`,from:n?.address,to:d,value:typeof f<"u"&&`${Ba(f)} ${s?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:a,gasPrice:typeof o<"u"&&`${he(o)} gwei`,maxFeePerGas:typeof c<"u"&&`${he(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${he(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",p].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Rd extends P{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:s,index:i}){let a="Transaction";r&&i!==void 0&&(a=`Transaction at block time "${r}" at index "${i}"`),t&&i!==void 0&&(a=`Transaction at block hash "${t}" at index "${i}"`),n&&i!==void 0&&(a=`Transaction at block number "${n}" at index "${i}"`),s&&(a=`Transaction with hash "${s}"`),super(`${a} could not be found.`,{name:"TransactionNotFoundError"})}}class jd extends P{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class Lm extends P{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}}class Dm extends P{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const Um=e=>e,$a=e=>e;class Ld extends P{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:a,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:d,value:f,stateOverride:p}){const m=n?ue(n):void 0;let h=cn({from:m?.address,to:d,value:typeof f<"u"&&`${Ba(f)} ${s?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:a,gasPrice:typeof o<"u"&&`${he(o)} gwei`,maxFeePerGas:typeof c<"u"&&`${he(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${he(u)} gwei`,nonce:l});p&&(h+=`
|
|
35
|
+
${Nm(p)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",h].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Ma extends P{constructor(t,{abi:n,args:r,contractAddress:s,docsPath:i,functionName:a,sender:o}){const c=Mt({abi:n,args:r,name:a}),u=c?Md({abiItem:c,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=c?Ne(c,{includeName:!0}):void 0,d=cn({address:s&&Um(s),function:l,args:u&&u!=="()"&&`${[...Array(a?.length??0).keys()].map(()=>" ").join("")}${u}`,sender:o});super(t.shortMessage||`An unknown error occurred while executing the contract function "${a}".`,{cause:t,docsPath:i,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],d&&"Contract Call:",d].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=t,this.contractAddress=s,this.functionName=a,this.sender=o}}class Br extends P{constructor({abi:t,data:n,functionName:r,message:s}){let i,a,o,c;if(n&&n!=="0x")try{a=$d({abi:t,data:n});const{abiItem:l,errorName:d,args:f}=a;if(d==="Error")c=f[0];else if(d==="Panic"){const[p]=f;c=ym[p]}else{const p=l?Ne(l,{includeName:!0}):void 0,m=l&&f?Md({abiItem:l,args:f,includeFunctionName:!1,includeName:!1}):void 0;o=[p?`Error: ${p}`:"",m&&m!=="()"?` ${[...Array(d?.length??0).keys()].map(()=>" ").join("")}${m}`:""]}}catch(l){i=l}else s&&(c=s);let u;i instanceof ud&&(u=i.signature,o=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.`]),super(c&&c!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,c||u].join(`
|
|
36
|
+
`):`The contract function "${r}" reverted.`,{cause:i,metaMessages:o,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=a,this.raw=n,this.reason=c,this.signature=u}}class Dd extends P{constructor({functionName:t}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class Fm extends P{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class is extends P{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}class En extends P{constructor({body:t,cause:n,details:r,headers:s,status:i,url:a}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[i&&`Status: ${i}`,`URL: ${$a(a)}`,t&&`Request body: ${ae(t)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=s,this.status=i,this.url=a}}class Na extends P{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${$a(r)}`,`Request body: ${ae(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=r}}class ac extends P{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${$a(n)}`,`Request body: ${ae(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const zm=-1;class xe extends P{constructor(t,{code:n,docsPath:r,metaMessages:s,name:i,shortMessage:a}){super(a,{cause:t,docsPath:r,metaMessages:s||t?.metaMessages,name:i||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i||t.name,this.code=t instanceof Na?t.code:n??zm}}class Se extends xe{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class Tn extends xe{constructor(t){super(t,{code:Tn.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Tn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class On extends xe{constructor(t){super(t,{code:On.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(On,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Cn extends xe{constructor(t,{method:n}={}){super(t,{code:Cn.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(Cn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Bn extends xe{constructor(t){super(t,{code:Bn.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
|
|
37
|
+
`)})}}Object.defineProperty(Bn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Ot extends xe{constructor(t){super(t,{code:Ot.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Ot,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class wt extends xe{constructor(t){super(t,{code:wt.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
38
|
+
`)})}}Object.defineProperty(wt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class $n extends xe{constructor(t){super(t,{code:$n.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty($n,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Mn extends xe{constructor(t){super(t,{code:Mn.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Mn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Nn extends xe{constructor(t){super(t,{code:Nn.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Nn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class kt extends xe{constructor(t,{method:n}={}){super(t,{code:kt.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(kt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Qt extends xe{constructor(t){super(t,{code:Qt.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Qt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Rn extends xe{constructor(t){super(t,{code:Rn.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Rn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Vt extends Se{constructor(t){super(t,{code:Vt.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Vt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class jn extends Se{constructor(t){super(t,{code:jn.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(jn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Ln extends Se{constructor(t,{method:n}={}){super(t,{code:Ln.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(Ln,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Dn extends Se{constructor(t){super(t,{code:Dn.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Dn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Un extends Se{constructor(t){super(t,{code:Un.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Un,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Fn extends Se{constructor(t){super(t,{code:Fn.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Fn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class zn extends Se{constructor(t){super(t,{code:zn.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(zn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class Gn extends Se{constructor(t){super(t,{code:Gn.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(Gn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Hn extends Se{constructor(t){super(t,{code:Hn.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Hn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class qn extends Se{constructor(t){super(t,{code:qn.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(qn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class Wn extends Se{constructor(t){super(t,{code:Wn.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(Wn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class Vn extends Se{constructor(t){super(t,{code:Vn.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(Vn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class Kn extends Se{constructor(t){super(t,{code:Kn.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(Kn,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Gm extends xe{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Hm=3;function Xt(e,{abi:t,address:n,args:r,docsPath:s,functionName:i,sender:a}){const o=e instanceof is?e:e instanceof P?e.walk(m=>"data"in m)||e.walk():{},{code:c,data:u,details:l,message:d,shortMessage:f}=o,p=e instanceof Yn?new Dd({functionName:i}):[Hm,Ot.code].includes(c)&&(u||l||d||f)||c===wt.code&&l==="execution reverted"&&u?new Br({abi:t,data:typeof u=="object"?u.data:u,functionName:i,message:o instanceof Na?l:f??d}):e;return new Ma(p,{abi:t,args:r,contractAddress:n,docsPath:s,functionName:i,sender:a})}function qm(e){const t=K(`0x${e.substring(4)}`).substring(26);return rs(`0x${t}`)}async function Wm({hash:e,signature:t}){const n=fe(e)?e:ge(e),{secp256k1:r}=await du(async()=>{const{secp256k1:a}=await import("./index-C4Lbscxg.js").then(o=>o.w);return{secp256k1:a}},__vite__mapDeps([0,1]));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:d,yParity:f}=t,p=Number(f??d),m=oc(p);return new r.Signature(se(u),se(l)).addRecoveryBit(m)}const a=fe(t)?t:ge(t);if(Z(a)!==65)throw new Error("invalid signature length");const o=ye(`0x${a.slice(130)}`),c=oc(o);return r.Signature.fromCompact(a.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function oc(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}async function Ud({hash:e,signature:t}){return qm(await Wm({hash:e,signature:t}))}function Vm(e,t="hex"){const n=Fd(e),r=Ca(new Uint8Array(n.length));return n.encode(r),t==="hex"?oe(r.bytes):r.bytes}function Fd(e){return Array.isArray(e)?Km(e.map(t=>Fd(t))):Jm(e)}function Km(e){const t=e.reduce((s,i)=>s+i.length,0),n=zd(t);return{length:t<=55?1+t:1+n+t,encode(s){t<=55?s.pushByte(192+t):(s.pushByte(247+n),n===1?s.pushUint8(t):n===2?s.pushUint16(t):n===3?s.pushUint24(t):s.pushUint32(t));for(const{encode:i}of e)i(s)}}}function Jm(e){const t=typeof e=="string"?be(e):e,n=zd(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(s){t.length===1&&t[0]<128?s.pushBytes(t):t.length<=55?(s.pushByte(128+t.length),s.pushBytes(t)):(s.pushByte(183+n),n===1?s.pushUint8(t.length):n===2?s.pushUint16(t.length):n===3?s.pushUint24(t.length):s.pushUint32(t.length),s.pushBytes(t))}}}function zd(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new P("Length is too large.")}function Zm(e){const{chainId:t,nonce:n,to:r}=e,s=e.contractAddress??e.address,i=K(ot(["0x05",Vm([t?O(t):"0x",s,n?O(n):"0x"])]));return r==="bytes"?be(i):i}async function Gd(e){const{authorization:t,signature:n}=e;return Ud({hash:Zm(t),signature:n??t})}class Ym extends P{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:a,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:d,value:f}){const p=cn({from:n?.address,to:d,value:typeof f<"u"&&`${Ba(f)} ${s?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:a,gasPrice:typeof o<"u"&&`${he(o)} gwei`,maxFeePerGas:typeof c<"u"&&`${he(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${he(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",p].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}let zt=class extends P{constructor({cause:t,message:n}={}){const r=n?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}};Object.defineProperty(zt,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(zt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class $r extends P{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${he(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty($r,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class hi extends P{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${he(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(hi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mi extends P{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(mi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class bi extends P{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
|
|
39
|
+
`),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(bi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class yi extends P{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(yi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class gi extends P{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
|
|
40
|
+
`),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(gi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class wi extends P{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(wi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class vi extends P{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(vi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class xi extends P{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(xi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Mr extends P{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${he(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${he(r)} gwei`:""}).`].join(`
|
|
41
|
+
`),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Mr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class tr extends P{constructor({cause:t}){super(`An error occurred while executing: ${t?.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function as(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof P?e.walk(s=>s?.code===zt.code):e;return r instanceof P?new zt({cause:e,message:r.details}):zt.nodeMessage.test(n)?new zt({cause:e,message:e.details}):$r.nodeMessage.test(n)?new $r({cause:e,maxFeePerGas:t?.maxFeePerGas}):hi.nodeMessage.test(n)?new hi({cause:e,maxFeePerGas:t?.maxFeePerGas}):mi.nodeMessage.test(n)?new mi({cause:e,nonce:t?.nonce}):bi.nodeMessage.test(n)?new bi({cause:e,nonce:t?.nonce}):yi.nodeMessage.test(n)?new yi({cause:e,nonce:t?.nonce}):gi.nodeMessage.test(n)?new gi({cause:e}):wi.nodeMessage.test(n)?new wi({cause:e,gas:t?.gas}):vi.nodeMessage.test(n)?new vi({cause:e,gas:t?.gas}):xi.nodeMessage.test(n)?new xi({cause:e}):Mr.nodeMessage.test(n)?new Mr({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new tr({cause:e})}function Qm(e,{docsPath:t,...n}){const r=(()=>{const s=as(e,n);return s instanceof tr?e:s})();return new Ym(r,{docsPath:t,...n})}function os(e,{format:t}){if(!t)return{};const n={};function r(i){const a=Object.keys(i);for(const o of a)o in e&&(n[o]=e[o]),i[o]&&typeof i[o]=="object"&&!Array.isArray(i[o])&&r(i[o])}const s=t(e||{});return r(s),n}const Xm={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function nr(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=eb(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(r=>oe(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=O(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=O(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=O(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=O(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=O(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=O(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Xm[e.type]),typeof e.value<"u"&&(n.value=O(e.value)),n}function eb(e){return e.map(t=>({address:t.address,r:t.r?O(BigInt(t.r)):t.r,s:t.s?O(BigInt(t.s)):t.s,chainId:O(t.chainId),nonce:O(t.nonce),...typeof t.yParity<"u"?{yParity:O(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:O(t.v)}:{}}))}function cc(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Wo({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Wo({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function tb(e){const{balance:t,nonce:n,state:r,stateDiff:s,code:i}=e,a={};if(i!==void 0&&(a.code=i),t!==void 0&&(a.balance=O(t)),n!==void 0&&(a.nonce=O(n)),r!==void 0&&(a.state=cc(r)),s!==void 0){if(a.state)throw new Mm;a.stateDiff=cc(s)}return a}function cs(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!le(n,{strict:!1}))throw new it({address:n});if(t[n])throw new $m({address:n});t[n]=tb(r)}return t}const nb=2n**256n-1n;function un(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:s}=e,i=t?ue(t):void 0;if(i&&!le(i.address))throw new it({address:i.address});if(s&&!le(s))throw new it({address:s});if(n&&n>nb)throw new $r({maxFeePerGas:n});if(r&&n&&r>n)throw new Mr({maxFeePerGas:n,maxPriorityFeePerGas:r})}class Hd extends P{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ra extends P{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class rb extends P{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${he(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class qd extends P{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const Wd={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function ja(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?ye(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?ye(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Wd[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=sb(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}function sb(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function Vd(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:ja(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function Be(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:s}={}){const i=s??!1,a=n!==void 0?O(n):void 0;let o=null;if(t?o=await e.request({method:"eth_getBlockByHash",params:[t,i]},{dedupe:!0}):o=await e.request({method:"eth_getBlockByNumber",params:[a||r,i]},{dedupe:!!a}),!o)throw new qd({blockHash:t,blockNumber:n});return(e.chain?.formatters?.block?.format||Vd)(o,"getBlock")}async function La(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function ib(e,t){return Kd(e,t)}async function Kd(e,t){const{block:n,chain:r=e.chain,request:s}=t||{};try{const i=r?.fees?.maxPriorityFeePerGas??r?.fees?.defaultPriorityFee;if(typeof i=="function"){const o=n||await M(e,Be,"getBlock")({}),c=await i({block:o,client:e,request:s});if(c===null)throw new Error;return c}if(typeof i<"u")return i;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return se(a)}catch{const[i,a]=await Promise.all([n?Promise.resolve(n):M(e,Be,"getBlock")({}),M(e,La,"getGasPrice")({})]);if(typeof i.baseFeePerGas!="bigint")throw new Ra;const o=a-i.baseFeePerGas;return o<0n?0n:o}}async function Jd(e,t){return _i(e,t)}async function _i(e,t){const{block:n,chain:r=e.chain,request:s,type:i="eip1559"}=t||{},a=await(async()=>typeof r?.fees?.baseFeeMultiplier=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:s}):r?.fees?.baseFeeMultiplier??1.2)();if(a<1)throw new Hd;const c=10**(a.toString().split(".")[1]?.length??0),u=f=>f*BigInt(Math.ceil(a*c))/BigInt(c),l=n||await M(e,Be,"getBlock")({});if(typeof r?.fees?.estimateFeesPerGas=="function"){const f=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:u,request:s,type:i});if(f!==null)return f}if(i==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new Ra;const f=typeof s?.maxPriorityFeePerGas=="bigint"?s.maxPriorityFeePerGas:await Kd(e,{block:l,chain:r,request:s}),p=u(l.baseFeePerGas);return{maxFeePerGas:s?.maxFeePerGas??p+f,maxPriorityFeePerGas:f}}return{gasPrice:s?.gasPrice??u(await M(e,La,"getGasPrice")({}))}}async function Da(e,{address:t,blockTag:n="latest",blockNumber:r}){const s=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?O(r):n]},{dedupe:!!r});return ye(s)}function Zd(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>be(i)):e.blobs,s=[];for(const i of r)s.push(Uint8Array.from(t.blobToKzgCommitment(i)));return n==="bytes"?s:s.map(i=>oe(i))}function Yd(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(a=>be(a)):e.blobs,s=typeof e.commitments[0]=="string"?e.commitments.map(a=>be(a)):e.commitments,i=[];for(let a=0;a<r.length;a++){const o=r[a],c=s[a];i.push(Uint8Array.from(t.computeBlobKzgProof(o,c)))}return n==="bytes"?i:i.map(a=>oe(a))}function ab(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),a=Number(n>>s&i),o=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,a,r),e.setUint32(t+u,o,r)}function ob(e,t,n){return e&t^~e&n}function cb(e,t,n){return e&t^e&n^t&n}let ub=class extends yd{constructor(t,n,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(t),this.view=Ss(this.buffer)}update(t){Or(this),t=ka(t),An(t);const{view:n,buffer:r,blockLen:s}=this,i=t.length;for(let a=0;a<i;){const o=Math.min(s-this.pos,i-a);if(o===s){const c=Ss(t);for(;s<=i-a;a+=s)this.process(c,a);continue}r.set(t.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Or(this),bd(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:a}=this;n[a++]=128,Sn(this.buffer.subarray(a)),this.padOffset>s-a&&(this.process(r,0),a=0);for(let d=a;d<s;d++)n[d]=0;ab(r,s-8,BigInt(this.length*8),i),this.process(r,0);const o=Ss(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)o.setUint32(4*d,l[d],i)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:a,pos:o}=this;return t.destroyed=a,t.finished=i,t.length=s,t.pos=o,s%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const ut=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),db=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),dt=new Uint32Array(64);let lb=class extends ub{constructor(t=32){super(64,t,8,!1),this.A=ut[0]|0,this.B=ut[1]|0,this.C=ut[2]|0,this.D=ut[3]|0,this.E=ut[4]|0,this.F=ut[5]|0,this.G=ut[6]|0,this.H=ut[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:a,G:o,H:c}=this;return[t,n,r,s,i,a,o,c]}set(t,n,r,s,i,a,o,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)dt[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const f=dt[d-15],p=dt[d-2],m=Ue(f,7)^Ue(f,18)^f>>>3,h=Ue(p,17)^Ue(p,19)^p>>>10;dt[d]=h+dt[d-7]+m+dt[d-16]|0}let{A:r,B:s,C:i,D:a,E:o,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const f=Ue(o,6)^Ue(o,11)^Ue(o,25),p=l+f+ob(o,c,u)+db[d]+dt[d]|0,h=(Ue(r,2)^Ue(r,13)^Ue(r,22))+cb(r,s,i)|0;l=u,u=c,c=o,o=a+p|0,a=i,i=s,s=r,r=p+h|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,s,i,a,o,c,u,l)}roundClean(){Sn(dt)}destroy(){this.set(0,0,0,0,0,0,0,0),Sn(this.buffer)}};const fb=gd(()=>new lb),pb=fb;function hb(e,t){return pb(fe(e,{strict:!1})?on(e):e)}function mb(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),s=hb(t);return s.set([n],0),r==="bytes"?s:oe(s)}function bb(e){const{commitments:t,version:n}=e,r=e.to,s=[];for(const i of t)s.push(mb({commitment:i,to:r,version:n}));return s}const uc=6,Qd=32,Ua=4096,Xd=Qd*Ua,dc=Xd*uc-1-1*Ua*uc;class yb extends P{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class gb extends P{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function wb(e){const t=typeof e.data=="string"?be(e.data):e.data,n=Z(t);if(!n)throw new gb;if(n>dc)throw new yb({maxSize:dc,size:n});const r=[];let s=!0,i=0;for(;s;){const a=Ca(new Uint8Array(Xd));let o=0;for(;o<Ua;){const c=t.slice(i,i+(Qd-1));if(a.pushByte(0),a.pushBytes(c),c.length<31){a.pushByte(128),s=!1;break}o++,i+=31}r.push(a)}return r.map(a=>oe(a.bytes))}function vb(e){const{data:t,kzg:n,to:r}=e,s=e.blobs??wb({data:t}),i=e.commitments??Zd({blobs:s,kzg:n,to:r}),a=e.proofs??Yd({blobs:s,commitments:i,kzg:n,to:r}),o=[];for(let c=0;c<s.length;c++)o.push({blob:s[c],commitment:i[c],proof:a[c]});return o}function xb(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new Rm({transaction:e})}function _b(e,{docsPath:t,...n}){const r=(()=>{const s=as(e,n);return s instanceof tr?e:s})();return new jm(r,{docsPath:t,...n})}async function dn(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return ye(t)}async function el(e,t){const{account:n=e.account,accessList:r,authorizationList:s,chain:i=e.chain,blobVersionedHashes:a,blobs:o,data:c,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:p,nonce:m,nonceManager:h,to:b,type:y,value:g,..._}=t,w=await(async()=>{if(!n||!h||typeof m<"u")return m;const T=ue(n),S=i?i.id:await M(e,dn,"getChainId")({});return await h.consume({address:T.address,chainId:S,client:e})})();un(t);const x=i?.formatters?.transactionRequest?.format,A=(x||nr)({...os(_,{format:x}),account:n?ue(n):void 0,accessList:r,authorizationList:s,blobs:o,blobVersionedHashes:a,data:c,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:p,nonce:w,to:b,type:y,value:g},"fillTransaction");try{const T=await e.request({method:"eth_fillTransaction",params:[A]}),v=(i?.formatters?.transaction?.format||ja)(T.tx);delete v.blockHash,delete v.blockNumber,delete v.r,delete v.s,delete v.transactionIndex,delete v.v,delete v.yParity,v.data=v.input,v.gas&&(v.gas=t.gas??v.gas),v.gasPrice&&(v.gasPrice=t.gasPrice??v.gasPrice),v.maxFeePerBlobGas&&(v.maxFeePerBlobGas=t.maxFeePerBlobGas??v.maxFeePerBlobGas),v.maxFeePerGas&&(v.maxFeePerGas=t.maxFeePerGas??v.maxFeePerGas),v.maxPriorityFeePerGas&&(v.maxPriorityFeePerGas=t.maxPriorityFeePerGas??v.maxPriorityFeePerGas),v.nonce&&(v.nonce=t.nonce??v.nonce);const I=await(async()=>{if(typeof i?.fees?.baseFeeMultiplier=="function"){const L=await M(e,Be,"getBlock")({});return i.fees.baseFeeMultiplier({block:L,client:e,request:t})}return i?.fees?.baseFeeMultiplier??1.2})();if(I<1)throw new Hd;const C=10**(I.toString().split(".")[1]?.length??0),N=L=>L*BigInt(Math.ceil(I*C))/BigInt(C);return v.maxFeePerGas&&!t.maxFeePerGas&&(v.maxFeePerGas=N(v.maxFeePerGas)),v.gasPrice&&!t.gasPrice&&(v.gasPrice=N(v.gasPrice)),{raw:T.raw,transaction:{from:A.from,...v}}}catch(T){throw _b(T,{...t,chain:e.chain})}}const Eb=["blobVersionedHashes","chainId","fees","gas","nonce","type"],lc=new Map,Os=new Qn(128);async function tl(e,t){let n=t;n.account??=e.account,n.parameters??=Eb;const{account:r,chain:s=e.chain,nonceManager:i,parameters:a}=n,o=(()=>{if(typeof s?.prepareTransactionRequest=="function")return{fn:s.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(s?.prepareTransactionRequest))return{fn:s.prepareTransactionRequest[0],runAt:s.prepareTransactionRequest[1].runAt}})();let c;async function u(){return c||(typeof n.chainId<"u"?n.chainId:s?s.id:(c=await M(e,dn,"getChainId")({}),c))}const l=r&&ue(r);let d=n.nonce;if(a.includes("nonce")&&typeof d>"u"&&l&&i){const w=await u();d=await i.consume({address:l.address,chainId:w,client:e})}o?.fn&&o.runAt?.includes("beforeFillTransaction")&&(n=await o.fn({...n,chain:s},{phase:"beforeFillTransaction"}),d??=n.nonce);const p=((a.includes("blobVersionedHashes")||a.includes("sidecars"))&&n.kzg&&n.blobs||Os.get(e.uid)===!1||!["fees","gas"].some(x=>a.includes(x))?!1:!!(a.includes("chainId")&&typeof n.chainId!="number"||a.includes("nonce")&&typeof d!="number"||a.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||a.includes("gas")&&typeof n.gas!="bigint"))?await M(e,el,"fillTransaction")({...n,nonce:d}).then(w=>{const{chainId:x,from:k,gas:A,gasPrice:T,nonce:S,maxFeePerBlobGas:v,maxFeePerGas:I,maxPriorityFeePerGas:E,type:C,...N}=w.transaction;return Os.set(e.uid,!0),{...n,...k?{from:k}:{},...C?{type:C}:{},...typeof x<"u"?{chainId:x}:{},...typeof A<"u"?{gas:A}:{},...typeof T<"u"?{gasPrice:T}:{},...typeof S<"u"?{nonce:S}:{},...typeof v<"u"?{maxFeePerBlobGas:v}:{},...typeof I<"u"?{maxFeePerGas:I}:{},...typeof E<"u"?{maxPriorityFeePerGas:E}:{},..."nonceKey"in N&&typeof N.nonceKey<"u"?{nonceKey:N.nonceKey}:{}}}).catch(w=>{const x=w;return x.name!=="TransactionExecutionError"||x.walk?.(A=>{const T=A;return T.name==="MethodNotFoundRpcError"||T.name==="MethodNotSupportedRpcError"})&&Os.set(e.uid,!1),n}):n;d??=p.nonce,n={...p,...l?{from:l?.address}:{},...d?{nonce:d}:{}};const{blobs:m,gas:h,kzg:b,type:y}=n;o?.fn&&o.runAt?.includes("beforeFillParameters")&&(n=await o.fn({...n,chain:s},{phase:"beforeFillParameters"}));let g;async function _(){return g||(g=await M(e,Be,"getBlock")({blockTag:"latest"}),g)}if(a.includes("nonce")&&typeof d>"u"&&l&&!i&&(n.nonce=await M(e,Da,"getTransactionCount")({address:l.address,blockTag:"pending"})),(a.includes("blobVersionedHashes")||a.includes("sidecars"))&&m&&b){const w=Zd({blobs:m,kzg:b});if(a.includes("blobVersionedHashes")){const x=bb({commitments:w,to:"hex"});n.blobVersionedHashes=x}if(a.includes("sidecars")){const x=Yd({blobs:m,commitments:w,kzg:b}),k=vb({blobs:m,commitments:w,proofs:x,to:"hex"});n.sidecars=k}}if(a.includes("chainId")&&(n.chainId=await u()),(a.includes("fees")||a.includes("type"))&&typeof y>"u")try{n.type=xb(n)}catch{let w=lc.get(e.uid);typeof w>"u"&&(w=typeof(await _())?.baseFeePerGas=="bigint",lc.set(e.uid,w)),n.type=w?"eip1559":"legacy"}if(a.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const w=await _(),{maxFeePerGas:x,maxPriorityFeePerGas:k}=await _i(e,{block:w,chain:s,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<k)throw new rb({maxPriorityFeePerGas:k});n.maxPriorityFeePerGas=k,n.maxFeePerGas=x}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new Ra;if(typeof n.gasPrice>"u"){const w=await _(),{gasPrice:x}=await _i(e,{block:w,chain:s,request:n,type:"legacy"});n.gasPrice=x}}return a.includes("gas")&&typeof h>"u"&&(n.gas=await M(e,Fa,"estimateGas")({...n,account:l,prepare:l?.type==="local"?[]:["blobVersionedHashes"]})),o?.fn&&o.runAt?.includes("afterFillParameters")&&(n=await o.fn({...n,chain:s},{phase:"afterFillParameters"})),un(n),delete n.parameters,n}async function Fa(e,t){const{account:n=e.account,prepare:r=!0}=t,s=n?ue(n):void 0,i=(()=>{if(Array.isArray(r))return r;if(s?.type!=="local")return["blobVersionedHashes"]})();try{const a=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await Gd({authorization:t.authorizationList[0]}).catch(()=>{throw new P("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:o,authorizationList:c,blobs:u,blobVersionedHashes:l,blockNumber:d,blockTag:f,data:p,gas:m,gasPrice:h,maxFeePerBlobGas:b,maxFeePerGas:y,maxPriorityFeePerGas:g,nonce:_,value:w,stateOverride:x,...k}=r?await tl(e,{...t,parameters:i,to:a}):t;if(m&&t.gas!==m)return m;const T=(typeof d=="bigint"?O(d):void 0)||f,S=cs(x);un(t);const v=e.chain?.formatters?.transactionRequest?.format,E=(v||nr)({...os(k,{format:v}),account:s,accessList:o,authorizationList:c,blobs:u,blobVersionedHashes:l,data:p,gasPrice:h,maxFeePerBlobGas:b,maxFeePerGas:y,maxPriorityFeePerGas:g,nonce:_,to:a,value:w},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:S?[E,T??e.experimental_blockTag??"latest",S]:T?[E,T]:[E]}))}catch(a){throw Qm(a,{...t,account:s,chain:e.chain})}}async function Pb(e,t){const{abi:n,address:r,args:s,functionName:i,dataSuffix:a,...o}=t,c=ie({abi:n,args:s,functionName:i});try{return await M(e,Fa,"estimateGas")({data:`${c}${a?a.replace("0x",""):""}`,to:r,...o})}catch(u){const l=o.account?ue(o.account):void 0;throw Xt(u,{abi:n,address:r,args:s,docsPath:"/docs/contract/estimateContractGas",functionName:i,sender:l?.address})}}function ln(e,t){if(!le(e,{strict:!1}))throw new it({address:e});if(!le(t,{strict:!1}))throw new it({address:t});return e.toLowerCase()===t.toLowerCase()}const fc="/docs/contract/decodeEventLog";function Nr(e){const{abi:t,data:n,strict:r,topics:s}=e,i=r??!0,[a,...o]=s;if(!a)throw new mh({docsPath:fc});const c=t.find(h=>h.type==="event"&&a===ns(Ne(h)));if(!(c&&"name"in c)||c.type!=="event")throw new bh(a,{docsPath:fc});const{name:u,inputs:l}=c,d=l?.some(h=>!("name"in h&&h.name)),f=d?[]:{},p=l.map((h,b)=>[h,b]).filter(([h])=>"indexed"in h&&h.indexed);for(let h=0;h<p.length;h++){const[b,y]=p[h],g=o[h];if(!g)throw new Ea({abiItem:c,param:b});f[d?y:b.name||y]=kb({param:b,value:g})}const m=l.filter(h=>!("indexed"in h&&h.indexed));if(m.length>0){if(n&&n!=="0x")try{const h=Nt(m,n);if(h)if(d)for(let b=0;b<l.length;b++)f[b]=f[b]??h.shift();else for(let b=0;b<m.length;b++)f[m[b].name]=h[b]}catch(h){if(i)throw h instanceof od||h instanceof Bd?new Tr({abiItem:c,data:n,params:m,size:Z(n)}):h}else if(i)throw new Tr({abiItem:c,data:"0x",params:m,size:0})}return{eventName:u,args:Object.values(f).length>0?f:void 0}}function kb({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Nt([e],t)||[])[0]}function za(e){const{abi:t,args:n,logs:r,strict:s=!0}=e,i=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(a=>{const o=t.filter(l=>l.type==="event"&&a.topics[0]===ns(l));if(o.length===0)return null;let c,u;for(const l of o)try{c=Nr({...a,abi:[l],strict:!0}),u=l;break}catch{}if(!c&&!s){u=o[0];try{c=Nr({...a,abi:[u],strict:!1})}catch{const l=u.inputs?.some(d=>!("name"in d&&d.name));return{...a,args:l?[]:{},eventName:u.name}}}return!c||!u||i&&!i.includes(c.eventName)||!Ab({args:c.args,inputs:u.inputs,matchArgs:n})?null:{...c,...a}}).filter(Boolean)}function Ab(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function s(i,a,o){try{return i.type==="address"?ln(a,o):i.type==="string"||i.type==="bytes"?K(on(a))===o:a===o}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((i,a)=>{if(i==null)return!0;const o=n[a];return o?(Array.isArray(i)?i:[i]).some(u=>s(o,u,t[a])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([i,a])=>{if(a==null)return!0;const o=n.find(u=>u.name===i);return o?(Array.isArray(a)?a:[a]).some(u=>s(o,u,t[i])):!1}):!1}function We(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}async function Ga(e,{address:t,blockHash:n,fromBlock:r,toBlock:s,event:i,events:a,args:o,strict:c}={}){const u=c??!1,l=a??(i?[i]:void 0);let d=[];l&&(d=[l.flatMap(h=>er({abi:[h],eventName:h.name,args:a?void 0:o}))],i&&(d=d[0]));let f;n?f=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:n}]}):f=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:typeof r=="bigint"?O(r):r,toBlock:typeof s=="bigint"?O(s):s}]});const p=f.map(m=>We(m));return l?za({abi:l,args:o,logs:p,strict:u}):p}async function nl(e,t){const{abi:n,address:r,args:s,blockHash:i,eventName:a,fromBlock:o,toBlock:c,strict:u}=t,l=a?Mt({abi:n,name:a}):void 0,d=l?void 0:n.filter(f=>f.type==="event");return M(e,Ga,"getLogs")({address:r,args:s,blockHash:i,event:l,events:d,fromBlock:o,toBlock:c,strict:u})}const Cs="/docs/contract/decodeFunctionResult";function Rt(e){const{abi:t,args:n,functionName:r,data:s}=e;let i=t[0];if(r){const o=Mt({abi:t,args:n,name:r});if(!o)throw new Yt(r,{docsPath:Cs});i=o}if(i.type!=="function")throw new Yt(void 0,{docsPath:Cs});if(!i.outputs)throw new dd(i.name,{docsPath:Cs});const a=Nt(i.outputs,s);if(a&&a.length>1)return a;if(a&&a.length===1)return a[0]}const Sb="0.1.1";function Ib(){return Sb}let D=class Qe extends Error{static setStaticOptions(t){Qe.prototype.docsOrigin=t.docsOrigin,Qe.prototype.showVersion=t.showVersion,Qe.prototype.version=t.version}constructor(t,n={}){const r=(()=>{if(n.cause instanceof Qe){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:n.cause?.message?n.cause.message:n.details})(),s=n.cause instanceof Qe&&n.cause.docsPath||n.docsPath,i=n.docsOrigin??Qe.prototype.docsOrigin,a=`${i}${s??""}`,o=!!(n.version??Qe.prototype.showVersion),c=n.version??Qe.prototype.version,u=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||s||o?["",r?`Details: ${r}`:void 0,s?`See: ${a}`:void 0,o?`Version: ${c}`:void 0]:[]].filter(l=>typeof l=="string").join(`
|
|
42
|
+
`);super(u,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=n.cause,this.details=r,this.docs=a,this.docsOrigin=i,this.docsPath=s,this.shortMessage=t,this.showVersion=o,this.version=c}walk(t){return rl(this,t)}};Object.defineProperty(D,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${Ib()}`}});D.setStaticOptions(D.defaultStaticOptions);function rl(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?rl(e.cause,t):t?null:e}function rr(e,t){if(Gt(e)>t)throw new qb({givenSize:Gt(e),maxSize:t})}const Ze={zero:48,nine:57,A:65,F:70,a:97,f:102};function pc(e){if(e>=Ze.zero&&e<=Ze.nine)return e-Ze.zero;if(e>=Ze.A&&e<=Ze.F)return e-(Ze.A-10);if(e>=Ze.a&&e<=Ze.f)return e-(Ze.a-10)}function Tb(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Wb({size:e.length,targetSize:r,type:"Bytes"});const s=new Uint8Array(r);for(let i=0;i<r;i++){const a=n==="right";s[a?i:r-i-1]=e[a?i:e.length-i-1]}return s}function sl(e,t={}){const{dir:n="left"}=t;let r=e,s=0;for(let i=0;i<r.length-1&&r[n==="left"?i:r.length-i-1].toString()==="0";i++)s++;return r=n==="left"?r.slice(s):r.slice(0,r.length-s),r}function us(e,t){if(Ae(e)>t)throw new Qb({givenSize:Ae(e),maxSize:t})}function Ob(e,t){if(typeof t=="number"&&t>0&&t>Ae(e)-1)throw new pl({offset:t,position:"start",size:Ae(e)})}function Cb(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Ae(e)!==n-t)throw new pl({offset:n,position:"end",size:Ae(e)})}function il(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const s=e.replace("0x","");if(s.length>r*2)throw new Xb({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Bb="#__bigint";function al(e,t,n){return JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString()+Bb:s,n)}const $b=new TextDecoder,Mb=new TextEncoder;function Nb(e){return e instanceof Uint8Array?e:typeof e=="string"?ol(e):Rb(e)}function Rb(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function ol(e,t={}){const{size:n}=t;let r=e;n&&(us(e,n),r=Bt(e,n));let s=r.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,a=new Uint8Array(i);for(let o=0,c=0;o<i;o++){const u=pc(s.charCodeAt(c++)),l=pc(s.charCodeAt(c++));if(u===void 0||l===void 0)throw new D(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);a[o]=u<<4|l}return a}function jb(e,t={}){const{size:n}=t,r=Mb.encode(e);return typeof n=="number"?(rr(r,n),Lb(r,n)):r}function Lb(e,t){return Tb(e,{dir:"right",size:t})}function Gt(e){return e.length}function Db(e,t,n,r={}){const{strict:s}=r;return e.slice(t,n)}function Ub(e,t={}){const{size:n}=t;typeof n<"u"&&rr(e,n);const r=je(e,t);return dl(r,t)}function Fb(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(rr(r,n),r=cl(r)),r.length>1||r[0]>1)throw new Hb(r);return!!r[0]}function rt(e,t={}){const{size:n}=t;typeof n<"u"&&rr(e,n);const r=je(e,t);return ll(r,t)}function zb(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(rr(r,n),r=Gb(r)),$b.decode(r)}function cl(e){return sl(e,{dir:"left"})}function Gb(e){return sl(e,{dir:"right"})}class Hb extends D{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}let qb=class extends D{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Wb=class extends D{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};const Vb=new TextEncoder,Kb=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Jb(e,t={}){const{strict:n=!1}=t;if(!e)throw new hc(e);if(typeof e!="string")throw new hc(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new mc(e);if(!e.startsWith("0x"))throw new mc(e)}function Re(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Zb(e){return e instanceof Uint8Array?je(e):Array.isArray(e)?je(new Uint8Array(e)):e}function ul(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(us(n,t.size),Ct(n,t.size)):n}function je(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=Kb[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(us(r,t.size),Bt(r,t.size)):r}function me(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<a){const u=typeof e=="bigint"?"n":"";throw new fl({max:i?`${i}${u}`:void 0,min:`${a}${u}`,signed:n,size:r,value:`${e}${u}`})}const c=`0x${(n&&s<0?BigInt.asUintN(r*8,BigInt(s)):s).toString(16)}`;return r?Ct(c,r):c}function Ha(e,t={}){return je(Vb.encode(e),t)}function Ct(e,t){return il(e,{dir:"left",size:t})}function Bt(e,t){return il(e,{dir:"right",size:t})}function qe(e,t,n,r={}){const{strict:s}=r;Ob(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&Cb(i,t,n),i}function Ae(e){return Math.ceil((e.length-2)/2)}function dl(e,t={}){const{signed:n}=t;t.size&&us(e,t.size);const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n)-1n,a=i>>1n;return r<=a?r:r-i-1n}function ll(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:dl(e,t))}function Yb(e,t={}){const{strict:n=!1}=t;try{return Jb(e,{strict:n}),!0}catch{return!1}}let fl=class extends D{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number \`${i}\` is not in safe${s?` ${s*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}},hc=class extends D{constructor(t){super(`Value \`${typeof t=="object"?al(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}},mc=class extends D{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}},Qb=class extends D{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},pl=class extends D{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}},Xb=class extends D{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}};function ey(e){return{address:e.address,amount:me(e.amount),index:me(e.index),validatorIndex:me(e.validatorIndex)}}function hl(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:me(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:me(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:me(e.gasLimit)},...typeof e.number=="bigint"&&{number:me(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:me(e.prevRandao)},...typeof e.time=="bigint"&&{time:me(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(ey)}}}const Rr=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],Ei=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],ml=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],bl=[...ml,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],ty=[...ml,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],bc=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],yc=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],yl=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],gc=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],ny=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],ry="0x82ad56cb",gl="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",sy="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",iy="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",qa="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";class Pi extends P{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class wl extends P{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const Bs="/docs/contract/encodeDeployData";function Wa(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const s=t.find(a=>"type"in a&&a.type==="constructor");if(!s)throw new lh({docsPath:Bs});if(!("inputs"in s))throw new Go({docsPath:Bs});if(!s.inputs||s.inputs.length===0)throw new Go({docsPath:Bs});const i=ke(s.inputs,n);return ot([r,i])}function fn({blockNumber:e,chain:t,contract:n}){const r=t?.contracts?.[n];if(!r)throw new Pi({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new Pi({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function vl(e,{docsPath:t,...n}){const r=(()=>{const s=as(e,n);return s instanceof tr?e:s})();return new Ld(r,{docsPath:t,...n})}function Va(){let e=()=>{},t=()=>{};return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}const $s=new Map;function xl({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:s}){const i=async()=>{const l=c();a();const d=l.map(({args:f})=>f);d.length!==0&&e(d).then(f=>{s&&Array.isArray(f)&&f.sort(s);for(let p=0;p<l.length;p++){const{resolve:m}=l[p];m?.([f[p],f])}}).catch(f=>{for(let p=0;p<l.length;p++){const{reject:m}=l[p];m?.(f)}})},a=()=>$s.delete(t),o=()=>c().map(({args:l})=>l),c=()=>$s.get(t)||[],u=l=>$s.set(t,[...c(),l]);return{flush:a,async schedule(l){const{promise:d,resolve:f,reject:p}=Va();return n?.([...o(),l])&&i(),c().length>0?(u({args:l,resolve:f,reject:p}),d):(u({args:l,resolve:f,reject:p}),setTimeout(i,r),d)}}}async function ds(e,t){const{account:n=e.account,authorizationList:r,batch:s=!!e.batch?.multicall,blockNumber:i,blockTag:a=e.experimental_blockTag??"latest",accessList:o,blobs:c,blockOverrides:u,code:l,data:d,factory:f,factoryData:p,gas:m,gasPrice:h,maxFeePerBlobGas:b,maxFeePerGas:y,maxPriorityFeePerGas:g,nonce:_,to:w,value:x,stateOverride:k,...A}=t,T=n?ue(n):void 0;if(l&&(f||p))throw new P("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&w)throw new P("Cannot provide both `code` & `to` as parameters.");const S=l&&d,v=f&&p&&w&&d,I=S||v,E=S?_l({code:l,data:d}):v?cy({data:d,factory:f,factoryData:p,to:w}):d;try{un(t);const N=(typeof i=="bigint"?O(i):void 0)||a,L=u?hl(u):void 0,H=cs(k),W=e.chain?.formatters?.transactionRequest?.format,Q=(W||nr)({...os(A,{format:W}),accessList:o,account:T,authorizationList:r,blobs:c,data:E,gas:m,gasPrice:h,maxFeePerBlobGas:b,maxFeePerGas:y,maxPriorityFeePerGas:g,nonce:_,to:I?void 0:w,value:x},"call");if(s&&ay({request:Q})&&!H&&!L)try{return await oy(e,{...Q,blockNumber:i,blockTag:a})}catch(Le){if(!(Le instanceof wl)&&!(Le instanceof Pi))throw Le}const Ke=(()=>{const Le=[Q,N];return H&&L?[...Le,H,L]:H?[...Le,H]:L?[...Le,{},L]:Le})(),xt=await e.request({method:"eth_call",params:Ke});return xt==="0x"?{data:void 0}:{data:xt}}catch(C){const N=uy(C),{offchainLookup:L,offchainLookupSignature:H}=await du(async()=>{const{offchainLookup:W,offchainLookupSignature:R}=await import("./ccip-ConwrR6S.js");return{offchainLookup:W,offchainLookupSignature:R}},__vite__mapDeps([2,0,1]));if(e.ccipRead!==!1&&N?.slice(0,10)===H&&w)return{data:await L(e,{data:N,to:w})};throw I&&N?.slice(0,10)==="0x101bb98d"?new Fm({factory:f}):vl(C,{...t,account:T,chain:e.chain})}}function ay({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(ry)||!n||Object.values(r).filter(s=>typeof s<"u").length>0)}async function oy(e,t){const{batchSize:n=1024,deployless:r=!1,wait:s=0}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},{blockNumber:i,blockTag:a=e.experimental_blockTag??"latest",data:o,to:c}=t,u=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return fn({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new wl})(),d=(typeof i=="bigint"?O(i):void 0)||a,{schedule:f}=xl({id:`${e.uid}.${d}`,wait:s,shouldSplitBatch(h){return h.reduce((y,{data:g})=>y+(g.length-2),0)>n*2},fn:async h=>{const b=h.map(_=>({allowFailure:!0,callData:_.data,target:_.to})),y=ie({abi:Rr,args:[b],functionName:"aggregate3"}),g=await e.request({method:"eth_call",params:[{...u===null?{data:_l({code:qa,data:y})}:{to:u,data:y}},d]});return Rt({abi:Rr,args:[b],functionName:"aggregate3",data:g||"0x"})}}),[{returnData:p,success:m}]=await f({data:o,to:c});if(!m)throw new is({data:p});return p==="0x"?{data:void 0}:{data:p}}function _l(e){const{code:t,data:n}=e;return Wa({abi:_a(["constructor(bytes, bytes)"]),bytecode:gl,args:[t,n]})}function cy(e){const{data:t,factory:n,factoryData:r,to:s}=e;return Wa({abi:_a(["constructor(address, bytes, address, bytes)"]),bytecode:sy,args:[s,t,n,r]})}function uy(e){if(!(e instanceof P))return;const t=e.walk();return typeof t?.data=="object"?t.data?.data:t.data}async function we(e,t){const{abi:n,address:r,args:s,functionName:i,...a}=t,o=ie({abi:n,args:s,functionName:i});try{const{data:c}=await M(e,ds,"call")({...a,data:o,to:r});return Rt({abi:n,args:s,functionName:i,data:c||"0x"})}catch(c){throw Xt(c,{abi:n,address:r,args:s,docsPath:"/docs/contract/readContract",functionName:i})}}async function dy(e,t){const{abi:n,address:r,args:s,dataSuffix:i,functionName:a,...o}=t,c=o.account?ue(o.account):e.account,u=ie({abi:n,args:s,functionName:a});try{const{data:l}=await M(e,ds,"call")({batch:!1,data:`${u}${i?i.replace("0x",""):""}`,to:r,...o,account:c}),d=Rt({abi:n,args:s,functionName:a,data:l||"0x"}),f=n.filter(p=>"name"in p&&p.name===t.functionName);return{result:d,request:{abi:f,address:r,args:s,dataSuffix:i,functionName:a,...o,account:c}}}catch(l){throw Xt(l,{abi:n,address:r,args:s,docsPath:"/docs/contract/simulateContract",functionName:a,sender:c?.address})}}const Ms=new Map,wc=new Map;let ly=0;function Ve(e,t,n){const r=++ly,s=()=>Ms.get(e)||[],i=()=>{const l=s();Ms.set(e,l.filter(d=>d.id!==r))},a=()=>{const l=s();if(!l.some(f=>f.id===r))return;const d=wc.get(e);if(l.length===1&&d){const f=d();f instanceof Promise&&f.catch(()=>{})}i()},o=s();if(Ms.set(e,[...o,{id:r,fns:t}]),o&&o.length>0)return a;const c={};for(const l in t)c[l]=((...d)=>{const f=s();if(f.length!==0)for(const p of f)p.fns[l]?.(...d)});const u=n(c);return typeof u=="function"&&wc.set(e,u),a}async function ki(e){return new Promise(t=>setTimeout(t,e))}function jt(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let s=!0;const i=()=>s=!1;return(async()=>{let o;t&&(o=await e({unpoll:i}));const c=await n?.(o)??r;await ki(c);const u=async()=>{s&&(await e({unpoll:i}),await ki(r),u())};u()})(),i}const fy=new Map,py=new Map;function hy(e){const t=(s,i)=>({clear:()=>i.delete(s),get:()=>i.get(s),set:a=>i.set(s,a)}),n=t(e,fy),r=t(e,py);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function my(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=hy(t),s=r.response.get();if(s&&n>0&&Date.now()-s.created.getTime()<n)return s.data;let i=r.promise.get();i||(i=e(),r.promise.set(i));try{const a=await i;return r.response.set({created:new Date,data:a}),a}finally{r.promise.clear()}}const by=e=>`blockNumber.${e}`;async function sr(e,{cacheTime:t=e.cacheTime}={}){const n=await my(()=>e.request({method:"eth_blockNumber"}),{cacheKey:by(e.uid),cacheTime:t});return BigInt(n)}async function ls(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const s=r.map(i=>We(i));return!("abi"in t)||!t.abi?s:za({abi:t.abi,logs:s,strict:n})}async function fs(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function yy(e,t){const{abi:n,address:r,args:s,batch:i=!0,eventName:a,fromBlock:o,onError:c,onLogs:u,poll:l,pollingInterval:d=e.pollingInterval,strict:f}=t;return(typeof l<"u"?l:typeof o=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const b=f??!1,y=ae(["watchContractEvent",r,s,i,e.uid,a,d,b,o]);return Ve(y,{onLogs:u,onError:c},g=>{let _;o!==void 0&&(_=o-1n);let w,x=!1;const k=jt(async()=>{if(!x){try{w=await M(e,Od,"createContractEventFilter")({abi:n,address:r,args:s,eventName:a,strict:b,fromBlock:o})}catch{}x=!0;return}try{let A;if(w)A=await M(e,ls,"getFilterChanges")({filter:w});else{const T=await M(e,sr,"getBlockNumber")({});_&&_<T?A=await M(e,nl,"getContractEvents")({abi:n,address:r,args:s,eventName:a,fromBlock:_+1n,toBlock:T,strict:b}):A=[],_=T}if(A.length===0)return;if(i)g.onLogs(A);else for(const T of A)g.onLogs([T])}catch(A){w&&A instanceof wt&&(x=!1),g.onError?.(A)}},{emitOnBegin:!0,interval:d});return async()=>{w&&await M(e,fs,"uninstallFilter")({filter:w}),k()}})})():(()=>{const b=f??!1,y=ae(["watchContractEvent",r,s,i,e.uid,a,d,b]);let g=!0,_=()=>g=!1;return Ve(y,{onLogs:u,onError:c},w=>((async()=>{try{const x=(()=>{if(e.transport.type==="fallback"){const T=e.transport.transports.find(S=>S.config.type==="webSocket"||S.config.type==="ipc");return T?T.value:e.transport}return e.transport})(),k=a?er({abi:n,eventName:a,args:s}):[],{unsubscribe:A}=await x.subscribe({params:["logs",{address:r,topics:k}],onData(T){if(!g)return;const S=T.result;try{const{eventName:v,args:I}=Nr({abi:n,data:S.data,topics:S.topics,strict:f}),E=We(S,{args:I,eventName:v});w.onLogs([E])}catch(v){let I,E;if(v instanceof Tr||v instanceof Ea){if(f)return;I=v.abiItem.name,E=v.abiItem.inputs?.some(N=>!("name"in N&&N.name))}const C=We(S,{args:E?[]:{},eventName:I});w.onLogs([C])}},onError(T){w.onError?.(T)}});_=A,g||_()}catch(x){c?.(x)}})(),()=>_()))})()}class ps extends P{constructor({docsPath:t}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
|
|
43
|
+
`),{docsPath:t,docsSlug:"account",name:"AccountNotFoundError"})}}async function gy(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}class wy extends P{constructor(t){super(`Call bundle failed with status: ${t.statusCode}`,{name:"BundleFailedError"}),Object.defineProperty(this,"result",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.result=t}}function jr(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((s,i)=>{const a=async({count:o=0}={})=>{const c=async({error:u})=>{const l=typeof t=="function"?t({count:o,error:u}):t;l&&await ki(l),a({count:o+1})};try{const u=await e();s(u)}catch(u){if(o<n&&await r({count:o,error:u}))return c({error:u});i(u)}};a()})}const El={"0x0":"reverted","0x1":"success"};function Ka(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>We(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?ye(e.transactionIndex):null,status:e.status?El[e.status]:null,type:e.type?Wd[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const vy="0x5792579257925792579257925792579257925792579257925792579257925792",xy=O(0,{size:32});async function _y(e,t){async function n(l){if(l.endsWith(vy.slice(2))){const f=Me(li(l,-64,-32)),p=li(l,0,-64).slice(2).match(/.{1,64}/g),m=await Promise.all(p.map(b=>xy.slice(2)!==b?e.request({method:"eth_getTransactionReceipt",params:[`0x${b}`]},{dedupe:!0}):void 0)),h=m.some(b=>b===null)?100:m.every(b=>b?.status==="0x1")?200:m.every(b=>b?.status==="0x0")?500:600;return{atomic:!1,chainId:ye(f),receipts:m.filter(Boolean),status:h,version:"2.0.0"}}return e.request({method:"wallet_getCallsStatus",params:[l]})}const{atomic:r=!1,chainId:s,receipts:i,version:a="2.0.0",...o}=await n(t.id),[c,u]=(()=>{const l=o.status;return l>=100&&l<200?["pending",l]:l>=200&&l<300?["success",l]:l>=300&&l<700?["failure",l]:l==="CONFIRMED"?["success",200]:l==="PENDING"?["pending",100]:[void 0,l]})();return{...o,atomic:r,chainId:s?ye(s):void 0,receipts:i?.map(l=>({...l,blockNumber:se(l.blockNumber),gasUsed:se(l.gasUsed),status:El[l.status]}))??[],statusCode:u,status:c,version:a}}async function Pl(e,t){const{id:n,pollingInterval:r=e.pollingInterval,status:s=({statusCode:h})=>h===200||h>=300,retryCount:i=4,retryDelay:a=({count:h})=>~~(1<<h)*200,timeout:o=6e4,throwOnFailure:c=!1}=t,u=ae(["waitForCallsStatus",e.uid,n]),{promise:l,resolve:d,reject:f}=Va();let p;const m=Ve(u,{resolve:d,reject:f},h=>{const b=jt(async()=>{const y=g=>{clearTimeout(p),b(),g(),m()};try{const g=await jr(async()=>{const _=await M(e,_y,"getCallsStatus")({id:n});if(c&&_.status==="failure")throw new wy(_);return _},{retryCount:i,delay:a});if(!s(g))return;y(()=>h.resolve(g))}catch(g){y(()=>h.reject(g))}},{interval:r,emitOnBegin:!0});return b});return p=o?setTimeout(()=>{m(),clearTimeout(p),f(new Ey({id:n}))},o):void 0,await l}class Ey extends P{constructor({id:t}){super(`Timed out while waiting for call bundle with id "${t}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}const Ai=256;let dr=Ai,lr;function kl(e=11){if(!lr||dr+e>Ai*2){lr="",dr=0;for(let t=0;t<Ai;t++)lr+=(256+Math.random()*256|0).toString(16).substring(1)}return lr.substring(dr,dr+++e)}function Al(e){const{batch:t,chain:n,ccipRead:r,key:s="base",name:i="Base Client",type:a="base"}=e,o=e.experimental_blockTag??(typeof n?.experimental_preconfirmationTime=="number"?"pending":void 0),c=n?.blockTime??12e3,u=Math.min(Math.max(Math.floor(c/2),500),4e3),l=e.pollingInterval??u,d=e.cacheTime??l,f=e.account?ue(e.account):void 0,{config:p,request:m,value:h}=e.transport({account:f,chain:n,pollingInterval:l}),b={...p,...h},y={account:f,batch:t,cacheTime:d,ccipRead:r,chain:n,key:s,name:i,pollingInterval:l,request:m,transport:b,type:a,uid:kl(),...o?{experimental_blockTag:o}:{}};function g(_){return w=>{const x=w(_);for(const A in y)delete x[A];const k={..._,...x};return Object.assign(k,{extend:g(k)})}}return Object.assign(y,{extend:g(y)})}function Ja(e){if(!(e instanceof P))return!1;const t=e.walk(n=>n instanceof Br);return t instanceof Br?t.data?.errorName==="HttpError"||t.data?.errorName==="ResolverError"||t.data?.errorName==="ResolverNotContract"||t.data?.errorName==="ResolverNotFound"||t.data?.errorName==="ReverseAddressMismatch"||t.data?.errorName==="UnsupportedResolverProfile":!1}function Za(e){const{abi:t,data:n}=e,r=Tt(n,0,4),s=t.find(i=>i.type==="function"&&r===Xn(Ne(i)));if(!s)throw new yh(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:s.name,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Nt(s.inputs,Tt(n,4)):void 0}}const Ns="/docs/contract/encodeErrorResult";function vc(e){const{abi:t,errorName:n,args:r}=e;let s=t[0];if(n){const c=Mt({abi:t,args:r,name:n});if(!c)throw new Ho(n,{docsPath:Ns});s=c}if(s.type!=="error")throw new Ho(void 0,{docsPath:Ns});const i=Ne(s),a=Xn(i);let o="0x";if(r&&r.length>0){if(!s.inputs)throw new hh(s.name,{docsPath:Ns});o=ke(s.inputs,r)}return ot([a,o])}const Rs="/docs/contract/encodeFunctionResult";function Py(e){const{abi:t,functionName:n,result:r}=e;let s=t[0];if(n){const a=Mt({abi:t,name:n});if(!a)throw new Yt(n,{docsPath:Rs});s=a}if(s.type!=="function")throw new Yt(void 0,{docsPath:Rs});if(!s.outputs)throw new dd(s.name,{docsPath:Rs});const i=(()=>{if(s.outputs.length===0)return[];if(s.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new fd(r)})();return ke(s.outputs,i)}const hs="x-batch-gateway:true";async function ky(e){const{data:t,ccipRequest:n}=e,{args:[r]}=Za({abi:Ei,data:t}),s=[],i=[];return await Promise.all(r.map(async(a,o)=>{try{i[o]=a.urls.includes(hs)?await ky({data:a.data,ccipRequest:n}):await n(a),s[o]=!1}catch(c){s[o]=!0,i[o]=Ay(c)}})),Py({abi:Ei,functionName:"query",result:[s,i]})}function Ay(e){return e.name==="HttpRequestError"&&e.status?vc({abi:Ei,errorName:"HttpError",args:[e.status,e.shortMessage]}):vc({abi:[Cd],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Sl(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return fe(t)?t:null}function Si(e){let t=new Uint8Array(32).fill(0);if(!e)return oe(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const s=Sl(n[r]),i=s?on(s):K(tt(n[r]),"bytes");t=K(pe([t,i]),"bytes")}return oe(t)}function Sy(e){return`[${e.slice(2)}]`}function Iy(e){const t=new Uint8Array(32).fill(0);return e?Sl(e)||K(tt(e)):oe(t)}function Ya(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(tt(t).byteLength+2);let r=0;const s=t.split(".");for(let i=0;i<s.length;i++){let a=tt(s[i]);a.byteLength>255&&(a=tt(Sy(Iy(s[i])))),n[r]=a.length,n.set(a,r+1),r+=a.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function Ty(e,t){const{blockNumber:n,blockTag:r,coinType:s,name:i,gatewayUrls:a,strict:o}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return fn({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),l=c?.ensTlds;if(l&&!l.some(f=>i.endsWith(f)))return null;const d=s!=null?[Si(i),BigInt(s)]:[Si(i)];try{const f=ie({abi:yc,functionName:"addr",args:d}),p={address:u,abi:bl,functionName:"resolveWithGateways",args:[ge(Ya(i)),f,a??[hs]],blockNumber:n,blockTag:r},h=await M(e,we,"readContract")(p);if(h[0]==="0x")return null;const b=Rt({abi:yc,args:d,functionName:"addr",data:h[0]});return b==="0x"||Me(b)==="0x00"?null:b}catch(f){if(o)throw f;if(Ja(f))return null;throw f}}class Oy extends P{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class mn extends P{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Qa extends P{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class Cy extends P{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const By=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,$y=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,My=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Ny=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Ry(e){try{const t=await fetch(e,{method:"HEAD"});return t.status===200?t.headers.get("content-type")?.startsWith("image/"):!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function xc(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Il({uri:e,gatewayUrls:t}){const n=My.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=xc(t?.ipfs,"https://ipfs.io"),s=xc(t?.arweave,"https://arweave.net"),i=e.match(By),{protocol:a,subpath:o,target:c,subtarget:u=""}=i?.groups||{},l=a==="ipns:/"||o==="ipns/",d=a==="ipfs:/"||o==="ipfs/"||$y.test(e);if(e.startsWith("http")&&!l&&!d){let p=e;return t?.arweave&&(p=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:p,isOnChain:!1,isEncoded:!1}}if((l||d)&&c)return{uri:`${r}/${l?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if(a==="ar:/"&&c)return{uri:`${s}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let f=e.replace(Ny,"");if(f.startsWith("<svg")&&(f=`data:image/svg+xml;base64,${btoa(f)}`),f.startsWith("data:")||f.startsWith("{"))return{uri:f,isOnChain:!0,isEncoded:!1};throw new Qa({uri:e})}function Tl(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new Oy({data:e});return e.image||e.image_url||e.image_data}async function jy({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(s=>s.json());return await Xa({gatewayUrls:e,uri:Tl(n)})}catch{throw new Qa({uri:t})}}async function Xa({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Il({uri:t,gatewayUrls:e});if(r||await Ry(n))return n;throw new Qa({uri:t})}function Ly(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,s]=t.split("/"),[i,a]=n.split(":"),[o,c]=r.split(":");if(!i||i.toLowerCase()!=="eip155")throw new mn({reason:"Only EIP-155 supported"});if(!a)throw new mn({reason:"Chain ID not found"});if(!c)throw new mn({reason:"Contract address not found"});if(!s)throw new mn({reason:"Token ID not found"});if(!o)throw new mn({reason:"ERC namespace not found"});return{chainID:Number.parseInt(a,10),namespace:o.toLowerCase(),contractAddress:c,tokenID:s}}async function Dy(e,{nft:t}){if(t.namespace==="erc721")return we(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return we(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new Cy({namespace:t.namespace})}async function Uy(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?Fy(e,{gatewayUrls:t,record:n}):Xa({uri:n,gatewayUrls:t})}async function Fy(e,{gatewayUrls:t,record:n}){const r=Ly(n),s=await Dy(e,{nft:r}),{uri:i,isOnChain:a,isEncoded:o}=Il({uri:s,gatewayUrls:t});if(a&&(i.includes("data:application/json;base64,")||i.startsWith("{"))){const u=o?atob(i.replace("data:application/json;base64,","")):i,l=JSON.parse(u);return Xa({uri:Tl(l),gatewayUrls:t})}let c=r.tokenID;return r.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),jy({gatewayUrls:t,uri:i.replace(/(?:0x)?{id}/,c)})}async function Ol(e,t){const{blockNumber:n,blockTag:r,key:s,name:i,gatewayUrls:a,strict:o}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return fn({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),l=c?.ensTlds;if(l&&!l.some(d=>i.endsWith(d)))return null;try{const d={address:u,abi:bl,args:[ge(Ya(i)),ie({abi:bc,functionName:"text",args:[Si(i),s]}),a??[hs]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},p=await M(e,we,"readContract")(d);if(p[0]==="0x")return null;const m=Rt({abi:bc,functionName:"text",data:p[0]});return m===""?null:m}catch(d){if(o)throw d;if(Ja(d))return null;throw d}}async function zy(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:s,gatewayUrls:i,strict:a,universalResolverAddress:o}){const c=await M(e,Ol,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:s,universalResolverAddress:o,gatewayUrls:i,strict:a});if(!c)return null;try{return await Uy(e,{record:c,gatewayUrls:r})}catch{return null}}async function Gy(e,t){const{address:n,blockNumber:r,blockTag:s,coinType:i=60n,gatewayUrls:a,strict:o}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return fn({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})();try{const l={address:u,abi:ty,args:[n,i,a??[hs]],functionName:"reverseWithGateways",blockNumber:r,blockTag:s},d=M(e,we,"readContract"),[f]=await d(l);return f||null}catch(l){if(o)throw l;if(Ja(l))return null;throw l}}async function Hy(e,t){const{blockNumber:n,blockTag:r,name:s}=t,{chain:i}=e,a=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!i)throw new Error("client chain not configured. universalResolverAddress is required.");return fn({blockNumber:n,chain:i,contract:"ensUniversalResolver"})})(),o=i?.ensTlds;if(o&&!o.some(u=>s.endsWith(u)))throw new Error(`${s} is not a valid ENS TLD (${o?.join(", ")}) for chain "${i.name}" (id: ${i.id}).`);const[c]=await M(e,we,"readContract")({address:a,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[ge(Ya(s))],blockNumber:n,blockTag:r});return c}async function Cl(e,t){const{account:n=e.account,blockNumber:r,blockTag:s="latest",blobs:i,data:a,gas:o,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:d,to:f,value:p,...m}=t,h=n?ue(n):void 0;try{un(t);const y=(typeof r=="bigint"?O(r):void 0)||s,g=e.chain?.formatters?.transactionRequest?.format,w=(g||nr)({...os(m,{format:g}),account:h,blobs:i,data:a,gas:o,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:d,to:f,value:p},"createAccessList"),x=await e.request({method:"eth_createAccessList",params:[w,y]});return{accessList:x.accessList,gasUsed:BigInt(x.gasUsed)}}catch(b){throw vl(b,{...t,account:h,chain:e.chain})}}async function qy(e){const t=ss(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Bl(e,{address:t,args:n,event:r,events:s,fromBlock:i,strict:a,toBlock:o}={}){const c=s??(r?[r]:void 0),u=ss(e,{method:"eth_newFilter"});let l=[];c&&(l=[c.flatMap(p=>er({abi:[p],eventName:p.name,args:n}))],r&&(l=l[0]));const d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof i=="bigint"?O(i):i,toBlock:typeof o=="bigint"?O(o):o,...l.length?{topics:l}:{}}]});return{abi:c,args:n,eventName:r?r.name:void 0,fromBlock:i,id:d,request:u(d),strict:!!a,toBlock:o,type:"event"}}async function $l(e){const t=ss(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function Wy(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const s=typeof n=="bigint"?O(n):void 0,i=await e.request({method:"eth_getBalance",params:[t,s||r]});return BigInt(i)}async function Vy(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function Ky(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const s=n!==void 0?O(n):void 0;let i;return t?i=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):i=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[s||r]},{dedupe:!!s}),ye(i)}async function Jn(e,{address:t,blockNumber:n,blockTag:r="latest"}){const s=n!==void 0?O(n):void 0,i=await e.request({method:"eth_getCode",params:[t,s||r]},{dedupe:!!s});if(i!=="0x")return i}class Jy extends P{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function Zy(e,t){const{address:n,factory:r,factoryData:s}=t;try{const[i,a,o,c,u,l,d]=await M(e,we,"readContract")({abi:Yy,address:n,functionName:"eip712Domain",factory:r,factoryData:s});return{domain:{name:a,version:o,chainId:Number(c),verifyingContract:u,salt:l},extensions:d,fields:i}}catch(i){const a=i;throw a.name==="ContractFunctionExecutionError"&&a.cause.name==="ContractFunctionZeroDataError"?new Jy({address:n}):a}}const Yy=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];function Qy(e){return{baseFeePerGas:e.baseFeePerGas.map(t=>BigInt(t)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:e.reward?.map(t=>t.map(n=>BigInt(n)))}}async function Xy(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:s}){const i=typeof n=="bigint"?O(n):void 0,a=await e.request({method:"eth_feeHistory",params:[O(t),i||r,s]},{dedupe:!!i});return Qy(a)}async function eg(e,{filter:t}){const n=t.strict??!1,s=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(i=>We(i));return t.abi?za({abi:t.abi,logs:s,strict:n}):s}function tg(e,t){if(e.length!==t.length)throw new cd({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const s=e[r],i=t[r];n.push(Ml(s,i))}return ot(n)}function Ml(e,t,n=!1){if(e==="address"){const a=t;if(!le(a))throw new it({address:a});return re(a.toLowerCase(),{size:n?32:null})}if(e==="string")return It(t);if(e==="bytes")return t;if(e==="bool")return re(Pa(t),{size:n?32:1});const r=e.match(Sa);if(r){const[a,o,c="256"]=r,u=Number.parseInt(c,10)/8;return O(t,{size:n?32:u,signed:o==="int"})}const s=e.match(Id);if(s){const[a,o]=s;if(Number.parseInt(o,10)!==(t.length-2)/2)throw new ld({expectedSize:Number.parseInt(o,10),givenSize:(t.length-2)/2});return re(t,{dir:"right",size:n?32:null})}const i=e.match(om);if(i&&Array.isArray(t)){const[a,o]=i,c=[];for(let u=0;u<t.length;u++)c.push(Ml(o,t[u],!0));return c.length===0?"0x":ot(c)}throw new _h(e)}async function ng({address:e,authorization:t,signature:n}){return ln(Cr(e),await Gd({authorization:t,signature:n}))}const fr=new Qn(8192);function rg(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(fr.get(n))return fr.get(n);const r=e().finally(()=>fr.delete(n));return fr.set(n,r),r}function sg(e,t={}){return async(n,r={})=>{const{dedupe:s=!1,methods:i,retryDelay:a=150,retryCount:o=3,uid:c}={...t,...r},{method:u}=n;if(i?.exclude?.includes(u))throw new kt(new Error("method not supported"),{method:u});if(i?.include&&!i.include.includes(u))throw new kt(new Error("method not supported"),{method:u});const l=s?It(`${c}.${ae(n)}`):void 0;return rg(()=>jr(async()=>{try{return await e(n)}catch(d){const f=d;switch(f.code){case Tn.code:throw new Tn(f);case On.code:throw new On(f);case Cn.code:throw new Cn(f,{method:n.method});case Bn.code:throw new Bn(f);case Ot.code:throw new Ot(f);case wt.code:throw new wt(f);case $n.code:throw new $n(f);case Mn.code:throw new Mn(f);case Nn.code:throw new Nn(f);case kt.code:throw new kt(f,{method:n.method});case Qt.code:throw new Qt(f);case Rn.code:throw new Rn(f);case Vt.code:throw new Vt(f);case jn.code:throw new jn(f);case Ln.code:throw new Ln(f);case Dn.code:throw new Dn(f);case Un.code:throw new Un(f);case Fn.code:throw new Fn(f);case zn.code:throw new zn(f);case Gn.code:throw new Gn(f);case Hn.code:throw new Hn(f);case qn.code:throw new qn(f);case Wn.code:throw new Wn(f);case Vn.code:throw new Vn(f);case Kn.code:throw new Kn(f);case 5e3:throw new Vt(f);default:throw d instanceof P?d:new Gm(f)}}},{delay:({count:d,error:f})=>{if(f&&f instanceof En){const p=f?.headers?.get("Retry-After");if(p?.match(/\d/))return Number.parseInt(p,10)*1e3}return~~(1<<d)*a},retryCount:o,shouldRetry:({error:d})=>ig(d)}),{enabled:s,id:l})}}function ig(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===Qt.code||e.code===Ot.code:e instanceof En&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}function ag(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return s=>{const i=typeof s=="function"?s(r):s,a={...r,...i};return Object.assign(a,{extend:n(a)})}}return Object.assign(t,{extend:n(t)})}function og(e){const{source:t}=e,n=new Map,r=new Qn(8192),s=new Map,i=({address:a,chainId:o})=>`${a}.${o}`;return{async consume({address:a,chainId:o,client:c}){const u=i({address:a,chainId:o}),l=this.get({address:a,chainId:o,client:c});this.increment({address:a,chainId:o});const d=await l;return await t.set({address:a,chainId:o},d),r.set(u,d),d},async increment({address:a,chainId:o}){const c=i({address:a,chainId:o}),u=n.get(c)??0;n.set(c,u+1)},async get({address:a,chainId:o,client:c}){const u=i({address:a,chainId:o});let l=s.get(u);return l||(l=(async()=>{try{const f=await t.get({address:a,chainId:o,client:c}),p=r.get(u)??0;return p>0&&f<=p?p+1:(r.delete(u),f)}finally{this.reset({address:a,chainId:o})}})(),s.set(u,l)),(n.get(u)??0)+await l},reset({address:a,chainId:o}){const c=i({address:a,chainId:o});n.delete(c),s.delete(c)}}}function cg(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((s,i)=>{(async()=>{let a;try{const o=new AbortController;n>0&&(a=setTimeout(()=>{r&&o.abort()},n)),s(await e({signal:o?.signal||null}))}catch(o){o?.name==="AbortError"&&i(t),i(o)}finally{clearTimeout(a)}})()})}function ug(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const _c=ug();function dg(e,t={}){return{async request(n){const{body:r,fetchFn:s=t.fetchFn??fetch,onRequest:i=t.onRequest,onResponse:a=t.onResponse,timeout:o=t.timeout??1e4}=n,c={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:u,method:l,signal:d}=c;try{const f=await cg(async({signal:m})=>{const h={...c,body:Array.isArray(r)?ae(r.map(_=>({jsonrpc:"2.0",id:_.id??_c.take(),..._}))):ae({jsonrpc:"2.0",id:r.id??_c.take(),...r}),headers:{"Content-Type":"application/json",...u},method:l||"POST",signal:d||(o>0?m:null)},b=new Request(e,h),y=await i?.(b,h)??{...h,url:e};return await s(y.url??e,y)},{errorInstance:new ac({body:r,url:e}),timeout:o,signal:!0});a&&await a(f);let p;if(f.headers.get("Content-Type")?.startsWith("application/json"))p=await f.json();else{p=await f.text();try{p=JSON.parse(p||"{}")}catch(m){if(f.ok)throw m;p={error:p}}}if(!f.ok)throw new En({body:r,details:ae(p.error)||f.statusText,headers:f.headers,status:f.status,url:e});return p}catch(f){throw f instanceof En||f instanceof ac?f:new En({body:r,cause:f,url:e})}}}}const lg=`Ethereum Signed Message:
|
|
44
|
+
`;function fg(e){const t=typeof e=="string"?It(e):typeof e.raw=="string"?e.raw:oe(e.raw),n=It(`${lg}${Z(t)}`);return pe([n,t])}function ms(e,t){return K(fg(e),t)}class pg extends P{constructor({domain:t}){super(`Invalid domain "${ae(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class hg extends P{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class mg extends P{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function bg(e){const{domain:t,message:n,primaryType:r,types:s}=e,i=(a,o)=>{for(const c of a){const{name:u,type:l}=c,d=o[u],f=l.match(Sa);if(f&&(typeof d=="number"||typeof d=="bigint")){const[h,b,y]=f;O(d,{signed:b==="int",size:Number.parseInt(y,10)/8})}if(l==="address"&&typeof d=="string"&&!le(d))throw new it({address:d});const p=l.match(Id);if(p){const[h,b]=p;if(b&&Z(d)!==Number.parseInt(b,10))throw new ld({expectedSize:Number.parseInt(b,10),givenSize:Z(d)})}const m=s[l];m&&(gg(l),i(m,d))}};if(s.EIP712Domain&&t){if(typeof t!="object")throw new pg({domain:t});i(s.EIP712Domain,t)}if(r!=="EIP712Domain")if(s[r])i(s[r],n);else throw new hg({primaryType:r,types:s})}function yg({domain:e}){return[typeof e?.name=="string"&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},(typeof e?.chainId=="number"||typeof e?.chainId=="bigint")&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function gg(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new mg({type:e})}function ir(e){const{domain:t={},message:n,primaryType:r}=e,s={EIP712Domain:yg({domain:t}),...e.types};bg({domain:t,message:n,primaryType:r,types:s});const i=["0x1901"];return t&&i.push(wg({domain:t,types:s})),r!=="EIP712Domain"&&i.push(Nl({data:n,primaryType:r,types:s})),K(pe(i))}function wg({domain:e,types:t}){return Nl({data:e,primaryType:"EIP712Domain",types:t})}function Nl({data:e,primaryType:t,types:n}){const r=Rl({data:e,primaryType:t,types:n});return K(r)}function Rl({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],s=[vg({primaryType:t,types:n})];for(const i of n[t]){const[a,o]=Ll({types:n,name:i.name,type:i.type,value:e[i.name]});r.push(a),s.push(o)}return ke(r,s)}function vg({primaryType:e,types:t}){const n=ge(xg({primaryType:e,types:t}));return K(n)}function xg({primaryType:e,types:t}){let n="";const r=jl({primaryType:e,types:t});r.delete(e);const s=[e,...Array.from(r).sort()];for(const i of s)n+=`${i}(${t[i].map(({name:a,type:o})=>`${o} ${a}`).join(",")})`;return n}function jl({primaryType:e,types:t},n=new Set){const s=e.match(/^\w*/u)?.[0];if(n.has(s)||t[s]===void 0)return n;n.add(s);for(const i of t[s])jl({primaryType:i.type,types:t},n);return n}function Ll({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},K(Rl({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},K(r)];if(n==="string")return[{type:"bytes32"},K(ge(r))];if(n.lastIndexOf("]")===n.length-1){const s=n.slice(0,n.lastIndexOf("[")),i=r.map(a=>Ll({name:t,type:s,types:e,value:a}));return[{type:"bytes32"},K(ke(i.map(([a])=>a),i.map(([,a])=>a)))]}return[{type:n},r]}const _g="0x6492649264926492649264926492649264926492649264926492649264926492";class Eg extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const Pg={checksum:new Eg(8192)},js=Pg.checksum;function Dl(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Ed(Nb(e));return n==="Bytes"?r:je(r)}const kg=/^0x[a-fA-F0-9]{40}$/;function bs(e,t={}){const{strict:n=!0}=t;if(!kg.test(e))throw new Ec({address:e,cause:new Ag});if(n){if(e.toLowerCase()===e)return;if(Ul(e)!==e)throw new Ec({address:e,cause:new Sg})}}function Ul(e){if(js.has(e))return js.get(e);bs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Dl(jb(t),{as:"Bytes"}),r=t.split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&r[i]&&(r[i]=r[i].toUpperCase()),(n[i>>1]&15)>=8&&r[i+1]&&(r[i+1]=r[i+1].toUpperCase());const s=`0x${r.join("")}`;return js.set(e,s),s}function Ii(e,t={}){const{strict:n=!0}=t??{};try{return bs(e,{strict:n}),!0}catch{return!1}}class Ec extends D{constructor({address:t,cause:n}){super(`Address "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class Ag extends D{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class Sg extends D{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const Ig=/^(.*)\[([0-9]*)\]$/,Tg=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Fl=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Pc=2n**256n-1n;function Kt(e,t,n){const{checksumAddress:r,staticPosition:s}=n,i=no(t.type);if(i){const[a,o]=i;return Cg(e,{...t,type:o},{checksumAddress:r,length:a,staticPosition:s})}if(t.type==="tuple")return Ng(e,t,{checksumAddress:r,staticPosition:s});if(t.type==="address")return Og(e,{checksum:r});if(t.type==="bool")return Bg(e);if(t.type.startsWith("bytes"))return $g(e,t,{staticPosition:s});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Mg(e,t);if(t.type==="string")return Rg(e,{staticPosition:s});throw new so(t.type)}const kc=32,Ti=32;function Og(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(i=>n?Ul(i):i)(je(Db(r,-20))),32]}function Cg(e,t,n){const{checksumAddress:r,length:s,staticPosition:i}=n;if(!s){const c=rt(e.readBytes(Ti)),u=i+c,l=u+kc;e.setPosition(u);const d=rt(e.readBytes(kc)),f=Zn(t);let p=0;const m=[];for(let h=0;h<d;++h){e.setPosition(l+(f?h*32:p));const[b,y]=Kt(e,t,{checksumAddress:r,staticPosition:l});p+=y,m.push(b)}return e.setPosition(i+32),[m,32]}if(Zn(t)){const c=rt(e.readBytes(Ti)),u=i+c,l=[];for(let d=0;d<s;++d){e.setPosition(u+d*32);const[f]=Kt(e,t,{checksumAddress:r,staticPosition:u});l.push(f)}return e.setPosition(i+32),[l,32]}let a=0;const o=[];for(let c=0;c<s;++c){const[u,l]=Kt(e,t,{checksumAddress:r,staticPosition:i+a});a+=l,o.push(u)}return[o,a]}function Bg(e){return[Fb(e.readBytes(32),{size:32}),32]}function $g(e,t,{staticPosition:n}){const[r,s]=t.type.split("bytes");if(!s){const a=rt(e.readBytes(32));e.setPosition(n+a);const o=rt(e.readBytes(32));if(o===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(o);return e.setPosition(n+32),[je(c),32]}return[je(e.readBytes(Number.parseInt(s,10),32)),32]}function Mg(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),s=e.readBytes(32);return[r>48?Ub(s,{signed:n}):rt(s,{signed:n}),32]}function Ng(e,t,n){const{checksumAddress:r,staticPosition:s}=n,i=t.components.length===0||t.components.some(({name:c})=>!c),a=i?[]:{};let o=0;if(Zn(t)){const c=rt(e.readBytes(Ti)),u=s+c;for(let l=0;l<t.components.length;++l){const d=t.components[l];e.setPosition(u+o);const[f,p]=Kt(e,d,{checksumAddress:r,staticPosition:u});o+=p,a[i?l:d?.name]=f}return e.setPosition(s+32),[a,32]}for(let c=0;c<t.components.length;++c){const u=t.components[c],[l,d]=Kt(e,u,{checksumAddress:r,staticPosition:s});a[i?c:u?.name]=l,o+=d}return[a,o]}function Rg(e,{staticPosition:t}){const n=rt(e.readBytes(32)),r=t+n;e.setPosition(r);const s=rt(e.readBytes(32));if(s===0)return e.setPosition(t+32),["",32];const i=e.readBytes(s,32),a=zb(cl(i));return e.setPosition(t+32),[a,32]}function jg({checksumAddress:e,parameters:t,values:n}){const r=[];for(let s=0;s<t.length;s++)r.push(eo({checksumAddress:e,parameter:t[s],value:n[s]}));return r}function eo({checksumAddress:e=!1,parameter:t,value:n}){const r=t,s=no(r.type);if(s){const[i,a]=s;return Dg(n,{checksumAddress:e,length:i,parameter:{...r,type:a}})}if(r.type==="tuple")return Hg(n,{checksumAddress:e,parameter:r});if(r.type==="address")return Lg(n,{checksum:e});if(r.type==="bool")return Fg(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const i=r.type.startsWith("int"),[,,a="256"]=Fl.exec(r.type)??[];return zg(n,{signed:i,size:Number(a)})}if(r.type.startsWith("bytes"))return Ug(n,{type:r.type});if(r.type==="string")return Gg(n);throw new so(r.type)}function to(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:a,encoded:o}=e[i];a?t+=32:t+=Ae(o)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:a,encoded:o}=e[i];a?(n.push(me(t+s,{size:32})),r.push(o),s+=Ae(o)):n.push(o)}return Re(...n,...r)}function Lg(e,t){const{checksum:n=!1}=t;return bs(e,{strict:n}),{dynamic:!1,encoded:Ct(e.toLowerCase())}}function Dg(e,t){const{checksumAddress:n,length:r,parameter:s}=t,i=r===null;if(!Array.isArray(e))throw new Xg(e);if(!i&&e.length!==r)throw new Qg({expectedLength:r,givenLength:e.length,type:`${s.type}[${r}]`});let a=!1;const o=[];for(let c=0;c<e.length;c++){const u=eo({checksumAddress:n,parameter:s,value:e[c]});u.dynamic&&(a=!0),o.push(u)}if(i||a){const c=to(o);if(i){const u=me(o.length,{size:32});return{dynamic:!0,encoded:o.length>0?Re(u,c):u}}if(a)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:Re(...o.map(({encoded:c})=>c))}}function Ug(e,{type:t}){const[,n]=t.split("bytes"),r=Ae(e);if(!n){let s=e;return r%32!==0&&(s=Bt(s,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Re(Ct(me(r,{size:32})),s)}}if(r!==Number.parseInt(n,10))throw new Gl({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Bt(e)}}function Fg(e){if(typeof e!="boolean")throw new D(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Ct(ul(e))}}function zg(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new fl({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:me(e,{size:32,signed:t})}}function Gg(e){const t=Ha(e),n=Math.ceil(Ae(t)/32),r=[];for(let s=0;s<n;s++)r.push(Bt(qe(t,s*32,(s+1)*32)));return{dynamic:!0,encoded:Re(Bt(me(Ae(t),{size:32})),...r)}}function Hg(e,t){const{checksumAddress:n,parameter:r}=t;let s=!1;const i=[];for(let a=0;a<r.components.length;a++){const o=r.components[a],c=Array.isArray(e)?a:o.name,u=eo({checksumAddress:n,parameter:o,value:e[c]});i.push(u),u.dynamic&&(s=!0)}return{dynamic:s,encoded:s?to(i):Re(...i.map(({encoded:a})=>a))}}function no(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Zn(e){const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(Zn);const n=no(e.type);return!!(n&&Zn({...e,type:n[1]}))}const qg={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new Kg({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Vg({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Ac({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new Ac({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function Wg(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(qg);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class Ac extends D{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class Vg extends D{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class Kg extends D{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function Jg(e,t,n={}){const{as:r="Array",checksumAddress:s=!1}=n,i=typeof t=="string"?ol(t):t,a=Wg(i);if(Gt(i)===0&&e.length>0)throw new Yg;if(Gt(i)&&Gt(i)<32)throw new Zg({data:typeof t=="string"?t:je(t),parameters:e,size:Gt(i)});let o=0;const c=r==="Array"?[]:{};for(let u=0;u<e.length;++u){const l=e[u];a.setPosition(o);const[d,f]=Kt(a,l,{checksumAddress:s,staticPosition:0});o+=f,r==="Array"?c.push(d):c[l.name??u]=d}return c}function ro(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Hl({expectedLength:e.length,givenLength:t.length});const s=jg({checksumAddress:r,parameters:e,values:t}),i=to(s);return i.length===0?"0x":i}function Oi(e,t){if(e.length!==t.length)throw new Hl({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const s=e[r],i=t[r];n.push(Oi.encode(s,i))}return Re(...n)}(function(e){function t(n,r,s=!1){if(n==="address"){const c=r;return bs(c),Ct(c.toLowerCase(),s?32:0)}if(n==="string")return Ha(r);if(n==="bytes")return r;if(n==="bool")return Ct(ul(r),s?32:1);const i=n.match(Fl);if(i){const[c,u,l="256"]=i,d=Number.parseInt(l,10)/8;return me(r,{size:s?32:d,signed:u==="int"})}const a=n.match(Tg);if(a){const[c,u]=a;if(Number.parseInt(u,10)!==(r.length-2)/2)throw new Gl({expectedSize:Number.parseInt(u,10),value:r});return Bt(r,s?32:0)}const o=n.match(Ig);if(o&&Array.isArray(r)){const[c,u]=o,l=[];for(let d=0;d<r.length;d++)l.push(t(u,r[d],!0));return l.length===0?"0x":Re(...l)}throw new so(n)}e.encode=t})(Oi||(Oi={}));function zl(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?zo(e):e}class Zg extends D{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${Ut(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class Yg extends D{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class Qg extends D{constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}class Gl extends D{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Ae(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Hl extends D{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
|
|
45
|
+
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class Xg extends D{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class so extends D{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}function ql(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Ls({signature:e});if(typeof e.s>"u")throw new Ls({signature:e});if(n&&typeof e.yParity>"u")throw new Ls({signature:e});if(e.r<0n||e.r>Pc)throw new a1({value:e.r});if(e.s<0n||e.s>Pc)throw new o1({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new ao({value:e.yParity})}function e1(e){return Wl(je(e))}function Wl(e){if(e.length!==130&&e.length!==132)throw new i1({signature:e});const t=BigInt(qe(e,0,32)),n=BigInt(qe(e,32,64)),r=(()=>{const s=+`0x${e.slice(130)}`;if(!Number.isNaN(s))try{return io(s)}catch{throw new ao({value:s})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function t1(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return n1(e)}function n1(e){const t=typeof e=="string"?Wl(e):e instanceof Uint8Array?e1(e):typeof e.r=="string"?s1(e):e.v?r1(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return ql(t),t}function r1(e){return{r:e.r,s:e.s,yParity:io(e.v)}}function s1(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=io(n)),typeof r!="number")throw new ao({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function io(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new c1({value:e})}let i1=class extends D{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${Ae(Zb(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}},Ls=class extends D{constructor({signature:t}){super(`Signature \`${al(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}},a1=class extends D{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}},o1=class extends D{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}},ao=class extends D{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}},c1=class extends D{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}};function u1(e,t={}){return typeof e.chainId=="string"?d1(e):{...e,...t.signature}}function d1(e){const{address:t,chainId:n,nonce:r}=e,s=t1(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...s}}const l1="0x8010801080108010801080108010801080108010801080108010801080108010",f1=zl("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function Vl(e){if(typeof e=="string"){if(qe(e,-32)!==l1)throw new m1(e)}else ql(e.authorization)}function p1(e){Vl(e);const t=ll(qe(e,-64,-32)),n=qe(e,-t-64,-64),r=qe(e,0,-t-64),[s,i,a]=Jg(f1,n);return{authorization:u1({address:s.delegation,chainId:Number(s.chainId),nonce:s.nonce,yParity:s.yParity,r:s.r,s:s.s}),signature:r,...a&&a!=="0x"?{data:a,to:i}:{}}}function h1(e){try{return Vl(e),!0}catch{return!1}}let m1=class extends D{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};function Ds(e){const{address:t,data:n,signature:r,to:s="hex"}=e,i=ot([ke([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),_g]);return s==="hex"?i:be(i)}function b1(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function y1(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?ye(e.nonce):void 0,storageProof:e.storageProof?b1(e.storageProof):void 0}}async function g1(e,{address:t,blockNumber:n,blockTag:r,storageKeys:s}){const i=r??"latest",a=n!==void 0?O(n):void 0,o=await e.request({method:"eth_getProof",params:[t,s,a||i]});return y1(o)}async function w1(e,{address:t,blockNumber:n,blockTag:r="latest",slot:s}){const i=n!==void 0?O(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,s,i||r]})}async function oo(e,{blockHash:t,blockNumber:n,blockTag:r,hash:s,index:i,sender:a,nonce:o}){const c=r||"latest",u=n!==void 0?O(n):void 0;let l=null;if(s?l=await e.request({method:"eth_getTransactionByHash",params:[s]},{dedupe:!0}):t?l=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,O(i)]},{dedupe:!0}):typeof i=="number"?l=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[u||c,O(i)]},{dedupe:!!u}):a&&typeof o=="number"&&(l=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[a,O(o)]},{dedupe:!0})),!l)throw new Rd({blockHash:t,blockNumber:n,blockTag:c,hash:s,index:i});return(e.chain?.formatters?.transaction?.format||ja)(l,"getTransaction")}async function v1(e,{hash:t,transactionReceipt:n}){const[r,s]=await Promise.all([M(e,sr,"getBlockNumber")({}),t?M(e,oo,"getTransaction")({hash:t}):void 0]),i=n?.blockNumber||s?.blockNumber;return i?r-i+1n:0n}async function kr(e,{hash:t}){const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new jd({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||Ka)(n,"getTransactionReceipt")}async function x1(e,t){const{account:n,authorizationList:r,allowFailure:s=!0,blockNumber:i,blockOverrides:a,blockTag:o,stateOverride:c}=t,u=t.contracts,{batchSize:l=t.batchSize??1024,deployless:d=t.deployless??!1}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},f=(()=>{if(t.multicallAddress)return t.multicallAddress;if(d)return null;if(e.chain)return fn({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),p=[[]];let m=0,h=0;for(let g=0;g<u.length;g++){const{abi:_,address:w,args:x,functionName:k}=u[g];try{const A=ie({abi:_,args:x,functionName:k});h+=(A.length-2)/2,l>0&&h>l&&p[m].length>0&&(m++,h=(A.length-2)/2,p[m]=[]),p[m]=[...p[m],{allowFailure:!0,callData:A,target:w}]}catch(A){const T=Xt(A,{abi:_,address:w,args:x,docsPath:"/docs/contract/multicall",functionName:k,sender:n});if(!s)throw T;p[m]=[...p[m],{allowFailure:!0,callData:"0x",target:w}]}}const b=await Promise.allSettled(p.map(g=>M(e,we,"readContract")({...f===null?{code:qa}:{address:f},abi:Rr,account:n,args:[g],authorizationList:r,blockNumber:i,blockOverrides:a,blockTag:o,functionName:"aggregate3",stateOverride:c}))),y=[];for(let g=0;g<b.length;g++){const _=b[g];if(_.status==="rejected"){if(!s)throw _.reason;for(let x=0;x<p[g].length;x++)y.push({status:"failure",error:_.reason,result:void 0});continue}const w=_.value;for(let x=0;x<w.length;x++){const{returnData:k,success:A}=w[x],{callData:T}=p[g][x],{abi:S,address:v,functionName:I,args:E}=u[y.length];try{if(T==="0x")throw new Yn;if(!A)throw new is({data:k});const C=Rt({abi:S,args:E,data:k,functionName:I});y.push(s?{result:C,status:"success"}:C)}catch(C){const N=Xt(C,{abi:S,address:v,args:E,docsPath:"/docs/contract/multicall",functionName:I});if(!s)throw N;y.push({error:N,result:void 0,status:"failure"})}}}if(y.length!==u.length)throw new P("multicall results mismatch");return y}async function Ci(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:s,returnFullTransactions:i,traceTransfers:a,validation:o}=t;try{const c=[];for(const f of s){const p=f.blockOverrides?hl(f.blockOverrides):void 0,m=f.calls.map(b=>{const y=b,g=y.account?ue(y.account):void 0,_=y.abi?ie(y):y.data,w={...y,account:g,data:y.dataSuffix?pe([_||"0x",y.dataSuffix]):_,from:y.from??g?.address};return un(w),nr(w)}),h=f.stateOverrides?cs(f.stateOverrides):void 0;c.push({blockOverrides:p,calls:m,stateOverrides:h})}const l=(typeof n=="bigint"?O(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:i,traceTransfers:a,validation:o},l]})).map((f,p)=>({...Vd(f),calls:f.calls.map((m,h)=>{const{abi:b,args:y,functionName:g,to:_}=s[p].calls[h],w=m.error?.data??m.returnData,x=BigInt(m.gasUsed),k=m.logs?.map(v=>We(v)),A=m.status==="0x1"?"success":"failure",T=b&&A==="success"&&w!=="0x"?Rt({abi:b,data:w,functionName:g}):null,S=(()=>{if(A==="success")return;let v;if(m.error?.data==="0x"?v=new Yn:m.error&&(v=new is(m.error)),!!v)return Xt(v,{abi:b??[],address:_??"0x",args:y,functionName:g??"<unknown>"})})();return{data:w,gasUsed:x,logs:k,status:A,...A==="success"?{result:T}:{error:S}}})}))}catch(c){const u=c,l=as(u,{});throw l instanceof tr?u:l}}function Bi(e){let t=!0,n="",r=0,s="",i=!1;for(let a=0;a<e.length;a++){const o=e[a];if(["(",")",","].includes(o)&&(t=!0),o==="("&&r++,o===")"&&r--,!!t){if(r===0){if(o===" "&&["event","function","error",""].includes(s))s="";else if(s+=o,o===")"){i=!0;break}continue}if(o===" "){e[a-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=o,n+=o}}if(!i)throw new D("Unable to normalize signature.");return s}function $i(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Ii(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((s,i)=>$i(Object.values(e)[i],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(s=>$i(s,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Kl(e,t,n){for(const r in e){const s=e[r],i=t[r];if(s.type==="tuple"&&i.type==="tuple"&&"components"in s&&"components"in i)return Kl(s.components,i.components,n[r]);const a=[s.type,i.type];if(a.includes("address")&&a.includes("bytes20")?!0:a.includes("address")&&a.includes("string")?Ii(n[r],{strict:!1}):a.includes("address")&&a.includes("bytes")?Ii(n[r],{strict:!1}):!1)return a}}function Jl(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?Fo(e):e;return{...r,...n?{hash:Ht(r)}:{}}}function ys(e,t,n){const{args:r=[],prepare:s=!0}=n??{},i=Yb(t,{strict:!1}),a=e.filter(u=>i?u.type==="function"||u.type==="error"?Zl(u)===qe(t,0,4):u.type==="event"?Ht(u)===t:!1:"name"in u&&u.name===t);if(a.length===0)throw new Lr({name:t});if(a.length===1)return{...a[0],...s?{hash:Ht(a[0])}:{}};let o;for(const u of a){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...s?{hash:Ht(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((d,f)=>{const p="inputs"in u&&u.inputs[f];return p?$i(d,p):!1})){if(o&&"inputs"in o&&o.inputs){const d=Kl(u.inputs,o.inputs,r);if(d)throw new E1({abiItem:u,type:d[0]},{abiItem:o,type:d[1]})}o=u}}const c=(()=>{if(o)return o;const[u,...l]=a;return{...u,overloads:l}})();if(!c)throw new Lr({name:t});return{...c,...s?{hash:Ht(c)}:{}}}function Zl(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return ys(n,r)}return e[0]})();return qe(Ht(t),0,4)}function _1(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,s]=e;return ys(r,s)}return e[0]})(),n=typeof t=="string"?t:Ir(t);return Bi(n)}function Ht(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return ys(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:Dl(Ha(_1(t)))}class E1 extends D{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Bi(Ir(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Bi(Ir(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class Lr extends D{constructor({name:t,data:n,type:r="item"}){const s=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${s} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function P1(...e){const[t,n]=(()=>{if(Array.isArray(e[0])){const[i,a]=e;return[A1(i),a]}return e})(),{bytecode:r,args:s}=n;return Re(r,t.inputs?.length&&s?.length?ro(t.inputs,s):"0x")}function k1(e){return Jl(e)}function A1(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new Lr({name:"constructor"});return t}function S1(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[u,l,d]=e;return[Sc(u,l,{args:d}),d]}const[o,c]=e;return[o,c]})(),{overloads:r}=t,s=r?Sc([t,...r],t.name,{args:n}):t,i=I1(s),a=n.length>0?ro(s.inputs,n):void 0;return a?Re(i,a):i}function Dt(e,t={}){return Jl(e,t)}function Sc(e,t,n){const r=ys(e,t,n);if(r.type!=="function")throw new Lr({name:t,type:"function"});return r}function I1(e){return Zl(e)}const T1="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Fe="0x0000000000000000000000000000000000000000",O1="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function C1(e,t){const{blockNumber:n,blockTag:r,calls:s,stateOverrides:i,traceAssetChanges:a,traceTransfers:o,validation:c}=t,u=t.account?ue(t.account):void 0;if(a&&!u)throw new P("`account` is required when `traceAssetChanges` is true");const l=u?P1(k1("constructor(bytes, bytes)"),{bytecode:gl,args:[O1,S1(Dt("function getBalance(address)"),[u.address])]}):void 0,d=a?await Promise.all(t.calls.map(async R=>{if(!R.data&&!R.abi)return;const{accessList:Q}=await Cl(e,{account:u.address,...R,data:R.abi?ie(R):R.data});return Q.map(({address:Ke,storageKeys:xt})=>xt.length>0?Ke:null)})).then(R=>R.flat().filter(Boolean)):[],f=await Ci(e,{blockNumber:n,blockTag:r,blocks:[...a?[{calls:[{data:l}],stateOverrides:i},{calls:d.map((R,Q)=>({abi:[Dt("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:R,from:Fe,nonce:Q})),stateOverrides:[{address:Fe,nonce:0}]}]:[],{calls:[...s,{}].map(R=>({...R,from:u?.address})),stateOverrides:i},...a?[{calls:[{data:l}]},{calls:d.map((R,Q)=>({abi:[Dt("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:R,from:Fe,nonce:Q})),stateOverrides:[{address:Fe,nonce:0}]},{calls:d.map((R,Q)=>({to:R,abi:[Dt("function decimals() returns (uint256)")],functionName:"decimals",from:Fe,nonce:Q})),stateOverrides:[{address:Fe,nonce:0}]},{calls:d.map((R,Q)=>({to:R,abi:[Dt("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Fe,nonce:Q})),stateOverrides:[{address:Fe,nonce:0}]},{calls:d.map((R,Q)=>({to:R,abi:[Dt("function symbol() returns (string)")],functionName:"symbol",from:Fe,nonce:Q})),stateOverrides:[{address:Fe,nonce:0}]}]:[]],traceTransfers:o,validation:c}),p=a?f[2]:f[0],[m,h,,b,y,g,_,w]=a?f:[],{calls:x,...k}=p,A=x.slice(0,-1)??[],T=m?.calls??[],S=h?.calls??[],v=[...T,...S].map(R=>R.status==="success"?se(R.data):null),I=b?.calls??[],E=y?.calls??[],C=[...I,...E].map(R=>R.status==="success"?se(R.data):null),N=(g?.calls??[]).map(R=>R.status==="success"?R.result:null),L=(w?.calls??[]).map(R=>R.status==="success"?R.result:null),H=(_?.calls??[]).map(R=>R.status==="success"?R.result:null),W=[];for(const[R,Q]of C.entries()){const Ke=v[R];if(typeof Q!="bigint"||typeof Ke!="bigint")continue;const xt=N[R-1],Le=L[R-1],Lf=H[R-1],bo=R===0?{address:T1,decimals:18,symbol:"ETH"}:{address:d[R-1],decimals:Lf||xt?Number(xt??1):void 0,symbol:Le??void 0};W.some(Df=>Df.token.address===bo.address)||W.push({token:bo,value:{pre:Ke,post:Q,diff:Q-Ke}})}return{assetChanges:W,block:k,results:A}}const Yl="0x6492649264926492649264926492649264926492649264926492649264926492";function B1(e){if(qe(e,-32)!==Yl)throw new N1(e)}function $1(e){const{data:t,signature:n,to:r}=e;return Re(ro(zl("address, bytes, bytes"),[r,t,n]),Yl)}function M1(e){try{return B1(e),!0}catch{return!1}}class N1 extends D{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function R1({r:e,s:t,to:n="hex",v:r,yParity:s}){const i=(()=>{if(s===0||s===1)return s;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),a=`0x${new lu.Signature(se(e),se(t)).toCompactHex()}${i===0?"1b":"1c"}`;return n==="hex"?a:be(a)}async function gs(e,t){const{address:n,chain:r=e.chain,hash:s,erc6492VerifierAddress:i=t.universalSignatureVerifierAddress??r?.contracts?.erc6492Verifier?.address,multicallAddress:a=t.multicallAddress??r?.contracts?.multicall3?.address}=t;if(r?.verifyHash)return await r.verifyHash(e,t);const o=(()=>{const c=t.signature;return fe(c)?c:typeof c=="object"&&"r"in c&&"s"in c?R1(c):oe(c)})();try{return h1(o)?await j1(e,{...t,multicallAddress:a,signature:o}):await L1(e,{...t,verifierAddress:i,signature:o})}catch(c){try{if(ln(Cr(n),await Ud({hash:s,signature:o})))return!0}catch{}if(c instanceof $t)return!1;throw c}}async function j1(e,t){const{address:n,blockNumber:r,blockTag:s,hash:i,multicallAddress:a}=t,{authorization:o,data:c,signature:u,to:l}=p1(t.signature);if(await Jn(e,{address:n,blockNumber:r,blockTag:s})===ot(["0xef0100",o.address]))return await D1(e,{address:n,blockNumber:r,blockTag:s,hash:i,signature:u});const f={address:o.address,chainId:Number(o.chainId),nonce:Number(o.nonce),r:O(o.r,{size:32}),s:O(o.s,{size:32}),yParity:o.yParity};if(!await ng({address:n,authorization:f}))throw new $t;const m=await M(e,we,"readContract")({...a?{address:a}:{code:qa},authorizationList:[f],abi:Rr,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...c?[{allowFailure:!0,target:l??n,callData:c}]:[],{allowFailure:!0,target:n,callData:ie({abi:yl,functionName:"isValidSignature",args:[i,u]})}]]});if(m[m.length-1]?.returnData?.startsWith("0x1626ba7e"))return!0;throw new $t}async function L1(e,t){const{address:n,factory:r,factoryData:s,hash:i,signature:a,verifierAddress:o,...c}=t,u=await(async()=>!r&&!s||M1(a)?a:$1({data:s,signature:a,to:r}))(),l=o?{to:o,data:ie({abi:gc,functionName:"isValidSig",args:[n,i,u]}),...c}:{data:Wa({abi:gc,args:[n,i,u],bytecode:iy}),...c},{data:d}=await M(e,ds,"call")(l).catch(f=>{throw f instanceof Ld?new $t:f});if(Ih(d??"0x0"))return!0;throw new $t}async function D1(e,t){const{address:n,blockNumber:r,blockTag:s,hash:i,signature:a}=t;if((await M(e,we,"readContract")({address:n,abi:yl,args:[i,a],blockNumber:r,blockTag:s,functionName:"isValidSignature"}).catch(c=>{throw c instanceof Ma?new $t:c})).startsWith("0x1626ba7e"))return!0;throw new $t}class $t extends Error{}async function U1(e,{address:t,message:n,factory:r,factoryData:s,signature:i,...a}){const o=ms(n);return M(e,gs,"verifyHash")({address:t,factory:r,factoryData:s,hash:o,signature:i,...a})}async function F1(e,t){const{address:n,factory:r,factoryData:s,signature:i,message:a,primaryType:o,types:c,domain:u,...l}=t,d=ir({message:a,primaryType:o,types:c,domain:u});return M(e,gs,"verifyHash")({address:n,factory:r,factoryData:s,hash:d,signature:i,...l})}function Ql(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:s,poll:i,pollingInterval:a=e.pollingInterval}){const o=typeof i<"u"?i:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let c;return o?(()=>{const d=ae(["watchBlockNumber",e.uid,t,n,a]);return Ve(d,{onBlockNumber:r,onError:s},f=>jt(async()=>{try{const p=await M(e,sr,"getBlockNumber")({cacheTime:0});if(c!==void 0){if(p===c)return;if(p-c>1&&n)for(let m=c+1n;m<p;m++)f.onBlockNumber(m,c),c=m}(c===void 0||p>c)&&(f.onBlockNumber(p,c),c=p)}catch(p){f.onError?.(p)}},{emitOnBegin:t,interval:a}))})():(()=>{const d=ae(["watchBlockNumber",e.uid,t,n]);return Ve(d,{onBlockNumber:r,onError:s},f=>{let p=!0,m=()=>p=!1;return(async()=>{try{const h=(()=>{if(e.transport.type==="fallback"){const y=e.transport.transports.find(g=>g.config.type==="webSocket"||g.config.type==="ipc");return y?y.value:e.transport}return e.transport})(),{unsubscribe:b}=await h.subscribe({params:["newHeads"],onData(y){if(!p)return;const g=se(y.result?.number);f.onBlockNumber(g,c),c=g},onError(y){f.onError?.(y)}});m=b,p||m()}catch(h){s?.(h)}})(),()=>m()})})()}async function z1(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:s,onReplaced:i,retryCount:a=6,retryDelay:o=({count:x})=>~~(1<<x)*200,timeout:c=18e4}=t,u=ae(["waitForTransactionReceipt",e.uid,s]),l=t.pollingInterval?t.pollingInterval:e.chain?.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval;let d,f,p,m=!1,h,b;const{promise:y,resolve:g,reject:_}=Va(),w=c?setTimeout(()=>{b?.(),h?.(),_(new Dm({hash:s}))},c):void 0;return h=Ve(u,{onReplaced:i,resolve:g,reject:_},async x=>{if(p=await M(e,kr,"getTransactionReceipt")({hash:s}).catch(()=>{}),p&&r<=1){clearTimeout(w),x.resolve(p),h?.();return}b=M(e,Ql,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(k){const A=S=>{clearTimeout(w),b?.(),S(),h?.()};let T=k;if(!m)try{if(p){if(r>1&&(!p.blockNumber||T-p.blockNumber+1n<r))return;A(()=>x.resolve(p));return}if(n&&!d&&(m=!0,await jr(async()=>{d=await M(e,oo,"getTransaction")({hash:s}),d.blockNumber&&(T=d.blockNumber)},{delay:o,retryCount:a}),m=!1),p=await M(e,kr,"getTransactionReceipt")({hash:s}),r>1&&(!p.blockNumber||T-p.blockNumber+1n<r))return;A(()=>x.resolve(p))}catch(S){if(S instanceof Rd||S instanceof jd){if(!d){m=!1;return}try{f=d,m=!0;const v=await jr(()=>M(e,Be,"getBlock")({blockNumber:T,includeTransactions:!0}),{delay:o,retryCount:a,shouldRetry:({error:C})=>C instanceof qd});m=!1;const I=v.transactions.find(({from:C,nonce:N})=>C===f.from&&N===f.nonce);if(!I||(p=await M(e,kr,"getTransactionReceipt")({hash:I.hash}),r>1&&(!p.blockNumber||T-p.blockNumber+1n<r)))return;let E="replaced";I.to===f.to&&I.value===f.value&&I.input===f.input?E="repriced":I.from===I.to&&I.value===0n&&(E="cancelled"),A(()=>{x.onReplaced?.({reason:E,replacedTransaction:f,transaction:I,transactionReceipt:p}),x.resolve(p)})}catch(v){A(()=>x.reject(v))}}else A(()=>x.reject(S))}}})}),y}function G1(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:s,onError:i,includeTransactions:a,poll:o,pollingInterval:c=e.pollingInterval}){const u=typeof o<"u"?o:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),l=a??!1;let d;return u?(()=>{const m=ae(["watchBlocks",e.uid,t,n,r,l,c]);return Ve(m,{onBlock:s,onError:i},h=>jt(async()=>{try{const b=await M(e,Be,"getBlock")({blockTag:t,includeTransactions:l});if(b.number!==null&&d?.number!=null){if(b.number===d.number)return;if(b.number-d.number>1&&n)for(let y=d?.number+1n;y<b.number;y++){const g=await M(e,Be,"getBlock")({blockNumber:y,includeTransactions:l});h.onBlock(g,d),d=g}}(d?.number==null||t==="pending"&&b?.number==null||b.number!==null&&b.number>d.number)&&(h.onBlock(b,d),d=b)}catch(b){h.onError?.(b)}},{emitOnBegin:r,interval:c}))})():(()=>{let m=!0,h=!0,b=()=>m=!1;return(async()=>{try{r&&M(e,Be,"getBlock")({blockTag:t,includeTransactions:l}).then(_=>{m&&h&&(s(_,void 0),h=!1)}).catch(i);const y=(()=>{if(e.transport.type==="fallback"){const _=e.transport.transports.find(w=>w.config.type==="webSocket"||w.config.type==="ipc");return _?_.value:e.transport}return e.transport})(),{unsubscribe:g}=await y.subscribe({params:["newHeads"],async onData(_){if(!m)return;const w=await M(e,Be,"getBlock")({blockNumber:_.result?.number,includeTransactions:l}).catch(()=>{});m&&(s(w,d),h=!1,d=w)},onError(_){i?.(_)}});b=g,m||b()}catch(y){i?.(y)}})(),()=>b()})()}function H1(e,{address:t,args:n,batch:r=!0,event:s,events:i,fromBlock:a,onError:o,onLogs:c,poll:u,pollingInterval:l=e.pollingInterval,strict:d}){const f=typeof u<"u"?u:typeof a=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),p=d??!1;return f?(()=>{const b=ae(["watchEvent",t,n,r,e.uid,s,l,a]);return Ve(b,{onLogs:c,onError:o},y=>{let g;a!==void 0&&(g=a-1n);let _,w=!1;const x=jt(async()=>{if(!w){try{_=await M(e,Bl,"createEventFilter")({address:t,args:n,event:s,events:i,strict:p,fromBlock:a})}catch{}w=!0;return}try{let k;if(_)k=await M(e,ls,"getFilterChanges")({filter:_});else{const A=await M(e,sr,"getBlockNumber")({});g&&g!==A?k=await M(e,Ga,"getLogs")({address:t,args:n,event:s,events:i,fromBlock:g+1n,toBlock:A}):k=[],g=A}if(k.length===0)return;if(r)y.onLogs(k);else for(const A of k)y.onLogs([A])}catch(k){_&&k instanceof wt&&(w=!1),y.onError?.(k)}},{emitOnBegin:!0,interval:l});return async()=>{_&&await M(e,fs,"uninstallFilter")({filter:_}),x()}})})():(()=>{let b=!0,y=()=>b=!1;return(async()=>{try{const g=(()=>{if(e.transport.type==="fallback"){const k=e.transport.transports.find(A=>A.config.type==="webSocket"||A.config.type==="ipc");return k?k.value:e.transport}return e.transport})(),_=i??(s?[s]:void 0);let w=[];_&&(w=[_.flatMap(A=>er({abi:[A],eventName:A.name,args:n}))],s&&(w=w[0]));const{unsubscribe:x}=await g.subscribe({params:["logs",{address:t,topics:w}],onData(k){if(!b)return;const A=k.result;try{const{eventName:T,args:S}=Nr({abi:_??[],data:A.data,topics:A.topics,strict:p}),v=We(A,{args:S,eventName:T});c([v])}catch(T){let S,v;if(T instanceof Tr||T instanceof Ea){if(d)return;S=T.abiItem.name,v=T.abiItem.inputs?.some(E=>!("name"in E&&E.name))}const I=We(A,{args:v?[]:{},eventName:S});c([I])}},onError(k){o?.(k)}});y=x,b||y()}catch(g){o?.(g)}})(),()=>y()})()}function q1(e,{batch:t=!0,onError:n,onTransactions:r,poll:s,pollingInterval:i=e.pollingInterval}){return(typeof s<"u"?s:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const u=ae(["watchPendingTransactions",e.uid,t,i]);return Ve(u,{onTransactions:r,onError:n},l=>{let d;const f=jt(async()=>{try{if(!d)try{d=await M(e,$l,"createPendingTransactionFilter")({});return}catch(m){throw f(),m}const p=await M(e,ls,"getFilterChanges")({filter:d});if(p.length===0)return;if(t)l.onTransactions(p);else for(const m of p)l.onTransactions([m])}catch(p){l.onError?.(p)}},{emitOnBegin:!0,interval:i});return async()=>{d&&await M(e,fs,"uninstallFilter")({filter:d}),f()}})})():(()=>{let u=!0,l=()=>u=!1;return(async()=>{try{const{unsubscribe:d}=await e.transport.subscribe({params:["newPendingTransactions"],onData(f){if(!u)return;const p=f.result;r([p])},onError(f){n?.(f)}});l=d,u||l()}catch(d){n?.(d)}})(),()=>l()})()}function W1(e){const{scheme:t,statement:n,...r}=e.match(V1)?.groups??{},{chainId:s,expirationTime:i,issuedAt:a,notBefore:o,requestId:c,...u}=e.match(K1)?.groups??{},l=e.split("Resources:")[1]?.split(`
|
|
46
|
+
- `).slice(1);return{...r,...u,...s?{chainId:Number(s)}:{},...i?{expirationTime:new Date(i)}:{},...a?{issuedAt:new Date(a)}:{},...o?{notBefore:new Date(o)}:{},...c?{requestId:c}:{},...l?{resources:l}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const V1=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,K1=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;function J1(e){const{address:t,domain:n,message:r,nonce:s,scheme:i,time:a=new Date}=e;if(n&&r.domain!==n||s&&r.nonce!==s||i&&r.scheme!==i||r.expirationTime&&a>=r.expirationTime||r.notBefore&&a<r.notBefore)return!1;try{if(!r.address||!le(r.address,{strict:!1})||t&&!ln(r.address,t))return!1}catch{return!1}return!0}async function Z1(e,t){const{address:n,domain:r,message:s,nonce:i,scheme:a,signature:o,time:c=new Date,...u}=t,l=W1(s);if(!l.address||!J1({address:n,domain:r,message:l,nonce:i,scheme:a,time:c}))return!1;const f=ms(s);return gs(e,{address:l.address,hash:f,signature:o,...u})}async function Y1(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){const s=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,O(r)]:[t]},{retryCount:0}),a=(e.chain?.formatters?.transactionReceipt?.format||Ka)(s);if(a.status==="reverted"&&n)throw new Lm({receipt:a});return a}function Q1(e){return{call:t=>ds(e,t),createAccessList:t=>Cl(e,t),createBlockFilter:()=>qy(e),createContractEventFilter:t=>Od(e,t),createEventFilter:t=>Bl(e,t),createPendingTransactionFilter:()=>$l(e),estimateContractGas:t=>Pb(e,t),estimateGas:t=>Fa(e,t),getBalance:t=>Wy(e,t),getBlobBaseFee:()=>Vy(e),getBlock:t=>Be(e,t),getBlockNumber:t=>sr(e,t),getBlockTransactionCount:t=>Ky(e,t),getBytecode:t=>Jn(e,t),getChainId:()=>dn(e),getCode:t=>Jn(e,t),getContractEvents:t=>nl(e,t),getEip712Domain:t=>Zy(e,t),getEnsAddress:t=>Ty(e,t),getEnsAvatar:t=>zy(e,t),getEnsName:t=>Gy(e,t),getEnsResolver:t=>Hy(e,t),getEnsText:t=>Ol(e,t),getFeeHistory:t=>Xy(e,t),estimateFeesPerGas:t=>Jd(e,t),getFilterChanges:t=>ls(e,t),getFilterLogs:t=>eg(e,t),getGasPrice:()=>La(e),getLogs:t=>Ga(e,t),getProof:t=>g1(e,t),estimateMaxPriorityFeePerGas:t=>ib(e,t),fillTransaction:t=>el(e,t),getStorageAt:t=>w1(e,t),getTransaction:t=>oo(e,t),getTransactionConfirmations:t=>v1(e,t),getTransactionCount:t=>Da(e,t),getTransactionReceipt:t=>kr(e,t),multicall:t=>x1(e,t),prepareTransactionRequest:t=>tl(e,t),readContract:t=>we(e,t),sendRawTransaction:t=>gy(e,t),sendRawTransactionSync:t=>Y1(e,t),simulate:t=>Ci(e,t),simulateBlocks:t=>Ci(e,t),simulateCalls:t=>C1(e,t),simulateContract:t=>dy(e,t),verifyHash:t=>gs(e,t),verifyMessage:t=>U1(e,t),verifySiweMessage:t=>Z1(e,t),verifyTypedData:t=>F1(e,t),uninstallFilter:t=>fs(e,t),waitForTransactionReceipt:t=>z1(e,t),watchBlocks:t=>G1(e,t),watchBlockNumber:t=>Ql(e,t),watchContractEvent:t=>yy(e,t),watchEvent:t=>H1(e,t),watchPendingTransactions:t=>q1(e,t)}}function X1(e){const{key:t="public",name:n="Public Client"}=e;return Al({...e,key:t,name:n,type:"publicClient"}).extend(Q1)}async function ew(e,t){const{account:n=e.account,chainId:r,nonce:s}=t;if(!n)throw new ps({docsPath:"/docs/eip7702/prepareAuthorization"});const i=ue(n),a=(()=>{if(t.executor)return t.executor==="self"?t.executor:ue(t.executor)})(),o={address:t.contractAddress??t.address,chainId:r,nonce:s};return typeof o.chainId>"u"&&(o.chainId=e.chain?.id??await M(e,dn,"getChainId")({})),typeof o.nonce>"u"&&(o.nonce=await M(e,Da,"getTransactionCount")({address:i.address,blockTag:"pending"}),(a==="self"||a?.address&&ln(a.address,i.address))&&(o.nonce+=1)),o}function tw({key:e,methods:t,name:n,request:r,retryCount:s=3,retryDelay:i=150,timeout:a,type:o},c){const u=kl();return{config:{key:e,methods:t,name:n,request:r,retryCount:s,retryDelay:i,timeout:a,type:o},request:sg(r,{methods:t,retryCount:s,retryDelay:i,uid:u}),value:c}}class nw extends P{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function Ic(e,t={}){const{batch:n,fetchFn:r,fetchOptions:s,key:i="http",methods:a,name:o="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:u,retryDelay:l,raw:d}=t;return({chain:f,retryCount:p,timeout:m})=>{const{batchSize:h=1e3,wait:b=0}=typeof n=="object"?n:{},y=t.retryCount??p,g=m??t.timeout??1e4,_=e||f?.rpcUrls.default.http[0];if(!_)throw new nw;const w=dg(_,{fetchFn:r,fetchOptions:s,onRequest:c,onResponse:u,timeout:g});return tw({key:i,methods:a,name:o,async request({method:x,params:k}){const A={method:x,params:k},{schedule:T}=xl({id:_,wait:b,shouldSplitBatch(E){return E.length>h},fn:E=>w.request({body:E}),sort:(E,C)=>E.id-C.id}),S=async E=>n?T(E):[await w.request({body:E})],[{error:v,result:I}]=await S(A);if(d)return{error:v,result:I};if(v)throw new Na({body:A,error:v,url:_});return I},retryCount:y,retryDelay:l,timeout:g,type:"http"},{fetchOptions:s,url:_})}}function rw(e){const{r:t,s:n}=lu.Signature.fromCompact(e.slice(2,130)),r=+`0x${e.slice(130)}`,[s,i]=(()=>{if(r===0||r===1)return[void 0,r];if(r===27)return[BigInt(r),0];if(r===28)return[BigInt(r),1];throw new Error("Invalid yParityOrV value")})();return typeof s<"u"?{r:O(t,{size:32}),s:O(n,{size:32}),v:s,yParity:i}:{r:O(t,{size:32}),s:O(n,{size:32}),yParity:i}}const sw=({method:e,correlationId:t})=>{var n;G("scw_signer.handshake.started",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=$.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},z.high)},iw=({method:e,correlationId:t,errorMessage:n})=>{var r;G("scw_signer.handshake.error",{action:F.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=$.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},z.high)},aw=({method:e,correlationId:t})=>{var n;G("scw_signer.handshake.completed",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=$.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},z.high)},ow=({method:e,correlationId:t})=>{var n;G("scw_signer.request.started",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=$.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},z.high)},cw=({method:e,correlationId:t,errorMessage:n})=>{var r;G("scw_signer.request.error",{action:F.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=$.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},z.high)},uw=({method:e,correlationId:t})=>{var n;G("scw_signer.request.completed",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=$.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},z.high)},dw=({method:e,correlationId:t})=>{var n;G("scw_sub_account.request.started",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=$.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},z.high)},lw=({method:e,correlationId:t})=>{var n;G("scw_sub_account.request.completed",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=$.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},z.high)},fw=({method:e,correlationId:t,errorMessage:n})=>{var r;G("scw_sub_account.request.error",{action:F.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=$.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},z.high)},pw=({method:e,correlationId:t})=>{var n;G("scw_sub_account.add_owner.started",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=$.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},z.high)},hw=({method:e,correlationId:t})=>{var n;G("scw_sub_account.add_owner.completed",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=$.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},z.high)},mw=({method:e,correlationId:t,errorMessage:n})=>{var r;G("scw_sub_account.add_owner.error",{action:F.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=$.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},z.high)},bw=({method:e,correlationId:t})=>{var n;G("scw_sub_account.insufficient_balance.error_handling.started",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=$.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},z.high)},yw=({method:e,correlationId:t})=>{var n;G("scw_sub_account.insufficient_balance.error_handling.completed",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=$.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},z.high)},gw=({method:e,correlationId:t,errorMessage:n})=>{var r;G("scw_sub_account.insufficient_balance.error_handling.error",{action:F.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=$.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},z.high)},Pt=e=>"message"in e&&typeof e.message=="string"?e.message:"",ww=[{inputs:[{name:"preOpGas",type:"uint256"},{name:"paid",type:"uint256"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"targetSuccess",type:"bool"},{name:"targetResult",type:"bytes"}],name:"ExecutionResult",type:"error"},{inputs:[{name:"opIndex",type:"uint256"},{name:"reason",type:"string"}],name:"FailedOp",type:"error"},{inputs:[{name:"sender",type:"address"}],name:"SenderAddressResult",type:"error"},{inputs:[{name:"aggregator",type:"address"}],name:"SignatureValidationFailed",type:"error"},{inputs:[{components:[{name:"preOpGas",type:"uint256"},{name:"prefund",type:"uint256"},{name:"sigFailed",type:"bool"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"paymasterContext",type:"bytes"}],name:"returnInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"senderInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"factoryInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"paymasterInfo",type:"tuple"}],name:"ValidationResult",type:"error"},{inputs:[{components:[{name:"preOpGas",type:"uint256"},{name:"prefund",type:"uint256"},{name:"sigFailed",type:"bool"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"paymasterContext",type:"bytes"}],name:"returnInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"senderInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"factoryInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"paymasterInfo",type:"tuple"},{components:[{name:"aggregator",type:"address"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"stakeInfo",type:"tuple"}],name:"aggregatorInfo",type:"tuple"}],name:"ValidationResultWithAggregation",type:"error"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"factory",type:"address"},{indexed:!1,name:"paymaster",type:"address"}],name:"AccountDeployed",type:"event"},{anonymous:!1,inputs:[],name:"BeforeExecution",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalDeposit",type:"uint256"}],name:"Deposited",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"aggregator",type:"address"}],name:"SignatureAggregatorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalStaked",type:"uint256"},{indexed:!1,name:"unstakeDelaySec",type:"uint256"}],name:"StakeLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawTime",type:"uint256"}],name:"StakeUnlocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"StakeWithdrawn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"paymaster",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"success",type:"bool"},{indexed:!1,name:"actualGasCost",type:"uint256"},{indexed:!1,name:"actualGasUsed",type:"uint256"}],name:"UserOperationEvent",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"revertReason",type:"bytes"}],name:"UserOperationRevertReason",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"Withdrawn",type:"event"},{inputs:[],name:"SIG_VALIDATION_FAILED",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"initCode",type:"bytes"},{name:"sender",type:"address"},{name:"paymasterAndData",type:"bytes"}],name:"_validateSenderAndPaymaster",outputs:[],stateMutability:"view",type:"function"},{inputs:[{name:"unstakeDelaySec",type:"uint32"}],name:"addStake",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"depositTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"",type:"address"}],name:"deposits",outputs:[{name:"deposit",type:"uint112"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"getDepositInfo",outputs:[{components:[{name:"deposit",type:"uint112"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],name:"info",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{name:"sender",type:"address"},{name:"key",type:"uint192"}],name:"getNonce",outputs:[{name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"initCode",type:"bytes"}],name:"getSenderAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"getUserOpHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOps",type:"tuple[]"},{name:"aggregator",type:"address"},{name:"signature",type:"bytes"}],name:"opsPerAggregator",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleAggregatedOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"ops",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"key",type:"uint192"}],name:"incrementNonce",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"callData",type:"bytes"},{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"paymaster",type:"address"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"}],name:"mUserOp",type:"tuple"},{name:"userOpHash",type:"bytes32"},{name:"prefund",type:"uint256"},{name:"contextOffset",type:"uint256"},{name:"preOpGas",type:"uint256"}],name:"opInfo",type:"tuple"},{name:"context",type:"bytes"}],name:"innerHandleOp",outputs:[{name:"actualGasCost",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"",type:"address"},{name:"",type:"uint192"}],name:"nonceSequenceNumber",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"op",type:"tuple"},{name:"target",type:"address"},{name:"targetCallData",type:"bytes"}],name:"simulateHandleOp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"simulateValidation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unlockStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"}],name:"withdrawStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"},{name:"withdrawAmount",type:"uint256"}],name:"withdrawTo",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],vw="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";function Xl(e,t={}){const{forHash:n}=t,{authorization:r,factory:s,factoryData:i}=e;return n&&(s==="0x7702"||s==="0x7702000000000000000000000000000000000000")?r?pe([r.address,i??"0x"]):"0x7702000000000000000000000000000000000000":s?pe([s,i??"0x"]):"0x"}const Tc="0x22e325a297439656";function ef(e,t={}){const{callGasLimit:n,callData:r,maxPriorityFeePerGas:s,maxFeePerGas:i,paymaster:a,paymasterData:o,paymasterPostOpGasLimit:c,paymasterSignature:u,paymasterVerificationGasLimit:l,sender:d,signature:f="0x",verificationGasLimit:p}=e,m=pe([re(O(p||0n),{size:16}),re(O(n||0n),{size:16})]),h=Xl(e,t),b=pe([re(O(s||0n),{size:16}),re(O(i||0n),{size:16})]),y=e.nonce??0n,g=a?pe([a,re(O(l||0n),{size:16}),re(O(c||0n),{size:16}),o||"0x",...u?t.forHash?[Tc]:[u,re(O(Z(u)),{size:2}),Tc]:[]]):"0x",_=e.preVerificationGas??0n;return{accountGasLimits:m,callData:r,initCode:h,gasFees:b,nonce:y,paymasterAndData:g,preVerificationGas:_,sender:d,signature:f}}const xw={PackedUserOperation:[{type:"address",name:"sender"},{type:"uint256",name:"nonce"},{type:"bytes",name:"initCode"},{type:"bytes",name:"callData"},{type:"bytes32",name:"accountGasLimits"},{type:"uint256",name:"preVerificationGas"},{type:"bytes32",name:"gasFees"},{type:"bytes",name:"paymasterAndData"}]};function _w(e){const{chainId:t,entryPointAddress:n,userOperation:r}=e,s=ef(r,{forHash:!0});return{types:xw,primaryType:"PackedUserOperation",domain:{name:"ERC4337",version:"1",chainId:t,verifyingContract:n},message:s}}function Ew(e){const{chainId:t,entryPointAddress:n,entryPointVersion:r}=e,s=e.userOperation,{authorization:i,callData:a="0x",callGasLimit:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,paymasterAndData:d="0x",preVerificationGas:f,sender:p,verificationGasLimit:m}=s;if(r==="0.8"||r==="0.9")return ir(_w({chainId:t,entryPointAddress:n,userOperation:s}));const h=(()=>{if(r==="0.6"){const b=s.initCode?.slice(0,42),y=s.initCode?.slice(42),g=Xl({authorization:i,factory:b,factoryData:y},{forHash:!0});return ke([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"bytes32"}],[p,l,K(g),K(a),o,m,f,c,u,K(d)])}if(r==="0.7"){const b=ef(s,{forHash:!0});return ke([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"}],[b.sender,b.nonce,K(b.initCode),K(b.callData),b.accountGasLimits,b.preVerificationGas,b.gasFees,K(b.paymasterAndData)])}throw new Error(`entryPointVersion "${r}" not supported.`)})();return K(ke([{type:"bytes32"},{type:"address"},{type:"uint256"}],[K(h),n,BigInt(t)]))}async function Pw(e){const{extend:t,nonceKeyManager:n=og({source:{get(){return Date.now()},set(){}}}),...r}=e;let s=!1;const i=await e.getAddress();return{...t,...r,address:i,async getFactoryArgs(){return"isDeployed"in this&&await this.isDeployed()?{factory:void 0,factoryData:void 0}:e.getFactoryArgs()},async getNonce(a){const o=a?.key??BigInt(await n.consume({address:i,chainId:e.client.chain.id,client:e.client}));return e.getNonce?await e.getNonce({...a,key:o}):await we(e.client,{abi:_a(["function getNonce(address, uint192) pure returns (uint256)"]),address:e.entryPoint.address,functionName:"getNonce",args:[i,o]})},async isDeployed(){return s?!0:(s=!!await M(e.client,Jn,"getCode")({address:i}),s)},...e.sign?{async sign(a){const[{factory:o,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.sign(a)]);return o&&c?Ds({address:o,data:c,signature:u}):u}}:{},async signMessage(a){const[{factory:o,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.signMessage(a)]);return o&&c&&o!=="0x7702"?Ds({address:o,data:c,signature:u}):u},async signTypedData(a){const[{factory:o,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.signTypedData(a)]);return o&&c&&o!=="0x7702"?Ds({address:o,data:c,signature:u}):u},type:"smart"}}class Mi extends P{constructor({cause:t}){super("Smart Account is not deployed.",{cause:t,metaMessages:["This could arise when:","- No `factory`/`factoryData` or `initCode` properties are provided for Smart Account deployment.","- An incorrect `sender` address is provided."],name:"AccountNotDeployedError"})}}Object.defineProperty(Mi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa20/});class en extends P{constructor({cause:t,data:n,message:r}={}){const s=r?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${s?`with reason: ${s}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n}}Object.defineProperty(en,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32521});Object.defineProperty(en,"message",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Ni extends P{constructor({cause:t}){super("Failed to send funds to beneficiary.",{cause:t,name:"FailedToSendToBeneficiaryError"})}}Object.defineProperty(Ni,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa91/});class Ri extends P{constructor({cause:t}){super("Gas value overflowed.",{cause:t,metaMessages:["This could arise when:","- one of the gas values exceeded 2**120 (uint120)"].filter(Boolean),name:"GasValuesOverflowError"})}}Object.defineProperty(Ri,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa94/});class ji extends P{constructor({cause:t}){super("The `handleOps` function was called by the Bundler with a gas limit too low.",{cause:t,name:"HandleOpsOutOfGasError"})}}Object.defineProperty(ji,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa95/});class Li extends P{constructor({cause:t,factory:n,factoryData:r,initCode:s}){super("Failed to simulate deployment for Smart Account.",{cause:t,metaMessages:["This could arise when:","- Invalid `factory`/`factoryData` or `initCode` properties are present","- Smart Account deployment execution ran out of gas (low `verificationGasLimit` value)",`- Smart Account deployment execution reverted with an error
|
|
47
|
+
`,n&&`factory: ${n}`,r&&`factoryData: ${r}`,s&&`initCode: ${s}`].filter(Boolean),name:"InitCodeFailedError"})}}Object.defineProperty(Li,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa13/});class Di extends P{constructor({cause:t,factory:n,factoryData:r,initCode:s}){super("Smart Account initialization implementation did not create an account.",{cause:t,metaMessages:["This could arise when:","- `factory`/`factoryData` or `initCode` properties are invalid",`- Smart Account initialization implementation is incorrect
|
|
48
|
+
`,n&&`factory: ${n}`,r&&`factoryData: ${r}`,s&&`initCode: ${s}`].filter(Boolean),name:"InitCodeMustCreateSenderError"})}}Object.defineProperty(Di,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa15/});class Ui extends P{constructor({cause:t,factory:n,factoryData:r,initCode:s,sender:i}){super("Smart Account initialization implementation does not return the expected sender.",{cause:t,metaMessages:["This could arise when:",`Smart Account initialization implementation does not return a sender address
|
|
49
|
+
`,n&&`factory: ${n}`,r&&`factoryData: ${r}`,s&&`initCode: ${s}`,i&&`sender: ${i}`].filter(Boolean),name:"InitCodeMustReturnSenderError"})}}Object.defineProperty(Ui,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa14/});class Fi extends P{constructor({cause:t}){super("Smart Account does not have sufficient funds to execute the User Operation.",{cause:t,metaMessages:["This could arise when:","- the Smart Account does not have sufficient funds to cover the required prefund, or","- a Paymaster was not provided"].filter(Boolean),name:"InsufficientPrefundError"})}}Object.defineProperty(Fi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa21/});class zi extends P{constructor({cause:t}){super("Bundler attempted to call an invalid function on the EntryPoint.",{cause:t,name:"InternalCallOnlyError"})}}Object.defineProperty(zi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa92/});class Gi extends P{constructor({cause:t}){super("Bundler used an invalid aggregator for handling aggregated User Operations.",{cause:t,name:"InvalidAggregatorError"})}}Object.defineProperty(Gi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa96/});class Hi extends P{constructor({cause:t,nonce:n}){super("Invalid Smart Account nonce used for User Operation.",{cause:t,metaMessages:[n&&`nonce: ${n}`].filter(Boolean),name:"InvalidAccountNonceError"})}}Object.defineProperty(Hi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa25/});class qi extends P{constructor({cause:t}){super("Bundler has not set a beneficiary address.",{cause:t,name:"InvalidBeneficiaryError"})}}Object.defineProperty(qi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa90/});class Dr extends P{constructor({cause:t}){super("Invalid fields set on User Operation.",{cause:t,name:"InvalidFieldsError"})}}Object.defineProperty(Dr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Wi extends P{constructor({cause:t,paymasterAndData:n}){super("Paymaster properties provided are invalid.",{cause:t,metaMessages:["This could arise when:","- the `paymasterAndData` property is of an incorrect length\n",n&&`paymasterAndData: ${n}`].filter(Boolean),name:"InvalidPaymasterAndDataError"})}}Object.defineProperty(Wi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa93/});class At extends P{constructor({cause:t}){super("Paymaster deposit for the User Operation is too low.",{cause:t,metaMessages:["This could arise when:","- the Paymaster has deposited less than the expected amount via the `deposit` function"].filter(Boolean),name:"PaymasterDepositTooLowError"})}}Object.defineProperty(At,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32508});Object.defineProperty(At,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa31/});class Vi extends P{constructor({cause:t}){super("The `validatePaymasterUserOp` function on the Paymaster reverted.",{cause:t,name:"PaymasterFunctionRevertedError"})}}Object.defineProperty(Vi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa33/});class Ki extends P{constructor({cause:t}){super("The Paymaster contract has not been deployed.",{cause:t,name:"PaymasterNotDeployedError"})}}Object.defineProperty(Ki,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa30/});class Ur extends P{constructor({cause:t}){super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.",{cause:t,name:"PaymasterRateLimitError"})}}Object.defineProperty(Ur,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32504});class Fr extends P{constructor({cause:t}){super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.",{cause:t,name:"PaymasterStakeTooLowError"})}}Object.defineProperty(Fr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32505});class Ji extends P{constructor({cause:t}){super("Paymaster `postOp` function reverted.",{cause:t,name:"PaymasterPostOpFunctionRevertedError"})}}Object.defineProperty(Ji,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa50/});class Zi extends P{constructor({cause:t,factory:n,factoryData:r,initCode:s}){super("Smart Account has already been deployed.",{cause:t,metaMessages:["Remove the following properties and try again:",n&&"`factory`",r&&"`factoryData`",s&&"`initCode`"].filter(Boolean),name:"SenderAlreadyConstructedError"})}}Object.defineProperty(Zi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa10/});class zr extends P{constructor({cause:t}){super("UserOperation rejected because account signature check failed (or paymaster signature, if the paymaster uses its data as signature).",{cause:t,name:"SignatureCheckFailedError"})}}Object.defineProperty(zr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32507});class Yi extends P{constructor({cause:t}){super("The `validateUserOp` function on the Smart Account reverted.",{cause:t,name:"SmartAccountFunctionRevertedError"})}}Object.defineProperty(Yi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa23/});class Gr extends P{constructor({cause:t}){super("UserOperation rejected because account specified unsupported signature aggregator.",{cause:t,name:"UnsupportedSignatureAggregatorError"})}}Object.defineProperty(Gr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32506});class Qi extends P{constructor({cause:t}){super("User Operation expired.",{cause:t,metaMessages:["This could arise when:","- the `validAfter` or `validUntil` values returned from `validateUserOp` on the Smart Account are not satisfied"].filter(Boolean),name:"UserOperationExpiredError"})}}Object.defineProperty(Qi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa22/});class Xi extends P{constructor({cause:t}){super("Paymaster for User Operation expired.",{cause:t,metaMessages:["This could arise when:","- the `validAfter` or `validUntil` values returned from `validatePaymasterUserOp` on the Paymaster are not satisfied"].filter(Boolean),name:"UserOperationPaymasterExpiredError"})}}Object.defineProperty(Xi,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa32/});class ea extends P{constructor({cause:t}){super("Signature provided for the User Operation is invalid.",{cause:t,metaMessages:["This could arise when:","- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Smart Account"].filter(Boolean),name:"UserOperationSignatureError"})}}Object.defineProperty(ea,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa24/});class ta extends P{constructor({cause:t}){super("Signature provided for the User Operation is invalid.",{cause:t,metaMessages:["This could arise when:","- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Paymaster"].filter(Boolean),name:"UserOperationPaymasterSignatureError"})}}Object.defineProperty(ta,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa34/});class Hr extends P{constructor({cause:t}){super("User Operation rejected by EntryPoint's `simulateValidation` during account creation or validation.",{cause:t,name:"UserOperationRejectedByEntryPointError"})}}Object.defineProperty(Hr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32500});class qr extends P{constructor({cause:t}){super("User Operation rejected by Paymaster's `validatePaymasterUserOp`.",{cause:t,name:"UserOperationRejectedByPaymasterError"})}}Object.defineProperty(qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32501});class Wr extends P{constructor({cause:t}){super("User Operation rejected with op code validation error.",{cause:t,name:"UserOperationRejectedByOpCodeError"})}}Object.defineProperty(Wr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32502});class Vr extends P{constructor({cause:t}){super("UserOperation out of time-range: either wallet or paymaster returned a time-range, and it is already expired (or will expire soon).",{cause:t,name:"UserOperationOutOfTimeRangeError"})}}Object.defineProperty(Vr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32503});class kw extends P{constructor({cause:t}){super(`An error occurred while executing user operation: ${t?.shortMessage}`,{cause:t,name:"UnknownBundlerError"})}}class na extends P{constructor({cause:t}){super("User Operation verification gas limit exceeded.",{cause:t,metaMessages:["This could arise when:","- the gas used for verification exceeded the `verificationGasLimit`"].filter(Boolean),name:"VerificationGasLimitExceededError"})}}Object.defineProperty(na,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa40/});class ra extends P{constructor({cause:t}){super("User Operation verification gas limit is too low.",{cause:t,metaMessages:["This could arise when:","- the `verificationGasLimit` is too low to verify the User Operation"].filter(Boolean),name:"VerificationGasLimitTooLowError"})}}Object.defineProperty(ra,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa41/});class Aw extends P{constructor(t,{callData:n,callGasLimit:r,docsPath:s,factory:i,factoryData:a,initCode:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,paymaster:d,paymasterAndData:f,paymasterData:p,paymasterPostOpGasLimit:m,paymasterVerificationGasLimit:h,preVerificationGas:b,sender:y,signature:g,verificationGasLimit:_}){const w=cn({callData:n,callGasLimit:r,factory:i,factoryData:a,initCode:o,maxFeePerGas:typeof c<"u"&&`${he(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${he(u)} gwei`,nonce:l,paymaster:d,paymasterAndData:f,paymasterData:p,paymasterPostOpGasLimit:m,paymasterVerificationGasLimit:h,preVerificationGas:b,sender:y,signature:g,verificationGasLimit:_});super(t.shortMessage,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",w].filter(Boolean),name:"UserOperationExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Sw extends P{constructor({hash:t}){super(`User Operation receipt with hash "${t}" could not be found. The User Operation may not have been processed yet.`,{name:"UserOperationReceiptNotFoundError"})}}class Iw extends P{constructor({hash:t}){super(`User Operation with hash "${t}" could not be found.`,{name:"UserOperationNotFoundError"})}}class Oc extends P{constructor({hash:t}){super(`Timed out while waiting for User Operation with hash "${t}" to be confirmed.`,{name:"WaitForUserOperationReceiptTimeoutError"})}}const Tw=[en,Dr,At,Ur,Fr,zr,Gr,Vr,Hr,qr,Wr];function Ow(e,t){const n=(e.details||"").toLowerCase();if(Mi.message.test(n))return new Mi({cause:e});if(Ni.message.test(n))return new Ni({cause:e});if(Ri.message.test(n))return new Ri({cause:e});if(ji.message.test(n))return new ji({cause:e});if(Li.message.test(n))return new Li({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(Di.message.test(n))return new Di({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(Ui.message.test(n))return new Ui({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode,sender:t.sender});if(Fi.message.test(n))return new Fi({cause:e});if(zi.message.test(n))return new zi({cause:e});if(Hi.message.test(n))return new Hi({cause:e,nonce:t.nonce});if(Gi.message.test(n))return new Gi({cause:e});if(qi.message.test(n))return new qi({cause:e});if(Wi.message.test(n))return new Wi({cause:e});if(At.message.test(n))return new At({cause:e});if(Vi.message.test(n))return new Vi({cause:e});if(Ki.message.test(n))return new Ki({cause:e});if(Ji.message.test(n))return new Ji({cause:e});if(Yi.message.test(n))return new Yi({cause:e});if(Zi.message.test(n))return new Zi({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(Qi.message.test(n))return new Qi({cause:e});if(Xi.message.test(n))return new Xi({cause:e});if(ta.message.test(n))return new ta({cause:e});if(ea.message.test(n))return new ea({cause:e});if(na.message.test(n))return new na({cause:e});if(ra.message.test(n))return new ra({cause:e});const r=e.walk(s=>Tw.some(i=>i.code===s.code));if(r){if(r.code===en.code)return new en({cause:e,data:r.data,message:r.details});if(r.code===Dr.code)return new Dr({cause:e});if(r.code===At.code)return new At({cause:e});if(r.code===Ur.code)return new Ur({cause:e});if(r.code===Fr.code)return new Fr({cause:e});if(r.code===zr.code)return new zr({cause:e});if(r.code===Gr.code)return new Gr({cause:e});if(r.code===Vr.code)return new Vr({cause:e});if(r.code===Hr.code)return new Hr({cause:e});if(r.code===qr.code)return new qr({cause:e});if(r.code===Wr.code)return new Wr({cause:e})}return new kw({cause:e})}function tf(e,{calls:t,docsPath:n,...r}){const s=(()=>{const i=Ow(e,r);if(t&&i instanceof en){const a=Cw(i),o=t?.filter(c=>c.abi);if(a&&o.length>0)return Bw({calls:o,revertData:a})}return i})();return new Aw(s,{docsPath:n,...r})}function Cw(e){let t;return e.walk(n=>{const r=n;if(typeof r.data=="string"||typeof r.data?.revertData=="string"||!(r instanceof P)&&typeof r.message=="string"){const s=(r.data?.revertData||r.data||r.message).match?.(/(0x[A-Za-z0-9]*)/);if(s)return t=s[1],!0}return!1}),t}function Bw(e){const{calls:t,revertData:n}=e,{abi:r,functionName:s,args:i,to:a}=(()=>{const c=t?.filter(l=>!!l.abi);if(c.length===1)return c[0];const u=c.filter(l=>{try{return!!$d({abi:l.abi,data:n})}catch{return!1}});return u.length===1?u[0]:{abi:[],functionName:c.reduce((l,d)=>`${l?`${l} | `:""}${d.functionName}`,""),args:void 0,to:void 0}})(),o=n==="0x"?new Dd({functionName:s}):new Br({abi:r,data:n,functionName:s});return new Ma(o,{abi:r,args:i,contractAddress:a,functionName:s})}function $w(e){const t={};return e.callGasLimit&&(t.callGasLimit=BigInt(e.callGasLimit)),e.preVerificationGas&&(t.preVerificationGas=BigInt(e.preVerificationGas)),e.verificationGasLimit&&(t.verificationGasLimit=BigInt(e.verificationGasLimit)),e.paymasterPostOpGasLimit&&(t.paymasterPostOpGasLimit=BigInt(e.paymasterPostOpGasLimit)),e.paymasterVerificationGasLimit&&(t.paymasterVerificationGasLimit=BigInt(e.paymasterVerificationGasLimit)),t}function ws(e){const t={};return typeof e.callData<"u"&&(t.callData=e.callData),typeof e.callGasLimit<"u"&&(t.callGasLimit=O(e.callGasLimit)),typeof e.factory<"u"&&(t.factory=e.factory),typeof e.factoryData<"u"&&(t.factoryData=e.factoryData),typeof e.initCode<"u"&&(t.initCode=e.initCode),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=O(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=O(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=O(e.nonce)),typeof e.paymaster<"u"&&(t.paymaster=e.paymaster),typeof e.paymasterAndData<"u"&&(t.paymasterAndData=e.paymasterAndData||"0x"),typeof e.paymasterData<"u"&&(t.paymasterData=e.paymasterData),typeof e.paymasterPostOpGasLimit<"u"&&(t.paymasterPostOpGasLimit=O(e.paymasterPostOpGasLimit)),typeof e.paymasterSignature<"u"&&(t.paymasterSignature=e.paymasterSignature),typeof e.paymasterVerificationGasLimit<"u"&&(t.paymasterVerificationGasLimit=O(e.paymasterVerificationGasLimit)),typeof e.preVerificationGas<"u"&&(t.preVerificationGas=O(e.preVerificationGas)),typeof e.sender<"u"&&(t.sender=e.sender),typeof e.signature<"u"&&(t.signature=e.signature),typeof e.verificationGasLimit<"u"&&(t.verificationGasLimit=O(e.verificationGasLimit)),typeof e.authorization<"u"&&(t.eip7702Auth=Mw(e.authorization)),t}function Mw(e){return{address:e.address,chainId:O(e.chainId),nonce:O(e.nonce),r:e.r?O(BigInt(e.r),{size:32}):re("0x",{size:32}),s:e.s?O(BigInt(e.s),{size:32}):re("0x",{size:32}),yParity:e.yParity?O(e.yParity,{size:1}):re("0x",{size:32})}}async function Nw(e,t){const{chainId:n,entryPointAddress:r,context:s,...i}=t,a=ws(i),{paymasterPostOpGasLimit:o,paymasterVerificationGasLimit:c,...u}=await e.request({method:"pm_getPaymasterData",params:[{...a,callGasLimit:a.callGasLimit??"0x0",verificationGasLimit:a.verificationGasLimit??"0x0",preVerificationGas:a.preVerificationGas??"0x0"},r,O(n),s]});return{...u,...o&&{paymasterPostOpGasLimit:se(o)},...c&&{paymasterVerificationGasLimit:se(c)}}}async function Rw(e,t){const{chainId:n,entryPointAddress:r,context:s,...i}=t,a=ws(i),{paymasterPostOpGasLimit:o,paymasterVerificationGasLimit:c,...u}=await e.request({method:"pm_getPaymasterStubData",params:[{...a,callGasLimit:a.callGasLimit??"0x0",verificationGasLimit:a.verificationGasLimit??"0x0",preVerificationGas:a.preVerificationGas??"0x0"},r,O(n),s]});return{...u,...o&&{paymasterPostOpGasLimit:se(o)},...c&&{paymasterVerificationGasLimit:se(c)}}}const jw=["factory","fees","gas","paymaster","nonce","signature","authorization"];async function co(e,t){const n=t,{account:r=e.account,parameters:s=jw,stateOverride:i}=n;if(!r)throw new ps;const a=ue(r),o=e,c=n.paymaster??o?.paymaster,u=typeof c=="string"?c:void 0,{getPaymasterStubData:l,getPaymasterData:d}=(()=>{if(c===!0)return{getPaymasterStubData:k=>M(o,Rw,"getPaymasterStubData")(k),getPaymasterData:k=>M(o,Nw,"getPaymasterData")(k)};if(typeof c=="object"){const{getPaymasterStubData:k,getPaymasterData:A}=c;return{getPaymasterStubData:A&&k?k:A,getPaymasterData:A&&k?A:void 0}}return{getPaymasterStubData:void 0,getPaymasterData:void 0}})(),f=n.paymasterContext?n.paymasterContext:o?.paymasterContext;let p={...n,paymaster:u,sender:a.address};const[m,h,b,y,g]=await Promise.all([(async()=>n.calls?a.encodeCalls(n.calls.map(k=>{const A=k;return A.abi?{data:ie(A),to:A.to,value:A.value}:A})):n.callData)(),(async()=>{if(!s.includes("factory"))return;if(n.initCode)return{initCode:n.initCode};if(n.factory&&n.factoryData)return{factory:n.factory,factoryData:n.factoryData};const{factory:k,factoryData:A}=await a.getFactoryArgs();return a.entryPoint.version==="0.6"?{initCode:k&&A?pe([k,A]):void 0}:{factory:k,factoryData:A}})(),(async()=>{if(s.includes("fees")){if(typeof n.maxFeePerGas=="bigint"&&typeof n.maxPriorityFeePerGas=="bigint")return p;if(o?.userOperation?.estimateFeesPerGas){const k=await o.userOperation.estimateFeesPerGas({account:a,bundlerClient:o,userOperation:p});return{...p,...k}}try{const k=o.client??e,A=await M(k,Jd,"estimateFeesPerGas")({chain:k.chain,type:"eip1559"});return{maxFeePerGas:typeof n.maxFeePerGas=="bigint"?n.maxFeePerGas:BigInt(2n*A.maxFeePerGas),maxPriorityFeePerGas:typeof n.maxPriorityFeePerGas=="bigint"?n.maxPriorityFeePerGas:BigInt(2n*A.maxPriorityFeePerGas)}}catch{return}}})(),(async()=>{if(s.includes("nonce"))return typeof n.nonce=="bigint"?n.nonce:a.getNonce()})(),(async()=>{if(s.includes("authorization")){if(typeof n.authorization=="object")return n.authorization;if(a.authorization&&!await a.isDeployed())return{...await ew(a.client,a.authorization),r:"0xfffffffffffffffffffffffffffffff000000000000000000000000000000000",s:"0x7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",yParity:1}}})()]);typeof m<"u"&&(p.callData=m),typeof h<"u"&&(p={...p,...h}),typeof b<"u"&&(p={...p,...b}),typeof y<"u"&&(p.nonce=y),typeof g<"u"&&(p.authorization=g),s.includes("signature")&&(typeof n.signature<"u"?p.signature=n.signature:p.signature=await a.getStubSignature(p)),a.entryPoint.version==="0.6"&&!p.initCode&&(p.initCode="0x");let _;async function w(){return _||(e.chain?e.chain.id:(_=await M(e,dn,"getChainId")({}),_))}let x=!1;if(s.includes("paymaster")&&l&&!u&&!n.paymasterAndData){const{isFinal:k=!1,sponsor:A,...T}=await l({chainId:await w(),entryPointAddress:a.entryPoint.address,context:f,...p});x=k,p={...p,...T}}if(a.entryPoint.version==="0.6"&&!p.paymasterAndData&&(p.paymasterAndData="0x"),s.includes("gas")){if(a.userOperation?.estimateGas){const k=await a.userOperation.estimateGas(p);p={...p,...k}}if(typeof p.callGasLimit>"u"||typeof p.preVerificationGas>"u"||typeof p.verificationGasLimit>"u"||p.paymaster&&typeof p.paymasterPostOpGasLimit>"u"||p.paymaster&&typeof p.paymasterVerificationGasLimit>"u"){const k=await M(o,nf,"estimateUserOperationGas")({account:a,callGasLimit:0n,preVerificationGas:0n,verificationGasLimit:0n,stateOverride:i,...p.paymaster?{paymasterPostOpGasLimit:0n,paymasterVerificationGasLimit:0n}:{},...p});p={...p,callGasLimit:p.callGasLimit??k.callGasLimit,preVerificationGas:p.preVerificationGas??k.preVerificationGas,verificationGasLimit:p.verificationGasLimit??k.verificationGasLimit,paymasterPostOpGasLimit:p.paymasterPostOpGasLimit??k.paymasterPostOpGasLimit,paymasterVerificationGasLimit:p.paymasterVerificationGasLimit??k.paymasterVerificationGasLimit}}}if(s.includes("paymaster")&&d&&!u&&!n.paymasterAndData&&!x){const k=await d({chainId:await w(),entryPointAddress:a.entryPoint.address,context:f,...p});p={...p,...k}}return delete p.calls,delete p.parameters,delete p.paymasterContext,typeof p.paymaster!="string"&&delete p.paymaster,p}async function nf(e,t){const{account:n=e.account,entryPointAddress:r,stateOverride:s}=t;if(!n&&!t.sender)throw new ps;const i=n?ue(n):void 0,a=cs(s),o=i?await M(e,co,"prepareUserOperation")({...t,parameters:["authorization","factory","nonce","paymaster","signature"]}):t;try{const c=[ws(o),r??i?.entryPoint?.address],u=await e.request({method:"eth_estimateUserOperationGas",params:a?[...c,a]:[...c]});return $w(u)}catch(c){const u=t.calls;throw tf(c,{...o,...u?{calls:u}:{}})}}function Lw(e){return e.request({method:"eth_supportedEntryPoints"})}function Dw(e){const t={...e};return e.callGasLimit&&(t.callGasLimit=BigInt(e.callGasLimit)),e.maxFeePerGas&&(t.maxFeePerGas=BigInt(e.maxFeePerGas)),e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=BigInt(e.maxPriorityFeePerGas)),e.nonce&&(t.nonce=BigInt(e.nonce)),e.paymasterPostOpGasLimit&&(t.paymasterPostOpGasLimit=BigInt(e.paymasterPostOpGasLimit)),e.paymasterVerificationGasLimit&&(t.paymasterVerificationGasLimit=BigInt(e.paymasterVerificationGasLimit)),e.preVerificationGas&&(t.preVerificationGas=BigInt(e.preVerificationGas)),e.verificationGasLimit&&(t.verificationGasLimit=BigInt(e.verificationGasLimit)),t}async function Uw(e,{hash:t}){const n=await e.request({method:"eth_getUserOperationByHash",params:[t]},{dedupe:!0});if(!n)throw new Iw({hash:t});const{blockHash:r,blockNumber:s,entryPoint:i,transactionHash:a,userOperation:o}=n;return{blockHash:r,blockNumber:BigInt(s),entryPoint:i,transactionHash:a,userOperation:Dw(o)}}function Fw(e){const t={...e};return e.actualGasCost&&(t.actualGasCost=BigInt(e.actualGasCost)),e.actualGasUsed&&(t.actualGasUsed=BigInt(e.actualGasUsed)),e.logs&&(t.logs=e.logs.map(n=>We(n))),e.receipt&&(t.receipt=Ka(t.receipt)),t}async function rf(e,{hash:t}){const n=await e.request({method:"eth_getUserOperationReceipt",params:[t]},{dedupe:!0});if(!n)throw new Sw({hash:t});return Fw(n)}async function zw(e,t){const{account:n=e.account,entryPointAddress:r}=t;if(!n&&!t.sender)throw new ps;const s=n?ue(n):void 0,i=s?await M(e,co,"prepareUserOperation")(t):t,a=t.signature||await s?.signUserOperation?.(i),o=ws({...i,signature:a});try{return await e.request({method:"eth_sendUserOperation",params:[o,r??s?.entryPoint?.address]},{retryCount:0})}catch(c){const u=t.calls;throw tf(c,{...i,...u?{calls:u}:{},signature:a})}}function Gw(e,t){const{hash:n,pollingInterval:r=e.pollingInterval,retryCount:s,timeout:i=12e4}=t;let a=0;const o=ae(["waitForUserOperationReceipt",e.uid,n]);return new Promise((c,u)=>{const l=Ve(o,{resolve:c,reject:u},d=>{const f=h=>{m(),h(),l()},p=i?setTimeout(()=>f(()=>d.reject(new Oc({hash:n}))),i):void 0,m=jt(async()=>{s&&a>=s&&(clearTimeout(p),f(()=>d.reject(new Oc({hash:n}))));try{const h=await M(e,rf,"getUserOperationReceipt")({hash:n});clearTimeout(p),f(()=>d.resolve(h))}catch(h){const b=h;b.name!=="UserOperationReceiptNotFoundError"&&(clearTimeout(p),f(()=>d.reject(b)))}a++},{emitOnBegin:!0,interval:r});return m})})}function Hw(e){return{estimateUserOperationGas:t=>nf(e,t),getChainId:()=>dn(e),getSupportedEntryPoints:()=>Lw(e),getUserOperation:t=>Uw(e,t),getUserOperationReceipt:t=>rf(e,t),prepareUserOperation:t=>co(e,t),sendUserOperation:t=>zw(e,t),waitForUserOperationReceipt:t=>Gw(e,t)}}function qw(e){const{client:t,key:n="bundler",name:r="Bundler Client",paymaster:s,paymasterContext:i,transport:a,userOperation:o}=e;return Object.assign(Al({...e,chain:e.chain??t?.chain,key:n,name:r,transport:a,type:"bundlerClient"}),{client:t,paymaster:s,paymasterContext:i,userOperation:o}).extend(Hw)}const sf=pa(()=>({}));function Cc(e){e.forEach(t=>{var n,r,s,i,a,o,c,u;if(!t.rpcUrl)return;const l=ag({id:t.id,rpcUrls:{default:{http:[t.rpcUrl]}},name:(r=(n=t.nativeCurrency)===null||n===void 0?void 0:n.name)!==null&&r!==void 0?r:"",nativeCurrency:{name:(i=(s=t.nativeCurrency)===null||s===void 0?void 0:s.name)!==null&&i!==void 0?i:"",symbol:(o=(a=t.nativeCurrency)===null||a===void 0?void 0:a.symbol)!==null&&o!==void 0?o:"",decimals:(u=(c=t.nativeCurrency)===null||c===void 0?void 0:c.decimal)!==null&&u!==void 0?u:18}}),d=X1({chain:l,transport:Ic(t.rpcUrl)}),f=qw({client:d,transport:Ic(t.rpcUrl)});sf.setState({[t.id]:{client:d,bundlerClient:f}})})}function af(e){var t;return(t=sf.getState()[e])===null||t===void 0?void 0:t.client}function Pe(e,t,n){if(e==null)throw t??B.rpc.invalidParams({message:"value must be present",data:e})}function mt(e,t){if(!Array.isArray(e))throw B.rpc.invalidParams({message:t??"value must be an array",data:e})}function pr(e){if(typeof e!="object"||e===null)throw B.rpc.internal("sub account info is not an object");if(!("address"in e))throw B.rpc.internal("sub account is invalid");if("address"in e&&typeof e.address=="string"&&!le(e.address))throw B.rpc.internal("sub account address is invalid");if("factory"in e&&typeof e.factory=="string"&&!le(e.factory))throw B.rpc.internal("sub account factory address is invalid");if("factoryData"in e&&typeof e.factoryData=="string"&&!fe(e.factoryData))throw B.rpc.internal("sub account factory data is invalid")}async function Ww(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Vw(e,t){return crypto.subtle.deriveKey({name:"ECDH",public:t},e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Kw(e,t){const n=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,new TextEncoder().encode(t));return{iv:n,cipherText:r}}async function Jw(e,{iv:t,cipherText:n}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,n);return new TextDecoder().decode(r)}function of(e){switch(e){case"public":return"spki";case"private":return"pkcs8"}}async function cf(e,t){const n=of(e),r=await crypto.subtle.exportKey(n,t);return ba(new Uint8Array(r))}async function uf(e,t){const n=of(e),r=Pr(t).buffer;return await crypto.subtle.importKey(n,new Uint8Array(r),{name:"ECDH",namedCurve:"P-256"},!0,e==="private"?["deriveKey"]:[])}async function Zw(e,t){const n=JSON.stringify(e,(r,s)=>{if(!(s instanceof Error))return s;const i=s;return Object.assign(Object.assign({},i.code?{code:i.code}:{}),{message:i.message})});return Kw(t,n)}async function Yw(e,t){return JSON.parse(await Jw(t,e))}const Qw="0.1.1";function Xw(){return Qw}class Y extends Error{constructor(t,n={}){const r=(()=>{if(n.cause instanceof Y){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause?.message?n.cause.message:n.details})(),s=n.cause instanceof Y&&n.cause.docsPath||n.docsPath,a=`https://oxlib.sh${s??""}`,o=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||s?["",r?`Details: ${r}`:void 0,s?`See: ${a}`:void 0]:[]].filter(c=>typeof c=="string").join(`
|
|
50
|
+
`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${Xw()}`}),this.cause=n.cause,this.details=r,this.docs=a,this.docsPath=s,this.shortMessage=t}walk(t){return df(this,t)}}function df(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?df(e.cause,t):t?null:e}function e6(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function uo(e,...t){if(!e6(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Bc(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function t6(e,t){uo(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function sa(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Us(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ze(e,t){return e<<32-t|e>>>t}function n6(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function lf(e){return typeof e=="string"&&(e=n6(e)),uo(e),e}let r6=class{};function s6(e){const t=r=>e().update(lf(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function i6(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),a=Number(n>>s&i),o=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,a,r),e.setUint32(t+u,o,r)}function a6(e,t,n){return e&t^~e&n}function o6(e,t,n){return e&t^e&n^t&n}let c6=class extends r6{constructor(t,n,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(t),this.view=Us(this.buffer)}update(t){Bc(this),t=lf(t),uo(t);const{view:n,buffer:r,blockLen:s}=this,i=t.length;for(let a=0;a<i;){const o=Math.min(s-this.pos,i-a);if(o===s){const c=Us(t);for(;s<=i-a;a+=s)this.process(c,a);continue}r.set(t.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Bc(this),t6(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:a}=this;n[a++]=128,sa(this.buffer.subarray(a)),this.padOffset>s-a&&(this.process(r,0),a=0);for(let d=a;d<s;d++)n[d]=0;i6(r,s-8,BigInt(this.length*8),i),this.process(r,0);const o=Us(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)o.setUint32(4*d,l[d],i)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:a,pos:o}=this;return t.destroyed=a,t.finished=i,t.length=s,t.pos=o,s%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const lt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u6=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ft=new Uint32Array(64);let d6=class extends c6{constructor(t=32){super(64,t,8,!1),this.A=lt[0]|0,this.B=lt[1]|0,this.C=lt[2]|0,this.D=lt[3]|0,this.E=lt[4]|0,this.F=lt[5]|0,this.G=lt[6]|0,this.H=lt[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:a,G:o,H:c}=this;return[t,n,r,s,i,a,o,c]}set(t,n,r,s,i,a,o,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)ft[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const f=ft[d-15],p=ft[d-2],m=ze(f,7)^ze(f,18)^f>>>3,h=ze(p,17)^ze(p,19)^p>>>10;ft[d]=h+ft[d-7]+m+ft[d-16]|0}let{A:r,B:s,C:i,D:a,E:o,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const f=ze(o,6)^ze(o,11)^ze(o,25),p=l+f+a6(o,c,u)+u6[d]+ft[d]|0,h=(ze(r,2)^ze(r,13)^ze(r,22))+o6(r,s,i)|0;l=u,u=c,c=o,o=a+p|0,a=i,i=s,s=r,r=p+h|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,s,i,a,o,c,u,l)}roundClean(){sa(ft)}destroy(){this.set(0,0,0,0,0,0,0,0),sa(this.buffer)}};const l6=s6(()=>new d6),f6=l6,p6="#__bigint";function vs(e,t,n){return JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString()+p6:s,n)}function h6(e,t){if(nn(e)>t)throw new O6({givenSize:nn(e),maxSize:t})}function m6(e,t){if(typeof t=="number"&&t>0&&t>nn(e)-1)throw new vf({offset:t,position:"start",size:nn(e)})}function b6(e,t,n){if(typeof t=="number"&&typeof n=="number"&&nn(e)!==n-t)throw new vf({offset:n,position:"end",size:nn(e)})}const Ye={zero:48,nine:57,A:65,F:70,a:97,f:102};function $c(e){if(e>=Ye.zero&&e<=Ye.nine)return e-Ye.zero;if(e>=Ye.A&&e<=Ye.F)return e-(Ye.A-10);if(e>=Ye.a&&e<=Ye.f)return e-(Ye.a-10)}function lo(e,t){if(vt(e)>t)throw new A6({givenSize:vt(e),maxSize:t})}function y6(e,t){if(typeof t=="number"&&t>0&&t>vt(e)-1)throw new bf({offset:t,position:"start",size:vt(e)})}function g6(e,t,n){if(typeof t=="number"&&typeof n=="number"&&vt(e)!==n-t)throw new bf({offset:n,position:"end",size:vt(e)})}function ff(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const s=e.replace("0x","");if(s.length>r*2)throw new S6({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const w6=new TextEncoder,v6=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function x6(e,t={}){const{strict:n=!1}=t;if(!e)throw new Mc(e);if(typeof e!="string")throw new Mc(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Nc(e);if(!e.startsWith("0x"))throw new Nc(e)}function xs(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function pf(e){return e instanceof Uint8Array?tn(e):Array.isArray(e)?tn(new Uint8Array(e)):e}function tn(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=v6[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(lo(r,t.size),mf(r,t.size)):r}function gt(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<a){const u=typeof e=="bigint"?"n":"";throw new k6({max:i?`${i}${u}`:void 0,min:`${a}${u}`,signed:n,size:r,value:`${e}${u}`})}const c=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?_6(c,r):c}function hf(e,t={}){return tn(w6.encode(e),t)}function _6(e,t){return ff(e,{dir:"left",size:t})}function mf(e,t){return ff(e,{dir:"right",size:t})}function Te(e,t,n,r={}){const{strict:s}=r;y6(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&g6(i,t,n),i}function vt(e){return Math.ceil((e.length-2)/2)}function E6(e,t={}){const{signed:n}=t;t.size&&lo(e,t.size);const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n)-1n,a=i>>1n;return r<=a?r:r-i-1n}function P6(e,t={}){const{strict:n=!1}=t;try{return x6(e,{strict:n}),!0}catch{return!1}}class k6 extends Y{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number \`${i}\` is not in safe${s?` ${s*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class Mc extends Y{constructor(t){super(`Value \`${typeof t=="object"?vs(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class Nc extends Y{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}let A6=class extends Y{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},bf=class extends Y{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}};class S6 extends Y{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function I6(e){if(!(e instanceof Uint8Array)){if(!e)throw new hr(e);if(typeof e!="object")throw new hr(e);if(!("BYTES_PER_ELEMENT"in e))throw new hr(e);if(e.BYTES_PER_ELEMENT!==1||e.constructor.name!=="Uint8Array")throw new hr(e)}}function yf(e){return e instanceof Uint8Array?e:typeof e=="string"?wf(e):gf(e)}function gf(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function wf(e,t={}){const{size:n}=t;let r=e;n&&(lo(e,n),r=mf(e,n));let s=r.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,a=new Uint8Array(i);for(let o=0,c=0;o<i;o++){const u=$c(s.charCodeAt(c++)),l=$c(s.charCodeAt(c++));if(u===void 0||l===void 0)throw new Y(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);a[o]=u*16+l}return a}function nn(e){return e.length}function Rc(e,t,n,r={}){const{strict:s}=r;m6(e,t);const i=e.slice(t,n);return s&&b6(i,t,n),i}function jc(e,t={}){const{size:n}=t;typeof n<"u"&&h6(e,n);const r=tn(e,t);return E6(r,t)}function T6(e){try{return I6(e),!0}catch{return!1}}class hr extends Y{constructor(t){super(`Value \`${typeof t=="object"?vs(t):t}\` of type \`${typeof t}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}class O6 extends Y{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class vf extends Y{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SliceOffsetOutOfBoundsError"})}}function xf(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=f6(yf(e));return n==="Bytes"?r:tn(r)}function _f(e,t={}){const{compressed:n}=t,{prefix:r,x:s,y:i}=e;if(n===!1||typeof s=="bigint"&&typeof i=="bigint"){if(r!==4)throw new Lc({prefix:r,cause:new N6});return}if(n===!0||typeof s=="bigint"&&typeof i>"u"){if(r!==3&&r!==2)throw new Lc({prefix:r,cause:new M6});return}throw new $6({publicKey:e})}function C6(e){const t=(()=>{if(P6(e))return Ef(e);if(T6(e))return B6(e);const{prefix:n,x:r,y:s}=e;return typeof r=="bigint"&&typeof s=="bigint"?{prefix:n??4,x:r,y:s}:{prefix:n,x:r}})();return _f(t),t}function B6(e){return Ef(tn(e))}function Ef(e){if(e.length!==132&&e.length!==130&&e.length!==68)throw new R6({publicKey:e});if(e.length===130){const r=BigInt(Te(e,0,32)),s=BigInt(Te(e,32,64));return{prefix:4,x:r,y:s}}if(e.length===132){const r=Number(Te(e,0,1)),s=BigInt(Te(e,1,33)),i=BigInt(Te(e,33,65));return{prefix:r,x:s,y:i}}const t=Number(Te(e,0,1)),n=BigInt(Te(e,1,33));return{prefix:t,x:n}}function fo(e,t={}){_f(e);const{prefix:n,x:r,y:s}=e,{includePrefix:i=!0}=t;return xs(i?gt(n,{size:1}):"0x",gt(r,{size:32}),typeof s=="bigint"?gt(s,{size:32}):"0x")}class $6 extends Y{constructor({publicKey:t}){super(`Value \`${vs(t)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class Lc extends Y{constructor({prefix:t,cause:n}){super(`Prefix "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class M6 extends Y{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class N6 extends Y{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}let R6=class extends Y{constructor({publicKey:t}){super(`Value \`${t}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${vt(pf(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const Dc=2n**256n-1n;function j6(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Fs({signature:e});if(typeof e.s>"u")throw new Fs({signature:e});if(n&&typeof e.yParity>"u")throw new Fs({signature:e});if(e.r<0n||e.r>Dc)throw new z6({value:e.r});if(e.s<0n||e.s>Dc)throw new G6({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new po({value:e.yParity})}function Pf(e){if(e.length!==130&&e.length!==132)throw new F6({signature:e});const t=BigInt(Te(e,0,32)),n=BigInt(Te(e,32,64)),r=(()=>{const s=+`0x${e.slice(130)}`;if(!Number.isNaN(s))try{return D6(s)}catch{throw new po({value:s})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function L6(e){j6(e);const t=e.r,n=e.s;return xs(gt(t,{size:32}),gt(n,{size:32}),typeof e.yParity=="number"?gt(U6(e.yParity),{size:1}):"0x")}function D6(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new H6({value:e})}function U6(e){if(e===0)return 27;if(e===1)return 28;throw new po({value:e})}class F6 extends Y{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${vt(pf(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class Fs extends Y{constructor({signature:t}){super(`Signature \`${vs(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class z6 extends Y{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class G6 extends Y{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class po extends Y{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class H6 extends Y{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}const q6=new TextDecoder,mr=Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((e,t)=>[t,e.charCodeAt(0)]));({...Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((e,t)=>[e.charCodeAt(0),t]))});function W6(e,t={}){const{pad:n=!0,url:r=!1}=t,s=new Uint8Array(Math.ceil(e.length/3)*4);for(let c=0,u=0;u<e.length;c+=4,u+=3){const l=(e[u]<<16)+(e[u+1]<<8)+(e[u+2]|0);s[c]=mr[l>>18],s[c+1]=mr[l>>12&63],s[c+2]=mr[l>>6&63],s[c+3]=mr[l&63]}const i=e.length%3,a=Math.floor(e.length/3)*4+(i&&i+1);let o=q6.decode(new Uint8Array(s.buffer,0,a));return n&&i===1&&(o+="=="),n&&i===2&&(o+="="),r&&(o=o.replaceAll("+","-").replaceAll("/","_")),o}function V6(e,t={}){return W6(wf(e),t)}Uint8Array.from([105,171,180,181,160,222,75,198,42,42,32,31,141,37,186,233]);function K6(e={}){const{flag:t=5,rpId:n=window.location.hostname,signCount:r=0}=e,s=xf(hf(n)),i=gt(t,{size:1}),a=gt(r,{size:4});return xs(s,i,a)}function J6(e){const{challenge:t,crossOrigin:n=!1,extraClientData:r,origin:s=window.location.origin}=e;return JSON.stringify({type:"webauthn.get",challenge:V6(t,{url:!0,pad:!1}),origin:s,crossOrigin:n,...r})}function Z6(e){const{challenge:t,crossOrigin:n,extraClientData:r,flag:s,origin:i,rpId:a,signCount:o,userVerification:c="required"}=e,u=K6({flag:s,rpId:a,signCount:o}),l=J6({challenge:t,crossOrigin:n,extraClientData:r,origin:i}),d=xf(hf(l)),f=l.indexOf('"challenge"'),p=l.indexOf('"type"'),m={authenticatorData:u,clientDataJSON:l,challengeIndex:f,typeIndex:p,userVerificationRequired:c==="required"},h=xs(u,d);return{metadata:m,payload:h}}async function Y6(e={}){const{extractable:t=!1}=e,n=await globalThis.crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},t,["sign","verify"]),r=await globalThis.crypto.subtle.exportKey("raw",n.publicKey),s=C6(new Uint8Array(r));return{privateKey:n.privateKey,publicKey:s}}async function Q6(e){const{payload:t,privateKey:n}=e,r=await globalThis.crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},n,yf(t)),s=gf(new Uint8Array(r)),i=jc(Rc(s,0,32));let a=jc(Rc(s,32,64));return a>yo.CURVE.n/2n&&(a=yo.CURVE.n-a),{r:i,s:a}}function X6(e,t){const n=typeof indexedDB<"u"?Su(e,t):void 0;return{getItem:async r=>{const s=await c0(r,n);return s||null},removeItem:async r=>d0(r,n),setItem:async(r,s)=>u0(r,s,n)}}const ev="cbwsdk",tv="keys",ho="activeId",rn=X6(ev,tv);async function nv(){const e=await Y6({extractable:!1}),t=Te(fo(e.publicKey),1);return await rn.setItem(t,e),await rn.setItem(ho,t),e}async function rv(){const e=await rn.getItem(ho);if(!e)return null;const t=await rn.getItem(e);return t||null}async function sv(){const e=await rv();if(!e){const t=await nv(),n=Te(fo(t.publicKey),1);return await rn.setItem(n,t),await rn.setItem(ho,n),t}return e}async function iv(){const e=await sv(),t=Te(fo(e.publicKey),1),n=async r=>{const{payload:s,metadata:i}=Z6({challenge:r,origin:"https://keys.coinbase.com",userVerification:"preferred"}),a=await Q6({payload:s,privateKey:e.privateKey});return{signature:L6(a),raw:{},webauthn:i}};return{id:t,publicKey:t,async sign({hash:r}){return n(r)},async signMessage({message:r}){return n(ms(r))},async signTypedData(r){return n(ir(r))},type:"webAuthn"}}async function Kr(){return{account:await iv()}}const Uc={storageKey:"ownPrivateKey",keyType:"private"},Fc={storageKey:"ownPublicKey",keyType:"public"},zc={storageKey:"peerPublicKey",keyType:"public"};class av{constructor(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(t){this.sharedSecret=null,this.peerPublicKey=t,await this.storeKey(zc,t),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,$.keys.clear()}async generateKeyPair(){const t=await Ww();this.ownPrivateKey=t.privateKey,this.ownPublicKey=t.publicKey,await this.storeKey(Uc,t.privateKey),await this.storeKey(Fc,t.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Uc)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(Fc)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(zc)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Vw(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(t){const n=$.keys.get(t.storageKey);return n?uf(t.keyType,n):null}async storeKey(t,n){const r=await cf(t.keyType,n);$.keys.set(t.storageKey,r)}}function gn(e,t){if(!(typeof e!="object"||e===null))return t.split(/[.[\]]+/).filter(Boolean).reduce((n,r)=>{if(typeof n=="object"&&n!==null)return n[r]},e)}const kf="0x0ba5ed0c6aa8c49038f819e587e2633c4a9f428a",Af="0xf85210B21cC50302F477BA56686d2019dC9b67Ad",$e=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"owner",type:"bytes"}],name:"AlreadyOwner",type:"error"},{inputs:[],name:"Initialized",type:"error"},{inputs:[{name:"owner",type:"bytes"}],name:"InvalidEthereumAddressOwner",type:"error"},{inputs:[{name:"key",type:"uint256"}],name:"InvalidNonceKey",type:"error"},{inputs:[{name:"owner",type:"bytes"}],name:"InvalidOwnerBytesLength",type:"error"},{inputs:[],name:"LastOwner",type:"error"},{inputs:[{name:"index",type:"uint256"}],name:"NoOwnerAtIndex",type:"error"},{inputs:[{name:"ownersRemaining",type:"uint256"}],name:"NotLastOwner",type:"error"},{inputs:[{name:"selector",type:"bytes4"}],name:"SelectorNotAllowed",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"UnauthorizedCallContext",type:"error"},{inputs:[],name:"UpgradeFailed",type:"error"},{inputs:[{name:"index",type:"uint256"},{name:"expectedOwner",type:"bytes"},{name:"actualOwner",type:"bytes"}],name:"WrongOwnerAtIndex",type:"error"},{anonymous:!1,inputs:[{indexed:!0,name:"index",type:"uint256"},{indexed:!1,name:"owner",type:"bytes"}],name:"AddOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"index",type:"uint256"},{indexed:!1,name:"owner",type:"bytes"}],name:"RemoveOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"REPLAYABLE_NONCE_KEY",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"addOwnerAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"addOwnerPublicKey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"functionSelector",type:"bytes4"}],name:"canSkipChainIdValidation",outputs:[{name:"",type:"bool"}],stateMutability:"pure",type:"function"},{inputs:[],name:"domainSeparator",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"entryPoint",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"executeBatch",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"calls",type:"bytes[]"}],name:"executeWithoutChainIdValidation",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"getUserOpHashWithoutChainId",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{name:"$",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"owners",type:"bytes[]"}],name:"initialize",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"isOwnerAddress",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"bytes"}],name:"isOwnerBytes",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"isOwnerPublicKey",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"result",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextOwnerIndex",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"index",type:"uint256"}],name:"ownerAtIndex",outputs:[{name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"ownerCount",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{name:"index",type:"uint256"},{name:"owner",type:"bytes"}],name:"removeLastOwner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"index",type:"uint256"},{name:"owner",type:"bytes"}],name:"removeOwnerAtIndex",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"removedOwnersCount",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"hash",type:"bytes32"}],name:"replaySafeHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{name:"newImplementation",type:"address"},{name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"},{name:"userOpHash",type:"bytes32"},{name:"missingAccountFunds",type:"uint256"}],name:"validateUserOp",outputs:[{name:"validationData",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],Sf=[{inputs:[{name:"implementation_",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"OwnerRequired",type:"error"},{inputs:[{name:"owners",type:"bytes[]"},{name:"nonce",type:"uint256"}],name:"createAccount",outputs:[{name:"account",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{name:"owners",type:"bytes[]"},{name:"nonce",type:"uint256"}],name:"getAddress",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"initCodeHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"}];function Gc(e){var t;if(!Array.isArray(e.params))return null;switch(e.method){case"personal_sign":return e.params[1];case"eth_signTypedData_v4":return e.params[0];case"eth_signTransaction":case"eth_sendTransaction":case"wallet_sendCalls":return(t=e.params[0])===null||t===void 0?void 0:t.from;default:return null}}function ov(e,t){if(!Array.isArray(e.params))throw B.rpc.invalidParams();const n=[...e.params];switch(e.method){case"eth_signTransaction":case"eth_sendTransaction":case"wallet_sendCalls":n[0].from=t;break;case"eth_signTypedData_v4":n[0]=t;break;case"personal_sign":n[1]=t;break}return Object.assign(Object.assign({},e),{params:n})}function Hc(e){var t;if(!e||!Array.isArray(e)||!(!((t=e[0])===null||t===void 0)&&t.chainId)||typeof e[0].chainId!="string"&&typeof e[0].chainId!="number")throw B.rpc.invalidParams()}function cv(e){if(!e||!Array.isArray(e)||e.length!==1&&e.length!==2||typeof e[0]!="string"||!le(e[0]))throw B.rpc.invalidParams();if(e.length===2){if(!Array.isArray(e[1]))throw B.rpc.invalidParams();for(const t of e[1])if(typeof t!="string"||!t.startsWith("0x"))throw B.rpc.invalidParams()}}function Jr(e,t){const n=Object.assign({},e);if(t&&e.method.startsWith("wallet_")){let r=gn(n,"params.0.capabilities");if(typeof r>"u"&&(r={}),typeof r!="object")throw B.rpc.invalidParams();r=Object.assign(Object.assign({},t),r),n.params&&Array.isArray(n.params)&&(n.params[0]=Object.assign(Object.assign({},n.params[0]),{capabilities:r}))}return n}async function zs(){var e;const t=(e=$.subAccountsConfig.get())!==null&&e!==void 0?e:{},n={};if(t.enableAutoSubAccounts){const{account:r}=t.toOwnerAccount?await t.toOwnerAccount():await Kr();if(!r)throw B.provider.unauthorized("No owner account found");n.addSubAccount={account:{type:"create",keys:[{type:r.address?"address":"webauthn-p256",publicKey:r.address||r.publicKey}]}}}$.subAccountsConfig.set({capabilities:n})}function uv(e){if(!(e.method==="coinbase_fetchPermissions"&&e.params===void 0)){if(e.method==="coinbase_fetchPermissions"&&Array.isArray(e.params)&&e.params.length===1&&typeof e.params[0]=="object"){if(typeof e.params[0].account!="string"||!e.params[0].chainId.startsWith("0x"))throw B.rpc.invalidParams("FetchPermissions - Invalid params: params[0].account must be a hex string");if(typeof e.params[0].chainId!="string"||!e.params[0].chainId.startsWith("0x"))throw B.rpc.invalidParams("FetchPermissions - Invalid params: params[0].chainId must be a hex string");if(typeof e.params[0].spender!="string"||!e.params[0].spender.startsWith("0x"))throw B.rpc.invalidParams("FetchPermissions - Invalid params: params[0].spender must be a hex string");return}throw B.rpc.invalidParams()}}function dv(e){var t,n,r;if(e.params!==void 0)return e;const s=(t=$.getState().account.accounts)===null||t===void 0?void 0:t[0],i=(n=$.getState().account.chain)===null||n===void 0?void 0:n.id,a=(r=$.getState().subAccount)===null||r===void 0?void 0:r.address;if(!s||!a||!i)throw B.rpc.invalidParams("FetchPermissions - one or more of account, sub account, or chain id is missing, connect to sub account via wallet_connect first");return{method:"coinbase_fetchPermissions",params:[{account:s,chainId:O(i),spender:a}]}}function lv({spendPermission:e,chainId:t}){return{domain:{name:"Spend Permission Manager",version:"1",chainId:t,verifyingContract:Af},types:{SpendPermission:[{name:"account",type:"address"},{name:"spender",type:"address"},{name:"token",type:"address"},{name:"allowance",type:"uint160"},{name:"period",type:"uint48"},{name:"start",type:"uint48"},{name:"end",type:"uint48"},{name:"salt",type:"uint256"},{name:"extraData",type:"bytes"}]},primaryType:"SpendPermission",message:{account:e.account,spender:e.spender,token:e.token,allowance:e.allowance,period:e.period,start:e.start,end:e.end,salt:e.salt,extraData:e.extraData}}}function fv({spendPermissionBatch:e,chainId:t}){return{domain:{name:"Spend Permission Manager",version:"1",chainId:t,verifyingContract:Af},types:{SpendPermissionBatch:[{name:"account",type:"address"},{name:"period",type:"uint48"},{name:"start",type:"uint48"},{name:"end",type:"uint48"},{name:"permissions",type:"PermissionDetails[]"}],PermissionDetails:[{name:"spender",type:"address"},{name:"token",type:"address"},{name:"allowance",type:"uint160"},{name:"salt",type:"uint256"},{name:"extraData",type:"bytes"}]},primaryType:"SpendPermissionBatch",message:{account:e.account,period:e.period,start:e.start,end:e.end,permissions:e.permissions.map(n=>({spender:n.spender,token:n.token,allowance:n.allowance,salt:n.salt,extraData:n.extraData}))}}}async function If({client:e,id:t}){var n;const r=await Pl(e,{id:t});if(r.status==="success")return(n=r.receipts)===null||n===void 0?void 0:n[0].transactionHash;throw B.rpc.internal("failed to send transaction")}function Tf({calls:e,from:t,chainId:n,capabilities:r}){const s=Ou.get().paymasterUrls;let i={method:"wallet_sendCalls",params:[{version:"1.0",calls:e,chainId:O(n),from:t,atomicRequired:!0,capabilities:r}]};return s?.[n]&&(i=Jr(i,{paymasterService:{url:s?.[n]}})),i}async function pv(){const e=va();return await new Promise(n=>{wa({snackbarContext:"sub_account_insufficient_balance"}),e.presentItem({autoExpand:!0,message:"Insufficient spend permission. Choose how to proceed:",menuItems:[{isRed:!1,info:"Create new Spend Permission",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{qt({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"create_permission"}),e.clear(),n("update_permission")}},{isRed:!1,info:"Continue in Popup",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{qt({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"continue_in_popup"}),e.clear(),n("continue_popup")}},{isRed:!0,info:"Cancel",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{qt({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"cancel"}),e.clear(),n("cancel")}}]})})}function hv({errorData:e,sourceAddress:t}){var n;const r=[];for(const[s,{amount:i,sources:a}]of Object.entries((n=e?.required)!==null&&n!==void 0?n:{})){if(a.filter(c=>se(c.balance)>=se(i)&&c.address.toLowerCase()===t?.toLowerCase()).length===0)throw new Error("Source address has insufficient balance for a token");r.push({token:s,requiredAmount:se(i)})}return r}function mv(e){return typeof e=="object"&&e!==null&&"calls"in e}function bv(e){return Array.isArray(e)&&e.length===1&&typeof e[0]=="object"&&e[0]!==null&&"to"in e[0]}function yv(e){return Tt(K(ge(e)),0,16)}function gv({attribution:e,dappOrigin:t}){if(e){if("auto"in e&&e.auto&&t)return yv(t);if("dataSuffix"in e)return e.dataSuffix}}function wv(e,t){var n;if(!Array.isArray(e?.params))return!1;const r=(n=e.params[0])===null||n===void 0?void 0:n.capabilities;return!r||typeof r!="object"?!1:t in r}function br(e,t){const n=e.filter(r=>r!==t);return[t,...n]}function yr(e,t){return[...e.filter(r=>r!==t),t]}async function vv(){const e=$.spendPermissions.get(),t=$.subAccounts.get(),n=$.account.get().accounts;return n?{accounts:n?.map(s=>({address:s,capabilities:{subAccounts:t?[t]:void 0,spendPermissions:e.length>0?{permissions:e}:void 0}}))}:null}function xv(e){return e.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function gr(e){const t=btoa(String.fromCharCode(...new Uint8Array(e)));return xv(t)}function _v({webauthn:e,signature:t,id:n}){const r=Pf(t);return{id:n,rawId:gr(tt(n)),response:{authenticatorData:gr(be(e.authenticatorData)),clientDataJSON:gr(tt(e.clientDataJSON)),signature:gr(Ev(r.r,r.s))},type:JSON.parse(e.clientDataJSON).type}}function Ev(e,t){const n=be(Me(O(e))),r=be(Me(O(t))),s=n.length,i=r.length,a=s+i+4,o=new Uint8Array(a+2);return o[0]=48,o[1]=a,o[2]=2,o[3]=s,o.set(n,4),o[s+4]=2,o[s+5]=i,o.set(r,s+6),o}var Pv=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n};async function kv(e){const{owner:t,ownerIndex:n,address:r,client:s,factoryData:i}=e,a={abi:ww,address:vw,version:"0.6"},o={abi:Sf,address:kf};return Pw({client:s,entryPoint:a,extend:{abi:$e,factory:o},async decodeCalls(c){const u=Za({abi:$e,data:c});if(u.functionName==="execute")return[{to:u.args[0],value:u.args[1],data:u.args[2]}];if(u.functionName==="executeBatch")return u.args[0].map(l=>({to:l.target,value:l.value,data:l.data}));throw new P(`unable to decode calls for "${u.functionName}"`)},async encodeCalls(c){var u,l;return c.length===1?ie({abi:$e,functionName:"execute",args:[c[0].to,(u=c[0].value)!==null&&u!==void 0?u:BigInt(0),(l=c[0].data)!==null&&l!==void 0?l:"0x"]}):ie({abi:$e,functionName:"executeBatch",args:[c.map(d=>{var f,p;return{data:(f=d.data)!==null&&f!==void 0?f:"0x",target:d.to,value:(p=d.value)!==null&&p!==void 0?p:BigInt(0)}})]})},async getAddress(){return r},async getFactoryArgs(){return i?{factory:o.address,factoryData:i}:{factory:o.address,factoryData:i}},async getStubSignature(){return t.type==="webAuthn"?"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000":bn({ownerIndex:n,signature:"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"})},async sign(c){const u=await this.getAddress(),l=Gs({address:u,chainId:s.chain.id,hash:c.hash}),d=await wr({hash:l,owner:t});return bn({ownerIndex:n,signature:d})},async signMessage(c){const{message:u}=c,l=await this.getAddress(),d=Gs({address:l,chainId:s.chain.id,hash:ms(u)}),f=await wr({hash:d,owner:t});return bn({ownerIndex:n,signature:f})},async signTypedData(c){const{domain:u,types:l,primaryType:d,message:f}=c,p=await this.getAddress(),m=Gs({address:p,chainId:s.chain.id,hash:ir({domain:u,message:f,primaryType:d,types:l})}),h=await wr({hash:m,owner:t});return bn({ownerIndex:n,signature:h})},async signUserOperation(c){const{chainId:u=s.chain.id}=c,l=Pv(c,["chainId"]),d=await this.getAddress(),f=Ew({chainId:u,entryPointAddress:a.address,entryPointVersion:a.version,userOperation:Object.assign(Object.assign({},l),{sender:d})}),p=await wr({hash:f,owner:t});return bn({ownerIndex:n,signature:p})},userOperation:{async estimateGas(c){var u;if(t.type==="webAuthn")return{verificationGasLimit:BigInt(Math.max(Number((u=c.verificationGasLimit)!==null&&u!==void 0?u:BigInt(0)),8e5))}}}})}async function wr({hash:e,owner:t}){if(t.type==="webAuthn"){const{signature:n,webauthn:r}=await t.sign({hash:e});return Av({signature:n,webauthn:r})}if(t.sign)return t.sign({hash:e});throw new P("`owner` does not support raw sign.")}function Gs({address:e,chainId:t,hash:n}){return ir({domain:{chainId:t,name:"Coinbase Smart Wallet",verifyingContract:e,version:"1"},types:{CoinbaseSmartWalletMessage:[{name:"hash",type:"bytes32"}]},primaryType:"CoinbaseSmartWalletMessage",message:{hash:n}})}function Av({webauthn:e,signature:t}){const{r:n,s:r}=Pf(t);return ke([{components:[{name:"authenticatorData",type:"bytes"},{name:"clientDataJSON",type:"bytes"},{name:"challengeIndex",type:"uint256"},{name:"typeIndex",type:"uint256"},{name:"r",type:"uint256"},{name:"s",type:"uint256"}],type:"tuple"}],[{authenticatorData:e.authenticatorData,clientDataJSON:It(e.clientDataJSON),challengeIndex:BigInt(e.challengeIndex),typeIndex:BigInt(e.typeIndex),r:n,s:r}])}function bn(e){const{ownerIndex:t=0}=e,n=(()=>{if(Z(e.signature)!==65)return e.signature;const r=rw(e.signature);return tg(["bytes32","bytes32","uint8"],[r.r,r.s,r.yParity===0?27:28])})();return ke([{components:[{name:"ownerIndex",type:"uint8"},{name:"signatureData",type:"bytes"}],type:"tuple"}],[{ownerIndex:t,signatureData:n}])}async function Sv({address:e,client:t,factory:n,factoryData:r,owner:s,ownerIndex:i,parentAddress:a,attribution:o}){var c;const u={address:e,factory:n,factoryData:r},l=(c=t.chain)===null||c===void 0?void 0:c.id;if(!l)throw B.rpc.internal("chainId not found");const d=await kv({owner:s,ownerIndex:i??1,address:e,client:t,factoryData:r}),f=async p=>{var m,h,b,y,g,_;try{switch(p.method){case"wallet_addSubAccount":return u;case"eth_accounts":return[u.address];case"eth_coinbase":return u.address;case"net_version":return l.toString();case"eth_chainId":return O(l);case"eth_sendTransaction":{mt(p.params);const w=p.params[0];Pe(w.to,B.rpc.invalidParams("to is required"));const x={to:w.to,data:si((m=w.data)!==null&&m!==void 0?m:"0x",!0),value:si((h=w.value)!==null&&h!==void 0?h:"0x",!0),from:(b=w.from)!==null&&b!==void 0?b:u.address},k=Tf({calls:[x],chainId:l,from:x.from}),A=await f(k);return If({client:t,id:A})}case"wallet_sendCalls":{mt(p.params);const w=gn(p.params[0],"chainId");if(!w)throw B.rpc.invalidParams("chainId is required");if(!fe(w))throw B.rpc.invalidParams("chainId must be a hex encoded integer");if(!p.params[0])throw B.rpc.invalidParams("params are required");if(!("calls"in p.params[0]))throw B.rpc.invalidParams("calls are required");let x={method:"wallet_prepareCalls",params:[{version:"1.0",calls:p.params[0].calls,chainId:w,from:u.address,capabilities:"capabilities"in p.params[0]?p.params[0].capabilities:{}}]};a&&(x=Jr(x,{funding:[{type:"spendPermission",data:{autoApply:!0,sources:[a],preference:"PREFER_DIRECT_BALANCE"}}]}));let k=await f(x);const A=await((g=(y=s).sign)===null||g===void 0?void 0:g.call(y,{hash:Vo(k.signatureRequest.hash)}));let T;if(!A)throw B.rpc.internal("signature not found");return fe(A)?T={type:"secp256k1",data:{address:s.address,signature:A}}:T={type:"webauthn",data:{signature:JSON.stringify(_v(Object.assign({id:(_=s.id)!==null&&_!==void 0?_:"1"},A))),publicKey:s.publicKey}},(await f({method:"wallet_sendPreparedCalls",params:[{version:"1.0",type:k.type,data:k.userOp,chainId:k.chainId,signature:T}]}))[0]}case"wallet_sendPreparedCalls":{mt(p.params);const w=gn(p.params[0],"chainId");if(!w)throw B.rpc.invalidParams("chainId is required");if(!fe(w))throw B.rpc.invalidParams("chainId must be a hex encoded integer");return await t.request({method:"wallet_sendPreparedCalls",params:p.params})}case"wallet_prepareCalls":{mt(p.params);const w=gn(p.params[0],"chainId");if(!w)throw B.rpc.invalidParams("chainId is required");if(!fe(w))throw B.rpc.invalidParams("chainId must be a hex encoded integer");if(!p.params[0])throw B.rpc.invalidParams("params are required");if(!gn(p.params[0],"calls"))throw B.rpc.invalidParams("calls are required");const x=p.params[0];return o&&x.capabilities&&!("attribution"in x.capabilities)&&(x.capabilities.attribution=o),await t.request({method:"wallet_prepareCalls",params:[Object.assign(Object.assign({},p.params[0]),{chainId:w})]})}case"personal_sign":{if(mt(p.params),!fe(p.params[0]))throw B.rpc.invalidParams("message must be a hex encoded string");const w=Vo(p.params[0]);return d.signMessage({message:w})}case"eth_signTypedData_v4":{mt(p.params);const w=typeof p.params[1]=="string"?JSON.parse(p.params[1]):p.params[1];return d.signTypedData(w)}default:throw B.rpc.methodNotSupported()}}catch(w){if(Nu(w)){const x=M0(w);if(x)throw x}throw w}};return{request:f}}async function Of({address:e,client:t,publicKey:n,factory:r,factoryData:s}){if(!await Jn(t,{address:e})&&r&&s){if(Cr(r)!==Cr(kf))throw B.rpc.internal("unknown factory address");const o=Za({abi:Sf,data:s});if(o.functionName!=="createAccount")throw B.rpc.internal("unknown factory function");const[c]=o.args;return c.findIndex(u=>u.toLowerCase()===qc(n).toLowerCase())}const a=await we(t,{address:e,abi:$e,functionName:"ownerCount"});for(let o=Number(a)-1;o>=0;o--){const c=await we(t,{address:e,abi:$e,functionName:"ownerAtIndex",args:[BigInt(o)]}),u=qc(n);if(c.toLowerCase()===u.toLowerCase())return o}return-1}function qc(e){return le(e)?re(e):e}async function Iv(){const e=va();return new Promise(t=>{wa({snackbarContext:"sub_account_add_owner"}),e.presentItem({autoExpand:!0,message:"App requires a signer update",menuItems:[{isRed:!1,info:"Confirm",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{qt({snackbarContext:"sub_account_add_owner",snackbarAction:"confirm"}),e.clear(),t("authenticate")}},{isRed:!0,info:"Cancel",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{qt({snackbarContext:"sub_account_add_owner",snackbarAction:"cancel"}),e.clear(),t("cancel")}}]})})}async function Tv({ownerAccount:e,globalAccountRequest:t}){var n,r;const s=$.account.get(),i=$.subAccounts.get(),a=(n=s.accounts)===null||n===void 0?void 0:n.find(m=>m.toLowerCase()!==i?.address.toLowerCase());Pe(a,B.provider.unauthorized("no global account")),Pe((r=s.chain)===null||r===void 0?void 0:r.id,B.provider.unauthorized("no chain id")),Pe(i?.address,B.provider.unauthorized("no sub account"));const o=[];if(e.type==="local"&&e.address&&o.push({to:i.address,data:ie({abi:$e,functionName:"addOwnerAddress",args:[e.address]}),value:ge(0)}),e.publicKey){const[m,h]=Nt([{type:"bytes32"},{type:"bytes32"}],e.publicKey);o.push({to:i.address,data:ie({abi:$e,functionName:"addOwnerPublicKey",args:[m,h]}),value:ge(0)})}const c={method:"wallet_sendCalls",params:[{version:"1",calls:o,chainId:O(84532),from:a}]};if(await Iv()==="cancel")throw B.provider.unauthorized("user cancelled");const l=await t(c),d=af(s.chain.id);if(Pe(d,B.rpc.internal(`client not found for chainId ${s.chain.id}`)),(await Pl(d,{id:l})).status!=="success")throw B.rpc.internal("add owner call failed");const p=await Of({address:i.address,publicKey:e.type==="local"&&e.address?e.address:e.publicKey,client:d});if(p===-1)throw B.rpc.internal("failed to find owner index");return p}async function Ov({errorData:e,globalAccountAddress:t,subAccountAddress:n,client:r,request:s,subAccountRequest:i,globalAccountRequest:a}){var o;const c=(o=r.chain)===null||o===void 0?void 0:o.id;Pe(c,B.rpc.internal("invalid chainId"));const u=hv({errorData:e,sourceAddress:t}),l=await pv();if(l==="cancel")throw new Error("User cancelled funding");let d;const f=3600*24,p=3;if(l==="update_permission"){if(u.length===1){const _=u[0],w=lv({spendPermission:{token:_.token,allowance:O(_.requiredAmount*BigInt(p)),period:f,account:t,spender:n,start:0,end:0xffffffffffff,salt:O(BigInt(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),extraData:"0x"},chainId:c});d={method:"eth_signTypedData_v4",params:[t,w]}}else{const _=fv({spendPermissionBatch:{account:t,period:f,start:0,end:0xffffffffffff,permissions:u.map(w=>({token:w.token,allowance:O(w.requiredAmount*BigInt(p)),period:f,account:t,spender:n,salt:"0x0",extraData:"0x"}))},chainId:c});d={method:"eth_signTypedData_v4",params:[t,_]}}try{await a(d)}catch(_){throw console.error(_),new Error("User denied spend permission request")}return i(s)}const m=u.map(_=>_.token.toLowerCase()==="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE".toLowerCase()?{to:n,value:O(_.requiredAmount),data:"0x"}:{to:_.token,value:"0x0",data:ie({abi:ny,functionName:"transfer",args:[n,_.requiredAmount]})});let h;if(s.method==="wallet_sendCalls"&&mv(s.params))h=s.params[0];else if(s.method==="eth_sendTransaction"&&bv(s.params))h=Tf({calls:[s.params[0]],chainId:c,from:s.params[0].from}).params[0];else throw new Error("Could not get original call");const b=ie({abi:$e,functionName:"executeBatch",args:[h.calls.map(_=>{var w,x;return{target:_.to,value:se((w=_.value)!==null&&w!==void 0?w:"0x0"),data:(x=_.data)!==null&&x!==void 0?x:"0x"}})]}),y=[...m,{data:b,to:n,value:"0x0"}],g=await a({method:"wallet_sendCalls",params:[Object.assign(Object.assign({},h),{calls:y,from:t})]});return s.method==="eth_sendTransaction"?If({client:r,id:g}):g}class Cf{constructor(t){var n,r,s,i;this.communicator=t.communicator,this.callback=t.callback,this.keyManager=new av;const{account:a,chains:o}=$.getState();this.accounts=(n=a.accounts)!==null&&n!==void 0?n:[],this.chain=(r=a.chain)!==null&&r!==void 0?r:{id:(i=(s=t.metadata.appChainIds)===null||s===void 0?void 0:s[0])!==null&&i!==void 0?i:1},o&&Cc(o)}async handshake(t){var n,r,s;const i=Ce.get(t);sw({method:t.method,correlationId:i});try{await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n));const a=await this.createRequestMessage({handshake:{method:t.method,params:(s=t.params)!==null&&s!==void 0?s:[]}},i),o=await this.communicator.postRequestAndWaitForResponse(a);if("failure"in o.content)throw o.content.failure;const c=await uf("public",o.sender);await this.keyManager.setPeerPublicKey(c);const u=await this.decryptResponseMessage(o);this.handleResponse(t,u),aw({method:t.method,correlationId:i})}catch(a){throw iw({method:t.method,correlationId:i,errorMessage:Pt(a)}),a}}async request(t){const n=Ce.get(t);ow({method:t.method,correlationId:n});try{const r=await this._request(t);return uw({method:t.method,correlationId:n}),r}catch(r){throw cw({method:t.method,correlationId:n,errorMessage:Pt(r)}),r}}async _request(t){var n,r,s,i,a,o,c,u,l,d,f,p,m,h;if(this.accounts.length===0)switch(t.method){case"eth_requestAccounts":return await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n)),await zs(),await this.request({method:"wallet_connect",params:[{version:"1",capabilities:Object.assign({},(i=(s=$.subAccountsConfig.get())===null||s===void 0?void 0:s.capabilities)!==null&&i!==void 0?i:{})}]}),this.accounts;case"wallet_switchEthereumChain":{Hc(t.params),this.chain.id=Number(t.params[0].chainId);return}case"wallet_connect":{await((o=(a=this.communicator).waitForPopupLoaded)===null||o===void 0?void 0:o.call(a)),await zs();let b={};wv(t,"addSubAccount")&&(b=(u=(c=$.subAccountsConfig.get())===null||c===void 0?void 0:c.capabilities)!==null&&u!==void 0?u:{});const y=Jr(t,b);return this.sendRequestToPopup(y)}case"wallet_sendCalls":case"wallet_sign":return this.sendRequestToPopup(t);default:throw B.provider.unauthorized()}if(this.shouldRequestUseSubAccountSigner(t)){const b=Ce.get(t);dw({method:t.method,correlationId:b});try{const y=await this.sendRequestToSubAccountSigner(t);return lw({method:t.method,correlationId:b}),y}catch(y){throw fw({method:t.method,correlationId:b,errorMessage:Pt(y)}),y}}switch(t.method){case"eth_requestAccounts":case"eth_accounts":{const b=$.subAccounts.get(),y=$.subAccountsConfig.get();return b?.address&&(this.accounts=y?.enableAutoSubAccounts?br(this.accounts,b.address):yr(this.accounts,b.address)),(l=this.callback)===null||l===void 0||l.call(this,"connect",{chainId:O(this.chain.id)}),this.accounts}case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return O(this.chain.id);case"wallet_getCapabilities":return this.handleGetCapabilitiesRequest(t);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(t);case"eth_ecRecover":case"personal_sign":case"wallet_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(t);case"wallet_connect":{const b=await vv();if(b)return b;await((f=(d=this.communicator).waitForPopupLoaded)===null||f===void 0?void 0:f.call(d)),await zs();const y=$.subAccountsConfig.get(),g=Jr(t,(p=y?.capabilities)!==null&&p!==void 0?p:{});return(m=this.callback)===null||m===void 0||m.call(this,"connect",{chainId:O(this.chain.id)}),this.sendRequestToPopup(g)}case"wallet_getSubAccounts":{const b=$.subAccounts.get();if(b?.address)return{subAccounts:[b]};if(!this.chain.rpcUrl)throw B.rpc.internal("No RPC URL set for chain");const y=await xn(t,this.chain.rpcUrl);if(mt(y.subAccounts,"subAccounts"),y.subAccounts.length>0){pr(y.subAccounts[0]);const g=y.subAccounts[0];$.subAccounts.set({address:g.address,factory:g.factory,factoryData:g.factoryData})}return y}case"wallet_addSubAccount":return this.addSubAccount(t);case"coinbase_fetchPermissions":{uv(t);const b=dv(t),y=await xn(b,Fu),g=ye((h=b.params)===null||h===void 0?void 0:h[0].chainId);return $.spendPermissions.set(y.permissions.map(_=>Object.assign(Object.assign({},_),{chainId:g}))),y}default:if(!this.chain.rpcUrl)throw B.rpc.internal("No RPC URL set for chain");return xn(t,this.chain.rpcUrl)}}async sendRequestToPopup(t){var n,r;await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n));const s=await this.sendEncryptedRequest(t),i=await this.decryptResponseMessage(s);return this.handleResponse(t,i)}async handleResponse(t,n){var r,s,i,a,o;const c=n.result;if("error"in c)throw c.error;switch(t.method){case"eth_requestAccounts":{const u=c.value;this.accounts=u,$.account.set({accounts:u,chain:this.chain}),(r=this.callback)===null||r===void 0||r.call(this,"accountsChanged",u);break}case"wallet_connect":{const u=c.value,l=u.accounts.map(y=>y.address);this.accounts=l,$.account.set({accounts:l});const d=u.accounts.at(0),f=d?.capabilities;if(f?.subAccounts){const y=f?.subAccounts;mt(y,"subAccounts"),pr(y[0]),$.subAccounts.set({address:y[0].address,factory:y[0].factory,factoryData:y[0].factoryData})}let p=[this.accounts[0]];const m=$.subAccounts.get(),h=$.subAccountsConfig.get();m?.address&&(this.accounts=h?.enableAutoSubAccounts?br(this.accounts,m.address):yr(this.accounts,m.address));const b=(i=(s=u?.accounts)===null||s===void 0?void 0:s[0].capabilities)===null||i===void 0?void 0:i.spendPermissions;b&&"permissions"in b&&$.spendPermissions.set(b?.permissions),(a=this.callback)===null||a===void 0||a.call(this,"accountsChanged",p);break}case"wallet_addSubAccount":{pr(c.value);const u=c.value;$.subAccounts.set(u);const l=$.subAccountsConfig.get();this.accounts=l?.enableAutoSubAccounts?br(this.accounts,u.address):yr(this.accounts,u.address),(o=this.callback)===null||o===void 0||o.call(this,"accountsChanged",this.accounts);break}}return c.value}async cleanup(){var t,n;const r=$.config.get().metadata;await this.keyManager.clear(),$.account.clear(),$.subAccounts.clear(),$.spendPermissions.clear(),$.chains.clear(),this.accounts=[],this.chain={id:(n=(t=r?.appChainIds)===null||t===void 0?void 0:t[0])!==null&&n!==void 0?n:1}}async handleSwitchChainRequest(t){Hc(t.params);const n=vn(t.params[0].chainId);if(this.updateChain(n))return null;const s=await this.sendRequestToPopup(t);return s===null&&this.updateChain(n),s}async handleGetCapabilitiesRequest(t){cv(t.params);const n=t.params[0],r=t.params[1];if(!this.accounts.some(o=>ln(o,n)))throw B.provider.unauthorized("no active account found when getting capabilities");const s=$.getState().account.capabilities;if(!s)return{};if(!r||r.length===0)return s;const i=new Set(r.map(o=>ye(o)));return Object.fromEntries(Object.entries(s).filter(([o])=>{try{const c=ye(o);return i.has(c)}catch{return!1}}))}async sendEncryptedRequest(t){const n=await this.keyManager.getSharedSecret();if(!n)throw B.provider.unauthorized("No shared secret found when encrypting request");const r=await Zw({action:t,chainId:this.chain.id},n),s=Ce.get(t),i=await this.createRequestMessage({encrypted:r},s);return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(t,n){const r=await cf("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),correlationId:n,sender:r,content:t,timestamp:new Date}}async decryptResponseMessage(t){var n,r,s;const i=t.content;if("failure"in i)throw i.failure;const a=await this.keyManager.getSharedSecret();if(!a)throw B.provider.unauthorized("Invalid session: no shared secret found when decrypting response");const o=await Yw(i.encrypted,a),c=(n=o.data)===null||n===void 0?void 0:n.chains;if(c){const l=(r=o.data)===null||r===void 0?void 0:r.nativeCurrencies,d=Object.entries(c).map(([f,p])=>{const m=l?.[Number(f)];return Object.assign({id:Number(f),rpcUrl:p},m?{nativeCurrency:m}:{})});$.chains.set(d),this.updateChain(this.chain.id,d),Cc(d)}const u=(s=o.data)===null||s===void 0?void 0:s.capabilities;return u&&$.account.set({capabilities:u}),o}updateChain(t,n){var r;const s=$.getState(),i=n??s.chains,a=i?.find(o=>o.id===t);return a?(a!==this.chain&&(this.chain=a,$.account.set({chain:a}),(r=this.callback)===null||r===void 0||r.call(this,"chainChanged",Ft(a.id))),!0):!1}async addSubAccount(t){var n,r,s,i;const o=$.getState().subAccount,c=$.subAccountsConfig.get();if(o?.address)return this.accounts=c?.enableAutoSubAccounts?br(this.accounts,o.address):yr(this.accounts,o.address),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",this.accounts),o;if(await((s=(r=this.communicator).waitForPopupLoaded)===null||s===void 0?void 0:s.call(r)),Array.isArray(t.params)&&t.params.length>0&&t.params[0].account&&t.params[0].account.type==="create"){let l;if(t.params[0].account.keys&&t.params[0].account.keys.length>0)l=t.params[0].account.keys;else{const d=(i=$.subAccountsConfig.get())!==null&&i!==void 0?i:{},{account:f}=d.toOwnerAccount?await d.toOwnerAccount():await Kr();if(!f)throw B.provider.unauthorized("could not get subaccount owner account when adding sub account");l=[{type:f.address?"address":"webauthn-p256",publicKey:f.address||f.publicKey}]}t.params[0].account.keys=l}const u=await this.sendRequestToPopup(t);return pr(u),u}shouldRequestUseSubAccountSigner(t){const n=Gc(t),r=$.subAccounts.get();return n?n.toLowerCase()===r?.address.toLowerCase():!1}async sendRequestToSubAccountSigner(t){var n;const r=$.subAccounts.get(),s=$.subAccountsConfig.get(),i=$.config.get();Pe(r?.address,B.provider.unauthorized("no active sub account when sending request to sub account signer"));const a=s?.toOwnerAccount?await s.toOwnerAccount():await Kr();Pe(a?.account,B.provider.unauthorized("no active sub account owner when sending request to sub account signer")),Gc(t)===void 0&&(t=ov(t,r.address));const c=af(this.chain.id);Pe(c,B.rpc.internal(`client not found for chainId ${this.chain.id} when sending request to sub account signer`));const u=this.accounts.find(m=>m.toLowerCase()!==r.address.toLowerCase());Pe(u,B.provider.unauthorized("no global account found when sending request to sub account signer"));const l=gv({attribution:(n=i.preference)===null||n===void 0?void 0:n.attribution,dappOrigin:window.location.origin}),d=a.account.type==="local"?a.account.address:a.account.publicKey;let f=await Of({address:r.address,factory:r.factory,factoryData:r.factoryData,publicKey:d,client:c});if(f===-1){const m=Ce.get(t);pw({method:t.method,correlationId:m});try{f=await Tv({ownerAccount:a.account,globalAccountRequest:this.sendRequestToPopup.bind(this)}),hw({method:t.method,correlationId:m})}catch(h){return mw({method:t.method,correlationId:m,errorMessage:Pt(h)}),B.provider.unauthorized("failed to add sub account owner when sending request to sub account signer")}}const{request:p}=await Sv({address:r.address,owner:a.account,client:c,factory:r.factory,factoryData:r.factoryData,parentAddress:u,attribution:l?{suffix:l}:void 0,ownerIndex:f});try{return await p(t)}catch(m){let h;if(Nu(m))h=JSON.parse(m.details);else if(Mo(m))h=m;else throw m;if(!(Mo(h)&&h.data)||!h.data)throw m;const b=Ce.get(t);bw({method:t.method,correlationId:b});try{const y=await Ov({errorData:h.data,globalAccountAddress:u,subAccountAddress:r.address,client:c,request:t,subAccountRequest:p,globalAccountRequest:this.request.bind(this)});return yw({method:t.method,correlationId:b}),y}catch(y){throw console.error(y),gw({method:t.method,correlationId:b,errorMessage:Pt(y)}),m}}}}const Cv=({method:e,correlationId:t})=>{G("walletlink_signer.handshake.started",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t},z.high)},Bv=({method:e,correlationId:t,errorMessage:n})=>{G("walletlink_signer.handshake.error",{action:F.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n},z.high)},$v=({method:e,correlationId:t})=>{G("walletlink_signer.handshake.completed",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t},z.high)},Mv=({method:e,correlationId:t})=>{G("walletlink_signer.request.started",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t},z.high)},Nv=({method:e,correlationId:t,errorMessage:n})=>{G("walletlink_signer.request.error",{action:F.error,componentType:U.unknown,method:e,correlationId:t,errorMessage:n},z.high)},Rv=({method:e,correlationId:t})=>{G("walletlink_signer.request.completed",{action:F.unknown,componentType:U.unknown,method:e,correlationId:t},z.high)},Wc=()=>{G("walletlink_signer.walletlink_connection.connection_failed",{action:F.measurement,componentType:U.unknown},z.high)},jv=()=>{G("walletlink_signer.walletlink_connection.fetch_unseen_events_failed",{action:F.measurement,componentType:U.unknown},z.high)};var V={},ce={},Vc;function Bf(){if(Vc)return ce;Vc=1,Object.defineProperty(ce,"__esModule",{value:!0}),ce.output=ce.exists=ce.hash=ce.bytes=ce.bool=ce.number=ce.isBytes=void 0;function e(c){if(!Number.isSafeInteger(c)||c<0)throw new Error(`positive integer expected, not ${c}`)}ce.number=e;function t(c){if(typeof c!="boolean")throw new Error(`boolean expected, not ${c}`)}ce.bool=t;function n(c){return c instanceof Uint8Array||c!=null&&typeof c=="object"&&c.constructor.name==="Uint8Array"}ce.isBytes=n;function r(c,...u){if(!n(c))throw new Error("Uint8Array expected");if(u.length>0&&!u.includes(c.length))throw new Error(`Uint8Array expected of length ${u}, not of length=${c.length}`)}ce.bytes=r;function s(c){if(typeof c!="function"||typeof c.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");e(c.outputLen),e(c.blockLen)}ce.hash=s;function i(c,u=!0){if(c.destroyed)throw new Error("Hash instance has been destroyed");if(u&&c.finished)throw new Error("Hash#digest() has already been called")}ce.exists=i;function a(c,u){r(c);const l=u.outputLen;if(c.length<l)throw new Error(`digestInto() expects output buffer of length at least ${l}`)}ce.output=a;const o={number:e,bool:t,bytes:r,hash:s,exists:i,output:a};return ce.default=o,ce}var j={},Kc;function Lv(){if(Kc)return j;Kc=1,Object.defineProperty(j,"__esModule",{value:!0}),j.add5L=j.add5H=j.add4H=j.add4L=j.add3H=j.add3L=j.add=j.rotlBL=j.rotlBH=j.rotlSL=j.rotlSH=j.rotr32L=j.rotr32H=j.rotrBL=j.rotrBH=j.rotrSL=j.rotrSH=j.shrSL=j.shrSH=j.toBig=j.split=j.fromBig=void 0;const e=BigInt(2**32-1),t=BigInt(32);function n(S,v=!1){return v?{h:Number(S&e),l:Number(S>>t&e)}:{h:Number(S>>t&e)|0,l:Number(S&e)|0}}j.fromBig=n;function r(S,v=!1){let I=new Uint32Array(S.length),E=new Uint32Array(S.length);for(let C=0;C<S.length;C++){const{h:N,l:L}=n(S[C],v);[I[C],E[C]]=[N,L]}return[I,E]}j.split=r;const s=(S,v)=>BigInt(S>>>0)<<t|BigInt(v>>>0);j.toBig=s;const i=(S,v,I)=>S>>>I;j.shrSH=i;const a=(S,v,I)=>S<<32-I|v>>>I;j.shrSL=a;const o=(S,v,I)=>S>>>I|v<<32-I;j.rotrSH=o;const c=(S,v,I)=>S<<32-I|v>>>I;j.rotrSL=c;const u=(S,v,I)=>S<<64-I|v>>>I-32;j.rotrBH=u;const l=(S,v,I)=>S>>>I-32|v<<64-I;j.rotrBL=l;const d=(S,v)=>v;j.rotr32H=d;const f=(S,v)=>S;j.rotr32L=f;const p=(S,v,I)=>S<<I|v>>>32-I;j.rotlSH=p;const m=(S,v,I)=>v<<I|S>>>32-I;j.rotlSL=m;const h=(S,v,I)=>v<<I-32|S>>>64-I;j.rotlBH=h;const b=(S,v,I)=>S<<I-32|v>>>64-I;j.rotlBL=b;function y(S,v,I,E){const C=(v>>>0)+(E>>>0);return{h:S+I+(C/2**32|0)|0,l:C|0}}j.add=y;const g=(S,v,I)=>(S>>>0)+(v>>>0)+(I>>>0);j.add3L=g;const _=(S,v,I,E)=>v+I+E+(S/2**32|0)|0;j.add3H=_;const w=(S,v,I,E)=>(S>>>0)+(v>>>0)+(I>>>0)+(E>>>0);j.add4L=w;const x=(S,v,I,E,C)=>v+I+E+C+(S/2**32|0)|0;j.add4H=x;const k=(S,v,I,E,C)=>(S>>>0)+(v>>>0)+(I>>>0)+(E>>>0)+(C>>>0);j.add5L=k;const A=(S,v,I,E,C,N)=>v+I+E+C+N+(S/2**32|0)|0;j.add5H=A;const T={fromBig:n,split:r,toBig:s,shrSH:i,shrSL:a,rotrSH:o,rotrSL:c,rotrBH:u,rotrBL:l,rotr32H:d,rotr32L:f,rotlSH:p,rotlSL:m,rotlBH:h,rotlBL:b,add:y,add3L:g,add3H:_,add4L:w,add4H:x,add5H:A,add5L:k};return j.default=T,j}var Hs={},yn={},Jc;function Dv(){return Jc||(Jc=1,Object.defineProperty(yn,"__esModule",{value:!0}),yn.crypto=void 0,yn.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),yn}var Zc;function Uv(){return Zc||(Zc=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const t=Dv(),n=Bf();function r(E){return E instanceof Uint8Array||E!=null&&typeof E=="object"&&E.constructor.name==="Uint8Array"}e.isBytes=r;const s=E=>new Uint8Array(E.buffer,E.byteOffset,E.byteLength);e.u8=s;const i=E=>new Uint32Array(E.buffer,E.byteOffset,Math.floor(E.byteLength/4));e.u32=i;const a=E=>new DataView(E.buffer,E.byteOffset,E.byteLength);e.createView=a;const o=(E,C)=>E<<32-C|E>>>C;e.rotr=o;const c=(E,C)=>E<<C|E>>>32-C>>>0;e.rotl=c,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const u=E=>E<<24&4278190080|E<<8&16711680|E>>>8&65280|E>>>24&255;e.byteSwap=u,e.byteSwapIfBE=e.isLE?E=>E:E=>(0,e.byteSwap)(E);function l(E){for(let C=0;C<E.length;C++)E[C]=(0,e.byteSwap)(E[C])}e.byteSwap32=l;const d=Array.from({length:256},(E,C)=>C.toString(16).padStart(2,"0"));function f(E){(0,n.bytes)(E);let C="";for(let N=0;N<E.length;N++)C+=d[E[N]];return C}e.bytesToHex=f;const p={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function m(E){if(E>=p._0&&E<=p._9)return E-p._0;if(E>=p._A&&E<=p._F)return E-(p._A-10);if(E>=p._a&&E<=p._f)return E-(p._a-10)}function h(E){if(typeof E!="string")throw new Error("hex string expected, got "+typeof E);const C=E.length,N=C/2;if(C%2)throw new Error("padded hex string expected, got unpadded hex of length "+C);const L=new Uint8Array(N);for(let H=0,W=0;H<N;H++,W+=2){const R=m(E.charCodeAt(W)),Q=m(E.charCodeAt(W+1));if(R===void 0||Q===void 0){const Ke=E[W]+E[W+1];throw new Error('hex string expected, got non-hex character "'+Ke+'" at index '+W)}L[H]=R*16+Q}return L}e.hexToBytes=h;const b=async()=>{};e.nextTick=b;async function y(E,C,N){let L=Date.now();for(let H=0;H<E;H++){N(H);const W=Date.now()-L;W>=0&&W<C||(await(0,e.nextTick)(),L+=W)}}e.asyncLoop=y;function g(E){if(typeof E!="string")throw new Error(`utf8ToBytes expected string, got ${typeof E}`);return new Uint8Array(new TextEncoder().encode(E))}e.utf8ToBytes=g;function _(E){return typeof E=="string"&&(E=g(E)),(0,n.bytes)(E),E}e.toBytes=_;function w(...E){let C=0;for(let L=0;L<E.length;L++){const H=E[L];(0,n.bytes)(H),C+=H.length}const N=new Uint8Array(C);for(let L=0,H=0;L<E.length;L++){const W=E[L];N.set(W,H),H+=W.length}return N}e.concatBytes=w;class x{clone(){return this._cloneInto()}}e.Hash=x;const k={}.toString;function A(E,C){if(C!==void 0&&k.call(C)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(E,C)}e.checkOpts=A;function T(E){const C=L=>E().update(_(L)).digest(),N=E();return C.outputLen=N.outputLen,C.blockLen=N.blockLen,C.create=()=>E(),C}e.wrapConstructor=T;function S(E){const C=(L,H)=>E(H).update(_(L)).digest(),N=E({});return C.outputLen=N.outputLen,C.blockLen=N.blockLen,C.create=L=>E(L),C}e.wrapConstructorWithOpts=S;function v(E){const C=(L,H)=>E(H).update(_(L)).digest(),N=E({});return C.outputLen=N.outputLen,C.blockLen=N.blockLen,C.create=L=>E(L),C}e.wrapXOFConstructorWithOpts=v;function I(E=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(E));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=I})(Hs)),Hs}var Yc;function Fv(){if(Yc)return V;Yc=1,Object.defineProperty(V,"__esModule",{value:!0}),V.shake256=V.shake128=V.keccak_512=V.keccak_384=V.keccak_256=V.keccak_224=V.sha3_512=V.sha3_384=V.sha3_256=V.sha3_224=V.Keccak=V.keccakP=void 0;const e=Bf(),t=Lv(),n=Uv(),r=[],s=[],i=[],a=BigInt(0),o=BigInt(1),c=BigInt(2),u=BigInt(7),l=BigInt(256),d=BigInt(113);for(let w=0,x=o,k=1,A=0;w<24;w++){[k,A]=[A,(2*k+3*A)%5],r.push(2*(5*A+k)),s.push((w+1)*(w+2)/2%64);let T=a;for(let S=0;S<7;S++)x=(x<<o^(x>>u)*d)%l,x&c&&(T^=o<<(o<<BigInt(S))-o);i.push(T)}const[f,p]=(0,t.split)(i,!0),m=(w,x,k)=>k>32?(0,t.rotlBH)(w,x,k):(0,t.rotlSH)(w,x,k),h=(w,x,k)=>k>32?(0,t.rotlBL)(w,x,k):(0,t.rotlSL)(w,x,k);function b(w,x=24){const k=new Uint32Array(10);for(let A=24-x;A<24;A++){for(let v=0;v<10;v++)k[v]=w[v]^w[v+10]^w[v+20]^w[v+30]^w[v+40];for(let v=0;v<10;v+=2){const I=(v+8)%10,E=(v+2)%10,C=k[E],N=k[E+1],L=m(C,N,1)^k[I],H=h(C,N,1)^k[I+1];for(let W=0;W<50;W+=10)w[v+W]^=L,w[v+W+1]^=H}let T=w[2],S=w[3];for(let v=0;v<24;v++){const I=s[v],E=m(T,S,I),C=h(T,S,I),N=r[v];T=w[N],S=w[N+1],w[N]=E,w[N+1]=C}for(let v=0;v<50;v+=10){for(let I=0;I<10;I++)k[I]=w[v+I];for(let I=0;I<10;I++)w[v+I]^=~k[(I+2)%10]&k[(I+4)%10]}w[0]^=f[A],w[1]^=p[A]}k.fill(0)}V.keccakP=b;class y extends n.Hash{constructor(x,k,A,T=!1,S=24){if(super(),this.blockLen=x,this.suffix=k,this.outputLen=A,this.enableXOF=T,this.rounds=S,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,e.number)(A),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,n.u32)(this.state)}keccak(){n.isLE||(0,n.byteSwap32)(this.state32),b(this.state32,this.rounds),n.isLE||(0,n.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(x){(0,e.exists)(this);const{blockLen:k,state:A}=this;x=(0,n.toBytes)(x);const T=x.length;for(let S=0;S<T;){const v=Math.min(k-this.pos,T-S);for(let I=0;I<v;I++)A[this.pos++]^=x[S++];this.pos===k&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:x,suffix:k,pos:A,blockLen:T}=this;x[A]^=k,(k&128)!==0&&A===T-1&&this.keccak(),x[T-1]^=128,this.keccak()}writeInto(x){(0,e.exists)(this,!1),(0,e.bytes)(x),this.finish();const k=this.state,{blockLen:A}=this;for(let T=0,S=x.length;T<S;){this.posOut>=A&&this.keccak();const v=Math.min(A-this.posOut,S-T);x.set(k.subarray(this.posOut,this.posOut+v),T),this.posOut+=v,T+=v}return x}xofInto(x){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(x)}xof(x){return(0,e.number)(x),this.xofInto(new Uint8Array(x))}digestInto(x){if((0,e.output)(x,this),this.finished)throw new Error("digest() was already called");return this.writeInto(x),this.destroy(),x}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(x){const{blockLen:k,suffix:A,outputLen:T,rounds:S,enableXOF:v}=this;return x||(x=new y(k,A,T,v,S)),x.state32.set(this.state32),x.pos=this.pos,x.posOut=this.posOut,x.finished=this.finished,x.rounds=S,x.suffix=A,x.outputLen=T,x.enableXOF=v,x.destroyed=this.destroyed,x}}V.Keccak=y;const g=(w,x,k)=>(0,n.wrapConstructor)(()=>new y(x,w,k));V.sha3_224=g(6,144,224/8),V.sha3_256=g(6,136,256/8),V.sha3_384=g(6,104,384/8),V.sha3_512=g(6,72,512/8),V.keccak_224=g(1,144,224/8),V.keccak_256=g(1,136,256/8),V.keccak_384=g(1,104,384/8),V.keccak_512=g(1,72,512/8);const _=(w,x,k)=>(0,n.wrapXOFConstructorWithOpts)((A={})=>new y(x,w,A.dkLen===void 0?k:A.dkLen,!0));return V.shake128=_(31,168,128/8),V.shake256=_(31,136,256/8),V}var qs,Qc;function $f(){if(Qc)return qs;Qc=1;const{keccak_256:e}=Fv();function t(h){return Buffer.allocUnsafe(h).fill(0)}function n(h){return`0x${h.toString(16)}`}function r(h){const b=n(h);return new Buffer(f(b.slice(2)),"hex")}function s(h){return h.toString(2).length}function i(h,b){let y=h.toString(16);y.length%2!==0&&(y="0"+y);const g=y.match(/.{1,2}/g).map(_=>parseInt(_,16));for(;g.length<b;)g.unshift(0);return Buffer.from(g)}function a(h,b){const y=h<0n;let g;if(y){const _=(1n<<BigInt(b))-1n;g=(~h&_)+1n}else g=h;return g&=(1n<<BigInt(b))-1n,g}function o(h,b,y){const g=t(b);return h=u(h),y?h.length<b?(h.copy(g),g):h.slice(0,b):h.length<b?(h.copy(g,b-h.length),g):h.slice(-b)}function c(h,b){return o(h,b,!0)}function u(h){if(!Buffer.isBuffer(h))if(Array.isArray(h))h=Buffer.from(h);else if(typeof h=="string")p(h)?h=Buffer.from(f(m(h)),"hex"):h=Buffer.from(h);else if(typeof h=="number")h=r(h);else if(h==null)h=Buffer.allocUnsafe(0);else if(typeof h=="bigint")h=i(h);else if(h.toArray)h=Buffer.from(h.toArray());else throw new Error("invalid type");return h}function l(h){return h=u(h),"0x"+h.toString("hex")}function d(h,b){if(h=u(h),b||(b=256),b!==256)throw new Error("unsupported");return Buffer.from(e(new Uint8Array(h)))}function f(h){return h.length%2?"0"+h:h}function p(h){return typeof h=="string"&&h.match(/^0x[0-9A-Fa-f]*$/)}function m(h){return typeof h=="string"&&h.startsWith("0x")?h.slice(2):h}return qs={zeros:t,setLength:o,setLengthRight:c,isHexString:p,stripHexPrefix:m,toBuffer:u,bufferToHex:l,keccak:d,bitLengthFromBigInt:s,bufferBEFromBigInt:i,twosFromBigInt:a},qs}var Ws,Xc;function zv(){if(Xc)return Ws;Xc=1;const e=$f();function t(f){return f.startsWith("int[")?"int256"+f.slice(3):f==="int"?"int256":f.startsWith("uint[")?"uint256"+f.slice(4):f==="uint"?"uint256":f.startsWith("fixed[")?"fixed128x128"+f.slice(5):f==="fixed"?"fixed128x128":f.startsWith("ufixed[")?"ufixed128x128"+f.slice(6):f==="ufixed"?"ufixed128x128":f}function n(f){return Number.parseInt(/^\D+(\d+)$/.exec(f)[1],10)}function r(f){var p=/^\D+(\d+)x(\d+)$/.exec(f);return[Number.parseInt(p[1],10),Number.parseInt(p[2],10)]}function s(f){var p=f.match(/(.*)\[(.*?)\]$/);return p?p[2]===""?"dynamic":Number.parseInt(p[2],10):null}function i(f){var p=typeof f;if(p==="string"||p==="number")return BigInt(f);if(p==="bigint")return f;throw new Error("Argument is not a number")}function a(f,p){var m,h,b,y;if(f==="address")return a("uint160",i(p));if(f==="bool")return a("uint8",p?1:0);if(f==="string")return a("bytes",new Buffer(p,"utf8"));if(c(f)){if(typeof p.length>"u")throw new Error("Not an array?");if(m=s(f),m!=="dynamic"&&m!==0&&p.length>m)throw new Error("Elements exceed array size: "+m);b=[],f=f.slice(0,f.lastIndexOf("[")),typeof p=="string"&&(p=JSON.parse(p));for(y in p)b.push(a(f,p[y]));if(m==="dynamic"){var g=a("uint256",p.length);b.unshift(g)}return Buffer.concat(b)}else{if(f==="bytes")return p=new Buffer(p),b=Buffer.concat([a("uint256",p.length),p]),p.length%32!==0&&(b=Buffer.concat([b,e.zeros(32-p.length%32)])),b;if(f.startsWith("bytes")){if(m=n(f),m<1||m>32)throw new Error("Invalid bytes<N> width: "+m);return e.setLengthRight(p,32)}else if(f.startsWith("uint")){if(m=n(f),m%8||m<8||m>256)throw new Error("Invalid uint<N> width: "+m);h=i(p);const _=e.bitLengthFromBigInt(h);if(_>m)throw new Error("Supplied uint exceeds width: "+m+" vs "+_);if(h<0)throw new Error("Supplied uint is negative");return e.bufferBEFromBigInt(h,32)}else if(f.startsWith("int")){if(m=n(f),m%8||m<8||m>256)throw new Error("Invalid int<N> width: "+m);h=i(p);const _=e.bitLengthFromBigInt(h);if(_>m)throw new Error("Supplied int exceeds width: "+m+" vs "+_);const w=e.twosFromBigInt(h,256);return e.bufferBEFromBigInt(w,32)}else if(f.startsWith("ufixed")){if(m=r(f),h=i(p),h<0)throw new Error("Supplied ufixed is negative");return a("uint256",h*BigInt(2)**BigInt(m[1]))}else if(f.startsWith("fixed"))return m=r(f),a("int256",i(p)*BigInt(2)**BigInt(m[1]))}throw new Error("Unsupported or invalid type: "+f)}function o(f){return f==="string"||f==="bytes"||s(f)==="dynamic"}function c(f){return f.lastIndexOf("]")===f.length-1}function u(f,p){var m=[],h=[],b=32*f.length;for(var y in f){var g=t(f[y]),_=p[y],w=a(g,_);o(g)?(m.push(a("uint256",b)),h.push(w),b+=w.length):m.push(w)}return Buffer.concat(m.concat(h))}function l(f,p){if(f.length!==p.length)throw new Error("Number of types are not matching the values");for(var m,h,b=[],y=0;y<f.length;y++){var g=t(f[y]),_=p[y];if(g==="bytes")b.push(_);else if(g==="string")b.push(new Buffer(_,"utf8"));else if(g==="bool")b.push(new Buffer(_?"01":"00","hex"));else if(g==="address")b.push(e.setLength(_,20));else if(g.startsWith("bytes")){if(m=n(g),m<1||m>32)throw new Error("Invalid bytes<N> width: "+m);b.push(e.setLengthRight(_,m))}else if(g.startsWith("uint")){if(m=n(g),m%8||m<8||m>256)throw new Error("Invalid uint<N> width: "+m);h=i(_);const w=e.bitLengthFromBigInt(h);if(w>m)throw new Error("Supplied uint exceeds width: "+m+" vs "+w);b.push(e.bufferBEFromBigInt(h,m/8))}else if(g.startsWith("int")){if(m=n(g),m%8||m<8||m>256)throw new Error("Invalid int<N> width: "+m);h=i(_);const w=e.bitLengthFromBigInt(h);if(w>m)throw new Error("Supplied int exceeds width: "+m+" vs "+w);const x=e.twosFromBigInt(h,m);b.push(e.bufferBEFromBigInt(x,m/8))}else throw new Error("Unsupported or invalid type: "+g)}return Buffer.concat(b)}function d(f,p){return e.keccak(l(f,p))}return Ws={rawEncode:u,solidityPack:l,soliditySHA3:d},Ws}var Vs,eu;function Gv(){if(eu)return Vs;eu=1;const e=$f(),t=zv(),n={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},r={encodeData(i,a,o,c=!0){const u=["bytes32"],l=[this.hashType(i,o)];if(c){const d=(f,p,m)=>{if(o[p]!==void 0)return["bytes32",m==null?"0x0000000000000000000000000000000000000000000000000000000000000000":e.keccak(this.encodeData(p,m,o,c))];if(m===void 0)throw new Error(`missing value for field ${f} of type ${p}`);if(p==="bytes")return["bytes32",e.keccak(m)];if(p==="string")return typeof m=="string"&&(m=Buffer.from(m,"utf8")),["bytes32",e.keccak(m)];if(p.lastIndexOf("]")===p.length-1){const h=p.slice(0,p.lastIndexOf("[")),b=m.map(y=>d(f,h,y));return["bytes32",e.keccak(t.rawEncode(b.map(([y])=>y),b.map(([,y])=>y)))]}return[p,m]};for(const f of o[i]){const[p,m]=d(f.name,f.type,a[f.name]);u.push(p),l.push(m)}}else for(const d of o[i]){let f=a[d.name];if(f!==void 0)if(d.type==="bytes")u.push("bytes32"),f=e.keccak(f),l.push(f);else if(d.type==="string")u.push("bytes32"),typeof f=="string"&&(f=Buffer.from(f,"utf8")),f=e.keccak(f),l.push(f);else if(o[d.type]!==void 0)u.push("bytes32"),f=e.keccak(this.encodeData(d.type,f,o,c)),l.push(f);else{if(d.type.lastIndexOf("]")===d.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");u.push(d.type),l.push(f)}}return t.rawEncode(u,l)},encodeType(i,a){let o="",c=this.findTypeDependencies(i,a).filter(u=>u!==i);c=[i].concat(c.sort());for(const u of c){if(!a[u])throw new Error("No type definition specified: "+u);o+=u+"("+a[u].map(({name:d,type:f})=>f+" "+d).join(",")+")"}return o},findTypeDependencies(i,a,o=[]){if(i=i.match(/^\w*/)[0],o.includes(i)||a[i]===void 0)return o;o.push(i);for(const c of a[i])for(const u of this.findTypeDependencies(c.type,a,o))!o.includes(u)&&o.push(u);return o},hashStruct(i,a,o,c=!0){return e.keccak(this.encodeData(i,a,o,c))},hashType(i,a){return e.keccak(this.encodeType(i,a))},sanitizeData(i){const a={};for(const o in n.properties)i[o]&&(a[o]=i[o]);return a.types&&(a.types=Object.assign({EIP712Domain:[]},a.types)),a},hash(i,a=!0){const o=this.sanitizeData(i),c=[Buffer.from("1901","hex")];return c.push(this.hashStruct("EIP712Domain",o.domain,o.types,a)),o.primaryType!=="EIP712Domain"&&c.push(this.hashStruct(o.primaryType,o.message,o.types,a)),e.keccak(Buffer.concat(c))}};Vs={TYPED_MESSAGE_SCHEMA:n,TypedDataUtils:r,hashForSignTypedDataLegacy:function(i){return s(i.data)},hashForSignTypedData_v3:function(i){return r.hash(i.data,!1)},hashForSignTypedData_v4:function(i){return r.hash(i.data)}};function s(i){const a=new Error("Expect argument to be non-empty array");if(typeof i!="object"||!i.length)throw a;const o=i.map(function(l){return l.type==="bytes"?e.toBuffer(l.value):l.value}),c=i.map(function(l){return l.type}),u=i.map(function(l){if(!l.name)throw a;return l.type+" "+l.name});return t.soliditySHA3(["bytes32","bytes32"],[t.soliditySHA3(new Array(i.length).fill("string"),u),t.soliditySHA3(c,o)])}return Vs}var Hv=Gv();const vr=Hf(Hv),qv="walletUsername",ia="Addresses",Wv="AppVersion";class Vv{constructor(t){this.secret=t}async encrypt(t){const n=this.secret;if(n.length!==64)throw new Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.importKey("raw",Pr(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},s,i.encode(t)),o=16,c=a.slice(a.byteLength-o),u=a.slice(0,a.byteLength-o),l=new Uint8Array(c),d=new Uint8Array(u),f=new Uint8Array([...r,...l,...d]);return ba(f)}async decrypt(t){const n=this.secret;if(n.length!==64)throw new Error("secret must be 256 bits");return new Promise((r,s)=>{(async()=>{const i=await crypto.subtle.importKey("raw",Pr(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=Pr(t),o=a.slice(0,12),c=a.slice(12,28),u=a.slice(28),l=new Uint8Array([...u,...c]),d={name:"AES-GCM",iv:new Uint8Array(o)};try{const f=await window.crypto.subtle.decrypt(d,i,l),p=new TextDecoder;r(p.decode(f))}catch(f){s(f)}})()})}}class Kv{constructor(t,n,r){this.linkAPIUrl=t,this.sessionId=n;const s=`${n}:${r}`;this.auth=`Basic ${btoa(s)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.map(n=>fetch(`${this.linkAPIUrl}/events/${n.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(n=>console.error("Unable to mark events as seen:",n))}async fetchUnseenEvents(){var t;const n=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(n.ok){const{events:r,error:s}=await n.json();if(s)throw new Error(`Check unseen events failed: ${s}`);const i=(t=r?.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&t!==void 0?t:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${n.status}`)}}var He;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(He||(He={}));class _e{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,n=WebSocket){this.WebSocketClass=n,this.webSocket=null,this.isDisconnecting=!1,this.url=t.replace(/^http/,"ws"),this.instanceId=_e.instanceCounter++,_e.activeInstances.add(this.instanceId)}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");if(this.isDisconnecting)throw new Error("WebSocket is disconnecting, cannot reconnect on same instance");return new Promise((t,n)=>{var r;let s;try{this.webSocket=s=new this.WebSocketClass(this.url)}catch(i){n(i);return}(r=this.connectionStateListener)===null||r===void 0||r.call(this,He.CONNECTING),s.onclose=i=>{var a;this.clearWebSocket(),s.readyState!==WebSocket.OPEN&&n(new Error(`websocket error ${i.code}: ${i.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,He.DISCONNECTED)},s.onopen=i=>{var a;t(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,He.CONNECTED),_e.pendingData.length>0&&([..._e.pendingData].forEach(c=>this.sendData(c)),_e.pendingData=[])},s.onmessage=i=>{var a,o;if(i.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(i.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var t;const{webSocket:n}=this;if(n){this.isDisconnecting=!0,this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,He.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{n.close()}catch{}}}sendData(t){const{webSocket:n}=this;if(!n){_e.pendingData.push(t),this.isDisconnecting||this.connect();return}if(n.readyState!==WebSocket.OPEN){_e.pendingData.push(t);return}n.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}cleanup(){_e.activeInstances.delete(this.instanceId)}}_e.instanceCounter=0;_e.activeInstances=new Set;_e.pendingData=[];const tu=1e4,Jv=6e4;class Zv{constructor({session:t,linkAPIUrl:n,listener:r}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Xe(1),this.reconnectAttempts=0,this.isReconnecting=!1,this._connected=!1,this._linked=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=i=>{if(!i)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",o=>i.JsonRpcUrl&&this.handleChainUpdated(o,i.JsonRpcUrl)]]).forEach((o,c)=>{const u=i[c];u!==void 0&&o(u)})},this.handleDestroyed=i=>{var a;i==="1"&&((a=this.listener)===null||a===void 0||a.resetAndReload())},this.handleAccountUpdated=async i=>{var a;try{const o=await this.cipher.decrypt(i);(a=this.listener)===null||a===void 0||a.accountUpdated(o)}catch{}},this.handleMetadataUpdated=async(i,a)=>{var o;try{const c=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.metadataUpdated(i,c)}catch{}},this.handleWalletUsernameUpdated=async i=>{this.handleMetadataUpdated(qv,i)},this.handleAppVersionUpdated=async i=>{this.handleMetadataUpdated(Wv,i)},this.handleChainUpdated=async(i,a)=>{var o;try{const c=await this.cipher.decrypt(i),u=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.chainUpdated(c,u)}catch{}},this.session=t,this.cipher=new Vv(t.secret),this.listener=r,this.linkAPIUrl=n,this.WebSocketClass=WebSocket;const s=this.createWebSocket();this.ws=s,this.http=new Kv(n,t.id,t.key),this.setupVisibilityChangeHandler()}createWebSocket(){const t=new _e(`${this.linkAPIUrl}/rpc`,this.WebSocketClass);return this.activeWsInstance=t,t.setConnectionStateListener(async n=>{if(t!==this.activeWsInstance)return;let r=!1;switch(n){case He.DISCONNECTED:this.heartbeatIntervalId&&(clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=void 0),this.lastHeartbeatResponse=0,r=!1,this.destroyed||(async()=>{if(this.isReconnecting)return;this.isReconnecting=!0;const i=this.reconnectAttempts===0?0:3e3;await new Promise(a=>setTimeout(a,i)),!this.destroyed&&t===this.activeWsInstance?(this.reconnectAttempts++,"cleanup"in this.ws&&typeof this.ws.cleanup=="function"&&this.ws.cleanup(),this.ws=this.createWebSocket(),this.ws.connect().catch(()=>{Wc()}).finally(()=>{this.isReconnecting=!1})):this.isReconnecting=!1})();break;case He.CONNECTED:this.reconnectAttempts=0;try{r=await this.handleConnected(),this.fetchUnseenEventsAPI().catch(()=>{})}catch{break}this.connected=r,this.updateLastHeartbeat(),this.heartbeatIntervalId&&clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=window.setInterval(()=>{this.heartbeat()},tu),setTimeout(()=>{this.heartbeat()},100);break;case He.CONNECTING:break}n!==He.CONNECTED&&(this.connected=r)}),t.setIncomingDataListener(n=>{var r;switch(n.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const s=n.type==="IsLinkedOK"?n.linked:void 0;this.linked=s||n.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(n.metadata);break}case"Event":{this.handleIncomingEvent(n);break}}n.id!==void 0&&((r=this.requestResolutions.get(n.id))===null||r===void 0||r(n))}),t}setupVisibilityChangeHandler(){this.visibilityChangeHandler=()=>{!document.hidden&&!this.destroyed&&(this.connected?this.heartbeat():this.reconnectWithFreshWebSocket())},this.focusHandler=()=>{!this.destroyed&&!this.connected&&this.reconnectWithFreshWebSocket()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),window.addEventListener("focus",this.focusHandler),window.addEventListener("pageshow",t=>{t.persisted&&this.focusHandler&&this.focusHandler()})}reconnectWithFreshWebSocket(){if(this.destroyed)return;const t=this.ws;this.activeWsInstance=void 0,t.disconnect(),"cleanup"in t&&typeof t.cleanup=="function"&&t.cleanup(),this.ws=this.createWebSocket(),this.ws.connect().catch(()=>{Wc()})}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Xe(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.activeWsInstance=void 0,this.heartbeatIntervalId&&(clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=void 0),this.visibilityChangeHandler&&document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.focusHandler&&window.removeEventListener("focus",this.focusHandler),this.ws.disconnect(),"cleanup"in this.ws&&typeof this.ws.cleanup=="function"&&this.ws.cleanup(),this.listener=void 0)}get connected(){return this._connected}set connected(t){this._connected=t}get linked(){return this._linked}set linked(t){var n,r;this._linked=t,t&&((n=this.onceLinked)===null||n===void 0||n.call(this)),(r=this.listener)===null||r===void 0||r.linkedUpdated(t)}setOnceLinked(t){return new Promise(n=>{this.linked?t().then(n):this.onceLinked=()=>{t().then(n),this.onceLinked=void 0}})}async handleIncomingEvent(t){var n;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const r=await this.cipher.decrypt(t.data),s=JSON.parse(r);if(s.type!=="WEB3_RESPONSE")return;(n=this.listener)===null||n===void 0||n.handleWeb3ResponseMessage(s.id,s.response)}catch{}}async checkUnseenEvents(){await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){try{(await this.http.fetchUnseenEvents()).forEach(n=>{this.handleIncomingEvent(n)})}catch{jv()}}async publishEvent(t,n,r=!1){const s=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},n),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:Xe(this.nextReqId++),sessionId:this.session.id,event:t,data:s,callWebhook:r};return this.setOnceLinked(async()=>{const a=await this.makeRequest(i);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(t){this.ws.sendData(JSON.stringify(t))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>tu*2){this.ws.disconnect();return}if(this.connected)try{this.ws.sendData("h")}catch{}}async makeRequest(t,n={timeout:Jv}){const r=t.id;this.sendData(t);let s;return Promise.race([new Promise((i,a)=>{s=window.setTimeout(()=>{a(new Error(`request ${r} timed out`))},n.timeout)}),new Promise(i=>{this.requestResolutions.set(r,a=>{clearTimeout(s),i(a),this.requestResolutions.delete(r)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Xe(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Xe(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Xe(this.nextReqId++),sessionId:this.session.id}),!0)}}class Yv{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const t=this._nextRequestId,n=Uu(t.toString(16));return this.callbacks.get(n)&&this.callbacks.delete(n),t}}function Qv(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function mo(e,...t){if(!Qv(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function nu(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Xv(e,t){mo(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const Ks=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Ge=(e,t)=>e<<32-t|e>>>t;new Uint8Array(new Uint32Array([287454020]).buffer)[0];const e5=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function t5(e){mo(e);let t="";for(let n=0;n<e.length;n++)t+=e5[e[n]];return t}function n5(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Mf(e){return typeof e=="string"&&(e=n5(e)),mo(e),e}class r5{clone(){return this._cloneInto()}}function s5(e){const t=r=>e().update(Mf(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function i5(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),a=Number(n>>s&i),o=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,a,r),e.setUint32(t+u,o,r)}const a5=(e,t,n)=>e&t^~e&n,o5=(e,t,n)=>e&t^e&n^t&n;class c5 extends r5{constructor(t,n,r,s){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Ks(this.buffer)}update(t){nu(this);const{view:n,buffer:r,blockLen:s}=this;t=Mf(t);const i=t.length;for(let a=0;a<i;){const o=Math.min(s-this.pos,i-a);if(o===s){const c=Ks(t);for(;s<=i-a;a+=s)this.process(c,a);continue}r.set(t.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){nu(this),Xv(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:a}=this;n[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>s-a&&(this.process(r,0),a=0);for(let d=a;d<s;d++)n[d]=0;i5(r,s-8,BigInt(this.length*8),i),this.process(r,0);const o=Ks(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)o.setUint32(4*d,l[d],i)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:a,pos:o}=this;return t.length=s,t.pos=o,t.finished=i,t.destroyed=a,s%n&&t.buffer.set(r),t}}const u5=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),pt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ht=new Uint32Array(64);class d5 extends c5{constructor(){super(64,32,8,!1),this.A=pt[0]|0,this.B=pt[1]|0,this.C=pt[2]|0,this.D=pt[3]|0,this.E=pt[4]|0,this.F=pt[5]|0,this.G=pt[6]|0,this.H=pt[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:a,G:o,H:c}=this;return[t,n,r,s,i,a,o,c]}set(t,n,r,s,i,a,o,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)ht[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const f=ht[d-15],p=ht[d-2],m=Ge(f,7)^Ge(f,18)^f>>>3,h=Ge(p,17)^Ge(p,19)^p>>>10;ht[d]=h+ht[d-7]+m+ht[d-16]|0}let{A:r,B:s,C:i,D:a,E:o,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const f=Ge(o,6)^Ge(o,11)^Ge(o,25),p=l+f+a5(o,c,u)+u5[d]+ht[d]|0,h=(Ge(r,2)^Ge(r,13)^Ge(r,22))+o5(r,s,i)|0;l=u,u=c,c=o,o=a+p|0,a=i,i=s,s=r,r=p+h|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,s,i,a,o,c,u,l)}roundClean(){ht.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const l5=s5(()=>new d5),ru="session:id",su="session:secret",iu="session:linked";class Jt{constructor(t,n,r,s=!1){this.storage=t,this.id=n,this.secret=r,this.key=t5(l5(`${n}, ${r} WalletLink`)),this._linked=!!s}static create(t){const n=Et(16),r=Et(32);return new Jt(t,n,r).save()}static load(t){const n=t.getItem(ru),r=t.getItem(iu),s=t.getItem(su);return n&&s?new Jt(t,n,s,r==="1"):null}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this.storage.setItem(ru,this.id),this.storage.setItem(su,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(iu,this._linked?"1":"0")}}const f5=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";class p5{constructor(){this.root=null,this.darkMode=Hu()}attach(){const t=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",t.appendChild(this.root),zu()}present(t){this.render(t)}clear(){this.render(null)}render(t){this.root&&(Qs(null,this.root),t&&Qs(q(h5,Object.assign({},t,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const h5=({title:e,buttonText:t,darkMode:n,onButtonClick:r,onDismiss:s})=>{const i=n?"dark":"light";return q(Wu,{darkMode:n},q("div",{class:"-cbwsdk-redirect-dialog"},q("style",null,f5),q("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),q("div",{class:_n("-cbwsdk-redirect-dialog-box",i)},q("p",null,e),q("button",{onClick:r},t))))};class au{constructor(){this.attached=!1,this.redirectDialog=new p5}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(t){const n=new URL(K0);n.searchParams.append("redirect_url",ep().href),t&&n.searchParams.append("wl_url",t);const r=document.createElement("a");r.target="cbw-opener",r.href=n.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(t){this.redirectToCoinbaseWallet(t),setTimeout(()=>{this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(t)}})},99)}showConnecting(t){return()=>{this.redirectDialog.clear()}}}class et{constructor(t){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=tp(),this.linkedUpdated=i=>{this.isLinked=i;const a=this.storage.getItem(ia);if(i&&(this._session.linked=i),this.isUnlinkedErrorState=!1,a){const o=a.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!i&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(i,a)=>{this.storage.setItem(i,a)},this.chainUpdated=(i,a)=>{this.chainCallbackParams.chainId===i&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:i,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(a,Number.parseInt(i,10)))},this.accountUpdated=i=>{this.accountsCallback&&this.accountsCallback([i]),et.accountRequestCallbackIds.size>0&&(Array.from(et.accountRequestCallbackIds.values()).forEach(a=>{this.invokeCallback(a,{method:"requestEthereumAccounts",result:[i]})}),et.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=t.linkAPIUrl,this.storage=t.storage,this.metadata=t.metadata,this.accountsCallback=t.accountsCallback,this.chainCallback=t.chainCallback;const{session:n,ui:r,connection:s}=this.subscribe();this._session=n,this.connection=s,this.relayEventManager=new Yv,this.ui=r,this.ui.attach()}subscribe(){const t=Jt.load(this.storage)||Jt.create(this.storage),{linkAPIUrl:n}=this,r=new Zv({session:t,linkAPIUrl:n,listener:this}),s=this.isMobileWeb?new au:new ap;return r.connect(),{session:t,ui:s,connection:r}}resetAndReload(){this.connection.destroy().then(()=>{const t=Jt.load(this.storage);t?.id===this._session.id&&St.clearAll(),document.location.reload()}).catch(t=>{})}signEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:De(t.weiValue),data:wn(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?De(t.gasPriceInWei):null,maxFeePerGas:t.gasPriceInWei?De(t.gasPriceInWei):null,maxPriorityFeePerGas:t.gasPriceInWei?De(t.gasPriceInWei):null,gasLimit:t.gasLimit?De(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:De(t.weiValue),data:wn(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?De(t.gasPriceInWei):null,maxFeePerGas:t.maxFeePerGas?De(t.maxFeePerGas):null,maxPriorityFeePerGas:t.maxPriorityFeePerGas?De(t.maxPriorityFeePerGas):null,gasLimit:t.gasLimit?De(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!0}})}submitEthereumTransaction(t,n){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:wn(t,!0),chainId:n}})}getWalletLinkSession(){return this._session}sendRequest(t){let n=null;const r=Et(8),s=i=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t.method,i),n?.()};return new Promise((i,a)=>{n=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:s,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,o=>{if(n?.(),de(o))return a(new Error(o.errorMessage));i(o)}),this.publishWeb3RequestEvent(r,t)})}publishWeb3RequestEvent(t,n){const r={type:"WEB3_REQUEST",id:t,request:n};this.publishEvent("Web3Request",r,!0).then(s=>{}).catch(s=>{this.handleWeb3ResponseMessage(r.id,{method:n.method,errorMessage:s.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(n.method)}openCoinbaseWalletDeeplink(t){if(this.ui instanceof au)switch(t){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(t){const n={type:"WEB3_REQUEST_CANCELED",id:t};this.publishEvent("Web3RequestCanceled",n,!1).then()}publishEvent(t,n,r){return this.connection.publishEvent(t,n,r)}handleWeb3ResponseMessage(t,n){if(n.method==="requestEthereumAccounts"){et.accountRequestCallbackIds.forEach(r=>this.invokeCallback(r,n)),et.accountRequestCallbackIds.clear();return}this.invokeCallback(t,n)}handleErrorResponse(t,n,r){var s;const i=(s=r?.message)!==null&&s!==void 0?s:"Unspecified error message.";this.handleWeb3ResponseMessage(t,{method:n,errorMessage:i})}invokeCallback(t,n){const r=this.relayEventManager.callbacks.get(t);r&&(r(n),this.relayEventManager.callbacks.delete(t))}requestEthereumAccounts(){const{appName:t,appLogoUrl:n}=this.metadata,r={method:"requestEthereumAccounts",params:{appName:t,appLogoUrl:n}},s=Et(8);return new Promise((i,a)=>{this.relayEventManager.callbacks.set(s,o=>{if(de(o))return a(new Error(o.errorMessage));i(o)}),et.accountRequestCallbackIds.add(s),this.publishWeb3RequestEvent(s,r)})}watchAsset(t,n,r,s,i,a){const o={method:"watchAsset",params:{type:t,options:{address:n,symbol:r,decimals:s,image:i},chainId:a}};let c=null;const u=Et(8),l=d=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,o.method,d),c?.()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}),new Promise((d,f)=>{this.relayEventManager.callbacks.set(u,p=>{if(c?.(),de(p))return f(new Error(p.errorMessage));d(p)}),this.publishWeb3RequestEvent(u,o)})}addEthereumChain(t,n,r,s,i,a){const o={method:"addEthereumChain",params:{chainId:t,rpcUrls:n,blockExplorerUrls:s,chainName:i,iconUrls:r,nativeCurrency:a}};let c=null;const u=Et(8),l=d=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,o.method,d),c?.()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}),new Promise((d,f)=>{this.relayEventManager.callbacks.set(u,p=>{if(c?.(),de(p))return f(new Error(p.errorMessage));d(p)}),this.publishWeb3RequestEvent(u,o)})}switchEthereumChain(t,n){const r={method:"switchEthereumChain",params:Object.assign({chainId:t},{address:n})};let s=null;const i=Et(8),a=o=>{this.publishWeb3RequestCanceledEvent(i),this.handleErrorResponse(i,r.method,o),s?.()};return s=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:a,onResetConnection:this.resetAndReload}),new Promise((o,c)=>{this.relayEventManager.callbacks.set(i,u=>{if(s?.(),de(u)&&u.errorCode)return c(B.provider.custom({code:u.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(de(u))return c(new Error(u.errorMessage));o(u)}),this.publishWeb3RequestEvent(i,r)})}}et.accountRequestCallbackIds=new Set;const ou="DefaultChainId",cu="DefaultJsonRpcUrl";class Nf{constructor(t){this._relay=null,this._addresses=[],this.metadata=t.metadata,this._storage=new St("walletlink",Ro),this.callback=t.callback||null;const n=this._storage.getItem(ia);if(n){const r=n.split(" ");r[0]!==""&&(this._addresses=r.map(s=>ct(s)))}this.initializeRelay()}getSession(){const t=this.initializeRelay(),{id:n,secret:r}=t.getWalletLinkSession();return{id:n,secret:r}}async handshake(t){const n="eth_requestAccounts",r=Ce.get(t);Cv({method:n,correlationId:r});try{await this._eth_requestAccounts(),$v({method:n,correlationId:r})}catch(s){throw Bv({method:n,correlationId:r,errorMessage:Pt(s)}),s}}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var t;return(t=this._storage.getItem(cu))!==null&&t!==void 0?t:void 0}set jsonRpcUrl(t){this._storage.setItem(cu,t)}updateProviderInfo(t,n){var r;this.jsonRpcUrl=t;const s=this.getChainId();this._storage.setItem(ou,n.toString(10)),vn(n)!==s&&((r=this.callback)===null||r===void 0||r.call(this,"chainChanged",Ft(n)))}async watchAsset(t){const n=Array.isArray(t)?t[0]:t;if(!n.type)throw B.rpc.invalidParams("Type is required");if(n?.type!=="ERC20")throw B.rpc.invalidParams(`Asset of type '${n.type}' is not supported`);if(!n?.options)throw B.rpc.invalidParams("Options are required");if(!n?.options.address)throw B.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:s,symbol:i,image:a,decimals:o}=n.options,u=await this.initializeRelay().watchAsset(n.type,s,i,o,a,r?.toString());return de(u)?!1:!!u.result}async addEthereumChain(t){var n,r;const s=t[0];if(((n=s.rpcUrls)===null||n===void 0?void 0:n.length)===0)throw B.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!s.chainName||s.chainName.trim()==="")throw B.rpc.invalidParams("chainName is a required field");if(!s.nativeCurrency)throw B.rpc.invalidParams("nativeCurrency is a required field");const i=Number.parseInt(s.chainId,16);if(i===this.getChainId())return!1;const a=this.initializeRelay(),{rpcUrls:o=[],blockExplorerUrls:c=[],chainName:u,iconUrls:l=[],nativeCurrency:d}=s,f=await a.addEthereumChain(i.toString(),o,l,c,u,d);if(de(f))return!1;if(((r=f.result)===null||r===void 0?void 0:r.isApproved)===!0)return this.updateProviderInfo(o[0],i),null;throw B.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(t){const n=t[0],r=Number.parseInt(n.chainId,16),i=await this.initializeRelay().switchEthereumChain(r.toString(10),this.selectedAddress||void 0);if(de(i))throw i;const a=i.result;return a.isApproved&&a.rpcUrl.length>0&&this.updateProviderInfo(a.rpcUrl,r),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(t,n){var r;if(!Array.isArray(t))throw new Error("addresses is not an array");const s=t.map(i=>ct(i));JSON.stringify(s)!==JSON.stringify(this._addresses)&&(this._addresses=s,(r=this.callback)===null||r===void 0||r.call(this,"accountsChanged",s),this._storage.setItem(ia,s.join(" ")))}async request(t){const n=Ce.get(t);Mv({method:t.method,correlationId:n});try{const r=await this._request(t);return Rv({method:t.method,correlationId:n}),r}catch(r){throw Nv({method:t.method,correlationId:n,errorMessage:Pt(r)}),r}}async _request(t){const n=t.params||[];switch(t.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return Ft(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(t);case"personal_sign":return this.personalSign(t);case"eth_signTransaction":return this._eth_signTransaction(n);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(n);case"eth_sendTransaction":return this._eth_sendTransaction(n);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(t);case"wallet_addEthereumChain":return this.addEthereumChain(n);case"wallet_switchEthereumChain":return this.switchEthereumChain(n);case"wallet_watchAsset":return this.watchAsset(n);default:if(!this.jsonRpcUrl)throw B.rpc.internal("No RPC URL set for chain");return xn(t,this.jsonRpcUrl)}}_ensureKnownAddress(t){const n=ct(t);if(!this._addresses.map(s=>ct(s)).includes(n))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(t){const n=t.from?ct(t.from):this.selectedAddress;if(!n)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(n);const r=t.to?ct(t.to):null,s=t.value!=null?pn(t.value):BigInt(0),i=t.data?ii(t.data):Buffer.alloc(0),a=t.nonce!=null?vn(t.nonce):null,o=t.gasPrice!=null?pn(t.gasPrice):null,c=t.maxFeePerGas!=null?pn(t.maxFeePerGas):null,u=t.maxPriorityFeePerGas!=null?pn(t.maxPriorityFeePerGas):null,l=t.gas!=null?pn(t.gas):null,d=t.chainId?vn(t.chainId):this.getChainId();return{fromAddress:n,toAddress:r,weiValue:s,data:i,nonce:a,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:u,gasLimit:l,chainId:d}}async ecRecover(t){const{method:n,params:r}=t;if(!Array.isArray(r))throw B.rpc.invalidParams();const i=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:Ps(r[0]),signature:Ps(r[1]),addPrefix:n==="personal_ecRecover"}});if(de(i))throw i;return i.result}getChainId(){var t;return Number.parseInt((t=this._storage.getItem(ou))!==null&&t!==void 0?t:"1",10)}async _eth_requestAccounts(){var t,n;if(this._addresses.length>0)return(t=this.callback)===null||t===void 0||t.call(this,"connect",{chainId:Ft(this.getChainId())}),this._addresses;const s=await this.initializeRelay().requestEthereumAccounts();if(de(s))throw s;if(!s.result)throw new Error("accounts received is empty");return this._setAddresses(s.result),(n=this.callback)===null||n===void 0||n.call(this,"connect",{chainId:Ft(this.getChainId())}),this._addresses}async personalSign({params:t}){if(!Array.isArray(t))throw B.rpc.invalidParams();const n=t[1],r=t[0];this._ensureKnownAddress(n);const i=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ct(n),message:Ps(r),addPrefix:!0,typedDataJson:null}});if(de(i))throw i;return i.result}async _eth_signTransaction(t){const n=this._prepareTransactionParams(t[0]||{}),s=await this.initializeRelay().signEthereumTransaction(n);if(de(s))throw s;return s.result}async _eth_sendRawTransaction(t){const n=ii(t[0]),s=await this.initializeRelay().submitEthereumTransaction(n,this.getChainId());if(de(s))throw s;return s.result}async _eth_sendTransaction(t){const n=this._prepareTransactionParams(t[0]||{}),s=await this.initializeRelay().signAndSubmitEthereumTransaction(n);if(de(s))throw s;return s.result}async signTypedData(t){const{method:n,params:r}=t;if(!Array.isArray(r))throw B.rpc.invalidParams();const s=u=>{const l={eth_signTypedData_v1:vr.hashForSignTypedDataLegacy,eth_signTypedData_v3:vr.hashForSignTypedData_v3,eth_signTypedData_v4:vr.hashForSignTypedData_v4,eth_signTypedData:vr.hashForSignTypedData_v4};return wn(l[n]({data:R0(u)}),!0)},i=r[n==="eth_signTypedData_v1"?1:0],a=r[n==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(i);const c=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:ct(i),message:s(a),typedDataJson:JSON.stringify(a,null,2),addPrefix:!1}});if(de(c))throw c;return c.result}initializeRelay(){return this._relay||(this._relay=new et({linkAPIUrl:Ro,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const Rf="SignerType",jf=new St("CBWSDK","SignerConfigurator");function m5(){return jf.getItem(Rf)}function b5(e){jf.setItem(Rf,e)}function uu(e){if(e)return e instanceof Cf?"scw":"walletlink"}async function y5(e){const{communicator:t,metadata:n,handshakeRequest:r,callback:s}=e;w5(t,n,s,r).catch(()=>{});const i={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},e.preference),{handshakeRequest:r})},{data:a}=await t.postRequestAndWaitForResponse(i);return a}function g5(e){const{signerType:t,metadata:n,communicator:r,callback:s}=e;switch(t){case"scw":return new Cf({metadata:n,callback:s,communicator:r});case"walletlink":return new Nf({metadata:n,callback:s})}}async function w5(e,t,n,r){await e.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const s=new Nf({metadata:t,callback:n});e.postMessage({event:"WalletLinkUpdate",data:{session:s.getSession()}}),await s.handshake(r),e.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var v5=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n};class x5 extends mp{constructor(t){var{metadata:n}=t,r=t.preference,{keysUrl:s}=r,i=v5(r,["keysUrl"]);super(),this.signer=null,this.isCoinbaseWallet=!0,this.metadata=n,this.preference=i,this.communicator=new fp({url:s,metadata:n,preference:i});const a=m5();a&&(this.signer=this.initSigner(a),bp({signerType:a}))}async request(t){const n=crypto.randomUUID();Ce.set(t,n),yp({method:t.method,correlationId:n});try{const r=await this._request(t);return wp({method:t.method,signerType:uu(this.signer),correlationId:n}),r}catch(r){throw gp({method:t.method,correlationId:n,signerType:uu(this.signer),errorMessage:r instanceof Error?r.message:""}),r}finally{Ce.delete(t)}}async _request(t){try{if(q0(t),!this.signer)switch(t.method){case"eth_requestAccounts":{let r;const s=$.subAccountsConfig.get();s?.enableAutoSubAccounts?r="scw":r=await this.requestSignerSelection(t);const i=this.initSigner(r);r==="scw"&&s?.enableAutoSubAccounts?(await i.handshake({method:"handshake"}),await i.request(t)):await i.handshake(t),this.signer=i,b5(r);break}case"wallet_connect":{const r=this.initSigner("scw");await r.handshake({method:"handshake"});const s=await r.request(t);return this.signer=r,s}case"wallet_sendCalls":case"wallet_sign":{const r=this.initSigner("scw");await r.handshake({method:"handshake"});const s=await r.request(t);return await r.cleanup(),s}case"wallet_getCallsStatus":return await xn(t,Fu);case"net_version":return 1;case"eth_chainId":return Ft(1);default:throw B.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")}return await this.signer.request(t)}catch(n){const{code:r}=n;return r===X.provider.unauthorized&&this.disconnect(),Promise.reject(pp(n))}}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),vp(),await this.request({method:"eth_requestAccounts"})}async disconnect(){var t;await((t=this.signer)===null||t===void 0?void 0:t.cleanup()),this.signer=null,St.clearAll(),Ce.clear(),this.emit("disconnect",B.provider.disconnected("User initiated disconnection"))}async requestSignerSelection(t){xp();const n=await y5({communicator:this.communicator,preference:this.preference,metadata:this.metadata,handshakeRequest:t,callback:this.emit.bind(this)});return _p(n),n}initSigner(t){return g5({signerType:t,metadata:this.metadata,communicator:this.communicator,callback:this.emit.bind(this)})}}function _5(e){var t;const n={metadata:e.metadata,preference:e.preference};return(t=H0(n))!==null&&t!==void 0?t:new x5(n)}const E5={options:"all"};function P5(e){var t,n,r,s;const i={metadata:{appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||"",appChainIds:e.appChainIds||[]},preference:Object.assign(E5,(t=e.preference)!==null&&t!==void 0?t:{}),paymasterUrls:e.paymasterUrls};!((n=e.subAccounts)===null||n===void 0)&&n.toOwnerAccount&&No(e.subAccounts.toOwnerAccount),$.subAccountsConfig.set({toOwnerAccount:(r=e.subAccounts)===null||r===void 0?void 0:r.toOwnerAccount,enableAutoSubAccounts:(s=e.subAccounts)===null||s===void 0?void 0:s.enableAutoSubAccounts}),$.config.set(i),$.persist.rehydrate(),U0(),i.preference.telemetry!==!1&&I0(),W0(i.preference);let a=null;const o={getProvider(){return a||(a=_5(i)),a.sdk=o,a},subAccount:{async create(c){var u,l;const d=$.getState();return Pe((u=d.subAccount)===null||u===void 0?void 0:u.address,new Error("subaccount already exists")),await((l=o.getProvider())===null||l===void 0?void 0:l.request({method:"wallet_addSubAccount",params:[{version:"1",account:c}]}))},async get(){var c,u;const l=$.subAccounts.get();if(l?.address)return l;const f=(u=(await((c=o.getProvider())===null||c===void 0?void 0:c.request({method:"wallet_connect",params:[{version:"1",capabilities:{}}]}))).accounts[0].capabilities)===null||u===void 0?void 0:u.subAccounts;return Array.isArray(f)?f[0]:null},async addOwner({address:c,publicKey:u,chainId:l}){var d,f;const p=$.subAccounts.get(),m=$.account.get();Pe(m,new Error("account does not exist")),Pe(p?.address,new Error("subaccount does not exist"));const h=[];if(u){const[b,y]=Nt([{type:"bytes32"},{type:"bytes32"}],u);h.push({to:p.address,data:ie({abi:$e,functionName:"addOwnerPublicKey",args:[b,y]}),value:ge(0)})}return c&&h.push({to:p.address,data:ie({abi:$e,functionName:"addOwnerAddress",args:[c]}),value:ge(0)}),await((d=o.getProvider())===null||d===void 0?void 0:d.request({method:"wallet_sendCalls",params:[{calls:h,chainId:ge(l),from:(f=m.accounts)===null||f===void 0?void 0:f[0],version:"1"}]}))},setToOwnerAccount(c){No(c),$.subAccountsConfig.set({toOwnerAccount:c})}}};return o}const u2=Object.freeze(Object.defineProperty({__proto__:null,createCoinbaseWalletSDK:P5,getCryptoKeyAccount:Kr},Symbol.toStringTag,{value:"Module"}));export{P as B,En as H,ky as a,pe as b,ds as c,$d as d,ke as e,fe as f,$a as g,u2 as h,ln as i,hs as l,ae as s};
|